Commit | Line | Data |
---|---|---|
1cc1b02a | 1 | /*- |
56559b70 KB |
2 | * Copyright (c) 1990, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
1cc1b02a KB |
4 | * |
5 | * %sccs.include.redist.c% | |
6 | * | |
af1eaad7 | 7 | * @(#)stdlib.h 8.3 (Berkeley) %G% |
1cc1b02a KB |
8 | */ |
9 | ||
10 | #ifndef _STDLIB_H_ | |
11 | #define _STDLIB_H_ | |
2a2d7d9d | 12 | |
a2798976 | 13 | #include <machine/ansi.h> |
1cc1b02a | 14 | |
3d2899e6 KB |
15 | #ifdef _BSD_SIZE_T_ |
16 | typedef _BSD_SIZE_T_ size_t; | |
17 | #undef _BSD_SIZE_T_ | |
5c02aa20 KB |
18 | #endif |
19 | ||
3d2899e6 | 20 | #ifdef _BSD_WCHAR_T_ |
2d5cbf27 | 21 | #ifndef _ANSI_SOURCE |
2a2d7d9d | 22 | typedef _BSD_WCHAR_T_ rune_t; |
2d5cbf27 | 23 | #endif |
3d2899e6 KB |
24 | typedef _BSD_WCHAR_T_ wchar_t; |
25 | #undef _BSD_WCHAR_T_ | |
1cc1b02a KB |
26 | #endif |
27 | ||
28 | typedef struct { | |
29 | int quot; /* quotient */ | |
30 | int rem; /* remainder */ | |
31 | } div_t; | |
5c02aa20 | 32 | |
1cc1b02a KB |
33 | typedef struct { |
34 | long quot; /* quotient */ | |
35 | long rem; /* remainder */ | |
36 | } ldiv_t; | |
37 | ||
e54f12d8 CT |
38 | #ifndef NULL |
39 | #define NULL 0 | |
40 | #endif | |
41 | ||
1cc1b02a KB |
42 | #define EXIT_FAILURE 1 |
43 | #define EXIT_SUCCESS 0 | |
44 | ||
f5e55301 | 45 | #define RAND_MAX 0x7fffffff |
1cc1b02a | 46 | |
2a2d7d9d EA |
47 | extern int __mb_cur_max; |
48 | #define MB_CUR_MAX __mb_cur_max | |
1cc1b02a | 49 | |
9992a62a KB |
50 | #include <sys/cdefs.h> |
51 | ||
52 | __BEGIN_DECLS | |
10fb5e70 CT |
53 | __dead void |
54 | abort __P((void)); | |
55 | __pure int | |
56 | abs __P((int)); | |
11e892b9 | 57 | int atexit __P((void (*)(void))); |
993000f1 DS |
58 | double atof __P((const char *)); |
59 | int atoi __P((const char *)); | |
60 | long atol __P((const char *)); | |
61 | void *bsearch __P((const void *, const void *, size_t, | |
62 | size_t, int (*)(const void *, const void *))); | |
63 | void *calloc __P((size_t, size_t)); | |
10fb5e70 CT |
64 | __pure div_t |
65 | div __P((int, int)); | |
66 | __dead void | |
67 | exit __P((int)); | |
993000f1 DS |
68 | void free __P((void *)); |
69 | char *getenv __P((const char *)); | |
10fb5e70 CT |
70 | __pure long |
71 | labs __P((long)); | |
72 | __pure ldiv_t | |
73 | ldiv __P((long, long)); | |
993000f1 DS |
74 | void *malloc __P((size_t)); |
75 | void qsort __P((void *, size_t, size_t, | |
76 | int (*)(const void *, const void *))); | |
9992a62a | 77 | int rand __P((void)); |
993000f1 DS |
78 | void *realloc __P((void *, size_t)); |
79 | void srand __P((unsigned)); | |
80 | double strtod __P((const char *, char **)); | |
81 | long strtol __P((const char *, char **, int)); | |
fac5dcaf | 82 | unsigned long |
993000f1 DS |
83 | strtoul __P((const char *, char **, int)); |
84 | int system __P((const char *)); | |
1cc1b02a | 85 | |
5c02aa20 | 86 | /* These are currently just stubs. */ |
993000f1 DS |
87 | int mblen __P((const char *, size_t)); |
88 | size_t mbstowcs __P((wchar_t *, const char *, size_t)); | |
89 | int wctomb __P((char *, wchar_t)); | |
90 | int mbtowc __P((wchar_t *, const char *, size_t)); | |
91 | size_t wcstombs __P((char *, const wchar_t *, size_t)); | |
b0aa9dc4 | 92 | |
6670c0eb | 93 | #ifndef _ANSI_SOURCE |
993000f1 DS |
94 | int putenv __P((const char *)); |
95 | int setenv __P((const char *, const char *, int)); | |
5c02aa20 | 96 | #endif |
993000f1 DS |
97 | |
98 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) | |
601cf9c7 | 99 | void *alloca __P((size_t)); /* built-in for gcc */ |
40b21215 | 100 | /* getcap(3) functions */ |
f0bbc0c5 | 101 | char *getbsize __P((int *, long *)); |
40b21215 KB |
102 | char *cgetcap __P((char *, char *, int)); |
103 | int cgetclose __P((void)); | |
104 | int cgetent __P((char **, char **, char *)); | |
105 | int cgetfirst __P((char **, char **)); | |
106 | int cgetmatch __P((char *, char *)); | |
107 | int cgetnext __P((char **, char **)); | |
108 | int cgetnum __P((char *, char *, long *)); | |
109 | int cgetset __P((char *)); | |
110 | int cgetstr __P((char *, char *, char **)); | |
111 | int cgetustr __P((char *, char *, char **)); | |
112 | ||
601cf9c7 | 113 | int daemon __P((int, int)); |
f0bbc0c5 | 114 | char *devname __P((int, int)); |
fcd543c2 | 115 | int getloadavg __P((double [], int)); |
601cf9c7 | 116 | |
5c02aa20 | 117 | extern char *optarg; /* getopt(3) external variables */ |
91ff65ad | 118 | extern int opterr, optind, optopt; |
83265d28 | 119 | int getopt __P((int, char * const *, const char *)); |
5c02aa20 KB |
120 | |
121 | extern char *suboptarg; /* getsubopt(3) external variable */ | |
f7c699ab | 122 | int getsubopt __P((char **, char * const *, char **)); |
5c02aa20 | 123 | |
601cf9c7 | 124 | char *group_from_gid __P((unsigned long, int)); |
d052fbea KB |
125 | int heapsort __P((void *, size_t, size_t, |
126 | int (*)(const void *, const void *))); | |
993000f1 | 127 | char *initstate __P((unsigned, char *, int)); |
7acbff43 KB |
128 | int mergesort __P((void *, size_t, size_t, |
129 | int (*)(const void *, const void *))); | |
a2798976 KB |
130 | int radixsort __P((const unsigned char **, int, const unsigned char *, |
131 | unsigned)); | |
132 | int sradixsort __P((const unsigned char **, int, const unsigned char *, | |
133 | unsigned)); | |
993000f1 | 134 | long random __P((void)); |
af1eaad7 | 135 | char *realpath __P((const char *, char resolved_path[])); |
993000f1 DS |
136 | char *setstate __P((char *)); |
137 | void srandom __P((unsigned)); | |
601cf9c7 | 138 | char *user_from_uid __P((unsigned long, int)); |
a2798976 | 139 | #ifndef __STRICT_ANSI__ |
f378c57b KB |
140 | long long |
141 | strtoq __P((const char *, char **, int)); | |
142 | unsigned long long | |
143 | strtouq __P((const char *, char **, int)); | |
a2798976 | 144 | #endif |
993000f1 | 145 | void unsetenv __P((const char *)); |
5c02aa20 | 146 | #endif |
9992a62a | 147 | __END_DECLS |
fac5dcaf | 148 | |
1cc1b02a | 149 | #endif /* _STDLIB_H_ */ |