Windows global stuff:
[krb5.git] / src / include / fake-stdlib.h
index d52fe3fe6c61ca71fe545d2f5451557e8bbd1f42..5f021a22803f86ff4cc654afd471b21f8581901c 100644 (file)
@@ -1,5 +1,4 @@
-#ifdef __STDC__
-# define       P(s) s
+#if defined(__STDC__) || defined(_WINDOWS)
 #else
 # define P(s) ()
 #endif
@@ -81,7 +80,9 @@ int close P((int ));
 int dup P((int ));
 int dup2 P((int , int ));
 int execve P((char *, char * [], char * []));
+#ifndef __GNUC__
 int _exit P((int ));
+#endif
 int fchmod P((int , int ));
 int fchown P((int , int , int ));
 int fcntl P((int , int , int ));
@@ -118,7 +119,7 @@ int setgroups P((int , int *));
 int sethostid P((long ));
 int sethostname P((char *, int ));
 int setpgrp P((int , int ));
-int setquota P((char *, char *));
+int setquota P((const char *, const char *));
 int setregid P((int , int ));
 int setreuid P((int , int ));
 int shutdown P((int , int ));
@@ -138,12 +139,7 @@ long atol P((char *));
 int bcmp P((char *, char *, int ));
 int bcopy P((const char *, char *, int ));
 int bzero P((char *, int ));
-#ifdef __GNUC__
-#include <stddef.h>
-void *calloc P((size_t, size_t));
-#else
-char *calloc P((unsigned , unsigned ));
-#endif
+void *calloc P((unsigned long, unsigned long));
 void closelog P((void ));
 int creat P((char *, int ));
 char *crypt P((char *, char *));
@@ -164,7 +160,9 @@ int execlp P((char *, char *, ...));
 int execv P((char *, char * []));
 int execvp P((char *, char * []));
 int exect P((char *, char * [], char * []));
+#ifndef __GNUC__
 int exit P((int ));
+#endif
 char *fcvt P((double , int , int *, int *));
 int ffs P((int ));
 #ifdef __GNUC__
@@ -202,16 +200,18 @@ char *initstate P((unsigned , char *, int ));
 int isatty P((int ));
 double ldexp P((double , int ));
 int longjmperror P((void ));
-#ifdef __STDC__
+#if defined(__STDC__) || defined(_WINDOWS)
 void *malloc P((size_t ));
 #else
 char *malloc P((unsigned ));
 #endif
 char *memccpy P((char *, char *, int , int ));
 char *memchr P((char *, int , int ));
+#ifndef __GNUC__
 int memcmp P((char *, char *, int ));
 char *memcpy P((char *, const char *, int ));
 char *memset P((char *, int , int ));
+#endif
 char *mktemp P((char *));
 int mkstemp P((char *));
 double modf P((double , double *));
@@ -260,10 +260,6 @@ int setusershell P((void ));
 int siginterrupt P((int , int ));
 int sleep P((unsigned ));
 int srand P((int ));
-int strlen P((const char *));
-char *strncat P((char *, const char *, int ));
-int strncmp P((const char *, const char *, int ));
-char *strncpy P((char *, const char *, int ));
 int swab P((char *, char *, int ));
 void syslog P((int , const char *, ...));
 int system P((char *));
@@ -278,7 +274,9 @@ int usleep P((unsigned ));
 int utime P((char *, time_t *));
 char *valloc P((unsigned ));
 int vlimit P((int , int ));
+#ifndef __GNUC__
 void abort P((void));
+#endif
 
 #endif /* VAX */
 
@@ -467,7 +465,7 @@ struct ttyent *getttyent P((void ));
 struct ttyent *getttynam P((const char * ));
 unsigned long inet_network P((const char * ));
 int initgroups P((char * , int  ));
-#ifdef __STDC__
+#if defined(__STDC__) || defined(_WINDOWS)
 void *malloc P((unsigned ));
 #else
 char *malloc P((unsigned ));
@@ -515,7 +513,9 @@ int siginterrupt P((int  , int  ));
 unsigned sleep P((unsigned  ));
 int strcmp P((const char * , const char * ));
 char *strcpy P((char * , const char * ));
+#ifndef hpux
 int strlen P((const char * ));
+#endif
 char *strncat P((char * , const char * , int  ));
 int strncmp P((const char * , const char * , int  ));
 char *strncpy P((char * , const char * , int  ));
@@ -672,17 +672,36 @@ void qsort P((char * , unsigned  , unsigned  , int (* )()));
 
 #ifdef ibm032
 #ifndef memcpy
-extern char *memcpy P((char *, const char *, int));
+extern void *memcpy P((void *, const void *, unsigned int));
 #endif
 #ifndef memset
-extern char *memset P((char *, int, int));
-#endif
-extern char *calloc P((unsigned int, unsigned int));
-extern char *malloc P((unsigned int));
-extern char *realloc P((char *, unsigned int));
-extern void free P((char *));
+extern void *memset P((void *, int, unsigned int));
+#endif
+extern int bcmp P((void *, void *, unsigned int));
+extern void *calloc P((unsigned int, unsigned int));
+extern void *malloc P((unsigned int));
+extern void *realloc P((void *, unsigned int));
+extern void free P((void *));
+#ifndef abort
 extern void abort P((void));
+#endif
 extern char *getenv P((const char *));
+
+extern double atof P((const char *));
+extern int    atoi P((const char *));
+
+#ifndef abs
+extern int abs(int);
+#if 0 /* used to be __HIGHC__; that interferes with jfc's c89 stdlib.h */
+#define        abs(x)  _abs(x)
+#endif
+#endif
+
 #endif /* ibm032 */
 
+/* Declarations valid for all machines. */
+#if !defined(abs) && defined(__GNUC__)
+#define        abs(x)  __builtin_abs(x)
+#endif
+
 #undef P