- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

# /home/jklowden/releases/freetds-0.91/include/replacements.h

    00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
    00002  * Copyright (C) 1998-1999  Brian Bruns
    00003  *
    00004  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the
    00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  * Boston, MA 02111-1307, USA.
    00018  */
    00019
    00020 #ifndef _replacements_h_
    00021 #define _replacements_h_
    00022
    00023 /* $Id: replacements.h,v 1.28.2.1 2011/07/07 07:27:33 freddy77 Exp $ */
    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 /* these headers are needed for basename */
    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 /* !HAVE_POLL */
    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 /* !HAVE__VSNPRINTF */
    00063 #endif /*  HAVE_VSNPRINTF */
    00064
    00065 #if !HAVE_ASPRINTF
    00066 int asprintf(char **ret, const char *fmt, ...);
    00067 #endif /* !HAVE_ASPRINTF */
    00068
    00069 #if !HAVE_VASPRINTF
    00070 int vasprintf(char **ret, const char *fmt, va_list ap);
    00071 #endif /* !HAVE_VASPRINTF */
    00072
    00073 #if !HAVE_ATOLL
    00074 tds_sysdep_int64_type atoll(const char *nptr);
    00075 #endif /* !HAVE_ATOLL */
    00076
    00077 #if !HAVE_STRTOK_R
    00078 char *strtok_r(char *str, const char *sep, char **lasts);
    00079 #endif /* !HAVE_STRTOK_R */
    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  * Microsoft's C Runtime library is missing strcasecmp and strncasecmp.
    00101  * Other Win32 C runtime libraries, notably minwg, may define it.
    00102  * There is no symbol uniquely defined in Microsoft's header files that
    00103  * can be used by the preprocessor to know whether we're compiling for
    00104  * Microsoft's library or not (or which version).  Thus there's no
    00105  * way to automatically decide whether or not to define strcasecmp
    00106  * in terms of stricmp.
    00107  *
    00108  * The Microsoft *compiler* defines _MSC_VER.  On the assumption that
    00109  * anyone using their compiler is also using their library, the below
    00110  * tests check _MSC_VER as a proxy.
    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

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines