1/* $NetBSD: llib-lstdc,v 1.2 1995/07/03 21:25:11 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 _ANSI_SOURCE 37 38#include <assert.h> 39#include <ctype.h> 40#include <errno.h> 41#include <locale.h> 42#include <math.h> 43#include <setjmp.h> 44#include <signal.h> 45#include <stdarg.h> 46#include <stddef.h> 47#include <stdio.h> 48#include <stdlib.h> 49#include <string.h> 50#include <time.h> 51 52/* PROTOLIB1 */ 53 54/* 55 * assert.h 56 */ 57#ifdef __NetBSD__ 58void (__assert)(const char *expression, int line, const char *file); 59#else 60void (assert)(int expression); 61#endif 62 63/* 64 * ctype.h 65 */ 66int (isalnum)(int c); 67int (isalpha)(int c); 68int (iscntrl)(int c); 69int (isdigit)(int c); 70int (isgraph)(int c); 71int (islower)(int c); 72int (isprint)(int c); 73int (ispunct)(int c); 74int (isspace)(int c); 75int (isupper)(int c); 76int (isxdigit)(int c); 77int (tolower)(int c); 78int (toupper)(int c); 79 80/* 81 * errno.h 82 */ 83int (errno); 84 85/* 86 * locale.h 87 */ 88char *(setlocale)(int category, const char *locale); 89struct lconv *(localeconv)(void); 90 91/* 92 * math.h 93 */ 94double (acos)(double x); 95double (asin)(double x); 96double (atan)(double x); 97double (atan2)(double y, double x); 98double (cos)(double x); 99double (sin)(double x); 100double (tan)(double x); 101double (cosh)(double x); 102double (sinh)(double x); 103double (tanh)(double x); 104double (exp)(double x); 105double (frexp)(double value, int *exp); 106double (ldexp)(double x, int exp); 107double (log)(double x); 108double (log10)(double x); 109double (modf)(double value, double *iptr); 110double (pow)(double x, double y); 111double (sqrt)(double x); 112double (ceil)(double x); 113double (fabs)(double x); 114double (floor)(double x); 115double (fmod)(double x, double y); 116 117/* 118 * setjmp.h 119 */ 120int (setjmp)(jmp_buf env); 121void (longjmp)(jmp_buf env, int val); 122 123/* 124 * signal.h 125 */ 126void (*(signal)(int sig, void (*func)(int)))(int); 127int (raise)(int sig); 128 129/* 130 * stdio.h 131 */ 132int (remove)(const char *filename); 133int (rename)(const char *old, const char *new); 134FILE *(tmpfile)(void); 135char *(tmpnam)(char *s); 136int (fclose)(FILE *stream); 137int (fflush)(FILE *stream); 138FILE *(fopen)(const char *filename, const char *mode); 139FILE *(freopen)(const char *filename, const char *mode, FILE *stream); 140void (setbuf)(FILE *stream, char *buf); 141int (setvbuf)(FILE *stream, char *buf, int mode, size_t size); 142/* PRINTFLIKE2 */ 143int (fprintf)(FILE *stream, const char *format, ...); 144/* SCANFLIKE2 */ 145int (fscanf)(FILE *stream, const char *format, ...); 146/* PRINTFLIKE1 */ 147int (printf)(const char *format, ...); 148/* SCANFLIKE1 */ 149int (scanf)(const char *format, ...); 150/* PRINTFLIKE2 */ 151int (sprintf)(char *s, const char *format, ...); 152/* SCANFLIKE2 */ 153int (sscanf)(const char *s, const char *format, ...); 154int (vfprintf)(FILE *stream, const char *format, va_list arg); 155int (vprintf)(const char *format, va_list arg); 156int (vsprintf)(char *s, const char *format, va_list arg); 157int (fgetc)(FILE *stream); 158char *(fgets)(char *s, int n, FILE *stream); 159int (fputc)(int c, FILE *stream); 160int (fputs)(const char *s, FILE *stream); 161int (getc)(FILE *stream); 162int (getchar)(void); 163char *(gets)(char *s); 164int (putc)(int c, FILE *stream); 165int (putchar)(int c); 166int (puts)(const char *s); 167int (ungetc)(int c, FILE *stream); 168size_t (fread)(void *ptr, size_t size, size_t nmemb, FILE *stream); 169size_t (fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream); 170int (fgetpos)(FILE *stream, fpos_t *pos); 171int (fseek)(FILE *stream, long offset, int whence); 172int (fsetpos)(FILE *stream, const fpos_t *pos); 173long (ftell)(FILE *stream); 174void (rewind)(FILE *stream); 175void (clearerr)(FILE *stream); 176int (feof)(FILE *stream); 177int (ferror)(FILE *stream); 178void (perror)(const char *s); 179 180/* 181 * stdlib.h 182 */ 183double (atof)(const char *nptr); 184int (atoi)(const char *nptr); 185long (atol)(const char *nptr); 186double (strtod)(const char *nptr, char **endptr); 187long (strtol)(const char *nptr, char **endptr, int base); 188unsigned long (strtoul)(const char *nptr, char **endptr, int base); 189int (rand)(void); 190void (srand)(unsigned seed); 191void *(calloc)(size_t nmemb, size_t size); 192void (free)(void *ptr); 193void *(malloc)(size_t size); 194void *(realloc)(void *ptr, size_t size); 195void (abort)(void); 196int (atexit)(void (*func)(void)); 197void (exit)(int status); 198char *(getenv)(const char *name); 199int (system)(const char *string); 200void *(bsearch)(const void *key, const void *base, size_t nmemb, 201 size_t size, int (*compar)(const void *, const void *)); 202void (qsort)(void *base, size_t nmemb, size_t size, 203 int (*compar)(const void *, const void *)); 204int (abs)(int j); 205div_t (div)(int numer, int denom); 206long (labs)(long j); 207ldiv_t (ldiv)(long numer, long denom); 208int (mblen)(const char *s, size_t n); 209int (mbtowc)(wchar_t *PWC, const char *s, size_t n); 210int (wctomb)(char *s, wchar_t wchar); 211size_t (mbstowcs)(wchar_t *pwcs, const char *s, size_t n); 212size_t (wcstombs)(char *s, const wchar_t *pwcs, size_t n); 213 214/* 215 * string.h 216 */ 217void *(memcpy)(void *s1, const void *s2, size_t n); 218void *(memmove)(void *s1, const void *s2, size_t n); 219char *(strcpy)(char *s1, const char *s2); 220char *(strncpy)(char *s1, const char *s2, size_t n); 221char *(strcat)(char *s1, const char *s2); 222char *(strncat)(char *s1, const char *s2, size_t n); 223int (memcmp)(const void *s1, const void *s2, size_t n); 224int (strcmp)(const char *s1, const char *s2); 225int (strcoll)(const char *s1, const char *s2); 226int (strncmp)(const char *s1, const char *s2, size_t n); 227size_t (strxfrm)(char *s1, const char *s2, size_t n); 228void *(memchr)(const void *s, int c, size_t n); 229char *(strchr)(const char *s, int c); 230size_t (strcspn)(const char *s1, const char *s2); 231char *(strpbrk)(const char *s1, const char *s2); 232char *(strrchr)(const char *s1, int c); 233size_t (strspn)(const char *s1, const char *s2); 234char *(strstr)(const char *s1, const char *s2); 235char *(strtok)(char *s1, const char *s2); 236void *(memset)(void *s, int c, size_t n); 237char *(strerror)(int errnom); 238size_t (strlen)(const char *s); 239 240/* 241 * time.h 242 */ 243clock_t (clock)(void); 244double (difftime)(time_t time1, time_t time2); 245time_t (mktime)(struct tm *timeptr); 246time_t (time)(time_t *timer); 247char *(asctime)(const struct tm *timeptr); 248char *(ctime)(const time_t *timer); 249struct tm *(gmtime)(const time_t *timer); 250struct tm *(localtime)(const time_t *timer); 251size_t (strftime)(char *s, size_t maxsize, const char *format, 252 const struct tm *timeptr); 253