1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
|
/*
* Copyright (c) 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the rights
* to redistribute these changes.
*/
/*
**********************************************************************
* HISTORY
* $Log: libc.h,v $
* Revision 1.3 1995/12/26 22:32:22 peter
* get rid of non-applicable files...
*
* Revision 1.2 1995/12/26 05:02:45 peter
* Apply ports/net/sup/patches/patch-aa...
*
* Revision 1.1.1.1 1995/12/26 04:54:47 peter
* Import the unmodified version of the sup that we are using.
* The heritage of this version is not clear. It appears to be NetBSD
* derived from some time ago.
*
* Revision 1.1.1.1 1993/08/21 00:46:33 jkh
* Current sup with compression support.
*
* Revision 1.1.1.1 1993/05/21 14:52:17 cgd
* initial import of CMU's SUP to NetBSD
*
* Revision 1.7 89/04/03 11:10:45 vanryzin
* Changed definition of qsort for c++ to indicate the procedure
* passed to qsort has parameters. Since we were unsure if ANSI C
* could handle the syntax I placed the new definition within #if
* defined(c_plusplus) conditionals. This may not be necessary
* and perhaps should be fixed at a later time.
* [89/04/03 vanryzin]
*
* Revision 1.6 89/02/05 15:55:57 gm0w
* Added extern char *errmsg().
* [89/02/04 gm0w]
*
* Revision 1.5 89/01/20 15:34:40 gm0w
* Moved all of the STDC changes to other existing include files
* back into this one. Added non-STDC extern declarations for
* all functions without int return values to match those defined
* by STDC. Added include of sysent.h. Removed obsolete cdate
* extern declaration.
* [88/12/17 gm0w]
*
* Revision 1.4 88/12/22 16:58:56 mja
* Correct __STDC__ parameter type for getenv().
* [88/12/20 dld]
*
* Revision 1.3 88/12/14 23:31:42 mja
* Made file reentrant. Added declarations for __STDC__.
* [88/01/06 jjk]
*
* 30-Apr-88 Glenn Marcy (gm0w) at Carnegie-Mellon University
* Added pathof() extern.
*
* 01-Dec-85 Glenn Marcy (gm0w) at Carnegie-Mellon University
* Added getname() extern.
*
* 29-Nov-85 Glenn Marcy (gm0w) at Carnegie-Mellon University
* Added lseek() extern.
*
* 02-Nov-85 Glenn Marcy (gm0w) at Carnegie-Mellon University
* Added salloc() extern.
*
* 14-Aug-81 Mike Accetta (mja) at Carnegie-Mellon University
* Created.
*
**********************************************************************
*/
#ifndef _LIBC_H_
#define _LIBC_H_ 1
#if defined(__hpux)
#define __P(x) x
#endif
#ifndef _TYPES_
#include <sys/types.h>
#endif /* _TYPES_ */
#ifndef FILE
#include <stdio.h>
#endif /* FILE */
#ifndef _STRINGS_H_
#include <strings.h>
#endif /* _STRINGS_H_ */
#ifndef _TIME_H_
#include <time.h>
#endif /* _TIME_H_ */
/* CMU stdio additions */
#if defined(__STDC__)
extern FILE *fopenp(const char*, const char*, char*, char*);
extern FILE *fwantread(const char*, const char*, const char*, const char*);
extern FILE *fwantwrite(const char*, const char*, const char*, const char*,
int);
#else /* __STDC__ */
extern FILE *fopenp();
extern FILE *fwantread();
extern FILE *fwantwrite();
#endif /* __STDC__ */
/* CMU string routines */
#if defined(__STDC__)
extern char* foldup(char*, const char*);
extern char* folddown(char*, const char*);
extern char* sindex(const char*, const char*);
extern char* skipto(const char*, const char*);
extern char* skipover(const char*, const char*);
extern char* nxtarg(char**, const char*);
extern char _argbreak;
extern char* getstr(const char*, char*, char*);
extern int getstab(const char*, const char**, const char*);
extern int getsearch(const char*, const char**, const char*);
extern char* strarg(const char**, const char*, const char*, char*, char*);
extern int stabarg(const char**, const char*, const char*, const char**,
const char*);
extern int searcharg(const char**, const char*, const char*, const char**,
const char*);
extern int getint(const char*, int, int, int);
extern int intarg(const char**, const char*, const char*, int, int, int);
extern long getlong(const char*, long, long, long);
extern long longarg(const char**, const char*, const char*, long, long, long);
extern short getshort(const char*, short, short, short);
extern short shortarg(const char**, const char*, const char*,
short, short, short);
extern float getfloat(const char*, float, float, float);
extern float floatarg(const char**, const char*, const char*,
float, float, float);
extern double getdouble(const char*, double, double, double);
extern double doublearg(const char**, const char*, const char*,
double, double, double);
extern unsigned int getoct(const char*, unsigned int, unsigned int,
unsigned int);
extern unsigned int octarg(const char**, const char*, const char*,
unsigned int, unsigned int, unsigned int);
extern unsigned int gethex(const char*, unsigned int, unsigned int,
unsigned int);
extern unsigned int hexarg(const char**, const char*, const char*,
unsigned int, unsigned int, unsigned int);
extern unsigned int atoo(const char*);
extern unsigned int atoh(const char*);
extern char *salloc(const char*);
extern char *concat(const char*, int, ...);
#else /* __STDC__ */
extern char *foldup(), *folddown();
extern char *sindex(), *skipto(), *skipover(), *nxtarg();
extern char *getstr(), *strarg();
extern long getlong(), longarg();
extern short getshort(), shortarg();
extern float getfloat(), floatarg();
extern double getdouble(), doublearg();
extern unsigned int getoct(), octarg(), gethex(), hexarg();
extern unsigned int atoo(), atoh();
extern char *salloc();
extern char *concat();
#endif /* __STDC__ */
/* CMU library routines */
#if defined(__STDC__)
extern char *getname(int);
extern char *pathof(char *);
extern char *errmsg(int);
#else /* __STDC__ */
extern char *getname();
extern char *pathof();
extern char *errmsg();
#endif /* __STDC__ */
/* CMU time additions */
#if defined(__STDC__)
extern long gtime(const struct tm*);
extern long atot(const char*);
#else /* __STDC__ */
extern long gtime();
extern long atot();
#endif /* __STDC__ */
/* 4.3 BSD standard library routines; taken from man(3) */
#if defined(__STDC__)
typedef int (*PFI)();
#if defined(c_plusplus)
typedef int (*PFI2)(...);
#endif /* c_plusplus */
#if defined(__hpux)
extern int utimes(char *, struct timeval *);
#ifndef LOCK_SH
#define LOCK_SH 1
#endif
#ifndef LOCK_EX
#define LOCK_EX 2
#endif
#ifndef LOCK_NB
#define LOCK_NB 4
#endif
#ifndef LOCK_UN
#define LOCK_UN 8
#endif
extern int flock(int, int);
#endif /* __hpux */
#if 0
extern void abort(void);
extern int abs(int);
extern double atof(const char *);
extern int atoi(const char *);
extern long atol(const char *);
extern void bcopy(const void *, void *, int);
extern int bcmp(const void *, const void *, int);
extern void bzero(void *, int);
extern int ffs(int);
extern char *crypt(const char *, const char *);
extern void setkey(char *);
extern void encrypt(char *, int);
extern char *ecvt(double, int, int *, int *);
extern char *fcvt(double, int, int *, int *);
extern char *gcvt(double, int, char *);
extern int execl(const char *, ...);
extern int execv(const char *, const char **);
extern int execle(const char *, ...);
extern int exect(const char *, const char **, const char **);
extern void exit(int);
extern char *getenv(const char *);
extern char *getlogin(void);
extern int getopt(int, const char **, const char *);
extern char *getpass(const char *);
extern char *getusershell(void);
extern void setusershell(void);
extern void endusershell(void);
extern char *getwd(char *);
extern int initgroups(const char *, gid_t);
extern void *malloc(unsigned);
extern void free(void *);
extern void *realloc(void *, unsigned);
extern void *calloc(unsigned, unsigned);
extern void *alloca(int);
extern char *mktemp(char *);
extern int mkstemp(char *);
extern void monitor(PFI, PFI, short *, int, int);
extern void monstartup(PFI, PFI);
extern void moncontrol(int);
extern int pause(void);
#if defined(c_plusplus)
extern void qsort(void *, int, int, PFI2);
#else /* c_plusplus */
extern void qsort(void *, int, int, PFI);
#endif /* c_plusplus */
extern long random(void);
extern int srandom(int);
extern void *initstate(unsigned, void *, int);
extern void *setstate(void *);
extern int rcmd(char **, int, const char *, const char *, const char *, int);
extern int rresvport(int *);
extern int ruserok(char *, int, const char *, const char *);
extern char *re_comp(char *);
extern int re_exec(char *);
extern int rexec(char **, int, const char *, const char *, const char *,
int *);
extern int setuid(uid_t);
extern int seteuid(uid_t);
extern int setruid(uid_t);
extern int setgid(gid_t);
extern int setegid(gid_t);
extern int setrgid(gid_t);
extern void sleep(unsigned);
extern void swab(void *, void *, int);
extern int system(const char *);
extern char *ttyname(int);
extern int isatty(int);
extern int ttyslot(void);
extern unsigned ualarm(unsigned, unsigned);
extern void usleep(unsigned);
#endif
#else /* __STDC__ */
extern double atof();
extern long atol();
extern char *crypt();
extern char *ecvt();
extern char *fcvt();
extern char *gcvt();
extern char *getenv();
extern char *getlogin();
extern char *getpass();
extern char *getusershell();
extern char *getwd();
extern char *malloc();
extern char *realloc();
extern char *calloc();
extern char *alloca();
extern char *mktemp();
extern long random();
extern char *initstate();
extern char *setstate();
extern char *re_comp();
extern char *ttyname();
extern unsigned ualarm();
#endif /* __STDC__ */
#endif /* not _LIBC_H_ */
|