llib-lposix revision 92087
1/*	$NetBSD: llib-lposix,v 1.2 1995/07/03 21:25:09 cgd Exp $	*/
2/* $FreeBSD: head/usr.bin/xlint/llib/llib-lposix 92087 2002-03-11 11:26:17Z markm $ */
3
4/*
5 * Copyright (c) 1994, 1995 Jochen Pohl
6 * All Rights Reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 *    must display the following acknowledgement:
18 *      This product includes software developed by Jochen Pohl for
19 *	The NetBSD Project.
20 * 4. The name of the author may not be used to endorse or promote products
21 *    derived from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/* LINTLIBRARY */
36
37#define _POSIX_SOURCE
38
39#include <sys/types.h>
40#include <sys/stat.h>
41#include <sys/utsname.h>
42#include <sys/times.h>
43#include <stdio.h>
44#include <stdarg.h>
45#include <stdlib.h>
46#include <unistd.h>
47#include <math.h>
48#include <time.h>
49#include <assert.h>
50#include <termios.h>
51#include <dirent.h>
52#include <fcntl.h>
53#include <grp.h>
54#include <pwd.h>
55#include <ctype.h>
56#include <signal.h>
57#include <locale.h>
58#include <setjmp.h>
59#include <string.h>
60#include <utime.h>
61
62
63/* PROTOLIB1 */
64
65
66void	(abort)(void);
67int	(abs)(int j);
68int	(access)(const char *path, int amode);
69double	(acos)(double x);
70unsigned (alarm)(unsigned seconds);
71char	*(asctime)(const struct tm *timeptr);
72double	(asin)(double x);
73void	(__assert)(const char *expression, const char *func, int line,
74		   const char *file);
75double	(atan)(double x);
76double	(atan2)(double y, double x);
77int	(atexit)(void (*func)(void));
78double	(atof)(const char *nptr);
79int	(atoi)(const char *nptr);
80long	(atol)(const char *nptr);
81void	*(bsearch)(const void *key, const void *base, size_t nmemb,
82		   size_t size, int (*compar)(const void *, const void *));
83void	*(calloc)(size_t nmemb, size_t size);
84double	(ceil)(double x);
85speed_t	(cfgetispeed)(const struct termios *p);
86speed_t	(cfgetospeed)(const struct termios *p);
87int	(cfsetispeed)(struct termios *p, speed_t speed);
88int	(cfsetospeed)(struct termios *p, speed_t speed);
89int	(chdir)(const char *path);
90int	(chmod)(const char *path, mode_t mode);
91int	(chown)(const char *path, uid_t owner, gid_t group);
92void	(clearerr)(FILE *stream);
93clock_t	(clock)(void);
94int	(close)(int fildes);
95int	(closedir)(DIR *dirp);
96double	(cos)(double x);
97double	(cosh)(double x);
98int	(creat)(const char *path, mode_t mode);
99char	*(ctermid)(char *s);
100char	*(ctime)(const time_t *timer);
101char	*(cuserid)(char *s);
102double	(difftime)(time_t time1, time_t time0);
103div_t	(div)(int numer, int denom);
104int	(dup)(int fildes);
105int	(dup2)(int fildes, int fildes2);
106int	(errno);
107int	(execl)(const char *path, const char *arg, ...);
108int	(execle)(const char *path, const char *arg, ...);
109int	(execlp)(const char *file, const char *arg, ...);
110int	(execv)(const char *path, char *const argv[]);
111int	(execve)(const char *path, char *const argv[], char *const *envp);
112int	(execvp)(const char *file, char *const argv[]);
113void	(exit)(int status);
114void	(_exit)(int status);
115double	(exp)(double x);
116double	(fabs)(double x);
117int	(fclose)(FILE *stream);
118int	(fcntl)(int fildes, int cmd, ...);
119FILE	*(fdopen)(int fildes, const char *type);
120int	(feof)(FILE *stream);
121int	(ferror)(FILE *stream);
122int	(fflush)(FILE *stream);
123int	(fgetc)(FILE *stream);
124int	(fgetpos)(FILE *stream, fpos_t *pos);
125char	*(fgets)(char *s, int n, FILE *stream);
126int	(fileno)(FILE *stream);
127double	(floor)(double x);
128double	(fmod)(double x, double y);
129FILE	*(fopen)(const char *filename, const char *mode);
130pid_t	(fork)(void);
131long	(fpathconf)(int fildes, int name);
132/* PRINTFLIKE2 */
133int	(fprintf)(FILE *stream, const char *format, ...);
134int	(fputc)(int c, FILE *stream);
135int	(fputs)(const char *s, FILE *stream);
136size_t	(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
137void	(free)(void *ptr);
138FILE	*(freopen)(const char *filename, const char *mode, FILE *stream);
139double	(frepx)(double value, int *exp);
140/* SCANFLIKE2 */
141int	(fscanf)(FILE *stream, const char *format, ...);
142int	(fseek)(FILE *stream, long int offset, int whence);
143int	(fsetpos)(FILE *stream, const fpos_t *pos);
144int	(fstat)(int fildes, struct stat *buf);
145long	(ftell)(FILE *stream);
146size_t	(fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream);
147int	(getc)(FILE *stream);
148int	(getchar)(void);
149char	*(getcwd)(char *buf, size_t size);
150gid_t	(getegid)(void);
151char	*(getenv)(const char *name);
152uid_t	(geteuid)(void);
153gid_t	(getgid)(void);
154struct	group *(getgrgid)(gid_t gid);
155struct	group *(getgrnam)(const char *name);
156int	(getgroups)(int gidsetsize, gid_t grouplist[]);
157char	*(getlogin)(void);
158pid_t	(getpgrp)(void);
159pid_t	(getpid)(void);
160pid_t	(getppid)(void);
161struct	passwd *(getpwnam)(const char *name);
162struct	passwd *(getpwuid)(uid_t uid);
163char	*(gets)(char *s);
164uid_t	(getuid)(void);
165struct	tm *(gmtime)(const time_t *timer);
166int	(isalnum)(int c);
167int	(isalpha)(int c);
168int	(isatty)(int fildes);
169int	(iscntrl)(int c);
170int	(isdigit)(int c);
171int	(isgraph)(int c);
172int	(islower)(int c);
173int	(isprint)(int c);
174int	(ispunct)(int c);
175int	(isspace)(int c);
176int	(isupper)(int c);
177int	(isxdigit)(int c);
178int	(kill)(pid_t pid, int sig);
179long	(labs)(long j);
180double	(ldexp)(double x, int exp);
181ldiv_t	(ldiv)(long numer, long denom);
182int	(link)(const char *existing, const char *new);
183struct	lconv *(localeconv)(void);
184struct	tm *(localtime)(const time_t *timer);
185double	(log)(double x);
186double	(log10)(double x);
187void	(longjmp)(jmp_buf env, int val);
188off_t	(lseek)(int fildes, off_t offset, int whence);
189void	*(malloc)(size_t size);
190int	(mblen)(const char *s, size_t n);
191size_t	(mbstowcs)(wchar_t *pwcs, const char *s, size_t n);
192int	(mbtowc)(wchar_t *pwc, const char *s, size_t n);
193void	*(memchr)(const void *s, int c, size_t n);
194int	(memcmp)(const void *s1, const void *s2, size_t n);
195void	*(memcpy)(void *s1, const void *s2, size_t n);
196void	*(memmove)(void *s1, const void *s2, size_t n);
197void	*(memset)(void *s, int c, size_t n);
198int	(mkdir)(const char *path, mode_t mode);
199int	(mkfifo)(const char *path, mode_t mode);
200time_t	(mktime)(struct tm *timeptr);
201double	(modf)(double value, double *iptr);
202int	(open)(const char *path, int oflag, ...);
203DIR	*(opendir)(const char *dirname);
204long	(pathconf)(const char *path, int name);
205int	(pause)(void);
206void	(perror)(const char *s);
207int	(pipe)(int fildes[2]);
208double	(pow)(double x, double y);
209/* PRINTFLIKE1 */
210int	(printf)(const char *format, ...);
211int	(putc)(int c, FILE *stream);
212int	(putchar)(int c);
213int	(puts)(const char *s);
214void	(qsort)(void *base, size_t nmemb, size_t size,
215	        int (*compar)(const void *, const void *));
216int	(raise)(int sig);
217int	(rand)(void);
218ssize_t	(read)(int fildes, void *buf, size_t nbyte);
219struct	dirent *(readdir)(DIR *dirp);
220void	*(realloc)(void *ptr, size_t size);
221int	(remove)(const char *filename);
222int	(rename)(const char *old, const char *new);
223void	(rewind)(FILE *stream);
224void	(rewinddir)(DIR *dirp);
225int	(rmdir)(const char *path);
226/* SCANFLIKE1 */
227int	(scanf)(const char *format, ...);
228void	(setbuf)(FILE *stream, char *buf);
229int	(setgid)(gid_t gid);
230int	(setjmp)(jmp_buf env);
231char	*(setlocale)(int category, const char *locale);
232int	(setpgid)(pid_t pid, pid_t pgid);
233pid_t	(setsid)(void);
234int	(setuid)(uid_t uid);
235int	(setvbuf)(FILE *stream, char *buf, int mode, size_t size);
236int	(sigaction)(int sig, const struct sigaction *act,
237		    struct sigaction *oact);
238int	(sigaddset)(sigset_t *set, int signo);
239int	(sigdelset)(sigset_t *set, int signo);
240int	(sigemptyset)(sigset_t *set);
241int	(sigfillset)(sigset_t *set);
242int	(sigismember)(const sigset_t *set, int signo);
243void	(siglongjmp)(sigjmp_buf env, int val);
244void	(*(signal)(int sig, void (*func)(int)))(int);
245int	(sigpending)(sigset_t *set);
246int	(sigprocmask)(int how, const sigset_t *set, sigset_t *oset);
247int	(sigsetjmp)(sigjmp_buf env, int savemask);
248int	(sigsuspend)(const sigset_t *sigmask);
249double	(sin)(double x);
250double	(sinh)(double x);
251unsigned (sleep)(unsigned seconds);
252/* PRINTFLIKE2 */
253int	(sprintf)(char *s, const char *format, ...);
254double	(sqrt)(double x);
255void	(srand)(unsigned seed);
256/* SCANFLIKE2 */
257int	(sscanf)(const char *s, const char *format, ...);
258int	(stat)(const char *path, struct stat *buf);
259char	*(strcat)(char *s1, const char *s2);
260char	*(strchr)(const char *s, int c);
261int	(strcmp)(const char *s1, const char *s2);
262int	(strcoll)(const char *s1, const char *s2);
263char	*(strcpy)(char *s1, const char *s2);
264size_t	(strcspn)(const char *s1, const char *s2);
265char	*(strerror)(int errnum);
266size_t	(strftime)(char *s, size_t maxsize, const char *format,
267		    const struct tm *timeptr);
268size_t	(strlen)(const char *s);
269char	*(strncat)(char *s1, const char *s2, size_t n);
270int	(strncmp)(const char *s1, const char *s2, size_t n);
271char	*(strncpy)(char *s1, const char *s2, size_t n);
272char	*(strpbrk)(const char *s1, const char *s2);
273char	*(strrchr)(const char *s, int c);
274size_t	(strspn)(const char *s1, const char *s2);
275char	*(strstr)(const char *s1, const char *s2);
276double	(strtod)(const char *nptr, char **endptr);
277char	*(strtok)(char *s1, const char *s2);
278long	(strtol)(const char *nptr, char **endptr, int base);
279unsigned long (strtoul)(const char *nptr, char **endptr, int base);
280size_t	(strxfrm)(char *s1, const char *s2, size_t n);
281long	(sysconf)(int name);
282int	(system)(const char *string);
283double	(tan)(double x);
284double	(tanh)(double x);
285int	(tcdrain)(int fildes);
286int	(tcflow)(int fildes, int action);
287int	(tcflush)(int fildes, int queue_selector);
288int	(tcgetattr)(int fildes, struct termios *tp);
289pid_t	(tcgetpgrp)(int fildes);
290int	(tcsendbreak)(int fildes, int duration);
291int	(tcsetattr)(int fildes, int options, const struct termios *tp);
292int	(tcsetpgrp)(int fildes, pid_t pgrpid);
293time_t	(time)(time_t *timer);
294clock_t	(times)(struct tms *buffer);
295FILE	*(tmpfile)(void);
296char	*(tmpnam)(char *s);
297int	(tolower)(int c);
298int	(toupper)(int c);
299char	*(ttyname)(int filedes);
300void	(tzset)(void);
301mode_t	(umask)(mode_t cmask);
302int	(uname)(struct utsname *name);
303int	(ungetc)(int c, FILE *stream);
304int	(unlink)(const char *path);
305int	(utime)(const char *path, const struct utimbuf *times);
306int	(vfprintf)(FILE *stream, const char *format, va_list arg);
307int	(vprintf)(const char *format, va_list arg);
308int	(vsprintf)(char *s, const char *format, va_list arg);
309pid_t	(wait)(int *statloc);
310pid_t	(waitpid)(pid_t pid, int *stat_loc, int options);
311size_t	(wcstombs)(char *s, const wchar_t *pwcs, size_t n);
312int	(wctomb)(char *s, wchar_t wchar);
313ssize_t	(write)(int fildes, const void *buf, size_t nbyte);
314