Path: utzoo!attcan!uunet!wuarchive!udel!princeton!notecnirp!nfs
From: nfs@notecnirp.Princeton.EDU (Norbert Schlenker)
Newsgroups: comp.os.minix
Subject: Another new stdio (part 2 of 4)
Summary: Header files
Message-ID: <19736@princeton.Princeton.EDU>
Date: 30 Sep 89 16:10:51 GMT
Sender: news@princeton.Princeton.EDU
Reply-To: nfs@notecnirp.UUCP (Norbert Schlenker)
Organization: Dept. of Computer Science, Princeton University
Lines: 1550

echo x - assert.h
sed '/^X/s///' > assert.h << '/'
X#ifndef __ASSERT_H
X#define __ASSERT_H
X
X/* --- Macros --- */
X#ifndef NDEBUG
X#define assert(p)							\
X  if(!(p)) {								\
X	fprintf(stderr, "False assertion at line %d in file \"%s\"\n",	\
X		 __LINE__, __FILE__);					\
X	exit(1);							\
X  }
X#else
X#define assert(p)
X#endif
X
X#endif /* !defined __ASSERT_H */
/
echo x - ctype.h
sed '/^X/s///' > ctype.h << '/'
X#ifndef __CTYPE_H
X#define __CTYPE_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#define	_CT_U	0x01
X#define	_CT_L	0x02
X#define	_CT_N	0x04
X#define	_CT_S	0x08
X#define _CT_P	0x10
X#define _CT_C	0x20
X#define _CT_X	0x40
X#define _CT_SP	0x80
X
X/* --- Prototypes --- */
Xint isalnum	_PROTO((int c));
Xint isalpha	_PROTO((int c));
Xint isascii	_PROTO((int c));
Xint iscntrl	_PROTO((int c));
Xint isdigit	_PROTO((int c));
Xint isgraph	_PROTO((int c));
Xint islower	_PROTO((int c));
Xint isprint	_PROTO((int c));
Xint ispunct	_PROTO((int c));
Xint isspace	_PROTO((int c));
Xint isupper	_PROTO((int c));
Xint isxdigit	_PROTO((int c));
Xint toascii	_PROTO((int c));
Xint _tolower	_PROTO((int c));
Xint _toupper	_PROTO((int c));
Xint tolower	_PROTO((int c));
Xint toupper	_PROTO((int c));
X
X/* --- Storage --- */
Xextern char _ctype[];
X#ifdef _SAFEMACRO
Xextern int _ct_c;
X#endif
X
X/* --- Macros --- */
X#define isalnum(c)	((_ctype+1)[c] & (_CT_U|_CT_L|_CT_N))
X#define	isalpha(c)	((_ctype+1)[c] & (_CT_U|_CT_L))
X#define isascii(c)	((unsigned)(c) <= 0x7f)
X#define iscntrl(c)	((_ctype+1)[c] & (_CT_C))
X#define	isdigit(c)	((_ctype+1)[c] & (_CT_N))
X#define isgraph(c)	((_ctype+1)[c] & (_CT_U|_CT_L|_CT_N|_CT_P))
X#define	islower(c)	((_ctype+1)[c] & (_CT_L))
X#define isprint(c)	((_ctype+1)[c] & (_CT_U|_CT_L|_CT_N|_CT_P|_CT_SP))
X#define ispunct(c)	((_ctype+1)[c] & (_CT_P))
X#define	isspace(c)	((_ctype+1)[c] & (_CT_S|_CT_SP))
X#define	isupper(c)	((_ctype+1)[c] & (_CT_U))
X#define	isxdigit(c)	((_ctype+1)[c] & (_CT_N|_CT_X))
X
X#define toascii(c)	((c) & 0x7f)
X#define _tolower(c)	((c) - 'A' + 'a')
X#define _toupper(c)	((c) - 'a' + 'A')
X#ifdef _SAFEMACRO
X#define tolower(c)	(_ct_c = (c), _isupper(_ct_c) ? _tolower(_ct_c) : _ct_c)
X#define toupper(c)	(_ct_c = (c), _islower(_ct_c) ? _toupper(_ct_c) : _ct_c)
X#endif
X
X#endif /* !defined __CTYPE_H */
/
echo x - dirent.h
sed '/^X/s///' > dirent.h << '/'
X#ifndef __DIRENT_H
X#define __DIRENT_H
X
X/*
X	 -- definitions for SVR3 directory access routines
X
X	last edit:	25-Apr-1987	D A Gwyn
X*/
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X#include 
X
X/* --- Types --- */
Xtypedef struct {
X  int	dd_fd;			/* file descriptor */
X  int	dd_loc;			/* offset in block */
X  int	dd_size;		/* amount of valid data */
X  char	*dd_buf;		/* -> directory block */
X} DIR;				/* stream data from opendir() */
X
X/* --- Prototypes --- */
XDIR	*opendir	_PROTO((char *dirname));
Xstruct dirent *readdir	_PROTO((DIR *dirp));
Xvoid	rewinddir	_PROTO((DIR *dirp));
Xint	closedir	_PROTO((DIR *dirp));
Xvoid	seekdir		_PROTO((DIR *dirp, off_t loc));	/* not POSIX */
Xoff_t	telldir		_PROTO((DIR *dirp));		/* not POSIX */
X
X#endif /* !defined __DIRENT_H */
/
echo x - errno.h
sed '/^X/s///' > errno.h << '/'
X#ifndef __ERRNO_H
X#define __ERRNO_H
X
X/* --- Constants --- */
X#define OK                 0
X#define ERROR              1
X#define EPERM              1
X#define ENOENT             2
X#define ESRCH              3
X#define EINTR              4
X#define EIO                5
X#define ENXIO              6
X#define E2BIG              7
X#define ENOEXEC            8
X#define EBADF              9
X#define ECHILD            10
X#define EAGAIN            11
X#define ENOMEM            12
X#define EACCES            13
X#define EFAULT            14
X#define ENOTBLK           15
X#define EBUSY             16
X#define EEXIST            17
X#define EXDEV             18
X#define ENODEV            19
X#define ENOTDIR           20
X#define EISDIR            21
X#define EINVAL            22
X#define ENFILE            23
X#define EMFILE            24
X#define ENOTTY            25
X#define ETXTBSY           26
X#define EFBIG             27
X#define ENOSPC            28
X#define ESPIPE            29
X#define EROFS             30
X#define EMLINK            31
X#define EPIPE             32
X#define EDOM              33
X#define ERANGE            34
X
X#define E_LOCKED         101
X#define E_BAD_CALL       102
X#define E_LONG_STRING    103
X
X/* --- Storage --- */
Xextern int errno;
X
X#endif /* !defined __ERRNO_H */
/
echo x - fcntl.h
sed '/^X/s///' > fcntl.h << '/'
X#ifndef __FCNTL_H
X#define __FCNTL_H
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X  /* --- For open(2) --- */
X#define O_RDONLY	0
X#define O_WRONLY	1
X#define O_RDWR		2
X#define	O_NONBLOCK	0x0004
X#define O_APPEND	0x0008
X#define O_NOCTTY	0x0100
X#define O_CREAT		0x0200
X#define O_TRUNC		0x0400
X#define O_EXCL		0x0800
X  /* --- For fcntl(2) --- */
X#define F_DUPFD		0
X#define F_GETFD		1
X#define F_SETFD		2
X#define F_GETFL		3
X#define F_SETFL		4
X#define F_GETLK		7
X#define F_SETLK		8
X#define F_SETLKW	9
X  /* --- fcntl(2) descriptor flags --- */
X#define FD_CLOEXEC	0x4000			/* Arbitrary!! */
X  /* --- fcntl(2) lock flags --- */
X#define F_RDLCK		1
X#define F_WRLCK		2
X#define F_UNLCK		3
X  /* --- Compatibility --- */
X#ifdef _SYSV
X#define O_NDELAY	O_NONBLOCK
X#endif
X
X#ifdef _BSD
X#define FNDELAY		O_NONBLOCK
X#define FAPPEND		O_APPEND
X#define FCREAT		O_CREAT
X#define FTRUNC		O_TRUNC
X#define FEXCL		O_EXCL
X#define F_GETOWN	5
X#define F_SETOWN	6
X#endif
X
X/* --- Structures --- */
Xstruct flock {
X  short l_type;
X  short l_whence;
X  off_t l_start;
X  off_t l_len;
X  pid_t l_pid;
X};
X
X/* --- Prototypes --- */
Xint	open	_PROTO((char *path, int oflag, ...));
Xint	creat	_PROTO((char *path, mode_t mode));
Xint	fcntl	_PROTO((int fd, int cmd, ...));
X
X#endif /* !defined __FCNTL_H */
/
echo x - grp.h
sed '/^X/s///' > grp.h << '/'
X#ifndef __GRP_H
X#define __GRP_H
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Structures --- */
Xstruct group {
X  char	*gr_name;
X  char	*gr_passwd;		/* not required by POSIX */
X  gid_t	gr_gid;
X  char	**gr_mem;
X};
X
X/* --- Prototypes --- */
Xstruct group *getgrgid	_PROTO((gid_t gid));
Xstruct group *getgrnam	_PROTO((char *name));
X
X#endif /* !defined __GRP_H */
/
echo x - lib.h
sed '/^X/s///' > lib.h << '/'
X#include 
X#include 
X#include 
X#include 
X
Xextern message M;
X
X#define MM                 0
X#define FS                 1
X
Xextern int callm1(), callm3(), callx(), len();
Xextern int errno;
Xextern int begsig();		/* interrupts all vector here */
/
echo x - limits.h
sed '/^X/s///' > limits.h << '/'
X#ifndef __LIMITS_H
X#define __LIMITS_H
X
X/* --- Constants --- */
X#define CHAR_BIT	    8
X#define SCHAR_MIN	 -128
X#define SCHAR_MAX	  127
X#define CHAR_MIN	 -128	/* char is signed by default */
X#define CHAR_MAX	  127
X#define UCHAR_MAX	  255
X#define SHRT_MIN       -32767	/* PENDING - Minix 1.3 compiler bug */
X#define SHRT_MAX	32767
X#define USHRT_MAX	65535
X#define INT_MIN	       -32767	/* PENDING - Minix 1.3 compiler bug */
X#define INT_MAX		32767
X#define UINT_MAX	65535
X#define LONG_MIN  -2147483647	/* PENDING - Minix 1.3 compiler bug */
X#define LONG_MAX   2147483647
X#define ULONG_MAX  4294967295
X
X#ifdef _POSIX_SOURCE
X#define _POSIX_ARG_MAX		4096
X#define _POSIX_CHILD_MAX	6
X#define _POSIX_LINK_MAX		8
X#define _POSIX_MAX_CANON	255
X#define _POSIX_MAX_INPUT	255
X#define _POSIX_NAME_MAX		14
X#define _POSIX_NGROUPS_MAX	0
X#define _POSIX_OPEN_MAX		16
X#define _POSIX_PATH_MAX		255
X#define _POSIX_PIPE_BUF		512
X
X#define NGROUPS_MAX		0
X#define ARG_MAX			2048	/* PENDING - POSIX requires >= 4096 */
X#define OPEN_MAX		20
X#define LINK_MAX		127
X#define MAX_CANON		256
X#define MAX_INPUT		256
X#define NAME_MAX		14
X#define PATH_MAX		127	/* PENDING - POSIX requires >= 256 */
X#define PIPE_BUF		7168
X
X#endif /* defined _POSIX_SOURCE */
X
X#endif /* !defined __LIMITS_H */
/
echo x - prototype.h
sed '/^X/s///' > prototype.h << '/'
X#ifndef __PROTOTYPE_H
X#define __PROTOTYPE_H
X
X#ifdef __STDC__
X#define _PROTO(p) p
X#else
X#define _PROTO(p) ()
X#define const
X#endif
X
X#endif /* !defined __PROTOTYPE_H */
/
echo x - pwd.h
sed '/^X/s///' > pwd.h << '/'
X#ifndef __PWD_H
X#define __PWD_H
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Structures --- */
Xstruct passwd {
X	char *pw_name;
X	char *pw_passwd;	/* not required by POSIX */
X	uid_t pw_uid;
X	gid_t pw_gid;
X	char *pw_gecos;		/* not required by POSIX */
X	char *pw_dir;
X	char *pw_shell;
X};
X
X/* --- Prototypes --- */
Xstruct passwd *getpwuid	_PROTO((uid_t uid));
Xstruct passwd *getpwnam	_PROTO((char *name));
X
X#endif /* !defined __PWD_H */
/
echo x - setjmp.h
sed '/^X/s///' > setjmp.h << '/'
X#ifndef __SETJMP_H
X#define __SETJMP_H
X
X/* --- Inclusions --- */
X#include "../include/prototype.h"
X
X/* --- Constants --- */
X#ifndef _JB_LEN
X#ifdef i8088
X#define _JB_LEN	3
X#else
X#ifdef ATARI_ST
X#define _JB_LEN	13
X#else
X#error Either i8088 or ATARI_ST must be defined!
X#endif
X#endif
X#endif
X
X/* --- Types --- */
Xtypedef int jmp_buf[_JB_LEN];
X#ifdef _POSIX_SOURCE
Xtypedef int sigjmp_buf[_JB_LEN + sizeof(long)]	/* PENDING - just a guess! */
X#endif
X
X/* --- Prototypes --- */
Xint	setjmp		_PROTO((jmp_buf env));
Xvoid	longjmp		_PROTO((jmp_buf env, int value));
X#ifdef _POSIX_SOURCE
Xint	sigsetjmp	_PROTO((sigjmp_buf env, int savemask));
Xvoid	siglongjmp	_PROTO((sigjmp_buf env, int value));
X#endif
X
X#endif /* !defined __SETJMP_H */
/
echo x - signal.h
sed '/^X/s///' > signal.h << '/'
X#ifndef __SIGNAL_H
X#define __SIGNAL_H
X
X/* --- Prerequisites --- */
X#ifdef _POSIX_SOURCE
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#define SIG_ERR	(void (*)())-1
X#define	SIG_DFL	(void (*)())0
X#define	SIG_IGN	(void (*)())1
X
X#define NSIG	16	/* PENDING! This limit needs to be 32 but the code */
X#define NR_SIGS NSIG	/* PENDING! in the kernel isn't fixed yet.  Also,  */
X#define STACK_FAULT 16	/* PENDING! these names pollute the name space.    */
X
X#define	SIGHUP	1	/* hangup */
X#define SIGINT	2	/* interrupt (DEL) */
X#define SIGQUIT	3	/* quit (ASCII FS) */
X#define SIGILL	4	/* illegal instruction (not reset when caught)*/
X#define SIGTRAP	5	/* trace trap (not reset when caught) */
X#define SIGABRT	6	/* abnormal termination */
X#define SIGIOT	SIGABRT	/* compatibility - IOT instruction (PDP 11!) */
X#define SIGEMT	7	/* EMT instruction (PDP 11!) */
X#define SIGFPE	8	/* floating point exception */
X#define SIGKILL	9	/* kill (cannot be caught or ignored) */
X#define SIGBUS	10	/* bus error */
X#define SIGSEGV	11	/* segmentation violation */
X#define SIGSYS	12	/* bad argument to system call */
X#define SIGPIPE	13	/* write on a pipe with no one to read it */
X#define SIGALRM	14	/* alarm clock */
X#define SIGTERM	15	/* software termination signal from kill */
X/*#define SIGUSR1	30	/* user defined signal 1 */
X/*#define SIGUSR2	31	/* user defined signal 2 */
X
X  /* --- Job control (POSIX requires definition but not support) --- */
X#define SIGSTOP	17	/* stop (cannot be caught or ignored) */
X#define SIGTSTP	18	/* interactive stop signal */
X#define SIGCONT	19	/* continue if stopped */
X#define SIGCHLD	20	/* child process terminated or stopped */
X#define SIGTTIN	21	/* to reader's process group on background read */
X#define SIGTTOU	22	/* to writer's process group on background write */
X
X/* --- Types --- */
Xtypedef int sig_atomic_t;
X
X/* --- Function prototypes --- */
Xint	raise	_PROTO((int sig));
Xvoid	(*signal _PROTO((int sig, void (*func)(int)))) _PROTO((int));
X#ifdef _POSIX_SOURCE
Xint	kill	_PROTO((pid_t pid, int sig));
X/* PENDING - A zillion sig* functions required by POSIX are missing. */
X#endif
X
X#endif /* !defined __SIGNAL_H */
/
echo x - stdarg.h
sed '/^X/s///' > stdarg.h << '/'
X#ifndef __STDARG_H
X#define __STDARG_H
X
X/* --- Types --- */
X#ifndef _VA_LIST
X#define _VA_LIST
Xtypedef char * va_list;
X#endif
X
X/* --- Definitions --- */
X  /* --- Add your favourite machine here! --- */
X  /*	_STK_OP	    indicates which way addresses change as one moves
X		    along an argument list
X	_STK_OPE    is _STK_OP with an = behind it
X	_STK_ALIGN  is the minimum number of bytes moved by a stack PUSH
X	_STK_OFFSET is the offset of an argument after the pointer has
X		    been bumped.
X	For example, if a machine has 4 bytes to a word, little endian,
X	grows its stack downwards and always pushes at least a word,
X	then we should define:
X	_STK_OP		+
X	_STK_OP		+=
X	_STK_ALIGN	4
X	_STK_OFFSET(v)	((sizeof(v) == 1) ? -4 : ((sizeof(v) == 2) ? -2 : -1))
X  */
X
X#ifdef i8088
X#define _STK_OP		+	/* stack grows down */
X#define _STK_OPE	+=
X#define _STK_ALIGN	2	/* PUSH moves at least 2 bytes */
X#define _STK_OFFSET(v)	((sizeof(v) < 2) ? -2 : -1) /* little endian */
X#endif
X
X#ifdef ATARI_ST
X#define _STK_OP		+	/* stack grows down */
X#define _STK_OPE	+=
X#define _STK_ALIGN	2	/* PUSH moves at least 2 bytes */
X#define _STK_OFFSET(v)	-1	/* big endian */	
X#endif
X
X#define _STK_BUMP(v)	((sizeof(v) < _STK_ALIGN) ? _STK_ALIGN : sizeof(v))
X
X/* --- Macros --- */
X#define va_start(ap, last) ((ap) = (va_list) &(last) _STK_OP _STK_BUMP(last))
X#define va_arg(ap, type) (((type *) ((ap) _STK_OPE _STK_BUMP(type)))[_STK_OFFSET(type)])
X#define va_end(ap)
X
X#endif /* !defined __STDARG_H */
/
echo x - stddef.h
sed '/^X/s///' > stddef.h << '/'
X#ifndef __STDDEF_H
X#define __STDDEF_H
X
X/* --- Constants --- */
X#ifndef __STDC__
X#define NULL	0
X#else
X#define NULL	((void *) 0)
X#endif
X
X/* --- Types --- */
X#ifndef __SIZE_T
X#define __SIZE_T
Xtypedef unsigned int size_t;
X#endif
X
X#ifndef __PTRDIFF_T
X#define __PTRDIFF_T
Xtypedef int ptrdiff_t;		/* Should be like size_t plus a sign bit! */
X#endif
X
X#ifndef __WCHAR_T
X#define __WCHAR_T
Xtypedef char wchar_t;		/* No special support for wide characters! */
X#endif
X
X/* --- Macros --- */
X#define offsetof(type, member)	((size_t) (&(((type *) 0)->member)))
X
X#endif /* !defined __STDDEF_H */
/
echo x - stdio.h
sed '/^X/s///' > stdio.h << '/'
X#ifndef __STDIO_H
X#define __STDIO_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#ifndef __STDC__
X#define NULL	0
X#else
X#define NULL	((void *) 0)
X#endif
X#define EOF	(-1)
X#define BUFSIZ	1024
X
X#define _IOFBF		0
X#define _IOLBF		_IO_LBUF
X#define _IONBF		(-1)
X#define L_tmpnam	(4 + 1 + FILENAME_MAX) /* "/tmp/" + file name + '\0' */
X#define TMP_MAX		32767		/* Arbitrary! */
X#define SEEK_SET	0
X#define SEEK_CUR	1
X#define SEEK_END	2
X#ifdef _POSIX_SOURCE
X#ifdef __LIMITS_H
X#define FILENAME_MAX	(NAME_MAX + 1)	/* includes room for trailing '\0' */
X#define FOPEN_MAX	OPEN_MAX
X#endif
X#define L_cuserid	(30+1)		/* Arbitrary! */
X#define L_ctermid	(10+1)		/* Arbitrary! */
X#endif
X#ifndef FILENAME_MAX
X#define FILENAME_MAX	15		/* 14 character file name + '\0' */
X#define FOPEN_MAX	20
X#endif
X
X/* --- Types --- */
X#ifndef __SIZE_T
X#define __SIZE_T
Xtypedef unsigned int size_t;
X#endif
X
X#ifndef _VA_LIST
X#define _VA_LIST
Xtypedef char * va_list;
X#endif
X
Xtypedef long fpos_t;
X
Xtypedef struct {
X  int		_io_fd;
X  unsigned int	_io_flags;
X  int		_io_count;
X  int		_io_bufsiz;
X  unsigned char	*_io_buf;
X  union {
X  unsigned char	*_io_ptr;
X  int		_io_char;
X  } _io;
X} FILE;
X
X/* --- Definitions --- */
X#define stdin	(&_iob[0])
X#define stdout	(&_iob[1])
X#define stderr	(&_iob[2])
X  /* --- Flag bits --- */
X#define _IO_READ	0x0001
X#define _IO_WRITE	0x0002
X#define _IO_UPDATE	0x0004
X#define _IO_LBUF	0x0008
X#define _IO_MYBUF	0x0010
X#define _IO_EOF		0x0020
X#define _IO_ERR		0x0040
X#define _IO_STRING	0x0080
X#define _IO_TEMP	0x0100
X#define _IO_TTY		0x1000
X#ifdef _V7
X#define _IO_APPEND	0x4000		/* won't be needed with Posix */
X#define _IO_NEEDSEEK	0x8000		/* won't be needed with Posix */
X#endif
X
X/* --- Prototypes --- */
X  /* --- Streams: open and close --- */
Xint	fclose	_PROTO((FILE *stream));
X#ifdef _POSIX_SOURCE
XFILE	*fdopen	_PROTO((int fd, const char *mode));
X#endif
XFILE	*fopen	_PROTO((const char *filename, const char *mode));
XFILE	*freopen _PROTO((const char *filename, const char *mode, FILE *stream));
XFILE	*tmpfile _PROTO((void));
X  /* --- Streams: input --- */
Xint	fgetc	_PROTO((FILE *stream));
Xchar	*fgets	_PROTO((char *s, int n, FILE *stream));
Xsize_t	fread	_PROTO((void *ptr, size_t size, size_t nmemb, FILE *stream));
Xint	fscanf	_PROTO((FILE *stream, const char *format, ...));
Xint	getc	_PROTO((FILE *stream));
Xint	getchar	_PROTO((void));
Xchar	*gets	_PROTO((char *s));
Xint	scanf	_PROTO((const char *format, ...));
Xint	sscanf	_PROTO((const char *s, const char *format, ...));
Xint	ungetc	_PROTO((int c, FILE *stream));
X  /* --- Streams: output --- */
Xint	fprintf	_PROTO((FILE *stream, const char *format, ...));
Xint	fputc	_PROTO((int c, FILE *stream));
Xint	fputs	_PROTO((const char *s, FILE *stream));
Xsize_t	fwrite	_PROTO((const void *ptr, size_t size, size_t nmemb, FILE *stream));
Xint	printf	_PROTO((const char *format, ...));
Xint	putc	_PROTO((int c, FILE *stream));
Xint	putchar	_PROTO((int c));
Xint	puts	_PROTO((const char *s));
Xint	sprintf	_PROTO((char *s, const char *format, ...));
Xint	vfprintf _PROTO((FILE *stream, const char *format, va_list arg));
Xint	vprintf	_PROTO((const char *format, va_list arg));
Xint	vsprintf _PROTO((char *s, const char *format, va_list arg));
X  /* --- Streams: inquiry and control --- */
Xvoid	clearerr _PROTO((FILE *stream));
Xint	feof	_PROTO((FILE *stream));
Xint	ferror	_PROTO((FILE *stream));
Xint	fflush	_PROTO((FILE *stream));
Xint	fgetpos	_PROTO((FILE *stream, fpos_t *pos));
X#ifdef _POSIX_SOURCE
Xint	fileno	_PROTO((FILE *stream));
X#endif
Xint	fseek	_PROTO((FILE *stream, long int offset, int whence));
Xint	fsetpos	_PROTO((FILE *stream, const fpos_t *pos));
Xlong int ftell	_PROTO((FILE *stream));
Xvoid	rewind	_PROTO((FILE *stream));
Xvoid	setbuf	_PROTO((FILE *stream, char *buf));
Xint	setvbuf	_PROTO((FILE *stream, char *buf, int mode, size_t size));
X  /* --- File system manipulation --- */
Xint	remove	_PROTO((const char *filename));
Xint	rename	_PROTO((const char *old, const char *new));
X  /* --- Miscellaneous --- */
Xvoid	perror	_PROTO((const char *s));
Xchar	*tmpnam	_PROTO((char *s));
X
X/* --- Some standard functions are defined below as macros.  In	--- */
X/* --- general, using the macros results in faster code at the	--- */
X/* --- expense of larger code size and increased compile time.	--- */
X/* --- Any macro may be #undef'ed to expose a library function. --- */
X
X/* --- The macros getc() and putc() are "unsafe" in that they	--- */
X/* --- evaluate their arguments more than once.  By default,	--- */
X/* --- the safe alternatives are the functions fgetc()/fputc().	--- */
X/* --- #define _SAFEMACRO will define fgetc()/fputc() as	--- */
X/* ---		safe macros, at the cost of increased storage.	--- */
X
X  /* --- Streams: input --- */
X#ifdef _SAFEMACRO
X#define fgetc(f)	(_io_f = (f), getc(_io_f))
X#endif
X#define getc(f)	((--(f)->_io_count >= 0) ? *(f)->_io._io_ptr++ : _filbuf(f))
X#define getchar()	getc(stdin)
X  /* --- Streams: output --- */
X#ifdef _SAFEMACRO
X#define fputc(c, f)	(_io_c = (c), _io_f = (f), putc(_io_c, _io_f))
X#endif
X#define putc(c, f)							\
X  (									\
X   ((--(f)->_io_count < 0) || (_io_testflag(f, _IO_LBUF) && c == '\n'))	\
X	? _flsbuf(c, f)							\
X	: (int) (*(f)->_io._io_ptr++ = c)				\
X  )
X#define putchar(c)	putc(c, stdout)
X#define puts(s)								\
X  ((fputs(s, stdout) >= 0) ? ((putchar('\n') == '\n') ? 0 : EOF) : EOF)
X#define vfprintf(f, fmt, ap)	_doprnt(f, fmt, ap)
X#define vprintf(fmt, ap)	_doprnt(stdout, fmt, ap)
X  /* --- Streams: inquiry and control --- */
X#define clearerr(f)		_io_clearflag((f), (_IO_EOF | _IO_ERR))
X#define feof(f)			_io_testflag((f), _IO_EOF)
X#define ferror(f)		_io_testflag((f), _IO_ERR)
X#define _io_testflag(f, flag)	((f)->_io_flags & (flag))
X#ifdef _POSIX_SOURCE
X#define fileno(f)	((f)->_io_fd)
X#endif /* defined _POSIX_SOURCE */
X#define fgetpos(f, p)	((*(p) = (fpos_t) ftell(f)) >= 0L) ? 0 : EOF)
X#define fsetpos	(f, p)	fseek((f), *(p), SEEK_SET)
X#define setbuf(f, b) setvbuf((f), (b), ((b) == NULL) ? _IONBF : _IOFBF, BUFSIZ)
X  /* --- File system manipulation --- */
X#define remove(p)	unlink(p)
X
X/* --- Storage --- */
Xextern FILE _iob[FOPEN_MAX];
X
X#ifdef _SAFEMACRO
Xextern FILE *_io_f;
Xextern int _io_c;
X#endif
X
X#endif /* !defined __STDIO_H */
/
echo x - stdiolib.h
sed '/^X/s///' > stdiolib.h << '/'
X#ifndef __STDIOLIB_H
X#define __STDIOLIB_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#define _IO_NEVER	(-1)	/* MAGIC count for virgin streams */
X#define P_tmpdir	"/tmp"	/* directory for temporary files */
X
X/* --- Prototypes --- */
Xvoid	_bufalloc	_PROTO((FILE *stream));
Xvoid	_buffree	_PROTO((FILE *stream));
Xvoid	_cleanup	_PROTO((void));
Xint	_doprnt		_PROTO((FILE *stream, const char *format, va_list arg));
Xint	_doscan		_PROTO((int is_string, void *source, const char *format, va_list arg));
Xint	_filbuf		_PROTO((FILE *stream));
Xint	_flsbuf		_PROTO((int c, FILE *stream));
Xint	_flspbuf	_PROTO((FILE *stream));
XFILE	*_ioballoc	_PROTO((void));
Xvoid	_iobfree	_PROTO((FILE *stream));
Xint	_iobindex	_PROTO((FILE *stream));
Xvoid	_i_init		_PROTO((FILE *stream));
Xvoid	_o_init		_PROTO((FILE *stream));
Xint	_valmode	_PROTO((const char *mode));
X
X/* --- Macros --- */
X#define _io_valid(f)		(_iobindex(f) >= 0)
X#define _io_setflag(f, flag)	((f)->_io_flags |= (flag))
X#define _io_clearflag(f, flag)	((f)->_io_flags &= ~(flag))
X
X#ifdef NDEBUG
X#define _io_assert(condition)
X#define _io_guarded(stmt)
X#else
X#define _io_assert(condition)	\
X  if (!(condition))		\
X	return (_IO_ERRVAL)
X#define _io_guarded(stmt) (stmt)
X#endif /* !defined NDEBUG */
X
X/* --- Storage --- */
Xextern void (*__cleanup)();
X
X#endif /* !defined __STDIOLIB_H */
/
echo x - stdlib.h
sed '/^X/s///' > stdlib.h << '/'
X#ifndef __STDLIB_H
X#define __STDLIB_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#ifndef __STDC__
X#define NULL	0
X#else
X#define NULL	((void *) 0)
X#endif
X#define RAND_MAX	32767
X#define EXIT_SUCCESS	0
X#define EXIT_FAILURE	1
X
X/* --- Types --- */
X#ifndef __SIZE_T
X#define __SIZE_T
Xtypedef unsigned int size_t;
X#endif
X
X#ifndef __WCHAR_T
X#define __WCHAR_T
Xtypedef char wchar_t;		/* No special support for wide characters! */
X#endif
X
X#ifndef __DIV_T
X#define __DIV_T
Xtypedef struct {int quot; int rem;} div_t;
X#endif
X
X#ifndef __LDIV_T
X#define __LDIV_T
Xtypedef struct {long int quot; long int rem;} ldiv_t;
X#endif
X
X/* --- Prototypes --- */
X  /* --- String conversion --- */
Xdouble	atof	_PROTO((const char *nptr));
Xint	atoi	_PROTO((const char *nptr));
Xlong	atol	_PROTO((const char *nptr));
Xdouble	strtod	_PROTO((const char *nptr, char **endptr));
Xlong	strtol	_PROTO((const char *nptr, char **endptr, int base));
Xunsigned long strtoul _PROTO((const char *nptr, char **endptr, int base));
X  /* --- Pseudo-random sequence generation --- */
Xint	rand	_PROTO((void));
Xvoid	srand	_PROTO((unsigned int seed));
X  /* --- Memory management --- */
Xvoid 	*calloc	_PROTO((size_t nmemb, size_t size));
Xvoid	free	_PROTO((void *ptr));
Xvoid	*malloc	_PROTO((size_t size));
Xvoid	*realloc _PROTO((void *ptr, size_t size));
X  /* --- Communication with the environment --- */
Xvoid	abort	_PROTO((void));
Xint	atexit	_PROTO((void (*func)(void)));
Xvoid	exit	_PROTO((int status));
Xchar	*getenv	_PROTO((const char *name));
Xint	system	_PROTO((const char *string));
X  /* --- Searching and sorting --- */
Xvoid	*bsearch _PROTO((const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)));
Xvoid	qsort	_PROTO((void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)));
X  /* --- Integer arithmetic --- */
Xint	abs	_PROTO((int j));
Xdiv_t	div	_PROTO((int numer, int denom));
Xlong int labs	_PROTO((long int j));
Xldiv_t	ldiv	_PROTO((long int numer, long int denom));
X  /* --- Multibyte characters --- */
X/* Nothing implemented! */
X
X/* --- Macros --- */
X#define atoi(nptr)	((int) strtol((nptr), NULL, 10))
X#define atol(nptr)	strtol((nptr), NULL, 10)
X
X#endif /* !defined __STDLIB_H */
/
echo x - string.h
sed '/^X/s///' > string.h << '/'
X#ifndef __STRING_H
X#define __STRING_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#ifndef __STDC__
X#define NULL	0
X#else
X#define NULL	((void *) 0)
X#endif
X
X/* --- Types --- */
X#ifndef __SIZE_T
X#define __SIZE_T
Xtypedef unsigned int size_t;
X#endif
X
X/* --- Prototypes --- */
X/*
X# String library.		Author: Henry Spencer
X
X# Configuration settings:  how should "size_t", "void *", "const" be written?
X# "size_t" is what's needed to hold the result of sizeof; beware of problems
X# with compatibility here, because X3J11 uses this for e.g. the third
X# argument of strncpy() as well.  You may need to make it "int" even if
X# this is a lie.  "void *" is the generic pointer type, "char *" in most
X# existing implementations.  "const" is the keyword marking read-only
X# variables and parameters, unimplemented in most existing implementations.
X# These things need to be defined this way because they must be fitted into
X# both the .h files and the .c files; see the make instructions for string.h
X# in the Makefile.
X
XSIZET = int
XVOIDSTAR = char *
XLVOIDSTAR = char*	# Lint shell file has problems with * alone.  Barf.
XCONST = 
X*/
X
X/*
X * String functions.
X */
X
Xvoid	*memcpy	_PROTO((void *dst, const void *src, size_t size));
Xvoid	*memccpy _PROTO((void *dst, const void *src, int ucharstop, size_t size));
Xchar	*strcpy	_PROTO((char *dst, const char *src));
Xchar	*strncpy _PROTO((char *dst, const char *src, size_t size));
Xchar	*strcat	_PROTO((char *dst, const char *src));
Xchar	*strncat _PROTO((char *dst, const char *src, size_t size));
Xint	memcmp	_PROTO((const void *s1, const void *s2, size_t size));
Xint	strcmp	_PROTO((const char *s1, const char *s2));
Xint	strncmp	_PROTO((const char *s1, const char *s2, size_t size));
Xvoid	*memchr	_PROTO((const void *s, int ucharwanted, size_t size));
Xchar	*strchr	_PROTO((const char *s, int charwanted));
Xsize_t	strcspn	_PROTO((const char *s, const char *reject));
Xchar	*strpbrk _PROTO((const char *s, const char *breakat));
Xchar	*strrchr _PROTO((const char *s, int charwanted));
Xsize_t	strspn	_PROTO((const char *s, const char *accept));
Xchar	*strstr	_PROTO((const char *s, const char *wanted));
Xchar	*strtok	_PROTO((char *s, const char *delim));
Xvoid	*memset	_PROTO((void *s, int ucharfill, size_t size));
Xsize_t	strlen	_PROTO((const char *s));
X
X/*
X * V7 and Berklix compatibility.
X */
X#ifdef _V7
Xchar	*index	_PROTO((const char *s, int charwanted));
Xchar	*rindex	_PROTO((const char *s, int charwanted));
X#endif
X#ifdef _BSD
Xint	bcopy	_PROTO((const char *src, char *dst, int length));
Xint	bcmp	_PROTO((const char *s1, const char *s2, int length));
Xint	bzero	_PROTO((char *dst, int length));
X#endif
X
X/*
X * Putting this in here is really silly, but who am I to argue with X3J11?
X */
Xchar *strerror	_PROTO((int errnum));
X
X#endif /* !defined __STRING_H */
/
echo x - termios.h
sed '/^X/s///' > termios.h << '/'
X#ifndef __TERMIOS_H
X#define __TERMIOS_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* PENDING - Fill these in when implemented. */
X/* PENDING - POSIX insists that all must be defined, even if unsupported. */
X/* --- Constants --- */
X  /* --- Input modes (c_iflag) --- */
X#define BRKINT			/* Signal interrupt on break */
X#define ICRNL			/* Map CR to NL on input */
X#define IGNBRK			/* Ignore break condition */
X#define IGNCR			/* Ignore CR */
X#define IGNPAR			/* Ignore characters with parity errors */
X#define INLCR			/* Map NL to CR on input */
X#define INPCK			/* Enable input parity check */
X#define ISTRIP			/* Strip character */
X#define IXOFF			/* Enable start/stop input control */
X#define IXON			/* Enable start/stop output control */
X#define PARMRK			/* Mark parity errors */
X  /* --- Output modes (c_oflag) --- */
X#define OPOST			/* Perform output processing */
X  /* --- Control modes (c_cflag) --- */
X#define CLOCAL			/* Ignore modem status lines */
X#define CREAD			/* Enable receiver */
X#define CSIZE			/* Number of bits per byte */
X#define   CS5			/*   5 bits */
X#define   CS6			/*   6 bits */
X#define   CS7			/*   7 bits */
X#define   CS8			/*   8 bits */
X#define CSTOPB			/* Send two stop bits, else one */
X#define HUPCL			/* Hang up on last close */
X#define PARENB			/* Parity enable */
X#define PARODD			/* Odd parity, else even */
X  /* --- Local modes (c_lflag) --- */
X#define ECHO			/* Enable echo */
X#define ECHOE			/* Echo ERASE as an error-correcting BS */
X#define ECHOK			/* Echo KILL */
X#define ECHONL			/* Echo '\n' */
X#define ICANON			/* Canonical input (erase and kill) */
X#define IEXTEN			/* Enable extended functions */
X#define ISIG			/* Enable signals */
X#define NOFLSH			/* Disable flush after interrupt, quit, suspend */
X#define TOSTOP			/* Send SIGTTOU for background output */
X  /* --- Special control characters --- */
X#define NCCS			/* Number of control characters */
X#define VEOF
X#define VEOL
X#define VERASE
X#define VINTR
X#define VKILL
X#define VMIN
X#define VQUIT
X#define VSUSP
X#define VTIME
X#define VSTART
X#define VSTOP
X  /* --- Line speeds --- */
X#define B0			/* Hang up */
X#define B50
X#define B75
X#define B110
X#define B134
X#define B150
X#define B200
X#define B300
X#define B600
X#define B1200
X#define B1800
X#define B2400
X#define B4800
X#define B9600
X#define B19200
X#define B38400
X
X/* --- Types --- */
X#ifndef __TCFLAG_T
X#define __TCFLAG_T
Xtypedef unsigned int tcflag_t;
X#endif
X
X#ifndef __CC_T
X#define __CC_T
Xtypedef unsigned int cc_t;
X#endif
X
X#ifndef __SPEED_T
X#define __SPEED_T
Xtypedef unsigned char speed_t;
X#endif
X
X/* --- Structures --- */
Xstruct termios {
X  tcflag_t	c_iflag;
X  tcflag_t	c_oflag;
X  tcflag_t	c_cflag;
X  tcflag_t	c_lflag;
X  cc_t		c_cc[NCCS];
X  speed_t	c_ispeed;
X  speed_t	c_ospeed;
X};
X
X/* --- Prototypes --- */
Xspeed_t	cfgetospeed	_PROTO((struct termios *termios_p));
Xspeed_t	cfsetospeed	_PROTO((struct termios *termios_p, speed_t speed));
Xspeed_t	cfgetispeed	_PROTO((struct termios *termios_p));
Xspeed_t	cfsetispeed	_PROTO((struct termios *termios_p, speed_t speed));
Xint	tcgetattr	_PROTO((int fd, struct termios *termios_p));
Xint	tcsetattr	_PROTO((int fd, int actions, struct termios *termios_p));
Xint	tcsendbreak	_PROTO((int fd, int duration));
Xint	tcdrain		_PROTO((int fd));
Xint	tcflush		_PROTO((int fd, int queue_selector));
Xint	tcflow		_PROTO((int fd, int action));
X
X#endif /* !defined __TERMIOS_H */
/
echo x - time.h
sed '/^X/s///' > time.h << '/'
X#ifndef __TIME_H
X#define __TIME_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#ifndef __STDC__
X#define NULL	0
X#else
X#define NULL	((void *) 0)
X#endif
X#define CLOCKS_PER_SEC	60
X#define CLK_TCK		CLOCKS_PER_SEC	/* PENDING - looks like ANSI won't like this */
X
X/* --- Types --- */
X#ifndef __SIZE_T
X#define __SIZE_T
Xtypedef unsigned int size_t;
X#endif
X
X#ifndef __CLOCK_T
X#define __CLOCK_T
Xtypedef long int clock_t;
X#endif
X
X#ifndef __TIME_T
X#define __TIME_T
Xtypedef long int time_t;
X#endif
X
X/* --- Structures --- */
Xstruct tm {
X	int	tm_sec;
X	int	tm_min;
X	int	tm_hour;
X	int	tm_mday;
X	int	tm_mon;
X	int	tm_year;
X	int	tm_wday;
X	int	tm_yday;
X	int	tm_isdst;
X};
X
X/* --- Prototypes --- */
Xchar	*asctime	_PROTO((const struct tm *timeptr));
Xclock_t	clock		_PROTO((void));
Xchar	*ctime		_PROTO((time_t *timer));
Xdouble	difftime	_PROTO((time_t time1, time_t time2));
Xstruct tm *gmtime	_PROTO((const time_t *timer));
Xstruct tm *localtime	_PROTO((const time_t *timer));
Xtime_t	mktime		_PROTO((struct tm *timeptr));
Xsize_t	strftime	_PROTO((char *s, size_t maxsize, const char *format, const struct tm *timeptr));
Xtime_t	time		_PROTO((time_t *timer));
X#ifdef _POSIX_SOURCE
Xvoid	tzset		_PROTO((void));
X#endif
X
X#endif /* !defined __TIME_H */
/
echo x - unistd.h
sed '/^X/s///' > unistd.h << '/'
X#ifndef __UNISTD_H
X#define __UNISTD_H
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#ifndef __STDC__
X#define NULL	0
X#else
X#define NULL	((void *) 0)
X#endif
X#define _POSIX_VERSION	198808L
X
X/* --- For access(2) --- */
X#define     R_OK     	4
X#define     W_OK     	2
X#define     X_OK     	1
X#define     F_OK     	0
X
X/* --- For lockf(2) --- */
X#define     F_ULOCK	0
X#define     F_LOCK	1
X#define     F_TLOCK	2
X#define     F_TEST	3
X
X/* --- For lseek(2) --- */
X#define     SEEK_SET	0
X#define     SEEK_CUR	1
X#define     SEEK_END	2
X
X/* --- For sysconf() --- */
X#define _SC_ARG_MAX	1
X#define _SC_CHILD_MAX	2
X#define _SC_CLK_TCK	3
X#define _SC_NGROUPS_MAX	4
X#define _SC_OPEN_MAX	5
X#define _SC_JOB_CONTROL	6
X#define _SC_SAVED_IDS	7
X#define _SC_VERSION	8
X
X/* --- Prototypes --- */
X  /* --- Process creation and execution --- */
Xpid_t	fork		_PROTO((void));
Xint	execl		_PROTO((char *path, ...));
Xint	execv		_PROTO((char *path, char *argv[]));
Xint	execle		_PROTO((char *path, ...));
Xint	execve		_PROTO((char *path, char *argv[], char *envp[]));
Xint	execlp		_PROTO((char *file, ...));
Xint	execvp		_PROTO((char *file, char *argv[]));
X  /* --- Process termination --- */
Xvoid	_exit		_PROTO((int status));
X  /* --- Timer operations --- */
Xunsigned int alarm	_PROTO((unsigned int seconds));
Xint	pause		_PROTO((void));
Xunsigned int sleep	_PROTO((unsigned int seconds));
X  /* --- Process identification --- */
Xpid_t	getpid		_PROTO((void));
Xpid_t	getppid		_PROTO((void));
X  /* --- User identification --- */
Xuid_t	getuid		_PROTO((void));
Xuid_t	geteuid		_PROTO((void));
Xgid_t	getgid		_PROTO((void));
Xgid_t	getegid		_PROTO((void));
Xint	setuid		_PROTO((uid_t uid));
Xint	setgid		_PROTO((gid_t gid));
Xint	getgroups	_PROTO((int gidsetsize, gid_t grouplist[]));
Xchar	*getlogin	_PROTO((void));
Xchar	*cuserid	_PROTO((char *s));
X  /* --- Process groups --- */
Xpid_t	getpgrp		_PROTO((void));
Xpid_t	setsid		_PROTO((void));
Xint	setpgid		_PROTO((pid_t pid, pid_t pgid));
X  /* --- Terminal identification --- */
Xchar	*ctermid	_PROTO((char *s));
Xchar	*ttyname	_PROTO((int fd));
Xint	isatty		_PROTO((int fd));
X  /* --- Configurable system variables --- */
Xlong	sysconf		_PROTO((int name));
X  /* --- Working directory --- */
Xint	chdir		_PROTO((char *path));
Xchar	*getcwd		_PROTO((char *buf, int size));
X  /* --- General file creation --- */
Xint	link		_PROTO((char *path1, char *path2));
X  /* --- File removal --- */
Xint	unlink		_PROTO((char *path));
Xint	rmdir		_PROTO((char *path));
X  /* --- File characteristics --- */
Xint	access		_PROTO((char *path, int amode));
Xint	chown		_PROTO((char *path, uid_t owner, gid_t group));
X  /* --- Configurable pathname variables --- */
Xlong	pathconf	_PROTO((char *path, int name));
Xlong	fpathconf	_PROTO((int fd, int name));
X  /* --- Pipes --- */
Xint	pipe		_PROTO((int fildes[2]));
X  /* --- File descriptor manipulation --- */
Xint	dup		_PROTO((int fd));
Xint	dup2		_PROTO((int fd, int fd2));
X  /* --- File descriptor deassignment --- */
Xint	close		_PROTO((int fd));
X  /* --- Input and output --- */
Xint	read		_PROTO((int fd, char *buf, unsigned int n));
Xint	write		_PROTO((int fd, char *buf, unsigned int n));
X  /* --- Control operations on files --- */
Xoff_t	lseek		_PROTO((int fd, off_t offset, int whence));
X  /* --- General terminal interface control --- */
Xpid_t	tcgetpgrp	_PROTO((int fd));
Xint	tcsetpgrp	_PROTO((int fd, pid_t pgrp_id));
X
X#endif /* !defined __UNISTD_H */
/
echo x - utime.h
sed '/^X/s///' > utime.h << '/'
X#ifndef __UTIME_H
X#define __UTIME_H
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Structures --- */
Xstruct utimbuf {
X	time_t	actime;
X	time_t	modtime;
X};
X
X/* --- Prototypes --- */
Xint	utime	_PROTO((char *path, struct utimbuf *times));
X
X#endif /* !defined __UTIME_H */
/
echo x - sys/dirent.h
sed '/^X/s///' > sys/dirent.h << '/'
X#ifndef __SYS_DIRENT_H
X#define __SYS_DIRENT_H
X
X/*
X	 -- file system independent directory entry (SVR3)
X
X	last edit:	27-Oct-1988	D A Gwyn
X
X	prerequisite:	
X*/
X
X/* --- Structures --- */
Xstruct dirent {			/* data from getdents()/readdir() */
X  long	d_ino;			/* inode number of entry */
X  off_t	d_off;			/* offset of disk directory entry */
X  unsigned short d_reclen;	/* length of this record */
X  char	d_name[1];		/* name of file */	/* non-ANSI */
X};
X
X#ifdef BSD_SYSV				/* (e.g., when compiling getdents.c) */
Xextern struct dirent	__dirent;	/* (not actually used) */
X/* The following is portable, although rather silly. */
X#define	DIRENTBASESIZ		(__dirent.d_name - (char *)&__dirent.d_ino)
X
X#else
X/* The following nonportable ugliness could have been avoided by defining
X   DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments.
X   There shouldn't be any problem if you avoid using the DIRENTSIZ() macro. */
X
X#define	DIRENTBASESIZ		(((struct dirent *)0)->d_name \
X				- (char *)&((struct dirent *)0)->d_ino)
X#endif
X
X#define	DIRENTSIZ( namlen )	((DIRENTBASESIZ + sizeof(long) + (namlen)) \
X				/ sizeof(long) * sizeof(long))
X
X/* DAG -- the following was moved from , which was the wrong place */
X#define	MAXNAMLEN	512		/* maximum filename length */
X
X#ifndef NAME_MAX
X#define	NAME_MAX	(MAXNAMLEN - 1)	/* DAG -- added for POSIX */
X#endif
X
X#endif /* !defined __SYS_DIRENT_H */
/
echo x - sys/stat.h
sed '/^X/s///' > sys/stat.h << '/'
X#ifndef __SYS_STAT_H
X#define __SYS_STAT_H
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X#define S_IFMT  0170000		/* type of file */
X#define S_IFDIR 0040000  	/* directory */
X#define S_IFCHR 0020000		/* character special */
X#define S_IFBLK 0060000		/* block special */
X#define S_IFREG 0100000		/* regular */
X#define S_IFIFO 0010000		/* named pipe (FIFO) */
X#define S_ISUID	04000		/* set user id on execution */
X#define S_ISGID	02000		/* set group id on execution */
X#define S_IRWXU	00700		/* owner rwx	*/
X#define S_IRUSR	00400		/* owner r	*/
X#define S_IWUSR	00200		/* owner  w	*/
X#define S_IXUSR	00100		/* owner   x	*/
X#define S_IRWXG	00070		/* group rwx	*/
X#define S_IRGRP	00040		/* group r	*/
X#define S_IWGRP	00020		/* group  w	*/
X#define S_IXGRP	00010		/* group   x	*/
X#define S_IRWXO	00007		/* other rwx	*/
X#define S_IROTH	00004		/* other r	*/
X#define S_IWOTH	00002		/* other  w	*/
X#define S_IXOTH	00001		/* other   x	*/
X
X  /* --- Compatibility --- */
X#define S_IREAD   S_IRUSR	/* read permission, owner */
X#define S_IWRITE  S_IWUSR	/* write permission, owner */
X#define S_IEXEC   S_IXUSR	/* execute/search permission, owner */
X#define S_ISVTX   01000		/* save swapped text even after use */
X
X/* --- Structures --- */
Xstruct stat {
X	dev_t	st_dev;
X	ino_t	st_ino;
X	mode_t	st_mode;
X	nlink_t	st_nlink;
X	uid_t	st_uid;
X	gid_t	st_gid;
X	dev_t	st_rdev;
X	off_t	st_size;
X	time_t	st_atime;
X	time_t	st_mtime;
X	time_t	st_ctime;
X};
X
X/* --- Macros --- */
X#define S_ISDIR(m)	((m) & S_IFDIR)
X#define S_ISCHR(m)	((m) & S_IFCHR)
X#define S_ISBLK(m)	((m) & S_IFBLK)
X#define S_ISREG(m)	((m) & S_IFREG)
X#define S_ISFIFO(m)	((m) & S_IFIFO)	/* PENDING - should catch pipes */
X
X/* --- Prototypes --- */
Xmode_t	umask	_PROTO((mode_t cmask));
Xint	mkdir	_PROTO((char *path, mode_t mode));
Xint	mkfifo	_PROTO((char *path, mode_t mode));
Xint	stat	_PROTO((char *path, struct stat *buf));
Xint	fstat	_PROTO((int fd, struct stat *buf));
Xint	chmod	_PROTO((char *path, mode_t mode));
X
X#endif /* !defined __SYS_STAT_H */
/
echo x - sys/times.h
sed '/^X/s///' > sys/times.h << '/'
X#ifndef __SYS_TIMES_H
X#define __SYS_TIMES_H
X
X/* --- Prerequisites --- */
X#ifndef __TIME_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Structures --- */
Xstruct tms {
X	clock_t	tms_utime;
X	clock_t tms_stime;
X	clock_t	tms_cutime;
X	clock_t tms_cstime;
X};
X
X/* --- Prototypes --- */
Xclock_t	times	_PROTO((struct tms *buffer));
X
X#endif /* !defined __SYS_TIMES_H */
/
echo x - sys/types.h
sed '/^X/s///' > sys/types.h << '/'
X#ifndef __SYS_TYPES_H
X#define __SYS_TYPES_H
X
X/* --- Types --- */
X#ifndef __DEV_T
X#define __DEV_T
Xtypedef unsigned short int dev_t;
X#endif
X
X#ifndef __GID_T
X#define __GID_T
Xtypedef char gid_t;
X#endif
X
X#ifndef __INO_T
X#define __INO_T
Xtypedef unsigned short int ino_t;
X#endif
X
X#ifndef __MODE_T
X#define __MODE_T
Xtypedef unsigned short int mode_t;
X#endif
X
X#ifndef __NLINK_T
X#define __NLINK_T
Xtypedef char nlink_t;
X#endif
X
X#ifndef __OFF_T
X#define __OFF_T
Xtypedef long int off_t;
X#endif
X
X#ifndef __PID_T
X#define __PID_T
Xtypedef int pid_t;
X#endif
X
X#ifndef __UID_T
X#define __UID_T
Xtypedef short int uid_t;
X#endif
X
X#ifndef __TIME_T
X#define __TIME_T
Xtypedef long int time_t;
X#endif
X
X#endif /* !defined __SYS_TYPES_H */
/
echo x - sys/utsname.h
sed '/^X/s///' > sys/utsname.h << '/'
X#ifndef __SYS_UTSNAME_H
X#define __SYS_UTSNAME_H
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Structures --- */
Xstruct utsname {
X  char	*sysname;		/* name of the operating system */
X  char	*nodename;		/* name of this node in the network */
X  char	*release;		/* release level */
X  char	*version;		/* version of the release */
X  char	*machine;		/* machine type */
X};
X
X/* --- Prototypes --- */
Xint	uname	_PROTO((struct utsname *name));
X
X#endif /* !defined __SYS_UTSNAME_H */
/
echo x - sys/wait.h
sed '/^X/s///' > sys/wait.h << '/'
X#ifndef __SYS_WAIT_H
X#define __SYS_WAIT_H
X
X/* --- Prerequisites --- */
X#ifndef __SYS_TYPES_H
X#error  is a prerequisite for 
X#endif
X
X/* --- Inclusions --- */
X#include "prototype.h"
X
X/* --- Constants --- */
X/* PENDING - Define these when implemented. */
X#define WNOHANG
X#define WUNTRACED
X
X/* --- Macros --- */
X#define _STAT_LO(stat_val)	((stat_val) & 0xff)
X#define _STAT_HI(stat_val)	(((stat_val) >> 8) & 0xff)
X#define WIFEXITED(stat_val)	(_STAT_LO(stat_val) == 0)
X#define WEXITSTATUS(stat_val)	(_STAT_HI(stat_val))
X#define WIFSIGNALED(stat_val)	(_STAT_HI(stat_val) == 0 && _STAT_LO(stat_val) != 0)
X#define WTERMSIG(stat_val)	(_STAT_LO(stat_val))
X#define WIFSTOPPED(stat_val)
X#define WSTOPSIG(stat_val)
X
X/* --- Prototypes --- */
Xpid_t	wait	_PROTO((int *stat_loc));
Xpid_t	waitpid	_PROTO((pid_t pid, int *stat_loc, int options));
X
X#endif /* !defined __SYS_WAIT_H */
/