cechew@bruce.OZ (Earl Chew) (09/05/89)
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 5)."
# Contents: Makefile.dos Makefile.unx _cleanup.c.cdif _fakfls.c.cdif
# _filbuf.c.cdif _flsbuf.c.cdif _fopen.c.cdif atexit.c.cdif
# bitset.h.cdif
# Wrapped by cechew@bruce on Tue Sep 5 16:55:05 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile.dos' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile.dos'\"
else
echo shar: Extracting \"'Makefile.dos'\" \(1677 characters\)
sed "s/^X//" >'Makefile.dos' <<'END_OF_FILE'
X# NdMakefile for TurboC
X#
XOBJ= _allocbu.obj _fakfls.obj _filbuf.obj _file.obj \
X _flsbuf.obj _fopen.obj _slot.obj fclose.obj \
X fdopen.obj fflush.obj fgetc.obj fgets.obj \
X fopen.obj fprintf.obj fputc.obj fputs.obj \
X fread.obj freopen.obj fscanf.obj fseek.obj \
X ftell.obj fwrite.obj gets.obj getw.obj \
X printf.obj puts.obj putw.obj rewind.obj \
X scanf.obj setbuf.obj setvbuf.obj sprintf.obj \
X sscanf.obj stdio.obj ungetc.obj vfprintf.obj \
X vfscanf.obj vprintf.obj vscanf.obj vsprintf.obj \
X vsscanf.obj exit.obj atexit.obj
X#
X.SUFFIXES: .obj .c
X.c.obj:
X tcc -c $<
X#
Xexercise.out: exercise.obj $(OBJ)
X link /st:4096/m/noi/f \minix\lib\tc\sepi&d+\minix\lib\tc\c0+exercise.obj+$(OBJ),exercise,,\minix\lib\mxtc+\tc\lib\cs
X /minix/tools/dos2out -d exercise.exe
X /minix/tools/chmem =64000 exercise.out
X#
Xall: exercise.out tputc.out tprintf.out tfwrite.out
Xtiming: tputc.out tprintf.out tfwrite.out
X#
Xtputc.out: tputc.obj $(OBJ)
X link /st:4096/m/noi/f \minix\lib\tc\sepi&d+\minix\lib\tc\c0+tputc.obj+$(OBJ),tputc,,\minix\lib\mxtc+\tc\lib\cs
X /minix/tools/dos2out -d tputc.exe
X /minix/tools/chmem =64000 tputc.out
X#
Xtprintf.out: tprintf.obj $(OBJ)
X link /st:4096/m/noi/f \minix\lib\tc\sepi&d+\minix\lib\tc\c0+tprintf.obj+$(OBJ),tprintf,,\minix\lib\mxtc+\tc\lib\cs
X /minix/tools/dos2out -d tprintf.exe
X /minix/tools/chmem =64000 tprintf.out
X#
Xtfwrite.out: tfwrite.obj $(OBJ)
X link /st:4096/m/noi/f \minix\lib\tc\sepi&d+\minix\lib\tc\c0+tfwrite.obj+$(OBJ),tfwrite,,\minix\lib\mxtc+\tc\lib\cs
X /minix/tools/dos2out -d tfwrite.exe
X /minix/tools/chmem =64000 tfwrite.out
X#
Xexercise.obj: stdio.h
Xtfwrite.obj: stdio.h
Xtprintf.obj: stdio.h
Xtputc.obj: stdio.h
X$(OBJ): stdiolib.h stdio.h
END_OF_FILE
if test 1677 -ne `wc -c <'Makefile.dos'`; then
echo shar: \"'Makefile.dos'\" unpacked with wrong size!
fi
# end of 'Makefile.dos'
fi
if test -f 'Makefile.unx' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile.unx'\"
else
echo shar: Extracting \"'Makefile.unx'\" \(1113 characters\)
sed "s/^X//" >'Makefile.unx' <<'END_OF_FILE'
X# Makefile for BSD
X#
XCFLAGS= -I. -I/usr/include -DBSD
X#
XSTDIO= stdio.a
XLIBOBJ= _allocbu.o _filbuf.o _file.o _flsbuf.o \
X _fopen.o _slot.o atexit.o fclose.o \
X fdopen.o fflush.o fgetc.o fgets.o \
X fopen.o fprintf.o fputc.o fputs.o \
X fread.o freopen.o fscanf.o fseek.o \
X ftell.o fwrite.o gets.o getw.o \
X printf.o puts.o putw.o rewind.o \
X scanf.o setbuf.o setvbuf.o sprintf.o \
X sscanf.o stdio.o ungetc.o vfprintf.o \
X vfscanf.o vprintf.o vscanf.o vsprintf.o \
X vsscanf.o
XEXIT= exit.o _fakfls.o
X#
Xexercise: exercise.o $(STDIO)
X cc -o exercise exercise.o $(STDIO)
X#
Xall: exercise tputc tprintf tfwrite texit
Xtiming: tputc tprintf tfwrite texit
X#
Xtexit: texit.o $(STDIO)
X cc -o texit texit.o $(STDIO)
X#
Xtputc: tputc.o $(STDIO)
X cc -o tputc tputc.o $(STDIO)
X#
Xtprintf: tprintf.o $(STDIO)
X cc -o tprintf tprintf.o $(STDIO)
X#
Xtfwrite: tfwrite.o $(STDIO)
X cc -o tfwrite tfwrite.o $(STDIO)
X#
X$(STDIO): $(LIBOBJ) $(EXIT)
X /bin/rm -f $(STDIO)
X ar cr $(STDIO) `lorder $(LIBOBJ) | tsort` $(EXIT)
X#
Xexercise.o: stdio.h
Xtexit.o:
Xtfwrite.o: stdio.h
Xtprintf.o: stdio.h
Xtputc.o: stdio.h
X$(LIBOBJ) $(EXIT): stdiolib.h stdio.h
END_OF_FILE
if test 1113 -ne `wc -c <'Makefile.unx'`; then
echo shar: \"'Makefile.unx'\" unpacked with wrong size!
fi
# end of 'Makefile.unx'
fi
if test -f '_cleanup.c.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'_cleanup.c.cdif'\"
else
echo shar: Extracting \"'_cleanup.c.cdif'\" \(522 characters\)
sed "s/^X//" >'_cleanup.c.cdif' <<'END_OF_FILE'
X*** Old/_cleanup.c Sun Sep 3 13:54:54 1989
X--- /dev/null Tue Sep 5 16:22:51 1989
X***************
X*** 1,23
X- /* _ c l e a n u p
X- *
X- * Cleanly close and flush all output buffers. This ensures that
X- * all streams are written out and closed.
X- *
X- * Patchlevel 1.0
X- *
X- * Edit History:
X- */
X-
X- #include "stdiolib.h"
X-
X- /*LINTLIBRARY*/
X-
X- void _cleanup()
X-
X- {
X- int i; /* slot index */
X-
X- for (i = 0; i < _NFILE; i++)
X- if (_iop[i] != NULL)
X- (void) fclose(_iop[i]);
X- }
X
X--- 0 -----
END_OF_FILE
if test 522 -ne `wc -c <'_cleanup.c.cdif'`; then
echo shar: \"'_cleanup.c.cdif'\" unpacked with wrong size!
fi
# end of '_cleanup.c.cdif'
fi
if test -f '_fakfls.c.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'_fakfls.c.cdif'\"
else
echo shar: Extracting \"'_fakfls.c.cdif'\" \(408 characters\)
sed "s/^X//" >'_fakfls.c.cdif' <<'END_OF_FILE'
X*** /dev/null Tue Sep 5 16:22:51 1989
X--- New/_fakfls.c Tue Sep 5 16:12:58 1989
X***************
X*** 0
X
X--- 1,19 -----
X+ /* _ f a k f l s
X+ *
X+ * Fake _ioflush() for exit() so that stdio won't be hauled into
X+ * programs that don't need it.
X+ *
X+ * Patchlevel 1.0
X+ *
X+ * Edit History:
X+ * 05-Sep-1989 Created.
X+ */
X+
X+ #include "stdiolib.h"
X+
X+ /*LINTLIBRARY*/
X+
X+ void _ioflush()
X+
X+ {
X+ }
END_OF_FILE
if test 408 -ne `wc -c <'_fakfls.c.cdif'`; then
echo shar: \"'_fakfls.c.cdif'\" unpacked with wrong size!
fi
# end of '_fakfls.c.cdif'
fi
if test -f '_filbuf.c.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'_filbuf.c.cdif'\"
else
echo shar: Extracting \"'_filbuf.c.cdif'\" \(1288 characters\)
sed "s/^X//" >'_filbuf.c.cdif' <<'END_OF_FILE'
X*** Old/_filbuf.c Sun Sep 3 13:55:00 1989
X--- New/_filbuf.c Mon Sep 4 22:47:38 1989
X***************
X*** 6,12
X * The function will get a buffer full of data then return
X * the first character. EOF is returned on error.
X *
X! * Patchlevel 1.0
X *
X * Edit History:
X */
X
X--- 6,12 -----
X * The function will get a buffer full of data then return
X * the first character. EOF is returned on error.
X *
X! * Patchlevel 1.1
X *
X * Edit History:
X * 05-Sep-1989 Add EINTR repeat code after read().
X***************
X*** 9,14
X * Patchlevel 1.0
X *
X * Edit History:
X */
X
X #include "stdiolib.h"
X
X--- 9,15 -----
X * Patchlevel 1.1
X *
X * Edit History:
X+ * 05-Sep-1989 Add EINTR repeat code after read().
X */
X
X #include "stdiolib.h"
X***************
X*** 40,47
X (void) fflush(stdout);
X
X /* Read data into the buffer */
X! bytes = read(fp->_file, (char *) fp->_base,
X! TESTFLAG(fp, _IONBF) ? 1 : fp->_bufsiz);
X
X INITREADBUFFER(fp, bytes == -1 ? 0 : bytes);
X
X
X--- 41,50 -----
X (void) fflush(stdout);
X
X /* Read data into the buffer */
X! do
X! bytes = read(fp->_file, (char *) fp->_base,
X! TESTFLAG(fp, _IONBF) ? 1 : fp->_bufsiz);
X! while (bytes == -1 && errno == EINTR);
X
X INITREADBUFFER(fp, bytes == -1 ? 0 : bytes);
X
END_OF_FILE
if test 1288 -ne `wc -c <'_filbuf.c.cdif'`; then
echo shar: \"'_filbuf.c.cdif'\" unpacked with wrong size!
fi
# end of '_filbuf.c.cdif'
fi
if test -f '_flsbuf.c.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'_flsbuf.c.cdif'\"
else
echo shar: Extracting \"'_flsbuf.c.cdif'\" \(2653 characters\)
sed "s/^X//" >'_flsbuf.c.cdif' <<'END_OF_FILE'
X*** Old/_flsbuf.c Mon Sep 4 08:49:00 1989
X--- New/_flsbuf.c Tue Sep 5 16:12:41 1989
X***************
X*** 1,7
X /* _ f l s b u f
X *
X! * Allocate and flush an output buffer. If no buffer has been
X! * previously allocated, one will be allocated. This function
X * is intimately tied to the putc() macro in the stdio library.
X *
X * The function returns the character that was written to the
X
X--- 1,19 -----
X /* _ f l s b u f
X *
X! * This file contains three functions: _ioexit, _ioflush()
X! * and _flsbuf().
X! *
X! * _ioexit is empty and just provides a hook by which other
X! * functions can force the loading of this module (_ioflush()
X! * in particular).
X! *
X! * _ioflush() flushes all output buffers. This ensures that
X! * all streams are written out and closed. It's main purpose
X! * is to ensure that all streams are flushed on exit. exit()
X! * knows about the existence of _ioflush.
X! *
X! * _flsbuf allocates and flushes an output buffer. If no buffer
X! * has been previously allocated, one will be allocated. This function
X * is intimately tied to the putc() macro in the stdio library.
X *
X * The function returns the character that was written to the
X***************
X*** 7,13
X * The function returns the character that was written to the
X * file, otherwise EOF on error.
X *
X! * Patchlevel 1.0
X *
X * Edit History:
X */
X
X--- 19,25 -----
X * The function returns the character that was written to the
X * file, otherwise EOF on error.
X *
X! * Patchlevel 1.1
X *
X * Edit History:
X * 05-Sep-1989 Change SETCLEANUP to SETIOFLUSH. Add _ioflush()
X***************
X*** 10,15
X * Patchlevel 1.0
X *
X * Edit History:
X */
X
X #include "stdiolib.h"
X
X--- 22,29 -----
X * Patchlevel 1.1
X *
X * Edit History:
X+ * 05-Sep-1989 Change SETCLEANUP to SETIOFLUSH. Add _ioflush()
X+ * and _ioexit().
X */
X
X #include "stdiolib.h"
X***************
X*** 16,21
X
X /*LINTLIBRARY*/
X
X int _flsbuf(c, fp)
X
X char c; /* character to write */
X
X--- 30,50 -----
X
X /*LINTLIBRARY*/
X
X+ void _ioexit()
X+
X+ {
X+ }
X+
X+ void _ioflush()
X+
X+ {
X+ int i; /* slot index */
X+
X+ for (i = 0; i < _NFILE; i++)
X+ if (_iop[i] != NULL)
X+ (void) fclose(_iop[i]);
X+ }
X+
X int _flsbuf(c, fp)
X
X char c; /* character to write */
X***************
X*** 44,50
X if (! HASBUFFER(fp)) {
X if (_allocbuf(fp) < 0)
X return EOF;
X! SETCLEANUP();
X }
X
X /* Signal character valid if fully buffered output */
X
X--- 73,79 -----
X if (! HASBUFFER(fp)) {
X if (_allocbuf(fp) < 0)
X return EOF;
X! SETIOFLUSH();
X }
X
X /* Signal character valid if fully buffered output */
END_OF_FILE
if test 2653 -ne `wc -c <'_flsbuf.c.cdif'`; then
echo shar: \"'_flsbuf.c.cdif'\" unpacked with wrong size!
fi
# end of '_flsbuf.c.cdif'
fi
if test -f '_fopen.c.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'_fopen.c.cdif'\"
else
echo shar: Extracting \"'_fopen.c.cdif'\" \(876 characters\)
sed "s/^X//" >'_fopen.c.cdif' <<'END_OF_FILE'
X*** Old/_fopen.c Sun Sep 3 13:55:18 1989
X--- New/_fopen.c Mon Sep 4 23:15:44 1989
X***************
X*** 10,16
X * -1, the channel will be allocated, otherwise the specified channel
X * will be used.
X *
X! * Patchlevel 1.0
X *
X * Edit History:
X */
X
X--- 10,16 -----
X * -1, the channel will be allocated, otherwise the specified channel
X * will be used.
X *
X! * Patchlevel 1.1
X *
X * Edit History:
X * 05-Sep-1989 Change SETCLEANUP to SETIOFLUSH.
X***************
X*** 13,18
X * Patchlevel 1.0
X *
X * Edit History:
X */
X
X
X
X--- 13,19 -----
X * Patchlevel 1.1
X *
X * Edit History:
X+ * 05-Sep-1989 Change SETCLEANUP to SETIOFLUSH.
X */
X
X
X***************
X*** 17,23
X
X
X #include <fcntl.h>
X- #include <errno.h>
X #include "stdiolib.h"
X
X /*LINTLIBRARY*/
X
X--- 18,23 -----
X
X
X #include <fcntl.h>
X #include "stdiolib.h"
X
X /*LINTLIBRARY*/
END_OF_FILE
if test 876 -ne `wc -c <'_fopen.c.cdif'`; then
echo shar: \"'_fopen.c.cdif'\" unpacked with wrong size!
fi
# end of '_fopen.c.cdif'
fi
if test -f 'atexit.c.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'atexit.c.cdif'\"
else
echo shar: Extracting \"'atexit.c.cdif'\" \(744 characters\)
sed "s/^X//" >'atexit.c.cdif' <<'END_OF_FILE'
X*** /dev/null Tue Sep 5 16:22:51 1989
X--- New/atexit.c Tue Sep 5 13:56:49 1989
X***************
X*** 0
X
X--- 1,25 -----
X+ /* a t e x i t
X+ *
X+ * Lodge an exit handler. The handler is lodged within a list of exit
X+ * handlers to be called by exit prior to calling _exit. The list
X+ * is of finite length. exit will call the exits handlers in fifo
X+ * order. The routine returns zero on failure (list overflow) and
X+ * non-zero on success.
X+ *
X+ * Patchlevel 1.0
X+ *
X+ * Edit History:
X+ * 05-Sep-1989 Created.
X+ */
X+
X+ #include "stdiolib.h"
X+
X+ extern void (**_exit_hp)(); /* exit handler pointer */
X+
X+ int atexit(fp)
X+
X+ void (*fp)(); /* exit handler */
X+
X+ {
X+ return (*_exit_hp != 0) ? 0 : (*_exit_hp-- = fp, 1);
X+ }
END_OF_FILE
if test 744 -ne `wc -c <'atexit.c.cdif'`; then
echo shar: \"'atexit.c.cdif'\" unpacked with wrong size!
fi
# end of 'atexit.c.cdif'
fi
if test -f 'bitset.h.cdif' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bitset.h.cdif'\"
else
echo shar: Extracting \"'bitset.h.cdif'\" \(2585 characters\)
sed "s/^X//" >'bitset.h.cdif' <<'END_OF_FILE'
X*** Old/bitset.h Sun Sep 3 13:59:18 1989
X--- New/bitset.h Tue Sep 5 16:40:25 1989
X***************
X*** 1,5
X! /*
X! * Bitset Macros
X *
X * This implements a set of operators to manipulate bitsets
X * is a machine independent way. It may be necessary for other
X
X--- 1,4 -----
X! /* b i t s e t
X *
X * (C) Copyright C E Chew
X *
X***************
X*** 1,6
X /*
X * Bitset Macros
X *
X * This implements a set of operators to manipulate bitsets
X * is a machine independent way. It may be necessary for other
X * machines to set up the constants at the front (such as the
X
X--- 1,12 -----
X /* b i t s e t
X *
X+ * (C) Copyright C E Chew
X+ *
X+ * Feel free to copy, use and distribute this software provided:
X+ *
X+ * 1. you do not pretend that you wrote it
X+ * 2. you leave this copyright notice intact.
X+ *
X * This implements a set of operators to manipulate bitsets
X * is a machine independent way. It may be necessary for other
X * machines to set up the constants at the front (such as the
X***************
X*** 12,17
X * 1. the bitset is int []
X * 2. the first int will be used as scratch int [0]
X * 3. all the following elements will be used for the bitset proper
X */
X
X #if defined(BSD)
X
X--- 18,28 -----
X * 1. the bitset is int []
X * 2. the first int will be used as scratch int [0]
X * 3. all the following elements will be used for the bitset proper
X+ *
X+ * Patchlevel 1.1
X+ *
X+ * Edit History:
X+ * 05-Sep-1989 Change so that MINIX is not required to be defined.
X */
X
X #if defined(BSD)
X***************
X*** 17,23
X #if defined(BSD)
X # include <values.h>
X # define CHAR_BIT (BITSPERBYTE)
X! extern void bzero Prototype((char *, int));
X # define _BITEMPTY(a,n) (bzero((a), (n)))
X # define _BITFILL(a,n) {char *p=(a); int c=(n); for ( ; c--; *p++ = ~0) ; }
X #endif
X
X--- 28,34 -----
X #if defined(BSD)
X # include <values.h>
X # define CHAR_BIT (BITSPERBYTE)
X! extern void bzero P((char *, int));
X # define _BITEMPTY(a,n) (bzero((a), (n)))
X # define _BITFILL(a,n) {char *p=(a); int c=(n); for ( ; c--; *p++ = ~0) ; }
X #endif
X***************
X*** 22,28
X # define _BITFILL(a,n) {char *p=(a); int c=(n); for ( ; c--; *p++ = ~0) ; }
X #endif
X
X! #if defined(MINIX) || defined(__MSDOS__) || defined(MSDOS)
X # include <limits.h>
X # include <memory.h>
X # define _BITEMPTY(a,n) (memset((a), 0, (n)))
X
X--- 33,39 -----
X # define _BITFILL(a,n) {char *p=(a); int c=(n); for ( ; c--; *p++ = ~0) ; }
X #endif
X
X! #if !defined(CHAR_BIT)
X # include <limits.h>
X # include <memory.h>
X # define _BITEMPTY(a,n) (memset((a), 0, (n)))
END_OF_FILE
if test 2585 -ne `wc -c <'bitset.h.cdif'`; then
echo shar: \"'bitset.h.cdif'\" unpacked with wrong size!
fi
# end of 'bitset.h.cdif'
fi
echo shar: End of archive 1 \(of 5\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 5 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0