Logo Search packages:      
Sourcecode: freetds version File versions

TDSCONNECTINFO* tds_read_config_info ( TDSSOCKET *  tds,
TDSLOGIN *  login,
TDSLOCALE *  locale 

tds_read_config_info() will fill the tds connect_info structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values

.tdsrc and freetds.conf have been added to make the package easier to integration with various Linux and *BSD distributions.

Definition at line 114 of file config.c.

References tds_alloc_connect(), tds_fix_connect(), tds_read_conf_file(), and tds_read_config_info().

Referenced by tds_read_config_info().

TDSCONNECTINFO *connect_info;
char *s;
char *path;
pid_t pid;
int opened = 0;

      /* allocate a new structure with hard coded and build-time defaults */
      connect_info = tds_alloc_connect(locale);
      if (!connect_info)
            return NULL;

      s = getenv("TDSDUMPCONFIG");
      if (s) {
            if (*s) {
                  opened = tdsdump_open(s);
            } else {
                  pid = getpid();
                  if (asprintf(&path, "/tmp/tdsconfig.log.%d", pid) >= 0) {
                        if (*path) {
                              opened = tdsdump_open(path);

      tdsdump_log(TDS_DBG_INFO1, "%L Attempting to read conf files.\n");
      if (!tds_read_conf_file(connect_info, login->server_name)) {
            /* fallback to interfaces file */
            tdsdump_log(TDS_DBG_INFO1, "%L Failed in reading conf file.  Trying interface files.\n");
            tds_read_interfaces(login->server_name, connect_info);

      if (parse_server_name_for_port(connect_info, login)) {
            tdsdump_log(TDS_DBG_INFO1, "Parsed servername, now %s on %d.\n", connect_info->server_name, login->port);


      /* And finally the login structure */
      tds_config_login(connect_info, login);

      if (opened) {
      return connect_info;

Generated by  Doxygen 1.6.0   Back to index