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