1 /*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)stdlib.h 5.16 (Berkeley) 12/06/91 8 */ 9 10 #ifndef _STDLIB_H_ 11 #define _STDLIB_H_ 12 #include <sys/types.h> 13 14 #ifdef _SIZE_T_ 15 typedef _SIZE_T_ size_t; 16 #undef _SIZE_T_ 17 #endif 18 19 #ifdef _WCHAR_T_ 20 typedef _WCHAR_T_ wchar_t; 21 #undef _WCHAR_T_ 22 #endif 23 24 typedef struct { 25 int quot; /* quotient */ 26 int rem; /* remainder */ 27 } div_t; 28 29 typedef struct { 30 long quot; /* quotient */ 31 long rem; /* remainder */ 32 } ldiv_t; 33 34 #define EXIT_FAILURE 1 35 #define EXIT_SUCCESS 0 36 37 #define RAND_MAX 0x7fffffff 38 39 #define MB_CUR_MAX 1 /* XXX */ 40 41 #include <sys/cdefs.h> 42 43 __BEGIN_DECLS 44 void abort __P((void)); 45 int abs __P((int)); 46 int atexit __P((void (*)(void))); 47 double atof __P((const char *)); 48 int atoi __P((const char *)); 49 long atol __P((const char *)); 50 void *bsearch __P((const void *, const void *, size_t, 51 size_t, int (*)(const void *, const void *))); 52 void *calloc __P((size_t, size_t)); 53 div_t div __P((int, int)); 54 void exit __P((int)); 55 void free __P((void *)); 56 char *getenv __P((const char *)); 57 long labs __P((long)); 58 ldiv_t ldiv __P((long, long)); 59 void *malloc __P((size_t)); 60 void qsort __P((void *, size_t, size_t, 61 int (*)(const void *, const void *))); 62 int rand __P((void)); 63 void *realloc __P((void *, size_t)); 64 void srand __P((unsigned)); 65 double strtod __P((const char *, char **)); 66 long strtol __P((const char *, char **, int)); 67 unsigned long 68 strtoul __P((const char *, char **, int)); 69 int system __P((const char *)); 70 71 /* These are currently just stubs. */ 72 int mblen __P((const char *, size_t)); 73 size_t mbstowcs __P((wchar_t *, const char *, size_t)); 74 int wctomb __P((char *, wchar_t)); 75 int mbtowc __P((wchar_t *, const char *, size_t)); 76 size_t wcstombs __P((char *, const wchar_t *, size_t)); 77 78 #ifndef _ANSI_SOURCE 79 void cfree __P((void *)); 80 int putenv __P((const char *)); 81 int setenv __P((const char *, const char *, int)); 82 #endif 83 84 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 85 extern char *optarg; /* getopt(3) external variables */ 86 extern int opterr, optind, optopt; 87 int getopt __P((int, char * const *, const char *)); 88 89 extern char *suboptarg; /* getsubopt(3) external variable */ 90 int getsubopt __P((char **, char * const *, char **)); 91 92 void *alloca __P((size_t)); /* built-in for gcc */ 93 int heapsort __P((void *, size_t, size_t, 94 int (*)(const void *, const void *))); 95 char *initstate __P((unsigned, char *, int)); 96 int radixsort __P((const u_char **, int, const u_char *, u_int)); 97 long random __P((void)); 98 char *setstate __P((char *)); 99 void srandom __P((unsigned)); 100 void unsetenv __P((const char *)); 101 #endif 102 __END_DECLS 103 104 #endif /* _STDLIB_H_ */ 105