Index: trunk/minix/commands/cawf/Makefile
===================================================================
--- trunk/minix/commands/cawf/Makefile	(revision 9)
+++ 	(revision )
@@ -1,107 +1,0 @@
-# 	Makefile for cawf
-
-#	Define UNIX for vanilla Unix systems -- e.g., older DYNIX.
-#
-#	Define UNIX and USG for System V, BSD 4.3 and for SunOS.
-#
-#	USG may also be needed if the required string function prototypes --
-#	e.g., for strrchr() -- are in <string.h> rather than <strings.h>.
-#
-#DEFS = -DUNIX -DUSG
-#
-#	Define STDLIB for systems that have <stdlib.h> -- e.g., AIX and
-#	SunOS.
-#
-#	Redefine CAWFLIB by adding -DCAWFLIB=\"...\" to DEFS.
-#
-#DEFS = -DUNIX -DUSG -DCAWFLIB=\"/usr/local/lib/cawf\"
-#
-#	Customize the install rule.
-#
-#	-ansi and -pedantic are ANSI compliance options for the gcc compiler.
-#	Remove them if your compiler objects.
-#
-#	If you're using xlc 2.1 on AIX 3.2 for the RISC/SYSTEM 6000, you
-#	must delete the definition of __STR__ (two leading and two trailing
-#	underscore characters), because the xlc 2.1 compiler incorrectly
-#	inlines string functions when compiling pass3.c.
-#
-#DEFS = -DUNIX -DSTDLIB -U__STR__
-#
-#	Unix systems that have a <malloc.h> need MALLOCH defined, unless
-#	they also have a <stdlib.h> that provides a function prototype for
-#	malloc() and its relatives (most do).
-#
-#DEFS = -DUNIX -DMALLOCH
-
-CC = exec cc
-
-DEFS = -DUNIX -DUSG -DSTDLIB
-
-CFLAGS = -i -f -wo -O ${DEFS}
-
-HDR = ansi.h cawf.h cawflib.h proto.h regexp.h regmagic.h
-
-SRC = cawf.c device.c error.c expand.c expr.c getopt.c macsup.c nreq.c \
-      output.c pass2.c pass3.c  regerror.c regexp.c store.c string.c
-
-OBJ = cawf.o device.o error.o expand.o expr.o getopt.o macsup.o nreq.o \
-      output.o pass2.o pass3.o  regerror.o regexp.o store.o string.o
-
-all:	bsfilt cawf
-
-bsfilt: bsfilt.c
-	${CC} ${CFLAGS} bsfilt.c -o $@
-	install -S 4kw $@
-
-cawf:	${OBJ}
-	${CC} ${CFLAGS} ${OBJ} -o $@
-	install -S 56k $@
-
-clean:
-	rm -f *.o a.out core *errs bsfilt cawf
-
-${OBJ}:	${HDR}
-
-install:	\
-	/usr/bin/bsfilt /usr/bin/colcrt /usr/bin/cawf \
-	/usr/bin/nroff /usr/lib/cawf /usr/lib/cawf/common \
-	/usr/lib/cawf/device.cf /usr/lib/cawf/dumb.dev \
-	/usr/lib/cawf/man.mac /usr/lib/cawf/me.mac \
-	/usr/lib/cawf/ms.mac /usr/lib/cawf/mnx.mac
-
-/usr/bin/bsfilt:	bsfilt
-	install -cs -o bin bsfilt $@
-
-/usr/bin/colcrt:	/usr/bin/bsfilt
-	install -l /usr/bin/bsfilt $@
-
-/usr/bin/cawf:	cawf
-	install -cs -o bin cawf $@
-
-/usr/bin/nroff:	/usr/bin/cawf
-	install -l /usr/bin/cawf $@
-
-/usr/lib/cawf:	
-	install -d -o bin /usr/lib/cawf
-
-/usr/lib/cawf/common:	common
-	install -c -o bin common $@
-
-/usr/lib/cawf/device.cf:	device.cf
-	install -c -o bin device.cf $@
-
-/usr/lib/cawf/dumb.dev:	dumb.dev
-	install -c -o bin dumb.dev $@
-
-/usr/lib/cawf/man.mac:	man.mac
-	install -c -o bin man.mac $@
-
-/usr/lib/cawf/me.mac:	me.mac
-	install -c -o bin me.mac $@
-
-/usr/lib/cawf/ms.mac:	ms.mac
-	install -c -o bin ms.mac $@
-
-/usr/lib/cawf/mnx.mac:	mnx.mac
-	install -c -o bin mnx.mac $@
Index: trunk/minix/commands/cawf/README
===================================================================
--- trunk/minix/commands/cawf/README	(revision 9)
+++ 	(revision )
@@ -1,264 +1,0 @@
-Cawf - nroff-like text formatter
-
-Cawf is a C version of awf, Henry Spencer's Amazingly Workable (text)
-Formatter.  (Awf is written in awk and appears in comp.sources.unix,
-Volume 23, Issue 27.)  Cawf and awf provide a usable subset of raw nroff
-capabilities and the styles of the man(7), me(7) and ms(7) macro sets.
-One of cawf's virtues is that it will run on PC clones under MS-DOS.  It
-is also, like awf, totally independent of any licensed Unix source code.
-
-This distribution contains complete source, make files for Unix and
-MS-DOS, documentation (raw and formatted) and MS-DOS executables for cawf
-and a companion output filters, bsfilt.
-
-This is the fourth distribution of cawf.  Changes include:
-
-	*  Some rudimentary output device support has been added, via a device
-	   configuration file.
-
-	*  The code has been converted to use unsigned characters.
-
-	*  An attempt has been made to make the code ANSI C compliant.
-
-	*  The following bugs have been fixed:
-
-		A bug in the locating of the device file has been corrected,
-		so that the code performs as documented.
-
-		Null macro arguments are ignored.
-
-		Some unused arguments to local functions have been more
-		carefully type cast to avoid portability problems.
-
-	*  The .fl and .rn requests are now supported.
-
-	*  Limited support has been added for the non-break request control
-	   character, the acute accent (').
-
-	*  Argument count conditionals -- operating on \n(.$ -- may now use
-	   the >= and <= operators in addition to [<=>].
-
-	*  Macros may be terminated with "..", ".", "''" or "'".
-
-	*  String interpolation is performed if it is specified at the start
-	   of the .ds request argument.
-
-	*  The .tr request has been enhanced to handle named characters and
-	   string interpolation.
-
-	*  The SS macro is now included in man.mac.
-
-	*  The cawf version number is now displayed in the help output.
-
-	*  A limited -me macro set is included in me.mac.
-
-Changes to cawf to run under Minix:
-
-	*  The DOS binaries and make files have been removed.
- 
-	*  Tabs stops changed from per 5 to per 8.
-
-	*  Bold and underline as it should be in device.cf.
-
-	*  Added .SB and .TA to man.mac.
-
-	*  Numerous prototypes added.
-
-
-CONTENTS
---------
-
-This Minix distribution of cawf includes:
-
-	README		    this file
-	*.c and *.h	    source files to build cawf and bsfilt (bsfilt
-			    removes Backspaces from cawf output)
-	bsfilt.1	    nroff source for the bsfilt manual page
-	cawf.1		    nroff source for the cawf manual page
-	common		    initialization file for CAWFLIB library
-	device.cf	    output device configuration file for CAWFLIB
-			    library
-	dumb.dev	    device description file for CAWFLIB library
-	Makefile	    Unix-style make file
-	man.mac		    man(7) macros for CAWFLIB library
-	me.mac		    me(7) macros for CAWFLIB library
-	ms.mac		    ms(7) macros for CAWFLIB library
-	diffs		    Minix patches
-#ifdef PUTTING_IT_ON_THE_NET
-	cawf
-	bsfilt		    binaries compiled under Minix-PC 1.5 using the ACK
-			    ANSI C compiler using software floating point
-#endif
-
-
-LIBRARY
--------
-
-To use cawf, you must select a location for the CAWFLIB library files.  The
-distributed cawf binary expects to find them in /usr/local/lib/cawf but you
-can alter that with the CAWFLIB environment variable, or you can change the
-CAWFLIB #define in cawf.h and rebuild cawf from the sources.
-
-CAWFLIB contains a minimum of six files:
-
-	common		common raw nroff commands to get cawf started
-	dumb.dev	a set of character definitions for a plain, "dumb"
-			ASCII device - e. g., the console display, a CRT or
-			a basic line printer
-	device.cf	the output device configuration file
-	man.mac		the man(7) macros
-	me.mac		the me(7) macros
-	ms.mac		the ms(7) macros
-
-You may want to add your own macro files to the library.  Just name them
-"m[your-name].mac", following the usual nroff naming convention for macro
-files.
-
-If you have fancy output devices with special character specifications, you
-may want to generate new *.dev files for them.  Follow the format of dumb.dev
-in making new character specifications.  To define characters for a new
-device, select a name prefix for it and create a file in CAWFLIB with the
-name "<prefix>.dev".  To use the new file, set the TERM environment variable
-to <prefix> - e. g., when I test cawf on Unix, I need a vt100.dev, because
-my TERM environment variable value is usually vt100.  All I do is make
-vt100.dev a symbolic link to dumb.dev.  Even that isn't even necessary,
-because cawf will use dumb.dev if it can't find TERM.dev.
-
-In addition to the character specifications possible through the *.dev files,
-cawf provides one-time font selection and bold or italic face support for
-output devices via its -d and -f options.  Cawf can be directed to issue
-specific device codes for bold and italic characters, and one font can be
-specified for the entire document.  Cawf has some built-in output device
-support, and addition support is contained in the device configuration file,
-device.cf.  Additional devices may be defined in device.cf.
-
-It is not necessary to generate a new *.dev file for each output device
-definition.  Only when you need special character definitions do you need to
-create a *.dev file.  The dumb.dev file is adequate for most devices you 
-define in device.cf.
-
-
-SOURCES
--------
-
-The Unix make file has some definitions that help tune it to the local
-Unix environment:
-
-	CAWFLIB		is a string that can be used in lieu of changes
-			to cawf.h's CWFLIB #define.
-
-	MALLOCH		is a string that should be defined when a UNIX
-			environment has a <malloc.h>, unless it also has a
-			<stdlib.h> with protoypes for malloc() and its
-			relatives.  In the latter case, you should define
-			STDLIB, but you don't need to define MALLOCH.
-
-	STDLIB		indicates that standard library function prototype
-			definitions may be found in <stdlib.h>.
-
-			STDLIB must be defined for MS-DOS Quick C.
-
-			If STDLIB is not defined, the cawf sources try to
-			define their own library function return values.
-
-	__STR__		The definition of this string must be deleted when
-			using the xlc 1.2 compiler on the RISC/System 6000
-			under AIX 3.2.  Put
-
-				-U__STR__
-
-			in the Makefile DEFS string.  This must be done
-			because the xlc 1.2 compiler does not correctly inline
-			string functions when compiling pass3.c.
-
-	UNIX		switches the build environment to Unix.  You may also
-			have to decide about MALLOCH, STDLIB, __STR__ and USG
-			when you define UNIX.
-
-			Do not define UNIX for MS-DOS Quick-C; do define
-			STDLIB.
-
-	USG		adjusts for System V.  (UNIX must also be defined.)
-
-			You may also need to define USG to select the proper
-			header file for string function prototypes.  If UNIX
-			and USG are defined, "proto.h" selects <string.h>;
-			if only UNIX, <strings.h>.  Cawf needs the more
-			complete set of definitions, including strchr() and
-			strrchr().  If <string.h> #includes <strings.h>, as
-			is sometimes the case, define only UNIX.
-
-I have built and tested cawf in the UNIX context under AIX 3.2 (see the
-note above on __STR__), BSD4.3-Tahoe, Sequent DYNIX, ETAV (SYSV 3.0),
-NeXTStep 3.0, SunOS 4.1.1 and Ultrix 2.2.  If you build under another Unix
-variant, you may have to adjust the source code, header files and Makefile
-to fit.  Check the Makefile first for hints.
-
-
-ANSI C COMPLIANCE
------------------
-
-Some effort has been devoted to making the cawf sources ANSI C compliant.
-The header file proto.h contains function prototypes that enable ANSI C
-argument checking.  The state of definition of the __STDC__ symbol is used
-to select options that depend on strict adherence to the ANSI C standard --
-e.g., the need for the isascii() test before islower() or isupper().  If
-your ANSI compiler doesn't define this variable when it's acting in strict
-ANSI C mode, you may have to define it in the Makefile.
-
-
-MS-DOS CONSIDERATIONS
----------------------
-
-The MS-DOS version of cawf was created to run under the KornShell of the
-Mortis Kern Systems Toolkit.  One ramification of using MKS' ksh is that it
-supports the separate standard error and standard output streams.  Hence,
-cawf blithely distributes its error messages to the standard error file, and
-assumes the user's shell is capable of separating them from standard output.
-
-If you don't use the MKS KornShell, but do want to separate the output
-streams, you'll have to modify the cawf source code.  As a rudimentary aid,
-cawf uses a separate stream pointer, Efs, for writing error output, but sets
-it to stderr.  You can change that process to open a separate error file and
-set Efs to point to it.
-
-
-COPYRIGHTS AND CREDITS
-----------------------
-
-The sources are copyrighted, but freely distributable under usual terms -
-retention of credit, etc.
-
-Please acknowledge:
-
-	AT&T for their public-domain release of getopt(3) at the 1985
-	UNIFORUM conference;
-
-	Chet Creider, Bob Hardy and Ted Campbell for their contributions
-	to font filtering;
-
-	Henry Spencer for awf and his regular expression package;
-
-	Andy Tanenbaum for his help in ANSI C compliance, including his
-	ansi.h header file from Minix.
-
-Henry says about awf, "I can't believe I really wrote this."  Those are
-my sentiments exactly about cawf, but I also understand that necessity
-sometimes forces us to do what we would prefer to avoid.
-
-
-BUGS AND ENHANCEMENTS
----------------------
-
-I'll be glad to hear about bugs and needs for enhancements, but make no
-promises about delivering fixes or upgrades in response.
-
-Vic Abell <abe@cc.purdue.edu>
-24 November 1992
-
-
-MINIX SPECIFIC TINKERING
-------------------------
-
-Kees J. Bot <kjb@cs.vu.nl>
-26 November 1992
Index: trunk/minix/commands/cawf/ansi.h
===================================================================
--- trunk/minix/commands/cawf/ansi.h	(revision 9)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/* The <ansi.h> header attempts to decide whether the compiler has enough
- * conformance to Standard C for Minix to take advantage of.  If so, the
- * symbol _ANSI is defined (as 31415).  Otherwise _ANSI is not defined
- * here, but it may be defined by applications that want to bend the rules.
- * The magic number in the definition is to inhibit unnecessary bending
- * of the rules.  (For consistency with the new '#ifdef _ANSI" tests in
- * the headers, _ANSI should really be defined as nothing, but that would
- * break many library routines that use "#if _ANSI".)
-
- * If _ANSI ends up being defined, a macro
- *
- *	_PROTOTYPE(function, params)
- *
- * is defined.  This macro expands in different ways, generating either
- * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)
- * prototypes, as needed.  Finally, some programs use _CONST, _VOIDSTAR etc
- * in such a way that they are portable over both ANSI and K&R compilers.
- * The appropriate macros are defined here.
- */
-
-#ifndef _ANSI_H
-#define _ANSI_H
-
-#if __STDC__ == 1
-#define _ANSI		31459	/* compiler claims full ANSI conformance */
-#endif
-
-#ifdef __GNUC__
-#define _ANSI		31459	/* gcc conforms enough even in non-ANSI mode */
-#endif
-
-#ifdef _ANSI
-
-/* Keep everything for ANSI prototypes. */
-#define	_PROTOTYPE(function, params)	function params
-
-#define	_VOIDSTAR	void *
-#define	_VOID		void
-#define	_CONST		const
-#define	_VOLATILE	volatile
-#define _SIZET		size_t
-
-#else
-
-/* Throw away the parameters for K&R prototypes. */
-#define	_PROTOTYPE(function, params)	function()
-
-#define	_VOIDSTAR	void *
-#define	_VOID		void
-#define	_CONST
-#define	_VOLATILE
-#define _SIZET		int
-
-#endif /* _ANSI */
-
-#endif /* ANSI_H */
Index: trunk/minix/commands/cawf/bsfilt.c
===================================================================
--- trunk/minix/commands/cawf/bsfilt.c	(revision 9)
+++ 	(revision )
@@ -1,211 +1,0 @@
-/*
- *	bsfilt.c - a colcrt-like processor for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include <stdio.h>
-
-#ifdef UNIX
-# ifdef USG
-#include <string.h>
-# else	/* not USG */
-#include <strings.h>
-# endif	/* USG */
-#else	/* not UNIX */
-#include <string.h>
-#endif	/* UNIX */
-
-#include <sys/types.h>
-
-#include "ansi.h"
-
-#define MAXLL	2048			/* ridiculous maximum line length */
-
-int Dash = 1;				/* underline with dashes */
-int Dp = 0;				/* dash pending */
-int Lc = 0;				/* line count */
-char *Pname;				/* program name */
-unsigned char Ulb[MAXLL];		/* underline buffer */
-int Ulx = 0;				/* underline buffer index */
-
-_PROTOTYPE(void Putchar,(int ch));
-
-main(argc, argv)
-	int argc;
-	char *argv[];
-{
-	int ax = 1;			/* argument index */
-	unsigned char c;		/* character buffer */
-	FILE *fs;			/* file stream */
-	int nf = 0;			/* number of files processed */
-	unsigned char pc;		/* previous character */
-	int under = 0;                  /* underline */
-/*
- * Save program name.
- */
-	if ((Pname = strrchr(argv[0], '/')) != NULL)
-		Pname++;
-	else if ((Pname = strrchr(argv[0], '\\')) != NULL)
-		Pname++;
-	else
-		Pname = argv[0];
-/*
- * Process options.
- */
-	if (argc > 1 && argv[1][0] == '-') {
-		switch (argv[1][1]) {
-	/*
-	 * "-U" - underline with dashes.
-	 */
-		case 'U':
-			Dash = 0;
-			under = 1;
-			break;
-	/*
-	 * "-" - do no  underlining at all.
-	 */
-		case '\0':
-			Dash = under = 0;
-			break;
-		default:
-			(void) fprintf(stderr,
-				"%s usage: [-] [-U] [file]\n", Pname);
-			exit(1);
-		}
-		ax++;
-	}
-/*
- * Process files.  Read standard input if no files names.
- */
-
-	while (ax < argc || nf == 0) {
-		if (ax >= argc)
-			fs = stdin;
-		else {
-#ifdef	UNIX
-			if ((fs = fopen(argv[ax], "r")) == NULL)
-#else
-			if ((fs = fopen(argv[ax], "rt")) == NULL)
-#endif
-			{
-				(void) fprintf(stderr, "%s: can't open %s\n",
-					Pname, argv[ax]);
-				exit(1);
-			}
-			ax++;
-		}
-		nf++;
-	/*
-	 * Read input a character at a time.
-	 */
-		for (pc = '\0';;) {
-			c = (unsigned char)fgetc(fs);
-			if (feof(fs))
-				break;
-			switch(c) {
-
-			case '\n':
-				if (pc)
-					Putchar((int)pc);
-				Putchar('\n');
-				pc = '\0';
-				break;
-
-			case '\b':
-				if (pc == '_') {
-					if (under) {
-						putchar(pc);
-						putchar('\b');
-					} else if (Dash)
-						Dp = 1;
-				}
-				pc = '\0';
-				break;
-
-			default:
-				if (pc)
-					Putchar((int)pc);
-				pc = c;
-			}
-		}
-		if (pc) {
-			Putchar((int)pc);
-			Putchar((int)'\n');
-		}
-	}
-	exit(0);
-}
-
-
-/*
- * Putchar(ch) - put a character with possible underlining
- */
-
-void
-Putchar(ch)
-	int ch;
-{
-	int i;					/* temporary index */
-
-	if ((unsigned char)ch == '\n') {
-/*
- * Handle end of line.
- */
-		putchar('\n');
-		if (Ulx) {
-			while (Ulx && Ulb[Ulx-1] == ' ')
-				Ulx--;
-			if (Ulx) {
-				for (i = 0; i < Ulx; i++)
-					putchar(Ulb[i]);
-				putchar('\n');
-			}
-		}
-		Dp = Ulx = 0;
-		Lc++;
-		return;
-	}
-/*
- * Put "normal" character.
- */
-	putchar((unsigned char)ch);
-	if (Dash) {
-
-	/*
-	 * Handle dash-type underlining.
-	 */
-		if (Ulx >= MAXLL) {
-			(void) fprintf(stderr,
-				"%s: underline for line %d > %d characters\n",
-				Pname, Lc, MAXLL);
-			exit(1);
-		}
-		Ulb[Ulx++] = Dp ? '-' : ' ';
-		Dp = 0;
-	}
-}
Index: trunk/minix/commands/cawf/build
===================================================================
--- trunk/minix/commands/cawf/build	(revision 9)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-make clean
-make && make install
Index: trunk/minix/commands/cawf/cawf.c
===================================================================
--- trunk/minix/commands/cawf/cawf.c	(revision 9)
+++ 	(revision )
@@ -1,488 +1,0 @@
-/*
- *	cawf - a C version of Henry Spencer's awf(1), the Amazingly
- *	       Workable (text) Formatter
- *
- *	V. Abell, Purdue University Computing Center
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-static char Version[] = "4.0";
-
-#include "cawf.h"
-
-#include <sys/stat.h>
-#ifndef	UNIX
-#include <io.h>
-#include <process.h>
-#include <string.h>
-#include <sys\types.h>
-#include <sys\stat.h>
-#endif
-
-
-main(argc, argv)
-	int     argc;
-	char    *argv[];
-{
-	char *ep;               	/* environment pointer */
-	int fff = 0;			/* final form feed status */
-	char **files;			/* file names */
-	int help = 0;			/* help status */
-	int i;	               		/* temporary index */
-	size_t l;                       /* length */
-	char *lib = CAWFLIB;		/* library path */
-	int libl;			/* library path length */
-	int mac = 0;			/* macro specification status */
-	int nf = 0;             	/* number of files */
-	char *np;               	/* name pointer */
-	int pc;                 	/* prolog count */
-	struct stat sbuf;               /* stat buffer */
-/*
- * Save program name.
- */
-	if ((Pname = strrchr(argv[0], '\\')) != NULL)
-		Pname++;
-	else if ((Pname = strrchr(argv[0], '/')) != NULL)
-		Pname++;
-	else
-		Pname = argv[0];
-/*
- * Set error file stream pointer.
- */
-	Efs = stderr;
-/*
- * Get library name.
- */
-	if ((np = getenv("CAWFLIB")) != NULL)
-		lib = np;
-	libl = strlen(lib);
-/*
- * Get device file name.
- */
-	for (ep = getenv("TERM");; ep = NULL) {
-		if (ep == NULL || *ep == '\0')
-			ep = "dumb";
-		l = libl + 1 + strlen(ep) + strlen(".dev") + 1;
-		if ((np = malloc(l)) == NULL)
-			Error(FATAL, NOLINE,
-				" no string space for device file: ", ep);
-		(void) sprintf(np, "%s/%s.dev", lib, ep);
-		if (stat(np, &sbuf) == 0)
-			break;
-		if (strcmp(ep, "dumb") == 0)
-			Error(FATAL, NOLINE, " no dumb.dev file in ", lib);
-		(void) free(np);
-	}
-	if ((files = malloc((argc + 2) * sizeof(files[0]))) == NULL)
-		Error(FATAL, NOLINE, " no space for file list",
-			NULL);
-	files[nf++] = np;
-/*
- * Get common text file name.
- */
-	l = libl + 1 + strlen("common") + 1;
-	if ((np = malloc(l)) == NULL)
-		Error(FATAL, NOLINE, " no string space for common file name",
-			NULL);
-	(void) sprintf(np, "%s/common", lib);
-	files[nf++] = np;
-/*
- * Process options.
- */
-	while ((i = getopt(argc, argv, "c:d:ef:hm:")) != EOF) {
-		switch (i) {
-	/*
-	 * -c<device_configuration_file_path>>
-	 */
-		case 'c':
-			Devconf = optarg;
-			break;
-	/*
-	 * -d<output_device_name> -- define output device name
-	 *
-	 * The default output device name is NORMAL -- i.e., a device that
-	 * does bold face with backspace and overprinting and italic face with
-	 * underscore.  NORMAL is usually a terminal device.
-	 *
-	 * There is a built-in device, named ANSI, that does bold face with
-	 * the ANSI shadow mode and italic face with the ANSI underscore mode.
-	 * ANSI is normally a terminal device that supports the ANSI shadow
-	 * and underscore modes.
-	 *
-	 * There is a built-in output device, named NONE, that does nothing
-	 * at all for the bold or italic faces.  This is usually a terminal
-	 * device.
-	 *
-	 * All other device names must match a stanza in the device
-	 * configuration file.
-	 */
-		case 'd':
-			Device = optarg;
-			break;
-	/*
-	 * -e -- eject: issue final form feed
-	 */
-		case 'e':
-			fff = 1;
-			break;
-	/*
-	 * -f<output_device_font_name> -- define font name for the output
-	 *				  device (from device configuration
-	 *				  file)
-	 */
-		case 'f':
-			Devfont = optarg;
-			break;
-	/*
-	 * -h -- display help (usage)
-	 */
-		case 'h':
-			help = 1;
-			break;
-	/*
-	 * -m<macro_file_name>
-	 *
-	 *  Special support is provided for -man, -me and -ms.
-	 */
-		case 'm':
-			if (mac) {
-				Error(WARN, NOLINE,
-					"multiple macro file declaration",
-					NULL);
-				break;
-			}
-			l = libl + 2 + strlen(optarg) + strlen(".mac") + 1;
-			if ((np = malloc(l)) == NULL)
-				Error(FATAL, NOLINE, " no string space for ",
-					argv[1]);
-			(void) sprintf(np, "%s/m%s.mac", lib, optarg);
-			files[nf++] = np;
-			if (strcmp(optarg, "an") == 0)
-				Marg = MANMACROS;
-			else if (strcmp(optarg, "s") == 0
-			     ||  strcmp(optarg, "e") == 0)
-				Marg = MSMACROS;
-			mac++;
-			break;
-	/*
-	 * Option not recognized by getopt().
-	 */
-		case '?':
-			Err = 1;
-		}
-	}
-	if (Defdev())
-		Err++;
-	if (help || Err) {
-	  (void) fprintf(stderr,
-	    "%s %s usage: [-c<c>] [-d<d>] [-e] [-f<f>] [-h] [-m<m>] file...\n",
-		Pname, Version);
-	  (void) fprintf(stderr,
-	    "\t-c<c>     <c> is the device configuration file path\n");
-	  (void) fprintf(stderr,
-	    "\t-d<d>     <d> is the output device name\n");
-	  (void) fprintf(stderr,
-	    "\t          (default = NORMAL, using \\b for bold and italic)\n");
-	  (void) fprintf(stderr,
-	    "\t          (built-ins = ANSI, NONE and NORMAL)\n");
-	  (void) fprintf(stderr,
-	    "\t-e        issue eject after last page\n");
-	  (void) fprintf(stderr,
-	    "\t-f<f>     <f> is the output device font name\n");
-	  (void) fprintf(stderr,
-	    "\t-h        display help (this output)\n");
-	  (void) fprintf(stderr,
-	    "\t-m<m>     m<m> is the macro file name\n");
-	  (void) fprintf(stderr,
-	    "\tfile ...  source file names\n");
-	  exit(Err);
-	}
-	if (mac == 0) {
-
-	    /*
-	     * No macroes - enable Bold, Italic, Roman and Courier fonts.
-	     */
-		for (i = 0; Fcode[i].nm; i++) {
-			switch (Fcode[i].nm) {
-			case 'B':
-			case 'I':
-			case 'R':
-			case 'C':
-				Fcode[i].status = '1';
-			}
-		}
-	}
-/*
- * Add user-supplied file names.
- */
-	pc = nf;
-	if (optind >= argc) {
-		files[nf++] = NULL;       /* STDIN */
-	} else {
-		while (optind < argc)
-			files[nf++] = argv[optind++];
-	}
-/*
- * Make sure all input files are accessible.
- */
-	for (i = 0; i < nf; i++) {
-		if (files[i] != NULL) {
-			if (stat(files[i], &sbuf) != 0)
-				Error(WARN, NOLINE, " can't find ", files[i]);
-		}
-	}
-	if (Err)
-		exit(1);
-/*
- * Miscellaneous initialization.
- */
-
-	for (i = 0; ; i++) {
-		if (Pat[i].re == NULL)
-			break;
-		if ((Pat[i].pat = regcomp(Pat[i].re)) == NULL)
-			Error(WARN, NOLINE, Pat[i].re, " regcomp failure");
-	}
-	if ((i = Findscale((int)'n', 0.0, 0)) < 0)
-		Error(WARN, NOLINE, " can't find Scale['n']", NULL);
-	Scalen = Scale[i].val;
-	if ((i = Findscale((int)'u', 0.0, 0)) < 0)
-		Error(WARN, NOLINE, " can't find Scale['u']", NULL);
-	Scaleu = Scale[i].val;
-	if ((i = Findscale((int)'v', 0.0, 0)) < 0)
-		Error(WARN, NOLINE, " can't find Scale['v']", NULL);
-	Scalev = Scale[i].val;
-	(void) Findstr((unsigned char *)"CH", (unsigned char *)"= % -", 1);
-	Cont = Newstr((unsigned char *)" ");
-	Contlen = 1;
-	if ((Trtbl = (unsigned char *)malloc(256)) == NULL)
-		Error(WARN, NOLINE, " can't allocate translate table space",
-			NULL);
-	else {
-		*Trtbl = ' ';
-		for (i = 1; i < 256; i++)
-			Trtbl[i] = (unsigned char) i;
-	}
-	if (Err)
-		exit(1);
-/*
- * Here begins pass1 of awf - reading input lines and expanding macros.
- */
-
-/*
- * Output prolog.
- */
-	if (Fstr.i) {
-		for (i = 0; i < Fstr.il; i++) {
-			Charput((int)Fstr.i[i]);
-		}
-	}
-	Macro((unsigned char *)".^x");
-	Macro((unsigned char *)".^b");
-	Macro((unsigned char *)".^# 1 <prolog>");
-/*
- * Read input files.
- */
-	for (i = 0; i < nf; i++) {
-		Dowarn = (i >= pc);
-		if (files[i] == NULL) {
-			np = "stdin";
-			Ifs = stdin;
-		} else {
-#ifdef	UNIX
-			if ((Ifs = fopen(files[i], "r")) == NULL)
-#else
-			if ((Ifs = fopen(files[i], "rt")) == NULL)
-#endif
-				Error(FATAL, NOLINE, " can't open ", files[i]);
-			np = files[i];
-		}
-		if (i >= pc) {
-			(void) sprintf((char *)Line, ".^# 1 %s", np);
-			Macro(Line);
-			NR = 0;
-		}
-		Fsp = 0;
-		do {
-			while (fgets((char *)Line, MAXLINE, Ifs) != NULL) {
-				NR++;
-				if ((np = strrchr((char *)Line, '\n')) != NULL)
-					*np = '\0';
-				else
-					Line[MAXLINE-1] = '\0';
-				Macro(Line);
-			}
-			if (i >= pc)
-				Macro((unsigned char *)".^e");
-			if (Ifs != stdin)
-				(void) fclose(Ifs);
-			if (Fsp > 0) {
-				Free(&Inname);
-				Inname = Inn_stk[Fsp-1];
-				NR = NR_stk[Fsp-1];
-				Ifs = Ifs_stk[Fsp-1];
-			}
-		} while (Fsp-- > 0);
-	}
-	Macro(NULL);
-	if (fff)
-		Charput((int)'\f');
-	exit(Err);
-}
-
-
-/*
- * Macro(inp) - process a possible macro statement
- *		pass non-macros and macros alike to pass 2
- */
-
-void
-Macro(inp)
-	unsigned char *inp;		/* possible macro statement pointer */
-{
-	unsigned char c[2];		/* characters */
-	int endm;			/* end of macro status */
-	FILE *fs;			/* temporary file stream */
-	int i, j, k;                    /* temporary indexes */
-	int mx;                         /* Macrotab[] index */
-	int req;			/* request character status */
-	unsigned char *s1, *s2;		/* temporary string pointers */
-
-	if (inp == NULL) {
-		Pass2(NULL);
-		return;
-	}
-	req = (*inp == '.' || *inp == '\'') ? 1 : 0;
-/*
- * Check for file name designator.
- */
-	if (req && inp[1] == '^' && inp[2] == '#') {
-		Free(&Inname);
-		Inname = Field(3, inp, 1);
-		F = NULL;
-		Pass2(inp);
-		return;
-	}
-/*
- * Check for source command - "^[.']so".
- */
-	if (req && inp[1] == 's' && inp[2] == 'o') {
-		if ((s1 = Field(2, inp, 1)) == NULL) {
-			Error(WARN, LINE, " no file specified", NULL);
-			return;
-		}
-		if ((fs = fopen((char *)s1, "r")) == NULL) {
-			Error(WARN, LINE, " can't open", NULL);
-			return;
-		}
-		if (Fsp >= MAXFSTK) {
-			(void) fclose(fs);
-			Error(WARN, LINE, " nesting too deep", NULL);
-			return;
-		}
-		Ifs_stk[Fsp] = Ifs;
-		Ifs = fs;
-		Inn_stk[Fsp] = Inname;
-		Inname = F;
-		F = NULL;
-		NR_stk[Fsp++] = NR;
-		NR = 0;
-		return;
-	}
- /*
-  * Check for ignore.
-  */
-	if (req && inp[1] == 'i' && inp[2] == 'g') {
-		while (fgets((char *)inp, MAXLINE, Ifs) != NULL) {
-			NR++;
-			if (inp[0] == '.' && inp[1] == '.') break;
-		}
-		return;
-	}
- /*
-  * Check for start of macro definition.
-  */
-	if (req && inp[1] == 'd' && inp[2] == 'e') {
-		if (inp[3] != ' ' || inp[4] == '\0') {
-			Error(WARN, LINE, " illegal macro definition", NULL);
-			return;
-		}
-		c[0] = inp[4];
-		c[1] = inp[5];
-		Curmx = Findmacro(c, 1);
-		return;
-	}
-/*
- * Check for macro text.  Remove double backslashes.
- */
-	if (req && (inp[1] == '\0' || (inp[2] == '\0' && inp[0] == inp[1])))
-		endm = 1;
-	else
-		endm = 0;
-	if (Curmx >= 0 && !endm) {
-		if (Mtx >= MAXMTXT)
-			Error(FATAL, LINE, " out of macro text space", NULL);
-		if ((s1 = (unsigned char *)strchr((char *)inp, '\\')) == NULL)
-			Macrotxt[Mtx] = Newstr(inp);
-		else {
-			for (s1 = Pass1ln, s2 = inp;; s1++) {
-				if ((*s1 = *s2++) == '\0')
-					break;
-				if (*s1 == '\\' && *s2 == '\\')
-					s2++;
-			}
-			Macrotxt[Mtx] = Newstr(Pass1ln);
-		}
-		if (Macrotab[Curmx].bx == -1)
-			Macrotab[Curmx].bx = Mtx;
-		Mtx++;
-		Macrotab[Curmx].ct++;
-		return;
-	}
-/*
- * Check for end of macro.
- */
-	if (Curmx >= 0 && endm) {
-		Curmx = -1;
-		(void) sprintf((char *)Pass1ln, ".^# %d %s", NR, Inname);
-		Pass2(Pass1ln);
-		return;
-	}
- /*
-  * Check for conditionals and macro expansions.
-  */
-	if (req
-	&&  (((mx = Findmacro(inp+1, 0)) != -1) || regexec(Pat[0].pat, inp))) {
-		Expand(inp);
-		return;
-	}
-/*
- * None of the above: forward the line.
- */
-	Pass2(inp);
-}
Index: trunk/minix/commands/cawf/cawf.h
===================================================================
--- trunk/minix/commands/cawf/cawf.h	(revision 9)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- *	cawf.h - definitions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include <stdio.h>
-#ifdef	UNIX
-#include <sys/types.h>
-#else
-#include <sys\types.h>
-#endif
-#include "regexp.h"
-#include "cawflib.h"
-#include "proto.h"
-
-#define	DEVCONFIG	"device.cf"		/* device configuration file */
-#define ESC		'\033'			/* ESCape character */
-#define MAXEXP          30                      /* maximum expressions
-						 * (and TABs) */
-#define MAXFSTK		5			/* maximum file stack
-						 * (for .so) */
-#define MAXHYCH		10			/* maximum hyphen characters */
-#define MAXLINE         512			/* maximum line length */
-#define MAXMACRO        100			/* maximum number of macros */
-#define MAXMTXT         1024			/* maximum macro text lines */
-#define MAXNHNR		10			/* maximum ".NH" numbers
-						 * (but 0 not used) */
-#define MAXNR		50			/* maximum number reg */
-#define MAXOLL		512			/* maximum output line length */
-#define	MAXSCH		256			/* maximum special characters */
-#define MAXSP		25			/* maximum stack pointer (for
-						 * nesting of macro calls) */
-#define MAXSTR		100			/* maximum ".ds" strings */
-
-/*
- * Output line adjustment modes
- */
-
-#define LEFTADJ		0
-#define RIGHTADJ	1
-#define BOTHADJ		2
-
-/*
- * Error handling codes
- */
-
-#define	FATAL		0			/* fatal error */
-#define	LINE		0			/* display line */
-#define	NOLINE		1			/* don't display line */
-#define WARN		1			/* warning error */
-
-/*
- * Padding directions
- */
-
-#define	PADLEFT		0			/* pad from left */
-#define PADRIGHT	1			/* pad from right */
-
-/*
- * Pass 3 signal codes
- */
-
-#define NOBREAK		-1
-#define DOBREAK		-2
-#define MESSAGE		-3
-
-/*
- * Macro argument types
- */
-
-#define	MANMACROS	1			/* -man */
-#define MSMACROS	2			/* -ms */
-
-
-struct fcode {
-	unsigned char nm;		/* font name character */
-	unsigned char status;		/* status */
-};
-
-struct fontstr {			/* font control strings */
-
-	unsigned char *i;		/* font initialization string */
-	int il;				/* length of *i */ 
-	unsigned char *b;		/* bold */
-	int bl;				/* length of *bb */
-	unsigned char *it;		/* italic */
-	int itl;			/* length of *itb */
-	unsigned char *r;		/* roman string */
-	int rl;				/* length of *r */
-}; 
-
-struct hytab {
-	unsigned char font;		/* font name character */
-	int len;			/* effective length */
-	unsigned char *str;		/* value string */
-};
-
-struct macro {
-        unsigned char name[2];		/* macro name */
-        int bx;				/* beginning Macrotxt[] index */
-	int ct;				/* index count */
-};
-
-struct nbr {
-	unsigned char nm[2];		/* register name */
-	int val;			/* value */
-};
-
-struct parms {
-	char nm[2];			/* parameter name */
-	char *cmd;			/* pass 3 command */
-	int val;                        /* current value */
-	int prev;                       /* previous value */
-};
-
-struct rx {
-	char *re;			/* regular expression */
-	struct regexp *pat;		/* compiled pattern */
-};
-
-struct scale {
-	unsigned char nm;		/* scale factor name */
-	double val;			/* value */
-};
-
-struct schtab {
-	unsigned char nm[2];		/* character name */
-	int len;			/* effective length */
-	unsigned char *str;		/* value string */
-};
-
-struct str {
-	unsigned char nm[2];		/* string name */
-	unsigned char *str;		/* string value */
-};
-
-extern int Adj;				/* output line adjustment mode */
-extern unsigned char *Aftnxt;		/* action after next line */
-extern unsigned char *Args[];		/* macro arguments */
-extern unsigned char *Argstack[];	/* stack for Expand()'s "args[]" */
-extern int Backc;                       /* last word ended with '\\c' */
-extern int Botmarg;			/* bottom margin */
-extern int Centering;                   /* centering count */
-extern int Condstack[];                 /* stack for Expand()'s "cond" */
-extern unsigned char *Cont;		/* continue line append */
-extern int Contlen;			/* continue line append length */
-extern int Curmx;                 	/* current macro name */
-extern char *Device;			/* output device name */
-extern char *Devconf;			/* device configuration file path */
-extern char *Devfont;			/* output device font */
-extern int Divert;			/* diversion status */
-extern FILE *Efs;			/* error file stream pointer */
-extern unsigned char *Eol;		/* end of line information */
-extern int Eollen;			/* end of line length */
-extern int Err;                         /* error flag */
-extern unsigned char *F;		/* field value */
-extern struct fcode Fcode[];		/* font codes */
-extern int Fill;			/* fill status */
-extern unsigned char Font[];		/* current font */
-extern int Fontctl;			/* output font control */
-extern char Fontstat;			/* output font status */
-extern int Fph;				/* first page header status */
-extern int Fsp;                         /* files stack pointer (for .so) */
-extern struct fontstr Fstr;		/* font control strings */
-extern unsigned char *Ftc;		/* center footer */
-extern unsigned char *Ftl;		/* left footer */
-extern unsigned char *Ftr;		/* right footer */
-extern unsigned char *Hdc;		/* center header */
-extern int Hdft;			/* header/footer status */
-extern unsigned char *Hdl;		/* left header */
-extern unsigned char *Hdr;		/* right header */
-extern FILE *Ifs;			/* input file stream */
-extern FILE *Ifs_stk[];			/* Ifs stack */
-extern int Ind;                         /* indentation amount */
-extern unsigned char *Inname;		/* input file name */
-extern unsigned char *Inn_stk[];	/* Inname stack */
-extern struct hytab Hychar[];           /* hyphen characters */
-extern int LL;				/* line length */
-extern unsigned char Line[];		/* input line */
-extern int Lockil;			/* pass 2 line number is locked
-					 * (processing is inside macro) */
-extern int Marg;                        /* macro argument - man, ms, etc. */
-extern struct macro Macrotab[];         /* macro table */
-extern int Macrostack[];                /* stack for Expand()'s "macro" */
-extern unsigned char *Macrotxt[];	/* macro text */
-extern int Mtx;                         /* macro text index */
-extern int Mxstack[];                   /* stack for Expand()'s "mx" */
-extern int Nhnr[];			/* ".NH" numbers */
-extern int Nhy;                         /* number of Hychar[] entries */
-extern int Nleftstack[];                /* stack for Expand()'s "nleft" */
-extern int Nmac;                        /* number of macros */
-extern int Nnr;                         /* number of Numb[] entries */
-extern int Nospmode;			/* no space mode */
-extern int Nparms;                      /* number of Parms[] entries */
-extern int NR;                          /* number of record, ala awk */
-extern int NR_stk[];			/* NR stack */
-extern int Nsch;                        /* number of Schar[] entries */
-extern int Nstr;                        /* number of entries in Str[] */
-extern int Ntabs;			/* number of TAB positions */
-extern struct nbr Numb[];		/* number registers */
-extern int Nxtln;			/* next line number */
-extern char *optarg;			/* getopt(3) argument pointer */
-extern int optind;			/* getopt(3) index */
-extern int Outll;			/* output line length */
-extern unsigned char Outln[];		/* output line */
-extern int Outlx;			/* output line index */
-extern int P2il;                        /* pass 2 input line number */
-extern unsigned char *P2name;		/* pass 2 input file name */
-extern int P3fill;			/* pass 3 fill status */
-extern int Padchar[];			/* padding character locations */
-extern int Padfrom;			/* which end to pad from */
-extern int Padx;			/* Padchar[] index */
-extern struct parms Parms[];            /* parameter registers */
-extern unsigned char Pass1ln[];		/* pass 1 output line */
-extern unsigned char Pass2ln[];		/* pass 2 output line */
-extern struct rx Pat[];			/* compiled regexp patterns */
-extern int Pglen;			/* page length */
-extern int Pgoff;			/* page offset */
-extern char *Pname;			/* program name */
-extern unsigned char Prevfont;		/* previous font */
-extern int Ptrstack[];                  /* stack for Expand()'s "ptr" */
-extern struct scale Scale[];		/* scaling factors */
-extern double Scalen;                   /* 'n' scaling factor */
-extern double Scaleu;                   /* 'u' scaling factor */
-extern double Scalev;                   /* 'v' scaling factor */
-extern struct schtab Schar[];           /* special characters */
-extern int Sp;				/* stack pointer */
-extern struct str Str[];		/* ".ds" strings */
-extern int Sx;				/* string index */
-extern int Tabs[];			/* TAB positions */
-extern int Thispg;			/* this page number */
-extern int Tind;			/* temporary indentation amount */
-extern int Topmarg;			/* top margin */
-extern unsigned char *Trtbl;		/* .tr table */
-extern int Uhyph;			/* hyphen usage state */
-extern int Vspace;                      /* vertical (inter-text-line) spacing */
-extern unsigned char Word[];		/* pass 2 word buffer */
-extern int Wordl;                       /* effective length of Word[] */
-extern int Wordx;                       /* Word[] index */
-extern int Dowarn;			/* Enables warnings when true */
Index: trunk/minix/commands/cawf/cawflib.h
===================================================================
--- trunk/minix/commands/cawf/cawflib.h	(revision 9)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- *	cawflib.h - definition of cawf's library path
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#ifndef	CAWFLIB
-#ifdef  UNIX
-#define CAWFLIB         "/usr/lib/cawf"		/* UNIX library location */
-#else
-#define CAWFLIB         "c:/sys/lib/cawf"       /* PC-DOS library location */
-#endif
-#endif
-						/* (CAWFLIB environment
-						 * variable over-rides it) */
Index: trunk/minix/commands/cawf/common
===================================================================
--- trunk/minix/commands/cawf/common	(revision 9)
+++ 	(revision )
@@ -1,7 +1,0 @@
-.\" Common startup code, fully device-independent.
-.\" --------------------------------
-.fi
-.ce 0
-.ta +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8
-.in 0
-.ti 0
Index: trunk/minix/commands/cawf/device.c
===================================================================
--- trunk/minix/commands/cawf/device.c	(revision 9)
+++ 	(revision )
@@ -1,415 +1,0 @@
-/*
- *	device.c -- cawf(1) output device support functions
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-#include <ctype.h>
-
-_PROTOTYPE(static unsigned char *Convstr,(char *s, int *len));
-_PROTOTYPE(static int Convfont,(char *nm, char *s, char **fn,
-	unsigned char **fi));
-
-#ifndef	UNIX
-#define	strcasecmp	strcmpi
-#endif
-
-
-
-/*
- * Convstr(s, len) - convert a string
- */
-
-static unsigned char *
-Convstr(s, len)
-	char *s;			/* input string */
-	int *len;			/* length of result */
-{
-	int c;				/* character assembly */
-	unsigned char *cp;		/* temporary character pointer */
-	char *em;			/* error message */
-	int i;				/* temporary index */
-	int l;				/* length */
-	unsigned char *r;		/* result string */
-/*
- * Make space for the result.
- */
-	if ((r = (unsigned char *)malloc(strlen((char *)s) + 1)) == NULL) {
-		(void) fprintf(stderr, "%s: out of string space at %s\n",
-			Pname, s);
-		return(NULL);
-	}
-/*
- * Copy the input string to the result, processing '\\' escapes.
- */
-	for (cp = r, l = 0; *s;) {
-		switch (*s) {
-
-		case '\\':
-			s++;
-			if (*s >= '0' && *s <= '7') {
-		/*
-		 * '\xxx' -- octal form
-		 */
-				for (c = i = 0; i < 3; i++, s++) {
-					if (*s < '0' || *s > '7') {
-						em = "non-octal char";
-bad_string:
-						(void) fprintf(stderr,
-							"%s: %s : %s\n",
-							Pname, em, (char *)r);
-						return(NULL);
-					}
-					c = (c << 3) + *s - '0';
-				}
-				if (c > 0377) {
-					em = "octal char > 0377";
-					goto bad_string;
-				}
-				*cp++ = c;
-				l++;
-			} else if (*s == 'x') {
-		/*
-		 * '\xyy' -- hexadecimal form
-		 */
-				s++;
-				for (c = i = 0; i < 2; i++, s++) {
-#if	defined(__STDC__)
-					if ( ! isalpha(*s) && ! isdigit(*s))
-#else
-					if ( ! isascii(*s) && ! isalpha(*s)
-					&&   ! isdigit(*s))
-#endif
-					{
-non_hex_char:
-						em = "non-hex char";
-						goto bad_string;
-					}
-					c = c << 4;
-					if (*s >= '0' && *s <= '9')
-						c += *s - '0';
-					else if ((*s >= 'a' && *s <= 'f')
-					     ||  (*s >= 'A' && *s <= 'F'))
-						c += *s + 10 -
-						     (isupper(*s) ? 'A' : 'a');
-					else
-						goto non_hex_char;
-				}
-				*cp++ = (unsigned char)c;
-				l++;
-			} else if (*s == 'E' || *s == 'e') {
-		/*
-		 * '\E' or '\e' -- ESCape
-		 */
-				*cp++ = ESC;
-				l++;
-				s++;
-			} else if (*s == '\0') {
-				em = "no char after \\";
-				goto bad_string;
-			} else {
-		/*
-		 * escaped character (for some reason)
-		 */
-				*cp++ = *s++;
-				l++;
-			}
-			break;
-	/*
-	 * Copy a "normal" character.
-	 */
-		default:
-			*cp++ = *s++;
-			l++;
-		}
-	}
-	*cp = '\0';
-	*len = l;
-	return(r);
-}
-
-
-/*
- * Convfont(nm, s, fn, fi) - convert a font for a device
- */
-
-static int
-Convfont(nm, s, fn, fi)
-	char *nm;			/* output device name */
-	char *s;			/* font definition string */
-	char **fn;			/* font name address */
-	unsigned char **fi;		/* initialization string address */
-{
-	char *cp;			/* temporary character pointer */
-	int len;			/* length */
-/*
- * Get the font name, allocate space for it and allocate space for
- * a font structure.
- */
-	if ((cp = strchr(s, '=')) == NULL) {
-		(void) fprintf(stderr, "%s: bad %s font line format: %s\n",
-			Pname, nm, s);
-		return(0);
-	}
-	if ((*fn = (char *)malloc(cp - s + 1)) == NULL) {
-		(void) fprintf(stderr, "%s: no space for %s font name %s\n",
-			Pname, nm, s);
-		return(0);
-	}
-	(void) strncpy(*fn, s, cp - s);
-	(*fn)[cp - s] = '\0';
-/*
- * Assmble the font initialization string.
- */
-	if ((*fi = Convstr(cp + 1, &len)) == NULL)
-		return(0);
-	return(len);
-}
-
-
-/*
- * Defdev() - define the output device
- */
-
-int
-Defdev()
-{
-	unsigned char *fi = NULL;	/* last font initialization string */
-	char *fn = NULL;		/* font name */
-	int fd = 0;			/* found-device flag */
-	FILE *fs;			/* file stream */
-	int err = 0;			/* errror count */
-	int i;				/* temporary index */
-	int len;			/* length */
-	char line[MAXLINE];		/* line buffer */
-	char *p;			/* output device configuration file */
-	char *s;			/* temporary string pointer */
-/*
- * Check for the built-in devices, ANSI, NONE or NORMAL (default).
- */
-	Fstr.b = Fstr.i = Fstr.it = Fstr.r = NULL;
-	Fstr.bl = Fstr.il = Fstr.itl = Fstr.rl = 0;
-	if (Device == NULL || strcasecmp(Device, "normal") == 0) {
-		Fontctl = 0;
-check_font:
-		if (Devfont) {
-			(void) fprintf(stderr,
-				"%s: font %s for device %s illegal\n",
-				Pname, Devfont, Device ? Device : "NORMAL");
-			return(1);
-		}
-		return(0);
-	}
-	Fontctl = 1;
-	if (strcasecmp(Device, "ansi") == 0) {
-		Fstr.b = Newstr((unsigned char *)"x[1m");
-		Fstr.it = Newstr((unsigned char *)"x[4m");
-		Fstr.r = Newstr((unsigned char *)"x[0m");
-		Fstr.b[0] = Fstr.it[0] = Fstr.r[0] = ESC;
-		Fstr.bl = Fstr.itl = Fstr.rl = 4;
-		goto check_font;
-	}
-	if (strcasecmp(Device, "none") == 0)
-		goto check_font;
-/*
- * If a device configuration file path is supplied, use it.
- */
-	if (Devconf)
-		p = Devconf;
-	else {
-
-	/*
-	 * Use the CAWFLIB environment if it is defined.
-	 */
-		if ((p = getenv("CAWFLIB")) == NULL)	
-			p = CAWFLIB;
-		len = strlen(p) + 1 + strlen(DEVCONFIG) + 1;
-		if ((s = (char *)malloc(len)) == NULL) {
-			(void) fprintf(stderr, "%s: no space for %s name\n",
-				Pname, DEVCONFIG);
-			return(1);
-		}
-		(void) sprintf(s, "%s/%s", p, DEVCONFIG);
-		p = s;
-	}
-/*
- * Open the configuration file.
- */
-#ifdef	UNIX
-	if ((fs = fopen(p, "r")) == NULL)
-#else
-	if ((fs = fopen(p, "rt")) == NULL)
-#endif
-	{
-		(void) fprintf(stderr, "%s: can't open config file: %s\n",
-			Pname, p);
-		return(1);
-	}
-	*line = ' ';
-/*
- * Look for a device definition line -- a line that begins with a name.
- */
-	while ( ! feof(fs)) {
-		if (*line == '\t' || *line == '#' || *line == ' ') {
-			(void) fgets(line, MAXLINE, fs);
-			continue;
-		}
-		if ((s = strrchr(line, '\n')) != NULL)
-			*s = '\0';
-		else
-			line[MAXLINE-1] = '\0';
-	/*
-	 * Match device name.
-	 */
-		if (strcmp(Device, line) != 0) {
-			(void) fgets(line, MAXLINE, fs);
-			continue;
-		}
-		fd = 1;
-	/*
-	 * Read the parameter lines for the device.
-	 */
-		while (fgets(line, MAXLINE, fs) != NULL) {
-			if (*line == ' ') {
-				for (i = 1; line[i] == ' '; i++)
-					;
-			} else if (*line == '\t')
-				i = 1;
-			else
-				break;
-#if	defined(__STDC__)
-			if ( ! isalpha(line[i])
-#else
-			if ( ! isascii(line[i]) || ! isalpha(line[i])
-#endif
-			||   line[i+1] != '=')
-				break;
-			if ((s = strrchr(line, '\n')) != NULL)
-				*s = '\0';
-			else
-				line[MAXLINE-1] = '\0';
-			switch (line[i]) {
-		/*
-		 * \tb=<bolding_string>
-		 */
-			case 'b':
-				if (Fstr.b != NULL) {
-				    (void) fprintf(stderr,
-					"%s: dup bold for %s in %s: %s\n",
-					Pname, Device, p, line);
-					(void) free(Fstr.b);
-					Fstr.b = NULL;
-				}
-				if ((Fstr.b = Convstr(&line[i+2], &Fstr.bl))
-				== NULL)
-					err++;
-				break;
-		/*
-		 * \ti=<italicization_string>
-		 */
-			case 'i':
-				if (Fstr.it != NULL) {
-				    (void) fprintf(stderr,
-					"%s: dup italic for %s in %s: %s\n",
-					Pname, Device, p, line);
-					(void) free(Fstr.it);
-					Fstr.it = NULL;
-				}
-				if ((Fstr.it = Convstr(&line[i+2], &Fstr.itl))
-				== NULL)
-					err++;
-				break;
-		/*
-		 * \tr=<return_to_Roman_string>
-		 */
-			case 'r':
-				if (Fstr.r != NULL) {
-				    (void) fprintf(stderr,
-					"%s: dup roman for %s in %s: %s\n",
-					Pname, Device, p, line);
-					(void) free(Fstr.r);
-					Fstr.r = NULL;
-				}
-				if ((Fstr.r = Convstr(&line[i+2], &Fstr.rl))
-				== NULL)
-					err++;
-				break;
-		/*
-		 * \tf=<font_name>=<font_initialization_string>
-		 */
-			case 'f':
-				if ( ! Devfont || Fstr.i)
-					break;
-				if ((i = Convfont(Device, &line[i+2], &fn, &fi))
-				< 0)
-					err++;
-				else if (fn && strcmp(Devfont, fn) == 0) {
-					Fstr.i = fi;
-					Fstr.il = i;
-					fi = NULL;
-				}
-				if (fn) {
-					(void) free(fn);
-					fn = NULL;
-				}
-				if (fi) {
-					(void) free((char *)fi);
-					fi = NULL;
-				}
-				break;
-		/*
-		 * ????
-		 */
-			default:
-				(void) fprintf(stderr,
-					"%s: unknown device %s line: %s\n",
-					Pname, Device, line);
-				err++;
-			}
-		}
-		break;
-	}
-	(void) fclose(fs);
-	if (err)
-		return(1);
-/*
- * See if the device stanza was located and the font exists.
- */
-	if ( ! fd) {
-		(void) fprintf(stderr, "%s: can't find device %s in %s\n",
-			Pname, Device, p);
-		return(1);
-	}
-	if (Devfont && ! Fstr.i) {
-		(void) fprintf(stderr,
-			"%s: font %s for device %s not found in %s\n",
-			Pname, Devfont, Device, p);
-		return(1);
-	}
-	return(0);
-}
Index: trunk/minix/commands/cawf/device.cf
===================================================================
--- trunk/minix/commands/cawf/device.cf	(revision 9)
+++ 	(revision )
@@ -1,89 +1,0 @@
-# cawf(1) device configuration file
-#
-# device
-# \tb=bold_control_sequence
-# \ti=italic_control_sequence
-# \tr=roman_control_sequence
-# \tf=font_name=font_initialization
-#
-# The first font name is the default for the device.
-#
-# sorted in reverse alphabetical order by device name
-
-# VGA monochrome monitors
-#	italic = underline
-
-vgamono
-	b=\033[1m
-	i=\033[4m
-	r=\033[0m
-
-
-# HP LaserJet III
-
-lj3
-	b=\x1b(s7B
-	i=\x1b(s1S
-	r=\x1b(s0B\x1b(s0S
-	f=c10=\x1b&l0O\x1b(8U\x1b(s0p12h10v0s0b3T
-	f=c12ibm=\x1b&l0O\x1b(10U\x1b(s0p10.00h12.0v0s0b3T
-	f=lg12=\x1b&l0O\x1b(8U\x1b(s12h12v0s0b6T
-
-# Panasonic KX-P1180
-#	bold = Emphasized
-#
-#	all fonts are Near Letter Quality (NLQ)
-
-kxp1180
-	b=\033E
-	i=\0334
-	r=\0335\033F
-	f=c10=\033x1\033k0\033P
-	f=bps10=\033x1\033k6\033P
-	f=bps12=\033x1\033k6\033M
-	f=c12=\033x1\033k0\033M
-	f=p10=\033x1\033k3\033P
-	f=p12=\033x1\033k3\033M
-	f=ss10=\033x1\033k1\033P
-	f=ss12=\033x1\033k1\033M
-
-# Panasonic KX-P1124 (from Bob Hardy <hardy@lucid.com>)
-#       bold = Emphasized
-#
-#       all fonts are Near Letter Quality (NLQ)
-#
-#       The s10 and s12 fonts are Script, which is only available on the more
-#       deluxe models of the Panasonic KX-P1100 series -- e.g., Script is not
-#       supported on the KX-P1180, but is supported on the KX-P1124.
-
-kxp1124
-	b=\033E
-	i=\0334
-	r=\0335\033F
-	f=c10=\033x1\033k0\033P
-	f=bps10=\033x1\033k6\033P
-	f=bps12=\033x1\033k6\033M
-	f=c12=\033x1\033k0\033M
-	f=p10=\033x1\033k3\033P
-	f=p12=\033x1\033k3\033M
-	f=s10=\033x1\033k4\033P
-	f=s12=\033x1\033k4\033M
-	f=ss10=\033x1\033k1\033P
-	f=ss12=\033x1\033k1\033M
-
-# IBM Personal Printer Data Stream (PPDS) protocol
-#	bold = Double-strike
-#	italic = Underline
-
-ibmppds
-	b=\033G
-	i=\033-\001
-	r=\033-\000\033H
-
-# Epson FX-86e/FX-800
-#	bold = double strike
-
-epson
-	b=\033G
-	i=\0334
-	r=\0335\033H
Index: trunk/minix/commands/cawf/diffs
===================================================================
--- trunk/minix/commands/cawf/diffs	(revision 9)
+++ 	(revision )
@@ -1,211 +1,0 @@
-diff -c1 ../4.0.2.dist/Makefile ./Makefile
-*** ../4.0.2.dist/Makefile	Thu Nov 26 09:06:28 1992
---- ./Makefile	Thu Nov 26 09:17:08 1992
-***************
-*** 36,40 ****
-  
-! DEFS = -DUNIX -DSTDLIB -ansi -pedantic
-  
-! CFLAGS = -O ${DEFS}
-  
---- 36,40 ----
-  
-! DEFS = -DUNIX -DUSG -DSTDLIB
-  
-! CFLAGS = -i -s -f -O ${DEFS}
-  
-diff -c1 ../4.0.2.dist/README ./README
-*** ../4.0.2.dist/README	Thu Nov 26 09:06:28 1992
---- ./README	Thu Nov 26 09:19:26 1992
-***************
-*** 54,56 ****
---- 54,68 ----
-  
-+ Changes to cawf to run under Minix:
-  
-+ 	*  The DOS binaries and make files have been removed.
-+  
-+ 	*  Tabs stops changed from per 5 to per 8.
-+ 
-+ 	*  Bold and underline as it should be in device.cf.
-+ 
-+ 	*  Added .SB and .TA to man.mac.
-+ 
-+ 	*  Numerous prototypes added.
-+ 
-+ 
-  CONTENTS
-***************
-*** 58,62 ****
-  
-! This Unix distribution of cawf includes:
-  
-! 	00readme	    this file
-  	*.c and *.h	    source files to build cawf and bsfilt (bsfilt
---- 70,74 ----
-  
-! This Minix distribution of cawf includes:
-  
-! 	README		    this file
-  	*.c and *.h	    source files to build cawf and bsfilt (bsfilt
-***************
-*** 64,70 ****
-  	bsfilt.1	    nroff source for the bsfilt manual page
-- 	bsfilt.exe.uue	    uuencoded MS-DOS bsfilt executable
-- 	bsfilt.mak	    MS-DOS Quick-C make file for bsfilt
-  	cawf.1		    nroff source for the cawf manual page
-- 	cawf.exe.uue	    uuencoded MS-DOS cawf executable
-- 	cawf.mak	    MS-DOS Quick-C make file for cawf
-  	common		    initialization file for CAWFLIB library
---- 76,78 ----
-***************
-*** 77,86 ****
-  	ms.mac		    ms(7) macros for CAWFLIB library
-  
-- Hint: to generate an MS-DOS executable, uudecode the *.exe.uue file -- e.g.
-  
-- 	$ uudecode cawf.exe.uue
-- 
-- yields a cawf.exe file.
-- 
-- 
-  LIBRARY
---- 85,94 ----
-  	ms.mac		    ms(7) macros for CAWFLIB library
-+ 	diffs		    Minix patches
-+ #ifdef PUTTING_IT_ON_THE_NET
-+ 	cawf
-+ 	bsfilt		    binaries compiled under Minix-PC 1.5 using the ACK
-+ 			    ANSI C compiler using software floating point
-+ #endif
-  
-  
-  LIBRARY
-***************
-*** 89,92 ****
-  To use cawf, you must select a location for the CAWFLIB library files.  The
-! distributed cawf.exe expects to find them in c:\sys\lib\cawf, but you can
-! alter that with the CAWFLIB environment variable, or you can change the
-  CAWFLIB #define in cawf.h and rebuild cawf from the sources.
---- 97,100 ----
-  To use cawf, you must select a location for the CAWFLIB library files.  The
-! distributed cawf binary expects to find them in /usr/local/lib/cawf but you
-! can alter that with the CAWFLIB environment variable, or you can change the
-  CAWFLIB #define in cawf.h and rebuild cawf from the sources.
-***************
-*** 135,139 ****
-  
-! A Unix make file and a cawf.mak file for version 2.5 of Microsoft MS-DOS
-! Quick-C are included.  The Unix make file has some definitions that help
-! tune it to the local Unix environment:
-  
---- 143,146 ----
-  
-! The Unix make file has some definitions that help tune it to the local
-! Unix environment:
-  
-***************
-*** 251 ****
---- 258,264 ----
-  
-+ 
-+ MINIX SPECIFIC TINKERING
-+ ------------------------
-+ 
-+ Kees J. Bot <kjb@cs.vu.nl>
-+ 26 November 1992
-diff -c1 ../4.0.2.dist/cawflib.h ./cawflib.h
-*** ../4.0.2.dist/cawflib.h	Thu Nov 26 09:06:35 1992
---- ./cawflib.h	Thu Nov 26 09:17:10 1992
-***************
-*** 32,34 ****
-  #ifdef  UNIX
-! #define CAWFLIB         "/Homes/abe/lib/cawf"	/* UNIX library location */
-  #else
---- 32,34 ----
-  #ifdef  UNIX
-! #define CAWFLIB         "/usr/local/lib/cawf"	/* UNIX library location */
-  #else
-diff -c1 ../4.0.2.dist/common ./common
-*** ../4.0.2.dist/common	Thu Nov 26 09:06:36 1992
---- ./common	Thu Nov 26 09:17:10 1992
-***************
-*** 4,6 ****
-  .ce 0
-! .ta +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5
-  .in 0
---- 4,6 ----
-  .ce 0
-! .ta +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8
-  .in 0
-diff -c1 ../4.0.2.dist/device.c ./device.c
-*** ../4.0.2.dist/device.c	Thu Nov 26 09:06:36 1992
---- ./device.c	Thu Nov 26 09:34:09 1992
-***************
-*** 229,231 ****
-  	if (strcasecmp(Device, "ansi") == 0) {
-! 		Fstr.b = Newstr((unsigned char *)"x[7m");
-  		Fstr.it = Newstr((unsigned char *)"x[4m");
---- 229,231 ----
-  	if (strcasecmp(Device, "ansi") == 0) {
-! 		Fstr.b = Newstr((unsigned char *)"x[1m");
-  		Fstr.it = Newstr((unsigned char *)"x[4m");
-diff -c1 ../4.0.2.dist/device.cf ./device.cf
-*** ../4.0.2.dist/device.cf	Thu Nov 26 09:06:37 1992
---- ./device.cf	Thu Nov 26 09:21:17 1992
-***************
-*** 13,15 ****
-  # VGA monochrome monitors
-! #	italic = reverse video
-  
---- 13,15 ----
-  # VGA monochrome monitors
-! #	italic = underline
-  
-***************
-*** 17,19 ****
-  	b=\033[1m
-! 	i=\033[7m
-  	r=\033[0m
---- 17,19 ----
-  	b=\033[1m
-! 	i=\033[4m
-  	r=\033[0m
-Only in .: diffs
-diff -c1 ../4.0.2.dist/man.mac ./man.mac
-*** ../4.0.2.dist/man.mac	Thu Nov 26 09:06:42 1992
---- ./man.mac	Thu Nov 26 09:17:12 1992
-***************
-*** 5,7 ****
-  .ds LH "\\$1(\\$2)
-! .ds CH "Unix Programmer's Manual
-  .ds RH "\\$1(\\$2)
---- 5,7 ----
-  .ds LH "\\$1(\\$2)
-! .ds CH "Minix Programmer's Manual
-  .ds RH "\\$1(\\$2)
-***************
-*** 120,121 ****
---- 120,128 ----
-  .\"-----------------
-+ .de SB
-+ .\" Can't reduce size, just do bold
-+ .ft B
-+ .it 1 fP
-+ .if \\n(.$>0 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-+ ..
-+ .\"-----------------
-  .de IR
-***************
-*** 150,152 ****
-  .de DT
-! .ta +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5
-  ..
---- 157,163 ----
-  .de DT
-! .ta +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8
-! ..
-! .\"-----------------
-! .de TA
-! .ta \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-  ..
Index: trunk/minix/commands/cawf/dumb.dev
===================================================================
--- trunk/minix/commands/cawf/dumb.dev	(revision 9)
+++ 	(revision )
@@ -1,158 +1,0 @@
-.\" Device-dependent but not macro-set-dependent definitions.
-.\" --------------------------------
-.\" overall formatting initialization
-.\" 12 cpi horizontal exploits 80-column terminal well (6.5i@12 = 78)
-.^r cpi 12 6
-.\" call margin adjustment device-dependent for sake of some unusual cases
-.ad
-.\" page parameters
-.pl 10i
-.ll 6.5i
-.po 0
-.\" --------------------------------
-.\" fonts, and their hyphens, last font change doubled to set up \fP
-.^f R
-.ft R
-.^c hy 1 -
-.^f I
-.ft I
-.^c hy 1 -
-.^f B
-.ft B
-.^c hy 1 -\b-\b-
-.^f C
-.ft C
-.^c hy 1 -\b-\b-
-.ft R
-.ft R
-.\" --------------------------------
-.\" definitions of nroff special characters
-.\" The character definitions here operate on the "better ugly than invisible"
-.\" principle, and try to approximate the character *somehow*.  They were
-.\" tuned for a Teletype 40 line printer, but should give vaguely plausible
-.\" results on any overprinting ASCII device.
-.\"
-.\" first, things that nroff considered builtins
-.^c \ 1 \\
-.^c e 1 \\
-.^c ' 1 '
-.^c ` 1 `
-.^c - 1 -
-.\" some things seem to assume that \+ is like \-
-.^c + 1 +
-.\" we do not do backslash-space here, it can't be done with .^c, but the
-.\" other forms of space we can do
-.^c 0 1 " 
-.^c | 0
-.^c ^ 0
-.^c & 0
-.\"
-.\" and more normal characters
-.\" note, the hyphenation logic knows about em
-.^c em 2 --
-.^c en 1 -
-.\" hy is a special case, see above
-.^c bu 1 +\bo
-.^c sq 2 []
-.^c ru 1 _
-.^c 12 3 1/2
-.^c 14 3 1/4
-.^c 34 3 3/4
-.^c de 1 '\b`
-.^c dg 1 -\b!
-.^c fm 1 '
-.^c ct 1 /\bc
-.^c rg 3 (R)
-.^c co 3 (c)
-.^c pl 1 +
-.^c mi 1 -
-.^c eq 1 =
-.^c ** 1 *
-.^c sc 1 j\bf
-.^c aa 1 '
-.^c ga 1 `
-.^c ul 1 _
-.^c sl 1 /
-.^c *a 1 <\ba
-.^c *b 1 ,\bB
-.^c *g 1 ,\by
-.^c *d 1 S\bo
-.^c *e 1 -\bc
-.^c *z 1 ,\bL
-.^c *y 1 ,\bn
-.^c *h 1 -\b0
-.^c *i 1 ,\bi
-.^c *k 1 <\bK
-.^c *l 1 \\\b>
-.^c *m 1 ,\bu
-.^c *n 1 ,\bv
-.^c *c 1 ,\b3
-.^c *o 1 o
-.^c *p 1 -\bn
-.^c *r 1 p
-.^c *s 1 -\bo
-.^c ts 1 s
-.^c *t 1 ~\bt
-.^c *u 1 u
-.^c *f 1 /\bo
-.^c *x 1 /\b\\
-.^c *q 1 |\bu
-.^c *w 1 u\bw
-.^c *G 2 ~\b|~
-.^c *D 2 _\b/_\b\\
-.^c *H 1 -\bO
-.^c *L 2 /\\
-.^c *C 1 _\b-\b~
-.^c *P 2 ~\b|~\b|
-.^c *S 1 ~\b_\b>
-.^c *U 1 Y
-.^c *F 1 |\bO
-.^c *Q 1 |\bU
-.^c *W 2 _\b(_\b)
-.^c sr 2 \\/
-.^c rn 1 ~
-.^c >= 1 _\b>
-.^c <= 1 _\b<
-.^c == 1 _\b=
-.^c ~= 1 ~\b=
-.^c ap 1 ~
-.^c != 1 /\b=
-.^c -> 2 ->
-.^c <- 2 <-
-.^c ua 1 |\b^
-.^c da 1 |\bv
-.^c mu 1 x
-.^c di 1 -\b:
-.^c +- 1 _\b+
-.^c cu 1 U
-.^c ca 3 (^)
-.^c sb 2 (_\b~
-.^c sp 2 _\b~)
-.^c ib 2 (~\b_\b=
-.^c ip 2 ~\b_\b=)
-.^c if 2 oo
-.^c pd 1 3\bo
-.^c gr 1 ~\bV
-.^c no 1 -
-.^c is 1 '\b,\bI
-.^c pt 2 oc
-.^c es 1 /\bO
-.^c mo 1 -\bC
-.^c br 1 |
-.^c dd 1 I\b|
-.^c rh 1 =\b>
-.^c lh 1 =\b<
-.^c bs 4 (:-)
-.^c or 1 |
-.^c ci 1 O
-.^c lt 1 ~\b(
-.^c lb 1 _\b(
-.^c rt 1 ~\b)
-.^c rb 1 _\b)
-.^c lk 1 -\b(
-.^c rk 1 -\b)
-.^c bv 1 |
-.^c lf 1 _\b[
-.^c rf 1 _\b]
-.^c lc 1 ~\b[
-.^c rc 1 ~\b]
Index: trunk/minix/commands/cawf/error.c
===================================================================
--- trunk/minix/commands/cawf/error.c	(revision 9)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- *	error.c - error handling functions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-
-
-/*
- * Error(t, l, s1, s2) - issue error message
- */
-
-void
-Error(t, l, s1, s2)
-	int t;				/* type: WARN or FATAL */
-	int l;				/* LINE: display Line[] */
-	char *s1, *s2;			/* optional text */
-{
-	char msg[MAXLINE];		/* message */
-
-	if (t == WARN && !Dowarn) return;
-
-	if (l == LINE)
-		(void) fprintf(Efs, "%s: (%s, %d):%s%s - %s\n",
-			Pname,
-			Inname,
-			NR,
-			(s1 == NULL) ? "" : s1,
-			(s2 == NULL) ? "" : s2,
-			Line);
-	else
-		(void) fprintf(Efs, "%s:%s%s\n",
-			Pname,
-			(s1 == NULL) ? "" : s1,
-			(s2 == NULL) ? "" : s2);
-	if (t == FATAL)
-		exit(1);
-	Err = 1;
-	return;
-}
-
-
-/*
- * Error3(len, word, sarg, narg) - process error in pass3
- */
-
-void
-Error3(len, word, sarg, narg, msg)
-	int len;			/* length (negative is special */
-        char *word;			/* word */
-        char *sarg;			/* string argument */
-        int narg;                       /* numeric argument */
-	char *msg;			/* message */
-{
-	if (len == MESSAGE) {
-		(void) fprintf(Efs, "%s: (%s, %d) %s\n",
-			Pname,
-			(word == NULL) ? "<none>" : word,
-			narg,
-			(sarg == NULL) ? "<none>" : sarg);
-		return;
-	}
-	(void) fprintf(Efs,
-		"%s: pass3, len=%d, word=\"%s\", sarg=\"%s\", narg=%d%s%s\n",
-		Pname, len,
-		(word == NULL) ? "" : word,
-		(sarg == NULL) ? "" : sarg,
-		narg,
-		(msg == NULL) ? "" : " - ",
-		(msg == NULL) ? "" : msg);
-	Err = 1;
-}
Index: trunk/minix/commands/cawf/expand.c
===================================================================
--- trunk/minix/commands/cawf/expand.c	(revision 9)
+++ 	(revision )
@@ -1,308 +1,0 @@
-/*
- *	expand.c - macro expansion functions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-
-/*
- * Expand(line) - expand macro or if/ie/el line
- */
-
-void
-Expand(line)
-	unsigned char *line;
-{
-	unsigned char buf[2*MAXLINE];	/* line buffer */
-	unsigned char cmd[4];		/* nroff command */
-	int cmdl;			/* command length */
-	int cmdx;			/* cmd index in Macrotab[] */
-	int cond = 0;			/* conditional statuses */
-	int i, j;			/* temporary indexes */
-	int iflen;			/* if statement length */
-	int invert;			/* inversion status */
-	unsigned char *lp;		/* line pointer */
-	int mx = -1;			/* Macrotab[] index */
-	int n1, n2;			/* temporary numbers */
-	int nargs = 0;			/* number of arguments */
-	int nleft = 0;			/* number of macro lines left */
-	char op;			/* comparison operator */
-	int prevcond;			/* previous condition (for else's) */
-	int ptr = -1;			/* Macrotxt[] index */
-	int quote;			/* quoted string status */
-	unsigned char *s1, *s2;		/* temporary string pointers */
-
-
-	(void) sprintf((char *)buf, ".^= %d %s", NR, (char *)Inname);
-	Pass2(buf);
-
-	for (lp = line; *lp; ) {
-		invert = regexec(Pat[1].pat, lp);
-		prevcond = cond;
-		cond = 0;
-		if (regexec(Pat[0].pat, lp) == 0) {
-	    /*
-	     * Not conditional: - ! "^[.'](i[ef]|el)"
-	     */
-			cond = 1;
-			iflen = 0;
-		}
-
-		else if (regexec(Pat[2].pat, lp)) {
-	    /*
-	     * Argument count comparison: -
-	     *		"^[.']i[ef] !?\\n\(\.\$(>|>=|=|<|<=)[0-9] "
-	     */
-			iflen = strlen(".if \\n(.$=n ") + invert;
-			s1 = lp + iflen - 3;
-			op = *s1++;
-			if (*s1 == '=' && (op == '>' || op == '<')) {
-				s1++;
-				op = (op == '>') ? 'G' : 'L';
-			}
-			n1 = (int)(*s1 - '0');
-			switch (op) {
-				case '=':
-					if ((nargs - 1) == n1)
-						cond = 1;
-					break;
-				case '<':
-					if ((nargs - 1) < n1)
-						cond = 1;
-					break;
-				case '>':
-					if ((nargs - 1) > n1)
-						cond = 1;
-					break;
-				case 'G':	/* >= */
-					if ((nargs - 1) >= n1)
-						cond = 1;
-					break;
-				case 'L':	/* <= */
-					if ((nargs - 1) <= n1)
-						cond = 1;
-			}
-		}
-		
-		else if (regexec(Pat[3].pat, lp)) {
-	    /*
-	     * Argument string comparison: - "^[.']i[ef] !?'\\\$[0-9]'[^']*' "
-	     */
-			iflen = strlen(".if '\\$n'") + invert;
-			n1 = (int)(*(lp + iflen - 2) - '0');
-			if (n1 >= 0 && n1 < nargs)
-				s1 = Args[n1];
-			else
-				s1 = (unsigned char *)"";
-			if ((s2 = (unsigned char *)strchr((char *)lp
-				  + iflen, '\''))
-			!= NULL) {
-				n2 = s2 - lp - iflen;
-				if (strncmp((char *)s1, (char *)lp + iflen, n2)
-				== 0)
-					cond = 1;
-				iflen += n2 + 2;
-			}
-		}
-		
-		else if (regexec(Pat[4].pat, lp)) {
-	    /*
-	     * Nroff or troff: - "^[.']i[ef] !?[nt] "
-	     */
-			iflen = strlen(".if n ") + invert;
-			if (*(lp + iflen - 2) == 'n')
-				cond = 1;
-		}
-		
-		else if ((*lp == '.' || *lp == '\'')
-		     &&  strncmp((char *)lp+1, "el ", 3) == 0) {
-	    /*
-	     * Else clause: - "^[.']el "
-	     */
-			cond = 1 - prevcond;
-			iflen = 4;
-		}
-		
-		else {
-	    /*
-	     * Unknown conditional:
-	     */
-			cond = 1;
-			iflen = 0;
-			(void) sprintf((char *)buf,
-				".tm unknown .if/.ie form: %s", (char *)lp);
-			lp = buf;
-		}
-	   /*
-	    * Handle conditional.  If case is true, locate predicate.
-	    * If predicate is an .i[ef], process it.
-	    */
-		if (invert)
-			cond = 1 - cond;
-		if (cond && iflen > 0) {
-			lp += iflen;
-			if (regexec(Pat[15].pat, lp))
-				continue;
-		}
-	    /*
-	     * Do argument substitution, as necessary.
-	     */
-		if (cond && regexec(Pat[5].pat, lp)) {      /* "\$[0-9]" ??? */
-			for (s1 = buf;;) {
-				if ((n1 = Pat[5].pat->startp[0] - lp) > 0) {
-					(void) strncpy((char *)s1, (char *)lp,
-						n1);
-					s1 += n1;
-				}
-				*s1 = '\0';
-				lp = Pat[5].pat->endp[0];
-				n1 = (int)(*(lp-1) - '0');
-				if (n1 >= 0 && n1 < nargs) {
-					(void) strcpy((char *)s1,
-						(char *)Args[n1]);
-					s1 += strlen((char *)Args[n1]);
-				}
-				if (*lp == '\0')
-					break;
-				if (regexec(Pat[5].pat, lp) == 0) {
-					(void) strcpy((char *)s1, (char *)lp);
-					break;
-				}
-			}
-			lp = buf;
-		}
-	    /*
-	     * Check for nroff command.
-	     */
-		if (cond) {
-			cmdl = 0;
-			if (cond && (*lp == '.' || *lp == '\'')) {
-				if ((*cmd = *(lp+1)) != '\0') {
-					cmdl++;
-					if ((*(cmd+1) = *(lp+2)) == ' ')
-						*(cmd+1) = '\0';
-					else
-						cmdl++;
-				}
-			}
-			cmd[cmdl] = '\0';
-		}
-		if (cond == 0)
-			i = i;		/* do nothing if condition is false */
-		else if (cmdl == 0 || ((cmdx = Findmacro(cmd, 0)) < 0))
-			Pass2(lp);
-		else if (Sp >= MAXSP) {
-			(void) sprintf((char *)buf, " macro nesting > %d",
-				MAXSP);
-			Error(WARN, LINE, (char *)buf, NULL);
-		} else {
-	    /*
-	     * Stack macros.
-	     */
-		  /*
-		   * Push stack.
-		   */
-			Sp++;
-			Nleftstack[Sp] = nleft;
-			Ptrstack[Sp] = ptr;
-			Mxstack[Sp] = mx;
-			Condstack[Sp] = cond;
-			for (i = 10*Sp, j = 0; j < 10; i++, j++) {
-				Argstack[i] = Args[j];
-				Args[j] = NULL;
-			}
-		   /*
-		    * Start new stack entry.
-		    */
-			mx = cmdx;
-			ptr = Macrotab[mx].bx;
-			cond = 0;
-			nleft = Macrotab[mx].ct;
-			Args[0] = Newstr(cmd);
-		   /*
-		    * Parse arguments.
-		    */
-			for (s1 = lp + cmdl + 1, nargs = 1; nargs < 10;) {
-				while (*s1 && (*s1 == ' ' || *s1 == '\t'))
-					s1++;
-				if (*s1 == '\0')
-					break;
-				if (*s1 == '"') {
-					s1++;
-					quote = 1;
-				} else
-					quote = 0;
-				for (s2 = buf;;) {
-				    if (!quote && (*s1 == ' ' || *s1 == '\t')) {
-					*s2 = '\0';
-					break;
-				    }
-				    if ((*s2 = *s1) == '\0')
-					break;
-				    s1++;
-				    if (quote && *s2 == '"') {
-					*s2 = '\0';
-					break;
-				    }
-				    s2++;
-			    	}
-				if (buf[0])
-					Args[nargs++] = Newstr(buf);
-			}
-			for (i = nargs; i < 10; i++) {
-				Args[i] = NULL;
-			}
-		}
-	    /*
-	     * Unstack completed macros.
-	     */
-		while (nleft <= 0 && Sp >= 0) {
-			nleft = Nleftstack[Sp];
-			mx = Mxstack[Sp];
-			ptr = Ptrstack[Sp];
-			cond = Condstack[Sp];
-			for (i = 10*Sp, j = 0, nargs = -1; j < 10; i++, j++) {
-				Free(&Args[j]);
-				if ((Args[j] = Argstack[i]) != NULL)
-					nargs = j;
-			}
-			Sp--;
-			nargs++;
-		}
-	    /*
-	     * Get next line.
-	     */
-		if (nleft > 0) {
-			lp = Macrotxt[ptr++];
-			nleft--;
-		} else
-			lp = (unsigned char *)"";
-	}
-	(void) sprintf((char *)buf, ".^# %d %s", NR, (char *)Inname);
-	Pass2(buf);
-}
Index: trunk/minix/commands/cawf/expr.c
===================================================================
--- trunk/minix/commands/cawf/expr.c	(revision 9)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- *	expr.c - expression support functions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-
-
-/*
- * Asmcode(s, c) - assemble number/name code following backslash-character
- *		   definition  - e. .g, "\\nPO"
- */
-
-unsigned char *
-Asmcode(s, c)
-	unsigned char **s;		/* pointer to character after '\\' */
-	unsigned char *c;		/* code destination (c[3]) */
-{
-	unsigned char *s1;
-
-	s1 = *s + 1;
-	c[0] = c[1] = c[2] = '\0';
-	if ((c[0] = *s1) == '(') {
-		s1++;
-		if ((c[0] = *s1) != '\0') {
-			s1++;
-			c[1] = *s1;
-		}
-	}
-	return(s1);
-}
-
-
-/*
- * Delnum(nx) - delete number
- */
-
-void
-Delnum(nx)
-	int nx;				/* number index */
-{
-	unsigned char buf[MAXLINE];	/* message buffer */
-
-	if (nx >= Nnr) {
-		(void) sprintf((char *)buf, " bad Delnum(%d) index", nx);
-		Error(FATAL, LINE, (char *)buf, NULL);
-	}
-	while (nx < (Nnr - 1)) {
-		Numb[nx] = Numb[nx + 1];
-		nx++;
-	}
-	Nnr--;
-}
-
-
-/*
- * Findnum(n, v, e) - find or optionally enter number value
- */
-
-Findnum(n, v, e)
-	unsigned char *n;		/* register name */
-	int v;				/* value */
-	int e;				/* 0 = find, don't enter
-					 * 1 = enter, don't find */
-{
-	int cmp, low, hi, mid;		/* binary search controls */
-	unsigned char c[3];		/* name buffer */
-
-	c[0] = n[0];
-	c[1] = (n[1] == ' ' || n[1] == '\t') ? '\0' : n[1];
-	c[2] = '\0';
-	low = mid = 0;
-	hi = Nnr - 1;
-	while (low <= hi) {
-		mid = (low + hi) / 2;
-		if ((cmp = strncmp((char *)c, (char *)Numb[mid].nm, 2)) < 0)
-			hi = mid - 1;
-		else if (cmp > 0)
-			low = mid + 1;
-		else {
-			if (e)
-				Numb[mid].val = v;
-			return(mid);
-		}
-	}
-	if ( ! e)
-		return(-1);
-	if (Nnr >= MAXNR)
-		Error(FATAL, LINE, " out of number registers at ", (char *)c);
-	if (Nnr) {
-		if (cmp > 0)
-			mid++;
-		for (hi = Nnr - 1; hi >= mid; hi--)
-			Numb[hi+1] = Numb[hi];
-	}
-	Nnr++;
-	Numb[mid].nm[0] = c[0];
-	Numb[mid].nm[1] = c[1];
-	Numb[mid].val = v;
-	return(mid);
-}
-
-
-/*
- * Findparms(n) - find parameter registers
- */
-
-Findparms(n)
-	unsigned char *n;		/* parameter name */
-{
-	unsigned char c[3];		/* character buffer */
-	int i;				/* temporary index */
-
-	c[0] = n[0];
-	c[1] = (n[1] == ' ' || n[1] == '\t') ? '\0' : n[1];
-	c[2] = '\0';
-	for (i = 0; Parms[i].nm[0]; i++) {
-		if (c[0] == Parms[i].nm[0] && c[1] == Parms[i].nm[1])
-			return(i);
-	}
-	return(-1);
-}
-
-
-/*
- * Findscale(n, v, e) - find and optionally enter scaling factor value
- */
-
-Findscale(n, v, e)
-	int n;				/* scaling factor name */
-	double v;			/* value */
-	int e;				/* 0 = find, don't enter
-					 * 1 = enter, don't find */
-{
-	int i;
-	double *pval;
-
-	for (i = 0; Scale[i].nm; i++) {
-		if ((unsigned char )n == Scale[i].nm)
-			break;
-	}
-	if (Scale[i].nm) {
-		if (e) {
-			pval = &Scale[i].val;
-			*pval = v;
-		}
-		return(i);
-	}
-	return(-1);
-}
Index: trunk/minix/commands/cawf/getopt.c
===================================================================
--- trunk/minix/commands/cawf/getopt.c	(revision 9)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
-Newsgroups: mod.std.unix
-Subject: public domain AT&T getopt source
-Date: 3 Nov 85 19:34:15 GMT
-
-Here's something you've all been waiting for:  the AT&T public domain
-source for getopt(3).  It is the code which was given out at the 1985
-UNIFORUM conference in Dallas.  I obtained it by electronic mail
-directly from AT&T.  The people there assure me that it is indeed
-in the public domain.
-*/
-
-
-/*LINTLIBRARY*/
-#define NULL	0
-#define EOF	(-1)
-#define ERR(s, c)	if(opterr){\
-	extern int strlen(), write();\
-	char errbuf[2];\
-	errbuf[0] = c; errbuf[1] = '\n';\
-	(void) write(2, argv[0], (unsigned)strlen(argv[0]));\
-	(void) write(2, s, (unsigned)strlen(s));\
-	(void) write(2, errbuf, 2);}
-
-extern int strcmp();
-extern char *strchr();
-
-int	opterr = 1;
-int	optind = 1;
-int	optopt;
-char	*optarg;
-
-int
-getopt(argc, argv, opts)
-int	argc;
-char	**argv, *opts;
-{
-	static int sp = 1;
-	register int c;
-	register char *cp;
-
-	if(sp == 1)
-		if(optind >= argc ||
-		   argv[optind][0] != '-' || argv[optind][1] == '\0')
-			return(EOF);
-		else if(strcmp(argv[optind], "--") == NULL) {
-			optind++;
-			return(EOF);
-		}
-	optopt = c = argv[optind][sp];
-	if(c == ':' || (cp=strchr(opts, c)) == NULL) {
-		ERR(": illegal option -- ", c);
-		if(argv[optind][++sp] == '\0') {
-			optind++;
-			sp = 1;
-		}
-		return('?');
-	}
-	if(*++cp == ':') {
-		if(argv[optind][sp+1] != '\0')
-			optarg = &argv[optind++][sp+1];
-		else if(++optind >= argc) {
-			ERR(": option requires an argument -- ", c);
-			sp = 1;
-			return('?');
-		} else
-			optarg = argv[optind++];
-		sp = 1;
-	} else {
-		if(argv[optind][++sp] == '\0') {
-			sp = 1;
-			optind++;
-		}
-		optarg = NULL;
-	}
-	return(c);
-}
Index: trunk/minix/commands/cawf/macsup.c
===================================================================
--- trunk/minix/commands/cawf/macsup.c	(revision 9)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- *	macsup.c - macro processing support functions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-
-
-/*
- * Delmacro(mx) - delete macro
- */
-
-Delmacro(mx)
-	int mx;				/* macro index */
-{
-	unsigned char buf[MAXLINE];	/* error message buffer */
-	int i, j;			/* temporary indexes */
-
-	if (mx >= Nmac) {
-		(void) sprintf((char *)buf, " bad Delmacro(%d) index", mx);
-		Error(FATAL, LINE, (char *)buf, NULL);
-	}
-	for (i = Macrotab[mx].bx, j = i + Macrotab[mx].ct; i < j; i++) {
-		Free(&Macrotxt[i]);
-	}
-	for (i = mx; i < (Nmac - 1); i++) {
-		Macrotab[i] = Macrotab[i+1];
-	}
-	Nmac--;
-}
-
-
-/*
- * Field(n, p, c) - skip to field n in p and optionally return a copy
- */
-
-unsigned char *
-Field(n, p, c)
-	int n;				/* field number */
-	unsigned char *p;		/* pointer to line containing fields */
-	int c;				/* 1: make a copy of the field */
-{
-	unsigned char *fs, *fe, *s;
-
-	if (c)
-		Free(&F);
-	fe = p;
-	while (n) {
-		while (*fe == ' ' || *fe == '\t')
-			fe++;
-		fs = fe;
-		while (*fe && *fe != ' ' && *fe != '\t')
-			fe++;
-		if (fs == fe)
-			return(NULL);
-		if (n == 1) {
-			if ( ! c)
-				return(fs);
-			if ((F = (unsigned char *)malloc((size_t)(fe - fs + 1)))
-			== NULL)
-				Error(FATAL, LINE, " Field out of string space",
-					NULL);
-			(void) strncpy((char *)F, (char *)fs, (fe - fs));
-			F[fe -fs] = '\0';
-			return(F);
-		}
-		n--;
-	}
-	return(NULL);
-}
-
-/*
- * Findmacro(p, e) - find macro and optionally enter it
- *
- * return = Macrotab[] index or -1 if not found
- */
-
-
-Findmacro(p, e)
-	unsigned char *p;	/* pointer to 2 character macro name  */
-	int e;			/* 0 = find, don't enter
-				 * 1 = enter, don't find */
-{
-	unsigned char c[3];
-	int cmp, hi, low, mid;
-
-	c[0] = p[0];
-	c[1] = (p[1] == ' ' || p[1] == '\t') ? '\0' : p[1];
-	c[2] = '\0';
-	low = mid = 0;
-	hi = Nmac - 1;
-	while (low <= hi) {
-		mid = (low + hi) / 2;
-		if ((cmp = strncmp((char *)c, (char *)Macrotab[mid].name, 2))
-		< 0)
-			hi = mid - 1;
-		else if (cmp > 0)
-			low = mid + 1;
-		else {
-			if ( ! e)
-				return(mid);
-			 Error(WARN, LINE, " duplicate macro ", (char *)c);
-			 hi = Macrotab[mid].bx + Macrotab[mid].ct;
-			 for (low = Macrotab[mid].bx; low < hi; low++) {
-				Free(&Macrotxt[low]);
-			 }
-			 goto new_macro;
-		}
-	}
-	if ( ! e)
-		return(-1);
-	if (Nmac >= MAXMACRO)
-		Error(FATAL, LINE, " macro table full at ", (char *)c);
-	if (Nmac) {
-		if (cmp > 0)
-			mid++;
-		for (hi = Nmac - 1; hi >= mid; hi--)
-			Macrotab[hi+1] = Macrotab[hi];
-	}
-	Nmac++;
-	Macrotab[mid].name[0] = c[0];
-	Macrotab[mid].name[1] = c[1];
-
-new_macro:
-
-	Macrotab[mid].bx = -1;
-	Macrotab[mid].ct = 0;
-	return(mid);
-}
-
-void
-Free(p)
-	unsigned char **p;
-{
-	if (*p != NULL) {
-		(void) free(*p);
-		*p = NULL;
-	}
-}
-
-/*
- * Newstr(s) - allocate space for string
- */
-
-unsigned char *
-Newstr(s)
-	unsigned char *s;
-{
-	unsigned char *ns;
-
-	if ((ns = (unsigned char *)malloc((size_t)(strlen((char *)s) + 1)))
-	== NULL)
-	    Error(FATAL, LINE, " Newstr out of malloc space at ", (char *)s);
-	(void) strcpy((char *)ns, (char *)s);
-	return(ns);
-}
Index: trunk/minix/commands/cawf/man.mac
===================================================================
--- trunk/minix/commands/cawf/man.mac	(revision 9)
+++ 	(revision )
@@ -1,180 +1,0 @@
-.^b HF 1
-.^b fh 1
-.\"-----------------
-.de TH
-.ds LH "\\$1(\\$2)
-.ds CH "Minix Programmer's Manual
-.ds RH "\\$1(\\$2)
-.ds LF "
-.ds CF "\\$3
-.ds RF "%
-..
-.\"-----------------
-.de AT
-..
-.\"-----------------
-.de IX
-..
-.\"-----------------
-.de NB
-.ds nb "\\$1
-.lF
-..
-.\"-----------------
-.de BY
-.ds by "\\$1
-.lF
-..
-.\"-----------------
-.de UC
-.BY "\\$1BSD"
-..
-.\"-----------------
-.\" common initialization for headers and paragraphs:  .In need
-.de In
-.ne \\$1
-.sp \\n(PDu
-.fi
-.in 0
-.ti 0
-.in \\n(inu
-.it
-.ft R
-.ns
-..
-.\"-----------------
-.de SH
-.In 6
-.in 0
-.ft B
-\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ft R
-.nr in 5n
-.in \\n(inu
-..
-.\"-----------------
-.de SS
-.In 6
-.in 2n
-.ft B
-\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ft R
-.in \\n(inu
-..
-.\"-----------------
-.de LP
-.In 4
-..
-.\"-----------------
-.de PP
-.LP
-..
-.\"-----------------
-.de P
-.LP
-..
-.\"-----------------
-.de HP
-.In 4
-.if \\n(.$>0 .ti 0-\\$1
-.if \\n(.$=0 .ti 0-\\n(tpu
-..
-.\"-----------------
-.de TP
-.In 4
-.if \\n(.$>0 .nr tp \\$1n
-.in \\n(inu+\\n(tpu
-.ti 0-\\n(tpu
-.it 1 tP
-..
-.\"-----------------
-.de IP
-.ie \\n(.$>1 .TP "\\$2"
-.el .TP
-\&\\$1
-..
-.\"-----------------
-.de I
-.ft I
-.it 1 fR
-.if \\n(.$>0 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"-----------------
-.de B
-.ft B
-.it 1 fR
-.if \\n(.$>0 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"-----------------
-.de SB
-.\" Can't reduce size, just do bold
-.ft B
-.it 1 fR
-.if \\n(.$>0 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"-----------------
-.de IR
-\&\\fI\\$1\\fR\\$2\\fI\\$3\\fR\\$4\\fI\\$5\\fR\\$6\\fI\\$7\\fR\\$8\\fI\\$9\\fR
-..
-.\"-----------------
-.de RI
-\&\\$1\\fI\\$2\\fR\\$3\\fI\\$4\\fR\\$5\\fI\\$6\\fR\\$7\\fI\\$8\\fR\\$9
-..
-.\"-----------------
-.de BR
-\&\\fB\\$1\\fR\\$2\\fB\\$3\\fR\\$4\\fB\\$5\\fR\\$6\\fB\\$7\\fR\\$8\\fB\\$9\\fR
-..
-.\"-----------------
-.de RB
-\&\\$1\\fB\\$2\\fR\\$3\\fB\\$4\\fR\\$5\\fB\\$6\\fR\\$7\\fB\\$8\\fR\\$9
-..
-.\"-----------------
-.de BI
-\&\\fB\\$1\\fI\\$2\\fB\\$3\\fI\\$4\\fB\\$5\\fI\\$6\\fB\\$7\\fI\\$8\\fB\\$9\\fR
-..
-.\"-----------------
-.de IB
-\&\\fI\\$1\\fB\\$2\\fI\\$3\\fB\\$4\\fI\\$5\\fB\\$6\\fI\\$7\\fB\\$8\\fI\\$9\\fR
-..
-.\"-----------------
-.de SM
-.\" no-op
-.if \\n(.$>0 \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"-----------------
-.de DT
-.ta +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8 +8
-..
-.\"-----------------
-.de TA
-.ta \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-..
-.\"-----------------
-.de RS
-.in +5n
-..
-.\"-----------------
-.de RE
-.in -5n
-..
-.de DS
-.br
-..
-.de DE
-.br
-..
-.\"-----------------
-.de PD
-.ie \\n(.$=0 .nr PD 0.3v
-.el .nr PD \\$1n
-..
-.\"-----------------
-.\" misc. initialization
-.nr tp 5n
-.PD
-.ds lq \&"
-.ds rq \&"
-.ds R \(rg
-.ds S "
-.ds Tm (TM)
-.nr )P 1v
Index: trunk/minix/commands/cawf/me.mac
===================================================================
--- trunk/minix/commands/cawf/me.mac	(revision 9)
+++ 	(revision )
@@ -1,199 +1,0 @@
-.^b HF 1
-.^b fh 0
-.^b NH
-.\"-----------------
-.de r
-.ie \\n(.$=0 .ft R
-.el \\fR\\$1\\fP\\$2
-..
-.\"-----------------
-.de i
-.ie \\n(.$=0 .ft I
-.el \\fI\\$1\\fP\\$2
-..
-.\"-----------------
-.de b
-.ie \\n(.$=0 .ft B
-.el \\fB\\$1\\fP\\$2
-..
-.\"-----------------
-.de UX
-\\$2UNIX\\$1
-..
-.\"-----------------
-.de DA
-.ds DY "\\$1 \\$2 \\$3
-.\" keep trailing spaces out of CF
-.if \\n(.$=1 .ds CF "\\$1
-.if \\n(.$=2 .ds CF "\\$1 \\$2
-.if \\n(.$>2 .ds CF "\\$1 \\$2 \\$3
-..
-.\"-----------------
-.de ND
-.\" it's our default, ignore it
-..
-.\"-----------------
-.de TL
-.rs
-.sp 5
-.ft B
-.ce 9999
-..
-.\"-----------------
-.de AU
-.sp 2
-.ft R
-..
-.\"-----------------
-.de AI
-.sp
-.ft R
-..
-.\"-----------------
-.de AB
-.sp 2
-.ce 0
-.ll -7n
-.in +7n
-..
-.\"-----------------
-.de AE
-.sp
-.ll
-.in
-..
-.\" common initialization for headers and paragraphs:  .In need extraspace
-.de In
-.ne \\$1
-.sp \\n(Tsu
-.nr Ts 0
-.ie \\n(.$>1 .nr iN \\$2v
-.el .nr iN 0
-.sp \\n(psu+\\n(iNu
-.ce 0
-.ft R
-.in 0
-.ti 0
-.in \\n(inu
-.ll \\n(LLu
-.ns
-.fi
-..
-.\"-----------------
-.de uh
-.\" unnumbered section head
-.nr in 0
-.In 6 1
-.ie \\n(.$=0 .ft B
-.el \\fB\\$1\\fP\\$2
-..
-.\"-----------------
-.de sh
-.\" numbered section head
-.nr in 0
-.In 6 1
-.ft B
-.\" punt to awk code to get the header numbering right
-.nH \\$1
-.\" and pick up the result
-\&\\*(Nh \\$2
-.ft R
-..
-.\"-----------------
-.de lp
-.\" left-blocked paragraph
-.In 4
-..
-.\"-----------------
-.de pp
-.\" paragraph, first line indented
-.In 4
-.ti \\n(piu
-..
-.\"-----------------
-.de tp
-.In 4
-.if \\n(.$>0 .nr tp \\$1n
-.in \\n(inu+\\n(tpu
-.ti 0-\\n(tpu
-.\" .it 1 tP
-..
-.\"-----------------
-.de ip
-.\" indented paragraph
-.ie \\n(.$>1 .tp "\\$2"
-.el .tp 4n
-\&\\$1
-..
-.\"-----------------
-.de np
-.\" numbered paragraph
-.nr $p +1			\" increment paragraph number
-.ip (\n($p)
-..
-.\"-----------------
-.de bu
-.\" bulleted paragraph
-.ip \(bu
-..
-.\"-----------------
-.de (q
-.\" begin major quote
-.nr in +5n
-.nr LL -5n
-.In 4
-..
-.\"-----------------
-.de )q
-.\" end major quote
-.sp
-.nr in -5n
-.nr LL +5n
-.In 4
-..
-.\"-----------------
-.de (l
-.\" begin list
-.In 5
-.if '\\$1'C' .ce 9999
-.if '\\$1'' .in +5n
-.if '\\$1'L' .in 0
-.nf
-..
-.\"-----------------
-.de )l
-.\" end list
-.In 3
-.sp
-.rs
-..
-.\"-----------------
-.de u
-\&\\fI$1\\fP
-..
-.\"-----------------
-.de sm
-..
-.\"-----------------
-.\" exdented paragraph macro borrowed from Berkeley -ms
-.de XP	
-.lp
-.in \\n(piu
-.ti
-..
-.\"-----------------
-.\" the -ms accent strings
-.ds ' "'\b
-.ds ` "`\b
-.ds : ":\b
-.ds ^ "^\b
-.ds ~ "~\b
-.ds C "v\b
-.ds , ",\b
-.\" post-title spacing (set to 4v if using .TL macro)
-.nr Ts 0v
-.\" and parameter setup
-.nr LL 6i
-.ll \n(LLu
-.nr ps 0.3v
-.nr pi 5n
Index: trunk/minix/commands/cawf/mnx.mac
===================================================================
--- trunk/minix/commands/cawf/mnx.mac	(revision 9)
+++ 	(revision )
@@ -1,137 +1,0 @@
-.\" -mnx macros for the Minix "Book manual pages".	Author: Kees J. Bot
-.\"								19 Nov 1994
-.\" Uses -ms:
-.so /usr/lib/cawf/ms.mac
-.tr ~
-.ds OQ \&'
-.ds CQ \&'
-.ds SQ \&'
-.ds M0 MINIX
-.ds M1 \\s-1MINIX\\s+1
-.ds M2 \\s-2MINIX\\s+2
-.ds M9 \\s-1MINIX\\s+1
-.ds m0 minix
-.de MX
-\s-2MINIX\s+2\\$1
-..
-.de Ux
-\s-2UNIX\s+2\\$1
-..
-.ds Mx \\s-1MINIX\\s0
-.ds Mp \\s-1MINIX-PC\\s0
-.ds Ms \\s-1MINIX-ST\\s0
-.ds M0 MINIX
-.ds M1 MINIX
-.ds M2 MINIX
-.ds M9 MINIX
-.ds Mx MINIX
-.ds Mp MINIX-PC
-.ds Ms MINIX-ST
-.de CD
-.LP
-.ne 2
-.ta 11m 15m 36m
-.ds SX Syntax:
-.ds FL Flags:
-.ds EX Examples:
-.ds EY Example:
-.in +16m
-.ti -16m
-\\fBCommand:\&	\\$1\\fR
-.in -16m
-.br
-..
-.de SX
-.in +16m
-.ti -16m
-\\fB\*(SX\&	\\$1
-.in -16m
-.ds SX
-.br
-..
-.de FL
-.in +15m
-.ti -15m
-\\fB\*(FL\&	\\fB\\$1	\\fR\\$2
-.in -15m
-.ds FL
-.br
-..
-.de EX
-.br
-.in +38m
-.ti -38m
-\\fB\*(EX\&	\\fR\\$1		\\fR# \\$2
-.in -38m
-.ds EX
-.ds EY
-.br
-..
-.de EY
-.br
-.in +38m
-.ti -38m
-\\fB\*(EY\&	\\fR\\$1		\\fR# \\$2
-.in -38m
-.ds EX
-.ds EY
-.br
-..
-.de Cx
-.in +8
-.ft B
-\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ft R
-.in -8
-..
-.de DI
-.ft B
-\&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
-.ft R
-..
-.de SY
-\\$3\\$1\\$2
-..
-.de HS
-.sp 0.5
-..
-.de SP
-.sp
-..
-.\"	Major section (normally numbered)
-.de SE
-.sp 1
-\fB\\$1\fP
-.sp 1
-..
-.\"	Subsection (normally numbered)
-.de SS
-.sp 1
-\fB\\$1\fP
-..
-.de UU
-.SH
-\\$1
-.sp 1
-..
-.\"	Start list
-.de LI
-.in +0.25i
-.ll -0.25i
-.HS
-..
-.\"	End list
-.de LX
-.sp 1
-.in -0.25i
-.ll +0.25i
-.LP
-..
-.\"	List item
-.de IT
-.HS
-..
-.\"Short unnumbered lines
-.de UN
-.HS
-..
Index: trunk/minix/commands/cawf/ms.mac
===================================================================
--- trunk/minix/commands/cawf/ms.mac	(revision 9)
+++ 	(revision )
@@ -1,210 +1,0 @@
-.^b HF 1
-.^b fh 0
-.^b NH
-.\"-----------------
-.de R
-.ie \\n(.$=0 .ft R
-.el \\fR\\$1\\fP\\$2
-..
-.\"-----------------
-.de I
-.ie \\n(.$=0 .ft I
-.el \\fI\\$1\\fP\\$2
-..
-.\"-----------------
-.de B
-.ie \\n(.$=0 .ft B
-.el \\fB\\$1\\fP\\$2
-..
-.\"-----------------
-.de UX
-\\$2UNIX\\$1
-..
-.\"-----------------
-.de DA
-.ds DY "\\$1 \\$2 \\$3
-.\" keep trailing spaces out of CF
-.if \\n(.$=1 .ds CF "\\$1
-.if \\n(.$=2 .ds CF "\\$1 \\$2
-.if \\n(.$>2 .ds CF "\\$1 \\$2 \\$3
-..
-.\"-----------------
-.de ND
-.\" it's our default, ignore it
-..
-.\"-----------------
-.de TL
-.rs
-.sp 5
-.ft B
-.ce 9999
-..
-.\"-----------------
-.de AU
-.sp 2
-.ft R
-..
-.\"-----------------
-.de AI
-.sp
-.ft R
-..
-.\"-----------------
-.de AB
-.sp 2
-.ce 0
-.ll -7n
-.in +7n
-..
-.\"-----------------
-.de AE
-.sp
-.ll
-.in
-..
-.\"-----------------
-.\" common initialization for headers and paragraphs:  .In need extraspace
-.de In
-.ne \\$1
-.sp \\n(Tsu
-.nr Ts 0
-.ie \\n(.$>1 .nr iN \\$2v
-.el .nr iN 0
-.sp \\n(PDu+\\n(iNu
-.ce 0
-.ft R
-.in 0
-.ti 0
-.in \\n(inu
-.ll \\n(LLu
-.ns
-.fi
-..
-.\"-----------------
-.de SH
-.nr in 0
-.In 6 1
-.ft B
-..
-.\"-----------------
-.de NH
-.nr in 0
-.In 6 1
-.ft B
-.\" punt to awk code to get the header numbering right
-.nH \\$1
-.\" and pick up the result
-\&\\*(Nh
-..
-.\"-----------------
-.de LP
-.In 4
-..
-.\"-----------------
-.de PP
-.In 4
-.ti \\n(PIu
-..
-.\"-----------------
-.de TP
-.In 4
-.if \\n(.$>0 .nr tp \\$1n
-.in \\n(inu+\\n(tpu
-.ti 0-\\n(tpu
-.it 1 tP
-..
-.\"-----------------
-.de IP
-.ie \\n(.$>1 .TP "\\$2"
-.el .TP 4n
-\&\\$1
-..
-.\"-----------------
-.de QP
-.In 4
-.in +5n
-.ll -5n
-..
-.\"-----------------
-.de QS
-.nr in +5n
-.nr LL -5n
-.In 4
-..
-.\"-----------------
-.de QE
-.nr in -5n
-.nr LL +5n
-.In 4
-..
-.\"-----------------
-.de DS
-.In 5
-.if '\\$1'C' .ce 9999
-.if '\\$1'' .in +5n
-.nf
-..
-.\"-----------------
-.de CD
-.In 5
-.ce 9999
-.nf
-..
-.\"-----------------
-.de LD
-.In 5
-.nf
-..
-.\"-----------------
-.de ID
-.In 5
-.in +5n
-.nf
-..
-.\"-----------------
-.de DE
-.In 3
-.rs
-..
-.\"-----------------
-.de RS
-.nr in +5n
-.in \\n(inu
-..
-.\"-----------------
-.de RE
-.nr in -5n
-.in \\n(inu
-..
-.\"-----------------
-.de UL
-\&\\fI$1\\fP
-..
-.\"-----------------
-.de RP
-..
-.\"-----------------
-.de LG
-..
-.\"-----------------
-.de SM
-..
-.\"-----------------
-.de NL
-..
-.\"-----------------
-.\" the -ms accent strings
-.ds ' "'\b
-.ds ` "`\b
-.ds : ":\b
-.ds ^ "^\b
-.ds ~ "~\b
-.ds C "v\b
-.ds , ",\b
-.\" post-title spacing
-.nr Ts 4v
-.\" and parameter setup
-.nr LL 6i
-.ll \n(LLu
-.nr PD 0.3v
-.nr PI 5n
Index: trunk/minix/commands/cawf/nreq.c
===================================================================
--- trunk/minix/commands/cawf/nreq.c	(revision 9)
+++ 	(revision )
@@ -1,880 +1,0 @@
-/*
- *	nreq.c - cawf(1) processing of nroff requests
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-#include <ctype.h>
-
-
-/*
- * Prototypes for request processing functions.
- */
-
-_PROTOTYPE(static void nr_UL,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_Ub,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_Uc,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_Uf,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_Ur,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_ad,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_bp,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_br,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_ce,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_di,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_ds,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_fi,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_fl,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_ft,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_it,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_na,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_nf,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_ns,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_rm,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_rn,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_rr,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_rs,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_tm,(unsigned char *line, int brk));
-_PROTOTYPE(static void nr_tr,(unsigned char *line, int brk));
-
-_PROTOTYPE(static void nr_nil,(unsigned char *line, int brk));
-
-
-/*
- * NrReqt[] - nroff request processing table
- *
- * CAUTION: place new entries in their proper alphabetical order, since
- *	    this table is processed with a binary search.
- */
-
-static struct nr_req {
-	char *nm;			/* nroff request */
-	void (*fun)();			/* processing function */
-} NrReqt[] = {
-	{ "\\\"",	nr_nil },	/* backslash-quote */
-	{ "^#",		nr_UL  },
-	{ "^=",		nr_UL  },
-	{ "^b",		nr_Ub  },
-	{ "^c",		nr_Uc  },
-	{ "^d",		nr_nil },
-	{ "^e",		nr_nil },
-	{ "^f",		nr_Uf  },
-	{ "^r",		nr_Ur  },
-	{ "^x",		nr_nil },
-	{ "ad",		nr_ad  },
-	{ "bp",		nr_bp  },
-	{ "br",		nr_br  },
-	{ "ce",		nr_ce  },
-	{ "di",		nr_di  },
-	{ "ds",		nr_ds  },
-	{ "fi",		nr_fi  },
-	{ "fl",		nr_fl  },
-	{ "ft",		nr_ft  },
-	{ "hy",		nr_nil },
-	{ "i0",		nr_nil },
-	{ "it",		nr_it  },
-	{ "lg",		nr_nil },
-	{ "li",		nr_nil },
-	{ "na",		nr_na  },
-	{ "nf",		nr_nf  },
-	{ "ns",		nr_ns  },
-	{ "ps",		nr_nil },
-	{ "rm",		nr_rm  },
-	{ "rn",		nr_rn  },
-	{ "rr",		nr_rr  },
-	{ "rs",		nr_rs  },
-	{ "tm",		nr_tm  },
-	{ "tr",		nr_tr  },
-	{ "vs",		nr_nil },
-};
-/*
- * Nreq(line, brk) - process miscellaneous nroff requests from line
- *		     buffer with request status of (brk)
- */
-
-void
-Nreq(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	unsigned char c[3];		/* command buffer */
-	int cmp, hi, low, mid;		/* binary search indixes */
-
-	c[0] = c[1] = c[2] = '\0';
-	if ((c[0] = line[1]) != '\0')
-		c[1] = line[2];
-
-	low = mid = 0;
-	hi = sizeof(NrReqt) / sizeof(struct nr_req);
-	while (low <= hi) {
-		mid = (low + hi) / 2;
-		if ((cmp = strcmp((char *)c, NrReqt[mid].nm)) < 0)
-			hi = mid - 1;
-		else if (cmp > 0)
-			low = mid + 1;
-		else {
-			(void) (*NrReqt[mid].fun)(line, brk);
-			return;
-		}
-	}
-    /*
-     * Unknown request starting with a '.' or '\''..
-     */
-	Error(WARN, LINE, " unknown request", NULL);
-}
-
-
-/*
- * Adjust - "^[.']ad"
- */
-
-static void
-nr_ad(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(NOBREAK, (unsigned char *)"both", NULL, 0);
-}
-
-
-/*
-* Begin new page - "^[.']bp"
-*/
-
-static void
-nr_bp(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(brk, (unsigned char *)"need", NULL, 999);
-}
-
-
-/*
-* Break - "^[.']br"
-*/
-
-static void
-nr_br(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(brk, (unsigned char *)"flush", NULL, 0);
-}
-
-
-/*
- * Center - "^[.']ce"
- */
-
-static void
-nr_ce(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	unsigned char *s;			/* string poiner */
-
-	if ((s = Field(2, line, 0)) != NULL)
-		Centering = atoi((char *)s);
-	else
-		Centering = 1;
-}
-
-
-/*
- * Diversion on and off - "^[.']di"
- */
-
-static void
-nr_di(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(DOBREAK, (unsigned char *)"flush", NULL, 0);
-	Divert ^= 1;
-}
-
-
-/*
- * Define string - "^[.']ds"
- */
-
-static void
-nr_ds(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	unsigned char buf[MAXLINE];	/* temporary buffer */
-	unsigned char nm[4], nm1[4];	/* name buffers */
-	unsigned char *s1, *s2, *s3,	/* temporary string pointers */
-		       *s4;
-
-	if (Asmname(&line[3], nm) == 0) {
-		Error(WARN, LINE, " no name", NULL);
-		return;
-	}
-	s1 = Field(3, line, 0);
-	s2 = Findstr(nm, s1, 1);
-	while (*s2 == '\\' && *(s2 + 1) == '*') {
-		s2++;
-		s3 = Asmcode(&s2, nm1);
-		s2 = Findstr(nm1, NULL, 0);
-	}
-	if (Hdft) {
-
-	/*
-	 * Look for names LH, LF, CH, CF, RH, RF.
-	 */
-		if ((nm[0]=='L' || nm[0]=='C' || nm[0]=='R')
-		&&  (nm[1]=='F' || nm[1]=='H')) {
-			(void) sprintf((char *)buf, "%s", (char *)nm);
-			Pass3(NOBREAK, buf, s2, 0);
-		}
-	}
-}
-
-
-
-/*
- * Fill - "^[.']fi"
- */
-
-static void
-nr_fi(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Fill = 1;
-	Pass3(brk, (unsigned char *)"flush", NULL, 0);
-}
-
-
-/*
- * Flush - "^[.']fl"
- */
-
-static void
-nr_fl(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(brk, (unsigned char *)"flush", NULL, 0);
-}
-
-
-/*
- * Font - "^[.']ft <font_name>"
- */
-
-static void
-nr_ft(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	int i;				/* temporary index */
-
-	if (line[3] == '\0' || line[4] == '\0')
-		line[4] = 'P';
-	if (line[4] == 'P') {
-		Font[0] = Prevfont;
-		return;
-	}
-	for (i = 0; Fcode[i].nm; i++) {
-		if (Fcode[i].nm == line[4])
-		break;
-	}
-	if (Fcode[i].status == '\0') {
-		Error(WARN, LINE, " bad font code", NULL);
-		return;
-	}
-	Prevfont = Font[0];
-	Font[0] = line[4];
-}
-
-
-/*
- * Input trap - "^[.']it [1 <request>]"
- */
-
-static void
-nr_it(line, brk)
-	unsigned char *line;
-	int brk;
-
-{
-	unsigned char buf[MAXLINE];	/* temporary buffer */
-	int i;				/* temporary index */
-	unsigned char *s1, *s2;		/* temporary string pointers */
-
-	if ((s1 = Field(2, line, 0)) == NULL) {
-		Free(&Aftnxt);
-		return;
-	}
-	if ((i = atoi((char *)s1)) != 1) {
-		Error(WARN, LINE, " first .it arg must be 1", NULL);
-		return;
-	}
-	if ((s2 = Field(3, line, 0)) == NULL)
-		Free(&Aftnxt);
-	else {
-		(void) sprintf((char *)buf, "%s,%s",
-			(Aftnxt == NULL) ? "" : (char *)Aftnxt,
-			(char *)s2);
-		Free(&Aftnxt);
-		Aftnxt = Newstr(buf);
-	}
-}
-
-
-/*
- * Comment - "^[.']\\" - do nothing
- *
- * Debug - "^[.']\^d" - do nothing
- *
- * Finalization - "[.']\^e" - do nothing
- *
- * Error file - "^[.']\^x <name>" - do nothing
- *
- * "^[.']i0", "^[.']lg" and "^[.']li" - do nothing
- *
- * Point size - "^[.']ps" - do nothing
- *
- * Vertical spacing - "^[.']vs" - do nothing
- *
- */
-
-static void
-nr_nil(line, brk)
-	unsigned char *line;
-	int brk;
-{
-}
-
-
-/*
- * No adjust "^[.']na"
- */
-
-static void
-nr_na(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(NOBREAK, (unsigned char *)"left", NULL, 0);
-}
-
-
-/*
- * No fill - "^[.']nf"
- */
-
-static void
-nr_nf(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Fill = 0;
-	Pass3(brk, (unsigned char *)"flush", NULL, 0);
-}
-
-
-/*
- * No space - "^[.']ns"
- */
-
-static void
-nr_ns(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(NOBREAK, (unsigned char *)"nospace", NULL, 0);
-}
-
-
-/*
- * Remove macro or string - "^[.']rm"
- */
-
-static void
-nr_rm(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	int i;				/* temporary index */
-	unsigned char nm[4];		/* name buffer */
-
-	if (Asmname(&line[3], nm) == 0) {
-		Error(WARN, LINE, " no name", NULL);
-		return;
-	}
-	if ((i = Findmacro(nm, 0)) >= 0) {
-		Delmacro(i);
-		return;
-			}
-	(void) Findstr(nm, NULL, 0);
-		if (Sx >= 0) {
-			Delstr(Sx);
-			return;
-	}
-	Error(WARN, LINE, " no macro/string", NULL);
-}
-
-
-/*
- * Rename macro or string - "^[.']rn"
- */
-
-static void
-nr_rn(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	int i, j;			/* temporary indexes */
-	unsigned char nm[4], nm1[4];	/* name buffers */
-	unsigned char *s1;		/* temporary string pointer */
-
-	if ((s1 = Field(2, line, 0)) == NULL ||  Asmname(s1, nm) == 0) {
-		Error(WARN, LINE, " no name", NULL);
-		return;
-	}
-	if ((s1 = Field(3, line, 0)) == NULL ||  Asmname(s1, nm1) == 0) {
-		Error(WARN, LINE, " no new name", NULL);
-		return;
-	}
-	if ((i = Findmacro(nm, 0)) >= 0) {
-		if ((j = Findmacro(nm1, 0)) >= 0)
-			Delmacro(j);
-		j = Findmacro(nm1, 1);
-		Macrotab[j].bx = Macrotab[i].bx;
-		Macrotab[i].bx = -1;
-		Macrotab[j].ct = Macrotab[i].ct;
-		Macrotab[i].ct = 0;
-		Delmacro(i);
-		return;
-	}
-	(void) Findstr(nm, NULL, 0);
-	if ((i = Sx) >= 0) {
-		(void) Findstr(nm1, Str[i].str, 1);
-		Delstr(i);
-		return;
-	}
-	if (Findmacro(nm1, 0) < 0)
-		(void) Findmacro(nm1, 1);
-}
-
-
-/*
- * Remove register - "^[.']rr"
- */
-
-static void
-nr_rr(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	int i;				/* temporary index */
-	unsigned char nm[4];		/* name buffer */
-
-	if (Asmname(&line[3], nm) == 0) {
-		Error(WARN, LINE, " no name", NULL);
-		return;
-	}
-	if ((i = Findnum(nm, 0, 0)) < 0) {
-		Error(WARN, LINE, " no register", NULL);
-		return;
-	}
-	Delnum(i);
-}
-
-
-/*
- * Resume space - "^[.']rs"
- */
-
-static void
-nr_rs(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(NOBREAK, (unsigned char *)"yesspace", NULL, 0);
-}
-
-
-/*
- * Message - "^[.']tm"
- */
-
-static void
-nr_tm(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	Pass3(MESSAGE, Inname, (line[3] == ' ') ? &line[4] : &line[3], NR);
-}
-
-
-/*
- * Translate - "^[.']tr abcd..."
- */
-
-static void
-nr_tr(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	unsigned char buf[MAXLINE];	/* temporary buffer */
-	int i, j;			/* temporary indexes */
-	unsigned char nm[4], nm1[4];	/* name buffers */
-	unsigned char *s1, *s2;		/* temporary string pointers */
-	int trin, trout;		/* types: 0 = char; 1 = named char */
-	unsigned char xbuf[MAXLINE];	/* temporary buffer */
-
-	if (line[3] != ' ') {
-		Error(WARN, LINE, " unknown translation", NULL);
-		return;
-	}
-	for (s1 = &line[4]; *s1;) {
-	    nm[1] = nm[2] = '\0';
-	    s2 = s1 + 1;
-	/*
-	 * Assemble the input value.
-	 */
-	    if (*s1 == '\\' && (*s2 == '*' || *s2 == '(')) {
-		if (*s2 == '(') {
-	    /*
-	     * Input is named character -- "\(xx".
-	     */
-		    trin = 1;
-		    s1 = s2 + 1;
-		    if ((nm[0] = *s1) != '\0') {
-			s1++;
-			if ((nm[1] = *s1) != '\0')
-			    s1++;
-		    }
-		} else {
-	    /*
-	     * Input is interpolated string -- "\*x" or "\*(xx".
-	     */
-		    s1 = Asmcode(&s2, nm);
-		    if (*s1)
-			s1++;
-		    s2 = Findstr(nm, NULL, 0);
-		    if (*s2 != '\0') {
-			if ((strlen((char *)s2) + strlen((char *)s1) + 1)
-			>= MAXLINE)
-			    Error(WARN, LINE, " string too long: ", (char *)nm);
-			else {
-			    (void) sprintf((char *)buf, "%s%s",
-				(char *)s2, (char *)s1);
-			    (void) strcpy((char *)xbuf, (char *)buf);
-			    s1 = xbuf;
-			}
-		    }
-		    continue;
-		}
-	    } else {
-
-	    /*
-	     * Input is a simple character.
-	     */
-		trin = 0;
-		if ((nm[0] = *s1) != '\0')
-		    s1++;
-	    }
-	/*
-	 * Assemble the output value.
-	 */
-
-assemble_output:
-	    nm1[1] = nm1[2] = '\0';
-	    if (*s1 == '\0') {
-
-	    /*
-	     * Supply a space if there is no output character.
-	     */
-		trout = 0;
-		nm1[0] = ' ';
-	    } else {
-		s2 = s1 + 1;
-		if (*s1 == '\\' && (*s2 == '(' || *s2 == '*')) {
-		    if (*s2 == '(') {
-		/*
-		 * The output is a named character -- "\(xx".
-		 */
-			trout = 1;
-			s1 = s2 + 1;
-			if ((nm1[0] = *s1) != '\0') {
-			    s1++;
-			    if ((nm1[1] = *s1) != '\0')
-				s1++;
-			}
-		    } else {
-		/*
-		 * The output is an interpolated string -- * "\*x" or "\*(xx".
-		 */
-			s1 = Asmcode(&s2, nm1);
-			if (*s1)
-			    s1++;
-			s2 = Findstr(nm1, NULL, 0);
-			if (*s2 != '\0') {
-		    /*
-		     * Interpolate a string value.
-		     */
-			    if ((strlen((char *)s2) + strlen((char *)s1) + 1)
-			    >= MAXLINE)
-				Error(WARN, LINE, " string too long: ",
-				    (char *)nm);
-			    else {
-				(void) sprintf((char *)buf, "%s%s", (char *)s2,
-				    (char *)s1);
-				(void) strcpy((char *)xbuf, (char *)buf);
-			        s1 = xbuf;
-			    }
-			}
-			goto assemble_output;
-		    }
-		} else {
-		    trout = 0;
-		    if ((nm1[0] = *s1) != '0')
-			s1++;
-		    else
-			nm1[0] = ' ';
-		}
-	    }
-	/*
-	 * Do the translation.
-	 */
-	    switch (trin) {
-
-	    case 0:			/* simple char */
-		switch (trout) {
-
-		case 0:			/* to simple char */
-		    Trtbl[(int)nm[0]] = nm1[0];
-		    break;
-		case 1:			/* to named char */
-		    if ((i = Findchar(nm1, 0, NULL, 0)) < 0
-		    ||  strlen((char *)Schar[i].str) != 1)
-			Error(WARN, LINE, " bad named character: ",
-			    (char *)nm1);
-		    else
-			Trtbl[(int)nm[0]] = *(Schar[i].str);
-		    break;
-		}
-		break;
-	    case 1:			/* named char */
-		if ((i = Findchar(nm, 0, NULL, 0)) < 0)
-		    Error(WARN, LINE, " unknown named character: ", (char *)nm);
-		else {
-		    switch (trout) {
-
-		    case 0:		/* to simple char */
-			Free(&Schar[i].str);
-			Schar[i].str = Newstr(nm1);
-			Schar[i].len = 1;
-			break;
-		    case 1:		/* to named char */
-			if ((j = Findchar(nm1, 0, NULL, 0)) < 0)
-			    Error(WARN, LINE, " unknown named character: ",
-				(char *)nm1);
-			else
-			    (void) Findchar(nm, Schar[j].len, Schar[j].str, 1);
-			break;
-		    }
-		}
-		break;
-	    }
-	}
-}
-
-
-/*
- * Initialization - "^[.']\^b (fh|HF|NH) [01]"
- *
- * fh = first page header status
- * HF = header/footer status
- * NH = initialize number headers
- */
-
-static void
-nr_Ub(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	int i;				/* temporary index */
-	unsigned char *s1, *s2;		/* temporary string pointers */
-
-	if ((s1 = Field(2, line, 0)) == NULL)
-		return;
-	if ((s2 = Field(3, line, 0)) == NULL)
-		i = 0;
-	else
-		i = atoi((char *)s2);
-	if (s1[0] == 'f' && s1[1] == 'h')
-		Pass3(NOBREAK, (unsigned char *)"fph", NULL, i);
-	else if (s1[0] == 'H' && s1[1] == 'F')
-		Hdft = i;
-	else if (s1[0] == 'N' && s1[1] == 'H') {
-		for (i = 0; i < MAXNHNR; i++)
-			Nhnr[i] = 0;
-	} else
-		Error(WARN, LINE, " unknown initialization", NULL);
-}
-
-
-/*
- * Character definitions - "^[.']\^c"
- */
-
-static void
-nr_Uc(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	unsigned char buf[MAXLINE];	/* temporary buffer */
-	int i;				/* temporary index */
-	unsigned char *s1, *s2, *s3,	/* temporary string pointers */
-		      *s4, *s5;
-
-	s2 = Field(2, line, 0);
-	i = atoi((char *)Field(3, line, 0));
-	s4 = Field(4, line, 0);
-	if (i < 0 || i > MAXLINE/2 || *s2 == '\0') {
-		Error(WARN, LINE, " bad character definition", NULL);
-		return;
-	}
-	if (s4 == NULL)
-		s4 = (unsigned char *)"";
-	else if (*s4 == '"')
-		s4++;
-	s1 = buf;
-	while ((s5 = (unsigned char *)strchr((char *)s4, '\\')) != NULL) {
-		while (s5 > s4)
-			*s1++ = *s4++;
-		s4 = ++s5;
-		if (*s5 == '\\')
-			*s1++ = '\\';
-		else if (*s5 == 'b')
-			*s1++ = '\b';
-		if (*s4)
-			s4++;
-	}
-	while (*s1++ = *s4++)
-		;
-	if (*s2 == 'h' && *(s2+1) == 'y')
-		(void) Findhy(buf, i, 1);
-	else
-		(void) Findchar(s2, i, buf, 1);
-}
-
-
-/*
- * Font is OK - "[.']\^f <font_name_character>"
- */
-
-static void
-nr_Uf(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	int i;				/* temporary index */
-
-	if (line[3] != '\0' && line[4] != '\0') {
-		for (i = 0; Fcode[i].nm; i++) {
-			if (line[4] == Fcode[i].nm) {
-				Fcode[i].status = '1';
-				return;
-			}
-		}
-	}
-	Error(WARN, LINE, " unknown font", NULL);
-}
-
-
-/*
- * Resolutions - "[.']\^r cpi horizontal vertical"
- */
-
-static void
-nr_Ur(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	unsigned char buf[MAXLINE];	/* temporary buffer */
-	int i, j;			/* temporary indexes */
-	double tval;			/* temporary value */
-
-	if ((i = atoi((char *)Field(3, line, 0))) <= 0
-	||  (j = atoi((char *)Field(4, line, 0))) <= 0) {
-		Error(WARN, LINE, " bad cpi resolutions", NULL);
-		return;
-	}
-	tval = (double) (240.0 / (double) i);
-	if (Findscale((int)'m', tval, 1) < 0)
-		Error(FATAL, LINE, " missing Scal['m']", NULL);
-	Scalen = tval;
-	if (Scalen <= 0.0) {
-		(void) sprintf((char *)buf, " bad Scale['n'] (%f)", Scalen);
-		Error(FATAL, LINE, (char *)buf, NULL);
-	}
-	if (Findscale((int)'n', tval, 1) < 0)
-		Error(FATAL, LINE, " missing Scale['n']", NULL);
-	Scalev = (double) (240.0 / (double) j);
-	if (Scalev <= 0.0) {
-		(void) sprintf((char *)buf, " bad Scale['v'] (%f)", Scalen);
-		Error(FATAL, LINE, (char *)buf, NULL);
-	}
-	if (Findscale((int)'v', Scalev, 1) < 0)
-		Error(FATAL, LINE, " missing Scale['v']", NULL);
-}
-
-
-/*
- * Set line number and file name - "^[.']\^# <number> <file>"
- *
- * Lock line number and file name - "^[.']\^= <number> <file>"
- */
-
-static void
-nr_UL(line, brk)
-	unsigned char *line;
-	int brk;
-{
-	unsigned char *s1;		/* temporary string pointer */
-
-	if ((s1 = Field(2, line, 0)) != NULL)
-		P2il = atoi((char *)s1) - 1;
-	else
-		P2il = 0;
-	Lockil = (line[2] == '#') ? 0 : 1;
-	Free(&P2name);
-	if (Field(3, line, 1) != NULL) {
-		P2name = F;
-		F = NULL;
-	} else
-		P2name = NULL;
-}
Index: trunk/minix/commands/cawf/output.c
===================================================================
--- trunk/minix/commands/cawf/output.c	(revision 9)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- *	output-c - output support functions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-
-
-/*
- * LenprtHF(s, p, t) - get length of print header or footer with page number
- *		       interpolation
- */
-
-LenprtHF(s, p, t)
-	unsigned char *s;		/* header/footer string */
-	int p;				/* page number */
-	int t;				/* type: 0 = get interpolated length
-					 *	 1 = print */
-{
-	unsigned char buf[10];		/* buffer for page number */
-	int len;			/* line length */
-	unsigned char *s1;		/* temporary string pointer */
-	
-	if (s == NULL)
-		return(0);
-	for (len = 0; *s && *s != '%'; s++) {
-		len++;
-		if (t)
-			Charput((int)*s);
-	}
-	if (*s) {
-		(void) sprintf((char *)buf, "%d", p);
-		for (s1 = buf; *s1; s1++) {
-			len++;
-			if (t)
-				Charput((int)*s1);
-		}
-		for (s++; *s; s++) {
-			len++;
-			if (t)
-				Charput((int)*s);
-		}
-	}
-	return(len);
-}
-
-
-/*
- * Charput(s) - put a character to output, subject to diversion
- */
-
-void
-Charput(c)
-	int c;			/* character to put */
-{
-	if (Divert == 0)
-		putchar((unsigned char)c);
-}
-
-
-/*
- * Stringput(s) - put a string to output, subject to diversion
- */
-
-void
-Stringput(s)
-	unsigned char *s;	/* string to put */
-{
-	if (Divert == 0)
-		fputs((char *)s, stdout);
-}
Index: trunk/minix/commands/cawf/pass2.c
===================================================================
--- trunk/minix/commands/cawf/pass2.c	(revision 9)
+++ 	(revision )
@@ -1,842 +1,0 @@
-/*
- *	pass2.c - cawf(1) pass 2 function
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-#include <ctype.h>
-
-/*
- * Pass2(line) - process the nroff requests in a line and break
- *		 text into words for pass 3
- */
-
-void
-Pass2(line)
-	unsigned char *line;
-{
-	int brk;			/* request break status */
-	unsigned char buf[MAXLINE];	/* working buffer */
-	unsigned char c;		/* character buffer */
-	double d;			/* temporary double */
-	double exscale;			/* expression scaling factor */
-	double expr[MAXEXP];            /* expressions */
-	unsigned char exsign[MAXEXP];	/* expression signs */
-	int i, j;			/* temporary indexes */
-	int inword;			/* word processing status */
-	int nexpr;			/* number of expressions */
-	unsigned char nm[4], nm1[4];	/* names */
-	int nsp;			/* number of spaces */
-	unsigned char op;		/* expression term operator */
-	unsigned char opstack[MAXSP];	/* expression operation stack */
-	unsigned char period;		/* end of word status */
-	unsigned char *s1, *s2, *s3;	/* temporary string pointers */
-	double sexpr[MAXEXP];           /* signed expressions */
-	int sp;				/* expression stack pointer */
-	unsigned char ssign;		/* expression's starting sign */
-	int tabpos;			/* tab position */
-	double tscale;			/* term scaling factor */
-	double tval;			/* term value */
-	double val;			/* term value */
-	double valstack[MAXSP];		/* expression value stack */
-	unsigned char xbuf[MAXLINE];	/* expansion buffer */
-
-	if (line == NULL) {
-    /*
-     * End of macro expansion.
-     */
-		Pass3(DOBREAK, (unsigned char *)"need", NULL, 999);
-		return;
-	}
-    /*
-     * Adjust line number.
-     */
-	if (Lockil == 0)
-		P2il++;
-    /*
-     * Empty line - "^[ \t]*$" or "^\\\"".
-     */
-	if (regexec(Pat[6].pat, line)
-	||  strncmp((char *)line, "\\\"", 2) == 0) {
-		Pass3(DOBREAK, (unsigned char *)"space", NULL, 0);
-		return;
-	}
-    /*
-     * Line begins with white space.
-     */
-	if (*line == ' ' || *line == '\t') {
-		Pass3(DOBREAK, (unsigned char *)"flush", NULL, 0);
-		Pass3(0, (unsigned char *)"", NULL, 0);
-	}
-	if (*line != '.' && *line != '\'') {
-    /*
-     * Line contains text (not an nroff request).
-     */
-		if (Font[0] == 'R' && Backc == 0 && Aftnxt == NULL
-		&&  regexec(Pat[7].pat, line) == 0) {
-		    /*
-		     * The font is Roman, there is no "\\c" or "after next"
-		     * trap pending and and the line has no '\\', '\t', '-',
-		     * or "  "  (regular expression "\\|\t|-|  ").
-		     *
-		     * Output each word of the line as "<length> <word>".
-		     */
-			for (s1 = line;;) {
-				while (*s1 && *s1 == ' ')
-					s1++;
-				if (*s1 == '\0')
-					break;
-				for (s2 = s1, s3 = buf; *s2 && *s2 != ' ';)
-				    *s3++ = Trtbl[(int)*s2++];
-				*s3 = '\0';
-				Pass3((s2 - s1), buf, NULL, 0);
-				s1 = *s2 ? ++s2 : s2;
-			}
-		    /*
-		     * Line terminates with punctuation and optional
-		     * bracketing (regular expression "[.!?:][\])'\"*]*$").
-		     */
-			if (regexec(Pat[8].pat, line))
-				Pass3(NOBREAK, (unsigned char *)"gap", NULL, 2);
-			if (Centering > 0) {
-				Pass3(DOBREAK,(unsigned char *)"center", NULL,
-					0);
-				Centering--;
-			} else if (Fill == 0)
-				Pass3(DOBREAK, (unsigned char *)"flush", NULL,
-					0);
-			return;
-		}
-	    /*
-	     * Line must be scanned a character at a time.
-	     */
-		inword = nsp = tabpos = 0;
-		period = '\0';
-		for (s1 = line;; s1++) {
-		    /*
-		     * Space or TAB causes state transition.
-		     */
-			if (*s1 == '\0' || *s1 == ' ' || *s1 == '\t') {
-				if (inword) {
-					if (!Backc) {
-						Endword();
-						Pass3(Wordl, Word, NULL, 0);
-						if (Uhyph) {
-						  Pass3(NOBREAK,
-						    (unsigned char *)"nohyphen",
-						    NULL, 0);
-						}
-					}
-					inword = 0;
-					nsp = 0;
-				}
-				if (*s1 == '\0')
-					break;
-			} else {
-				if (inword == 0) {
-					if (Backc == 0) {
-						Wordl = Wordx = 0;
-						Uhyph = 0;
-					}
-					Backc = 0;
-					inword = 1;
-					if (nsp > 1) {
-						Pass3(NOBREAK,
-						    (unsigned char *)"gap",
-						    NULL, nsp);
-					}
-				}
-			}
-		    /*
-		     * Process a character.
-		     */
-			switch (*s1) {
-		    /*
-		     * Space
-		     */
-	     		case ' ':
-				nsp++;
-				period = '\0';
-				break;
-		    /*
-		     * TAB
-		     */
-	     		case '\t':
-				tabpos++;
-				if (tabpos <= Ntabs) {
-					Pass3(NOBREAK,
-					    (unsigned char *)"tabto", NULL,
-					    Tabs[tabpos-1]);
-				}
-				nsp = 0;
-				period = '\0';
-				break;
-		    /*
-		     * Hyphen if word is being assembled
-		     */
-			case '-':
-				if (Wordl <= 0)
-				    goto ordinary_char;
-				if ((i = Findhy(NULL, 0, 0)) < 0) {
-				    Error(WARN, LINE, " no hyphen for font ",
-					(char *)Font);
-				    return;
-				}
-				Endword();
-				Pass3(Wordl, Word, NULL, Hychar[i].len);
-				Pass3(NOBREAK, (unsigned char *)"userhyphen",
-				    Hychar[i].str, Hychar[i].len);
-				Wordl = Wordx = 0;
-				period = '\0';
-				Uhyph = 1;
-				break;
-		    /*
-		     * Backslash
-		     */
-			case '\\':
-				s1++;
-				switch(*s1) {
-			    /*
-			     * Comment - "\\\""
-			     */
-				case '"':
-					while (*(s1+1))
-						s1++;
-					break;
-			    /*
-			     * Change font - "\\fN"
-			     */
-				case 'f':
-					s1 = Asmcode(&s1, nm);
-					if (nm[0] == 'P') {
-					    Font[0] = Prevfont;
-					    break;
-					}
-					for (i = 0; Fcode[i].nm; i++) {
-					    if (Fcode[i].nm == nm[0])
-						break;
-					}
-					if (Fcode[i].nm == '\0'
-					||  nm[1] != '\0') {
-					    Error(WARN, LINE, " unknown font ",
-					    	(char *)nm);
-					    break;
-					}
-					if (Fcode[i].status != '1') {
-					    Error(WARN, LINE,
-						" font undefined ", (char *)nm);
-					    break;
-					} else {
-					    Prevfont = Font[0];
-					    Font[0] = nm[0];
-					}
-					break;
-			    /*
-			     * Positive horizontal motion - "\\h\\n(NN" or
-			     * "\\h\\nN"
-			     */
-				case 'h':
-					if (s1[1] != '\\' || s1[2] != 'n') {
-					    Error(WARN, LINE,
-						" no \\n after \\h", NULL);
-					    break;
-					}
-					s1 +=2;
-					s1 = Asmcode(&s1, nm);
-					if ((i = Findnum(nm, 0, 0)) < 0)
-						goto unknown_num;
-					if ((j = Numb[i].val) < 0) {
-					    Error(WARN, LINE, " \\h < 0 ",
-					    NULL);
-					    break;
-					}
-					if (j == 0)
-						break;
-					if ((strlen((char *)s1+1) + j + 1)
-					>=  MAXLINE)
-						goto line_too_long;
-					for (s2 = &xbuf[1]; j; j--)
-						*s2++ = ' ';
-					(void) strcpy((char *)s2, (char *)s1+1);
-					s1 = xbuf;
-					break;
-			    /*
-			     * Save current position in register if "\\k<reg>"
-			     */
-			        case 'k':
-					s1 = Asmcode(&s1, nm);
-					if ((i = Findnum(nm, 0, 0)) < 0)
-					    i = Findnum(nm, 0, 1);
-					Numb[i].val =
-						(int)((double)Outll * Scalen);
-					break;
-			    /*
-			     * Interpolate number - "\\n(NN" or "\\nN"
-			     */
-				case 'n':
-					s1 = Asmcode(&s1, nm);
-					if ((i = Findnum(nm, 0, 0)) < 0) {
-unknown_num:
-					    Error(WARN, LINE,
-					        " unknown number register ",
-						(char *)nm);
-					    break;
-					}
-					(void) sprintf((char *)buf, "%d",
-					    Numb[i].val);
-					if ((strlen((char *)buf)
-					   + strlen((char *)s1+1) + 1)
-					>=  MAXLINE) {
-line_too_long:
-					    Error(WARN, LINE, " line too long",
-					        NULL);
-					    break;
-					}
-					(void) sprintf((char *)buf, "%d%s",
-					    Numb[i].val, (char *)s1+1);
-					(void) strcpy((char *)&xbuf[1],
-						(char *)buf);
-				        s1 = xbuf;
-					break;
-			    /*
-			     * Change size - "\\s[+-][0-9]" - NOP
-			     */
-				case 's':
-					s1++;
-					if (*s1 == '+' || *s1 == '-')
-						s1++;
-					while (*s1 && isdigit(*s1))
-						s1++;
-					s1--;
-					break;
-			    /*
-			     * Continue - "\\c"
-			     */
-				case 'c':
-					Backc = 1;
-					break;
-			    /*
-			     * Interpolate string - "\\*(NN" or "\\*N"
-			     */
-				case '*':
-					s1 = Asmcode(&s1, nm);
-					s2 = Findstr(nm, NULL, 0);
-					if (*s2 != '\0') {
-					    if ((strlen((char *)s2)
-					       + strlen((char *)s1+1) + 1)
-					    >=  MAXLINE)
-						goto line_too_long;
-					    (void) sprintf((char *)buf, "%s%s",
-						(char *)s2, (char *)s1+1);
-					    (void) strcpy((char *)&xbuf[1],
-						(char *)buf);
-					    s1 = xbuf;
-					}
-					break;
-			    /*
-			     * Discretionary hyphen - "\\%"
-			     */
-				case '%':
-					if (Wordl <= 0)
-					    break;
-					if ((i = Findhy(NULL, 0, 0)) < 0) {
-					    Error(WARN, LINE,
-					        " no hyphen for font ",
-						(char *)Font);
-					    break;
-					}
-					Endword();
-					Pass3(Wordl, Word, NULL, Hychar[i].len);
-					Pass3(NOBREAK,
-					    (unsigned char *) "hyphen",
-					    Hychar[i].str, Hychar[i].len);
-					Wordl = Wordx = 0;
-					Uhyph = 1;
-					break;
-			    /*
-			     * None of the above - may be special character
-			     * name.
-			     */
-				default:
-					s2 = s1--;
-					s1 = Asmcode(&s1, nm);
-					if ((i = Findchar(nm, 0, NULL, 0)) < 0){
-					    s1 = s2;
-					    goto ordinary_char;
-					}
-					if (strcmp((char *)nm, "em") == 0
-					&& Wordx > 0) {
-				    /*
-				     * "\\(em" is a special case when a word
-				     * has been assembled, because of
-				     * hyphenation.
-				     */
-					    Endword();
-					    Pass3(Wordl, Word, NULL,
-					        Schar[i].len);
-					    Pass3(NOBREAK,
-						(unsigned char *)"userhyphen",
-					        Schar[i].str, Schar[i].len);
-				            Wordl = Wordx = 0;
-					    period = '\0';
-					    Uhyph = 1;
-			 		}
-				    /*
-				     * Interpolate a special character
-				     */
-					if (Str2word(Schar[i].str,
-					    strlen((char *)Schar[i].str)) != 0)
-						return;
-				        Wordl += Schar[i].len;
-					period = '\0';
-				}
-				break;
-		    /*
-		     * Ordinary character
-		     */
-			default:
-ordinary_char:
-				if (Str2word(s1, 1) != 0)
-					return;
-				Wordl++;
-				if (*s1 == '.' || *s1 == '!'
-				||  *s1 == '?' || *s1 == ':')
-				    period = '.';
-				else if (period == '.') {
-				    nm[0] = *s1;
-				    nm[1] = '\0';
-				    if (regexec(Pat[13].pat, nm) == 0)
-					 period = '\0';
-				}
-			}
-		}
-	    /*
-	     * End of line processing
-	     */
-     		if (!Backc) {
-			if (period == '.')
-				Pass3(NOBREAK, (unsigned char *)"gap", NULL, 2);
-			if (Centering > 0) {
-				Pass3(DOBREAK, (unsigned char *)"center", NULL,
-				0);
-				Centering--;
-			} else if (!Fill)
-				Pass3(DOBREAK, (unsigned char *)"flush", NULL,
-				0);
-		}
-		if (Aftnxt == NULL)
-			return;
-		/* else fall through to process an "after next trap */
-	}
-    /*
-     * Special -man macro handling.
-     */
-	if (Marg == MANMACROS) {
-	    /*
-	     * A text line - "^[^.]" - is only processed when there is an
-	     * "after next" directive.
-	     */
-		if (*line != '.' && *line != '\'') {
-			if (Aftnxt != NULL) {
-				if (regexec(Pat[9].pat, Aftnxt))  /* ",fP" */
-					Font[0] = Prevfont;
-				if (regexec(Pat[16].pat, Aftnxt))  /* ",fR" */
-					Font[0] = 'R';
-				if (regexec(Pat[10].pat, Aftnxt))  /* ",tP" */
-					Pass3(DOBREAK,
-						(unsigned char *)"toindent",
-						NULL, 0);
-				Free(&Aftnxt);
-			}
-			return;
-		}
-	    /*
-	     * Special footer handling - "^.lF"
-	     */
-		if (line[1] == 'l' && line[2] == 'F') {
-			s1 = Findstr((unsigned char *)"by", NULL, 0);
-			s2 = Findstr((unsigned char *)"nb", NULL, 0);
-			if (*s1 == '\0' || *s2 == '\0')
-				(void) sprintf((char *)buf, "%s%s",
-					(char *)s1, (char *)s2);
-			else
-				(void) sprintf((char *)buf, "%s; %s",
-					(char *)s1, (char *)s2);
-			Pass3(NOBREAK, (unsigned char *)"LF", buf, 0);
-			return;
-		}
-	}
-    /*
-     * Special -ms macro handling.
-     */
-	if (Marg == MSMACROS) {
-	    /*
-	     * A text line - "^[^.]" - is only processed when there is an
-	     * "after next" directive.
-	     */
-		if (*line != '.' && *line != '\'') {
-			if (Aftnxt != NULL) {
-				if (regexec(Pat[10].pat, Aftnxt))  /* ",tP" */
-					Pass3(DOBREAK,
-						(unsigned char *)"toindent",
-						NULL, 0);
-				Free(&Aftnxt);
-			}
-			return;
-		}
-	    /*
-	     * Numbered headings - "^[.']nH"
-	     */
-		if (line[1] == 'n' && line[2] == 'H') {
-			s1 = Field(2, line, 0);
-			if (s1 != NULL) {
-				i = atoi((char *)s1) - 1;	
-				if (i < 0) {
-					for (j = 0; j < MAXNHNR; j++) {
-						Nhnr[j] = 0;
-					}
-					i = 0;
-				} else if (i >= MAXNHNR) {
-				    (void) sprintf((char *)buf,
-					" over NH limit (%d)", MAXNHNR);
-				    Error(WARN, LINE, (char *)buf, NULL);
-				}
-			} else
-				i = 0;
-			Nhnr[i]++;
-			for (j = i + 1; j < MAXNHNR; j++) {
-				Nhnr[j] = 0;
-			}
-			s1 = buf;
-			for (j = 0; j <= i; j++) {
-				(void) sprintf((char *)s1, "%d.", Nhnr[j]);
-				s1 = buf + strlen((char *)buf);
-			}
-			(void) Findstr((unsigned char *)"Nh", buf, 1);
-			return;
-		}
-	}
-    /*
-     * Remaining lines should begin with a '.' or '\'' unless an "after next"
-     * trap has failed.
-     */
-	if (*line != '.' && *line != '\'') {
-		if (Aftnxt != NULL)
-			Error(WARN, LINE, " failed .it: ", (char *)Aftnxt);
-		else
-			Error(WARN, LINE, " unrecognized line ", NULL);
-		return;
-	}
-	brk = (*line == '.') ? DOBREAK : NOBREAK;
-    /*
-     * Evaluate expressions for "^[.'](ta|ll|ls|in|ti|po|ne|sp|pl|nr)"
-     * Then process the requests.
-     */
-	if (regexec(Pat[11].pat, &line[1])) {
-	    /*
-	     * Establish default scale factor.
-	     */
-		if ((line[1] == 'n' && line[2] == 'e')
-		||  (line[1] == 's' && line[2] == 'p')
-		||  (line[1] == 'p' && line[2] == 'l'))
-			exscale = Scalev;
-		else if (line[1] == 'n' && line[2] == 'r')
-			exscale = Scaleu;
-		else
-			exscale = Scalen;
-	    /*
-	     * Determine starting argument.
-	     */
-		if (line[1] == 'n' && line[2] == 'r')
-			s1 = Field(2, &line[3], 0);
-		else
-			s1 = Field(1, &line[3], 0);
-	    /*
-	     * Evaluate expressions.
-	     */
-		for (nexpr = 0; s1 != NULL &&*s1 != '\0'; ) {
-			while (*s1 == ' ' || *s1 == '\t')
-				s1++;
-			if (*s1 == '+' || *s1 == '-')
-				ssign = *s1++;
-			else
-				ssign = '\0';
-		    /*
-		     * Process terms.
-		     */
-			val = 0.0;
-			sp = -1;
-			c = '+';
-			s1--;
-			while (c == '+' || c == '*' || c == '%'
-			||  c == ')' || c == '-' || c == '/') {
-			    op = c;
-			    s1++;
-			    tscale = exscale;
-			    tval = 0.0;
-			/*
-			 * Pop stack on right parenthesis.
-			 */
-			    if (op == ')') {
-				tval = val;
-				if (sp >= 0) {
-				    val = valstack[sp];
-				    op = opstack[sp];
-				    sp--;
-				} else {
-				    Error(WARN, LINE,
-					" expression stack underflow", NULL);
-				    return;
-				}
-				tscale = Scaleu;
-			/*
-			 * Push stack on left parenthesis.
-			 */
-			    } else if (*s1 == '(') {
-				sp++;
-				if (sp >= MAXSP) {
-				    Error(WARN, LINE,
-				       " expression stack overflow", NULL);
-				    return;
-				}
-				valstack[sp] = val;
-				opstack[sp] = op;
-				val = 0.0;
-				c = '+';
-				continue;
-			    } else if (*s1 == '\\') {
-			      s1++;
-			      switch(*s1) {
-			/*
-			 * "\\"" begins a comment.
-			 */
-			      case '"':
-				while (*s1)
-					s1++;
-				break;
-			/*
-			 * Crude width calculation for "\\w"
-			 */
-			      case 'w':
-				s2 = ++s1;
-				if (*s1) {
-				    s1++;
-				    while (*s1 && *s1 != *s2)
-					s1++;
-				    tval = (double) (s1 - s2 - 1) * Scalen;
-				    if (*s1)
-					s1++;
-				}
-				break;
-			/*
-			 * Interpolate number register if "\\n".
-			 */
-			      case 'n':
-				s1 = Asmcode(&s1, nm);
-				if ((i = Findnum(nm, 0, 0)) >= 0)
-				    tval = Numb[i].val;
-			        s1++;
-			     }
-			/*
-			 * Assemble numeric value.
-			 */
-			    } else if (*s1 == '.' || isdigit(*s1)) {
-				for (i = 0; isdigit(*s1) || *s1 == '.'; s1++) {
-				    if (*s1 == '.') {
-					i = 10;
-					continue;
-				    }
-				    d = (double) (*s1 - '0');
-				    if (i) {
-					tval = tval + (d / (double) i);
-					i = i * 10;
-				    } else
-					tval = (tval * 10.0) + d;
-				}
-			    } else {
-			/*
-			 * It's not an expression.  Ignore extra scale.
-			 */
-				if ((i = Findscale((int)*s1, 0.0, 0)) < 0) {
-				    (void) sprintf((char *)buf,
-					" \"%s\" isn't an expression",
-					(char *)s1);
-				    Error(WARN, LINE, (char *)buf, NULL);
-				}
-				s1++;
-			    }
-			/*
-			 * Add term to expression value.
-			 */
-			    if ((i = Findscale((int)*s1, 0.0, 0)) >= 0) {
-				tval *= Scale[i].val;
-				s1++;
-			    } else
-				tval *= tscale;
-			    switch (op) {
-			    case '+':
-				val += tval;
-				break;
-			    case '-':
-				val -= tval;
-				break;
-			    case '*':
-				val *= tval;
-				break;
-			    case '/':
-			    case '%':
-				i = (int) val;
-				j = (int) tval;
-				if (j == 0) {
-				    Error(WARN, LINE,
-					(*s1 == '/') ? "div" : "mod",
-				        " by 0");
-				    return;
-				}
-				if (op == '/')
-					val = (double) (i / j);
-				else
-					val = (double) (i % j);
-				break;
-			    }
-			    c = *s1;
-			}
-		    /*
-		     * Save expression value and sign.
-		     */
-			if (nexpr >= MAXEXP) {
-				(void) sprintf((char *)buf,
-				    " at expression limit of %d", MAXEXP);
-				Error(WARN, LINE, (char *)buf, NULL);
-				return;
-			}
-			exsign[nexpr] = ssign;
-			expr[nexpr] = val;
-			if (ssign == '-')
-				sexpr[nexpr] = -1.0 * val;
-			else
-				sexpr[nexpr] = val;
-			nexpr++;
-			while (*s1 == ' ' || *s1 == '\t')
-				s1++;
-		}
-	    /*
-	     * Set parameters "(ll|ls|in|ti|po|pl)"
-	     */
-		if (regexec(Pat[12].pat, &line[1])) {
-			nm[0] = line[1];
-			nm[1] = line[2];
-			if ((i = Findparms(nm)) < 0) {
-				Error(WARN, LINE,
-				    " can't find parameter register ",
-				    (char *)nm);
-				return;
-			}
-			if (nexpr == 0 || exscale == 0.0)
-				j = Parms[i].prev;
-			else if (exsign[0] == '\0'
-			     ||  (nm[0] == 't' && nm[1] == 'i'))
-				 j = (int)(sexpr[0] / exscale);
-			else
-				j = Parms[i].val + (int)(sexpr[0] / exscale);
-			Parms[i].prev = Parms[i].val;
-			Parms[i].val = j;
-			nm[0] = (nexpr) ? exsign[0] : '\0';     /* for .ti */
-			nm[1] = '\0';
-			Pass3(brk, (unsigned char *)Parms[i].cmd, nm, j);
-			return;
-		}
-		if (line[1] == 'n') {
-			switch(line[2]) {
-	    /*
-	     * Need - "^[.']ne <expression>"
-	     */
-			case 'e':
-				if (nexpr && Scalev > 0.0)
-					i = (int) ((expr[0]/Scalev) + 0.99);
-				else
-					i = 0;
-				Pass3(DOBREAK, (unsigned char *)"need", NULL,
-					i);
-				return;
-	    /*
-	     * Number - "^[.']nr <name> <expression>"
-	     */
-			case 'r':
-				if ((s1 = Field(2, line, 0)) == NULL) {
-				    Error(WARN, LINE, " bad number register",
-				        NULL);
-				    return;
-				}
-				if ((i = Findnum(s1, 0, 0)) < 0)
-				    i = Findnum(s1, 0, 1);
-				if (nexpr < 1) {
-				    Numb[i].val = 0;
-				    return;
-				}
-				if (exsign[0] == '\0')
-				    Numb[i].val = (int) expr[0];
-				else
-				    Numb[i].val += (int) sexpr[0];
-				return;
-			}
-		}
-	    /*
-	     * Space - "^[.']sp <expression>"
-	     */
-		if (line[1] == 's' && line[2] == 'p') {
-			if (nexpr == 0)
-				i = 1;
-			else
-				i = (int)((expr[0] / Scalev) + 0.99);
-			while (i--)
-				Pass3(brk, (unsigned char *)"space", NULL, 0);
-			return;
-		}
-	    /*
-	     * Tab positions - "^[.']ta <pos1> <pos2> . . ."
-	     */
-     		if (line[1] == 't' && line[2] == 'a') {
-			tval = 0.0;
-			for (j = 0; j < nexpr; j++) {
-				if (exsign[j] == '\0')
-					tval = expr[j];
-				else
-					tval += sexpr[j];
-				Tabs[j] = (int) (tval / Scalen);
-			}
-			Ntabs = nexpr;
-			return;
-		}
-	}
-    /*
-     * Process all other nroff requests via Nreq().
-     */
-	(void) Nreq(line, brk);
-	return;
-}
Index: trunk/minix/commands/cawf/pass3.c
===================================================================
--- trunk/minix/commands/cawf/pass3.c	(revision 9)
+++ 	(revision )
@@ -1,614 +1,0 @@
-/*
- *	pass3.c - cawf(1) pass 3 function
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-
-void
-Pass3(len, word, sarg, narg)
-	int len;			/* length (negative is special) */
-	unsigned char *word;		/* word */
-	unsigned char *sarg;		/* string argument */
-	int narg;			/* numeric argument */
-{
-	int addto;			/* spaces to add to all words */
-	int i, j, k;			/* temporary index */
-	unsigned char msg[MAXLINE];	/* message buffer */
-	int n;				/* temporary number */
-	unsigned char *s1;		/* temporary string pointer */
-	int sp = 0;			/* no-break spacing switch */
-	int sp_Outll;			/* sp-saved Outll */
-	char sp_Outln;			/* sp-saved Outln[0] */
-	int sp_Outlx;			/* sp-saved Outlx */
-	int sp_Padx;			/* sp-saved Padx */
-	int sp_Tind;			/* sp-saved Tind */
-	int wl;				/* real word length */
-	int xsp;			/* extra spaces to add */
-	int vsp;			/* vertical spacing status */
-
-	vsp = 0;
-	if (word != NULL)
-		wl = strlen((char *)word);
-    /*
-     * If not a special command, process a word.
-     */
-	if (len >= 0 && Outll < 0) {
-	/*
-	 * Enter first word.
-	 */
-		(void) strcpy((char *)Outln, (char *)word);
-		Outll = len;
-		Outlx = wl;
-		Padx = 0;
-	} else if (len >= 0
-	       && (Outll+Contlen+len+narg) <= (LL-Pgoff-Ind-Tind)) {
-	/*
-	 * The word fits, so enter it.
-	 */
-		if ((Contlen + len) > 0) {
-line_too_big:
-			if ((Outlx + Contlen + wl) >= MAXOLL) {
-				Error3(len, (char *)word, (char *)sarg, narg,
-					"output line too big");
-				return;
-			} else {
-				if (Contlen > 0 && Cont != NULL) {
-					if (Contlen == 1 && *Cont == ' ') {
-						Padchar[Padx++] = Outlx;
-						Outln[Outlx++] = ' ';
-					} else {
-					    (void) strcpy((char *)&Outln[Outlx],
-						(char *)Cont);
-					    Outlx += Contlen;
-					}
-				}
-				if (len > 0) {
-					(void) strcpy((char *)&Outln[Outlx],
-						(char *)word);
-					Outlx += wl;
-				}
-			}
-		}
-		Outll += Contlen + len;
-	} else if (len == NOBREAK || len == MESSAGE) {
-		/*
-		 * Do nothing (equivalent to break)
-		 */
-	} else if (len == DOBREAK && strcmp((char *)word, "need") == 0
-	       &&  (Nxtln + narg) < (Pglen + 1 - Botmarg)) {
-		/*
-		 * Do nothing, because there is room on the page.
-		 */
-	} else if (len == DOBREAK && strcmp((char *)word, "toindent") == 0
-	       &&  (Ind + Tind + Outll) < Ind) {
-	/*
-	 * Move to indent position with line - there is room.
-	 */
-		n = Ind - (Ind + Tind +Outll);
-		Outll += n;
-		if ((Outlx + n) >= MAXOLL)
-			goto line_too_big;
-		for (i = n; i; i--)
-			Outln[Outlx++] = ' ';
-		Padx = 0;
-		Free(&Cont);
-		Contlen = 0;
-	} else if (Outll >= 0
-	       || (len == DOBREAK && strcmp((char *)word, "need") == 0)) {
-	/*
-	 * A non-empty line or a "need" forces output.
-	 */
-		vsp = 0;
-
-print_line:
-		if (Nxtln == 1) {
-	    /*
-	     * We're at the top of the page, so issue the header.
-	     */
-			if (Thispg > 1)
-				Charput((int)'\f');
-			for (i = (Topmarg - 1)/2; i > 0; i--) {
-				Charput((int)'\n');
-				Nxtln++;
-			}
-		    /*
-		     * Print the page header, as required.
-		     */
-			if (Fph || Thispg > 1) {
-				i = LenprtHF(Hdc, Thispg, 0)
-				  + LenprtHF(Hdl, Thispg, 0)
-				  + LenprtHF(Hdr, Thispg, 0) + 2;
-				j = (LL - i - Pgoff) / 2 + 1;
-				n = LL - Pgoff - i - j + 2;
-				for (k = 0; k < Pgoff; k++)
-					Charput((int)' ');
-				if (Hdl)
-					LenprtHF(Hdl, Thispg, 1);
-				while (j-- > 0)
-					Charput((int)' ');
-				if (Hdc)
-					LenprtHF(Hdc, Thispg, 1);
-				while (n-- > 0)
-					Charput((int)' ');
-				if (Hdr)
-					LenprtHF(Hdr, Thispg, 1);
-				Charput((int)'\n');
-			} else
-				Charput((int)'\n');
-			Nxtln++;
-			while(Nxtln <= Topmarg) {
-				Charput((int)'\n');
-				Nxtln++;
-			}
-		}
-	    /*
-	     *  Add a trailing hyphen, if mecessary.
-	     */
-     		if (vsp == 0 && Eollen > 0 && Eol != NULL) {
-			i = strlen((char *)Eol);
-			if ((Outlx + i) >= MAXOLL)
-				goto line_too_big;
-			(void) strcpy((char *)&Outln[Outlx], (char *)Eol);
-			Outlx += i;
-			Outll += Eollen;
-		}
-	    /*
-	     * Trim trailing spaces from the output line.
-	     */
-     		while (Outlx > 0) {
-			if (Outln[Outlx - 1] != ' ')
-				break;
-			if (Padx > 0 && (Outlx - 1) == Padchar[Padx - 1])
-				Padx--;
-			Outlx--;
-			Outln[Outlx] = '\0';
-			Outll--;
-		}
-		if (Outlx == 0)
-			Charput((int)'\n');
-		else if (len == DOBREAK && strcmp((char *)word, "center") == 0)
-		    {
-		    /*
-		     * Center the output line.
-		     */
-			i = (LL - Pgoff - Outll) / 2;
-			if (i < 0)
-				i = 0;
-			for (j = (Pgoff + Ind + Tind + i); j; j--)
-				Charput((int)' ');
-			Stringput(Outln);
-			Charput((int)'\n');
-		} else if (Adj == LEFTADJ
-		       || (Adj == BOTHADJ && (len < 0 || Padx == 0))) {
-		    /*
-		     * No right margin adjustment - disabled, inappropriate
-		     * (line ended by break) or impossible.
-		     */
-			for (i = 0; i < (Pgoff + Ind + Tind); i++)
-				Charput((int)' ');
-			Stringput(Outln);
-			Charput((int)'\n');
-		} else if (Adj == BOTHADJ) {
-		    /*
-		     * Adjust right margin.
-		     */
-			for (i = 0; i < (Pgoff + Ind + Tind); i++)
-				Charput((int)' ');
-			i = LL - (Pgoff + Ind + Tind);
-			j = i - Outll;
-			addto = Padx ? (j / Padx) : 0;
-			xsp = j - (Padx * addto);
-			for (i = 0, s1 = Outln; i < Padx; i++) {
-				while (*s1 && (s1 - Outln) <= Padchar[i])
-					Charput((int)*s1++);
-				if (*s1 == '\0')
-					break;
-				j = addto;
-				if (Padfrom == PADLEFT) {
-					if (i < xsp)
-						j++;
-				} else if (i >= (Padx - xsp))
-					j++;
-				while (j-- > 0)
-					Charput((int)' ');
-			}
-			while (*s1)
-				Charput((int)*s1++);
-			Charput((int)'\n');
-			Padfrom = (Padfrom == PADLEFT) ? PADRIGHT : PADLEFT;
-		}
-	    /*
-	     * End of line housekeeping
-	     */
-		Nxtln++;
-		Outll = -1;
-		Outlx = 0;
-		Padx = 0;
-		Tind = 0;
-		Nospmode = 0;
-		if (vsp == 0 && len == DOBREAK
-		&&  strcmp((char *)word, "need") == 0) {
-		    /*
-		     * Break caused by "need" - satisfy it.
-		     */
-			while (Nxtln < (Pglen + 1 - Botmarg)) {
-				Charput((int)'\n');
-				Nxtln++;
-			}
-		}
-		if (Nxtln >= (Pglen + 1 - Botmarg)) {
-	    /*
-	     * Footer required
-	     */
-			for (i = (Botmarg - 1)/2; i > 0; i--) {
-				Charput((int)'\n');
-				Nxtln++;
-			}
-			i = LenprtHF(Ftl, Thispg, 0) + LenprtHF(Ftc, Thispg, 0)
-			  + LenprtHF(Ftr, Thispg, 0) + 2;
-			j = (LL - i - Pgoff) / 2 + 1;
-			n = LL - Pgoff - i - j + 2;
-			for (k = 0; k < Pgoff; k++)
-				Charput((int)' ');
-			if (Ftl)
-				LenprtHF(Ftl, Thispg, 1);
-			while (j-- > 0)
-				Charput((int)' ');
-			if (Ftc)
-				LenprtHF(Ftc, Thispg, 1);
-			while (n-- > 0)
-				Charput((int)' ');
-			if (Ftr)
-				LenprtHF(Ftr, Thispg, 1);
-			Charput((int)'\n');
-			Nxtln++;
-		/*
-		 * The last blank line on the page is suppressed to assist
-		 * printers that can't look ahead to the following FF.
-		 */
-			while (Nxtln < Pglen) {
-				Charput((int)'\n');
-				Nxtln++;
-			}
-			Nxtln = 1;
-			Thispg++;
-			Nospmode = 1;
-			Padfrom = PADRIGHT;
-		}
-	    /*
-	     * Initiate any extra vertical spacing.
-	     */
-		if (++vsp < Vspace)
-			goto print_line;
-	    /*
-	     * Save any input word that might have forced output.
-	     */
-		if (len >= 0) {
-			(void) strcpy((char *)Outln, (char *)word);
-			Outll = len;
-			Outlx = wl;
-			Padx = 0;
-		}
-	}
-    /*
-     * A break causes padding reversal.
-     */
-	if (len == DOBREAK)
-		Padfrom = PADRIGHT;
-	if (len >= 0 || strcmp((char *)word, "nohyphen") == 0) {
-    /*
-     * Reset continuation and hyphenation.
-     */
-		if (Contlen != 1 || Cont[0] != ' ') {
-			Free(&Cont);
-			Cont = Newstr((unsigned char *)" ");
-			Contlen = 1;
-		}
-		if (Eollen > 0) {
-			Free(&Eol);
-			Eollen = 0;
-		}
-		return;
-	}
-    /*
-     * Now post-process any special commands.
-     */
-	if (len == MESSAGE) {
-		Error3(len, (char *)word, (char *)sarg, narg, NULL);
-		return;
-	}
-
-	switch (*word) {
-
-	case 'b':				/* both */
-	    /*
-	     * Adjust on both margins.
-	     */
-		Adj = BOTHADJ;
-		return;
-
-	case 'c':				/* center */
-		return;
-
-	case 'e':				/* errsto */
-	    /*
-	     * "errsto" comes from awf.
-	     */
-		return;
-
-	case 'f':				/* flush and fph */
-		if (word[1] == 'l')
-			return;
-		else if (word[1] == 'p') {
-	    /*
-	     * First page header status
-	     */
-			Fph = narg;
-			return;
-		}
-		break;
-
-	case 'g':				/* gap */
-	    /*
-	     * Increase word gap.  (Space is not paddable.)
-	     */
-		if (Outll >= 0) {
-			if ((Outlx + narg - 1) >= MAXOLL)
-				goto line_too_big;
-			for (i = 0; i < (narg - 1); i++) {
-				Outln[Outlx++] = ' ';
-				Outll++;
-			}
-		}
-		return;
-
-	case 'h':				/* hyphen */
-	    /*
-	     * Set discretionary hyphen.
-	     */
-		Free(&Cont);
-		Contlen = 0;
-		Free(&Eol);
-		Eol = (sarg != NULL) ? Newstr(sarg) : NULL;
-		Eollen = narg;
-		return;
-
-	case 'i':				/* indent */
-	    /*
-	     * Set indentation.
-	     */
-		Ind = narg;
-		return;
-
-	case 'l':				/* left or linelen */
-		if (word[1] == 'e') {
-	    /*
-	     * Adjust on left margin.
-	     */
-			Adj = LEFTADJ;
-			return;
-		} else if (word[1] == 'i') {
-	    /*
-	     * Set line length.
-	     */
-			LL = narg;
-			return;
-		}
-		break;
-
-	case 'n':				/* need or nospace */
-		if (word[1] == 'e')
-			return;			/* need */
-		else if (word[1] == 'o') {
-	    /*
-	     * Set no space mode.
-	     */
-			Nospmode = 1;
-			return;
-		}
-		break;
-
-	case 'p':				/* pagelen or pageoffset */
-		if (strncmp((char *)&word[1], "age", 3) != 0)
-			break;
-		if (word[4] == 'l') {
-	    /*
-	     * Set page length.
-	     */
-			Pglen = narg;
-			return;
-		} else if (word[4] == 'o') {
-	    /*
-	     * Set page offset.
-	     */
-			Pgoff = narg;
-			return;
-		}
-		break;
-
-	case 's':				/* space */
-		if (sp) {
-
-		/*
-		 * Restore values after NOBREAK spacing ("^'sp").
-		 */
-			Outlx = sp_Outlx;
-			Outln[0] = sp_Outln;
-			Padx = sp_Padx;
-			Outll = sp_Outll;
-			Tind = sp_Tind;
-			return;
-		}
-		if (Nospmode == 0) {
-			if (len == NOBREAK) {
-		
-			/*
-			 * Set up for NOBREAK spacing.
-			 */
-				sp_Outlx = Outlx;
-				sp_Outln = Outln[0];
-				sp_Padx = Padx;
-				sp_Outll = Outll;
-				sp_Tind = Tind;
-				vsp = Vspace + 1;
-				sp = 1;
-			}
-		/*
-		 * Generate a blank line.
-		 */
-			Outlx = 0;
-			Outln[0] = '\0';
-			Padx = 0;
-			Outll = LL - 1;
-			if (sp)
-				goto print_line;
-		}
-		return;
-
-	case 't':				/* tabto, tempindent, or
-						 * toindent */
-		if (word[1] == 'a') {
-	    /*
-	     * Move to TAB stop.
-	     */
-			if (Outll < 0)
-				Outll = 0;
-			if ((n = narg - Outll) > 0) {
-				if ((Outlx + n) >= MAXOLL)
-					goto line_too_big;
-				Outll += n;
-				for (i = n; i > 0; i--)
-					Outln[Outlx++] = ' ';
-				Free(&Cont);
-				Contlen = 0;
-				Padx = 0;
-			}
-			return;
-		} else if (word[1] == 'e') {
-	    /*
-	     * Set temporary indentation.
-	     */
-			if (*sarg == '\0' && narg >= 0)
-				Tind = narg - Ind;
-			else
-				Tind = ((Ind + narg) >= 0) ? narg : -Ind;
-			return;
-		} else if (word[1] == 'o')
-			return;				/* toindent */
-		break;
-
-	case 'u':					/* userhyphen */
-	    /*
-	     * Set line length.
-	     */
-		Free(&Cont);
-		Free(&Eol);
-		Contlen = Eollen = narg;
-		Cont = (sarg == NULL) ? NULL : Newstr(sarg);
-		Eol = (sarg == NULL) ? NULL : Newstr(sarg);
-		return;
-
-	case 'v':					/* vspace */
-	    /*
-	     * Set vertical spacing.
-	     */
-		Vspace = (narg == 0) ? 1 : narg;
-		return;
-
-	case 'y':					/* yesspace */
-	    /*
-	     * Set space mode.
-	     */
-		Nospmode = 0;
-		return;
-	}				/* end of switch(*word) */
-    /*
-     * Locate header and footer defintions.
-     */
-	if (regexec(Pat[14].pat, word)) {
-		if (strcmp((char *)word, "LH") == 0) {
-		    /*
-		     * Left header
-		     */
-			Free(&Hdl);
-			if (sarg != NULL)
-				Hdl = Newstr(sarg);
-			return;
-		}
-		if (strcmp((char *)word, "CH") == 0) {
-		    /*
-		     * Center header
-		     */
-			Free(&Hdc);
-			if (sarg != NULL)
-				Hdc = Newstr(sarg);
-			return;
-		}
-		if (strcmp((char *)word, "RH") == 0) {
-		    /*
-		     * Right header
-		     */
-			Free(&Hdr);
-			if (sarg != NULL)
-				Hdr = Newstr(sarg);
-			return;
-		}
-		if (strcmp((char *)word, "LF") == 0) {
-		    /*
-		     * Left footer
-		     */
-			Free(&Ftl);
-			if (sarg != NULL)
-				Ftl = Newstr(sarg);
-			return;
-		}
-		if (strcmp((char *)word, "CF") == 0) {
-		    /*
-		     * Center footer
-		     */
-			Free(&Ftc);
-			if (sarg != NULL)
-				Ftc = Newstr(sarg);
-			return;
-		}
-		if (strcmp((char *)word, "RF") == 0) {
-		    /*
-		     * Right footer
-		     */
-			Free(&Ftr);
-			if (sarg != NULL)
-				Ftr = Newstr(sarg);
-			return;
-		}
-	}
-    /*
-     * Error on unknown arguments
-     */
-	Error3(len, (char *)word, (char *)sarg, narg, "unknown request");
-}
Index: trunk/minix/commands/cawf/proto.h
===================================================================
--- trunk/minix/commands/cawf/proto.h	(revision 9)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- *	proto.h - function prototype definitions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "ansi.h"
-
-#ifdef	UNIX
-# ifdef	USG
-#include <string.h>
-# else	/* not USG */
-#include <strings.h>
-# endif	/* USG */
-#else	/* not UNIX */
-#include <string.h>
-#endif	/* UNIX */
-
-/*
- * The following conditional rat's nest intends to:
- *
- * for MS-DOS	#include <stdlib.h> and <malloc.h>.  <stdlib.h> exists in
- *		MS-DOS so the STDLIB symbol should be defined and UNIX
- *		shouldn't be.
- *
- * for Unix	#include <stdlib.h> if the STDLIB symbol is defined.  If
- *		STDLIB isn't defined, define a prototype for getenv().
- *		If the UNIX symbol is defined (and it should be) and if
- *		the MALLOCH symbol is defined, #include <malloc.h>; else
- *		define a prototype for malloc() if UNIX is defined and
- *		MALLOCH isn't.  (The Unix <stdlib.h> usually defines the
- *		malloc() prototype.)
- *
- * for ???	Define a prototype for getenv() and #include <malloc.h>
- *		if neither STDLIB nor UNIX are defined.  (What system is
- *		this?)
- */
-
-#ifdef	STDLIB
-#include <stdlib.h>
-# ifndef	UNIX
-#include <malloc.h>
-# endif		/* UNIX */
-#else	/* not STDLIB */
-_PROTOTYPE(char *getenv,(char *name));
-# ifdef	UNIX
-#  ifdef	MALLOCH
-#include <malloc.h>
-#  else		/* not MALLOCH */
-_PROTOTYPE(char *malloc,(unsigned size));
-#  endif	/* MALLOCH */
-# else	/* not UNIX */
-#include <malloc.h>
-# endif	/* UNIX */
-#endif	/* STDLIB */
-
-_PROTOTYPE(unsigned char *Asmcode,(unsigned char **s, unsigned char *c));
-_PROTOTYPE(int Asmname,(unsigned char *s, unsigned char *c));
-_PROTOTYPE(void Charput,(int c));
-_PROTOTYPE(int Delmacro,(int mx));
-_PROTOTYPE(int Defdev,());
-_PROTOTYPE(void Delstr,(int sx));
-_PROTOTYPE(void Error,(int t, int l, char *s1, char *s2));
-_PROTOTYPE(void Error3,(int len, char *word, char *sarg, int narg, char *msg));
-_PROTOTYPE(void Expand,(unsigned char *line));
-_PROTOTYPE(void Delnum,(int nx));
-_PROTOTYPE(unsigned char *Field,(int n, unsigned char *p, int c));
-_PROTOTYPE(void Endword,());
-_PROTOTYPE(int Findchar,(unsigned char *nm, int l, unsigned char *s, int e));
-_PROTOTYPE(int Findhy,(unsigned char *s, int l, int e));
-_PROTOTYPE(int Findmacro,(unsigned char *p, int e));
-_PROTOTYPE(int Findnum,(unsigned char *n, int v, int e));
-_PROTOTYPE(int Findparms,(unsigned char *n));
-_PROTOTYPE(int Findscale,(int n, double v, int e));
-_PROTOTYPE(unsigned char *Findstr,(unsigned char *nm, unsigned char *s, int e));
-_PROTOTYPE(int getopt,(int argc, char **argv, char *opts));
-_PROTOTYPE(int LenprtHF,(unsigned char *s, int p, int t));
-_PROTOTYPE(int main,(int argc, char *argv[]));
-_PROTOTYPE(void Macro,(unsigned char *inp));
-_PROTOTYPE(void Nreq,(unsigned char *line, int brk));
-_PROTOTYPE(void Free,(unsigned char **p));
-_PROTOTYPE(unsigned char *Newstr,(unsigned char *s));
-_PROTOTYPE(void Pass2,(unsigned char *line));
-_PROTOTYPE(void Pass3,(int len, unsigned char *word, unsigned char *sarg, int narg));
-_PROTOTYPE(void regerror,(char *s));
-_PROTOTYPE(unsigned char *reg,(int paren, int *flagp));
-_PROTOTYPE(unsigned char *regatom,(int *flagp));
-_PROTOTYPE(unsigned char *regbranch,(int *flagp));
-_PROTOTYPE(regexp *regcomp,(char *exp));
-_PROTOTYPE(void regdump,(regexp *r));
-_PROTOTYPE(int regexec,(regexp *prog, unsigned char *string));
-_PROTOTYPE(void Stringput,(unsigned char *s));
-_PROTOTYPE(int Str2word,(unsigned char *s, int len));
Index: trunk/minix/commands/cawf/regerror.c
===================================================================
--- trunk/minix/commands/cawf/regerror.c	(revision 9)
+++ 	(revision )
@@ -1,18 +1,0 @@
-#include <stdio.h>
-#include "regexp.h"
-#include "proto.h"
-
-void
-regerror(s)
-char *s;
-{
-#ifndef DOSPORT
-#ifdef ERRAVAIL
-	error("regexp: %s", s);
-#else
-	fprintf(stderr, "regexp(3): %s", s);
-	exit(1);
-#endif
-	/* NOTREACHED */
-#endif /* ifdef'd out for less's sake when reporting error inside less */
-}
Index: trunk/minix/commands/cawf/regexp.c
===================================================================
--- trunk/minix/commands/cawf/regexp.c	(revision 9)
+++ 	(revision )
@@ -1,1242 +1,0 @@
-/*
- * regcomp and regexec -- regsub and regerror are elsewhere
- *
- *	Copyright (c) 1986 by University of Toronto.
- *	Written by Henry Spencer.  Not derived from licensed software.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to redistribute it freely,
- *	subject to the following restrictions:
- *
- *	1. The author is not responsible for the consequences of use of
- *		this software, no matter how awful, even if they arise
- *		from defects in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *		by explicit claim or by omission.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *		be misrepresented as being the original software.
- *
- * Beware that some of this code is subtly aware of the way operator
- * precedence is structured in regular expressions.  Serious changes in
- * regular-expression syntax might require a total rethink.
- */
-#include <stdio.h>
-#ifdef	UNIX
-#ifdef	USG
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#else
-#include <string.h>
-#endif
-#include "regexp.h"
-#include "regmagic.h"
-#include "proto.h"
-
-/*
- * The "internal use only" fields in regexp.h are present to pass info from
- * compile to execute that permits the execute phase to run lots faster on
- * simple cases.  They are:
- *
- * regstart	char that must begin a match; '\0' if none obvious
- * reganch	is the match anchored (at beginning-of-line only)?
- * regmust	string (pointer into program) that match must include, or NULL
- * regmlen	length of regmust string
- *
- * Regstart and reganch permit very fast decisions on suitable starting points
- * for a match, cutting down the work a lot.  Regmust permits fast rejection
- * of lines that cannot possibly match.  The regmust tests are costly enough
- * that regcomp() supplies a regmust only if the r.e. contains something
- * potentially expensive (at present, the only such thing detected is * or +
- * at the start of the r.e., which can involve a lot of backup).  Regmlen is
- * supplied because the test in regexec() needs it and regcomp() is computing
- * it anyway.
- */
-
-/*
- * Structure for regexp "program".  This is essentially a linear encoding
- * of a nondeterministic finite-state machine (aka syntax charts or
- * "railroad normal form" in parsing technology).  Each node is an opcode
- * plus a "next" pointer, possibly plus an operand.  "Next" pointers of
- * all nodes except BRANCH implement concatenation; a "next" pointer with
- * a BRANCH on both ends of it is connecting two alternatives.  (Here we
- * have one of the subtle syntax dependencies:  an individual BRANCH (as
- * opposed to a collection of them) is never concatenated with anything
- * because of operator precedence.)  The operand of some types of node is
- * a literal string; for others, it is a node leading into a sub-FSM.  In
- * particular, the operand of a BRANCH node is the first node of the branch.
- * (NB this is *not* a tree structure:  the tail of the branch connects
- * to the thing following the set of BRANCHes.)  The opcodes are:
- */
-
-/* definition	number	opnd?	meaning */
-#define	END	0	/* no	End of program. */
-#define	BOL	1	/* no	Match "" at beginning of line. */
-#define	EOL	2	/* no	Match "" at end of line. */
-#define	ANY	3	/* no	Match any one character. */
-#define	ANYOF	4	/* str	Match any character in this string. */
-#define	ANYBUT	5	/* str	Match any character not in this string. */
-#define	BRANCH	6	/* node	Match this alternative, or the next... */
-#define	BACK	7	/* no	Match "", "next" ptr points backward. */
-#define	EXACTLY	8	/* str	Match this string. */
-#define	NOTHING	9	/* no	Match empty string. */
-#define	STAR	10	/* node	Match this (simple) thing 0 or more times. */
-#define	PLUS	11	/* node	Match this (simple) thing 1 or more times. */
-#define	OPEN	20	/* no	Mark this point in input as start of #n. */
-			/*	OPEN+1 is number 1, etc. */
-#define	CLOSE	30	/* no	Analogous to OPEN. */
-
-/*
- * Opcode notes:
- *
- * BRANCH	The set of branches constituting a single choice are hooked
- *		together with their "next" pointers, since precedence prevents
- *		anything being concatenated to any individual branch.  The
- *		"next" pointer of the last BRANCH in a choice points to the
- *		thing following the whole choice.  This is also where the
- *		final "next" pointer of each individual branch points; each
- *		branch starts with the operand node of a BRANCH node.
- *
- * BACK		Normal "next" pointers all implicitly point forward; BACK
- *		exists to make loop structures possible.
- *
- * STAR,PLUS	'?', and complex '*' and '+', are implemented as circular
- *		BRANCH structures using BACK.  Simple cases (one character
- *		per match) are implemented with STAR and PLUS for speed
- *		and to minimize recursive plunges.
- *
- * OPEN,CLOSE	...are numbered at compile time.
- */
-
-/*
- * A node is one char of opcode followed by two chars of "next" pointer.
- * "Next" pointers are stored as two 8-bit pieces, high order first.  The
- * value is a positive offset from the opcode of the node containing it.
- * An operand, if any, simply follows the node.  (Note that much of the
- * code generation knows about this implicit relationship.)
- *
- * Using two bytes for the "next" pointer is vast overkill for most things,
- * but allows patterns to get big without disasters.
- */
-#define	OP(p)	(*(p))
-#define	NEXT(p)	(((*((p)+1)&0377)<<8) + (*((p)+2)&0377))
-#define	OPERAND(p)	((p) + 3)
-
-/*
- * See regmagic.h for one further detail of program structure.
- */
-
-
-/*
- * Utility definitions.
- */
-#ifndef CHARBITS
-#define	UCHARAT(p)	((int)*(unsigned char *)(p))
-#else
-#define	UCHARAT(p)	((int)*(p)&CHARBITS)
-#endif
-
-#define	FAIL(m)	{ regerror(m); return(NULL); }
-#define	ISMULT(c)	((c) == '*' || (c) == '+' || (c) == '?')
-#define	META	"^$.[()|?+*\\"
-
-/*
- * Flags to be passed up and down.
- */
-#define	HASWIDTH	01	/* Known never to match null string. */
-#define	SIMPLE		02	/* Simple enough to be STAR/PLUS operand. */
-#define	SPSTART		04	/* Starts with * or +. */
-#define	WORST		0	/* Worst case. */
-#define STATIC 
-/*
- * Global work variables for regcomp().
- */
-
-STATIC char *regparse;		/* Input-scan pointer. */
-STATIC int regnpar;		/* () count. */
-STATIC unsigned char regdummy;
-STATIC unsigned char *regcode;	/* Code-emit pointer; &regdummy = don't. */
-STATIC long regsize;		/* Code size. */
-
-/*
- * Forward declarations for regcomp()'s friends.
- */
-_PROTOTYPE(STATIC unsigned char *reg, (int paren, int *flagp ));
-_PROTOTYPE(STATIC unsigned char *regbranch, (int *flagp ));
-_PROTOTYPE(STATIC unsigned char *regpiece, (int *flagp ));
-_PROTOTYPE(STATIC unsigned char *regatom, (int *flagp ));
-_PROTOTYPE(STATIC unsigned char *regnode, (int op ));
-_PROTOTYPE(STATIC void regc, (int b ));
-_PROTOTYPE(STATIC void reginsert, (int op, unsigned char *opnd ));
-_PROTOTYPE(STATIC void regtail, (unsigned char *p, unsigned char *val ));
-_PROTOTYPE(STATIC void regoptail, (unsigned char *p, unsigned char *val ));
-_PROTOTYPE(STATIC int regtry, (regexp *prog, unsigned char *string ));
-_PROTOTYPE(STATIC int regmatch, (unsigned char *prog ));
-_PROTOTYPE(STATIC int regrepeat, (unsigned char *p ));
-_PROTOTYPE(STATIC unsigned char *regnext, (unsigned char *p ));
-_PROTOTYPE(STATIC unsigned char *regprop, (unsigned char *op ));
-
-#ifdef STRCSPN
-_PROTOTYPE(STATIC int strcspn, (unsigned char *s1, unsigned char *s2 ));
-#endif
-
-/*
- - regcomp - compile a regular expression into internal code
- *
- * We can't allocate space until we know how big the compiled form will be,
- * but we can't compile it (and thus know how big it is) until we've got a
- * place to put the code.  So we cheat:  we compile it twice, once with code
- * generation turned off and size counting turned on, and once "for real".
- * This also means that we don't allocate space until we are sure that the
- * thing really will compile successfully, and we never have to move the
- * code and thus invalidate pointers into it.  (Note that it has to be in
- * one piece because free() must be able to free it all.)
- *
- * Beware that the optimization-preparation code in here knows about some
- * of the structure of the compiled regexp.
- */
-regexp *
-regcomp(exp)
-char *exp;
-{
-	register regexp *r;
-	register unsigned char *scan;
-	register unsigned char *longest;
-	register int len;
-	int flags;
-
-	if (exp == NULL)
-		FAIL("NULL argument");
-
-	/* First pass: determine size, legality. */
-	regparse = exp;
-	regnpar = 1;
-	regsize = 0L;
-	regcode = &regdummy;
-	regc(MAGIC);
-	if (reg(0, &flags) == NULL)
-		return(NULL);
-
-	/* Small enough for pointer-storage convention? */
-	if (regsize >= 32767L)		/* Probably could be 65535L. */
-		FAIL("regexp too big");
-
-	/* Allocate space. */
-	r = (regexp *)malloc(sizeof(regexp) + (unsigned)regsize);
-	if (r == NULL)
-		FAIL("out of space");
-
-	/* Second pass: emit code. */
-	regparse = exp;
-	regnpar = 1;
-	regcode = r->program;
-	regc(MAGIC);
-	if (reg(0, &flags) == NULL)
-		return(NULL);
-
-	/* Dig out information for optimizations. */
-	r->regstart = '\0';	/* Worst-case defaults. */
-	r->reganch = 0;
-	r->regmust = NULL;
-	r->regmlen = 0;
-	scan = r->program+1;			/* First BRANCH. */
-	if (OP(regnext(scan)) == END) {		/* Only one top-level choice. */
-		scan = OPERAND(scan);
-
-		/* Starting-point info. */
-		if (OP(scan) == EXACTLY)
-			r->regstart = *OPERAND(scan);
-		else if (OP(scan) == BOL)
-			r->reganch++;
-
-		/*
-		 * If there's something expensive in the r.e., find the
-		 * longest literal string that must appear and make it the
-		 * regmust.  Resolve ties in favor of later strings, since
-		 * the regstart check works with the beginning of the r.e.
-		 * and avoiding duplication strengthens checking.  Not a
-		 * strong reason, but sufficient in the absence of others.
-		 */
-		if (flags&SPSTART) {
-			longest = NULL;
-			len = 0;
-			for (; scan != NULL; scan = regnext(scan))
-				if (OP(scan) == EXACTLY
-				&& strlen((char *)OPERAND(scan)) >= len) {
-					longest = OPERAND(scan);
-					len = strlen((char *)OPERAND(scan));
-				}
-			r->regmust = longest;
-			r->regmlen = len;
-		}
-	}
-
-	return(r);
-}
-
-/*
- - reg - regular expression, i.e. main body or parenthesized thing
- *
- * Caller must absorb opening parenthesis.
- *
- * Combining parenthesis handling with the base level of regular expression
- * is a trifle forced, but the need to tie the tails of the branches to what
- * follows makes it hard to avoid.
- */
-STATIC unsigned char *
-reg(paren, flagp)
-int paren;			/* Parenthesized? */
-int *flagp;
-{
-	register unsigned char *ret;
-	register unsigned char *br;
-	register unsigned char *ender;
-	register int parno;
-	int flags;
-
-	*flagp = HASWIDTH;	/* Tentatively. */
-
-	/* Make an OPEN node, if parenthesized. */
-	if (paren) {
-		if (regnpar >= NSUBEXP)
-			FAIL("too many ()");
-		parno = regnpar;
-		regnpar++;
-		ret = regnode(OPEN+parno);
-	} else
-		ret = NULL;
-
-	/* Pick up the branches, linking them together. */
-	br = regbranch(&flags);
-	if (br == NULL)
-		return(NULL);
-	if (ret != NULL)
-		regtail(ret, br);	/* OPEN -> first. */
-	else
-		ret = br;
-	if (!(flags&HASWIDTH))
-		*flagp &= ~HASWIDTH;
-	*flagp |= flags&SPSTART;
-	while (*regparse == '|') {
-		regparse++;
-		br = regbranch(&flags);
-		if (br == NULL)
-			return(NULL);
-		regtail(ret, br);	/* BRANCH -> BRANCH. */
-		if (!(flags&HASWIDTH))
-			*flagp &= ~HASWIDTH;
-		*flagp |= flags&SPSTART;
-	}
-
-	/* Make a closing node, and hook it on the end. */
-	ender = regnode((paren) ? CLOSE+parno : END);	
-	regtail(ret, ender);
-
-	/* Hook the tails of the branches to the closing node. */
-	for (br = ret; br != NULL; br = regnext(br))
-		regoptail(br, ender);
-
-	/* Check for proper termination. */
-	if (paren && *regparse++ != ')') {
-		FAIL("unmatched ()");
-	} else if (!paren && *regparse != '\0') {
-		if (*regparse == ')') {
-			FAIL("unmatched ()");
-		} else
-			FAIL("junk on end");	/* "Can't happen". */
-		/* NOTREACHED */
-	}
-
-	return(ret);
-}
-
-/*
- - regbranch - one alternative of an | operator
- *
- * Implements the concatenation operator.
- */
-STATIC unsigned char *
-regbranch(flagp)
-int *flagp;
-{
-	register unsigned char *ret;
-	register unsigned char *chain;
-	register unsigned char *latest;
-	int flags;
-
-	*flagp = WORST;		/* Tentatively. */
-
-	ret = regnode(BRANCH);
-	chain = NULL;
-	while (*regparse != '\0' && *regparse != '|' && *regparse != ')') {
-		latest = regpiece(&flags);
-		if (latest == NULL)
-			return(NULL);
-		*flagp |= flags&HASWIDTH;
-		if (chain == NULL)	/* First piece. */
-			*flagp |= flags&SPSTART;
-		else
-			regtail(chain, latest);
-		chain = latest;
-	}
-	if (chain == NULL)	/* Loop ran zero times. */
-		(void) regnode(NOTHING);
-
-	return(ret);
-}
-
-/*
- - regpiece - something followed by possible [*+?]
- *
- * Note that the branching code sequences used for ? and the general cases
- * of * and + are somewhat optimized:  they use the same NOTHING node as
- * both the endmarker for their branch list and the body of the last branch.
- * It might seem that this node could be dispensed with entirely, but the
- * endmarker role is not redundant.
- */
-STATIC unsigned char *
-regpiece(flagp)
-int *flagp;
-{
-	register unsigned char *ret;
-	register unsigned char op;
-	register unsigned char *next;
-	int flags;
-
-	ret = regatom(&flags);
-	if (ret == NULL)
-		return(NULL);
-
-	op = *regparse;
-	if (!ISMULT(op)) {
-		*flagp = flags;
-		return(ret);
-	}
-
-	if (!(flags&HASWIDTH) && op != '?')
-		FAIL("*+ operand could be empty");
-	*flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH);
-
-	if (op == '*' && (flags&SIMPLE))
-		reginsert(STAR, ret);
-	else if (op == '*') {
-		/* Emit x* as (x&|), where & means "self". */
-		reginsert(BRANCH, ret);			/* Either x */
-		regoptail(ret, regnode(BACK));		/* and loop */
-		regoptail(ret, ret);			/* back */
-		regtail(ret, regnode(BRANCH));		/* or */
-		regtail(ret, regnode(NOTHING));		/* null. */
-	} else if (op == '+' && (flags&SIMPLE))
-		reginsert(PLUS, ret);
-	else if (op == '+') {
-		/* Emit x+ as x(&|), where & means "self". */
-		next = regnode(BRANCH);			/* Either */
-		regtail(ret, next);
-		regtail(regnode(BACK), ret);		/* loop back */
-		regtail(next, regnode(BRANCH));		/* or */
-		regtail(ret, regnode(NOTHING));		/* null. */
-	} else if (op == '?') {
-		/* Emit x? as (x|) */
-		reginsert(BRANCH, ret);			/* Either x */
-		regtail(ret, regnode(BRANCH));		/* or */
-		next = regnode(NOTHING);		/* null. */
-		regtail(ret, next);
-		regoptail(ret, next);
-	}
-	regparse++;
-	if (ISMULT(*regparse))
-		FAIL("nested *?+");
-
-	return(ret);
-}
-
-/*
- - regatom - the lowest level
- *
- * Optimization:  gobbles an entire sequence of ordinary characters so that
- * it can turn them into a single node, which is smaller to store and
- * faster to run.  Backslashed characters are exceptions, each becoming a
- * separate node; the code is simpler that way and it's not worth fixing.
- */
-STATIC unsigned char *
-regatom(flagp)
-int *flagp;
-{
-	register unsigned char *ret;
-	int flags;
-
-	*flagp = WORST;		/* Tentatively. */
-
-	switch (*regparse++) {
-	case '^':
-		ret = regnode(BOL);
-		break;
-	case '$':
-		ret = regnode(EOL);
-		break;
-	case '.':
-		ret = regnode(ANY);
-		*flagp |= HASWIDTH|SIMPLE;
-		break;
-	case '[': {
-			register int class;
-			register int classend;
-
-			if (*regparse == '^') {	/* Complement of range. */
-				ret = regnode(ANYBUT);
-				regparse++;
-			} else
-				ret = regnode(ANYOF);
-			if (*regparse == ']' || *regparse == '-')
-				regc(*regparse++);
-			while (*regparse != '\0' && *regparse != ']') {
-				if (*regparse == '-') {
-					regparse++;
-					if (*regparse == ']' || *regparse == '\0')
-						regc('-');
-					else {
-						class = UCHARAT(regparse-2)+1;
-						classend = UCHARAT(regparse);
-						if (class > classend+1)
-							FAIL("invalid [] range");
-						for (; class <= classend; class++)
-							regc(class);
-						regparse++;
-					}
-				} else
-					regc(*regparse++);
-			}
-			regc('\0');
-			if (*regparse != ']')
-				FAIL("unmatched []");
-			regparse++;
-			*flagp |= HASWIDTH|SIMPLE;
-		}
-		break;
-	case '(':
-		ret = reg(1, &flags);
-		if (ret == NULL)
-			return(NULL);
-		*flagp |= flags&(HASWIDTH|SPSTART);
-		break;
-	case '\0':
-	case '|':
-	case ')':
-		FAIL("internal urp");	/* Supposed to be caught earlier. */
-		break;
-	case '?':
-	case '+':
-	case '*':
-		FAIL("?+* follows nothing");
-		break;
-	case '\\':
-		if (*regparse == '\0')
-			FAIL("trailing \\");
-		ret = regnode(EXACTLY);
-		regc(*regparse++);
-		regc('\0');
-		*flagp |= HASWIDTH|SIMPLE;
-		break;
-	default: {
-			register int len;
-			register unsigned char ender;
-
-			regparse--;
-#ifdef	STRCSPN
-			len = strcspn(regparse, (unsigned char *)META);
-#else
-			len = strcspn((char *)regparse, META);
-#endif
-			if (len <= 0)
-				FAIL("internal disaster");
-			ender = *(regparse+len);
-			if (len > 1 && ISMULT(ender))
-				len--;		/* Back off clear of ?+* operand. */
-			*flagp |= HASWIDTH;
-			if (len == 1)
-				*flagp |= SIMPLE;
-			ret = regnode(EXACTLY);
-			while (len > 0) {
-				regc(*regparse++);
-				len--;
-			}
-			regc('\0');
-		}
-		break;
-	}
-
-	return(ret);
-}
-
-/*
- - regnode - emit a node
- */
-STATIC unsigned char *			/* Location. */
-regnode(iop)
-int iop;
-{
-	register unsigned char *ret;
-	register unsigned char *ptr;
-	unsigned char op;
-
-	op = (unsigned char) iop;
-	ret = regcode;
-	if (ret == &regdummy) {
-		regsize += 3;
-		return(ret);
-	}
-
-	ptr = ret;
-	*ptr++ = op;
-	*ptr++ = '\0';		/* Null "next" pointer. */
-	*ptr++ = '\0';
-	regcode = ptr;
-
-	return(ret);
-}
-
-/*
- - regc - emit (if appropriate) a byte of code
- */
-STATIC void
-regc(ib)
-int ib;
-{
-	unsigned char b;
-
-	b = (unsigned char) ib;
-	if (regcode != &regdummy)
-		*regcode++ = b;
-	else
-		regsize++;
-}
-
-/*
- - reginsert - insert an operator in front of already-emitted operand
- *
- * Means relocating the operand.
- */
-STATIC void
-reginsert(iop, opnd)
-int iop;
-unsigned char *opnd;
-{
-	register unsigned char *src;
-	register unsigned char *dst;
-	register unsigned char *place;
-	unsigned char op;
-
-	op = (unsigned char) iop;
-	if (regcode == &regdummy) {
-		regsize += 3;
-		return;
-	}
-
-	src = regcode;
-	regcode += 3;
-	dst = regcode;
-	while (src > opnd)
-		*--dst = *--src;
-
-	place = opnd;		/* Op node, where operand used to be. */
-	*place++ = op;
-	*place++ = '\0';
-	*place++ = '\0';
-}
-
-/*
- - regtail - set the next-pointer at the end of a node chain
- */
-STATIC void
-regtail(p, val)
-unsigned char *p;
-unsigned char *val;
-{
-	register unsigned char *scan;
-	register unsigned char *temp;
-	register int offset;
-
-	if (p == &regdummy)
-		return;
-
-	/* Find last node. */
-	scan = p;
-	for (;;) {
-		temp = regnext(scan);
-		if (temp == NULL)
-			break;
-		scan = temp;
-	}
-
-	if (OP(scan) == BACK)
-		offset = scan - val;
-	else
-		offset = val - scan;
-	*(scan+1) = (offset>>8)&0377;
-	*(scan+2) = offset&0377;
-}
-
-/*
- - regoptail - regtail on operand of first argument; nop if operandless
- */
-STATIC void
-regoptail(p, val)
-unsigned char *p;
-unsigned char *val;
-{
-	/* "Operandless" and "op != BRANCH" are synonymous in practice. */
-	if (p == NULL || p == &regdummy || OP(p) != BRANCH)
-		return;
-	regtail(OPERAND(p), val);
-}
-
-/*
- * regexec and friends
- */
-
-/*
- * Global work variables for regexec().
- */
-STATIC unsigned char *reginput;		/* String-input pointer. */
-STATIC unsigned char *regbol;		/* Beginning of input, for ^ check. */
-STATIC unsigned char **regstartp;	/* Pointer to startp array. */
-STATIC unsigned char **regendp;		/* Ditto for endp. */
-
-#ifdef DEBUG
-int regnarrate = 0;
-void regdump();
-STATIC unsigned char *regprop();
-#endif
-
-/*
- - regexec - match a regexp against a string
- */
-int
-regexec(prog, string)
-register regexp *prog;
-register unsigned char *string;
-{
-	register unsigned char *s;
-#ifndef	STDLIB
-	extern char *strchr();
-#endif
-
-	/* Be paranoid... */
-	if (prog == NULL || string == NULL) {
-		regerror("NULL parameter");
-		return(0);
-	}
-
-	/* Check validity of program. */
-	if (UCHARAT(prog->program) != MAGIC) {
-		regerror("corrupted program");
-		return(0);
-	}
-
-	/* If there is a "must appear" string, look for it. */
-	if (prog->regmust != NULL) {
-		s = string;
-		while ((s = (unsigned char *)strchr((char *)s,prog->regmust[0]))
-		!= NULL) {
-			if (strncmp((char *)s, (char *)prog->regmust,
-			    prog->regmlen)
-			== 0)
-				break;	/* Found it. */
-			s++;
-		}
-		if (s == NULL)	/* Not present. */
-			return(0);
-	}
-
-	/* Mark beginning of line for ^ . */
-	regbol = string;
-
-	/* Simplest case:  anchored match need be tried only once. */
-	if (prog->reganch)
-		return(regtry(prog, string));
-
-	/* Messy cases:  unanchored match. */
-	s = string;
-	if (prog->regstart != '\0')
-		/* We know what char it must start with. */
-		while ((s = (unsigned char *)strchr((char *)s, prog->regstart))
-		!= NULL) {
-			if (regtry(prog, s))
-				return(1);
-			s++;
-		}
-	else
-		/* We don't -- general case. */
-		do {
-			if (regtry(prog, s))
-				return(1);
-		} while (*s++ != '\0');
-
-	/* Failure. */
-	return(0);
-}
-
-/*
- - regtry - try match at specific point
- */
-STATIC int			/* 0 failure, 1 success */
-regtry(prog, string)
-regexp *prog;
-unsigned char *string;
-{
-	register int i;
-	register unsigned char **sp;
-	register unsigned char **ep;
-
-	reginput = string;
-	regstartp = prog->startp;
-	regendp = prog->endp;
-
-	sp = prog->startp;
-	ep = prog->endp;
-	for (i = NSUBEXP; i > 0; i--) {
-		*sp++ = NULL;
-		*ep++ = NULL;
-	}
-	if (regmatch(prog->program + 1)) {
-		prog->startp[0] = string;
-		prog->endp[0] = reginput;
-		return(1);
-	} else
-		return(0);
-}
-
-/*
- - regmatch - main matching routine
- *
- * Conceptually the strategy is simple:  check to see whether the current
- * node matches, call self recursively to see whether the rest matches,
- * and then act accordingly.  In practice we make some effort to avoid
- * recursion, in particular by going through "ordinary" nodes (that don't
- * need to know whether the rest of the match failed) by a loop instead of
- * by recursion.
- */
-STATIC int			/* 0 failure, 1 success */
-regmatch(prog)
-unsigned char *prog;
-{
-	register unsigned char *scan;	/* Current node. */
-	unsigned char *next;		/* Next node. */
-#ifndef	STDLIB
-	extern char *strchr();
-#endif
-
-	scan = prog;
-#ifdef DEBUG
-	if (scan != NULL && regnarrate)
-		fprintf(stderr, "%s(\n", regprop(scan));
-#endif
-	while (scan != NULL) {
-#ifdef DEBUG
-		if (regnarrate)
-			fprintf(stderr, "%s...\n", regprop(scan));
-#endif
-		next = regnext(scan);
-
-		switch (OP(scan)) {
-		case BOL:
-			if (reginput != regbol)
-				return(0);
-			break;
-		case EOL:
-			if (*reginput != '\0')
-				return(0);
-			break;
-		case ANY:
-			if (*reginput == '\0')
-				return(0);
-			reginput++;
-			break;
-		case EXACTLY: {
-				register int len;
-				register unsigned char *opnd;
-
-				opnd = OPERAND(scan);
-				/* Inline the first character, for speed. */
-				if (*opnd != *reginput)
-					return(0);
-				len = strlen((char *)opnd);
-				if (len > 1 && strncmp((char *)opnd,
-				   (char *)reginput, len)
-				!= 0)
-					return(0);
-				reginput += len;
-			}
-			break;
-		case ANYOF:
-			if (*reginput == '\0'
-			|| strchr((char *)OPERAND(scan), *reginput) == NULL)
-				return(0);
-			reginput++;
-			break;
-		case ANYBUT:
-			if (*reginput == '\0'
-			|| strchr((char *)OPERAND(scan), *reginput) != NULL)
-				return(0);
-			reginput++;
-			break;
-		case NOTHING:
-			break;
-		case BACK:
-			break;
-		case OPEN+1:
-		case OPEN+2:
-		case OPEN+3:
-		case OPEN+4:
-		case OPEN+5:
-		case OPEN+6:
-		case OPEN+7:
-		case OPEN+8:
-		case OPEN+9: {
-				register int no;
-				register unsigned char *save;
-
-				no = OP(scan) - OPEN;
-				save = reginput;
-
-				if (regmatch(next)) {
-					/*
-					 * Don't set startp if some later
-					 * invocation of the same parentheses
-					 * already has.
-					 */
-					if (regstartp[no] == NULL)
-						regstartp[no] = save;
-					return(1);
-				} else
-					return(0);
-			}
-			break;
-		case CLOSE+1:
-		case CLOSE+2:
-		case CLOSE+3:
-		case CLOSE+4:
-		case CLOSE+5:
-		case CLOSE+6:
-		case CLOSE+7:
-		case CLOSE+8:
-		case CLOSE+9: {
-				register int no;
-				register unsigned char *save;
-
-				no = OP(scan) - CLOSE;
-				save = reginput;
-
-				if (regmatch(next)) {
-					/*
-					 * Don't set endp if some later
-					 * invocation of the same parentheses
-					 * already has.
-					 */
-					if (regendp[no] == NULL)
-						regendp[no] = save;
-					return(1);
-				} else
-					return(0);
-			}
-			break;
-		case BRANCH: {
-				register unsigned char *save;
-
-				if (OP(next) != BRANCH)		/* No choice. */
-					next = OPERAND(scan);	/* Avoid recursion. */
-				else {
-					do {
-						save = reginput;
-						if (regmatch(OPERAND(scan)))
-							return(1);
-						reginput = save;
-						scan = regnext(scan);
-					} while (scan != NULL && OP(scan) == BRANCH);
-					return(0);
-					/* NOTREACHED */
-				}
-			}
-			break;
-		case STAR:
-		case PLUS: {
-				register unsigned char nextch;
-				register int no;
-				register unsigned char *save;
-				register int min;
-
-				/*
-				 * Lookahead to avoid useless match attempts
-				 * when we know what character comes next.
-				 */
-				nextch = '\0';
-				if (OP(next) == EXACTLY)
-					nextch = *OPERAND(next);
-				min = (OP(scan) == STAR) ? 0 : 1;
-				save = reginput;
-				no = regrepeat(OPERAND(scan));
-				while (no >= min) {
-					/* If it could work, try it. */
-					if (nextch == '\0' || *reginput == nextch)
-						if (regmatch(next))
-							return(1);
-					/* Couldn't or didn't -- back up. */
-					no--;
-					reginput = save + no;
-				}
-				return(0);
-			}
-			break;
-		case END:
-			return(1);	/* Success! */
-			break;
-		default:
-			regerror("memory corruption");
-			return(0);
-			break;
-		}
-
-		scan = next;
-	}
-
-	/*
-	 * We get here only if there's trouble -- normally "case END" is
-	 * the terminating point.
-	 */
-	regerror("corrupted pointers");
-	return(0);
-}
-
-/*
- - regrepeat - repeatedly match something simple, report how many
- */
-STATIC int
-regrepeat(p)
-unsigned char *p;
-{
-	register int count = 0;
-	register unsigned char *scan;
-	register unsigned char *opnd;
-
-	scan = reginput;
-	opnd = OPERAND(p);
-	switch (OP(p)) {
-	case ANY:
-		count = strlen((char *)scan);
-		scan += count;
-		break;
-	case EXACTLY:
-		while (*opnd == *scan) {
-			count++;
-			scan++;
-		}
-		break;
-	case ANYOF:
-		while (*scan != '\0' && strchr((char *)opnd, *scan) != NULL) {
-			count++;
-			scan++;
-		}
-		break;
-	case ANYBUT:
-		while (*scan != '\0' && strchr((char *)opnd, *scan) == NULL) {
-			count++;
-			scan++;
-		}
-		break;
-	default:		/* Oh dear.  Called inappropriately. */
-		regerror("internal foulup");
-		count = 0;	/* Best compromise. */
-		break;
-	}
-	reginput = scan;
-
-	return(count);
-}
-
-/*
- - regnext - dig the "next" pointer out of a node
- */
-STATIC unsigned char *
-regnext(p)
-register unsigned char *p;
-{
-	register int offset;
-
-	if (p == &regdummy)
-		return(NULL);
-
-	offset = NEXT(p);
-	if (offset == 0)
-		return(NULL);
-
-	if (OP(p) == BACK)
-		return(p-offset);
-	else
-		return(p+offset);
-}
-
-#ifdef DEBUG
-
-STATIC unsigned char *regprop();
-
-/*
- - regdump - dump a regexp onto stdout in vaguely comprehensible form
- */
-void
-regdump(r)
-regexp *r;
-{
-	register unsigned char *s;
-	register unsigned char op = EXACTLY;	/* Arbitrary non-END op. */
-	register unsigned char *next;
-	extern char *strchr();
-
-
-	s = r->program + 1;
-	while (op != END) {	/* While that wasn't END last time... */
-		op = OP(s);
-		printf("%2d%s", s-r->program, regprop(s));	/* Where, what. */
-		next = regnext(s);
-		if (next == NULL)		/* Next ptr. */
-			printf("(0)");
-		else 
-			printf("(%d)", (s-r->program)+(next-s));
-		s += 3;
-		if (op == ANYOF || op == ANYBUT || op == EXACTLY) {
-			/* Literal string, where present. */
-			while (*s != '\0') {
-				putchar(*s);
-				s++;
-			}
-			s++;
-		}
-		putchar('\n');
-	}
-
-	/* Header fields of interest. */
-	if (r->regstart != '\0')
-		printf("start `%c' ", r->regstart);
-	if (r->reganch)
-		printf("anchored ");
-	if (r->regmust != NULL)
-		printf("must have \"%s\"", r->regmust);
-	printf("\n");
-}
-
-/*
- - regprop - printable representation of opcode
- */
-STATIC unsigned char *
-regprop(op)
-unsigned char *op;
-{
-	register unsigned char *p;
-	STATIC unsigned char buf[50];
-
-	(void) strcpy(buf, ":");
-
-	switch (OP(op)) {
-	case BOL:
-		p = "BOL";
-		break;
-	case EOL:
-		p = "EOL";
-		break;
-	case ANY:
-		p = "ANY";
-		break;
-	case ANYOF:
-		p = "ANYOF";
-		break;
-	case ANYBUT:
-		p = "ANYBUT";
-		break;
-	case BRANCH:
-		p = "BRANCH";
-		break;
-	case EXACTLY:
-		p = "EXACTLY";
-		break;
-	case NOTHING:
-		p = "NOTHING";
-		break;
-	case BACK:
-		p = "BACK";
-		break;
-	case END:
-		p = "END";
-		break;
-	case OPEN+1:
-	case OPEN+2:
-	case OPEN+3:
-	case OPEN+4:
-	case OPEN+5:
-	case OPEN+6:
-	case OPEN+7:
-	case OPEN+8:
-	case OPEN+9:
-		sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN);
-		p = NULL;
-		break;
-	case CLOSE+1:
-	case CLOSE+2:
-	case CLOSE+3:
-	case CLOSE+4:
-	case CLOSE+5:
-	case CLOSE+6:
-	case CLOSE+7:
-	case CLOSE+8:
-	case CLOSE+9:
-		sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE);
-		p = NULL;
-		break;
-	case STAR:
-		p = "STAR";
-		break;
-	case PLUS:
-		p = "PLUS";
-		break;
-	default:
-		regerror("corrupted opcode");
-		break;
-	}
-	if (p != NULL)
-		(void) strcat(buf, p);
-	return(buf);
-}
-#endif
-
-/*
- * The following is provided for those people who do not have strcspn() in
- * their C libraries.  They should get off their butts and do something
- * about it; at least one public-domain implementation of those (highly
- * useful) string routines has been published on Usenet.
- */
-#ifdef STRCSPN
-/*
- * strcspn - find length of initial segment of s1 consisting entirely
- * of characters not from s2
- */
-
-STATIC int
-strcspn(s1, s2)
-unsigned char *s1;
-unsigned char *s2;
-{
-	register unsigned char *scan1;
-	register unsigned char *scan2;
-	register int count;
-
-	count = 0;
-	for (scan1 = s1; *scan1 != '\0'; scan1++) {
-		for (scan2 = s2; *scan2 != '\0';)	/* ++ moved down. */
-			if (*scan1 == *scan2++)
-				return(count);
-		count++;
-	}
-	return(count);
-}
-#endif
Index: trunk/minix/commands/cawf/regexp.h
===================================================================
--- trunk/minix/commands/cawf/regexp.h	(revision 9)
+++ 	(revision )
@@ -1,17 +1,0 @@
-/*
- * Definitions etc. for regexp(3) routines.
- *
- * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
- * not the System V one.
- */
-#define NSUBEXP  10
-typedef struct regexp {
-	unsigned char *startp[NSUBEXP];
-	unsigned char *endp[NSUBEXP];
-	unsigned char regstart;		/* Internal use only. */
-	unsigned char reganch;		/* Internal use only. */
-	unsigned char *regmust;		/* Internal use only. */
-	unsigned char regmlen;		/* Internal use only. */
-	unsigned char program[1];	/* Unwarranted chumminess with
-					 * compiler. */
-} regexp;
Index: trunk/minix/commands/cawf/regmagic.h
===================================================================
--- trunk/minix/commands/cawf/regmagic.h	(revision 9)
+++ 	(revision )
@@ -1,5 +1,0 @@
-/*
- * The first byte of the regexp internal "program" is actually this magic
- * number; the start node begins in the second byte.
- */
-#define	MAGIC	0234
Index: trunk/minix/commands/cawf/store.c
===================================================================
--- trunk/minix/commands/cawf/store.c	(revision 9)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- *	store.c - cawf(1) storage areas
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-
-struct rx Pat[] = {
-	{ "^[.'](i[ef]|el)",			 	NULL},	/* 0 */
-	{ "^[.']i[ef] !",				NULL},  /* 1 */
-	{ "^[.']i[ef] !?\\\\n\\(\\.\\$(>|>=|=|<|<=)[0-9] ",
-							NULL},	/* 2 */
-	{ "^[.']i[ef] !?'\\\\\\$[0-9]'[^']*' ",		NULL},	/* 3 */
-	{ "^[.']i[ef] !?[nt] ",				NULL},  /* 4 */
-	{ "\\\\\\$[0-9]",                               NULL},  /* 5 */
-	{ "^[ \t]*$",					NULL},  /* 6 */
-	{ "\\\\|\t|-|  ",				NULL},	/* 7 */
-	{ "[.!?:][]\\)'\\\"\\*]*$",                     NULL},  /* 8 */
-	{ ",fP",					NULL},	/* 9 */
-	{ ",tP",					NULL},	/* 10 */
-	{ "^(ta|ll|ls|in|ti|po|ne|sp|pl|nr)",           NULL},  /* 11 */
-	{ "^(ll|ls|in|ti|po|pl)",                       NULL},  /* 12 */
-	{ "[]\\)'\\\"\\*]",                             NULL},  /* 13 */
-	{ "^(LH|CH|RH|LF|CF|RF)",			NULL},	/* 14 */
-	{ "^[.']i[ef]",			 		NULL},	/* 15 */
-	{ ",fR",					NULL},	/* 16 */
-	{ NULL,                                         NULL}   /* END */
-};
-
-int Adj = BOTHADJ;			/* output line adjustment mode */
-unsigned char *Aftnxt = NULL;		/* action after next line */
-unsigned char *Args[] = { NULL, NULL,	/* 10 macro arguments */
-			  NULL, NULL,
-			  NULL, NULL,
-			  NULL, NULL,
-			  NULL, NULL
-};
-unsigned char *Argstack[10*MAXSP];	/* stack for Expand()'s "args[]" */
-int Backc = 0;				/* last word ended with '\\c' */
-int Botmarg = 5;			/* bottom margin */
-int Centering = 0;			/* centering count */
-int Condstack[MAXSP];                   /* stack for Expand()'s "cond" */
-unsigned char *Cont = NULL;		/* continue line append */
-int Contlen = 0;			/* continue line append length */
-int Curmx = -1;				/* current macro index */
-char *Device = NULL;			/* output device name */
-char *Devconf = NULL;			/* device configuration file path */
-char *Devfont = NULL;			/* output device font */
-int Divert = 0;                         /* diversion status */
-FILE *Efs = NULL;			/* error file stream */
-unsigned char *Eol = NULL;		/* end of line information */
-int Eollen = 0;				/* end of line length */
-int Err = 0;                            /* error flag */
-unsigned char *F = NULL;		/* field value */
-struct fcode Fcode[] = {		/* font codes */
-	{ 'B',  '\0'},			/* Bold */
-	{ 'I',  '\0'},			/* Italic */
-	{ 'R',  '\0'},			/* Roman */
-	{ 'C',  '\0'},			/* Courier */
-	{ '\0', '\0'}
-};
-int Fill = 0;				/* fill status */
-unsigned char Font[] = { '\0', '\0' };	/* current font */
-int Fontctl;				/* output font control */
-char Fontstat = 'R';			/* output font status */
-int Fph = 0;				/* first page header status */
-int Fsp = 0;				/* files stack pointer (for .so) */
-struct fontstr Fstr;			/* font control strings */
-unsigned char *Ftc = NULL;		/* center footer */
-unsigned char *Ftl = NULL;		/* left footer */
-unsigned char *Ftr = NULL;		/* right footer */
-unsigned char *Hdc = NULL;		/* center header */
-int Hdft = 0;				/* header/footer status */
-unsigned char *Hdl = NULL;		/* left header */
-unsigned char *Hdr = NULL;		/* right header */
-struct hytab Hychar[MAXHYCH];		/* hyphen characters */
-FILE *Ifs = NULL;			/* input file stream */
-FILE *Ifs_stk[MAXFSTK];                 /* Ifs stack */
-int Ind = 0;				/* indentation amount */
-unsigned char *Inname = NULL;		/* input file name */
-unsigned char *Inn_stk[MAXFSTK];	/* Inname stack */
-int LL = 78;				/* line length (default) */
-unsigned char Line[MAXLINE];		/* input line */
-int Lockil = 0;                      	/* pass 2 line number is locked
-                                         * (processing is inside macro) */
-int Marg = 0;				/* macro argument - man, ms, etc. */
-struct macro Macrotab[MAXMACRO];        /* macro table */
-unsigned char *Macrotxt[MAXMTXT];	/* macro text */
-int Mtx = 0;                            /* macro text index */
-int Mxstack[MAXSP];                     /* stack for Expand()'s "mx" */
-int Nfc;				/* number of font codes */
-int Nhnr[MAXNHNR];                      /* ".NH" numbers */
-int Nhy = 0;				/* number of Hychar[] entries */
-int Nleftstack[MAXSP];                  /* stack for Expand()'s "nleft" */
-int Nmac = 0;                           /* number of macros */
-int Nnr = 0;				/* number of Numb[] entries */
-int Nospmode = 1;                    	/* no space mode */
-int Nparms = 0;				/* number of Parms[] entries */
-int NR = 0;                             /* number of record ala awk */
-int NR_stk[MAXFSTK];                   	/* NR stack */
-int Nsch = 0;				/* number of Schar[] entries */
-int Nstr = 0;				/* number of entries in Str[] */
-int Ntabs = 0;				/* number of TAB positions */
-struct nbr Numb[MAXNR];			/* number registers */
-int Nxtln = 1;				/* next line number */
-int Outll = -1;				/* output line length */
-unsigned char Outln[MAXOLL*2];		/* output line */
-int Outlx = 0;				/* output line index */
-int P2il = 0; 	                        /* pass 2 input line number */
-unsigned char *P2name = NULL;		/* pass 2 input file name */
-int P3fill = 1;				/* pass 3 fill status */
-int Padchar[MAXOLL];			/* padding character locations */
-int Padfrom = PADLEFT;			/* which end to pad from */
-int Padx = 0;				/* Padchar[] index */
-struct parms Parms[] = {                /* parameter registers */
-	{ {'i', 'n'}, "indent", 0, 0      },
-	{ {'l', 'l'}, "linelen", 0, 0     },
-	{ {'l', 's'}, "vspace", 0, 0	  },
-	{ {'t', 'i'}, "tempindent", 0, 0  },
-	{ {'p', 'o'}, "pageoffset", 0, 0  },
-	{ {'p', 'l'}, "pagelen", 0, 0     },
-	{ {'\0', '\0'}, NULL, 0, 0        }
-};
-unsigned char Pass1ln[MAXLINE];		/* pass 1 output line */
-unsigned char Pass2ln[MAXLINE];		/* pass 2 output line */
-int Pglen = 66;				/* page length */
-int Pgoff = 0;				/* page offset */
-char *Pname = NULL;			/* program name */
-unsigned char Prevfont = '\0';		/* previous font */
-int Ptrstack[MAXSP];                    /* stack for Expand()'s "ptr" */
-struct scale Scale[] = {		/* scaling factors */
-	{ 'i',	(240.0)		 	},
-	{ 'c',	((240.0 * 50.0)/127.0)	},
-	{ 'P',	(240.0/6.0)		},
-	{ 'p',	(240.0/72.0)		},
-	{ 'u',  (1.0)                   },
-	{ 'm',  (1.0)                   },
-	{ 'n',  (1.0)                   },
-	{ 'v',  (1.0)                   },
-	{ '\0',	(0.0)			}
-};
-double Scalen = 0.0;			/* 'n' scaling factor */
-double Scaleu = 0.0;			/* 'u' scaling factor */
-double Scalev = 0.0;			/* 'v' scaling factor */
-struct schtab Schar[MAXSCH];		/* special characters */
-int Sp = -1;				/* stack pointer */
-struct str Str[MAXSTR];                 /* ".ds" strings */
-int Sx = -1;				/* string index */
-int Tabs[MAXEXP+1];			/* TAB positions */
-int Thispg = 1;				/* this page number */
-int Tind = 0; 				/* temporary indentation amount */
-int Topmarg = 5;			/* top margin */
-unsigned char *Trtbl = NULL;		/* .tr table */
-int Uhyph = 0;				/* hyphen usage state */
-int Vspace = 1;				/* vertical (inter-text-line) spacing */
-unsigned char Word[MAXLINE];		/* pass 2 word buffer */
-int Wordl = 0;                          /* effective length of Word[] */
-int Wordx = 0;                          /* Word[] index */
-int Dowarn = 1;				/* Enable warnings if true */
Index: trunk/minix/commands/cawf/string.c
===================================================================
--- trunk/minix/commands/cawf/string.c	(revision 9)
+++ 	(revision )
@@ -1,351 +1,0 @@
-/*
- *	string.c - string support functions for cawf(1)
- */
-
-/*
- *	Copyright (c) 1991 Purdue University Research Foundation,
- *	West Lafayette, Indiana 47907.  All rights reserved.
- *
- *	Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
- *	University Computing Center.  Not derived from licensed software;
- *	derived from awf(1) by Henry Spencer of the University of Toronto.
- *
- *	Permission is granted to anyone to use this software for any
- *	purpose on any computer system, and to alter it and redistribute
- *	it freely, subject to the following restrictions:
- *
- *	1. The author is not responsible for any consequences of use of
- *	   this software, even if they arise from flaws in it.
- *
- *	2. The origin of this software must not be misrepresented, either
- *	   by explicit claim or by omission.  Credits must appear in the
- *	   documentation.
- *
- *	3. Altered versions must be plainly marked as such, and must not
- *	   be misrepresented as being the original software.  Credits must
- *	   appear in the documentation.
- *
- *	4. This notice may not be removed or altered.
- */
-
-#include "cawf.h"
-#include <ctype.h>
-
-_PROTOTYPE(static void Setroman,());
-
-
-/*
- * Asmname(s, c) - assemble name
- */
-
-Asmname(s, c)
-	unsigned char *s;		/* pointer to name */
-	unsigned char *c;		/* code destination (c[3]) */
-{
-
-	c[1] = c[2] = '\0';
-	while (*s && *s == ' ')
-		s++;
-	if ((c[0] = *s) == '\0')
-		return(0);
-	return(((c[1] = s[1]) == '\0') ? 1 : 2);
-}
-
-
-/*
- * Delstr(sx) - delete string
- */
-
-void
-Delstr(sx)
-	int sx;				/* string index */
-{
-	char buf[MAXLINE];		/* message buffer */
-
-	if (sx >= Nstr) {
-		(void) sprintf(buf, " bad Delstr(%d) index", sx);
-		Error(FATAL, LINE, buf, NULL);
-	}
-	Free(&Str[sx].str);
-	while (sx < (Nstr - 1)) {
-		Str[sx] = Str[sx + 1];
-		sx++;
-	}
-	Nstr--;
-}
-
-
-/*
- * Endword() - end a word
- */
-
-void
-Endword()
-{
-	if (Fontstat != 'R')
-		Setroman();
-	Word[Wordx] = '\0';
-}
-
-
-/*
- * Findchar(nm, l, s, e) - find special character definition and
- *			   optionally enter it
- */
-
-Findchar(nm, l, s, e)
-	unsigned char *nm;		/* character name */
-	int l;				/* effective length */
-	unsigned char *s;		/* value string */
-	int e;				/* 0 = find, don't enter
-					 * 1 = don't find, enter */
-{
-	int cmp, hi, low, mid;
-	unsigned char c[3];
-
-	c[0] = nm[0];
-	c[1] = (nm[1] == ' ' || nm[1] == '\t') ? '\0' : nm[1];
-	c[2] = '\0';
-	low = mid = 0;
-	hi = Nsch - 1;
-	while (low <= hi) {
-		mid = (low + hi) / 2;
-		if ((cmp = strncmp((char *)c, (char *)Schar[mid].nm, 2)) < 0)
-			hi = mid - 1;
-		else if (cmp > 0)
-			low = mid + 1;
-		else {
-			if ( ! e)
-				return(mid);
-			Free(&Schar[mid].str);
-			goto new_char;
-		}
-	}
-	if ( ! e)
-		return(-1);
-	if (Nsch >= MAXSCH)
-		Error(FATAL, LINE, " at character table limit", NULL);
-	if (Nsch) {
-		if (cmp > 0)
-			mid++;
-		for (hi = Nsch - 1; hi >= mid; hi--)
-			Schar[hi+1] = Schar[hi];
-	}
-	Nsch++;
-	Schar[mid].nm[0] = c[0];
-	Schar[mid].nm[1] = c[1];
-
-new_char:
-
-	Schar[mid].str = Newstr(s);
-	Schar[mid].len = l;
-	return(mid);
-}
-
-
-/*
- * Findhy(s, l, e) - find and optionally enter hyphen
- */
-
-Findhy(s, l, e)
-	unsigned char *s;		/* value string */
-	int l;				/* equivalent length */
-	int e;				/* 0 = find, don't enter
-					 * 1 = enter, don't find */
-{
-	int i;
-
-	for (i = 0; i < Nhy; i++) {
-		if (Font[0] == Hychar[i].font)
-			break;
-	}
-	if (i >= Nhy) {
-		if ( ! e)
-			return(-1);
-		if (Nhy >= MAXHYCH)
-			Error(FATAL, LINE, " at hyphen limit for font ",
-				(char *)Font);
-		Hychar[i].font = Font[0];
-		Nhy++;
-	} else {
-		if ( ! e)
-			return(i);
-		Error(WARN, LINE, " duplicate hyphen for font ", (char *)Font);
-		Free(&Hychar[i].str);
-	}
-	Hychar[i].str = Newstr(s);
-	Hychar[i].len = l;
-	return(i);
-}
-
-
-/*
- * Findstr(nm, s, e) - find and  optionally enter string in Str[]
- */
-
-unsigned char *
-Findstr(nm, s, e)
-	unsigned char *nm;		/* 2 character string name */
-	unsigned char *s;		/* string value */
-	int e;				/* 0 = find, don't enter
-					 * 1 = enter, don't find */
-{
-	unsigned char c[3];		/* character buffer */
-	int cmp, hi, low, mid;		/* binary search controls */
-	int i;				/* temporary indexes */
-	unsigned char *s1, *s2;		/* temporary string pointers */
-
-	c[0] = nm[0];
-	c[1] = (nm[1] == ' ' || nm[1] == '\t') ? '\0' : nm[1];
-	c[2] = '\0';
-	low = mid = 0;
-	hi = Nstr - 1;
-	Sx = -1;
-	while (low <= hi) {
-		mid = (low + hi) / 2;
-		if ((cmp = strncmp((char *)c, (char *)Str[mid].nm, 2)) < 0)
-			hi = mid - 1;
-		else if (cmp > 0)
-			low = mid + 1;
-		else {
-			Sx = mid;
-			if ( ! e)
-				return(Str[mid].str);
-			Free(&Str[mid].str);
-			goto new_string;
-		}
-	}
-	if ( ! e)
-		return((unsigned char *)"");
-	if (Nstr >= MAXSTR)
-		Error(FATAL, LINE, " out of space for string ", (char *)c);
-	if (Nstr) {
-		if (cmp > 0)
-			mid++;
-		for (hi = Nstr - 1; hi >= mid; hi--)
-			Str[hi+1] = Str[hi];
-	}
-	Nstr++;
-	Sx = mid;
-	Str[mid].nm[0] = c[0];
-	Str[mid].nm[1] = c[1];
-
-new_string:
-
-	if (s == NULL)
-		return (Str[mid].str = Newstr((unsigned char *)""));
-	i = (*s == '"') ? 1 : 0;
-	s1 = Str[mid].str = Newstr(s + i);
-	if (i) {
-		s2 = s1 + strlen((char *)s1);
-		if (s2 > s1 && *(s2-1) == '"')
-			*(s2-1) = '\0';
-	}
-	return(s1);
-}
-
-
-/*
- * Setroman() - set Roman font
- */
-
-static void
-Setroman()
-{
-	int i;
-
-	if ((Wordx + Fstr.rl) >= MAXLINE)
-		Error(WARN, LINE, " word too long", NULL);
-	else {
-		if (Fstr.r) {
-			for (i = 0; i < Fstr.rl; i++) {
-				Word[Wordx++] = Fstr.r[i];
-			}
-	    	}
-		Fontstat = 'R';
-	}
-}
-
-
-/*
- * Str2word(s, len) - copy len characters from string to Word[]
- */
-
-Str2word(s, len)
-	unsigned char *s;
-	int len;
-{
-	int i;
-
-	for (; len > 0; len--, s++) {
-		switch (Font[0]) {
-		case 'B':
-		case 'C':
-			if (Fontctl == 0) {
-				if ((Wordx + 5) >= MAXLINE) {
-word_too_long:
-					Error(WARN, LINE, " word too long",
-						NULL);
-					return(1);
-				}
-				Word[Wordx++] = Trtbl[(int)*s];
-				Word[Wordx++] = '\b';
-				Word[Wordx++] = Trtbl[(int)*s];
-				Word[Wordx++] = '\b';
-				Word[Wordx++] = Trtbl[(int)*s];
-				break;
-			}
-			if (Fontstat != Font[0]) {
-				if (Fontstat != 'R')
-					Setroman();
-				if ((Wordx + Fstr.bl) >= MAXLINE)
-					goto word_too_long;
-				if (Fstr.b) {
-					for (i = 0; i < Fstr.bl; i++) {
-						Word[Wordx++] = Fstr.b[i];
-					}
-				}
-				Fontstat = Font[0];
-			}
-			if ((Wordx + 1) >= MAXLINE)
-				goto word_too_long;
-			Word[Wordx++] = Trtbl[(int)*s];
-			break;
-		case 'I':
-			if (isalnum(*s)) {
-				if (Fontctl == 0) {
-					if ((Wordx + 3) >= MAXLINE)
-						goto word_too_long;
-					Word[Wordx++] = '_';
-					Word[Wordx++] = '\b';
-					Word[Wordx++] = Trtbl[(int)*s];
-					break;
-				}
-				if (Fontstat != 'I') {
-					if (Fontstat != 'R')
-						Setroman();
-					if ((Wordx + Fstr.itl) >= MAXLINE)
-						goto word_too_long;
-					if (Fstr.it) {
-					    for (i = 0; i < Fstr.itl; i++) {
-						Word[Wordx++] = Fstr.it[i];
-					    }
-					}
-					Fontstat = 'I';
-				}
-				if ((Wordx + 1) >= MAXLINE)
-					goto word_too_long;
-				Word[Wordx++] = Trtbl[(int)*s];
-				break;
-			}
-			/* else fall through */
-		default:
-			if (Fontstat != 'R')
-				Setroman();
-			if ((Wordx + 1) >= MAXLINE)
-				goto word_too_long;
-			Word[Wordx++] = Trtbl[(int)*s];
-		}
-	}
-	return(0);
-}
