]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.bin/xlint/llib/llib-lposix
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.bin / xlint / llib / llib-lposix
1 /*      $NetBSD: llib-lposix,v 1.2 1995/07/03 21:25:09 cgd Exp $        */
2 /* $FreeBSD$ */
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/time.h>
41 #include <sys/stat.h>
42 #include <sys/utsname.h>
43 #include <sys/times.h>
44 #include <stdio.h>
45 #include <stdarg.h>
46 #include <stdlib.h>
47 #include <unistd.h>
48 #include <math.h>
49 #include <time.h>
50 #include <assert.h>
51 #include <termios.h>
52 #include <dirent.h>
53 #include <fcntl.h>
54 #include <grp.h>
55 #include <pwd.h>
56 #include <ctype.h>
57 #include <signal.h>
58 #include <locale.h>
59 #include <setjmp.h>
60 #include <string.h>
61 #include <utime.h>
62
63
64 /* PROTOLIB1 */
65
66
67 void    (abort)(void);
68 int     (abs)(int j);
69 int     (access)(const char *path, int amode);
70 double  (acos)(double x);
71 unsigned (alarm)(unsigned seconds);
72 char    *(asctime)(const struct tm *timeptr);
73 double  (asin)(double x);
74 void    (__assert)(const char *expression, const char *func, int line,
75                    const char *file);
76 double  (atan)(double x);
77 double  (atan2)(double y, double x);
78 int     (atexit)(void (*func)(void));
79 double  (atof)(const char *nptr);
80 int     (atoi)(const char *nptr);
81 long    (atol)(const char *nptr);
82 void    *(bsearch)(const void *key, const void *base, size_t nmemb,
83                    size_t size, int (*compar)(const void *, const void *));
84 void    *(calloc)(size_t nmemb, size_t size);
85 double  (ceil)(double x);
86 speed_t (cfgetispeed)(const struct termios *p);
87 speed_t (cfgetospeed)(const struct termios *p);
88 int     (cfsetispeed)(struct termios *p, speed_t speed);
89 int     (cfsetospeed)(struct termios *p, speed_t speed);
90 int     (chdir)(const char *path);
91 int     (chmod)(const char *path, mode_t mode);
92 int     (chown)(const char *path, uid_t owner, gid_t group);
93 void    (clearerr)(FILE *stream);
94 clock_t (clock)(void);
95 int     (close)(int fildes);
96 int     (closedir)(DIR *dirp);
97 double  (cos)(double x);
98 double  (cosh)(double x);
99 int     (creat)(const char *path, mode_t mode);
100 char    *(ctermid)(char *s);
101 char    *(ctime)(const time_t *timer);
102 char    *(cuserid)(char *s);
103 double  (difftime)(time_t time1, time_t time0);
104 div_t   (div)(int numer, int denom);
105 int     (dup)(int fildes);
106 int     (dup2)(int fildes, int fildes2);
107 int     (errno);
108 int     (execl)(const char *path, const char *arg, ...);
109 int     (execle)(const char *path, const char *arg, ...);
110 int     (execlp)(const char *file, const char *arg, ...);
111 int     (execv)(const char *path, char *const argv[]);
112 int     (execve)(const char *path, char *const argv[], char *const *envp);
113 int     (execvp)(const char *file, char *const argv[]);
114 void    (exit)(int status);
115 void    (_exit)(int status);
116 double  (exp)(double x);
117 double  (fabs)(double x);
118 int     (fclose)(FILE *stream);
119 int     (fcntl)(int fildes, int cmd, ...);
120 FILE    *(fdopen)(int fildes, const char *type);
121 int     (feof)(FILE *stream);
122 int     (ferror)(FILE *stream);
123 int     (fflush)(FILE *stream);
124 int     (fgetc)(FILE *stream);
125 int     (fgetpos)(FILE *stream, fpos_t *pos);
126 char    *(fgets)(char *s, int n, FILE *stream);
127 int     (fileno)(FILE *stream);
128 double  (floor)(double x);
129 double  (fmod)(double x, double y);
130 FILE    *(fopen)(const char *filename, const char *mode);
131 pid_t   (fork)(void);
132 long    (fpathconf)(int fildes, int name);
133 /* PRINTFLIKE2 */
134 int     (fprintf)(FILE *stream, const char *format, ...);
135 int     (fputc)(int c, FILE *stream);
136 int     (fputs)(const char *s, FILE *stream);
137 size_t  (fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
138 void    (free)(void *ptr);
139 FILE    *(freopen)(const char *filename, const char *mode, FILE *stream);
140 double  (frepx)(double value, int *exp);
141 /* SCANFLIKE2 */
142 int     (fscanf)(FILE *stream, const char *format, ...);
143 int     (fseek)(FILE *stream, long int offset, int whence);
144 int     (fsetpos)(FILE *stream, const fpos_t *pos);
145 int     (fstat)(int fildes, struct stat *buf);
146 long    (ftell)(FILE *stream);
147 size_t  (fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream);
148 int     (getc)(FILE *stream);
149 int     (getchar)(void);
150 char    *(getcwd)(char *buf, size_t size);
151 gid_t   (getegid)(void);
152 char    *(getenv)(const char *name);
153 uid_t   (geteuid)(void);
154 gid_t   (getgid)(void);
155 struct  group *(getgrgid)(gid_t gid);
156 struct  group *(getgrnam)(const char *name);
157 int     (getgroups)(int gidsetsize, gid_t grouplist[]);
158 char    *(getlogin)(void);
159 pid_t   (getpgrp)(void);
160 pid_t   (getpid)(void);
161 pid_t   (getppid)(void);
162 struct  passwd *(getpwnam)(const char *name);
163 struct  passwd *(getpwuid)(uid_t uid);
164 char    *(gets)(char *s);
165 uid_t   (getuid)(void);
166 struct  tm *(gmtime)(const time_t *timer);
167 int     (isalnum)(int c);
168 int     (isalpha)(int c);
169 int     (isatty)(int fildes);
170 int     (iscntrl)(int c);
171 int     (isdigit)(int c);
172 int     (isgraph)(int c);
173 int     (islower)(int c);
174 int     (isprint)(int c);
175 int     (ispunct)(int c);
176 int     (isspace)(int c);
177 int     (isupper)(int c);
178 int     (isxdigit)(int c);
179 int     (kill)(pid_t pid, int sig);
180 long    (labs)(long j);
181 double  (ldexp)(double x, int exp);
182 ldiv_t  (ldiv)(long numer, long denom);
183 int     (link)(const char *existing, const char *new);
184 struct  lconv *(localeconv)(void);
185 struct  tm *(localtime)(const time_t *timer);
186 double  (log)(double x);
187 double  (log10)(double x);
188 void    (longjmp)(jmp_buf env, int val);
189 off_t   (lseek)(int fildes, off_t offset, int whence);
190 void    *(malloc)(size_t size);
191 int     (mblen)(const char *s, size_t n);
192 size_t  (mbstowcs)(wchar_t *pwcs, const char *s, size_t n);
193 int     (mbtowc)(wchar_t *pwc, const char *s, size_t n);
194 void    *(memchr)(const void *s, int c, size_t n);
195 int     (memcmp)(const void *s1, const void *s2, size_t n);
196 void    *(memcpy)(void *s1, const void *s2, size_t n);
197 void    *(memmove)(void *s1, const void *s2, size_t n);
198 void    *(memset)(void *s, int c, size_t n);
199 int     (mkdir)(const char *path, mode_t mode);
200 int     (mkfifo)(const char *path, mode_t mode);
201 time_t  (mktime)(struct tm *timeptr);
202 double  (modf)(double value, double *iptr);
203 int     (open)(const char *path, int oflag, ...);
204 DIR     *(opendir)(const char *dirname);
205 long    (pathconf)(const char *path, int name);
206 int     (pause)(void);
207 void    (perror)(const char *s);
208 int     (pipe)(int fildes[2]);
209 double  (pow)(double x, double y);
210 /* PRINTFLIKE1 */
211 int     (printf)(const char *format, ...);
212 int     (putc)(int c, FILE *stream);
213 int     (putchar)(int c);
214 int     (puts)(const char *s);
215 void    (qsort)(void *base, size_t nmemb, size_t size,
216                 int (*compar)(const void *, const void *));
217 int     (raise)(int sig);
218 int     (rand)(void);
219 ssize_t (read)(int fildes, void *buf, size_t nbyte);
220 struct  dirent *(readdir)(DIR *dirp);
221 void    *(realloc)(void *ptr, size_t size);
222 int     (remove)(const char *filename);
223 int     (rename)(const char *old, const char *new);
224 void    (rewind)(FILE *stream);
225 void    (rewinddir)(DIR *dirp);
226 int     (rmdir)(const char *path);
227 /* SCANFLIKE1 */
228 int     (scanf)(const char *format, ...);
229 void    (setbuf)(FILE *stream, char *buf);
230 int     (setgid)(gid_t gid);
231 int     (setjmp)(jmp_buf env);
232 char    *(setlocale)(int category, const char *locale);
233 int     (setpgid)(pid_t pid, pid_t pgid);
234 pid_t   (setsid)(void);
235 int     (setuid)(uid_t uid);
236 int     (setvbuf)(FILE *stream, char *buf, int mode, size_t size);
237 int     (sigaction)(int sig, const struct sigaction *act,
238                     struct sigaction *oact);
239 int     (sigaddset)(sigset_t *set, int signo);
240 int     (sigdelset)(sigset_t *set, int signo);
241 int     (sigemptyset)(sigset_t *set);
242 int     (sigfillset)(sigset_t *set);
243 int     (sigismember)(const sigset_t *set, int signo);
244 void    (siglongjmp)(sigjmp_buf env, int val);
245 void    (*(signal)(int sig, void (*func)(int)))(int);
246 int     (sigpending)(sigset_t *set);
247 int     (sigprocmask)(int how, const sigset_t *set, sigset_t *oset);
248 int     (sigsetjmp)(sigjmp_buf env, int savemask);
249 int     (sigsuspend)(const sigset_t *sigmask);
250 double  (sin)(double x);
251 double  (sinh)(double x);
252 unsigned (sleep)(unsigned seconds);
253 /* PRINTFLIKE2 */
254 int     (sprintf)(char *s, const char *format, ...);
255 double  (sqrt)(double x);
256 void    (srand)(unsigned seed);
257 /* SCANFLIKE2 */
258 int     (sscanf)(const char *s, const char *format, ...);
259 int     (stat)(const char *path, struct stat *buf);
260 char    *(strcat)(char *s1, const char *s2);
261 char    *(strchr)(const char *s, int c);
262 int     (strcmp)(const char *s1, const char *s2);
263 int     (strcoll)(const char *s1, const char *s2);
264 char    *(strcpy)(char *s1, const char *s2);
265 size_t  (strcspn)(const char *s1, const char *s2);
266 char    *(strerror)(int errnum);
267 size_t  (strftime)(char *s, size_t maxsize, const char *format,
268                     const struct tm *timeptr);
269 size_t  (strlen)(const char *s);
270 char    *(strncat)(char *s1, const char *s2, size_t n);
271 int     (strncmp)(const char *s1, const char *s2, size_t n);
272 char    *(strncpy)(char *s1, const char *s2, size_t n);
273 char    *(strpbrk)(const char *s1, const char *s2);
274 char    *(strrchr)(const char *s, int c);
275 size_t  (strspn)(const char *s1, const char *s2);
276 char    *(strstr)(const char *s1, const char *s2);
277 double  (strtod)(const char *nptr, char **endptr);
278 char    *(strtok)(char *s1, const char *s2);
279 long    (strtol)(const char *nptr, char **endptr, int base);
280 unsigned long (strtoul)(const char *nptr, char **endptr, int base);
281 size_t  (strxfrm)(char *s1, const char *s2, size_t n);
282 long    (sysconf)(int name);
283 int     (system)(const char *string);
284 double  (tan)(double x);
285 double  (tanh)(double x);
286 int     (tcdrain)(int fildes);
287 int     (tcflow)(int fildes, int action);
288 int     (tcflush)(int fildes, int queue_selector);
289 int     (tcgetattr)(int fildes, struct termios *tp);
290 pid_t   (tcgetpgrp)(int fildes);
291 int     (tcsendbreak)(int fildes, int duration);
292 int     (tcsetattr)(int fildes, int options, const struct termios *tp);
293 int     (tcsetpgrp)(int fildes, pid_t pgrpid);
294 time_t  (time)(time_t *timer);
295 clock_t (times)(struct tms *buffer);
296 FILE    *(tmpfile)(void);
297 char    *(tmpnam)(char *s);
298 int     (tolower)(int c);
299 int     (toupper)(int c);
300 char    *(ttyname)(int filedes);
301 void    (tzset)(void);
302 mode_t  (umask)(mode_t cmask);
303 int     (uname)(struct utsname *name);
304 int     (ungetc)(int c, FILE *stream);
305 int     (unlink)(const char *path);
306 int     (utime)(const char *path, const struct utimbuf *times);
307 int     (vfprintf)(FILE *stream, const char *format, va_list arg);
308 int     (vprintf)(const char *format, va_list arg);
309 int     (vsprintf)(char *s, const char *format, va_list arg);
310 pid_t   (wait)(int *statloc);
311 pid_t   (waitpid)(pid_t pid, int *stat_loc, int options);
312 size_t  (wcstombs)(char *s, const wchar_t *pwcs, size_t n);
313 int     (wctomb)(char *s, wchar_t wchar);
314 ssize_t (write)(int fildes, const void *buf, size_t nbyte);