Initial revision

This commit is contained in:
eck
1989-05-16 13:13:53 +00:00
parent 13bc7e128d
commit d818da36f0
39 changed files with 1780 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/*
* assert.h - diagnostics
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
void _bad_assertion(const char *expr, const char *file, int line);
#undef assert
#ifdef NDEBUG
#define assert(ignore) ((void)0)
#else
#define assert(expr) \
{ \
if (!(expr)) { \
_bad_assertion( #expr, __FILE__, __LINE); \
abort(); \
} \
}
#endif /* NDEBUG */

View File

@@ -0,0 +1,30 @@
/*
* ctype.h - character handling
*/
/* $Header$ */
#ifndef _CTYPE_HEADER_
#define _CTYPE_HEADER_
int isalnum(int c); /* alpha numeric character */
int isalpha(int c); /* alpha character */
int iscntrl(int c); /* control character */
int isdigit(int c); /* digit character */
int isgraph(int c); /* graphical character */
int islower(int c); /* lower case character */
int isprint(int c); /* printable character */
int ispunct(int c); /* punctuaction character */
int isspace(int c); /* space character */
int isupper(int c); /* upper case character */
int isxdigit(int c); /* hexdecimal digit character */
int tolower(int c); /* convert to lower case character */
int toupper(int c); /* convert to upper case character */
#define isdigit(c) ((unsigned)((c)-'0') < 10)
#define islower(c) ((unsigned)((c)-'a') < 26)
#define isupper(c) ((unsigned)((c)-'A') < 26)
#define isprint(c) ((unsigned)((c)-' ') < 95)
#define isascii(c) ((unsigned)(c) < 128)
#endif /* _CTYPE_HEADER_ */

View File

@@ -0,0 +1,135 @@
/*
* errno.h - errors
*/
/* $Header$ */
#ifndef _ERRNO_HEADER_
#define _ERRNO_HEADER_
#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* No more processes */
#define ENOMEM 12 /* Not enough core */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Mount device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory*/
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
/* The standard requires the next two definitions */
#define EDOM 33 /* math arg out of domain of func */
#define ERANGE 34 /* math result not representable */
#ifdef __USG
/* Only ENOMSG, EIDRM and EDEADLK are documented */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier Removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
#define EUNATCH 42 /* Protocol driver not attached */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#define EDEADLK 45 /* DeadLock */
#endif /* __USG */
#ifdef __BDS4_2
/* non-blocking and interrupt i/o */
#define EWOULDBLOCK 35 /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
/* ipc/network software */
/* argument errors */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define EOPNOTSUPP 45 /* Operation not supported on socket */
#define EPFNOSUPPORT 46 /* Protocol family not supported */
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
/* operational errors */
#define ENETDOWN 50 /* Network is down */
#define ENETUNREACH 51 /* Network is unreachable */
#define ENETRESET 52 /* Network dropped connection on reset */
#define ECONNABORTED 53 /* Software caused connection abort */
#define ECONNRESET 54 /* Connection reset by peer */
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Socket is already connected */
#define ENOTCONN 57 /* Socket is not connected */
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
/* ETOOMANYREFS is not documented */
#define ETOOMANYREFS 59 /* Too many references: can't splice */
#define ETIMEDOUT 60 /* Connection timed out */
#define ECONNREFUSED 61 /* Connection refused */
/* */
#define ELOOP 62 /* Too many levels of symbolic links */
#define ENAMETOOLONG 63 /* File name too long */
/* In BSD4.2, ENOTEMPTY is defined as 64. */
/* Just use BSD4.3 & Sun UNIX 4.2 definitions */
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
/* EPROCLIM and EUSERS are not documented */
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Disc quota exceeded */
/* Network File System */
#define ESTALE 70 /* Stale NFS file handle */
#define EREMOTE 71 /* Too many levels of remote in path */
/* streams */
/* only ENOMSG is documented */
#define ENOSTR 72 /* Device is not a stream */
#define ETIME 73 /* Timer expired */
#define ENOSR 74 /* Out of streams resources */
#define ENOMSG 75 /* No message of desired type */
#define EBADMSG 76 /* Trying to read unreadable message */
#define EIDRM 77 /* Identifier removed */
/* SystemV Record Locking */
#define EDEADLK 78 /* Deadlock condition. */
#define ENOLCK 79 /* No record locks available. */
#endif /* __BSD4_2 */
extern int errno; /* error number */
#endif /* _ERRNO_HEADER_ */

View File

@@ -0,0 +1,118 @@
/*
* float.h - implementation limits
*/
/* $Header$ */
#ifndef _FLOAT_HEADER_
#define _FLOAT_HEADER_
#ifdef vax
#define FLT_DIG 6
#define FLT_EPSILON 5.96046448e-08
#define FLT_MANT_DIG 8
#define FLT_MAX 1.70141173e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 127
#define FLT_MIN 2.93873588e-39
#define FLT_MIN_10_EXP -39
#define FLT_MIN_EXP -127
#define DBL_DIG 16
#define DBL_EPSILON 1.38777878078144568e-17
#define DBL_MANT_DIG 8
#define DBL_MAX 1.70141183460469229e+38
#define DBL_MAX_10_EXP 38
#define DBL_MAX_EXP 127
#define DBL_MIN 2.93873587705571877e-39
#define DBL_MIN_10_EXP 39
#define DBL_MIN_EXP -127
#define LDBL_DIG 16
#define LDBL_EPSILON 1.38777878078144568e-17
#define LDBL_MANT_DIG 8
#define LDBL_MAX 1.70141183460469229e+38
#define LDBL_MAX_10_EXP 38
#define LDBL_MAX_EXP 127
#define LDBL_MIN 2.93873587705571877e-39
#define LDBL_MIN_10_EXP 39
#define LDBL_MIN_EXP -127
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#else
#ifdef pdp
/* The values are not certain, because there are no pdp's here anymore. The
* values given here are the same as for the vax.
*/
#define FLT_DIG 6
#define FLT_EPSILON 5.96046448e-08
#define FLT_MANT_DIG 8
#define FLT_MAX 1.70141173e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 127
#define FLT_MIN 2.93873588e-39
#define FLT_MIN_10_EXP -39
#define FLT_MIN_EXP -127
#define DBL_DIG 16
#define DBL_EPSILON 1.38777878078144568e-17
#define DBL_MANT_DIG 8
#define DBL_MAX 1.70141183460469229e+38
#define DBL_MAX_10_EXP 38
#define DBL_MAX_EXP 127
#define DBL_MIN 2.93873587705571877e-39
#define DBL_MIN_10_EXP 39
#define DBL_MIN_EXP -127
#define LDBL_DIG 16
#define LDBL_EPSILON 1.38777878078144568e-17
#define LDBL_MANT_DIG 8
#define LDBL_MAX 1.70141183460469229e+38
#define LDBL_MAX_10_EXP 38
#define LDBL_MAX_EXP 127
#define LDBL_MIN 2.93873587705571877e-39
#define LDBL_MIN_10_EXP 39
#define LDBL_MIN_EXP -127
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#else /* floating point emulation */
#define FLT_DIG 6
#define FLT_EPSILON 5.96046448e-08
#define FLT_MANT_DIG 8
#define FLT_MAX 1.70141173e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 127
#define FLT_MIN 2.93873588e-39
#define FLT_MIN_10_EXP -39
#define FLT_MIN_EXP -127
#define DBL_DIG 15
#define DBL_EPSILON 1.1102230246251565e-16
#define DBL_MANT_DIG 11
#define DBL_MAX 8.9884656743115823e+307
#define DBL_MAX_10_EXP 307
#define DBL_MAX_EXP 1023
#define DBL_MIN 5.5626846462680062e-309
#define DBL_MIN_10_EXP -309
#define DBL_MIN_EXP -1023
#define LDBL_DIG 15
#define LDBL_EPSILON 1.1102230246251565e-16
#define LDBL_MANT_DIG 11
#define LDBL_MAX 8.9884656743115823e+307
#define LDBL_MAX_10_EXP 307
#define LDBL_MAX_EXP 1023
#define LDBL_MIN 5.5626846462680062e-309
#define LDBL_MIN_10_EXP -309
#define LDBL_MIN_EXP -1023
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#endif /* pdp */
#endif /* vax */
#endif /* _FLOAT_HEADER_ */

View File

@@ -0,0 +1,51 @@
/*
* limits.h - implementation limits
*/
/* $Header$ */
#ifndef _LIMITS_HEADER_
#define _LIMITS_HEADER_
/*
** Define _SIGNED_CHARS_ for machines with signed characters.
** Define _WORD_32_ for machines with 32 bits integers.
**
** These defines should probably be set by the compiler when the
** -vi option is used.
*/
#define _SIGNED_CHARS_
#define _WORD_32_
#define CHAR_BIT 8
#define SCHAR_MIN (-127)
#define SCHAR_MAX (+127)
#define UCHAR_MAX 255
#define MB_LEN_MAX 1
#define SHRT_MIN (-32767)
#define SHRT_MAX (+32767)
#define USHRT_MAX 65535
#define LONG_MIN (-2147483647L)
#define LONG_MAX (+2147483647L)
#define ULONG_MAX 4294967295L
#ifdef _SIGNED_CHARS_
#define CHAR_MAX SCHAR_MAX
#define CHAR_MIN SCHAR_MIN
#else /* defined(_UNSIGNED_CHARS_) */
#define CHAR_MAX UCHAR_MAX
#define CHAR_MIN 0
#endif /* _SIGNED_CHARS */
#ifdef _WORD_32_
#define INT_MIN LONG_MIN
#define INT_MAX LONG_MAX
#define UINT_MAX ULONG_MAX
#else /*defined(_WORD_16_)*/
#define INT_MIN SHRT_MIN
#define INT_MAX SHRT_MAX
#define UINT_MAX USHRT_MAX
#endif /* WORD_32_ */
#endif /* _LIMITS_HEADER_ */

View File

@@ -0,0 +1,44 @@
/*
* locale.h - localization
*/
/* $Header$ */
#ifndef _LOCALE_HEADER_
#define _LOCALE_HEADER_
struct lconv {
char *decimal_point; /* "." */
char *thousands_sep; /* "" */
char *grouping; /* "" */
char *int_curr_symbol; /* "" */
char *currency_symbol; /* "" */
char *mon_decimal_point; /* "" */
char *mon_thousands_sep; /* "" */
char *mon_grouping; /* "" */
char *positive_sign; /* "" */
char *negative_sign; /* "" */
char frac_digits; /* CHAR_MAX */
char p_cs_precedes; /* CHAR_MAX */
char p_sep_by_space; /* CHAR_MAX */
char n_cs_precedes; /* CHAR_MAX */
char n_sep_by_space; /* CHAR_MAX */
char p_sign_posn; /* CHAR_MAX */
char n_sign_posn; /* CHAR_MAX */
};
#ifndef NULL
#define NULL 0
#endif /* NULL */
#define LC_ALL 1
#define LC_COLLATE 2
#define LC_CTYPE 3
#define LC_MONETARY 4
#define LC_NUMERIC 5
#define LC_TIME 6
char *setlocale(int category, const char *locale);
struct lconv *localeconv(void);
#endif /* _LOCALE_HEADER_ */

View File

@@ -0,0 +1,41 @@
/*
* math.h - mathematics
*/
/* $Header$ */
#ifndef _MATH_HEADER_
#define _MATH_HEADER_
#include <float.h>
#define HUGE_VAL DBL_MAX
double acos(double x);
double asin(double x);
double atan(double x);
double atan2(double y, double x);
double cos(double x);
double sin(double x);
double tan(double x);
double cosh(double x);
double sinh(double x);
double tanh(double x);
double exp(double x);
double log(double x);
double log10(double x);
double sqrt(double x);
double ceil(double x);
double fabs(double x);
double floor(double x);
double pow(double x, double y);
double frexp(double x, int *exp);
double ldexp(double x, int exp);
double modf(double x, double *iptr);
double fmod(double x, double y);
#endif /* _MATH_HEADER_ */

View File

@@ -0,0 +1,29 @@
/*
* mathconst.h - mathematic constants
*/
/* $Header$ */
#ifndef _MATHCONST_HEADER_
#define _MATHCONST_HEADER_
/* some constants (Hart & Cheney) */
#define M_PI 3.14159265358979323846264338327950288
#define M_2PI 6.28318530717958647692528676655900576
#define M_3PI_4 2.35619449019234492884698253745962716
#define M_PI_2 1.57079632679489661923132169163975144
#define M_3PI_8 1.17809724509617246442349126872981358
#define M_PI_4 0.78539816339744830961566084581987572
#define M_PI_8 0.39269908169872415480783042290993786
#define M_1_PI 0.31830988618379067153776752674502872
#define M_2_PI 0.63661977236758134307553505349005744
#define M_4_PI 1.27323954473516268615107010698011488
#define M_E 2.71828182845904523536028747135266250
#define M_LOG2E 1.44269504088896340735992468100189213
#define M_LOG10E 0.43429448190325182765112891891660508
#define M_LN2 0.69314718055994530941723212145817657
#define M_LN10 2.30258509299404568401799145468436421
#define M_SQRT2 1.41421356237309504880168872420969808
#define M_1_SQRT2 0.70710678118654752440084436210484904
#define M_EULER 0.57721566490153286060651209008240243
#endif /* _MATHCONST_HEADER_ */

View File

@@ -0,0 +1,17 @@
/*
* setjmp.h - restore calling environment
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _SETJMP_HEADER_
#define _SETJMP_HEADER_
typedef char jmp_buf[256];
int setjmp(jmp_buf env);
void longjmp(jmp_buf env, int val);
#endif /* _SETJMP_HEADER_ */

View File

@@ -0,0 +1,116 @@
/*
* signal.h - signal handling
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _SIGNAL_HEADER_
#define _SIGNAL_HEADER_
typedef int sig_atomic_t;
#define SIG_ERR (void (*)())-1
#if defined(em22) || defined(em24) || defined(em44)
#define SIG_DFL ((void (*)())-2)
#define SIG_IGN ((void (*)())-3)
#else
#define SIG_DFL ((void (*)())0)
#define SIG_IGN ((void (*)())1)
#endif /* SIG_ERR */
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGIOT 6 /* IOT instruction */
#define SIGABRT 6 /* ANSI abort trap */
#define SIGEMT 7 /* EMT instruction */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#ifdef __USG
#define SIGUSR1 16 /* user defined signal 1 */
#define SIGUSR2 17 /* user defined signal 2 */
#define SIGCLD 18 /* death of a child */
#define SIGPWR 19 /* power-fail signal */
#define _NSIG 20
#elif defined(__BSD4_2)
#define SIGURG 16 /* urgent condition */
#define SIGSTOP 17 /* stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* death of a child */
#define SIGCLD 20 /* System V compat. */
#define SIGTTIN 21 /* background tty read */
#define SIGTTOU 22 /* background tty write */
#define SIGIO 23 /* I/O possible signal */
#define SIGPOLL SIGIO /* System V compat. */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window has changed */
#define SIGLOST 29 /* resource lost */
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
#define _NSIG 32
#else
#define _NSIG 16
#endif /* __USG or __BSD4_2 */
#ifdef __BSD4_2
struct sigvec {
int (*sv_handler)(); /* handler */
int sv_mask; /* mask to apply */
int sv_flags;
};
#define SV_ONSTACK 0x0001 /* take signal on signal stack */
#define SV_INTERRUPT 0x0002 /* do not restart system on signal return */
#define SV_RESETHAND 0x0004 /* reset signal handler to SIG_DFL when signal taken */
#define sv_onstack sv_flags /* compat. */
struct sigstack {
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
struct sigcontext {
int sc_onstack; /* sigstack state to restore */
int sc_mask; /* signal mask to restore */
int sc_sp; /* sp to restore */
#ifdef vax
int sc_fp; /* fp to restore */
int sc_ap; /* ap to restore */
#endif /* vax */
int sc_pc; /* pc to retore */
int sc_ps; /* psl to restore */
};
#define BADSIG SIG_ERR /* compat. */
#define sigmask(m) (1 << ((m)-1))
/*
* These are only defined for shutting up the compiler.
*/
#ifdef __STDC__
int sigvec(int sig, struct sigvec *vec, struct sigvec *ovec);
int sigstack(struct sigstack *ss, struct sigstack *oss);
int sigblock(int mask);
int sigsetmask(int mask);
int sigpause(int sigmask);
#endif /* __STDC__ */
#endif /* __BSD4_2 */
#ifdef __STDC__
void (*signal(int sig, void (*func)(int)))(int);
int raise(int sig);
#endif /* __STDC__ */
#endif /* _SIGNAL_HEADER_ */

View File

@@ -0,0 +1,18 @@
/*
* stdarg.h - variable arguments
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _STDARG_HEADER_
#define _STDARG_HEADER_
typedef char *va_list;
#define va_start(ap, parmN) (ap = (char *)&parmN)
#define va_arg(ap, type) ((type *)(ap += sizeof(type)))[0]
#define va_end(ap)
#endif /* _STDARG_HEADER_ */

View File

@@ -0,0 +1,35 @@
/*
* stddef.h - common definitions
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _STDDEF_HEADER_
#define _STDDEF_HEADER_
#ifndef NULL
#define NULL 0
#endif /* NULL */
/* ??? cast to char pointer necessary? */
#define offsetof(type, ident) \
(size_t) &(((type *)0)->ident)
#ifndef _TYPE_PTRDIFF_
#define _TYPE_PTRDIFF_
typedef int ptrdiff_t; /* result of substracting two pointers */
#endif /* _TYPE_PTRDIFF_ */
#ifndef _TYPE_SIZE_
#define _TYPE_SIZE_
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _TYPE_SIZE_ */
#ifndef _TYPE_WCHAR_
#define _TYPE_WCHAR_
typedef char wchar_t; /* type expanded character set */
#endif /* _TYPE_WCHAR_ */
#endif /* _STDEF_HEADER_ */

View File

@@ -0,0 +1,125 @@
/*
* stdio.h - input/output definitions
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _STDIO_HEADER_
#define _STDIO_HEADER_
#include <stdarg.h>
#define _NFILES 20
/*
* Focus point of all stdio activity.
*/
typedef struct _iobuf {
int _fd;
int _count;
int _flags;
char *_tname;
unsigned char *_buf;
unsigned char *_ptr;
} FILE;
#define _IOFBF 0000
#define _IOREAD 0001
#define _IOWRITE 0002
#define _IONBF 0004
#define _IOMYBUF 0010
#define _IOEOF 0020
#define _IOERR 0040
#define _IOLBF 0100
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define stdin (&_stdin)
#define stdout (&_stdout)
#define stderr (&_stderr)
#define BUFSIZ 1024
#ifndef NULL
#define NULL 0
#endif /* NULL */
#ifndef EOF
#define EOF (-1)
#endif /* EOF */
#define FOPEN_MAX (_NFILES - 3)
#ifdef __BSD4_2
#define FILENAME_MAX 255
#else
#define FILENAME_MAX 14
#endif /* __BSD4_2 */
#define TMP_MAX 1000
#define L_tmpnam (sizeof("/usr/tmp/") + 15)
#ifndef _TYPE_FPOS_
#define _TYPE_FPOS_
typedef long int fpos_t;
#endif /* _TYPE_FPOS */
#ifndef _TYPE_SIZE_
#define _TYPE_SIZE_
typedef unsigned int size_t;
#endif /* _TYPE_SIZE_ */
#define getchar() getc(stdin)
#define putchar(c) putc(c,stdout)
#define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
_fillbuf(p))
#define putc(c, p) (--(p)->_count >= 0 ? \
(int) (*(p)->_ptr++ = (c)) : \
_flushbuf((c),(p)))
#define feof(p) (((p)->_flags & _IOEOF) != 0)
#define ferror(p) (((p)->_flags & _IOERR) != 0)
#define fileno(p) ((p)->_fd)
FILE *_iotable[_NFILES];
FILE _stdin, _stdout, _stderr;
#ifdef __STDC__
int remove(const char *filename);
int rename(const char *old, const char *new);
FILE *tmpfile(void);
char *tmpnam(char *s);
int fclose(FILE *stream);
int fflush(FILE *stream);
FILE *fopen(const char *filename, const char *mode);
FILE *freopen(const char *filename, const char *mode, FILE *stream);
void setbuf(FILE *stream, char *buf);
int setvbuf(FILE *stream, char *buf, int mode, size_t size);
int fprintf(FILE *stream, const char *format, ...);
int fscanf(FILE *stream, const char *format, ...);
int printf(const char *format, ...);
int scanf(const char *format, ...);
int sprintf(char *s, const char *format, ...);
int sscanf(char *s, const char *format, ...);
int vfprintf(FILE *stream, const char *format, va_list arg);
int vprintf(const char *format, va_list arg);
int vsprintf(char *s, const char *format, va_list arg);
int fgetc(FILE *stream);
char *fgets(char *s, int n, FILE *stream);
int fputc(int c, FILE *stream);
int fputs(const char *s, FILE *stream);
char *gets(char *s);
int ungetc(int c, FILE *stream);
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
int fgetpos(FILE *stream, fpos_t *pos);
int fseek(FILE *stream, long offset, int whence);
int fsetpos(FILE *stream, const fpos_t *pos);
long ftell(FILE *stream);
void rewind(FILE *stream);
void clearerr(FILE *stream);
int perror(const char *s);
#endif /* __STDC__ */
#endif /* _STDIO_HEADER_ */

View File

@@ -0,0 +1,68 @@
/*
* stdlib.h - standard library
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _STDLIB_HEADER_
#define _STDLIB_HEADER_
#ifndef NULL
#define NULL 0
#endif /* NULL */
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define RAND_MAX 32767
#define MB_CUR_MAX 1
typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t;
#ifndef _TYPE_SIZE_
#define _TYPE_SIZE_
typedef unsigned int size_t;
#endif /* _TYPE_SIZE_ */
#ifndef _TYPE_WCHAR_
#define _TYPE_WCHAR_
typedef int wchar_t;
#endif /* _TYPE_WCHAR_ */
#ifdef __STDC__
double atof(const char *nptr);
int atoi(const char *nptr);
long atol(const char *nptr);
double strtod(const char *nptr, char **endptr);
long strtol(const char *nptr, char **endptr, int base);
unsigned long int strtoul(const char *nptr, char **endptr, int base);
int rand(void);
void srand(unsigned int seed);
void *calloc(size_t nmemb, size_t size);
void free(void *ptr);
void *malloc(size_t size);
void *realloc(void *ptr, size_t size);
void abort(void);
int atexit(void (*func)(void));
void exit(int status);
char *getenv(const char *name);
int system(const char *string);
void *bsearch(const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
void qsort(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
int abs(int j);
div_t div(int numer, int denom);
long labs(long j);
ldiv_t ldiv(long numer, long denom);
int mblen(const char *s, size_t n);
int mbtowc(wchar_t *pwc, const char *s, size_t n);
int wctomb(const char *s, wchar_t wchar);
size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
#endif /* __STDC__ */
#endif /* _STDLIB_HEADER_ */

View File

@@ -0,0 +1,46 @@
/*
* string.h - string handling
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
#ifndef _STRING_HEADER_
#define _STRING_HEADER_
#ifndef NULL
#define NULL 0
#endif /* NULL */
#ifndef _TYPE_SIZE_
#define _TYPE_SIZE_
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _TYPE_SIZE_ */
#ifdef __STDC__
void *memcpy(void *s1, const void *s2, size_t n);
void *memmove(void *s1, const void *s2, size_t n);
char *strcpy(char *s1, const char *s2);
char *strncpy(char *s1, const char *s2, size_t n);
char *strcat(char *s1, const char *s2);
char *strncat(char *s1, const char *s2, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);
int strcmp(const char *s1, const char *s2);
int strcoll(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
size_t strxfrm(char *s1, const char *s2, size_t n);
void *memchr(const void *s, int c, size_t n);
char *strchr(const char *s, int c);
size_t strcspn(const char *s1, const char *s2);
char *strpbrk(const char *s1, const char *s2);
char *strrchr(const char *s, int c);
size_t strspn(const char *s1, const char *s2);
char *strstr(const char *s1, const char *s2);
char *strtok(char *s1, const char *s2);
void *memset(void *s, int c, size_t n);
char *strerror(int errnum);
size_t strlen(const char *s);
#endif /* __STDC__ */
#endif /* _STRING_HEADER_ */

View File

@@ -0,0 +1,51 @@
/*
* time.h - date and time
*/
/* $Header$ */
#ifndef _TIME_HEADER_
#define _TIME_HEADER_
#ifndef NULL
#define NULL 0
#endif /* NULL */
#ifdef __BSD4_2
#define CLK_TCK 60 /* ticks per second */
#else
#define CLK_TCK 1
#endif /* __BSD4_2 */
#ifndef _TYPE_SIZE_
#define _TYPE_SIZE_
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _TYPE_SIZE_ */
typedef signed long time_t; /* type returned by TOD clock */
typedef signed long clock_t; /* type returned by real time clock */
struct tm {
int tm_sec; /* seconds after the minute - [0, 59] */
int tm_min; /* minutes after the hour - [0, 59] */
int tm_hour; /* hours since midnight - [0, 28] */
int tm_mday; /* day of the month - [1, 31] */
int tm_mon; /* months since January - [0, 11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday - [0, 6] */
int tm_yday; /* days since January 1 - [0, 365] */
int tm_isdst; /* Daylight Saving Time flag */
};
clock_t clock(void);
double difftime(time_t time1, time_t time0);
time_t mktime(struct tm *timeptr);
time_t time(time_t *timeptr);
char *asctime(const struct tm *timeptr);
char *ctime(const time_t *timer);
struct tm *gmtime(const time_t *timer);
struct tm *localtime(const time_t *timer);
size_t strftime(char *s, size_t maxsize,
const char *format,
const struct tm *timeptr);
#endif /* _TIME_HEADER_ */