PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
port.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * port.h
4  * Header for src/port/ compatibility functions.
5  *
6  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/port.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PG_PORT_H
14 #define PG_PORT_H
15 
16 #include <ctype.h>
17 #include <netdb.h>
18 #include <pwd.h>
19 
20 /* socket has a different definition on WIN32 */
21 #ifndef WIN32
22 typedef int pgsocket;
23 
24 #define PGINVALID_SOCKET (-1)
25 #else
26 typedef SOCKET pgsocket;
27 
28 #define PGINVALID_SOCKET INVALID_SOCKET
29 #endif
30 
31 /* non-blocking */
32 extern bool pg_set_noblock(pgsocket sock);
33 extern bool pg_set_block(pgsocket sock);
34 
35 /* Portable path handling for Unix/Win32 (in path.c) */
36 
37 extern bool has_drive_prefix(const char *filename);
38 extern char *first_dir_separator(const char *filename);
39 extern char *last_dir_separator(const char *filename);
40 extern char *first_path_var_separator(const char *pathlist);
41 extern void join_path_components(char *ret_path,
42  const char *head, const char *tail);
43 extern void canonicalize_path(char *path);
44 extern void make_native_path(char *path);
45 extern void cleanup_path(char *path);
46 extern bool path_contains_parent_reference(const char *path);
47 extern bool path_is_relative_and_below_cwd(const char *path);
48 extern bool path_is_prefix_of_path(const char *path1, const char *path2);
49 extern char *make_absolute_path(const char *path);
50 extern const char *get_progname(const char *argv0);
51 extern void get_share_path(const char *my_exec_path, char *ret_path);
52 extern void get_etc_path(const char *my_exec_path, char *ret_path);
53 extern void get_include_path(const char *my_exec_path, char *ret_path);
54 extern void get_pkginclude_path(const char *my_exec_path, char *ret_path);
55 extern void get_includeserver_path(const char *my_exec_path, char *ret_path);
56 extern void get_lib_path(const char *my_exec_path, char *ret_path);
57 extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
58 extern void get_locale_path(const char *my_exec_path, char *ret_path);
59 extern void get_doc_path(const char *my_exec_path, char *ret_path);
60 extern void get_html_path(const char *my_exec_path, char *ret_path);
61 extern void get_man_path(const char *my_exec_path, char *ret_path);
62 extern bool get_home_path(char *ret_path);
63 extern void get_parent_directory(char *path);
64 
65 /* common/pgfnames.c */
66 extern char **pgfnames(const char *path);
67 extern void pgfnames_cleanup(char **filenames);
68 
69 /*
70  * is_absolute_path
71  *
72  * By making this a macro we avoid needing to include path.c in libpq.
73  */
74 #ifndef WIN32
75 #define IS_DIR_SEP(ch) ((ch) == '/')
76 
77 #define is_absolute_path(filename) \
78 ( \
79  IS_DIR_SEP((filename)[0]) \
80 )
81 #else
82 #define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
83 
84 /* See path_is_relative_and_below_cwd() for how we handle 'E:abc'. */
85 #define is_absolute_path(filename) \
86 ( \
87  IS_DIR_SEP((filename)[0]) || \
88  (isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \
89  IS_DIR_SEP((filename)[2])) \
90 )
91 #endif
92 
93 /* Portable locale initialization (in exec.c) */
94 extern void set_pglocale_pgservice(const char *argv0, const char *app);
95 
96 /* Portable way to find binaries (in exec.c) */
97 extern int find_my_exec(const char *argv0, char *retpath);
98 extern int find_other_exec(const char *argv0, const char *target,
99  const char *versionstr, char *retpath);
100 
101 /* Windows security token manipulation (in exec.c) */
102 #ifdef WIN32
103 extern BOOL AddUserToTokenDacl(HANDLE hToken);
104 #endif
105 
106 
107 #if defined(WIN32) || defined(__CYGWIN__)
108 #define EXE ".exe"
109 #else
110 #define EXE ""
111 #endif
112 
113 #if defined(WIN32) && !defined(__CYGWIN__)
114 #define DEVNULL "nul"
115 #else
116 #define DEVNULL "/dev/null"
117 #endif
118 
119 /* Portable delay handling */
120 extern void pg_usleep(long microsec);
121 
122 /* Portable SQL-like case-independent comparisons and conversions */
123 extern int pg_strcasecmp(const char *s1, const char *s2);
124 extern int pg_strncasecmp(const char *s1, const char *s2, size_t n);
125 extern unsigned char pg_toupper(unsigned char ch);
126 extern unsigned char pg_tolower(unsigned char ch);
127 extern unsigned char pg_ascii_toupper(unsigned char ch);
128 extern unsigned char pg_ascii_tolower(unsigned char ch);
129 
130 #ifdef USE_REPL_SNPRINTF
131 
132 /*
133  * Versions of libintl >= 0.13 try to replace printf() and friends with
134  * macros to their own versions that understand the %$ format. We do the
135  * same, so disable their macros, if they exist.
136  */
137 #ifdef vsnprintf
138 #undef vsnprintf
139 #endif
140 #ifdef snprintf
141 #undef snprintf
142 #endif
143 #ifdef sprintf
144 #undef sprintf
145 #endif
146 #ifdef vfprintf
147 #undef vfprintf
148 #endif
149 #ifdef fprintf
150 #undef fprintf
151 #endif
152 #ifdef printf
153 #undef printf
154 #endif
155 
156 extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
157 extern int pg_snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3, 4);
158 extern int pg_sprintf(char *str, const char *fmt,...) pg_attribute_printf(2, 3);
159 extern int pg_vfprintf(FILE *stream, const char *fmt, va_list args);
160 extern int pg_fprintf(FILE *stream, const char *fmt,...) pg_attribute_printf(2, 3);
161 extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
162 
163 /*
164  * The GCC-specific code below prevents the pg_attribute_printf above from
165  * being replaced, and this is required because gcc doesn't know anything
166  * about pg_printf.
167  */
168 #ifdef __GNUC__
169 #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
170 #define snprintf(...) pg_snprintf(__VA_ARGS__)
171 #define sprintf(...) pg_sprintf(__VA_ARGS__)
172 #define vfprintf(...) pg_vfprintf(__VA_ARGS__)
173 #define fprintf(...) pg_fprintf(__VA_ARGS__)
174 #define printf(...) pg_printf(__VA_ARGS__)
175 #else
176 #define vsnprintf pg_vsnprintf
177 #define snprintf pg_snprintf
178 #define sprintf pg_sprintf
179 #define vfprintf pg_vfprintf
180 #define fprintf pg_fprintf
181 #define printf pg_printf
182 #endif
183 #endif /* USE_REPL_SNPRINTF */
184 
185 #if defined(WIN32)
186 /*
187  * Versions of libintl >= 0.18? try to replace setlocale() with a macro
188  * to their own versions. Remove the macro, if it exists, because it
189  * ends up calling the wrong version when the backend and libintl use
190  * different versions of msvcrt.
191  */
192 #if defined(setlocale)
193 #undef setlocale
194 #endif
195 
196 /*
197  * Define our own wrapper macro around setlocale() to work around bugs in
198  * Windows' native setlocale() function.
199  */
200 extern char *pgwin32_setlocale(int category, const char *locale);
201 
202 #define setlocale(a,b) pgwin32_setlocale(a,b)
203 #endif /* WIN32 */
204 
205 /* Portable prompt handling */
206 extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
207 
208 #ifdef WIN32
209 #define PG_SIGNAL_COUNT 32
210 #define kill(pid,sig) pgkill(pid,sig)
211 extern int pgkill(int pid, int sig);
212 #endif
213 
214 extern int pclose_check(FILE *stream);
215 
216 /* Global variable holding time zone information. */
217 #if defined(WIN32) || defined(__CYGWIN__)
218 #define TIMEZONE_GLOBAL _timezone
219 #define TZNAME_GLOBAL _tzname
220 #else
221 #define TIMEZONE_GLOBAL timezone
222 #define TZNAME_GLOBAL tzname
223 #endif
224 
225 #if defined(WIN32) || defined(__CYGWIN__)
226 /*
227  * Win32 doesn't have reliable rename/unlink during concurrent access.
228  */
229 extern int pgrename(const char *from, const char *to);
230 extern int pgunlink(const char *path);
231 
232 /* Include this first so later includes don't see these defines */
233 #ifdef WIN32_ONLY_COMPILER
234 #include <io.h>
235 #endif
236 
237 #define rename(from, to) pgrename(from, to)
238 #define unlink(path) pgunlink(path)
239 #endif /* defined(WIN32) || defined(__CYGWIN__) */
240 
241 /*
242  * Win32 also doesn't have symlinks, but we can emulate them with
243  * junction points on newer Win32 versions.
244  *
245  * Cygwin has its own symlinks which work on Win95/98/ME where
246  * junction points don't, so use those instead. We have no way of
247  * knowing what type of system Cygwin binaries will be run on.
248  * Note: Some CYGWIN includes might #define WIN32.
249  */
250 #if defined(WIN32) && !defined(__CYGWIN__)
251 extern int pgsymlink(const char *oldpath, const char *newpath);
252 extern int pgreadlink(const char *path, char *buf, size_t size);
253 extern bool pgwin32_is_junction(char *path);
254 
255 #define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
256 #define readlink(path, buf, size) pgreadlink(path, buf, size)
257 #endif
258 
259 extern bool rmtree(const char *path, bool rmtopdir);
260 
261 /*
262  * stat() is not guaranteed to set the st_size field on win32, so we
263  * redefine it to our own implementation that is.
264  *
265  * We must pull in sys/stat.h here so the system header definition
266  * goes in first, and we redefine that, and not the other way around.
267  *
268  * Some frontends don't need the size from stat, so if UNSAFE_STAT_OK
269  * is defined we don't bother with this.
270  */
271 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK)
272 #include <sys/stat.h>
273 extern int pgwin32_safestat(const char *path, struct stat * buf);
274 
275 #define stat(a,b) pgwin32_safestat(a,b)
276 #endif
277 
278 #if defined(WIN32) && !defined(__CYGWIN__)
279 
280 /*
281  * open() and fopen() replacements to allow deletion of open files and
282  * passing of other special options.
283  */
284 #define O_DIRECT 0x80000000
285 extern int pgwin32_open(const char *, int,...);
286 extern FILE *pgwin32_fopen(const char *, const char *);
287 
288 #ifndef FRONTEND
289 #define open(a,b,c) pgwin32_open(a,b,c)
290 #define fopen(a,b) pgwin32_fopen(a,b)
291 #endif
292 
293 /*
294  * Mingw-w64 headers #define popen and pclose to _popen and _pclose. We want
295  * to use our popen wrapper, rather than plain _popen, so override that. For
296  * consistency, use our version of pclose, too.
297  */
298 #ifdef popen
299 #undef popen
300 #endif
301 #ifdef pclose
302 #undef pclose
303 #endif
304 
305 /*
306  * system() and popen() replacements to enclose the command in an extra
307  * pair of quotes.
308  */
309 extern int pgwin32_system(const char *command);
310 extern FILE *pgwin32_popen(const char *command, const char *type);
311 
312 #define system(a) pgwin32_system(a)
313 #define popen(a,b) pgwin32_popen(a,b)
314 #define pclose(a) _pclose(a)
315 
316 /* New versions of MingW have gettimeofday, old mingw and msvc don't */
317 #ifndef HAVE_GETTIMEOFDAY
318 /* Last parameter not used */
319 extern int gettimeofday(struct timeval * tp, struct timezone * tzp);
320 #endif
321 #else /* !WIN32 */
322 
323 /*
324  * Win32 requires a special close for sockets and pipes, while on Unix
325  * close() does them all.
326  */
327 #define closesocket close
328 #endif /* WIN32 */
329 
330 /*
331  * On Windows, setvbuf() does not support _IOLBF mode, and interprets that
332  * as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0)
333  * crashes outright if "parameter validation" is enabled. Therefore, in
334  * places where we'd like to select line-buffered mode, we fall back to
335  * unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF
336  * directly in order to implement this behavior.
337  */
338 #ifndef WIN32
339 #define PG_IOLBF _IOLBF
340 #else
341 #define PG_IOLBF _IONBF
342 #endif
343 
344 /*
345  * Default "extern" declarations or macro substitutes for library routines.
346  * When necessary, these routines are provided by files in src/port/.
347  */
348 #ifndef HAVE_CRYPT
349 extern char *crypt(const char *key, const char *setting);
350 #endif
351 
352 /* WIN32 handled in port/win32.h */
353 #ifndef WIN32
354 #define pgoff_t off_t
355 #ifdef __NetBSD__
356 extern int fseeko(FILE *stream, off_t offset, int whence);
357 extern off_t ftello(FILE *stream);
358 #endif
359 #endif
360 
361 extern double pg_erand48(unsigned short xseed[3]);
362 extern long pg_lrand48(void);
363 extern void pg_srand48(long seed);
364 
365 #ifndef HAVE_FLS
366 extern int fls(int mask);
367 #endif
368 
369 #ifndef HAVE_FSEEKO
370 #define fseeko(a, b, c) fseek(a, b, c)
371 #define ftello(a) ftell(a)
372 #endif
373 
374 #if !defined(HAVE_GETPEEREID) && !defined(WIN32)
375 extern int getpeereid(int sock, uid_t *uid, gid_t *gid);
376 #endif
377 
378 #ifndef HAVE_ISINF
379 extern int isinf(double x);
380 #endif
381 
382 #ifndef HAVE_MKDTEMP
383 extern char *mkdtemp(char *path);
384 #endif
385 
386 #ifndef HAVE_RINT
387 extern double rint(double x);
388 #endif
389 
390 #ifndef HAVE_INET_ATON
391 #include <netinet/in.h>
392 #include <arpa/inet.h>
393 extern int inet_aton(const char *cp, struct in_addr * addr);
394 #endif
395 
396 #if !HAVE_DECL_STRLCAT
397 extern size_t strlcat(char *dst, const char *src, size_t siz);
398 #endif
399 
400 #if !HAVE_DECL_STRLCPY
401 extern size_t strlcpy(char *dst, const char *src, size_t siz);
402 #endif
403 
404 #if !defined(HAVE_RANDOM) && !defined(__BORLANDC__)
405 extern long random(void);
406 #endif
407 
408 #ifndef HAVE_UNSETENV
409 extern void unsetenv(const char *name);
410 #endif
411 
412 #ifndef HAVE_SRANDOM
413 extern void srandom(unsigned int seed);
414 #endif
415 
416 #ifndef HAVE_SSL_GET_CURRENT_COMPRESSION
417 #define SSL_get_current_compression(x) 0
418 #endif
419 
420 /* thread.h */
421 extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
422 
423 #ifndef WIN32
424 extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
425  size_t buflen, struct passwd ** result);
426 #endif
427 
428 extern int pqGethostbyname(const char *name,
429  struct hostent * resultbuf,
430  char *buffer, size_t buflen,
431  struct hostent ** result,
432  int *herrno);
433 
434 extern void pg_qsort(void *base, size_t nel, size_t elsize,
435  int (*cmp) (const void *, const void *));
436 extern int pg_qsort_strcmp(const void *a, const void *b);
437 
438 #define qsort(a,b,c,d) pg_qsort(a,b,c,d)
439 
440 typedef int (*qsort_arg_comparator) (const void *a, const void *b, void *arg);
441 
442 extern void qsort_arg(void *base, size_t nel, size_t elsize,
443  qsort_arg_comparator cmp, void *arg);
444 
445 /* port/chklocale.c */
446 extern int pg_get_encoding_from_locale(const char *ctype, bool write_message);
447 
448 #if defined(WIN32) && !defined(FRONTEND)
449 extern int pg_codepage_to_encoding(UINT cp);
450 #endif
451 
452 /* port/inet_net_ntop.c */
453 extern char *inet_net_ntop(int af, const void *src, int bits,
454  char *dst, size_t size);
455 
456 /* port/pgcheckdir.c */
457 extern int pg_check_dir(const char *dir);
458 
459 /* port/pgmkdirp.c */
460 extern int pg_mkdir_p(char *path, int omode);
461 
462 /* port/pqsignal.c */
463 typedef void (*pqsigfunc) (int signo);
464 extern pqsigfunc pqsignal(int signo, pqsigfunc func);
465 
466 /* port/quotes.c */
467 extern char *escape_single_quotes_ascii(const char *src);
468 
469 /* port/wait_error.c */
470 extern char *wait_result_to_str(int exit_status);
471 
472 #endif /* PG_PORT_H */
char * make_absolute_path(const char *path)
Definition: path.c:608
static char * argv0
Definition: pg_ctl.c:91
int gettimeofday(struct timeval *tp, struct timezone *tzp)
Definition: gettimeofday.c:105
void pg_usleep(long microsec)
Definition: signal.c:53
void get_includeserver_path(const char *my_exec_path, char *ret_path)
Definition: path.c:740
char * wait_result_to_str(int exit_status)
Definition: wait_error.c:34
#define fseeko(a, b, c)
Definition: port.h:370
int pg_mkdir_p(char *path, int omode)
Definition: pgmkdirp.c:57
int gid_t
Definition: win32.h:261
int uid_t
Definition: win32.h:260
const char * get_progname(const char *argv0)
Definition: path.c:453
int getpeereid(int sock, uid_t *uid, gid_t *gid)
Definition: getpeereid.c:35
bool pg_set_block(pgsocket sock)
Definition: noblock.c:35
long random(void)
Definition: random.c:22
bool path_is_prefix_of_path(const char *path1, const char *path2)
Definition: path.c:438
int pg_snprintf(char *str, size_t count, const char *fmt,...)
Definition: snprintf.c:167
int pqGethostbyname(const char *name, struct hostent *resultbuf, char *buffer, size_t buflen, struct hostent **result, int *herrno)
Definition: thread.c:117
int pg_vfprintf(FILE *stream, const char *fmt, va_list args)
Definition: snprintf.c:208
unsigned char pg_ascii_tolower(unsigned char ch)
Definition: pgstrcasecmp.c:146
long pg_lrand48(void)
Definition: erand48.c:88
void make_native_path(char *path)
Definition: path.c:166
void pg_srand48(long seed)
Definition: erand48.c:95
char * pqStrerror(int errnum, char *strerrbuf, size_t buflen)
Definition: thread.c:61
void canonicalize_path(char *path)
Definition: path.c:254
unsigned char pg_tolower(unsigned char ch)
Definition: pgstrcasecmp.c:122
unsigned char pg_ascii_toupper(unsigned char ch)
Definition: pgstrcasecmp.c:135
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
bool path_contains_parent_reference(const char *path)
Definition: path.c:376
void get_pkglib_path(const char *my_exec_path, char *ret_path)
Definition: path.c:758
#define pg_attribute_printf(f, a)
Definition: c.h:630
int fls(int mask)
Definition: fls.c:55
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
Definition: pgstrcasecmp.c:69
bool has_drive_prefix(const char *filename)
Definition: path.c:87
char * escape_single_quotes_ascii(const char *src)
Definition: quotes.c:33
bool rmtree(const char *path, bool rmtopdir)
Definition: rmtree.c:36
pqsigfunc pqsignal(int signo, pqsigfunc func)
Definition: signal.c:168
void get_lib_path(const char *my_exec_path, char *ret_path)
Definition: path.c:749
char * s1
void get_pkginclude_path(const char *my_exec_path, char *ret_path)
Definition: path.c:731
void unsetenv(const char *name)
Definition: unsetenv.c:20
void get_doc_path(const char *my_exec_path, char *ret_path)
Definition: path.c:776
int isinf(double x)
void cleanup_path(char *path)
Definition: path.c:185
static char * buf
Definition: pg_test_fsync.c:65
int pg_printf(const char *fmt,...)
Definition: snprintf.c:242
void(* pqsigfunc)(int signo)
Definition: port.h:463
bool path_is_relative_and_below_cwd(const char *path)
Definition: path.c:405
void get_parent_directory(char *path)
Definition: path.c:854
int pclose_check(FILE *stream)
Definition: exec.c:510
int pgsocket
Definition: port.h:22
double rint(double x)
Definition: rint.c:22
int pg_sprintf(char *str, const char *fmt,...)
Definition: snprintf.c:196
char * inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
Definition: inet_net_ntop.c:78
int inet_aton(const char *cp, struct in_addr *addr)
Definition: inet_aton.c:54
char * pgwin32_setlocale(int category, const char *locale)
char * simple_prompt(const char *prompt, int maxlen, bool echo)
Definition: sprompt.c:38
void qsort_arg(void *base, size_t nel, size_t elsize, qsort_arg_comparator cmp, void *arg)
Definition: qsort_arg.c:113
char my_exec_path[MAXPGPATH]
Definition: globals.c:63
char * crypt(const char *key, const char *setting)
char * s2
int find_my_exec(const char *argv0, char *retpath)
Definition: exec.c:119
char * first_dir_separator(const char *filename)
Definition: path.c:103
int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args)
Definition: snprintf.c:150
static int sig
Definition: pg_ctl.c:78
double pg_erand48(unsigned short xseed[3])
Definition: erand48.c:79
char * last_dir_separator(const char *filename)
Definition: path.c:138
void get_etc_path(const char *my_exec_path, char *ret_path)
Definition: path.c:713
int pg_get_encoding_from_locale(const char *ctype, bool write_message)
Definition: chklocale.c:441
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition: exec.c:550
bool pg_set_noblock(pgsocket sock)
Definition: noblock.c:21
void get_html_path(const char *my_exec_path, char *ret_path)
Definition: path.c:785
void pg_qsort(void *base, size_t nel, size_t elsize, int(*cmp)(const void *, const void *))
Definition: qsort.c:113
char * mkdtemp(char *path)
Definition: mkdtemp.c:286
int pg_qsort_strcmp(const void *a, const void *b)
Definition: qsort.c:232
char ** pgfnames(const char *path)
Definition: pgfnames.c:31
void join_path_components(char *ret_path, const char *head, const char *tail)
Definition: path.c:218
const char * name
Definition: encode.c:521
void get_man_path(const char *my_exec_path, char *ret_path)
Definition: path.c:794
void get_include_path(const char *my_exec_path, char *ret_path)
Definition: path.c:722
static char * filename
Definition: pg_dumpall.c:86
int pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer, size_t buflen, struct passwd **result)
Definition: thread.c:95
#define ftello(a)
Definition: port.h:371
int pg_check_dir(const char *dir)
Definition: pgcheckdir.c:31
static char * locale
Definition: initdb.c:126
int(* qsort_arg_comparator)(const void *a, const void *b, void *arg)
Definition: port.h:440
void * arg
void srandom(unsigned int seed)
Definition: srandom.c:22
void get_locale_path(const char *my_exec_path, char *ret_path)
Definition: path.c:767
void get_share_path(const char *my_exec_path, char *ret_path)
Definition: path.c:704
typedef BOOL(WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess
int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath)
Definition: exec.c:307
unsigned char pg_toupper(unsigned char ch)
Definition: pgstrcasecmp.c:105
int pg_fprintf(FILE *stream, const char *fmt,...)
Definition: snprintf.c:230
void pgfnames_cleanup(char **filenames)
Definition: pgfnames.c:99
char * first_path_var_separator(const char *pathlist)
Definition: path.c:120
size_t strlcat(char *dst, const char *src, size_t siz)
Definition: strlcat.c:33
bool get_home_path(char *ret_path)
Definition: path.c:807
static int cmp(const chr *x, const chr *y, size_t len)
Definition: regc_locale.c:702