]> granicus.if.org Git - postgresql/blob - src/include/port.h
Back out patch that got bundled into another patch.
[postgresql] / src / include / port.h
1 /*-------------------------------------------------------------------------
2  *
3  * port.h
4  *        Header for /port compatibility functions.
5  *
6  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: port.h,v 1.5 2003/06/12 08:11:07 momjian Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13
14 /* Portable path handling for Unix/Win32 */
15 bool is_absolute_path(const char *filename);
16 char *first_path_separator(const char *filename);
17 char *last_path_separator(const char *filename);
18 char *get_progname(char *argv0);
19
20 #if defined(bsdi) || defined(netbsd)
21 int fseeko(FILE *stream, off_t offset, int whence);
22 off_t ftello(FILE *stream);
23 #endif
24
25 #ifdef WIN32
26 /*
27  * Win32 doesn't have reliable rename/unlink during concurrent access
28  */
29 #ifndef FRONTEND
30 int pgrename(const char *from, const char *to);
31 int pgunlink(const char *path);      
32 #define rename(from, to)        pgrename(from, to)
33 #define unlink(path)            pgunlink(path)
34 #endif
35
36 extern int copydir(char *fromdir,char *todir);
37 /* Last parameter not used */
38 extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
39
40 #else
41
42 /*
43  *      Win32 requires a special close for sockets and pipes, while on Unix
44  *      close() does them all.
45  */
46 #define closesocket close
47 #endif
48   
49 /*
50  * Default "extern" declarations or macro substitutes for library routines.
51  * When necessary, these routines are provided by files in src/port/.
52  */
53 #ifndef HAVE_CRYPT
54 extern char *crypt(const char *key, const char *setting);
55 #endif
56
57 #ifndef HAVE_FSEEKO
58 #define fseeko(a, b, c) fseek((a), (b), (c))
59 #define ftello(a) ftell((a))
60 #endif
61
62 #ifndef HAVE_GETOPT
63 extern int getopt(int nargc, char *const *nargv, const char *ostr);
64 #endif
65
66 #ifndef HAVE_ISINF
67 extern int isinf(double x);
68 #endif
69
70 #if !defined(HAVE_GETHOSTNAME) && defined(KRB4)
71 extern int gethostname(char *name, int namelen);
72 #endif
73
74 #ifndef HAVE_RINT
75 extern double rint(double x);
76 #endif
77
78 #ifndef HAVE_INET_ATON
79 # include <netinet/in.h>
80 # include <arpa/inet.h>
81 extern int inet_aton(const char *cp, struct in_addr * addr);
82 #endif
83
84 #ifndef HAVE_STRCASECMP
85 extern int strcasecmp(char *s1, char *s2);
86 #endif
87
88 #ifndef HAVE_STRDUP
89 extern char *strdup(char const *);
90 #endif
91
92 #ifndef HAVE_RANDOM
93 extern long random(void);
94 #endif
95
96 #ifndef HAVE_SRANDOM
97 extern void srandom(unsigned int seed);
98 #endif