[alt.sources] STDWIN 0.9.5, Part 17/19

guido@cwi.nl (Guido van Rossum) (03/04/91)

Archive-name: stdwin/part17

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 17 (of 19)."
# Contents:  Appls/bed/mmenu.c Appls/dpv/README Appls/dpv/dpv.c
#   Appls/dpv/funnytab Appls/dpv/trans Appls/klok/bsdsetdate.c
#   Appls/miniedit/regsub.c Appls/test/multiwin.c Conf/makemakefile
#   Conf/mkmf Conf/proto.conf Gen/wdrawpar.c Gen/wtextbreak.c
#   H/stdwtext.h Packs/textedit/textdbg.c Ports/alfa/To.do
#   Ports/mac/dprintf.c Ports/mac/scrap.c Ports/mac/timer.c
#   Ports/vtrm/DIST/README Ports/x11/error.c Tools/getopt.c
# Wrapped by guido@voorn.cwi.nl on Mon Mar  4 12:37:35 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Appls/bed/mmenu.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/bed/mmenu.c'\"
else
echo shar: Extracting \"'Appls/bed/mmenu.c'\" \(1938 characters\)
sed "s/^X//" >'Appls/bed/mmenu.c' <<'END_OF_FILE'
X#include "bed.h"
X#include "menu.h"
X
Xint	state = PENCIL_ITEM ;
X
Xextern MENU	*pmmenu ;
Xextern MENU	*popmenu ;
X
Xextern bool	drawline ;
X
Xextern bool	drawcircle ;
X
Xextern bool	selrect ;
Xextern int	sr_left ;
Xextern int	sr_top ;
Xextern int	sr_right ;
Xextern int	sr_bottom ;
X
Xextern void	invertbit () ;
X
Xvoid
Xdo_mode_menu (ep)
X	EVENT	*ep ;
X{
X	int	i ;
X
X	switch (ep->u.m.item) {
X	case PENCIL_ITEM :
X		if (drawline) {
X			plotline (invertbit, FALSE) ;
X			drawline = FALSE ;
X		}
X		else if (drawcircle) {
X			plotcircle (invertbit, FALSE) ;
X			drawcircle = FALSE ;
X		}
X		else if (selrect) {
X			drawselrect (sr_left, sr_top, sr_right, sr_bottom) ;
X			selrect = FALSE ;
X		}
X
X		wmenucheck (pmmenu, state, FALSE) ;
X		wmenucheck (pmmenu, PENCIL_ITEM, TRUE) ;
X		state = PENCIL_ITEM ;
X		break ;
X	case LINE_ITEM :
X		if (drawcircle) {
X			plotcircle (invertbit, FALSE) ;
X			drawcircle = FALSE ;
X		}
X		else if (selrect) {
X			drawselrect (sr_left, sr_top, sr_right, sr_bottom) ;
X			selrect = FALSE ;
X		}
X
X		wmenucheck (pmmenu, state, FALSE) ;
X		wmenucheck (pmmenu, LINE_ITEM, TRUE) ;
X		state = LINE_ITEM ;
X		break ;
X	case CIRCLE_ITEM :
X		if (drawline) {
X			plotline (invertbit, FALSE) ;
X			drawline = FALSE ;
X		}
X		else if (selrect) {
X			drawselrect (sr_left, sr_top, sr_right, sr_bottom) ;
X			selrect = FALSE ;
X		}
X
X		wmenucheck (pmmenu, state, FALSE) ;
X		wmenucheck (pmmenu, CIRCLE_ITEM, TRUE) ;
X		state = CIRCLE_ITEM ;
X		break ;
X	case SELECT_ITEM :
X		if (drawline) {
X			plotline (invertbit, FALSE) ;
X			drawline = FALSE ;
X		}
X		else if (drawcircle) {
X			plotcircle (invertbit, FALSE) ;
X			drawcircle = FALSE ;
X		}
X
X		wmenucheck (pmmenu, state, FALSE) ;
X		wmenucheck (pmmenu, SELECT_ITEM, TRUE) ;
X		state = SELECT_ITEM ;
X		break ;
X	}
X
X	if (state == SELECT_ITEM) {
X		for (i = TRANS_MAJ_ITEM ; i <= FLIP_VERT_ITEM ; ++i)
X			wmenuenable (popmenu, i, TRUE) ;
X	}
X	else {
X		for (i = TRANS_MAJ_ITEM ; i <= FLIP_VERT_ITEM ; ++i)
X			wmenuenable (popmenu, i, FALSE) ;
X	}
X}
END_OF_FILE
if test 1938 -ne `wc -c <'Appls/bed/mmenu.c'`; then
    echo shar: \"'Appls/bed/mmenu.c'\" unpacked with wrong size!
fi
# end of 'Appls/bed/mmenu.c'
fi
if test -f 'Appls/dpv/README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/dpv/README'\"
else
echo shar: Extracting \"'Appls/dpv/README'\" \(2323 characters\)
sed "s/^X//" >'Appls/dpv/README' <<'END_OF_FILE'
XName:		dpv -- Ditroff previewer using STDWIN
XAuthor:		Guido van Rossum
XStarted:	Jan 12 1988
X
XDitroff output describes pages to be typeset (see comments in the source
Xfor a description).
XPages are started by 'p' commands.
XEach page is a contiguous segment of the file, but operations within a
Xpage can contain arbitrary vertical movements.  I have made the decision
Xnot to display the entire file as one document, since this would limit
Xus to approx. 32 pages (given a practical limit on STDWIN documents of
X32K pixels, and an average screen height of 1K pixels).
XTo allow reasonably efficient displaying, we need to remember the file
Xoffsets where each page starts in the input, and the state of the
Xditroff engine at the start of the page (font etc.).  Thus, we must make
Xa pre-scan of the input to compute this info; after that, the draw
Xprocedure only needs to read the particular page being displayed.
X(Note that it would be easy enough to change the interface so that all
Xpages are mapped to a single document.)
XAs an optimization, we actually don't pre-scan the entire file when the
Xprogram starts up; rather, when a page is first displayed the pre-scan
Xinformation is computed as a by-product of the displaying process.
XThere are two page numbering schemes: internally, the pages are always
Xnumbered 0, 1, ..., with 0 being the configuration data (everything that
Xcomes before the first 'p' command).  Externally, page numbers are taken
Xfrom the argument to the 'p' command.
X
XState to remember for each page start:
X- mounted fonts ('x f' command)
X- character height and slant ('x H' and 'x S' commands) (not used?)
X- current font and size
X
XThe following state, although it can be reset using 'x' commands, is
Xassumed to be set once and for all on page 0:
X- device name ('x T' command)
X- resolution ('x r' command)
X
XFormally, one should also remember the stack of state records
Xmanipulated by '{' and '}' commands; I assume these are used only by
Xpictures, and the stack is empty at page boundaries.
X
XTO DO:
X
XPrint special chars as what they should look like, instead of as their
Xditroff names.
X
XUse real troff fonts.  This requires a translation between ASCII codes
Xoutput by ditroff and character codes in the font.  Perhaps the fonts
Xshould be stored different, so that for ASCII at least no mapping is
Xnecessary.
END_OF_FILE
if test 2323 -ne `wc -c <'Appls/dpv/README'`; then
    echo shar: \"'Appls/dpv/README'\" unpacked with wrong size!
fi
# end of 'Appls/dpv/README'
fi
if test -f 'Appls/dpv/dpv.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/dpv/dpv.c'\"
else
echo shar: Extracting \"'Appls/dpv/dpv.c'\" \(1986 characters\)
sed "s/^X//" >'Appls/dpv/dpv.c' <<'END_OF_FILE'
X/* dpv -- ditroff previewer.  Main program. */
X
X#include "dpv.h"
X
Xint	dbg;		/* Amount of debugging output wanted */
Xint	windowarn;	/* Set if errors must go to dialog box */
X
Xchar   *progname= "dpv"; /* Program name if not taken from argv[0] */
X
X/* Main program.  Scan arguments and call other routines. */
X
Xmain(argc, argv)
X	int argc;
X	char **argv;
X{
X	int firstpage;
X	
X	winitargs(&argc, &argv);
X	
X	if (argc > 0 && *argv != NULL && **argv != EOS) {
X		progname= rindex(argv[0], '/');
X		if (progname != NULL)
X			++progname;
X		else
X			progname= argv[0];
X	}
X	
X	for (;;) {
X		int c;
X		
X		c= getopt(argc, argv, "df:t:P:");
X		if (c == EOF)
X			break;
X		switch (c) {
X		
X		case 'f':	/* Alternate funnytab file */
X			funnyfile = optarg;
X			break;
X		
X		case 't':	/* Alternative font translations file */
X			readtrans(optarg);
X			break;
X		
X		case 'd':	/* Ask for debugging output */
X			++dbg; /* Use -dd to increment debug level */
X			break;
X		
X		case 'P':	/* Add printer definition */
X			addprinter(optarg);
X			break;
X		
X		default:
X			usage();
X			/*NOTREACHED*/
X		
X		}
X	}
X	
X	if (optind < argc && argv[optind][0] == '+') {
X		if (argv[optind][1] == EOS ||
X			argv[optind][1] == '$')
X			firstpage= 32000;
X		else
X			firstpage= atoi(argv[optind] + 1);
X		++optind;
X	}
X	else
X		firstpage= 1;
X	
X	if (optind+1 != argc || strcmp(argv[optind], "-") == 0)
X		usage();
X	
X	windowarn= 1; /* From now on, use dialog box for warnings */
X	
X	preview(argv[optind], firstpage);
X	
X	exit(0);
X}
X
Xusage()
X{
X	error(ABORT,
X"usage: %s [-d] [-f funnytab] [-t translationsfile] [-P printer] [+page] file",
X	    progname);
X}
X
X/*VARARGS2*/
Xerror(f, s, a1, a2, a3, a4, a5, a6, a7)
X	int f;
X	char *s;
X{
X	if (f != WARNING || !windowarn) { /* Use stderr */
X		if (f != 0)
X			wdone();
X		fprintf(stderr, "%s: ", progname);
X		fprintf(stderr, s, a1, a2, a3, a4, a5, a6, a7);
X		fprintf(stderr, "\n");
X		if (f != 0)
X			exit(f);
X	}
X	else { /* use dialog box */
X		char buf[256];
X		sprintf(buf, s, a1, a2, a3, a4, a5, a6, a7);
X		wmessage(buf);
X	}
X}
END_OF_FILE
if test 1986 -ne `wc -c <'Appls/dpv/dpv.c'`; then
    echo shar: \"'Appls/dpv/dpv.c'\" unpacked with wrong size!
fi
# end of 'Appls/dpv/dpv.c'
fi
if test -f 'Appls/dpv/funnytab' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/dpv/funnytab'\"
else
echo shar: Extracting \"'Appls/dpv/funnytab'\" \(2307 characters\)
sed "s/^X//" >'Appls/dpv/funnytab' <<'END_OF_FILE'
XoA	r3symbol	0x22
XoE	r3symbol	0x24
Xcn	r3symbol	0x27
X**	r3symbol	0x2A
Xpl	r3symbol	0x2B
Xmi	r3symbol	0x2D
Xsl	r3symbol	0x2F
Xeq	r3symbol	0x3D
X=~	r3symbol	0x40
X*A	r3symbol	0x41
X*B	r3symbol	0x42
X*X	r3symbol	0x43
X*D	r3symbol	0x44
X*E	r3symbol	0x45
X*F	r3symbol	0x46
X*G	r3symbol	0x47
X*Y	r3symbol	0x48
X*I	r3symbol	0x49
X*K	r3symbol	0x4B
X*L	r3symbol	0x4C
X*M	r3symbol	0x4D
X*N	r3symbol	0x4E
X*O	r3symbol	0x4F
X*P	r3symbol	0x50
X*H	r3symbol	0x51
X*R	r3symbol	0x52
X*S	r3symbol	0x53
X*T	r3symbol	0x54
X*U	r3symbol	0x55
Xts	r3symbol	0x56
X*W	r3symbol	0x57
X*C	r3symbol	0x58
X*Q	r3symbol	0x59
X*Z	r3symbol	0x5A
Xul	r3symbol	0x5F
Xrn	r3symbol	0x60
X*a	r3symbol	0x61
X*b	r3symbol	0x62
X*x	r3symbol	0x63
X*d	r3symbol	0x64
X*e	r3symbol	0x65
X*f	r3symbol	0x66
X*g	r3symbol	0x67
X*y	r3symbol	0x68
X*i	r3symbol	0x69
X*f	r3symbol	0x6A
X*k	r3symbol	0x6B
X*l	r3symbol	0x6C
X*m	r3symbol	0x6D
X*n	r3symbol	0x6E
X*o	r3symbol	0x6F
X*p	r3symbol	0x70
X*h	r3symbol	0x71
X*r	r3symbol	0x72
X*s	r3symbol	0x73
X*t	r3symbol	0x74
X*u	r3symbol	0x75
X*w	r3symbol	0x77
X*c	r3symbol	0x78
X*q	r3symbol	0x79
X*z	r3symbol	0x7A
Xor	r3symbol	0x7C
Xap	r3symbol	0x7E
X
Xfm	r3symbol	0xa2
X<=	r3symbol	0xa3
Xsl	r3symbol	0xa4
Xif	r3symbol	0xa5
X$D	r3symbol	0xa6
Xbs	r3symbol	0xa9
Xlr	r3symbol	0xaB
X<-	r3symbol	0xaC
Xua	r3symbol	0xaD
X->	r3symbol	0xaE
Xda	r3symbol	0xaF
Xde	r3symbol	0xb0
X+-	r3symbol	0xb1
X>=	r3symbol	0xb3
Xmu	r3symbol	0xb4
Xpt	r3symbol	0xb5
Xpd	r3symbol	0xb6
Xbu	r3symbol	0xb7
Xdi	r3symbol	0xb8
X!=	r3symbol	0xb9
X==	r3symbol	0xbA
X~=	r3symbol	0xbB
Xbr	r3symbol	0xbD
XAh	r3symbol	0xc0
Xc*	r3symbol	0xc4
Xc+	r3symbol	0xc5
Xes	r3symbol	0xc6
Xca	r3symbol	0xc7
Xcu	r3symbol	0xc8
Xsp	r3symbol	0xc9
Xip	r3symbol	0xcA
Xsb	r3symbol	0xcC
Xib	r3symbol	0xcD
Xmo	r3symbol	0xcE
Xnm	r3symbol	0xcF
Xan	r3symbol	0xd0
Xgr	r3symbol	0xd1
Xrg	r3symbol	0xd2
Xco	r3symbol	0xd3
Xsr	r3symbol	0xd6
Xno	r3symbol	0xd8
XAN	r3symbol	0xd9
XOR	r3symbol	0xdA
X<>	r3symbol	0xdB
XDl	r3symbol	0xdC
XDu	r3symbol	0xdD
XDr	r3symbol	0xdE
XDd	r3symbol	0xdF
Xfo	r3symbol	0xe1
Xlc	r3symbol	0xe9
Xlf	r3symbol	0xeB
Xlt	r3symbol	0xeC
Xlk	r3symbol	0xeD
Xlb	r3symbol	0xeE
Xbv	r3symbol	0xeF
Xbs	r3symbol	0xf0
Xfc	r3symbol	0xf1
Xis	r3symbol	0xf2
Xrc	r3symbol	0xf9
Xrf	r3symbol	0xfB
Xrt	r3symbol	0xfC
Xrk	r3symbol	0xfD
Xrb	r3symbol	0xfE
Xff	-	"ff"
Xfi	-	"fi"
Xfl	-	"fl"
XFi	-	"ffi"
XFl	-	"ffl"
XAE	-	"AE"
XOE	-	"OE"
Xae	-	"ae"
Xoe	-	"oe"
X\-	-	"-"
X\_	-	"_"
Xhy	-	"-"
Xru	-	"_"
Xem	-	"-"
Xaa	-	"'"
Xga	-	"`"
Xct	-	"c"
END_OF_FILE
if test 2307 -ne `wc -c <'Appls/dpv/funnytab'`; then
    echo shar: \"'Appls/dpv/funnytab'\" unpacked with wrong size!
fi
# end of 'Appls/dpv/funnytab'
fi
if test -f 'Appls/dpv/trans' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/dpv/trans'\"
else
echo shar: Extracting \"'Appls/dpv/trans'\" \(2127 characters\)
sed "s/^X//" >'Appls/dpv/trans' <<'END_OF_FILE'
X# Font translation tables for dpv for X11 R3 and R4
X# -------------------------------------------------
X
X# This will work for both -Tpsc and -Thar.
X
X# PostScript font names
X# ---------------------
X
XR	-*-times-medium-r-*--%d-*
XI	-*-times-medium-i-*--%d-*
XB	-*-times-bold-r-*--%d-*
XBI	-*-times-bold-i-*--%d-*
X
XH	-*-helvetica-medium-r-*--%d-*
XHO	-*-helvetica-medium-o-*--%d-*
XHB	-*-helvetica-bold-r-*--%d-*
XHD	-*-helvetica-bold-o-*--%d-*
X
XC	-*-courier-medium-r-*--%d-*	
XCO	-*-courier-medium-o-*--%d-*
XCB	-*-courier-bold-r-*--%d-*
XCD	-*-courier-bold-o-*--%d-*
X
X# CW is a common alias for C
XCW	-*-courier-medium-r-*--%d-*	
X
X# CWI Harris font names (also R, I, B, BI)
X# ----------------------------------------
X
X# Vega light, Vega, Vega medium (Helvetica look-alike)
XVl	-*-helvetica-medium-r-*--%d-*
Xvl	-*-helvetica-medium-o-*--%d-*
XV	-*-helvetica-medium-r-*--%d-*
Xv	-*-helvetica-medium-o-*--%d-*
XVm	-*-helvetica-bold-r-*--%d-*
Xvm	-*-helvetica-bold-o-*--%d-*
X
X# Baskerville (see also small caps)
Xbr	-*-times-medium-r-*--%d-*
Xbi	-*-times-medium-i-*--%d-*
Xbb	-*-times-bold-r-*--%d-*
XbI	-*-times-bold-i-*--%d-*
X
X# Century Schoolbook
Xcr	-*-new?century?schoolbook-medium-r-*--%d-*
Xci	-*-new?century?schoolbook-medium-i-*--%d-*
Xcb	-*-new?century?schoolbook-bold-r-*--%d-*
XcI	-*-new?century?schoolbook-bold-i-*--%d-*
X
X# Laurel
Xlr	-*-times-medium-r-*--%d-*
Xli	-*-times-medium-i-*--%d-*
Xlb	-*-times-bold-r-*--%d-*
XlI	-*-times-bold-i-*--%d-*
X
X# Funny fonts mapped to Helvetica, so at least they differ from Times
XG3	-*-helvetica-medium-r-*--%d-*		# German no 3
Xfs	-*-helvetica-medium-r-*--%d-*		# French Script
XRS	-*-helvetica-medium-o-*--%d-*		# Rose Script
XSO	-*-helvetica-bold-r-*--%d-*		# Scitype Open
X
X# OCR-B (line printer font, only available in a few sizes)
Xlp	-*-courier-bold-r-*--%d-* 8 10 12
X
X# Small caps fonts mapped to normal fonts
XRs	-*-times-medium-r-*--%d-*		# Times
XBs	-*-times-bold-r-*--%d-*			# Times bold
Xbs	-*-times-medium-r-*--%d-*		# Baskerville
XbS	-*-times-bold-r-*--%d-*			# Baskerville bold
X
X# Font used by funny character translation
X# ----------------------------------------
X
Xr3symbol	*-*-symbol-medium-r-*--%d-*
END_OF_FILE
if test 2127 -ne `wc -c <'Appls/dpv/trans'`; then
    echo shar: \"'Appls/dpv/trans'\" unpacked with wrong size!
fi
# end of 'Appls/dpv/trans'
fi
if test -f 'Appls/klok/bsdsetdate.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/klok/bsdsetdate.c'\"
else
echo shar: Extracting \"'Appls/klok/bsdsetdate.c'\" \(1755 characters\)
sed "s/^X//" >'Appls/klok/bsdsetdate.c' <<'END_OF_FILE'
X/* Set the date and time -- 4.3 BSD Unix version */
X
X#ifndef sun
X/* This is not needed on SunOS 4.03 (what about higher SunOS'es?). */
X#include <time.h>
X#endif
X#include <sys/time.h>
X
X#define isleap(y) ((y)%4 == 0 && ((y)%100 != 0 || (y)%400 == 0))
X
X/* Convert a struct tm to seconds since Jan. 1, 1970.
X   This knows nothing about time zones or daylight saving time. */
X
Xstatic unsigned long
Xtm2tv(tp)
X	struct tm *tp;
X{
X	static short mdays[12]=
X		{31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
X	unsigned long s= 0;
X	int y, m, d;
X	
X	for (y= 1970; y < tp->tm_year + 1900; ++y) {
X		s += 365;
X		if (isleap(y))
X			++s;
X	}
X	mdays[1]= 28 + isleap(y); /* Months have origin 0 */
X	for (m= 0; m < tp->tm_mon; ++m)
X		s += mdays[m];
X	s += tp->tm_mday - 1;
X	return ((s*24 + tp->tm_hour)*60 + tp->tm_min)*60 /*+ tp->tm_sec*/;
X}
X
X/* Set the date and time from a struct tm.
X   The Input time is in local time.
X   If 'minchange' is zero, minutes and seconds are not taken
X   from the input but from the current system time. */
X
Xsetdatetime(tp, minchange)
X	struct tm *tp;
X	int minchange; /* nonzero if we must reset minutes and seconds, too */
X{
X	struct timeval tv;
X	struct timezone tz;
X	unsigned long t;
X	
X	t= tm2tv(tp);				/* t is local time */
X	if (gettimeofday(&tv, &tz) != 0)
X		return -1;
X	if (tp->tm_isdst)
X		t -= 3600;			/* t is local time less DST */
X	t += tz.tz_minuteswest*60;		/* t is GMT time */
X	if (minchange)
X		t= t/60 * 60;			/* Clear seconds */
X	else
X		t= t/3600 * 3600 + tv.tv_sec % 3600; /* Use current min/sec */
X	tv.tv_sec= t;
X	if (settimeofday(&tv, &tz) != 0)
X		return -1;
X	return 0;
X}
X
X#ifdef SYSV
X
X/* XXX How do you set the date/time on system V? */
X
Xint
Xsettimeofday(ptv, ptz)
X	struct timeval *ptv;
X	struct timezone *ptz;
X{
X	return -1;
X}
X
X#endif
END_OF_FILE
if test 1755 -ne `wc -c <'Appls/klok/bsdsetdate.c'`; then
    echo shar: \"'Appls/klok/bsdsetdate.c'\" unpacked with wrong size!
fi
# end of 'Appls/klok/bsdsetdate.c'
fi
if test -f 'Appls/miniedit/regsub.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/miniedit/regsub.c'\"
else
echo shar: Extracting \"'Appls/miniedit/regsub.c'\" \(2150 characters\)
sed "s/^X//" >'Appls/miniedit/regsub.c' <<'END_OF_FILE'
X/*
X * regsub
X *
X *	Copyright (c) 1986 by University of Toronto.
X *	Written by Henry Spencer.  Not derived from licensed software.
X#ifdef MULTILINE
X *	Changed by Guido van Rossum, CWI, Amsterdam
X *	for multi-line support.
X#endif
X *
X *	Permission is granted to anyone to use this software for any
X *	purpose on any computer system, and to redistribute it freely,
X *	subject to the following restrictions:
X *
X *	1. The author is not responsible for the consequences of use of
X *		this software, no matter how awful, even if they arise
X *		from defects in it.
X *
X *	2. The origin of this software must not be misrepresented, either
X *		by explicit claim or by omission.
X *
X *	3. Altered versions must be plainly marked as such, and must not
X *		be misrepresented as being the original software.
X */
X#include <stdio.h>
X#include "regexp.h"
X#include "regmagic.h"
X
X#ifndef CHARBITS
X#define	UCHARAT(p)	((int)*(unsigned char *)(p))
X#else
X#define	UCHARAT(p)	((int)*(p)&CHARBITS)
X#endif
X
X/*
X - regsub - perform substitutions after a regexp match
X */
Xvoid
Xregsub(prog, source, dest)
Xregexp *prog;
Xchar *source;
Xchar *dest;
X{
X	register char *src;
X	register char *dst;
X	register char c;
X	register int no;
X	register int len;
X	extern char *strncpy();
X
X	if (prog == NULL || source == NULL || dest == NULL) {
X		regerror("NULL parm to regsub");
X		return;
X	}
X	if (UCHARAT(prog->program) != MAGIC) {
X		regerror("damaged regexp fed to regsub");
X		return;
X	}
X
X	src = source;
X	dst = dest;
X	while ((c = *src++) != '\0') {
X		if (c == '&')
X			no = 0;
X		else if (c == '\\' && '0' <= *src && *src <= '9')
X			no = *src++ - '0';
X		else
X			no = -1;
X
X		if (no < 0) {	/* Ordinary character. */
X			if (c == '\\' && (*src == '\\' || *src == '&'))
X				c = *src++;
X#ifdef MULTILINE
X			else if (c == '\\' && *src == 'n') {
X				c = '\n';
X				src++;
X			}
X#endif
X			*dst++ = c;
X		} else if (prog->startp[no] != NULL && prog->endp[no] != NULL) {
X			len = prog->endp[no] - prog->startp[no];
X			(void) strncpy(dst, prog->startp[no], len);
X			dst += len;
X			if (len != 0 && *(dst-1) == '\0') {	/* strncpy hit NUL. */
X				regerror("damaged match string");
X				return;
X			}
X		}
X	}
X	*dst++ = '\0';
X}
END_OF_FILE
if test 2150 -ne `wc -c <'Appls/miniedit/regsub.c'`; then
    echo shar: \"'Appls/miniedit/regsub.c'\" unpacked with wrong size!
fi
# end of 'Appls/miniedit/regsub.c'
fi
if test -f 'Appls/test/multiwin.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Appls/test/multiwin.c'\"
else
echo shar: Extracting \"'Appls/test/multiwin.c'\" \(2145 characters\)
sed "s/^X//" >'Appls/test/multiwin.c' <<'END_OF_FILE'
X/* Multiple windows, menus */
X
X#include "stdwin.h"
X
X#define NW 10			/* Max # of windows */
X
Xstruct {
X	WINDOW *win;
X	TEXTEDIT *tb;
X	int bottom;
X} wlist[NW];			/* Window list */
X
Xdrawproc(win, l, tl, r, b)
X	WINDOW *win;
X{
X	int i= wgettag(win);
X	tedraw(wlist[i].tb);
X}
X
Xnewwin()
X{
X	int i;
X	
X	for (i= 0; i < NW; ++i) {
X		if (wlist[i].win == 0) {
X			char title[20];
X			int width, height;
X			WINDOW *win;
X			sprintf(title, "Untitled-%d", i);
X			wlist[i].win= win= wopen(title, drawproc);
X			wsettag(win, i);
X			wgetwinsize(win, &width, &height);
X			wlist[i].tb= tealloc(win, 0, 0, width);
X			wlist[i].bottom= tegetbottom(wlist[i].tb);
X			wsetdocsize(win, width, wlist[i].bottom);
X			return;
X		}
X	}
X	
X	wmessage("Can't open another window");
X}
X
Xclosewin(win)
X	WINDOW *win;
X{
X	int i= wgettag(win);
X	tefree(wlist[i].tb);
X	wclose(wlist[i].win);
X	wlist[i].win= 0;
X}
X
Xmain(argc, argv)
X	int argc;
X	char **argv;
X{
X	MENU *mp;
X	int inew, iquit;
X	int stop= 0;
X	
X	winitargs(&argc, &argv);
X	
X	mp= wmenucreate(1, "File");
X	inew= wmenuadditem(mp, "New", 'N');
X	(void) wmenuadditem(mp, "", -1);
X	iquit= wmenuadditem(mp, "Quit", 'Q');
X	
X	newwin();		/* Initial window */
X	
X	while (!stop) {
X		EVENT e;
X		
X		wgetevent(&e);
X		
X		if (e.window != 0) {
X			int i= wgettag(e.window);
X			if (teevent(wlist[i].tb, &e)) {
X				/*if (tegetbottom(wlist[i].tb) !=
X						wlist[i].bottom)*/
X				wsetdocsize(wlist[i].win,
X					tegetright(wlist[i].tb),
X					tegetbottom(wlist[i].tb));
X				continue;
X			}
X		}
X		
X		switch (e.type) {
X		
X		case WE_MENU:
X			switch (e.u.m.id) {
X			case 1:
X				if (e.u.m.item == inew)
X					newwin();
X				else if (e.u.m.item == iquit)
X					stop= 1;
X				break;
X			}
X			break;
X		
X		case WE_COMMAND:
X			switch (e.u.command) {
X			
X			case WC_CLOSE:
X				closewin(e.window);
X				break;
X			
X			}
X			break;
X		
X		case WE_CLOSE:
X			closewin(e.window);
X			break;
X
X		case WE_SIZE:
X			{
X				int i= wgettag(e.window);
X				int width, height;
X				wgetwinsize(e.window, &width, &height);
X				temove(wlist[i].tb, 0, 0, width);
X				wlist[i].bottom= tegetbottom(wlist[i].tb);
X				wsetdocsize(wlist[i].win,
X					width, wlist[i].bottom);
X			}
X			break;
X		}
X	}
X	
X	wdone();
X	exit(0);
X}
X
END_OF_FILE
if test 2145 -ne `wc -c <'Appls/test/multiwin.c'`; then
    echo shar: \"'Appls/test/multiwin.c'\" unpacked with wrong size!
fi
# end of 'Appls/test/multiwin.c'
fi
if test -f 'Conf/makemakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Conf/makemakefile'\"
else
echo shar: Extracting \"'Conf/makemakefile'\" \(2213 characters\)
sed "s/^X//" >'Conf/makemakefile' <<'END_OF_FILE'
X#!/bin/sh
X
X# makemakefile - create a Makefile
X
XPROGNAME=`basename $0`
XUSAGE="usage: $PROGNAME topdir os arch port srcdir builddir"
X
X# Check and get arguments
X#
Xcase $# in
X6)	;;
X*)  echo "$USAGE" 1>&2
X    echo '  <src> may be relative to <top>' 1>&2
X    echo '  <build> may be relative to <top>/Build/<arch>/<port>' 1>&2
X    exit 2
X    ;;
Xesac
X
XTOPDIR=$1; shift
XOS=$1; shift
XARCH=$1; shift
XPORT=$1; shift
XSRCDIR=$1; shift
XBLDDIR=$1; shift
X
X
X# Set derived pathnames
X
XCONFDIR=$TOPDIR/Conf
X
Xcase $SRCDIR in
X/*)	;;
X*)	SRCDIR=$TOPDIR/$SRCDIR;;
Xesac
X
Xcase $BLDDIR in
X/*)	;;
X*)	BLDDIR=$TOPDIR/Build/$ARCH/$PORT/$BLDDIR;;
Xesac
X
XOSPROTO=$CONFDIR/proto.os.$OS
XARCHPROTO=$CONFDIR/proto.arch.$ARCH
XPORTPROTO=$CONFDIR/proto.port.$PORT
XCONFPROTO=$CONFDIR/proto.conf
XSRCPROTO=$SRCDIR/Make.proto
X
X# Make sure the source prototype exists, else there's no use in proceeding.
X# This test is made to avoid creating junk build directories.
X# (Missing other files are detected by the cat command.)
X
Xif test ! -f $SRCPROTO
Xthen
X	echo "$PROGNAME: can't find Makefile prototype $SRCPROTO" 1>&2
X	exit 1
Xfi
X
X# Make sure the build directory exists, create it if necessary
X# (only one level deep though!)
X#
Xif test -d $BLDDIR
Xthen
X	:
Xelse
X	echo "$PROGNAME: creating new build directory $BLDDIR" 1>&2
X	mkdir $BLDDIR ||
X	{ echo "$PROGNAME: can't create build directory $BLDDIR" 1>&2; exit 1;}
Xfi
X
X
X# Now begin doing the real work
X#
XPRELUDE="$OSPROTO $ARCHPROTO $PORTPROTO $CONFPROTO $SRCPROTO"
X
XBOOTMAKE=$BLDDIR/Mf.boot
Xecho "$PROGNAME: creating bootstrap Makefile ..." 1>&2
X
X{ echo "TOP=$TOPDIR" &&
X  cat $PRELUDE;
X} >$BOOTMAKE ||
X{ echo "$PROGNAME: can't create bootstrap Makefile $BOOTMAKE" 1>&2; exit 1; }
X
XTEMPMAKE=$BLDDIR/Mf.temp
Xecho "$PROGNAME: creating temp Makefile ..." 1>&2
X
X{ echo "TOP=$TOPDIR" &&
X  cat $PRELUDE &&
X  make -f $BOOTMAKE _bootstrap; } >$TEMPMAKE ||
X{ echo "$PROGNAME: can't create temp Makefile $TEMPMAKE" 1>&2; exit 1; }
X
XMAKEFILE=$BLDDIR/Makefile
Xecho "$PROGNAME: moving temp Makefile to Makefile ..." 1>&2
X
Xif test -f $MAKEFILE
Xthen
X	BACKUP=$MAKEFILE.bak
X	echo "$PROGNAME: NB: moving previous Makefile to backup" 1>&2
X	rm -f $BACKUP
X	mv $MAKEFILE $BACKUP
Xfi
X
Xmv $TEMPMAKE $MAKEFILE &&
Xecho "$PROGNAME: done." 1>&2
END_OF_FILE
if test 2213 -ne `wc -c <'Conf/makemakefile'`; then
    echo shar: \"'Conf/makemakefile'\" unpacked with wrong size!
fi
chmod +x 'Conf/makemakefile'
# end of 'Conf/makemakefile'
fi
if test -f 'Conf/mkmf' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Conf/mkmf'\"
else
echo shar: Extracting \"'Conf/mkmf'\" \(1567 characters\)
sed "s/^X//" >'Conf/mkmf' <<'END_OF_FILE'
X#! /bin/sh
X# mkmf - friendly interface to makemakefile
X
XPROGNAME=`basename $0`
XUSAGE="usage: $PROGNAME [-a arch] [-o os] [-t topdir] [-p port] [application];
X    if no application specified, a port makefile is created,
X    else an application makefile is created."
X
XTOP=`(cd ..; pwd)`
X
XPORT=x11
X
Xif ARCH=`(arch) 2>/dev/null`
Xthen
X	case $ARCH in
X	sun[34])	OS=sunos;;
X	sgi)		OS=sysv;;
X	esac
Xelif ARCH=`(machine) 2>/dev/null`
Xthen
X	case $ARCH in
X	vax|mips)	OS=ultrix;;
X	tahoe)		OS=bsd;;
X	esac
Xfi
X
Xwhile :
Xdo
X	case $1 in
X	-a)	ARCH=$2; shift; shift;;
X	-o)	OS=$2; shift; shift;;
X	-p)	PORT=$2; shift; shift;;
X	-t)	TOP=$2; shift; shift;;
X	-*)	echo "$USAGE" 1>&2; exit 2;;
X	*)	break;;
X	esac
Xdone
X
Xcase $OS in
X'')	echo "Sorry, can't guess operating system, use -o"; exit 2;;
Xesac
X
Xcase $ARCH in
X'')	echo "Sorry, can't guess architecture, use -a" 1>&2; exit 2;;
Xesac
X
X# Create top level in the Build tree if necessary
X
Xif test ! -d $TOP/Build
Xthen
X	echo "Create $TOP/Build? [ny]"
X	read reply
X	case $reply in
X	[yY]*)	mkdir $TOP/Build || exit;;
X	*)	exit;;
X	esac
Xfi
X
Xif test ! -d $TOP/Build/$ARCH
Xthen
X	echo "Create $TOP/Build/$ARCH? [ny]"
X	read reply
X	case $reply in
X	[yY]*)	mkdir $TOP/Build/$ARCH || exit;;
X	*)	exit;;
X	esac
Xfi
X
Xif test ! -d $TOP/Build/$ARCH/$PORT
Xthen
X	echo "Create $TOP/Build/$ARCH/$PORT? [ny]"
X	read reply
X	case $reply in
X	[yY]*)	mkdir $TOP/Build/$ARCH/$PORT || exit;;
X	*)	exit;;
X	esac
Xfi
X
Xcase $# in
X0)	set -x; makemakefile $TOP $OS $ARCH $PORT Ports/$PORT lib;;
X1)	set -x; makemakefile $TOP $OS $ARCH $PORT Appls/$1 $1;;
X*)	echo "$USAGE" 1>&2; exit 2;;
Xesac
END_OF_FILE
if test 1567 -ne `wc -c <'Conf/mkmf'`; then
    echo shar: \"'Conf/mkmf'\" unpacked with wrong size!
fi
chmod +x 'Conf/mkmf'
# end of 'Conf/mkmf'
fi
if test -f 'Conf/proto.conf' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Conf/proto.conf'\"
else
echo shar: Extracting \"'Conf/proto.conf'\" \(1658 characters\)
sed "s/^X//" >'Conf/proto.conf' <<'END_OF_FILE'
X
X#
X# Definitions pertaining to all configurations
X#
X
X# Names for all the top-level subdirectories of the stdwin tree
XAPPLS=		$(TOP)/Appls
XBUILD=		$(TOP)/Build
XCONF=		$(TOP)/Conf
XH=		$(TOP)/H
XPACKS=		$(TOP)/Packs
XPORTS=		$(TOP)/Ports
XTOOLS=		$(TOP)/Tools
X
X# Names for subdirectories of $(PORTS)
XALFA=		$(PORTS)/alfa
XX11=		$(PORTS)/x11
XGEN=		$(TOP)/Gen
XVTRM=		$(PORTS)/vtrm
XVTRM_ALL=	$(PORTS)/vtrm/uxtty.c $(PORTS)/vtrm/vtrm.c
X
X# Names for subdirectories of $(PACKS)
XTEXTEDIT=	$(TOP)/Packs/textedit
XVT=		$(TOP)/Packs/vt
X
X# Names for all sources files to the textedit package --
X# this is used to include them in each port's library
XTEXTEDIT_PACK=	$(TEXTEDIT)/*.c
XVT_PACK=	$(VT)/vt*.c
X
X# Build directory -- one for each port
XPORTBUILD=	$(TOP)/Build/$(ARCH)/$(PORT)
X
X# C flags (include directories, definitions, options) used at all times
XCONFINCLS=	-I$(H)
XCONFDEFS=	
XCONFOPTS=	-g	# XXX should be OS or arch specific!
XCONFLIBS=	
X
X# Construct CFLAGS from various sources
X# XXX does the order matter?
XINCLS=		$(OSINCLS) $(ARCHINCLS) $(PORTINCLS) $(CONFINCLS) $(SRCINCLS)
XDEFS=		$(OSDEFS) $(ARCHDEFS) $(PORTDEFS) $(CONFDEFS) $(SRCDEFS)
XOPTS=		$(OSOPTS) $(ARCHOPTS) $(PORTOPTS) $(CONFOPTS) $(SRCOPTS)
XCPPFLAGS=	$(INCLS) $(DEFS)
XCFLAGS=		$(CPPFLAGS) $(OPTS)
X
X# Construct LIBS to link application with from various sources
X# XXX what is the right order?
XLIBS=		$(SRCLIBS) $(PORTLIBS) $(OSLIBS) $(ARCHLIBS) $(CONFLIBS)
X
X# Ensure that "all" is the first target defined in this Makefile
Xall:
X
X
X# Standard targets
X
X# Target to add dependency rules to the Makefile (in place!)
Xdepend:
X		$(MKDEP) $(CFLAGS) $(SRCS)
X
X# XXX There should be standard targets tags, clean, etc.
X
END_OF_FILE
if test 1658 -ne `wc -c <'Conf/proto.conf'`; then
    echo shar: \"'Conf/proto.conf'\" unpacked with wrong size!
fi
# end of 'Conf/proto.conf'
fi
if test -f 'Gen/wdrawpar.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Gen/wdrawpar.c'\"
else
echo shar: Extracting \"'Gen/wdrawpar.c'\" \(1576 characters\)
sed "s/^X//" >'Gen/wdrawpar.c' <<'END_OF_FILE'
X/* STDWIN -- PARAGRAPH DRAWING OPERATIONS.
X   N.B. This is portable to other implementations of stdwin. */
X
X#include "stdwin.h"
X#include "tools.h"
X
X/* Draw a paragraph of text.
X   An EOL forces a new line, otherwise lines are broken at spaces
X   (if at all possible).
X   Parameters are the top left corner, the width, the text and its length.
X   Return value is the v coordinate of the bottom line.
X   (Note that an empty string is drawn as one blank line.) */
X
Xint
Xwdrawpar(left, top, text, width)
X	int left, top;
X	char *text;
X	int width;
X{
X	return _wdrawpar(left, top, text, width, TRUE);
X}
X
X/* Measure the height of a paragraph of text, when drawn with wdrawpar. */
X
Xint
Xwparheight(text, width)
X	char *text;
X	int width;
X{
X	return _wdrawpar(0, 0, text, width, FALSE);
X}
X
X/* Routine to do the dirty work for the above two. */
X
Xstatic int
X_wdrawpar(left, top, text, width, draw)
X	int left, top;
X	char *text;
X	int width;
X	bool draw;
X{
X	int len= strlen(text);
X	int len1= 0; /* Len1 counts characters until next EOL */
X	
X	while (len1 < len && text[len1] != EOL)
X		++len1;
X	for (;;) {
X		int n= wtextbreak(text, len1, width);
X		if (n < len1) {
X			char *cp= text+n;
X			while (cp > text && *cp != ' ')
X				--cp;
X			if (cp > text)
X				n= cp-text;
X		}
X		if (draw)
X			(void) wdrawtext(left, top, text, n);
X		top += wlineheight();
X		text += n;
X		len -= n;
X		len1 -= n;
X		while (len1 > 0 && *text == ' ') {
X			++text;
X			--len;
X			--len1;
X		}
X		if (len1 == 0) {
X			if (len == 0)
X				break;
X			++text;
X			--len;
X			while (len1 < len && text[len1] != EOL)
X				++len1;
X		}
X	}
X	return top;
X}
END_OF_FILE
if test 1576 -ne `wc -c <'Gen/wdrawpar.c'`; then
    echo shar: \"'Gen/wdrawpar.c'\" unpacked with wrong size!
fi
# end of 'Gen/wdrawpar.c'
fi
if test -f 'Gen/wtextbreak.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Gen/wtextbreak.c'\"
else
echo shar: Extracting \"'Gen/wtextbreak.c'\" \(1688 characters\)
sed "s/^X//" >'Gen/wtextbreak.c' <<'END_OF_FILE'
X/* STDWIN -- TEXT BREAK ROUTINE. */
X
X#include "stdwin.h"
X
X/* Portable version of wtextbreak(); use on systems where such an
X   operation is not an available primitive and wtextwidth has a high
X   overhead per call.
X   This function makes an educated guess and then uses linear
X   interpolation to find the exact answer.
X   It assumes that the textwidth function is additive (if not, but
X   almost, a final adjustment pass could be added). */
X
Xint
Xwtextbreak(str, len, width)
X	char *str;
X	int len;
X	int width;
X{
X	int en= wcharwidth('n');	/* Estimated average char width */
X					/* NB: adapted below in the loop! */
X	int max;			/* Maximum answer */
X	int min= 0;			/* Minimum answer */
X	int wmin= 0;			/* Corresponding string width */
X	
X	if (len < 0)
X		len= strlen(str);
X	max= len;
X	
X	/* Invariants:
X	   'min' characters fit, 'max+1' characters don't.
X	   Ergo: we can stop when min == max. */
X	
X	while (min < max) {
X		/* Guess a number of chars beyond min. */
X		int guess= (width - wmin)/en;
X		int wguess;
X		if (guess <= 0)
X			guess= 1;
X		else if (min+guess > max)
X			guess= max-min;
X		wguess= wtextwidth(str+min, guess); /* Width increment */
X		if (wguess > 0)
X			en= (wguess + guess - 1) / guess;
X		guess += min;
X		wguess += wmin;
X		if (wguess > width) {
X			max= guess-1;
X		}
X		else /* wguess <= width */ {
X			min= guess;
X			wmin= wguess;
X		}
X	}
X
X#ifdef TEXT_NOT_ADDITIVE
X	/* Initially, min==max.  See if min should be smaller. */
X	while (min > 0 && wtextwidth(str, min) > width) {
X		--min;
X	}
X	if (min == max) {
X		/* Previous loop didn't decrease min.
X		   See if we can increase it... */
X		while (max < len && wtextwidth(str, ++max) <= width) {
X			++min;
X		}
X	}
X#endif
X	
X	return min;
X}
END_OF_FILE
if test 1688 -ne `wc -c <'Gen/wtextbreak.c'`; then
    echo shar: \"'Gen/wtextbreak.c'\" unpacked with wrong size!
fi
# end of 'Gen/wtextbreak.c'
fi
if test -f 'H/stdwtext.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'H/stdwtext.h'\"
else
echo shar: Extracting \"'H/stdwtext.h'\" \(1803 characters\)
sed "s/^X//" >'H/stdwtext.h' <<'END_OF_FILE'
X/* STDWIN TEXTEDIT PACKAGE INTERFACE */
X
X/* This file is only ever included by "stdwin.h" */
X
X#define TEXTEDIT struct _textedit
X
XTEXTEDIT *tealloc _ARGS((WINDOW *win, int left, int top, int width));
XTEXTEDIT *tecreate _ARGS((WINDOW *win,
X	int left, int top, int right, int bottom));
Xvoid tefree _ARGS((TEXTEDIT *tp));
Xvoid tedestroy _ARGS((TEXTEDIT *tp));
Xvoid tesetactive _ARGS((TEXTEDIT *tp, /*bool*/int active));
X
Xvoid tedraw _ARGS((TEXTEDIT *tp));
Xvoid tedrawnew _ARGS((TEXTEDIT *tp,
X	int left, int top, int right, int bottom));
Xvoid temove _ARGS((TEXTEDIT *tp, int left, int top, int width));
Xvoid temovenew _ARGS((TEXTEDIT *tp,
X	int left, int top, int right, int bottom));
X
Xvoid tesetfocus _ARGS((TEXTEDIT *tp, int foc1, int foc2));
Xvoid tereplace _ARGS((TEXTEDIT *tp, char *str));
Xvoid tesetbuf _ARGS((TEXTEDIT *tp, char *buf, int buflen));
X
Xvoid tearrow _ARGS((TEXTEDIT *tp, int code));
Xvoid tebackspace _ARGS((TEXTEDIT *tp));
X/*bool*/int teclicknew _ARGS((TEXTEDIT *tp, int h, int v, /*bool*/int extend, /*bool*/int dclick));
X/*bool*/int tedoubleclick _ARGS((TEXTEDIT *tp, int h, int v));
X/*bool*/int teevent _ARGS((TEXTEDIT *tp, EVENT *ep));
X
X#define teclick(tp, h, v) teclicknew(tp, h, v, FALSE)
X#define teclickextend(tp, h, v) teclicknew(tp, h, v, TRUE)
X
Xchar *tegettext _ARGS((TEXTEDIT *tp));
Xint tegetlen _ARGS((TEXTEDIT *tp));
Xint tegetnlines _ARGS((TEXTEDIT *tp));
Xint tegetfoc1 _ARGS((TEXTEDIT *tp));
Xint tegetfoc2 _ARGS((TEXTEDIT *tp));
Xint tegetleft _ARGS((TEXTEDIT *tp));
Xint tegettop _ARGS((TEXTEDIT *tp));
Xint tegetright _ARGS((TEXTEDIT *tp));
Xint tegetbottom _ARGS((TEXTEDIT *tp));
X
X/* Text paragraph drawing functions: */
X
Xint wdrawpar _ARGS((int h, int v, char *text, int width));
X	/* Returns new v coord. */
Xint wparheight _ARGS((char *text, int width));
X	/* Returns height */
END_OF_FILE
if test 1803 -ne `wc -c <'H/stdwtext.h'`; then
    echo shar: \"'H/stdwtext.h'\" unpacked with wrong size!
fi
# end of 'H/stdwtext.h'
fi
if test -f 'Packs/textedit/textdbg.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Packs/textedit/textdbg.c'\"
else
echo shar: Extracting \"'Packs/textedit/textdbg.c'\" \(2218 characters\)
sed "s/^X//" >'Packs/textedit/textdbg.c' <<'END_OF_FILE'
X/* Text Edit, debugging code */
X
X#include "text.h"
X
X#ifndef macintosh
X
X/*VARARGS1*/
Xdprintf(fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
X	char *fmt;
X{
X	printf("\r\n");
X	printf(fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
X	printf("\r\n");
X}
X
X#endif
X
X#ifndef NDEBUG
X
X/* Check the world's consistency */
X
Xtecheck(tp, line)
X	TEXTEDIT *tp;
X	int line;
X{
X	lineno i;
X
X#define zck(n) ((n) || dprintf("zck(n) line %d", line))
X	
X	zck(tp->nlines >= 1);
X	
X	zck(tp->start[0] == zaddgap(0));
X	zck(tp->start[tp->nlines] == tp->buflen);
X	
X	zck(0 <= tp->gap);
X	zck(0 <= tp->gaplen);
X	zck(zgapend <= tp->buflen);
X	
X	zck(0 <= tp->foc);
X	zck(0 <= tp->foclen);
X	zck(zfocend <= tp->buflen-tp->gaplen);
X	
X	for (i= 0; i < tp->nlines; ++i) {
X		if (i < tp->nlines-1)
X			{ zck(tp->start[i] < tp->start[i+1]); }
X		else
X			{ zck(tp->start[i] <= tp->start[tp->nlines]); }
X		zck(tp->start[i] < tp->gap || zgapend <= tp->start[i]);
X	}
X
X#undef zck
X
X}
X
X#if 0
X
X/* Dump the world's state to the screen (call from drawproc) */
X
Xzdebug(left, top, right, bottom)
X{
X	int h, v;
X	int i, j;
X	
X	h= 0, v= 15*wlh; if (v >= bottom) return;
X	zprintf(h, v, "buflen=%d nlines=%d foc=%d foclen=%d gap=%d gaplen=%d.",
X		buflen, nlines, foc, foclen, gap, gaplen);
X	h= 0, v += wlh; if (v >= bottom) return;
X	for (i= 0; i <= nlines; ++i) {
X		h= zprintf(h, v, "%d:%d ", i, start[i]);
X	}
X	h= 0, v += wlh; if (v >= bottom) return;
X	for (i= 0; i <= buflen; ++i) {
X		h= zprintf(h, v, "%c",
X			i == zaddgap(foc) ?
X				(foclen == 0 ? '|' : '[') :
X				(i == zaddgap(focend) ? ']' : ' '));
X		if (i >= buflen)
X			break;
X		if (i >= gap && i < gapend)
X			h= zprintf(h, v, "**");
X		else
X			h= zprintf(h, v, "%02x", buf[i] & 0xff);
X	}
X	h= 0, v += wlh; if (v >= bottom) return;
X	for (i= 0; i <= buflen; ++i) {
X		for (j= 0; j <= nlines; ++j)
X			if (i == start[j])
X				break;
X		if (j <= nlines)
X			h= zprintf(h, v, "%-3d", j);
X		else
X			h= zprintf(h, v, "   ");
X	}
X}
X
X/* Printf into the window (could be of general use).
X   NB: doesn't recognize \n */
X
Xstatic
Xzprintf(h, v, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
X	int h, v;
X	char *fmt;
X{
X	char buf[256];
X	sprintf(buf, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
X	return wdrawtext(h, v, buf, -1);
X}
X
X#endif
X
X#endif /* !NDEBUG */
END_OF_FILE
if test 2218 -ne `wc -c <'Packs/textedit/textdbg.c'`; then
    echo shar: \"'Packs/textedit/textdbg.c'\" unpacked with wrong size!
fi
# end of 'Packs/textedit/textdbg.c'
fi
if test -f 'Ports/alfa/To.do' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ports/alfa/To.do'\"
else
echo shar: Extracting \"'Ports/alfa/To.do'\" \(1462 characters\)
sed "s/^X//" >'Ports/alfa/To.do' <<'END_OF_FILE'
XComplain about bad arguments (esp. window pointers) instead of ignoring
Xthem
X
XDon't scroll so much beyond end of window (in wshow?)
X
XTextedit highlights disappear when they are redrawn after a menu covered
Xsome text but *not* the highlight
X
XFix wreshuffle to minimize redrawing
X
XFix scrollupdate to minimize redrawing
X
XMaintain a stack of active windows so active window after a delete is
Xless surprising
X
XDon't grow windows beyond their document size
X
XLet wmessage wait for CR to acknowledge?
X
XDreams:
X
XGeneralized key bindings read from a startup file
X
X~ and $ expansion and file name completion in waskfile
X(or write a tiny directory browser?)
X
X
XChages to stdwin by Euromath project?
X
Xdraw.c		bogus! fix to scrollupdate;
X		some comments added
X
Xstdwin.c	added wgetwinpos and wgetorigin;
X		support for resize events;
X		don't force showing the caret;
X		don't reset the 'front' window when closing non-front;
X		Lambert's attempts at imporving _wreshuffle???
X
X
XOf the following changes I am not sure yet:
X
Xmenu.c		changed standard menu title and contents;
X		fixed minor bugs;
X		and what else?  (lots changed)
X
Xscroll.c	only change is to comment out a fallback on wchange in
X		wscroll when there is horizontal scrolling or not the
X		entire window width is affected.  do we need this?
X
Xsyswin.c	added wdialog which is like waskstr with an additional
X		multiple-choice list of options (???) (why couldn't this
X		be done as a normal stdwin window?);
X		added RedrawAll
END_OF_FILE
if test 1462 -ne `wc -c <'Ports/alfa/To.do'`; then
    echo shar: \"'Ports/alfa/To.do'\" unpacked with wrong size!
fi
# end of 'Ports/alfa/To.do'
fi
if test -f 'Ports/mac/dprintf.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ports/mac/dprintf.c'\"
else
echo shar: Extracting \"'Ports/mac/dprintf.c'\" \(2129 characters\)
sed "s/^X//" >'Ports/mac/dprintf.c' <<'END_OF_FILE'
X/* A simple debugging routine, assuming you've got QuickDraw,
X   windows and menus running.
X   It can be called with up to 10 printf arguments.
X
X   It beeps, draws a message over the menu bar,
X   and waits for a key or mouse down event.
X   If Command-Period is detected, it calls ExitToShell,
X   to allow an emergency exit from a looping program.
X
X   Warning: there are some side effects on the window manager's port,
X   such as pen parameters and clipping.
X   The printed string shouldn't exceed 255 chars.
X*/
X
X#include "macwin.h"
X
X#ifdef MPW
X#include <Events.h>
X#include <Menus.h>
X#include <OSUtils.h>
X#include <SegLoad.h>
X#endif
X
Xvoid
Xdprintf(fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
X	char *fmt;
X{
X	char buf[256];
X	GrafPtr saveport;
X	GrafPtr screen;
X	Rect r;
X	
X	SysBeep(2);
X	sprintf(buf, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
X	GetPort(&saveport);
X	GetWMgrPort(&screen);
X	SetPort(screen);
X	r= screen->portRect;
X	r.bottom= 19; /* Height of menu bar, less border line */
X	ClipRect(&r);
X	PenNormal();
X	/* Reset more parameters, such as text font? */
X	EraseRect(&r);
X	MoveTo(5, 15); /* Left margin and base line */
X#ifndef CLEVERGLUE
X	CtoPstr(buf);
X#endif
X	DrawString(buf);
X	
X	/* Wait for mouse or key down event.
X	   Include auto key events so a flood of dprintf
X	   calls can be skipped quickly by holding a key. */
X	for (;;) {
X		EventRecord e;
X		
X		if (GetNextEvent(keyDownMask|autoKeyMask|mDownMask, &e)) {
X			if (e.what == keyDown &&
X				(e.message & charCodeMask) == '.' &&
X				(e.modifiers & cmdKey))
X				ExitToShell();
X			if ((e.what == keyDown || e.what == autoKey) &&
X				((e.message & charCodeMask) == '\r' ||
X				 (e.message & charCodeMask) == '\3')
X			    || e.what == mouseDown)
X				break;
X		}
X	}
X	
X	/* Restore the situation, more or less. */
X	SetPort(saveport);
X	DrawMenuBar();
X}
X
X#ifdef UNUSED
X
X/* Print the extent of the stack. */
X
X#define CurStackBase	(* (long*)0x908)
X#define ApplZone	(* (long*)0x2AA)
X#define ApplLimit	(* (long*)0x130)
X
Xprstack(where)
X	char *where;
X{
X	dprintf("ApplZone=%d, ApplLimit=%d, CurStackBase=%d, SP=%d",
X		ApplZone, ApplLimit, CurStackBase, &where);
X}
X
X#endif /*UNUSED*/
END_OF_FILE
if test 2129 -ne `wc -c <'Ports/mac/dprintf.c'`; then
    echo shar: \"'Ports/mac/dprintf.c'\" unpacked with wrong size!
fi
# end of 'Ports/mac/dprintf.c'
fi
if test -f 'Ports/mac/scrap.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ports/mac/scrap.c'\"
else
echo shar: Extracting \"'Ports/mac/scrap.c'\" \(2210 characters\)
sed "s/^X//" >'Ports/mac/scrap.c' <<'END_OF_FILE'
X/* Macintosh Scrap (Clipboard) Interface */
X
X#include "macwin.h"
X#ifdef MPW
X#include <Scrap.h>
X#include <Memory.h>
X#endif
X#ifdef THINK_C
X#include <ScrapMgr.h>
X#include <MemoryMgr.h>
X#endif
X
Xstatic Handle hclip;
Xstatic long lenclip;
X
X/* _wfreeclip is called from wgetevent and from wsetclip. */
X
Xvoid
X_wfreeclip()
X{
X	if (hclip != NULL) {
X		HUnlock(hclip);
X		DisposHandle(hclip);
X		hclip= NULL;
X	}
X}
X
Xchar *
Xwgetclip()
X{
X	long offset;
X	
X	/* NB if the use of hclip or lenclip changes,
X	   also change wgetcutbuffer() below !!! */
X	
X	if (hclip == NULL)
X		hclip= NewHandle(1L);
X	else
X		HUnlock(hclip);
X	lenclip= GetScrap(hclip, 'TEXT', &offset);
X	if (lenclip < 0)
X		return NULL;
X	SetHandleSize(hclip, lenclip+1);
X	HLock(hclip);
X	(*hclip)[lenclip]= EOS;
X#ifndef CLEVERGLUE
X	{
X	/* Convert imported \r into \n */
X		char *p= *hclip;
X		while ((p= strchr(p, '\r')) != NULL)
X			*p++ = '\n';
X	}
X#endif
X	return *hclip;
X}
X
Xvoid
Xwsetclip(p, len)
X	char *p;
X	int len;
X{
X	int err;
X#ifndef CLEVERGLUE
X	/* Convert \n into \r before exporting.  Must make a copy, shit! */
X	char *q= malloc(len+1);
X	if (q != NULL) {
X		strncpy(q, p, len);
X		q[len]= EOS;
X		p= q;
X		while ((p= strchr(p, '\n')) != NULL)
X			*p++ = '\r';
X		p= q;
X	}
X	/* If there's no memory, export with \n's left in... */
X#endif
X	_wfreeclip();
X	err= ZeroScrap();
X	if (err != 0) dprintf("wsetclip: ZeroScrap error %d", err);
X	err= PutScrap((long)len, 'TEXT', p);
X	if (err != 0) dprintf("wsetclip: PutScrap error %d", err);
X#ifndef CLEVERGLUE
X	if (q != NULL)
X		free(q);
X#endif
X}
X
X/* For "compatibility" with X11 STDWIN: */
X
Xint
Xwsetselection(win, sel, data, len)
X	WINDOW *win;
X	int sel;
X	char *data;
X	int len;
X{
X	return 0;
X}
X
Xchar *
Xwgetselection(sel, plen)
X	int sel;
X	int *plen;
X{
X	return NULL;
X}
X
Xvoid
Xwresetselection(sel)
X	int sel;
X{
X}
X
Xvoid
Xwsetcutbuffer(ibuffer, data, len)
X	int ibuffer;
X	char *data;
X	int len;
X{
X	if (ibuffer == 0)
X		wsetclip(data, len);
X}
X
Xchar *
Xwgetcutbuffer(ibuffer, plen)
X	int ibuffer;
X	int *plen;
X{
X	if (ibuffer != 0)
X		return NULL;
X	if (wgetclip() == NULL)
X		return NULL;
X	/* This knows about the implementation of wgetclip() */
X	*plen = lenclip; /* NB: long --> int, may truncate... */
X	return *hclip;
X}
X
Xvoid
Xwrotatecutbuffers(n)
X	int n;
X{
X}
END_OF_FILE
if test 2210 -ne `wc -c <'Ports/mac/scrap.c'`; then
    echo shar: \"'Ports/mac/scrap.c'\" unpacked with wrong size!
fi
# end of 'Ports/mac/scrap.c'
fi
if test -f 'Ports/mac/timer.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ports/mac/timer.c'\"
else
echo shar: Extracting \"'Ports/mac/timer.c'\" \(1933 characters\)
sed "s/^X//" >'Ports/mac/timer.c' <<'END_OF_FILE'
X/* MAC STDWIN -- TIMER. */
X
X/* XXX The timer mechanism should be coupled less strongly with the
X   stdwin implementation -- stdwin should support a single timer,
X   while thin layers on top could implement various timer strategies. */
X
X#include "macwin.h"
X#ifdef MPW
X#include <Events.h>
X#endif
X
Xstatic unsigned long nexttimer;
X
X/* Set a window's timer.
X   The second parameter is the number of deciseconds from now
X   when the timer is to go off, or 0 to clear the timer.
X   When the timer goes off (or sometime later),
X   a WE_TIMER event will be delivered.
X   As a service to 'checktimer' below, a NULL window parameter
X   is ignored, but causes the 'nexttimer' value to be recalculated.
X   (The inefficient simplicity of the code here is due to MINIX,
X   with some inventions of my own.) */
X
Xvoid
Xwsettimer(win, deciseconds)
X	WINDOW *win;
X	int deciseconds;
X{
X	WindowPeek w;
X	
X	nexttimer= 0;
X	if (win != NULL) {
X		if (deciseconds == 0)
X			win->timer= 0;
X		else {
X			nexttimer= win->timer= TickCount() +
X				deciseconds*(TICKSPERSECOND/10);
X		}
X	}
X	for (w= (WindowPeek)FrontWindow(); w != NULL; w= w->nextWindow) {
X		win= whichwin((WindowPtr)w);
X		if (win != NULL && win->timer != 0) {
X			if (nexttimer == 0 || win->timer < nexttimer)
X				nexttimer= win->timer;
X		}
X	}
X}
X
X/* Check if a timer went off.
X   If so, return TRUE and set the event record correspondingly;
X   otherwise, return FALSE. */
X
Xbool
Xchecktimer(ep)
X	EVENT *ep;
X{
X	WindowPtr w;
X	WINDOW *win;
X	unsigned long now;
X	
X	if (nexttimer == 0) {
X		return FALSE;
X	}
X	now= TickCount();
X	if (now < nexttimer) {
X		return FALSE;
X	}
X	ep->type= WE_NULL;
X	ep->window= NULL;
X	for (w= FrontWindow(); w != NULL;
X		w= (WindowPtr)((WindowPeek)w)->nextWindow) {
X		win= whichwin(w);
X		if (win != NULL && win->timer != 0) {
X			if (win->timer <= now) {
X				ep->type= WE_TIMER;
X				ep->window= win;
X				now= win->timer;
X			}
X		}
X	}
X	wsettimer(ep->window, 0);
X	return ep->type == WE_TIMER;
X}
END_OF_FILE
if test 1933 -ne `wc -c <'Ports/mac/timer.c'`; then
    echo shar: \"'Ports/mac/timer.c'\" unpacked with wrong size!
fi
# end of 'Ports/mac/timer.c'
fi
if test -f 'Ports/vtrm/DIST/README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ports/vtrm/DIST/README'\"
else
echo shar: Extracting \"'Ports/vtrm/DIST/README'\" \(1635 characters\)
sed "s/^X//" >'Ports/vtrm/DIST/README' <<'END_OF_FILE'
XTHIS IS VTRM
X============
X
XVTRM is a terminal control package, with two implementations: one for Unix
X(only well-tested on 4.2/4.3 BSD, but supposedly running under System 5
Xas well, as long as there is a termcap database), and one for MS-DOS, to
Xbe compiled with the Microsoft C compiler (tested only with version 3.0).
XThis is a "curses replacement", which does not mean it is a curses
Xreimplementation: the interface is totally different, only the purpose
Xis more or less the same: to shield an application program from the
Xnitty-gritty detail of cursor navigation, inverse video, scrolling, etc.
XThere are also a few routines for CBREAK-mode input.
X
XUNPACKING NOTES
X
XThe shars yield six files:
X	README		(this file)
X	pag.c		(a trivial application using the package)
X	vtrmdoc.ms	(an attempt at documentation)
X	trm.h		(common header file)
X	ptrm.c		(MS-DOS version)
X	vtrm.c_1
X	vtrm.c_2
XThe latter two should be pasted together to get a file named vtrm.c:
X	cat vtrm.c_[12] >vtrm.c
X
XAUTHORS
X
XThis software was written by:
X
X	Timo Krijnen and Guido van Rossum
X	CWI, dept. AA
X	Kruislaan 413
X	1089 SJ  Amsterdam
X	The Netherlands
X
X	Electronic mail: timo@cwi.nl,  guido@cwi.nl
X	Phone: ... 20 - 592 4138.
X
XCOPYRIGHT
X
XThis software is copyright (c) 1986 by Stichting Mathematisch Centrum,
XAmsterdam, The Netherlands.  Its use is allowed freely for
Xnon-commercial purposes only.  Use at your own risk: SMC does not take
Xresponsibility for the proper functioning of the software or for damage
Xcaused by its use.  Redistribution is allowed for non-commercial
Xpurposes only, and only unchanged, in its entirety, and including this
Xcopyright notice.
END_OF_FILE
if test 1635 -ne `wc -c <'Ports/vtrm/DIST/README'`; then
    echo shar: \"'Ports/vtrm/DIST/README'\" unpacked with wrong size!
fi
# end of 'Ports/vtrm/DIST/README'
fi
if test -f 'Ports/x11/error.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Ports/x11/error.c'\"
else
echo shar: Extracting \"'Ports/x11/error.c'\" \(1992 characters\)
sed "s/^X//" >'Ports/x11/error.c' <<'END_OF_FILE'
X/* X11 STDWIN -- error and debugging messages */
X
X#include "x11.h"
X
X
X/* Undocumented globals to reduce the output volume */
X
Xbool _wnoerrors;		/* Suppress errors and warnings if set */
Xbool _wnowarnings;		/* Suppress warnings if set */
Xint _wtracelevel;		/* Amount of trace output wanted */
Xint _wdebuglevel;		/* Amount of debug output wanted */
X
X
X/* Fatal error message aborting the program (use for unrecoverable errors) */
X
X/*VARARGS1*/
X_wfatal(str, arg1, arg2, arg3, arg4)
X	char *str;
X{
X	fprintf(stderr, "%s: fatal error: ", _wprogname);
X	fprintf(stderr, str, arg1, arg2, arg3, arg4);
X	fprintf(stderr, "\n");
X	exit(1);
X	/*NOTREACHED*/
X}
X
X
X/* Error message (use for recoverable serious errors) */
X
X/*VARARGS1*/
X_werror(str, arg1, arg2, arg3, arg4)
X	char *str;
X{
X	if (!_wnoerrors || _wdebuglevel > 0 || _wtracelevel > 0) {
X		fprintf(stderr, "%s: error: ", _wprogname);
X		fprintf(stderr, str, arg1, arg2, arg3, arg4);
X		fprintf(stderr, "\n");
X	}
X}
X
X
X/* Warning message (use for informative messages) */
X
X/*VARARGS1*/
X_wwarning(str, arg1, arg2, arg3, arg4)
X	char *str;
X{
X	if (!_wnoerrors && !_wnowarnings || 
X		_wdebuglevel > 0 || _wtracelevel > 0) {
X		fprintf(stderr, "%s: warning: ", _wprogname);
X		fprintf(stderr, str, arg1, arg2, arg3, arg4);
X		fprintf(stderr, "\n");
X	}
X}
X
X
X/* Trace message (use to trace user-level routine calls) */
X
X/*VARARGS2*/
X_wtrace(level, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
X	int level;
X	char *str;
X{
X	if (_wtracelevel >= level) {
X		fprintf(stderr, "%s: trace %d: ", _wprogname, level);
X		fprintf(stderr, str,
X			arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
X		fprintf(stderr, "\n");
X	}
X}
X
X
X/* Debug message (use for misc. debugging output) */
X
X/*VARARGS2*/
X_wdebug(level, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
X	int level;
X	char *str;
X{
X	if (_wdebuglevel >= level) {
X		fprintf(stderr, "%s: debug %d: ", _wprogname, level);
X		fprintf(stderr, str,
X			arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
X		fprintf(stderr, "\n");
X	}
X}
END_OF_FILE
if test 1992 -ne `wc -c <'Ports/x11/error.c'`; then
    echo shar: \"'Ports/x11/error.c'\" unpacked with wrong size!
fi
# end of 'Ports/x11/error.c'
fi
if test -f 'Tools/getopt.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Tools/getopt.c'\"
else
echo shar: Extracting \"'Tools/getopt.c'\" \(1532 characters\)
sed "s/^X//" >'Tools/getopt.c' <<'END_OF_FILE'
X/*LINTLIBRARY*/
X
X#include "configure.h"
X
X#ifdef THINK_C
X#define SYSV
X#endif
X
X#ifdef SYSV
X#define index strchr
X#endif
X
X#ifdef unix
X#define NULL	0
X#define EOF	(-1)
X#define ERR(s, c)	if(opterr){\
X	extern int strlen(), write();\
X	char errbuf[2];\
X	errbuf[0] = c; errbuf[1] = '\n';\
X	(void) write(2, argv[0], (int)strlen(argv[0]));\
X	(void) write(2, s, (int)strlen(s));\
X	(void) write(2, errbuf, 2);}
X#else
X/* Not unix -- assume <stdio.h> works, don't expect write(2). */
X#include <stdio.h>
X#define ERR(str, chr)	if(opterr){\
X	fprintf(stderr, "%s%s%c\n", argv[0], str, chr); }
X#endif
X
Xextern int strcmp();
Xextern char *index();
X
Xint	opterr = 1;
Xint	optind = 1;
Xint	optopt;
Xchar	*optarg;
X
Xint
Xgetopt(argc, argv, opts)
Xint	argc;
Xchar	**argv, *opts;
X{
X	static int sp = 1;
X	register int c;
X	register char *cp;
X
X	if(sp == 1)
X		if(optind >= argc ||
X		   argv[optind][0] != '-' || argv[optind][1] == '\0')
X			return(EOF);
X		else if(strcmp(argv[optind], "--") == NULL) {
X			optind++;
X			return(EOF);
X		}
X	optopt = c = argv[optind][sp];
X	if(c == ':' || (cp=index(opts, c)) == NULL) {
X		ERR(": illegal option -- ", c);
X		if(argv[optind][++sp] == '\0') {
X			optind++;
X			sp = 1;
X		}
X		return('?');
X	}
X	if(*++cp == ':') {
X		if(argv[optind][sp+1] != '\0')
X			optarg = &argv[optind++][sp+1];
X		else if(++optind >= argc) {
X			ERR(": option requires an argument -- ", c);
X			sp = 1;
X			return('?');
X		} else
X			optarg = argv[optind++];
X		sp = 1;
X	} else {
X		if(argv[optind][++sp] == '\0') {
X			sp = 1;
X			optind++;
X		}
X		optarg = NULL;
X	}
X	return(c);
X}
END_OF_FILE
if test 1532 -ne `wc -c <'Tools/getopt.c'`; then
    echo shar: \"'Tools/getopt.c'\" unpacked with wrong size!
fi
# end of 'Tools/getopt.c'
fi
echo shar: End of archive 17 \(of 19\).
cp /dev/null ark17isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 19 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0