192087Smarkm/*	$NetBSD: llib-lposix,v 1.2 1995/07/03 21:25:09 cgd Exp $	*/
292087Smarkm/* $FreeBSD$ */
312099Sjoerg
412099Sjoerg/*
512099Sjoerg * Copyright (c) 1994, 1995 Jochen Pohl
612099Sjoerg * All Rights Reserved.
712099Sjoerg *
812099Sjoerg * Redistribution and use in source and binary forms, with or without
912099Sjoerg * modification, are permitted provided that the following conditions
1012099Sjoerg * are met:
1112099Sjoerg * 1. Redistributions of source code must retain the above copyright
1212099Sjoerg *    notice, this list of conditions and the following disclaimer.
1312099Sjoerg * 2. Redistributions in binary form must reproduce the above copyright
1412099Sjoerg *    notice, this list of conditions and the following disclaimer in the
1512099Sjoerg *    documentation and/or other materials provided with the distribution.
1612099Sjoerg * 3. All advertising materials mentioning features or use of this software
1712099Sjoerg *    must display the following acknowledgement:
1812099Sjoerg *      This product includes software developed by Jochen Pohl for
1912099Sjoerg *	The NetBSD Project.
2012099Sjoerg * 4. The name of the author may not be used to endorse or promote products
2112099Sjoerg *    derived from this software without specific prior written permission.
2212099Sjoerg *
2312099Sjoerg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2412099Sjoerg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2512099Sjoerg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2612099Sjoerg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2712099Sjoerg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2812099Sjoerg * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2912099Sjoerg * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3012099Sjoerg * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3112099Sjoerg * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3212099Sjoerg * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3312099Sjoerg */
3412099Sjoerg
3512099Sjoerg/* LINTLIBRARY */
3612099Sjoerg
3712099Sjoerg#define _POSIX_SOURCE
3812099Sjoerg
3912099Sjoerg#include <sys/types.h>
4098549Sphk#include <sys/time.h>
4112099Sjoerg#include <sys/stat.h>
4212099Sjoerg#include <sys/utsname.h>
4312099Sjoerg#include <sys/times.h>
4412099Sjoerg#include <stdio.h>
4512099Sjoerg#include <stdarg.h>
4612099Sjoerg#include <stdlib.h>
4712099Sjoerg#include <unistd.h>
4812099Sjoerg#include <math.h>
4912099Sjoerg#include <time.h>
5012099Sjoerg#include <assert.h>
5112099Sjoerg#include <termios.h>
5212099Sjoerg#include <dirent.h>
5312099Sjoerg#include <fcntl.h>
5412099Sjoerg#include <grp.h>
5512099Sjoerg#include <pwd.h>
5612099Sjoerg#include <ctype.h>
5712099Sjoerg#include <signal.h>
5812099Sjoerg#include <locale.h>
5912099Sjoerg#include <setjmp.h>
6012099Sjoerg#include <string.h>
6112099Sjoerg#include <utime.h>
6212099Sjoerg
6312099Sjoerg
6412099Sjoerg/* PROTOLIB1 */
6512099Sjoerg
6612099Sjoerg
6712099Sjoergvoid	(abort)(void);
6812099Sjoergint	(abs)(int j);
6912099Sjoergint	(access)(const char *path, int amode);
7012099Sjoergdouble	(acos)(double x);
7112099Sjoergunsigned (alarm)(unsigned seconds);
7212099Sjoergchar	*(asctime)(const struct tm *timeptr);
7312099Sjoergdouble	(asin)(double x);
7492087Smarkmvoid	(__assert)(const char *expression, const char *func, int line,
7592087Smarkm		   const char *file);
7612099Sjoergdouble	(atan)(double x);
7712099Sjoergdouble	(atan2)(double y, double x);
7812099Sjoergint	(atexit)(void (*func)(void));
7912099Sjoergdouble	(atof)(const char *nptr);
8012099Sjoergint	(atoi)(const char *nptr);
8112099Sjoerglong	(atol)(const char *nptr);
8212099Sjoergvoid	*(bsearch)(const void *key, const void *base, size_t nmemb,
8312099Sjoerg		   size_t size, int (*compar)(const void *, const void *));
8412099Sjoergvoid	*(calloc)(size_t nmemb, size_t size);
8512099Sjoergdouble	(ceil)(double x);
8612099Sjoergspeed_t	(cfgetispeed)(const struct termios *p);
8712099Sjoergspeed_t	(cfgetospeed)(const struct termios *p);
8812099Sjoergint	(cfsetispeed)(struct termios *p, speed_t speed);
8912099Sjoergint	(cfsetospeed)(struct termios *p, speed_t speed);
9012099Sjoergint	(chdir)(const char *path);
9112099Sjoergint	(chmod)(const char *path, mode_t mode);
9212099Sjoergint	(chown)(const char *path, uid_t owner, gid_t group);
9312099Sjoergvoid	(clearerr)(FILE *stream);
9412099Sjoergclock_t	(clock)(void);
9512099Sjoergint	(close)(int fildes);
9612099Sjoergint	(closedir)(DIR *dirp);
9712099Sjoergdouble	(cos)(double x);
9812099Sjoergdouble	(cosh)(double x);
9912099Sjoergint	(creat)(const char *path, mode_t mode);
10012099Sjoergchar	*(ctermid)(char *s);
10112099Sjoergchar	*(ctime)(const time_t *timer);
10212099Sjoergchar	*(cuserid)(char *s);
10312099Sjoergdouble	(difftime)(time_t time1, time_t time0);
10412099Sjoergdiv_t	(div)(int numer, int denom);
10512099Sjoergint	(dup)(int fildes);
10612099Sjoergint	(dup2)(int fildes, int fildes2);
10712099Sjoergint	(errno);
10812099Sjoergint	(execl)(const char *path, const char *arg, ...);
10912099Sjoergint	(execle)(const char *path, const char *arg, ...);
11012099Sjoergint	(execlp)(const char *file, const char *arg, ...);
11112099Sjoergint	(execv)(const char *path, char *const argv[]);
11212099Sjoergint	(execve)(const char *path, char *const argv[], char *const *envp);
11312099Sjoergint	(execvp)(const char *file, char *const argv[]);
11412099Sjoergvoid	(exit)(int status);
11512099Sjoergvoid	(_exit)(int status);
11612099Sjoergdouble	(exp)(double x);
11712099Sjoergdouble	(fabs)(double x);
11812099Sjoergint	(fclose)(FILE *stream);
11912099Sjoergint	(fcntl)(int fildes, int cmd, ...);
12012099SjoergFILE	*(fdopen)(int fildes, const char *type);
12112099Sjoergint	(feof)(FILE *stream);
12212099Sjoergint	(ferror)(FILE *stream);
12312099Sjoergint	(fflush)(FILE *stream);
12412099Sjoergint	(fgetc)(FILE *stream);
12512099Sjoergint	(fgetpos)(FILE *stream, fpos_t *pos);
12612099Sjoergchar	*(fgets)(char *s, int n, FILE *stream);
12712099Sjoergint	(fileno)(FILE *stream);
12812099Sjoergdouble	(floor)(double x);
12912099Sjoergdouble	(fmod)(double x, double y);
13012099SjoergFILE	*(fopen)(const char *filename, const char *mode);
13112099Sjoergpid_t	(fork)(void);
13212099Sjoerglong	(fpathconf)(int fildes, int name);
13312099Sjoerg/* PRINTFLIKE2 */
13412099Sjoergint	(fprintf)(FILE *stream, const char *format, ...);
13512099Sjoergint	(fputc)(int c, FILE *stream);
13612099Sjoergint	(fputs)(const char *s, FILE *stream);
13712099Sjoergsize_t	(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
13812099Sjoergvoid	(free)(void *ptr);
13912099SjoergFILE	*(freopen)(const char *filename, const char *mode, FILE *stream);
14012099Sjoergdouble	(frepx)(double value, int *exp);
14112099Sjoerg/* SCANFLIKE2 */
14212099Sjoergint	(fscanf)(FILE *stream, const char *format, ...);
14312099Sjoergint	(fseek)(FILE *stream, long int offset, int whence);
14412099Sjoergint	(fsetpos)(FILE *stream, const fpos_t *pos);
14512099Sjoergint	(fstat)(int fildes, struct stat *buf);
14612099Sjoerglong	(ftell)(FILE *stream);
14712099Sjoergsize_t	(fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream);
14812099Sjoergint	(getc)(FILE *stream);
14912099Sjoergint	(getchar)(void);
15012099Sjoergchar	*(getcwd)(char *buf, size_t size);
15112099Sjoerggid_t	(getegid)(void);
15212099Sjoergchar	*(getenv)(const char *name);
15312099Sjoerguid_t	(geteuid)(void);
15412099Sjoerggid_t	(getgid)(void);
15512099Sjoergstruct	group *(getgrgid)(gid_t gid);
15612099Sjoergstruct	group *(getgrnam)(const char *name);
15712099Sjoergint	(getgroups)(int gidsetsize, gid_t grouplist[]);
15812099Sjoergchar	*(getlogin)(void);
15912099Sjoergpid_t	(getpgrp)(void);
16012099Sjoergpid_t	(getpid)(void);
16112099Sjoergpid_t	(getppid)(void);
16212099Sjoergstruct	passwd *(getpwnam)(const char *name);
16312099Sjoergstruct	passwd *(getpwuid)(uid_t uid);
16412099Sjoergchar	*(gets)(char *s);
16512099Sjoerguid_t	(getuid)(void);
16612099Sjoergstruct	tm *(gmtime)(const time_t *timer);
16712099Sjoergint	(isalnum)(int c);
16812099Sjoergint	(isalpha)(int c);
16912099Sjoergint	(isatty)(int fildes);
17012099Sjoergint	(iscntrl)(int c);
17112099Sjoergint	(isdigit)(int c);
17212099Sjoergint	(isgraph)(int c);
17312099Sjoergint	(islower)(int c);
17412099Sjoergint	(isprint)(int c);
17512099Sjoergint	(ispunct)(int c);
17612099Sjoergint	(isspace)(int c);
17712099Sjoergint	(isupper)(int c);
17812099Sjoergint	(isxdigit)(int c);
17912099Sjoergint	(kill)(pid_t pid, int sig);
18012099Sjoerglong	(labs)(long j);
18112099Sjoergdouble	(ldexp)(double x, int exp);
18212099Sjoergldiv_t	(ldiv)(long numer, long denom);
18312099Sjoergint	(link)(const char *existing, const char *new);
18412099Sjoergstruct	lconv *(localeconv)(void);
18512099Sjoergstruct	tm *(localtime)(const time_t *timer);
18612099Sjoergdouble	(log)(double x);
18712099Sjoergdouble	(log10)(double x);
18812099Sjoergvoid	(longjmp)(jmp_buf env, int val);
18912099Sjoergoff_t	(lseek)(int fildes, off_t offset, int whence);
19012099Sjoergvoid	*(malloc)(size_t size);
19112099Sjoergint	(mblen)(const char *s, size_t n);
19212099Sjoergsize_t	(mbstowcs)(wchar_t *pwcs, const char *s, size_t n);
19312099Sjoergint	(mbtowc)(wchar_t *pwc, const char *s, size_t n);
19412099Sjoergvoid	*(memchr)(const void *s, int c, size_t n);
19512099Sjoergint	(memcmp)(const void *s1, const void *s2, size_t n);
19612099Sjoergvoid	*(memcpy)(void *s1, const void *s2, size_t n);
19712099Sjoergvoid	*(memmove)(void *s1, const void *s2, size_t n);
19812099Sjoergvoid	*(memset)(void *s, int c, size_t n);
19912099Sjoergint	(mkdir)(const char *path, mode_t mode);
20012099Sjoergint	(mkfifo)(const char *path, mode_t mode);
20112099Sjoergtime_t	(mktime)(struct tm *timeptr);
20212099Sjoergdouble	(modf)(double value, double *iptr);
20312099Sjoergint	(open)(const char *path, int oflag, ...);
20412099SjoergDIR	*(opendir)(const char *dirname);
20512099Sjoerglong	(pathconf)(const char *path, int name);
20612099Sjoergint	(pause)(void);
20712099Sjoergvoid	(perror)(const char *s);
20812099Sjoergint	(pipe)(int fildes[2]);
20912099Sjoergdouble	(pow)(double x, double y);
21012099Sjoerg/* PRINTFLIKE1 */
21112099Sjoergint	(printf)(const char *format, ...);
21212099Sjoergint	(putc)(int c, FILE *stream);
21312099Sjoergint	(putchar)(int c);
21412099Sjoergint	(puts)(const char *s);
21512099Sjoergvoid	(qsort)(void *base, size_t nmemb, size_t size,
21612099Sjoerg	        int (*compar)(const void *, const void *));
21712099Sjoergint	(raise)(int sig);
21812099Sjoergint	(rand)(void);
21912099Sjoergssize_t	(read)(int fildes, void *buf, size_t nbyte);
22012099Sjoergstruct	dirent *(readdir)(DIR *dirp);
22112099Sjoergvoid	*(realloc)(void *ptr, size_t size);
22212099Sjoergint	(remove)(const char *filename);
22312099Sjoergint	(rename)(const char *old, const char *new);
22412099Sjoergvoid	(rewind)(FILE *stream);
22512099Sjoergvoid	(rewinddir)(DIR *dirp);
22612099Sjoergint	(rmdir)(const char *path);
22712099Sjoerg/* SCANFLIKE1 */
22812099Sjoergint	(scanf)(const char *format, ...);
22912099Sjoergvoid	(setbuf)(FILE *stream, char *buf);
23012099Sjoergint	(setgid)(gid_t gid);
23112099Sjoergint	(setjmp)(jmp_buf env);
23212099Sjoergchar	*(setlocale)(int category, const char *locale);
23312099Sjoergint	(setpgid)(pid_t pid, pid_t pgid);
23412099Sjoergpid_t	(setsid)(void);
23512099Sjoergint	(setuid)(uid_t uid);
23612099Sjoergint	(setvbuf)(FILE *stream, char *buf, int mode, size_t size);
23712099Sjoergint	(sigaction)(int sig, const struct sigaction *act,
23812099Sjoerg		    struct sigaction *oact);
23912099Sjoergint	(sigaddset)(sigset_t *set, int signo);
24012099Sjoergint	(sigdelset)(sigset_t *set, int signo);
24112099Sjoergint	(sigemptyset)(sigset_t *set);
24212099Sjoergint	(sigfillset)(sigset_t *set);
24312099Sjoergint	(sigismember)(const sigset_t *set, int signo);
24412099Sjoergvoid	(siglongjmp)(sigjmp_buf env, int val);
24512099Sjoergvoid	(*(signal)(int sig, void (*func)(int)))(int);
24612099Sjoergint	(sigpending)(sigset_t *set);
24712099Sjoergint	(sigprocmask)(int how, const sigset_t *set, sigset_t *oset);
24812099Sjoergint	(sigsetjmp)(sigjmp_buf env, int savemask);
24912099Sjoergint	(sigsuspend)(const sigset_t *sigmask);
25012099Sjoergdouble	(sin)(double x);
25112099Sjoergdouble	(sinh)(double x);
25212099Sjoergunsigned (sleep)(unsigned seconds);
25312099Sjoerg/* PRINTFLIKE2 */
25412099Sjoergint	(sprintf)(char *s, const char *format, ...);
25512099Sjoergdouble	(sqrt)(double x);
25612099Sjoergvoid	(srand)(unsigned seed);
25712099Sjoerg/* SCANFLIKE2 */
25812099Sjoergint	(sscanf)(const char *s, const char *format, ...);
25912099Sjoergint	(stat)(const char *path, struct stat *buf);
26012099Sjoergchar	*(strcat)(char *s1, const char *s2);
26112099Sjoergchar	*(strchr)(const char *s, int c);
26212099Sjoergint	(strcmp)(const char *s1, const char *s2);
26312099Sjoergint	(strcoll)(const char *s1, const char *s2);
26412099Sjoergchar	*(strcpy)(char *s1, const char *s2);
26512099Sjoergsize_t	(strcspn)(const char *s1, const char *s2);
26612099Sjoergchar	*(strerror)(int errnum);
26712099Sjoergsize_t	(strftime)(char *s, size_t maxsize, const char *format,
26812099Sjoerg		    const struct tm *timeptr);
26912099Sjoergsize_t	(strlen)(const char *s);
27012099Sjoergchar	*(strncat)(char *s1, const char *s2, size_t n);
27112099Sjoergint	(strncmp)(const char *s1, const char *s2, size_t n);
27212099Sjoergchar	*(strncpy)(char *s1, const char *s2, size_t n);
27312099Sjoergchar	*(strpbrk)(const char *s1, const char *s2);
27412099Sjoergchar	*(strrchr)(const char *s, int c);
27512099Sjoergsize_t	(strspn)(const char *s1, const char *s2);
27612099Sjoergchar	*(strstr)(const char *s1, const char *s2);
27712099Sjoergdouble	(strtod)(const char *nptr, char **endptr);
27812099Sjoergchar	*(strtok)(char *s1, const char *s2);
27912099Sjoerglong	(strtol)(const char *nptr, char **endptr, int base);
28012099Sjoergunsigned long (strtoul)(const char *nptr, char **endptr, int base);
28112099Sjoergsize_t	(strxfrm)(char *s1, const char *s2, size_t n);
28212099Sjoerglong	(sysconf)(int name);
28312099Sjoergint	(system)(const char *string);
28412099Sjoergdouble	(tan)(double x);
28512099Sjoergdouble	(tanh)(double x);
28612099Sjoergint	(tcdrain)(int fildes);
28712099Sjoergint	(tcflow)(int fildes, int action);
28812099Sjoergint	(tcflush)(int fildes, int queue_selector);
28912099Sjoergint	(tcgetattr)(int fildes, struct termios *tp);
29012099Sjoergpid_t	(tcgetpgrp)(int fildes);
29112099Sjoergint	(tcsendbreak)(int fildes, int duration);
29212099Sjoergint	(tcsetattr)(int fildes, int options, const struct termios *tp);
29312099Sjoergint	(tcsetpgrp)(int fildes, pid_t pgrpid);
29412099Sjoergtime_t	(time)(time_t *timer);
29512099Sjoergclock_t	(times)(struct tms *buffer);
29612099SjoergFILE	*(tmpfile)(void);
29712099Sjoergchar	*(tmpnam)(char *s);
29812099Sjoergint	(tolower)(int c);
29912099Sjoergint	(toupper)(int c);
30012099Sjoergchar	*(ttyname)(int filedes);
30112099Sjoergvoid	(tzset)(void);
30212099Sjoergmode_t	(umask)(mode_t cmask);
30312099Sjoergint	(uname)(struct utsname *name);
30412099Sjoergint	(ungetc)(int c, FILE *stream);
30512099Sjoergint	(unlink)(const char *path);
30612099Sjoergint	(utime)(const char *path, const struct utimbuf *times);
30712099Sjoergint	(vfprintf)(FILE *stream, const char *format, va_list arg);
30812099Sjoergint	(vprintf)(const char *format, va_list arg);
30912099Sjoergint	(vsprintf)(char *s, const char *format, va_list arg);
31012099Sjoergpid_t	(wait)(int *statloc);
31112099Sjoergpid_t	(waitpid)(pid_t pid, int *stat_loc, int options);
31212099Sjoergsize_t	(wcstombs)(char *s, const wchar_t *pwcs, size_t n);
31312099Sjoergint	(wctomb)(char *s, wchar_t wchar);
31412099Sjoergssize_t	(write)(int fildes, const void *buf, size_t nbyte);
315