2 Unix SMB/CIFS implementation.
4 macros to go along with the lib/replace/ portability layer code
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #define QSORT_CAST (__compar_fn_t)
31 #define QSORT_CAST (int (*)(const void *, const void *))
35 char *strdup(const char *s);
39 void *memmove(void *dest,const void *src,int size);
43 time_t mktime(struct tm *t);
47 size_t strlcpy(char *d, const char *s, size_t bufsize);
51 size_t strlcat(char *d, const char *s, size_t bufsize);
55 char *strndup(const char *s, size_t n);
59 size_t strnlen(const char *s, size_t n);
63 unsigned long strtoul(const char *nptr, char **endptr, int base);
67 int setenv(const char *name, const char *value, int overwrite);
70 #ifndef HAVE_VASPRINTF_DECL
71 int vasprintf(char **ptr, const char *format, va_list ap);
74 #if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
75 #define bzero(a,b) memset((a),'\0',(b))
78 /* add varargs prototypes with printf checking */
79 #ifndef HAVE_SNPRINTF_DECL
80 int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
82 #ifndef HAVE_ASPRINTF_DECL
83 int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
87 /* we used to use these fns, but now we have good replacements
88 for snprintf and vsnprintf */
89 #define slprintf snprintf
93 #define VA_COPY(dest, src) va_copy(dest, src)
94 #elif defined(HAVE___VA_COPY)
95 #define VA_COPY(dest, src) __va_copy(dest, src)
97 #define VA_COPY(dest, src) (dest) = (src)
101 #define UINT16_MAX 65535
104 #if defined(HAVE_VOLATILE)
105 #define VOLATILE volatile
110 #ifndef HAVE_COMPARISON_FN_T
111 typedef int (*comparison_fn_t)(const void *, const void *);