Windows global stuff:
[krb5.git] / src / include / fake-stdlib.h
index 1dff3d4d4c19245ea667733079509a1c8bf960b3..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,10 +119,11 @@ 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 ));
+void srandom P((int  ));
 int swapon P((char *));
 int sync P((void ));
 int umask P((int ));
@@ -131,13 +133,13 @@ int vhangup P((void ));
 int write P((int , const char *, int ));
 int abs P((int ));
 int alarm P((unsigned ));
-double atof P((char *));
+double atof P((const char *));
 int atoi P((char *));
 long atol P((char *));
 int bcmp P((char *, char *, int ));
 int bcopy P((const char *, char *, int ));
 int bzero P((char *, int ));
-char *calloc P((unsigned , unsigned ));
+void *calloc P((unsigned long, unsigned long));
 void closelog P((void ));
 int creat P((char *, int ));
 char *crypt P((char *, char *));
@@ -152,16 +154,22 @@ int endpwent P((void ));
 int endservent P((void ));
 int endttyent P((void ));
 int endusershell P((void ));
-int execl P((char *, char *));
+int execl P((char *, char *, ...));
 int execle P((char *, char *));
-int execlp P((char *, char *));
+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__
+void free P((void *));
+#else
 int free P((char *));
+#endif
 double frexp P((double , int *));
 char *gcvt P((double , int , char *));
 struct disktab *getdiskbyname P((char *));
@@ -172,15 +180,15 @@ struct fstab *getfsfile P((char *));
 struct fstab *getfstype P((char *));
 struct group *getgrent P((void ));
 struct group *getgrgid P((int ));
-struct group *getgrnam P((char *));
+struct group *getgrnam P((const char *));
 char *getlogin P((void ));
 int getopt P((int , char **, char *));
 char *getpass P((char *));
 int getpw P((int , char *));
 struct passwd *getpwent P((void ));
 struct passwd *getpwuid P((int ));
-struct passwd *getpwnam P((char *));
-struct ttyent *getttynam P((char *));
+struct passwd *getpwnam P((const char *));
+struct ttyent *getttynam P((const char *));
 char *getusershell P((void ));
 char *getwd P((char *));
 u_long htonl P((u_long ));
@@ -192,12 +200,18 @@ char *initstate P((unsigned , char *, int ));
 int isatty P((int ));
 double ldexp P((double , int ));
 int longjmperror P((void ));
+#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 *, 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 *));
@@ -208,14 +222,19 @@ u_long ntohl P((u_long ));
 u_short ntohs P((unsigned int ));
 void openlog P((const char *, int , int ));
 int pause P((void ));
-int psignal P((unsigned , char *));
+int perror P((const char * ));
+int psignal P((unsigned , const char *));
 int qsort P((char *, int , int , int (* )()));
 int rand P((void ));
 long random P((void ));
 int rcmd P((char **, u_short , char *, char *, char *, int *));
 char *re_comp P((char *));
 int re_exec P((char *));
+#ifdef __GNUC__
+void *realloc P((void *, size_t ));
+#else
 char *realloc P((char *, unsigned ));
+#endif
 int rexec P((char **, u_short , char *, char *, char *, int *));
 int rresvport P((int *));
 int ruserok P((char *, int , char *, char *));
@@ -230,7 +249,7 @@ int setlogmask P((int ));
 int setnetent P((int ));
 int setprotoent P((int ));
 int setpwent P((void ));
-int setpwfile P((char *));
+int setpwfile P((const char *));
 int setrgid P((gid_t ));
 int setruid P((uid_t ));
 int setservent P((int ));
@@ -241,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 *));
@@ -259,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 */
 
@@ -334,7 +351,7 @@ int ioctl P((int  , int  , char * ));
 #endif
 int kill P((int  , int  ));
 int link P((char * , char * ));
-long lseek P((int  , long  , int ));
+off_t lseek P((int  , long  , int ));
 #ifdef SYSTEM_FIVE
 int madvise P((char * , int , int ));
 int mmap P((char * , int  , int , int , int , off_t ));
@@ -384,16 +401,13 @@ char *crypt P((char * , char * ));
 #ifndef SYSTEM_FIVE
 void encrypt P((char * ));
 #endif
-char *ctime P((long * ));
-struct tm *localtime P((long * ));
-struct tm *gmtime P((long * ));
 #ifndef SYSTEM_FIVE
 char *timezone P((int  , int  ));
 #endif
 char *ecvt P((double , int , int * , int * ));
 char *fcvt P((double , int  , int * , int * ));
 char *gcvt P((double , int , char * ));
-int execl P((char * , char * ));
+int execl P((char * , char *, ...));
 int execle P((char * , char * ));
 int execv P((char * , char **));
 int exect P((char *, char **, char ** ));
@@ -412,7 +426,7 @@ int setfsent P((void ));
 #ifndef SYSTEM_FIVE
 struct group *getgrent P((void ));
 struct group *getgrgid P((int ));
-struct group *getgrnam P((char * ));
+struct group *getgrnam P((const char * ));
 int endgrent P((void ));
 int setgrent P((void ));
 #endif
@@ -437,7 +451,7 @@ int getpw P((int , char * ));
 #ifndef SYSTEM_FIVE
 struct passwd *getpwent P((void ));
 struct passwd *getpwuid P((int ));
-struct passwd *getpwnam P((char * ));
+struct passwd *getpwnam P((const char * ));
 int endpwent P((void ));
 int setpwent P((void ));
 #endif
@@ -448,12 +462,14 @@ struct servent *getservbyport P((int , char * ));
 void setservent P((int ));
 void endservent P((void ));
 struct ttyent *getttyent P((void ));
-struct ttyent *getttynam P((char * ));
-void setttyent P((void ));
-void endttyent P((void ));
-unsigned long inet_network P((char * ));
+struct ttyent *getttynam P((const char * ));
+unsigned long inet_network P((const char * ));
 int initgroups P((char * , int  ));
+#if defined(__STDC__) || defined(_WINDOWS)
+void *malloc P((unsigned ));
+#else
 char *malloc P((unsigned ));
+#endif
 char *calloc P((unsigned , unsigned  ));
 char *realloc P((char * , unsigned  ));
 void free P((char * ));
@@ -497,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  ));
@@ -523,7 +541,7 @@ int getpriority P((int  , int  ));
 int setpriority P((int  , int  , int  ));
 int getsockname P((int  , char * , int * ));
 int getsockopt P((int  , int  , int  , char * , int * ));
-int setsockopt P((int  , int  , int  , char * , int  ));
+int setsockopt P((int  , int  , int  , const char * , int  ));
 int killpg P((int  , int  ));
 int listen P((int  , int  ));
 int quota P((int  , int  , int  , caddr_t ));
@@ -564,19 +582,17 @@ char *initstate P((unsigned  , char * , int  ));
 char *setstate P((char * ));
 char *re_comp P((char * ));
 int re_exec P((char * ));
-void openlog P((const char * , int  ));
-void syslog P((int  , char *, ... ));
+void openlog P((const char * , int, int  )); /* our local version... */
+void syslog P((int  , const char *, ... ));
 void closelog P((void ));
-long time P((long * ));
 char *valloc P((unsigned  ));
 int vlimit P((int  , int  ));
 #endif
-int execlp P((char * , char * ));
+int execlp P((char * , char *, ... ));
 int execvp P((char * , char * []));
 int plock P((int ));
 char *shmat P((int  , char * , int  ));
 int shmdt P((char * ));
-int stime P((long * ));
 void sys3b P((int  , int  , int  ));
 long ulimit P((int  , long  ));
 long a64l P((char * ));
@@ -606,7 +622,7 @@ char *lfind P((char * , char * , unsigned * , unsigned  , int (* )(char *, char
 char *memccpy P((char * , char * , int  , int  ));
 char *memchr P((char * , int  , int  ));
 int memcmp P((char * , char * , int  ));
-char *memcpy P((char * , char * , int  ));
+char *memcpy P((char * , const char * , int  ));
 char *memset P((char * , int  , int  ));
 int gsignal P((int  ));
 double strtod P((char * , char ** ));
@@ -617,8 +633,6 @@ char *tsearch P((char * , char ** , int (* )(char *, char *)));
 char *tfind P((char * , char ** , int (* )(char *, char *)));
 char *tdelete P((char * , char ** , int (* )(char *, char *)));
 void twalk P((char * , void (* )(char *, int, int)));
-int vprintf P((char * , ...  ));
-int vsprintf P((char * , const char * , ...  ));
 int syscall P((int  , int  , int  , int  ));
 long tell P((int  ));
 
@@ -648,11 +662,46 @@ void setgrent P((void ));
 void endgrent P((void ));
 struct passwd *getpwent P((void ));
 struct passwd *getpwuid P((int  ));
-struct passwd *getpwnam P((char * ));
+struct passwd *getpwnam P((const char * ));
 void setpwent P((void ));
 void endpwent P((void ));
 void qsort P((char * , unsigned  , unsigned  , int (* )()));
 #endif
 
 #endif /* MIPS/Ultrix */
+
+#ifdef ibm032
+#ifndef memcpy
+extern void *memcpy P((void *, const void *, unsigned int));
+#endif
+#ifndef memset
+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