Re: ct_config set CS_IFILE property is not working?

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Tue, 3 Jan 2012 09:07:31 +0100
dariusz ostolski <[email protected]> wrote:

> 1. Can You confirm that I cannot set custom path to interfaces file
> using ct_config?

Yes.  The FreeTDS function supports only three properties,  CS_IFILE
not among them.  

> 2. What alternatives do I have? I don't want to modify $SYBASE
> environment variable and I wouldn't like to use any function outside
> ct library?

USTL.  There's a static constant src/tds/config.c::interfaces_path.
Add to the case statement in ct_config, diddle just a bit with the
logic around config.c:1095:

		if (!sybase || !sybase[0])
			sybase = interfaces_path;

		...
		found = search_interface_file(login, sybase,
						"interfaces", server);

to something like:

	static const char default_interfaces_path[] = "/etc/freetds"; 
				// should be $PREFIX from configure
	/* interfaces_path can be set by ct_config CS_IFILE */
	const char *interfaces_path = default_interfaces_path;
	...
	if (interfaces_path == default_interfaces_path) {
		if (!sybase || !sybase[0])
			sybase = interfaces_path;
	} else {
			sybase = interfaces_path;
	}

and call it a day.  If you post such a patch, I'll include it in the
main branch.  

That's just a hack, though.  For extra credit, the path should be in
CS_CONTEXT.  

HTH.  

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.