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.23 (Berkeley) 12/02/92 8 */ 9 10 #ifndef _STDLIB_H_ 11 #define _STDLIB_H_ 12 #include <machine/ansi.h> 13 14 #ifdef _BSD_SIZE_T_ 15 typedef _BSD_SIZE_T_ size_t; 16 #undef _BSD_SIZE_T_ 17 #endif 18 19 #ifdef _BSD_WCHAR_T_ 20 typedef _BSD_WCHAR_T_ wchar_t; 21 #undef _BSD_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 __dead void 45 abort __P((void)); 46 __pure int 47 abs __P((int)); 48 int atexit __P((void (*)(void))); 49 double atof __P((const char *)); 50 int atoi __P((const char *)); 51 long atol __P((const char *)); 52 void *bsearch __P((const void *, const void *, size_t, 53 size_t, int (*)(const void *, const void *))); 54 void *calloc __P((size_t, size_t)); 55 __pure div_t 56 div __P((int, int)); 57 __dead void 58 exit __P((int)); 59 void free __P((void *)); 60 char *getenv __P((const char *)); 61 __pure long 62 labs __P((long)); 63 __pure ldiv_t 64 ldiv __P((long, long)); 65 void *malloc __P((size_t)); 66 void qsort __P((void *, size_t, size_t, 67 int (*)(const void *, const void *))); 68 int rand __P((void)); 69 void *realloc __P((void *, size_t)); 70 void srand __P((unsigned)); 71 double strtod __P((const char *, char **)); 72 long strtol __P((const char *, char **, int)); 73 unsigned long 74 strtoul __P((const char *, char **, int)); 75 int system __P((const char *)); 76 77 /* These are currently just stubs. */ 78 int mblen __P((const char *, size_t)); 79 size_t mbstowcs __P((wchar_t *, const char *, size_t)); 80 int wctomb __P((char *, wchar_t)); 81 int mbtowc __P((wchar_t *, const char *, size_t)); 82 size_t wcstombs __P((char *, const wchar_t *, size_t)); 83 84 #ifndef _ANSI_SOURCE 85 void cfree __P((void *)); 86 int putenv __P((const char *)); 87 int setenv __P((const char *, const char *, int)); 88 #endif 89 90 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 91 /* getcap(3) functions */ 92 char *cgetcap __P((char *, char *, int)); 93 int cgetclose __P((void)); 94 int cgetent __P((char **, char **, char *)); 95 int cgetfirst __P((char **, char **)); 96 int cgetmatch __P((char *, char *)); 97 int cgetnext __P((char **, char **)); 98 int cgetnum __P((char *, char *, long *)); 99 int cgetset __P((char *)); 100 int cgetstr __P((char *, char *, char **)); 101 int cgetustr __P((char *, char *, char **)); 102 103 extern char *optarg; /* getopt(3) external variables */ 104 extern int opterr, optind, optopt; 105 int getopt __P((int, char * const *, const char *)); 106 107 extern char *suboptarg; /* getsubopt(3) external variable */ 108 int getsubopt __P((char **, char * const *, char **)); 109 110 void *alloca __P((size_t)); /* built-in for gcc */ 111 int heapsort __P((void *, size_t, size_t, 112 int (*)(const void *, const void *))); 113 char *initstate __P((unsigned, char *, int)); 114 int mergesort __P((void *, size_t, size_t, 115 int (*)(const void *, const void *))); 116 int radixsort __P((const unsigned char **, int, const unsigned char *, 117 unsigned)); 118 int sradixsort __P((const unsigned char **, int, const unsigned char *, 119 unsigned)); 120 long random __P((void)); 121 char *setstate __P((char *)); 122 void srandom __P((unsigned)); 123 #ifndef __STRICT_ANSI__ 124 long long 125 strtoq __P((const char *, char **, int)); 126 unsigned long long 127 strtouq __P((const char *, char **, int)); 128 #endif 129 void unsetenv __P((const char *)); 130 #endif 131 __END_DECLS 132 133 #endif /* _STDLIB_H_ */ 134