191592Smarkm/* $NetBSD: llib-lstdc,v 1.2 1995/07/03 21:25:11 cgd Exp $ */ 214963Spaul 314963Spaul/* 414963Spaul * Copyright (c) 1994, 1995 Jochen Pohl 514963Spaul * All Rights Reserved. 614963Spaul * 714963Spaul * Redistribution and use in source and binary forms, with or without 814963Spaul * modification, are permitted provided that the following conditions 914963Spaul * are met: 1014963Spaul * 1. Redistributions of source code must retain the above copyright 1114963Spaul * notice, this list of conditions and the following disclaimer. 1214963Spaul * 2. Redistributions in binary form must reproduce the above copyright 1314963Spaul * notice, this list of conditions and the following disclaimer in the 1414963Spaul * documentation and/or other materials provided with the distribution. 1514963Spaul * 3. All advertising materials mentioning features or use of this software 1614963Spaul * must display the following acknowledgement: 1714963Spaul * This product includes software developed by Jochen Pohl for 1814963Spaul * The NetBSD Project. 1914963Spaul * 4. The name of the author may not be used to endorse or promote products 2014963Spaul * derived from this software without specific prior written permission. 2114963Spaul * 2214963Spaul * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2314963Spaul * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2414963Spaul * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2514963Spaul * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2614963Spaul * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2714963Spaul * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2814963Spaul * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2914963Spaul * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3014963Spaul * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3114963Spaul * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3275730Sasmodai * 3375730Sasmodai * $FreeBSD$ 3414963Spaul */ 3514963Spaul 3614963Spaul/* LINTLIBRARY */ 3714963Spaul 3814963Spaul#define _ANSI_SOURCE 3914963Spaul 4014963Spaul#include <assert.h> 4114963Spaul#include <ctype.h> 4214963Spaul#include <errno.h> 4314963Spaul#include <locale.h> 4414963Spaul#include <math.h> 4514963Spaul#include <setjmp.h> 4614963Spaul#include <signal.h> 4714963Spaul#include <stdarg.h> 4814963Spaul#include <stddef.h> 4914963Spaul#include <stdio.h> 5014963Spaul#include <stdlib.h> 5114963Spaul#include <string.h> 5214963Spaul#include <time.h> 5314963Spaul 5414963Spaul/* PROTOLIB1 */ 5514963Spaul 5614963Spaul/* 5714963Spaul * assert.h 5814963Spaul */ 5914963Spaul#ifdef __NetBSD__ 6014963Spaulvoid (__assert)(const char *expression, int line, const char *file); 6114963Spaul#else 6214963Spaulvoid (assert)(int expression); 6314963Spaul#endif 6414963Spaul 6514963Spaul/* 6614963Spaul * ctype.h 6714963Spaul */ 6814963Spaulint (isalnum)(int c); 6914963Spaulint (isalpha)(int c); 7014963Spaulint (iscntrl)(int c); 7114963Spaulint (isdigit)(int c); 7214963Spaulint (isgraph)(int c); 7314963Spaulint (islower)(int c); 7414963Spaulint (isprint)(int c); 7514963Spaulint (ispunct)(int c); 7614963Spaulint (isspace)(int c); 7714963Spaulint (isupper)(int c); 7814963Spaulint (isxdigit)(int c); 7914963Spaulint (tolower)(int c); 8014963Spaulint (toupper)(int c); 8114963Spaul 8214963Spaul/* 8314963Spaul * errno.h 8414963Spaul */ 8514963Spaulint (errno); 8614963Spaul 8714963Spaul/* 8814963Spaul * locale.h 8914963Spaul */ 9014963Spaulchar *(setlocale)(int category, const char *locale); 9114963Spaulstruct lconv *(localeconv)(void); 9214963Spaul 9314963Spaul/* 9414963Spaul * math.h 9514963Spaul */ 9614963Spauldouble (acos)(double x); 9714963Spauldouble (asin)(double x); 9814963Spauldouble (atan)(double x); 9914963Spauldouble (atan2)(double y, double x); 10014963Spauldouble (cos)(double x); 10114963Spauldouble (sin)(double x); 10214963Spauldouble (tan)(double x); 10314963Spauldouble (cosh)(double x); 10414963Spauldouble (sinh)(double x); 10514963Spauldouble (tanh)(double x); 10614963Spauldouble (exp)(double x); 10714963Spauldouble (frexp)(double value, int *exp); 10814963Spauldouble (ldexp)(double x, int exp); 10914963Spauldouble (log)(double x); 11014963Spauldouble (log10)(double x); 11114963Spauldouble (modf)(double value, double *iptr); 11214963Spauldouble (pow)(double x, double y); 11314963Spauldouble (sqrt)(double x); 11414963Spauldouble (ceil)(double x); 11514963Spauldouble (fabs)(double x); 11614963Spauldouble (floor)(double x); 11714963Spauldouble (fmod)(double x, double y); 11814963Spaul 11914963Spaul/* 12014963Spaul * setjmp.h 12114963Spaul */ 12214963Spaulint (setjmp)(jmp_buf env); 12314963Spaulvoid (longjmp)(jmp_buf env, int val); 12414963Spaul 12514963Spaul/* 12614963Spaul * signal.h 12714963Spaul */ 12814963Spaulvoid (*(signal)(int sig, void (*func)(int)))(int); 12914963Spaulint (raise)(int sig); 13014963Spaul 13114963Spaul/* 13214963Spaul * stdio.h 13314963Spaul */ 13414963Spaulint (remove)(const char *filename); 13514963Spaulint (rename)(const char *old, const char *new); 13614963SpaulFILE *(tmpfile)(void); 13714963Spaulchar *(tmpnam)(char *s); 13814963Spaulint (fclose)(FILE *stream); 13914963Spaulint (fflush)(FILE *stream); 14014963SpaulFILE *(fopen)(const char *filename, const char *mode); 14114963SpaulFILE *(freopen)(const char *filename, const char *mode, FILE *stream); 14214963Spaulvoid (setbuf)(FILE *stream, char *buf); 14314963Spaulint (setvbuf)(FILE *stream, char *buf, int mode, size_t size); 14414963Spaul/* PRINTFLIKE2 */ 14514963Spaulint (fprintf)(FILE *stream, const char *format, ...); 14614963Spaul/* SCANFLIKE2 */ 14714963Spaulint (fscanf)(FILE *stream, const char *format, ...); 14814963Spaul/* PRINTFLIKE1 */ 14914963Spaulint (printf)(const char *format, ...); 15014963Spaul/* SCANFLIKE1 */ 15114963Spaulint (scanf)(const char *format, ...); 15214963Spaul/* PRINTFLIKE2 */ 15314963Spaulint (sprintf)(char *s, const char *format, ...); 15414963Spaul/* SCANFLIKE2 */ 15514963Spaulint (sscanf)(const char *s, const char *format, ...); 15614963Spaulint (vfprintf)(FILE *stream, const char *format, va_list arg); 15714963Spaulint (vprintf)(const char *format, va_list arg); 15814963Spaulint (vsprintf)(char *s, const char *format, va_list arg); 15914963Spaulint (fgetc)(FILE *stream); 16014963Spaulchar *(fgets)(char *s, int n, FILE *stream); 16114963Spaulint (fputc)(int c, FILE *stream); 16214963Spaulint (fputs)(const char *s, FILE *stream); 16314963Spaulint (getc)(FILE *stream); 16414963Spaulint (getchar)(void); 16514963Spaulchar *(gets)(char *s); 16614963Spaulint (putc)(int c, FILE *stream); 16714963Spaulint (putchar)(int c); 16814963Spaulint (puts)(const char *s); 16914963Spaulint (ungetc)(int c, FILE *stream); 17014963Spaulsize_t (fread)(void *ptr, size_t size, size_t nmemb, FILE *stream); 17114963Spaulsize_t (fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream); 17214963Spaulint (fgetpos)(FILE *stream, fpos_t *pos); 17314963Spaulint (fseek)(FILE *stream, long offset, int whence); 17414963Spaulint (fsetpos)(FILE *stream, const fpos_t *pos); 17514963Spaullong (ftell)(FILE *stream); 17614963Spaulvoid (rewind)(FILE *stream); 17714963Spaulvoid (clearerr)(FILE *stream); 17814963Spaulint (feof)(FILE *stream); 17914963Spaulint (ferror)(FILE *stream); 18014963Spaulvoid (perror)(const char *s); 18114963Spaul 18214963Spaul/* 18314963Spaul * stdlib.h 18414963Spaul */ 18514963Spauldouble (atof)(const char *nptr); 18614963Spaulint (atoi)(const char *nptr); 18714963Spaullong (atol)(const char *nptr); 18814963Spauldouble (strtod)(const char *nptr, char **endptr); 18914963Spaullong (strtol)(const char *nptr, char **endptr, int base); 19014963Spaulunsigned long (strtoul)(const char *nptr, char **endptr, int base); 19114963Spaulint (rand)(void); 19214963Spaulvoid (srand)(unsigned seed); 19314963Spaulvoid *(calloc)(size_t nmemb, size_t size); 19414963Spaulvoid (free)(void *ptr); 19514963Spaulvoid *(malloc)(size_t size); 19614963Spaulvoid *(realloc)(void *ptr, size_t size); 19714963Spaulvoid (abort)(void); 19814963Spaulint (atexit)(void (*func)(void)); 19914963Spaulvoid (exit)(int status); 20014963Spaulchar *(getenv)(const char *name); 20114963Spaulint (system)(const char *string); 20214963Spaulvoid *(bsearch)(const void *key, const void *base, size_t nmemb, 20314963Spaul size_t size, int (*compar)(const void *, const void *)); 20414963Spaulvoid (qsort)(void *base, size_t nmemb, size_t size, 20514963Spaul int (*compar)(const void *, const void *)); 20614963Spaulint (abs)(int j); 20714963Spauldiv_t (div)(int numer, int denom); 20814963Spaullong (labs)(long j); 20914963Spaulldiv_t (ldiv)(long numer, long denom); 21014963Spaulint (mblen)(const char *s, size_t n); 21114963Spaulint (mbtowc)(wchar_t *PWC, const char *s, size_t n); 21214963Spaulint (wctomb)(char *s, wchar_t wchar); 21314963Spaulsize_t (mbstowcs)(wchar_t *pwcs, const char *s, size_t n); 21414963Spaulsize_t (wcstombs)(char *s, const wchar_t *pwcs, size_t n); 21514963Spaul 21614963Spaul/* 21714963Spaul * string.h 21814963Spaul */ 21914963Spaulvoid *(memcpy)(void *s1, const void *s2, size_t n); 22014963Spaulvoid *(memmove)(void *s1, const void *s2, size_t n); 22114963Spaulchar *(strcpy)(char *s1, const char *s2); 22214963Spaulchar *(strncpy)(char *s1, const char *s2, size_t n); 22314963Spaulchar *(strcat)(char *s1, const char *s2); 22414963Spaulchar *(strncat)(char *s1, const char *s2, size_t n); 22514963Spaulint (memcmp)(const void *s1, const void *s2, size_t n); 22614963Spaulint (strcmp)(const char *s1, const char *s2); 22714963Spaulint (strcoll)(const char *s1, const char *s2); 22814963Spaulint (strncmp)(const char *s1, const char *s2, size_t n); 22914963Spaulsize_t (strxfrm)(char *s1, const char *s2, size_t n); 23014963Spaulvoid *(memchr)(const void *s, int c, size_t n); 23114963Spaulchar *(strchr)(const char *s, int c); 23214963Spaulsize_t (strcspn)(const char *s1, const char *s2); 23314963Spaulchar *(strpbrk)(const char *s1, const char *s2); 23414963Spaulchar *(strrchr)(const char *s1, int c); 23514963Spaulsize_t (strspn)(const char *s1, const char *s2); 23614963Spaulchar *(strstr)(const char *s1, const char *s2); 23714963Spaulchar *(strtok)(char *s1, const char *s2); 23814963Spaulvoid *(memset)(void *s, int c, size_t n); 23914963Spaulchar *(strerror)(int errnom); 24014963Spaulsize_t (strlen)(const char *s); 24114963Spaul 24214963Spaul/* 24314963Spaul * time.h 24414963Spaul */ 24514963Spaulclock_t (clock)(void); 24614963Spauldouble (difftime)(time_t time1, time_t time2); 24714963Spaultime_t (mktime)(struct tm *timeptr); 24814963Spaultime_t (time)(time_t *timer); 24914963Spaulchar *(asctime)(const struct tm *timeptr); 25014963Spaulchar *(ctime)(const time_t *timer); 25114963Spaulstruct tm *(gmtime)(const time_t *timer); 25214963Spaulstruct tm *(localtime)(const time_t *timer); 25314963Spaulsize_t (strftime)(char *s, size_t maxsize, const char *format, 25414963Spaul const struct tm *timeptr); 255