Don't refer to odbcinst.ini by absolute path. SQLGetPrivateProfileString

handles this.

Don't install our own odbcinst.ini.  That's the driver manager's business.
This commit is contained in:
Peter Eisentraut 2001-09-23 13:32:24 +00:00
parent bb2bf2d401
commit 091a7659d4
3 changed files with 14 additions and 17 deletions

View File

@ -2,7 +2,7 @@
# #
# GNUMakefile for psqlodbc (Postgres ODBC driver) # GNUMakefile for psqlodbc (Postgres ODBC driver)
# #
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.20 2001/09/22 22:54:32 petere Exp $ # $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.21 2001/09/23 13:32:24 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -19,7 +19,7 @@ endif
SO_MAJOR_VERSION = 0 SO_MAJOR_VERSION = 0
SO_MINOR_VERSION = 27 SO_MINOR_VERSION = 27
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -DODBCINSTDIR='"$(odbcinst_ini_dir)"' override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \ OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
@ -40,6 +40,7 @@ SHLIB_LINK += -liodbcinst
endif endif
ifeq ($(with_unixodbc)$(with_iodbc),nono) ifeq ($(with_unixodbc)$(with_iodbc),nono)
OBJS += gpps.o OBJS += gpps.o
override CPPFLAGS += -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
endif endif
all: all-lib all: all-lib
@ -54,16 +55,14 @@ LINK.shared += $(shlib_symbolic)
install: all installdirs install: all installdirs
$(INSTALL_DATA) $(srcdir)/odbcinst.ini $(DESTDIR)$(odbcinst_ini_dir)/odbcinst.ini
$(INSTALL_DATA) $(srcdir)/odbc.sql $(DESTDIR)$(datadir)/odbc.sql $(INSTALL_DATA) $(srcdir)/odbc.sql $(DESTDIR)$(datadir)/odbc.sql
$(MAKE) install-lib $(MAKE) install-lib
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(odbcinst_ini_dir) $(DESTDIR)$(datadir) $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(datadir)
uninstall: uninstall-lib uninstall: uninstall-lib
rm -f $(DESTDIR)$(datadir)/odbc.sql rm -f $(DESTDIR)$(datadir)/odbc.sql
# XXX Uninstall the .ini file as well?
clean distclean maintainer-clean: clean-lib clean distclean maintainer-clean: clean-lib
rm -f $(OBJS) rm -f $(OBJS)

View File

@ -22,20 +22,14 @@
#define UNKNOWNS_AS_DONTKNOW 1 #define UNKNOWNS_AS_DONTKNOW 1
#define UNKNOWNS_AS_LONGEST 2 #define UNKNOWNS_AS_LONGEST 2
/* INI File Stuff */ /* ODBC initialization files */
#ifndef WIN32 #ifndef WIN32
#define ODBC_INI ".odbc.ini" #define ODBC_INI ".odbc.ini"
#ifdef ODBCINSTDIR #define ODBCINST_INI "odbcinst.ini"
#define ODBCINST_INI ODBCINSTDIR "/odbcinst.ini"
#else #else
#define ODBCINST_INI "/etc/odbcinst.ini" #define ODBC_INI "ODBC.INI"
#define ODBCINST_INI "ODBCINST.INI"
#endif #endif
#else /* WIN32 */
#define ODBC_INI "ODBC.INI" /* ODBC initialization
* file */
#define ODBCINST_INI "ODBCINST.INI" /* ODBC Installation
* file */
#endif /* WIN32 */
#define INI_DSN DBMS_NAME /* Name of default #define INI_DSN DBMS_NAME /* Name of default

View File

@ -43,12 +43,16 @@
#define FALSE ((BOOL)0) #define FALSE ((BOOL)0)
#endif #endif
#ifndef ODBCINSTDIR
#error "ODBCINSTDIR must be defined to compile this file"
#endif
/* /*
* theIniFileName is searched for in: * theIniFileName is searched for in:
* $HOME/theIniFileName * $HOME/theIniFileName
* theIniFileName * theIniFileName
* ODBCINST_INI * ODBCINSTDIR/ODBCINST_INI
*/ */
DWORD DWORD
GetPrivateProfileString(const char *theSection, /* section name */ GetPrivateProfileString(const char *theSection, /* section name */
@ -102,7 +106,7 @@ GetPrivateProfileString(const char *theSection, /* section name */
{ {
aFile = (FILE *) fopen(theIniFileName, PG_BINARY_R); aFile = (FILE *) fopen(theIniFileName, PG_BINARY_R);
if (!aFile) if (!aFile)
aFile = (FILE *) fopen(ODBCINST_INI, PG_BINARY_R); aFile = (FILE *) fopen(ODBCINSTDIR "/" ODBCINST_INI, PG_BINARY_R);
} }
aLength = (theDefault == NULL) ? 0 : strlen(theDefault); aLength = (theDefault == NULL) ? 0 : strlen(theDefault);