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_STRLCPY
00082 #define tds_strlcpy(d,s,l) strlcpy(d,s,l)
00083 #else
00084 size_t tds_strlcpy(char *dest, const char *src, size_t len);
00085 #endif
00086 
00087 #if HAVE_STRLCAT
00088 #define tds_strlcat(d,s,l) strlcat(d,s,l)
00089 #else
00090 size_t tds_strlcat(char *dest, const char *src, size_t len);
00091 #endif
00092 
00093 #if HAVE_BASENAME
00094 #define tds_basename(s) basename(s)
00095 #else
00096 char *tds_basename(char *path);
00097 #endif
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 #if defined(_WIN32)
00113 # if !defined(strcasecmp) && defined(_MSC_VER) 
00114 #     define  strcasecmp(A, B) stricmp((A), (B))
00115 # endif
00116 # if !defined(strncasecmp) && defined(_MSC_VER)
00117 #     define  strncasecmp(x,y,z) strnicmp((x),(y),(z))
00118 # endif
00119 int gettimeofday (struct timeval *tv, void *tz);
00120 int getopt(int argc, char * const argv[], const char *optstring);
00121 extern char *optarg;
00122 extern int optind, offset, opterr, optreset;
00123 #endif
00124 
00125 #ifdef __cplusplus
00126 }
00127 #endif
00128 
00129 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
00130 #pragma GCC visibility pop
00131 #endif
00132 
00133 #endif