1 | /******************************************************* |
---|---|
2 | * _odbcinst_ConfigModeINI |
3 | * |
4 | * Get first valid INI file name. If we can open it for read then we assume its valid. |
5 | * 1. ODBC_SYSTEM_DSN |
6 | * - /etc/odbc.ini |
7 | * 2. ODBC_USER_DSN |
8 | * - ODBCINI |
9 | * - ~/.odbc.ini |
10 | * - /home/.odbc.ini |
11 | * 3. ODBC_BOTH_DSN |
12 | * - ODBC_USER_DSN |
13 | * - ODBC_SYSTEM_DSN |
14 | * |
15 | ************************************************** |
16 | * This code was created by Peter Harvey @ CodeByDesign. |
17 | * Released under LGPL 28.JAN.99 |
18 | * |
19 | * Contributions from... |
20 | * ----------------------------------------------- |
21 | * Peter Harvey - pharvey@codebydesign.com |
22 | **************************************************/ |
23 | #include <config.h> |
24 | #include <odbcinstext.h> |
25 | |
26 | BOOL _odbcinst_ConfigModeINI( char *pszFileName ) |
27 | { |
28 | UWORD nConfigMode = __get_config_mode(); |
29 | |
30 | pszFileName[0] = '\0'; |
31 | |
32 | switch ( nConfigMode ) |
33 | { |
34 | case ODBC_SYSTEM_DSN: |
35 | if ( !_odbcinst_SystemINI( pszFileName, TRUE ) ) |
36 | return FALSE; |
37 | break; |
38 | case ODBC_USER_DSN: |
39 | if ( !_odbcinst_UserINI( pszFileName, TRUE ) ) |
40 | return FALSE; |
41 | break; |
42 | case ODBC_BOTH_DSN: |
43 | if ( !_odbcinst_UserINI( pszFileName, TRUE ) ) |
44 | { |
45 | if ( !_odbcinst_SystemINI( pszFileName, TRUE ) ) |
46 | return FALSE; |
47 | } |
48 | break; |
49 | default: |
50 | return FALSE; |
51 | } |
52 | |
53 | return TRUE; |
54 | } |
55 | |
56 |