00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _replacements_h_
00021 #define _replacements_h_
00022
00023
00024
00025 #include <stdarg.h>
00026 #include "tds_sysdep_public.h"
00027
00028 #ifndef HAVE_READPASSPHRASE
00029 # include <replacements/readpassphrase.h>
00030 #else
00031 # include <readpassphrase.h>
00032 #endif
00033
00034
00035 #ifdef HAVE_STRING_H
00036 # include <string.h>
00037 #endif
00038 #ifdef HAVE_LIBGEN_H
00039 # include <libgen.h>
00040 #endif
00041
00042 #if !HAVE_POLL
00043 #include <fakepoll.h>
00044 #define poll(fds, nfds, timeout) fakepoll((fds), (nfds), (timeout))
00045 #endif
00046
00047 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
00048 #pragma GCC visibility push(hidden)
00049 #endif
00050
00051 #ifdef __cplusplus
00052 extern "C"
00053 {
00054 #endif
00055
00056 #if !HAVE_VSNPRINTF
00057 #if HAVE__VSNPRINTF
00058 #undef vsnprintf
00059 #define vsnprintf _vsnprintf
00060 #else
00061 int vsnprintf(char *ret, size_t max, const char *fmt, va_list ap);
00062 #endif
00063 #endif
00064
00065 #if !HAVE_ASPRINTF
00066 int asprintf(char **ret, const char *fmt, ...);
00067 #endif
00068
00069 #if !HAVE_VASPRINTF
00070 int vasprintf(char **ret, const char *fmt, va_list ap);
00071 #endif
00072
00073 #if !HAVE_ATOLL
00074 tds_sysdep_int64_type atoll(const char *nptr);
00075 #endif
00076
00077 #if !HAVE_STRTOK_R
00078 char *strtok_r(char *str, const char *sep, char **lasts);
00079 #endif
00080
00081 #if !HAVE_STRSEP
00082 char *strsep(char **stringp, const char *delim);
00083 #endif
00084
00085 #if HAVE_STRLCPY
00086 #define tds_strlcpy(d,s,l) strlcpy(d,s,l)
00087 #else
00088 size_t tds_strlcpy(char *dest, const char *src, size_t len);
00089 #endif
00090
00091 #if HAVE_STRLCAT
00092 #define tds_strlcat(d,s,l) strlcat(d,s,l)
00093 #else
00094 size_t tds_strlcat(char *dest, const char *src, size_t len);
00095 #endif
00096
00097 #if HAVE_BASENAME
00098 #define tds_basename(s) basename(s)
00099 #else
00100 char *tds_basename(char *path);
00101 #endif
00102
00103 char *getpassarg(char *arg);
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 #if defined(_WIN32)
00119 # if !defined(strcasecmp) && defined(_MSC_VER)
00120 # define strcasecmp(A, B) stricmp((A), (B))
00121 # endif
00122 # if !defined(strncasecmp) && defined(_MSC_VER)
00123 # define strncasecmp(x,y,z) strnicmp((x),(y),(z))
00124 # endif
00125 int gettimeofday (struct timeval *tv, void *tz);
00126 int getopt(int argc, char * const argv[], const char *optstring);
00127 extern char *optarg;
00128 extern int optind, offset, opterr, optreset;
00129 #endif
00130
00131 #if HAVE_SOCKETPAIR
00132 #define tds_socketpair(d,t,p,s) socketpair(d,t,p,s)
00133 #else
00134 int tds_socketpair(int domain, int type, int protocol, int sv[2]);
00135 #endif
00136
00137 #ifdef __cplusplus
00138 }
00139 #endif
00140
00141 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
00142 #pragma GCC visibility pop
00143 #endif
00144
00145 #endif