FreeTDS API
path.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2023 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tdsguard_eI8iNo9FExd6aRlc3im79S_
21 #define _tdsguard_eI8iNo9FExd6aRlc3im79S_
22 
23 #ifdef _WIN32
24 #include <wchar.h>
25 #endif
26 
27 #include <freetds/pushvis.h>
28 
29 #ifdef _WIN32
30 #define TDS_SDIR_SEPARATOR L"\\"
31 typedef wchar_t tds_dir_char;
32 #define tds_dir_open _wfopen
33 #define tds_dir_getenv _wgetenv
34 #define tds_dir_dup _wcsdup
35 #define tds_dir_len wcslen
36 #define tds_dir_cmp wcscmp
37 #define tds_dir_snprintf _snwprintf
38 #define TDS_DIR_(s) L ## s
39 #define TDS_DIR(s) TDS_DIR_(s)
40 #define tdsPRIdir "ls"
41 tds_dir_char *tds_dir_from_cstr(const char *path);
42 #else
43 #define TDS_SDIR_SEPARATOR "/"
44 typedef char tds_dir_char;
45 #define tds_dir_open fopen
46 #define tds_dir_getenv getenv
47 #define tds_dir_dup strdup
48 #define tds_dir_len strlen
49 #define tds_dir_cmp strcmp
50 #define tds_dir_snprintf snprintf
51 #define TDS_DIR(s) s
52 #define tdsPRIdir "s"
53 #define tds_dir_from_cstr(s) strdup(s)
54 #endif
55 
56 tds_dir_char *tds_get_homedir(void);
57 tds_dir_char* tds_join_path(const tds_dir_char *dir, const tds_dir_char *file);
58 tds_dir_char *tds_get_home_file(const tds_dir_char *file);
59 
60 #include <freetds/popvis.h>
61 
62 #endif /* _tdsguard_eI8iNo9FExd6aRlc3im79S_ */