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