			EStdio Installation For Minix
			============================

This package provides a complete replacement for Minix stdio. It implements all
the functions required for ANSI and POSIX 1003.1-1988 compatibility. The
resulting code is slightly larger but considerably faster. The following are
run times for the test programs found in the TEST subdirectory. Each program
writes about 256k of output to /dev/null. The programs were compiled using
Bruce Evans' bcc in 16-bit mode on a 20MHz 386.

		EStdio				Minix Stdio
ten	real 4.0 user 3.7 sys 0.1	real 11.0 user 7.2 sys 3.3
putc	real 1.0 user 0.8 sys 0.2	real 5.0 user 4.6 sys 0.2
fputs	real 2.0 user 0.9 sys 0.1	real 5.0 user 4.9 sys 0.2
nfputs	real 13.0 user 1.5 sys 11.1	real 3:18.0 user 18.5 sys 2:58.9
fwrite	real 0.0 user 0.0 sys 0.0	real 6.0 user 5.9 sys 0.1
sprintf	real 4.0 user 3.8 sys 0.0	real 11.0 user 10.7 sys 0.0
printf	real 4.0 user 3.9 sys 0.1	real 14.0 user 10.8 sys 2.9
nprintf	real 48.0 user 12.6 sys 35.1	real 3:23.0 user 21.1 sys 3:01.7
printfs	real 1.0 user 1.2 sys 0.1	real 18.0 user 9.6 sys 8.5
putchar	real 2.0 user 0.8 sys 0.1	real 5.0 user 4.4 sys 0.2

Site Description
----------------

A site description is required for stdio to compile properly. There are two
methods for generating this. Both methods will require you to run the
installation script yinstall.sh. 

The installation script is run from the INSTALL directory:

	cd INSTALL			# must be in INSTALL subdirectory
	sh yinstall.sh

If your site is a standard Minix site, a preconfigured description will be
available. Respond `y' to the question regarding the use of a preconfigured
site description and select the ack configuration.

If your site is not a standard Minix site, or the preconfigured site
description is broken, you will have to  run the installation script and answer
`n' to the question about the preconfigured site description. The script will
then attempt to determine all the parameters required to describe your site in
order to compile stdio.

Prerecorded answer files are also available in files with a .ans suffix. These
files are generated by running the installation script interactively using tee:

	cd INSTALL
	tee machine.ans | sh yinstall.sh

Remember to terminate the session with a ^D after all the questions have been
answered. The site file can be regenerated directly from the answer file by
feeding it directly into the installation script:

	cd INSTALL
	sh yinstall.sh < machine.ans

Making the Library
------------------

If you have floating point support installed (Peter Housel's floating point
library in /usr/lib/fplib.a), then you will have to make the floating point
linkages:

	make stdiofp

This will create a series of stubs and floating point support code with the
names *.f for the *scan* and *print* functions. The main stdio code modules
are kept in libc.a. This makes the libraries easier to maintain.

Now you can proceed to make the library proper:

	make stdio

To begin with, I suggest that you build the stdio exercise program first. This
is done as follows:

	make test

After xercise has been constructed, it can be run by typing:

	TEST/exercise

Verify that all the exercises complete successfully.

Installation with BCC
---------------------

If you have Bruce Evans 386 kit and are working with bcc, the easiest way to
install the library is to move the entire directory tree to
/usr/src/lib/estdio. The makelib script should be in the directory
/usr/src/lib/bcc.

You will have to edit the makelib script to activate usage of estdio.
Furthermore I prefer to use perror() included in estdio. The following patches
indicate the changes required to makelib:

-------------------------------------------------------------------------------
*** makelib.orig	Sat Jul 28 11:12:48 1990
--- makelib	Sat Jul 28 11:13:34 1990
***************
*** 17,19 ****
  # Nonstandard library directories to be built. Comment out the lines not used.
! # earlstdiodir=../e20		# Earl Chew's stdio
  # localdir=../local
--- 17,19 ----
  # Nonstandard library directories to be built. Comment out the lines not used.
! earlstdiodir=../estdio		# Earl Chew's stdio
  # localdir=../local
***************
*** 162,163 ****
--- 162,164 ----
  	s/^gets.c$//
+ 	s/^perror.c$//
  	s/^printf.c$//
***************
*** 211,213 ****
  			ar r $tmplibdir/libc.a \
! 				`cat Liborder | sed -e 's/perror.o//'` ;;
  		*)	make $option ;;
--- 212,214 ----
  			ar r $tmplibdir/libc.a \
! 				`cat Liborder` ;;
  		*)	make $option ;;
-------------------------------------------------------------------------------

You should ensure that the new stdio.h has been installed in /usr/include:

	mv /usr/include/stdio.h /usr/include/stdio.h.orig
	mv ../estdio/stdio.h /usr/include
	chown bin /usr/include/stdio.h
	chgrp bin /usr/include/stdio.h
	chmod 644 /usr/include/stdio.h

The easiest and safest way to proceed from here is to clean out the entire
library with:

	sh makelib [86|386] clean

Now you can rebuild the library to suit whichever flavour system you are
running:

	sh makelib [86|386]

Installation with ACK
---------------------

If you are using the standard Minix distribution system, the easiest way to
obtain a library is to type:

	cd INSTALL			# must be in INSTALL subdirectory
	sh yminix.sh

The script will use libc.a and libfp.a (if available) to generate properly
ordered libraries. The script will ask before it touches and remakes those
modules in the existing system library which refer to stdio.

The generated libraries will be left in the subdirectory INSTALL/libc. If your
site does not match the assumptions made by this script you will either have to
edit the script or make the library by hand.

It is probably wise to keep the old stdio.h so that you'll have something
to fall back on when ast posts upgrades:

	mv /usr/include/stdio.h /usr/include/stdio.h.orig

It is also wise to keep the old libraries:

	mv /usr/lib/libc.a /usr/lib/libc.a.orig
	mv /usr/lib/fplib.a /usr/lib/fplib.a.orig

Now you can install the new stdio.h:

	chown bin stdio.h
	chgrp bin stdio.h
	chmod 644 stdio.h
	mv stdio.h /usr/include

Finally, the libraries can be copied across:

	chown bin libc/*.a
	chgrp bin libc/*.a
	chmod 644 libc/*.a
	mv libc/*.a /usr/lib

Manual Library Installation
---------------------------

This section provides some information for those who cannot install stdio
using the yminix.sh script.

Before stdio can be installed in the library, it is necessary to re-compile
some of the library modules that make use of stdio. These are:

	ansi/assert.c
	ansi/system.c
	other/curses.c
	other/getopt.c
	other/getpass.c
	other/lock.c
	other/nlist.c
	other/popen.c
	other/regexp.c
	other/regsub.c
	other/termcap.c
	posix/getlogin.c

The modules provided by stdio will supercede the following files in the
Minix library:

	ansi/exit.s
	ansi/fclose.s
	ansi/fflush.s
	ansi/fgetc.s
	ansi/fgets.s
	ansi/fopen.s
	ansi/fprintf.s
	ansi/fputc.s
	ansi/fputs.s
	ansi/fread.s
	ansi/freopen.s
	ansi/fseek.s
	ansi/ftell.s
	ansi/fwrite.s
	ansi/gets.s
	ansi/perror.s
	ansi/puts.s
	ansi/scanf.s
	ansi/setbuf.s
	ansi/sprintf.s
	ansi/tmpnam.s
	ansi/ungetc.s
	ansi/vsprintf.s
	other/cleanup.s
	other/doprintf.s
	other/printdat.s
	posix/ctermid.s
	posix/cuserid.s
	posix/fdopen.s

The following files supersede those in the floating point library:
	fprintf.s
	printf.s
	sprintf.s
	vfprintf.s
	vprintf.s
	vsprintf.s

The shell script yminix.sh will generate a library from all the components. It
assumes that the library modules are in:

	/usr/src/lib/ansi
	/usr/src/lib/other
	/usr/src/lib/posix
	/usr/src/lib/ibm
	/usr/lib/libc.a
	/usr/lib/fplib.a

				--ooOoo--
