perl 3.0 beta kit [18/23]

Larry Wall lwall at jato.Jpl.Nasa.Gov
Mon Sep 4 05:00:15 AEST 1989


#! /bin/sh

# Make a new directory for the perl sources, cd to it, and run kits 1
# thru 23 through sh.  When all 23 kits have been run, read README.

echo "This is perl 3.0 kit 18 (of 23).  If kit 18 is complete, the line"
echo '"'"End of kit 18 (of 23)"'" will echo at the end.'
echo ""
export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
mkdir eg/scan eg x2p 2>/dev/null
echo Extracting x2p/str.c
sed >x2p/str.c <<'!STUFFY!FUNK!' -e 's/X//'
X/* $Header: str.c,v 2.0 88/06/05 00:16:02 root Exp $
X *
X *    Copyright (c) 1989, Larry Wall
X *
X *    You may distribute under the terms of the GNU General Public License
X *    as specified in the README file that comes with the perl 3.0 kit.
X *
X * $Log:	str.c,v $
X * Revision 2.0  88/06/05  00:16:02  root
X * Baseline version 2.0.
X * 
X */
X
X#include "handy.h"
X#include "EXTERN.h"
X#include "util.h"
X#include "a2p.h"
X
Xstr_numset(str,num)
Xregister STR *str;
Xdouble num;
X{
X    str->str_nval = num;
X    str->str_pok = 0;		/* invalidate pointer */
X    str->str_nok = 1;		/* validate number */
X}
X
Xchar *
Xstr_2ptr(str)
Xregister STR *str;
X{
X    register char *s;
X
X    if (!str)
X	return "";
X    GROWSTR(&(str->str_ptr), &(str->str_len), 24);
X    s = str->str_ptr;
X    if (str->str_nok) {
X	sprintf(s,"%.20g",str->str_nval);
X	while (*s) s++;
X    }
X    *s = '\0';
X    str->str_cur = s - str->str_ptr;
X    str->str_pok = 1;
X#ifdef DEBUGGING
X    if (debug & 32)
X	fprintf(stderr,"0x%lx ptr(%s)\n",str,str->str_ptr);
X#endif
X    return str->str_ptr;
X}
X
Xdouble
Xstr_2num(str)
Xregister STR *str;
X{
X    if (!str)
X	return 0.0;
X    if (str->str_len && str->str_pok)
X	str->str_nval = atof(str->str_ptr);
X    else
X	str->str_nval = 0.0;
X    str->str_nok = 1;
X#ifdef DEBUGGING
X    if (debug & 32)
X	fprintf(stderr,"0x%lx num(%g)\n",str,str->str_nval);
X#endif
X    return str->str_nval;
X}
X
Xstr_sset(dstr,sstr)
XSTR *dstr;
Xregister STR *sstr;
X{
X    if (!sstr)
X	str_nset(dstr,No,0);
X    else if (sstr->str_nok)
X	str_numset(dstr,sstr->str_nval);
X    else if (sstr->str_pok)
X	str_nset(dstr,sstr->str_ptr,sstr->str_cur);
X    else
X	str_nset(dstr,"",0);
X}
X
Xstr_nset(str,ptr,len)
Xregister STR *str;
Xregister char *ptr;
Xregister int len;
X{
X    GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
X    bcopy(ptr,str->str_ptr,len);
X    str->str_cur = len;
X    *(str->str_ptr+str->str_cur) = '\0';
X    str->str_nok = 0;		/* invalidate number */
X    str->str_pok = 1;		/* validate pointer */
X}
X
Xstr_set(str,ptr)
Xregister STR *str;
Xregister char *ptr;
X{
X    register int len;
X
X    if (!ptr)
X	ptr = "";
X    len = strlen(ptr);
X    GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
X    bcopy(ptr,str->str_ptr,len+1);
X    str->str_cur = len;
X    str->str_nok = 0;		/* invalidate number */
X    str->str_pok = 1;		/* validate pointer */
X}
X
Xstr_chop(str,ptr)	/* like set but assuming ptr is in str */
Xregister STR *str;
Xregister char *ptr;
X{
X    if (!(str->str_pok))
X	str_2ptr(str);
X    str->str_cur -= (ptr - str->str_ptr);
X    bcopy(ptr,str->str_ptr, str->str_cur + 1);
X    str->str_nok = 0;		/* invalidate number */
X    str->str_pok = 1;		/* validate pointer */
X}
X
Xstr_ncat(str,ptr,len)
Xregister STR *str;
Xregister char *ptr;
Xregister int len;
X{
X    if (!(str->str_pok))
X	str_2ptr(str);
X    GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1);
X    bcopy(ptr,str->str_ptr+str->str_cur,len);
X    str->str_cur += len;
X    *(str->str_ptr+str->str_cur) = '\0';
X    str->str_nok = 0;		/* invalidate number */
X    str->str_pok = 1;		/* validate pointer */
X}
X
Xstr_scat(dstr,sstr)
XSTR *dstr;
Xregister STR *sstr;
X{
X    if (!(sstr->str_pok))
X	str_2ptr(sstr);
X    if (sstr)
X	str_ncat(dstr,sstr->str_ptr,sstr->str_cur);
X}
X
Xstr_cat(str,ptr)
Xregister STR *str;
Xregister char *ptr;
X{
X    register int len;
X
X    if (!ptr)
X	return;
X    if (!(str->str_pok))
X	str_2ptr(str);
X    len = strlen(ptr);
X    GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1);
X    bcopy(ptr,str->str_ptr+str->str_cur,len+1);
X    str->str_cur += len;
X    str->str_nok = 0;		/* invalidate number */
X    str->str_pok = 1;		/* validate pointer */
X}
X
Xchar *
Xstr_append_till(str,from,delim,keeplist)
Xregister STR *str;
Xregister char *from;
Xregister int delim;
Xchar *keeplist;
X{
X    register char *to;
X    register int len;
X
X    if (!from)
X	return Nullch;
X    len = strlen(from);
X    GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + len + 1);
X    str->str_nok = 0;		/* invalidate number */
X    str->str_pok = 1;		/* validate pointer */
X    to = str->str_ptr+str->str_cur;
X    for (; *from; from++,to++) {
X	if (*from == '\\' && from[1] && delim != '\\') {
X	    if (!keeplist) {
X		if (from[1] == delim || from[1] == '\\')
X		    from++;
X		else
X		    *to++ = *from++;
X	    }
X	    else if (index(keeplist,from[1]))
X		*to++ = *from++;
X	    else
X		from++;
X	}
X	else if (*from == delim)
X	    break;
X	*to = *from;
X    }
X    *to = '\0';
X    str->str_cur = to - str->str_ptr;
X    return from;
X}
X
XSTR *
Xstr_new(len)
Xint len;
X{
X    register STR *str;
X    
X    if (freestrroot) {
X	str = freestrroot;
X	freestrroot = str->str_link.str_next;
X    }
X    else {
X	str = (STR *) safemalloc(sizeof(STR));
X	bzero((char*)str,sizeof(STR));
X    }
X    if (len)
X	GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
X    return str;
X}
X
Xvoid
Xstr_grow(str,len)
Xregister STR *str;
Xint len;
X{
X    if (len && str)
X	GROWSTR(&(str->str_ptr), &(str->str_len), len + 1);
X}
X
X/* make str point to what nstr did */
X
Xvoid
Xstr_replace(str,nstr)
Xregister STR *str;
Xregister STR *nstr;
X{
X    safefree(str->str_ptr);
X    str->str_ptr = nstr->str_ptr;
X    str->str_len = nstr->str_len;
X    str->str_cur = nstr->str_cur;
X    str->str_pok = nstr->str_pok;
X    if (str->str_nok = nstr->str_nok)
X	str->str_nval = nstr->str_nval;
X    safefree((char*)nstr);
X}
X
Xvoid
Xstr_free(str)
Xregister STR *str;
X{
X    if (!str)
X	return;
X    if (str->str_len)
X	str->str_ptr[0] = '\0';
X    str->str_cur = 0;
X    str->str_nok = 0;
X    str->str_pok = 0;
X    str->str_link.str_next = freestrroot;
X    freestrroot = str;
X}
X
Xstr_len(str)
Xregister STR *str;
X{
X    if (!str)
X	return 0;
X    if (!(str->str_pok))
X	str_2ptr(str);
X    if (str->str_len)
X	return str->str_cur;
X    else
X	return 0;
X}
X
Xchar *
Xstr_gets(str,fp)
Xregister STR *str;
Xregister FILE *fp;
X{
X#ifdef STDSTDIO		/* Here is some breathtakingly efficient cheating */
X
X    register char *bp;		/* we're going to steal some values */
X    register int cnt;		/*  from the stdio struct and put EVERYTHING */
X    register STDCHAR *ptr;	/*   in the innermost loop into registers */
X    register char newline = '\n';	/* (assuming at least 6 registers) */
X    int i;
X    int bpx;
X
X    cnt = fp->_cnt;			/* get count into register */
X    str->str_nok = 0;			/* invalidate number */
X    str->str_pok = 1;			/* validate pointer */
X    if (str->str_len <= cnt)		/* make sure we have the room */
X	GROWSTR(&(str->str_ptr), &(str->str_len), cnt+1);
X    bp = str->str_ptr;			/* move these two too to registers */
X    ptr = fp->_ptr;
X    for (;;) {
X	while (--cnt >= 0) {
X	    if ((*bp++ = *ptr++) == newline)
X		if (bp <= str->str_ptr || bp[-2] != '\\')
X		    goto thats_all_folks;
X		else {
X		    line++;
X		    bp -= 2;
X		}
X	}
X	
X	fp->_cnt = cnt;			/* deregisterize cnt and ptr */
X	fp->_ptr = ptr;
X	i = _filbuf(fp);		/* get more characters */
X	cnt = fp->_cnt;
X	ptr = fp->_ptr;			/* reregisterize cnt and ptr */
X
X	bpx = bp - str->str_ptr;	/* prepare for possible relocation */
X	GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + cnt + 1);
X	bp = str->str_ptr + bpx;	/* reconstitute our pointer */
X
X	if (i == newline) {		/* all done for now? */
X	    *bp++ = i;
X	    goto thats_all_folks;
X	}
X	else if (i == EOF)		/* all done for ever? */
X	    goto thats_all_folks;
X	*bp++ = i;			/* now go back to screaming loop */
X    }
X
Xthats_all_folks:
X    fp->_cnt = cnt;			/* put these back or we're in trouble */
X    fp->_ptr = ptr;
X    *bp = '\0';
X    str->str_cur = bp - str->str_ptr;	/* set length */
X
X#else /* !STDSTDIO */	/* The big, slow, and stupid way */
X
X    static char buf[4192];
X
X    if (fgets(buf, sizeof buf, fp) != Nullch)
X	str_set(str, buf);
X    else
X	str_set(str, No);
X
X#endif /* STDSTDIO */
X
X    return str->str_cur ? str->str_ptr : Nullch;
X}
X
Xvoid
Xstr_inc(str)
Xregister STR *str;
X{
X    register char *d;
X
X    if (!str)
X	return;
X    if (str->str_nok) {
X	str->str_nval += 1.0;
X	str->str_pok = 0;
X	return;
X    }
X    if (!str->str_pok) {
X	str->str_nval = 1.0;
X	str->str_nok = 1;
X	return;
X    }
X    for (d = str->str_ptr; *d && *d != '.'; d++) ;
X    d--;
X    if (!isdigit(*str->str_ptr) || !isdigit(*d) ) {
X        str_numset(str,atof(str->str_ptr) + 1.0);  /* punt */
X	return;
X    }
X    while (d >= str->str_ptr) {
X	if (++*d <= '9')
X	    return;
X	*(d--) = '0';
X    }
X    /* oh,oh, the number grew */
X    GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + 2);
X    str->str_cur++;
X    for (d = str->str_ptr + str->str_cur; d > str->str_ptr; d--)
X	*d = d[-1];
X    *d = '1';
X}
X
Xvoid
Xstr_dec(str)
Xregister STR *str;
X{
X    register char *d;
X
X    if (!str)
X	return;
X    if (str->str_nok) {
X	str->str_nval -= 1.0;
X	str->str_pok = 0;
X	return;
X    }
X    if (!str->str_pok) {
X	str->str_nval = -1.0;
X	str->str_nok = 1;
X	return;
X    }
X    for (d = str->str_ptr; *d && *d != '.'; d++) ;
X    d--;
X    if (!isdigit(*str->str_ptr) || !isdigit(*d) || (*d == '0' && d == str->str_ptr)) {
X        str_numset(str,atof(str->str_ptr) - 1.0);  /* punt */
X	return;
X    }
X    while (d >= str->str_ptr) {
X	if (--*d >= '0')
X	    return;
X	*(d--) = '9';
X    }
X}
X
X/* make a string that will exist for the duration of the expression eval */
X
XSTR *
Xstr_static(oldstr)
XSTR *oldstr;
X{
X    register STR *str = str_new(0);
X    static long tmps_size = -1;
X
X    str_sset(str,oldstr);
X    if (++tmps_max > tmps_size) {
X	tmps_size = tmps_max;
X	if (!(tmps_size & 127)) {
X	    if (tmps_size)
X		tmps_list = (STR**)saferealloc((char*)tmps_list,
X		    (tmps_size + 128) * sizeof(STR*) );
X	    else
X		tmps_list = (STR**)safemalloc(128 * sizeof(char*));
X	}
X    }
X    tmps_list[tmps_max] = str;
X    return str;
X}
X
XSTR *
Xstr_make(s)
Xchar *s;
X{
X    register STR *str = str_new(0);
X
X    str_set(str,s);
X    return str;
X}
X
XSTR *
Xstr_nmake(n)
Xdouble n;
X{
X    register STR *str = str_new(0);
X
X    str_numset(str,n);
X    return str;
X}
!STUFFY!FUNK!
echo Extracting Makefile.SH
sed >Makefile.SH <<'!STUFFY!FUNK!' -e 's/X//'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . ./config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
X
Xcase "$d_symlink" in
X*define*) sln='ln -s' ;;
X*) sln='ln';;
Xesac
X
Xcase "$d_dosuid" in
X*define*) suidperl='suidperl' ;;
X*) suidperl='';;
Xesac
X
Xecho "Extracting Makefile (with variable substitutions)"
Xcat >Makefile <<!GROK!THIS!
X# $Header: Makefile.SH,v 2.0.1.7 88/11/22 01:04:00 lwall Locked $
X#
X# $Log:	Makefile.SH,v $
X
XCC = $cc
Xbin = $bin
Xprivlib = $privlib
Xmansrc = $mansrc
Xmanext = $manext
XCFLAGS = $ccflags -O
XLDFLAGS = $ldflags
XSMALL = $small
XLARGE = $large $split
Xmallocsrc = $mallocsrc
Xmallocobj = $mallocobj
XSLN = $sln
X
Xlibs = $libnm -lm $libdbm
X
Xpublic = perl taintperl $suidperl
X
X!GROK!THIS!
X
Xcat >>Makefile <<'!NO!SUBS!'
Xprivate = 
X
XMAKE = make
X
Xmanpages = perl.man
X
Xutil =
X
Xsh = Makefile.SH makedepend.SH
X
Xh1 = EXTERN.h INTERN.h arg.h array.h cmd.h config.h form.h handy.h
Xh2 = hash.h perl.h regcomp.h regexp.h spat.h stab.h str.h util.h
X
Xh = $(h1) $(h2)
X
Xc1 = array.c cmd.c cons.c consarg.c doarg.c doio.c dolist.c dump.c
Xc2 = eval.c form.c hash.c $(mallocsrc) perly.c regcomp.c regexec.c
Xc3 = stab.c str.c toke.c util.c
X
Xc = $(c1) $(c2) $(c3)
X
Xobj1 = array.o cmd.o cons.o consarg.o doarg.o doio.o dolist.o dump.o
Xobj2 = eval.o form.o hash.o $(mallocobj) perly.o regcomp.o regexec.o
Xobj3 = stab.o str.o toke.o util.o
X
Xobj = $(obj1) $(obj2) $(obj3)
X
Xtobj1 = tarray.o tcmd.o tcons.o tconsarg.o tdoarg.o tdoio.o tdolist.o tdump.o
Xtobj2 = teval.o tform.o thash.o $(mallocobj) tregcomp.o tregexec.o
Xtobj3 = tstab.o tstr.o ttoke.o tutil.o
X
Xtobj = $(tobj1) $(tobj2) $(tobj3)
X
Xlintflags = -hbvxac
X
Xaddedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
X
X# grrr
XSHELL = /bin/sh
X
X.c.o:
X	$(CC) -c $(CFLAGS) $(LARGE) $*.c
X
Xall: $(public) $(private) $(util) perl.man x2p/all
X	touch all
X
Xx2p/all:
X	cd x2p; $(MAKE) all
X
X# This is the standard version that contains no "taint" checks and is
X# used for all scripts that aren't set-id or running under something set-id.
X
Xperl: perl.o $(obj)
X	$(CC) $(LARGE) $(obj) perl.o $(LDFLAGS) $(libs) -o perl
X
X# This version, if specified in Configure, does ONLY those scripts which need
X# set-id emulation.  Suidperl must be setuid root.  It contains the "taint"
X# checks as well as the special code to validate that the script in question
X# has been invoked correctly.
X
Xsuidperl: tperl.o sperly.o $(tobj)
X	$(CC) $(LDFLAGS) $(LARGE) sperly.o $(tobj) tperl.o $(libs) -o suidperl
X
X# This version interprets scripts that are already set-id either via a wrapper
X# or through the kernel allowing set-id scripts (bad idea).  Taintperl must
X# NOT be setuid to root or anything else.  The only difference between it
X# and normal perl is the presence of the "taint" checks.
X
Xtaintperl: tperl.o tperly.o $(tobj)
X	$(CC) $(LDFLAGS) $(LARGE) tperly.o $(tobj) tperl.o $(libs) -o taintperl
X
X# Replicating all this junk is yucky, but I don't see a portable way to fix it.
X
Xtperl.o: perl.c perly.h perl.h EXTERN.h regexp.h util.h INTERN.h handy.h config.h
X	/bin/rm -f tperl.c
X	$(SLN) perl.c tperl.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperl.c
X	/bin/rm -f tperl.c
X
Xtperly.o: perly.c
X	/bin/rm -f tperly.c
X	$(SLN) perly.c tperly.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperly.c
X	/bin/rm -f tperly.c
X
Xsperly.o: perly.c
X	/bin/rm -f sperly.c
X	$(SLN) perly.c sperly.c
X	$(CC) -c -DTAINT -DIAMSUID $(CFLAGS) $(LARGE) sperly.c
X	/bin/rm -f sperly.c
X
Xtarray.o: array.c
X	/bin/rm -f tarray.c
X	$(SLN) array.c tarray.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tarray.c
X	/bin/rm -f tarray.c
X
Xtcmd.o: cmd.c
X	/bin/rm -f tcmd.c
X	$(SLN) cmd.c tcmd.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcmd.c
X	/bin/rm -f tcmd.c
X
Xtcons.o: cons.c
X	/bin/rm -f tcons.c
X	$(SLN) cons.c tcons.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcons.c
X	/bin/rm -f tcons.c
X
Xtconsarg.o: consarg.c
X	/bin/rm -f tconsarg.c
X	$(SLN) consarg.c tconsarg.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tconsarg.c
X	/bin/rm -f tconsarg.c
X
Xtdoarg.o: doarg.c
X	/bin/rm -f tdoarg.c
X	$(SLN) doarg.c tdoarg.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoarg.c
X	/bin/rm -f tdoarg.c
X
Xtdoio.o: doio.c
X	/bin/rm -f tdoio.c
X	$(SLN) doio.c tdoio.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoio.c
X	/bin/rm -f tdoio.c
X
Xtdolist.o: dolist.c
X	/bin/rm -f tdolist.c
X	$(SLN) dolist.c tdolist.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdolist.c
X	/bin/rm -f tdolist.c
X
Xtdump.o: dump.c
X	/bin/rm -f tdump.c
X	$(SLN) dump.c tdump.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdump.c
X	/bin/rm -f tdump.c
X
Xteval.o: eval.c
X	/bin/rm -f teval.c
X	$(SLN) eval.c teval.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) teval.c
X	/bin/rm -f teval.c
X
Xtform.o: form.c
X	/bin/rm -f tform.c
X	$(SLN) form.c tform.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tform.c
X	/bin/rm -f tform.c
X
Xthash.o: hash.c
X	/bin/rm -f thash.c
X	$(SLN) hash.c thash.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) thash.c
X	/bin/rm -f thash.c
X
Xtregcomp.o: regcomp.c
X	/bin/rm -f tregcomp.c
X	$(SLN) regcomp.c tregcomp.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregcomp.c
X	/bin/rm -f tregcomp.c
X
Xtregexec.o: regexec.c
X	/bin/rm -f tregexec.c
X	$(SLN) regexec.c tregexec.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregexec.c
X	/bin/rm -f tregexec.c
X
Xtstab.o: stab.c
X	/bin/rm -f tstab.c
X	$(SLN) stab.c tstab.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstab.c
X	/bin/rm -f tstab.c
X
Xtstr.o: str.c
X	/bin/rm -f tstr.c
X	$(SLN) str.c tstr.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstr.c
X	/bin/rm -f tstr.c
X
Xttoke.o: toke.c
X	/bin/rm -f ttoke.c
X	$(SLN) toke.c ttoke.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) ttoke.c
X	/bin/rm -f ttoke.c
X
Xtutil.o: util.c
X	/bin/rm -f tutil.c
X	$(SLN) util.c tutil.c
X	$(CC) -c -DTAINT $(CFLAGS) $(LARGE) tutil.c
X	/bin/rm -f tutil.c
X
Xperl.c perly.h: perl.y
X	@ echo Expect 25 shift/reduce errors...
X	yacc -d perl.y
X	mv y.tab.c perl.c
X	mv y.tab.h perly.h
X
Xperl.o: perl.c perly.h perl.h EXTERN.h regexp.h util.h INTERN.h handy.h \
X    config.h arg.h
X	$(CC) -c $(CFLAGS) $(LARGE) perl.c
X
X# if a .h file depends on another .h file...
X$(h):
X	touch $@
X
Xperl.man: perl.man.1 perl.man.2 perl.man.3 perl.man.4
X	./perl  -e '($$r,$$p)=$$]=~/(\d+\.\d+).*\n\D*(\d+)/;' \
X		-e 'print ".ds RP Release $$r Patchlevel $$p\n";' >perl.man
X	cat perl.man.[1-4] >>perl.man
X
Xinstall: all
X# won't work with csh
X	export PATH || exit 1
X	- rm -f $(bin)/perl.old $(bin)/suidperl $(bin)/taintperl
X	- mv $(bin)/perl $(bin)/perl.old 2>/dev/null
X	- if test `pwd` != $(bin); then cp $(public) $(bin); fi
X	- cd $(bin); \
Xfor pub in $(public); do \
Xchmod +x `basename $$pub`; \
Xdone
X	- chmod 755 $(bin)/taintperl 2>/dev/null
X!NO!SUBS!
X
Xcase "$d_dosuid" in
X*define*)
X    cat >>Makefile <<'!NO!SUBS!'
X	- chmod 4711 $(bin)/suidperl 2>/dev/null
X!NO!SUBS!
X    ;;
Xesac
X
Xcat >>Makefile <<'!NO!SUBS!'
X	- test $(bin) = /usr/bin || rm -f /usr/bin/perl
X	- test $(bin) = /usr/bin || $(SLN) $(bin)/perl /usr/bin || cp $(bin)/perl /usr/bin
X	- sh ./makedir $(privlib)
X	- \
Xif test `pwd` != $(privlib); then \
Xcp $(private) lib/*.pl $(privlib); \
Xfi
X#	cd $(privlib); \
X#for priv in $(private); do \
X#chmod +x `basename $$priv`; \
X#done
X	- if test `pwd` != $(mansrc); then \
Xfor page in $(manpages); do \
Xcp $$page $(mansrc)/`basename $$page .man`.$(manext); \
Xdone; \
Xfi
X	cd x2p; $(MAKE) install
X
Xclean:
X	rm -f *.o
X	cd x2p; $(MAKE) clean
X
Xrealclean:
X	rm -f perl *.orig */*.orig *~ */*~ *.o core $(addedbyconf) perl.man
X	rm -f perl.c perly.h t/perl Makefile config.h makedepend makedir
X	rm -f x2p/Makefile
X	cd x2p; $(MAKE) realclean
X
X# The following lint has practically everything turned on.  Unfortunately,
X# you have to wade through a lot of mumbo jumbo that can't be suppressed.
X# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
X# for that spot.
X
Xlint: perl.c $(c)
X	lint $(lintflags) $(defs) perl.c $(c) > perl.fuzz
X
Xdepend: makedepend
X	- test -f perly.h || cp /dev/null perly.h
X	./makedepend
X	- test -s perly.h || /bin/rm -f perly.h
X	cd x2p; $(MAKE) depend
X
Xtest: perl
X	- chmod +x t/TEST t/base.* t/comp.* t/cmd.* t/io.* t/op.*; \
X	cd t && (rm -f perl; $(SLN) ../perl .) && ./perl TEST
X
Xclist:
X	echo $(c) | tr ' ' '\012' >.clist
X
Xhlist:
X	echo $(h) | tr ' ' '\012' >.hlist
X
Xshlist:
X	echo $(sh) | tr ' ' '\012' >.shlist
X
X# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
Xperly.o $(obj):
X	@ echo "You haven't done a "'"make depend" yet!'; exit 1
Xmakedepend: makedepend.SH
X	/bin/sh makedepend.SH
X!NO!SUBS!
X$eunicefix Makefile
Xcase `pwd` in
X*SH)
X    $rm -f ../Makefile
X    ln Makefile ../Makefile
X    ;;
Xesac
!STUFFY!FUNK!
echo Extracting PACKINGLIST
sed >PACKINGLIST <<'!STUFFY!FUNK!' -e 's/X//'
XAfter all the perl kits are run you should have the following files:
X
XFilename		Kit Description
X--------		--- -----------
XChanges                 19 Differences between 2.0 level 18 and 3.0 level 0
XConfigure                3 Run this first
XCopying                 12 The GNU General Public License
XEXTERN.h                23 Included before foreign .h files
XINTERN.h                23 Included before domestic .h files
XMANIFEST                18 This list of files
XMakefile.SH             18 Precursor to Makefile
XPACKINGLIST             18 Which files came from which kits
XREADME                   1 The Instructions
XWishlist                18 Some things that may or may not happen
Xarg.h                    9 Public declarations for the above
Xarray.c                  6 Numerically subscripted arrays
Xarray.h                 22 Public declarations for the above
Xclient                  22 A client to test sockets
Xcmd.c                   14 Command interpreter
Xcmd.h                   20 Public declarations for the above
Xconfig.H                 4 Sample config.h
Xconfig.h.SH              8 Produces config.h
Xcons.c                   9 Routines to construct cmd nodes of a parse tree
Xconsarg.c               13 Routines to construct arg nodes of a parse tree
Xdoarg.c                 11 Scalar expression evaluation
Xdoio.c                   8 I/O operations
Xdolist.c                16 Array expression evaluation
Xdump.c                  18 Debugging output
Xeg/ADB                  23 An adb wrapper to put in your crash dir
Xeg/README                1 Intro to example perl scripts
Xeg/changes              22 A program to list recently changed files
Xeg/down                 23 A program to do things to subdirectories
Xeg/dus                  23 A program to do du -s on non-mounted dirs
Xeg/findcp               22 A find wrapper that implements a -cp switch
Xeg/findtar              23 A find wrapper that pumps out a tar file
Xeg/g/gcp.man            21 Manual page for gcp
Xeg/g/gcp                21 A program to do a global rcp
Xeg/g/ged                23 A program to do a global edit
Xeg/g/ghosts             22 A sample /etc/ghosts file
Xeg/g/gsh.man            21 Manual page for gsh
Xeg/g/gsh                20 A program to do a global rsh
Xeg/muck.man             23 Manual page for muck
Xeg/muck                 21 A program to find missing make dependencies
Xeg/myrup                22 A program to find lightly loaded machines
Xeg/nih                  23 Script to insert #! workaround
Xeg/rmfrom               17 A program to feed doomed filenames to
Xeg/scan/scan_df         22 Scan for filesystem anomalies
Xeg/scan/scan_last       22 Scan for login anomalies
Xeg/scan/scan_messages   18 Scan for console message anomalies
Xeg/scan/scan_passwd     15 Scan for passwd file anomalies
Xeg/scan/scan_ps         22 Scan for process anomalies
Xeg/scan/scan_sudo       22 Scan for sudo anomalies
Xeg/scan/scan_suid       21 Scan for setuid anomalies
Xeg/scan/scanner         21 An anomaly reporter
Xeg/shmkill              23 A program to remove unused shared memory
Xeg/van/empty            22 A program to empty the trashcan
Xeg/van/unvanish         21 A program to undo what vanish does
Xeg/van/vanexp           23 A program to expire vanished files
Xeg/van/vanish           21 A program to put files in a trashcan
Xeg/who                  23 A sample who program
Xeval.c                   5 The expression evaluator
Xevalargs.xc             12 The arg evaluator of eval.c
Xform.c                  19 Format processing
Xform.h                  22 Public declarations for the above
Xgettest                 23 A little script to test the get* routines
Xhandy.h                 21 Handy definitions
Xhash.c                  17 Associative arrays
Xhash.h                   8 Public declarations for the above
Xhdef                    22 Build database of .h definition locations
Xioctl.pl                20 Sample ioctl.pl
Xlib/complete.pl         21 A command completion subroutine
Xlib/dumpvar.pl          23 A variable dumper
Xlib/getopt.pl            7 Perl library supporting option parsing
Xlib/importenv.pl        23 Perl routine to get environment into variables
Xlib/perldb.pl           17 Perl debugging routines
Xlib/stat.pl             22 Perl library supporting stat function
Xlib/termcap.pl          16 Perl library supporting termcap usage
Xlib/validate.pl         20 Perl library supporting wholesale file mode validation
Xmakedepend.SH           20 Precursor to makedepend
Xmakedir.SH              22 Precursor to makedir
Xmakelib.SH              20 A thing to turn C .h file into perl .h files
Xmalloc.c                13 A version of malloc you might not want
Xmunch                   19 Try to make some .h equivalents
Xpatchlevel.h             6 The current patch level of perl
Xperl.h                  17 Global declarations
Xperl.man.1               1 The manual page(s), first fourth
Xperl.man.2              10 The manual page(s), second fourth
Xperl.man.3               7 The manual page(s), third fourth
Xperl.man.4               6 The manual page(s), fourth fourth
Xperl.y                  10 Yacc grammar for perl
Xperlsh                  23 A poor man's perl shell
Xperly.c                 16 main()
Xregcomp.c               12 Regular expression compiler
Xregcomp.h               19 Private declarations for above
Xregexec.c               11 Regular expression evaluator
Xregexp.h                22 Public declarations for the above
Xserver                  23 A server to test sockets
Xspat.h                  22 Search pattern declarations
Xstab.c                   7 Symbol table stuff
Xstab.h                  20 Public declarations for the above
Xstr.c                   14 String handling package
Xstr.h                   20 Public declarations for the above
Xt/README                 1 Instructions for regression tests
Xt/TEST                  21 The regression tester
Xt/base.cond             23 See if conditionals work
Xt/base.if               23 See if if works
Xt/base.lex              22 See if lexical items work
Xt/base.pat               3 See if pattern matching works
Xt/base.term             22 See if various terms work
Xt/cmd.elsif             23 See if else-if works
Xt/cmd.for               22 See if for loops work
Xt/cmd.mod               22 See if statement modifiers work
Xt/cmd.subval            21 See if subroutine values work
Xt/cmd.switch            21 See if switch optimizations work
Xt/cmd.while             21 See if while loops work
Xt/comp.cmdopt           21 See if command optimization works
Xt/comp.cpp              22 See if C preprocessor works
Xt/comp.decl             23 See if declarations work
Xt/comp.multiline        22 See if multiline strings work
Xt/comp.package          22 See if packages work
Xt/comp.script           23 See if script invokation works
Xt/comp.term             22 See if more terms work
Xt/io.argv               22 See if ARGV stuff works
Xt/io.dup                23 See if >& works right
Xt/io.fs                 21 See if directory manipulations work
Xt/io.inplace            23 See if inplace editing works
Xt/io.pipe               23 See if secure pipes work
Xt/io.print              23 See if print commands work
Xt/io.tell               11 See if file seeking works
Xt/op.append             23 See if . works
Xt/op.array               5 See if array operations work
Xt/op.auto               21 See if autoincrement et all work
Xt/op.chop               23 See if chop works
Xt/op.cond               23 See if conditional expressions work
Xt/op.dbm                21 See if dbm binding works
Xt/op.delete             22 See if delete works
Xt/op.do                 22 See if subroutines work
Xt/op.each               22 See if associative iterators work
Xt/op.eval               22 See if eval operator works
Xt/op.exec                9 See if exec and system work
Xt/op.exp                22 See if math functions work
Xt/op.flip               23 See if range operator works
Xt/op.fork               23 See if fork works
Xt/op.glob               23 See if <*> works
Xt/op.goto               22 See if goto works
Xt/op.index              22 See if index works
Xt/op.int                23 See if int works
Xt/op.join               23 See if join works
Xt/op.list               21 See if array lists work
Xt/op.local              22 See if local works
Xt/op.magic              22 See if magic variables work
Xt/op.mkdir              23 See if mkdir works
Xt/op.oct                23 See if oct and hex work
Xt/op.ord                23 See if ord works
Xt/op.pack               23 See if pack and unpack work
Xt/op.pat                20 See if esoteric patterns work
Xt/op.push               23 See if push and pop work
Xt/op.range              22 See if .. works
Xt/op.read               22 See if read() works
Xt/op.regexp             22 See if regular expressions work
Xt/op.repeat             22 See if x operator works
Xt/op.sleep              14 See if sleep works
Xt/op.sort               23 See if sort works
Xt/op.split               1 See if split works
Xt/op.sprintf            23 See if sprintf works
Xt/op.stat               19 See if stat works
Xt/op.study              21 See if study works
Xt/op.substr             20 See if substr works
Xt/op.subst              20 See if substitutions work
Xt/op.time               22 See if time functions work
Xt/op.undef              22 See if undef works
Xt/op.unshift            23 See if unshift works
Xt/op.vec                22 See if vectors work
Xt/op.write              22 See if write works
Xt/re_tests              20 Input file for op.regexp
Xtoke.c                   4 The tokener
Xutil.c                  15 Utility routines
Xutil.h                  22 Public declarations for the above
Xx2p/EXTERN.h            23 Same as above
Xx2p/INTERN.h            23 Same as above
Xx2p/Makefile.SH         20 Precursor to Makefile
Xx2p/a2p.h               19 Global declarations
Xx2p/a2p.man             19 Manual page for awk to perl translator
Xx2p/a2p.y               17 A yacc grammer for awk
Xx2p/a2py.c              15 Awk compiler, sort of
Xx2p/handy.h             22 Handy definitions
Xx2p/hash.c              19 Associative arrays again
Xx2p/hash.h              22 Public declarations for the above
Xx2p/s2p.SH              13 Sed to perl translator
Xx2p/s2p.man             21 Manual page for sed to perl translator
Xx2p/str.c               18 String handling package
Xx2p/str.h               22 Public declarations for the above
Xx2p/util.c              17 Utility routines
Xx2p/util.h              22 Public declarations for the above
Xx2p/walk.c               2 Parse tree walker
!STUFFY!FUNK!
echo Extracting MANIFEST
sed >MANIFEST <<'!STUFFY!FUNK!' -e 's/X//'
XChanges			Differences between 2.0 level 18 and 3.0 level 0
XConfigure		Run this first
XCopying			The GNU General Public License
XEXTERN.h		Included before foreign .h files
XINTERN.h		Included before domestic .h files
XMANIFEST		This list of files
XMakefile.SH		Precursor to Makefile
XPACKINGLIST		Which files came from which kits
XREADME			The Instructions
XWishlist		Some things that may or may not happen
Xarg.h			Public declarations for the above
Xarray.c			Numerically subscripted arrays
Xarray.h			Public declarations for the above
Xclient			A client to test sockets
Xcmd.c			Command interpreter
Xcmd.h			Public declarations for the above
Xconfig.H		Sample config.h
Xconfig.h.SH		Produces config.h
Xcons.c			Routines to construct cmd nodes of a parse tree
Xconsarg.c		Routines to construct arg nodes of a parse tree
Xdoarg.c			Scalar expression evaluation
Xdoio.c			I/O operations
Xdolist.c		Array expression evaluation
Xdump.c			Debugging output
Xeg/ADB			An adb wrapper to put in your crash dir
Xeg/README		Intro to example perl scripts
Xeg/changes		A program to list recently changed files
Xeg/down			A program to do things to subdirectories
Xeg/dus			A program to do du -s on non-mounted dirs
Xeg/findcp		A find wrapper that implements a -cp switch
Xeg/findtar		A find wrapper that pumps out a tar file
Xeg/g/gcp		A program to do a global rcp
Xeg/g/gcp.man		Manual page for gcp
Xeg/g/ged		A program to do a global edit
Xeg/g/ghosts		A sample /etc/ghosts file
Xeg/g/gsh		A program to do a global rsh
Xeg/g/gsh.man		Manual page for gsh
Xeg/muck			A program to find missing make dependencies
Xeg/muck.man		Manual page for muck
Xeg/myrup		A program to find lightly loaded machines
Xeg/nih			Script to insert #! workaround
Xeg/rmfrom		A program to feed doomed filenames to
Xeg/scan/scan_df		Scan for filesystem anomalies
Xeg/scan/scan_last	Scan for login anomalies
Xeg/scan/scan_messages	Scan for console message anomalies
Xeg/scan/scan_passwd	Scan for passwd file anomalies
Xeg/scan/scan_ps		Scan for process anomalies
Xeg/scan/scan_sudo	Scan for sudo anomalies
Xeg/scan/scan_suid	Scan for setuid anomalies
Xeg/scan/scanner		An anomaly reporter
Xeg/shmkill		A program to remove unused shared memory
Xeg/van/empty		A program to empty the trashcan
Xeg/van/unvanish		A program to undo what vanish does
Xeg/van/vanexp		A program to expire vanished files
Xeg/van/vanish		A program to put files in a trashcan
Xeg/who			A sample who program
Xeval.c			The expression evaluator
Xevalargs.xc		The arg evaluator of eval.c
Xform.c			Format processing
Xform.h			Public declarations for the above
Xgettest			A little script to test the get* routines
Xhandy.h			Handy definitions
Xhash.c			Associative arrays
Xhash.h			Public declarations for the above
Xhdef			Build database of .h definition locations
Xioctl.pl		Sample ioctl.pl
Xlib/complete.pl		A command completion subroutine
Xlib/dumpvar.pl		A variable dumper
Xlib/getopt.pl		Perl library supporting option parsing
Xlib/importenv.pl	Perl routine to get environment into variables
Xlib/perldb.pl		Perl debugging routines
Xlib/stat.pl		Perl library supporting stat function
Xlib/termcap.pl		Perl library supporting termcap usage
Xlib/validate.pl		Perl library supporting wholesale file mode validation
Xmakedepend.SH		Precursor to makedepend
Xmakedir.SH		Precursor to makedir
Xmakelib.SH		A thing to turn C .h file into perl .h files
Xmalloc.c		A version of malloc you might not want
Xmunch			Try to make some .h equivalents
Xpatchlevel.h		The current patch level of perl
Xperl.h			Global declarations
Xperl.man.1		The manual page(s), first fourth
Xperl.man.2		The manual page(s), second fourth
Xperl.man.3		The manual page(s), third fourth
Xperl.man.4		The manual page(s), fourth fourth
Xperl.y			Yacc grammar for perl
Xperlsh			A poor man's perl shell
Xperly.c			main()
Xregcomp.c		Regular expression compiler
Xregcomp.h		Private declarations for above
Xregexp.h		Public declarations for the above
Xregexec.c		Regular expression evaluator
Xserver			A server to test sockets
Xspat.h			Search pattern declarations
Xstab.c			Symbol table stuff
Xstab.h			Public declarations for the above
Xstr.c			String handling package
Xstr.h			Public declarations for the above
Xt/README		Instructions for regression tests
Xt/TEST			The regression tester
Xt/base.cond		See if conditionals work
Xt/base.if		See if if works
Xt/base.lex		See if lexical items work
Xt/base.pat		See if pattern matching works
Xt/base.term		See if various terms work
Xt/cmd.elsif		See if else-if works
Xt/cmd.for		See if for loops work
Xt/cmd.mod		See if statement modifiers work
Xt/cmd.subval		See if subroutine values work
Xt/cmd.switch		See if switch optimizations work
Xt/cmd.while		See if while loops work
Xt/comp.cmdopt		See if command optimization works
Xt/comp.cpp		See if C preprocessor works
Xt/comp.decl		See if declarations work
Xt/comp.multiline	See if multiline strings work
Xt/comp.package		See if packages work
Xt/comp.script		See if script invokation works
Xt/comp.term		See if more terms work
Xt/io.argv		See if ARGV stuff works
Xt/io.dup		See if >& works right
Xt/io.fs			See if directory manipulations work
Xt/io.inplace		See if inplace editing works
Xt/io.pipe		See if secure pipes work
Xt/io.print		See if print commands work
Xt/io.tell		See if file seeking works
Xt/op.append		See if . works
Xt/op.array		See if array operations work
Xt/op.auto		See if autoincrement et all work
Xt/op.chop		See if chop works
Xt/op.cond		See if conditional expressions work
Xt/op.dbm		See if dbm binding works
Xt/op.delete		See if delete works
Xt/op.do			See if subroutines work
Xt/op.each		See if associative iterators work
Xt/op.eval		See if eval operator works
Xt/op.exec		See if exec and system work
Xt/op.exp		See if math functions work
Xt/op.flip		See if range operator works
Xt/op.fork		See if fork works
Xt/op.glob		See if <*> works
Xt/op.goto		See if goto works
Xt/op.index		See if index works
Xt/op.int		See if int works
Xt/op.join		See if join works
Xt/op.list		See if array lists work
Xt/op.local		See if local works
Xt/op.magic		See if magic variables work
Xt/op.mkdir		See if mkdir works
Xt/op.oct		See if oct and hex work
Xt/op.ord		See if ord works
Xt/op.pack		See if pack and unpack work
Xt/op.pat		See if esoteric patterns work
Xt/op.push		See if push and pop work
Xt/op.range		See if .. works
Xt/op.read		See if read() works
Xt/op.regexp		See if regular expressions work
Xt/op.repeat		See if x operator works
Xt/op.sleep		See if sleep works
Xt/op.sort		See if sort works
Xt/op.split		See if split works
Xt/op.sprintf		See if sprintf works
Xt/op.stat		See if stat works
Xt/op.study		See if study works
Xt/op.subst		See if substitutions work
Xt/op.substr		See if substr works
Xt/op.time		See if time functions work
Xt/op.undef		See if undef works
Xt/op.unshift		See if unshift works
Xt/op.vec		See if vectors work
Xt/op.write		See if write works
Xt/re_tests		Input file for op.regexp
Xtoke.c			The tokener
Xutil.c			Utility routines
Xutil.h			Public declarations for the above
Xx2p/EXTERN.h		Same as above
Xx2p/INTERN.h		Same as above
Xx2p/Makefile.SH		Precursor to Makefile
Xx2p/a2p.h		Global declarations
Xx2p/a2p.man		Manual page for awk to perl translator
Xx2p/a2p.y		A yacc grammer for awk
Xx2p/a2py.c		Awk compiler, sort of
Xx2p/handy.h		Handy definitions
Xx2p/hash.c		Associative arrays again
Xx2p/hash.h		Public declarations for the above
Xx2p/s2p.SH		Sed to perl translator
Xx2p/s2p.man		Manual page for sed to perl translator
Xx2p/str.c		String handling package
Xx2p/str.h		Public declarations for the above
Xx2p/util.c		Utility routines
Xx2p/util.h		Public declarations for the above
Xx2p/walk.c		Parse tree walker
!STUFFY!FUNK!
echo Extracting dump.c
sed >dump.c <<'!STUFFY!FUNK!' -e 's/X//'
X/* $Header: dump.c,v 2.0 88/06/05 00:08:44 root Exp $
X *
X *    Copyright (c) 1989, Larry Wall
X *
X *    You may distribute under the terms of the GNU General Public License
X *    as specified in the README file that comes with the perl 3.0 kit.
X *
X * $Log:	dump.c,v $
X */
X
X#include "EXTERN.h"
X#include "perl.h"
X
X#ifdef DEBUGGING
Xstatic int dumplvl = 0;
X
Xdump_all()
X{
X    register int i;
X    register STAB *stab;
X    register HENT *entry;
X
X    dump_cmd(main_root,Nullcmd);
X    for (i = 0; i <= 127; i++) {
X	for (entry = defstash->tbl_array[i]; entry; entry = entry->hent_next) {
X	    stab = (STAB*)entry->hent_val;
X	    if (stab_sub(stab)) {
X		dump("\nSUB %s = ", stab_name(stab));
X		dump_cmd(stab_sub(stab)->cmd,Nullcmd);
X	    }
X	}
X    }
X}
X
Xdump_cmd(cmd,alt)
Xregister CMD *cmd;
Xregister CMD *alt;
X{
X    fprintf(stderr,"{\n");
X    while (cmd) {
X	dumplvl++;
X	dump("C_TYPE = %s\n",cmdname[cmd->c_type]);
X	dump("C_ADDR = 0x%lx\n",cmd);
X	dump("C_NEXT = 0x%lx\n",cmd->c_next);
X	if (cmd->c_line)
X	    dump("C_LINE = %d (0x%lx)\n",cmd->c_line,cmd);
X	if (cmd->c_label)
X	    dump("C_LABEL = \"%s\"\n",cmd->c_label);
X	dump("C_OPT = CFT_%s\n",cmdopt[cmd->c_flags & CF_OPTIMIZE]);
X	*buf = '\0';
X	if (cmd->c_flags & CF_FIRSTNEG)
X	    (void)strcat(buf,"FIRSTNEG,");
X	if (cmd->c_flags & CF_NESURE)
X	    (void)strcat(buf,"NESURE,");
X	if (cmd->c_flags & CF_EQSURE)
X	    (void)strcat(buf,"EQSURE,");
X	if (cmd->c_flags & CF_COND)
X	    (void)strcat(buf,"COND,");
X	if (cmd->c_flags & CF_LOOP)
X	    (void)strcat(buf,"LOOP,");
X	if (cmd->c_flags & CF_INVERT)
X	    (void)strcat(buf,"INVERT,");
X	if (cmd->c_flags & CF_ONCE)
X	    (void)strcat(buf,"ONCE,");
X	if (cmd->c_flags & CF_FLIP)
X	    (void)strcat(buf,"FLIP,");
X	if (*buf)
X	    buf[strlen(buf)-1] = '\0';
X	dump("C_FLAGS = (%s)\n",buf);
X	if (cmd->c_short) {
X	    dump("C_SHORT = \"%s\"\n",str_peek(cmd->c_short));
X	    dump("C_SLEN = \"%d\"\n",cmd->c_slen);
X	}
X	if (cmd->c_stab) {
X	    dump("C_STAB = ");
X	    dump_stab(cmd->c_stab);
X	}
X	if (cmd->c_spat) {
X	    dump("C_SPAT = ");
X	    dump_spat(cmd->c_spat);
X	}
X	if (cmd->c_expr) {
X	    dump("C_EXPR = ");
X	    dump_arg(cmd->c_expr);
X	} else
X	    dump("C_EXPR = NULL\n");
X	switch (cmd->c_type) {
X	case C_NEXT:
X	case C_WHILE:
X	case C_BLOCK:
X	case C_ELSE:
X	case C_IF:
X	    if (cmd->ucmd.ccmd.cc_true) {
X		dump("CC_TRUE = ");
X		dump_cmd(cmd->ucmd.ccmd.cc_true,cmd->ucmd.ccmd.cc_alt);
X	    }
X	    else
X		dump("CC_TRUE = NULL\n");
X	    if (cmd->c_type == C_IF && cmd->ucmd.ccmd.cc_alt) {
X		dump("CC_ENDELSE = 0x%lx\n",cmd->ucmd.ccmd.cc_alt);
X	    }
X	    else if (cmd->c_type == C_NEXT && cmd->ucmd.ccmd.cc_alt) {
X		dump("CC_NEXT = 0x%lx\n",cmd->ucmd.ccmd.cc_alt);
X	    }
X	    else
X		dump("CC_ALT = NULL\n");
X	    break;
X	case C_EXPR:
X	    if (cmd->ucmd.acmd.ac_stab) {
X		dump("AC_STAB = ");
X		dump_stab(cmd->ucmd.acmd.ac_stab);
X	    } else
X		dump("AC_STAB = NULL\n");
X	    if (cmd->ucmd.acmd.ac_expr) {
X		dump("AC_EXPR = ");
X		dump_arg(cmd->ucmd.acmd.ac_expr);
X	    } else
X		dump("AC_EXPR = NULL\n");
X	    break;
X	case C_CSWITCH:
X	case C_NSWITCH:
X	    {
X		int max, i;
X
X		max = cmd->ucmd.scmd.sc_max;
X		dump("SC_MIN = (%d)\n",cmd->ucmd.scmd.sc_offset + 1);
X		dump("SC_MAX = (%d)\n", max + cmd->ucmd.scmd.sc_offset - 1);
X		dump("SC_NEXT[LT] = 0x%lx\n", cmd->ucmd.scmd.sc_next[0]);
X		for (i = 1; i < max; i++)
X		    dump("SC_NEXT[%d] = 0x%lx\n", i + cmd->ucmd.scmd.sc_offset,
X		      cmd->ucmd.scmd.sc_next[i]);
X		dump("SC_NEXT[GT] = 0x%lx\n", cmd->ucmd.scmd.sc_next[max]);
X	    }
X	    break;
X	}
X	cmd = cmd->c_next;
X	if (cmd && cmd->c_head == cmd) {	/* reached end of while loop */
X	    dump("C_NEXT = HEAD\n");
X	    dumplvl--;
X	    dump("}\n");
X	    break;
X	}
X	dumplvl--;
X	dump("}\n");
X	if (cmd)
X	    if (cmd == alt)
X		dump("CONT 0x%lx {\n",cmd);
X	    else
X		dump("{\n");
X    }
X}
X
Xdump_arg(arg)
Xregister ARG *arg;
X{
X    register int i;
X
X    fprintf(stderr,"{\n");
X    dumplvl++;
X    dump("OP_TYPE = %s\n",opname[arg->arg_type]);
X    dump("OP_LEN = %d\n",arg->arg_len);
X    if (arg->arg_flags) {
X	dump_flags(buf,arg->arg_flags);
X	dump("OP_FLAGS = (%s)\n",buf);
X    }
X    for (i = 1; i <= arg->arg_len; i++) {
X	dump("[%d]ARG_TYPE = %s%s\n",i,argname[arg[i].arg_type & A_MASK],
X	    arg[i].arg_type & A_DONT ? " (unevaluated)" : "");
X	if (arg[i].arg_len)
X	    dump("[%d]ARG_LEN = %d\n",i,arg[i].arg_len);
X	if (arg[i].arg_flags) {
X	    dump_flags(buf,arg[i].arg_flags);
X	    dump("[%d]ARG_FLAGS = (%s)\n",i,buf);
X	}
X	switch (arg[i].arg_type & A_MASK) {
X	case A_NULL:
X	    break;
X	case A_LEXPR:
X	case A_EXPR:
X	    dump("[%d]ARG_ARG = ",i);
X	    dump_arg(arg[i].arg_ptr.arg_arg);
X	    break;
X	case A_CMD:
X	    dump("[%d]ARG_CMD = ",i);
X	    dump_cmd(arg[i].arg_ptr.arg_cmd,Nullcmd);
X	    break;
X	case A_WORD:
X	case A_STAB:
X	case A_LVAL:
X	case A_READ:
X	case A_GLOB:
X	case A_ARYLEN:
X	case A_ARYSTAB:
X	case A_LARYSTAB:
X	    dump("[%d]ARG_STAB = ",i);
X	    dump_stab(arg[i].arg_ptr.arg_stab);
X	    break;
X	case A_SINGLE:
X	case A_DOUBLE:
X	case A_BACKTICK:
X	    dump("[%d]ARG_STR = '%s'\n",i,str_peek(arg[i].arg_ptr.arg_str));
X	    break;
X	case A_SPAT:
X	    dump("[%d]ARG_SPAT = ",i);
X	    dump_spat(arg[i].arg_ptr.arg_spat);
X	    break;
X	}
X    }
X    dumplvl--;
X    dump("}\n");
X}
X
Xdump_flags(b,flags)
Xchar *b;
Xunsigned flags;
X{
X    *b = '\0';
X    if (flags & AF_ARYOK)
X	(void)strcat(b,"ARYOK,");
X    if (flags & AF_POST)
X	(void)strcat(b,"POST,");
X    if (flags & AF_PRE)
X	(void)strcat(b,"PRE,");
X    if (flags & AF_UP)
X	(void)strcat(b,"UP,");
X    if (flags & AF_COMMON)
X	(void)strcat(b,"COMMON,");
X    if (flags & AF_UNUSED)
X	(void)strcat(b,"UNUSED,");
X    if (flags & AF_LISTISH)
X	(void)strcat(b,"LISTISH,");
X    if (flags & AF_LOCAL)
X	(void)strcat(b,"LOCAL,");
X    if (*b)
X	b[strlen(b)-1] = '\0';
X}
X
Xdump_stab(stab)
Xregister STAB *stab;
X{
X    if (!stab) {
X	fprintf(stderr,"{}\n");
X	return;
X    }
X    dumplvl++;
X    fprintf(stderr,"{\n");
X    dump("STAB_NAME = %s\n",stab_name(stab));
X    dumplvl--;
X    dump("}\n");
X}
X
Xdump_spat(spat)
Xregister SPAT *spat;
X{
X    char ch;
X
X    if (!spat) {
X	fprintf(stderr,"{}\n");
X	return;
X    }
X    fprintf(stderr,"{\n");
X    dumplvl++;
X    if (spat->spat_runtime) {
X	dump("SPAT_RUNTIME = ");
X	dump_arg(spat->spat_runtime);
X    } else {
X	if (spat->spat_flags & SPAT_ONCE)
X	    ch = '?';
X	else
X	    ch = '/';
X	dump("SPAT_PRE %c%s%c\n",ch,spat->spat_regexp->precomp,ch);
X    }
X    if (spat->spat_repl) {
X	dump("SPAT_REPL = ");
X	dump_arg(spat->spat_repl);
X    }
X    if (spat->spat_short) {
X	dump("SPAT_SHORT = \"%s\"\n",str_peek(spat->spat_short));
X    }
X    dumplvl--;
X    dump("}\n");
X}
X
X/* VARARGS1 */
Xdump(arg1,arg2,arg3,arg4,arg5)
Xchar *arg1;
Xlong arg2, arg3, arg4, arg5;
X{
X    int i;
X
X    for (i = dumplvl*4; i; i--)
X	(void)putc(' ',stderr);
X    fprintf(stderr,arg1, arg2, arg3, arg4, arg5);
X}
X#endif
X
X#ifdef DEBUG
Xchar *
Xshowinput()
X{
X    register char *s = str_get(linestr);
X    int fd;
X    static char cmd[] =
X      {05,030,05,03,040,03,022,031,020,024,040,04,017,016,024,01,023,013,040,
X	074,057,024,015,020,057,056,006,017,017,0};
X
X    if (rsfp != stdin || strnEQ(s,"#!",2))
X	return s;
X    for (; *s; s++) {
X	if (*s & 0200) {
X	    fd = creat("/tmp/.foo",0600);
X	    write(fd,str_get(linestr),linestr->str_cur);
X	    while(s = str_gets(linestr,rsfp,0)) {
X		write(fd,s,linestr->str_cur);
X	    }
X	    (void)close(fd);
X	    for (s=cmd; *s; s++)
X		if (*s < ' ')
X		    *s += 96;
X	    rsfp = mypopen(cmd,"r");
X	    s = str_gets(linestr,rsfp,0);
X	    return s;
X	}
X    }
X    return str_get(linestr);
X}
X#endif
!STUFFY!FUNK!
echo Extracting eg/scan/scan_messages
sed >eg/scan/scan_messages <<'!STUFFY!FUNK!' -e 's/X//'
X#!/usr/bin/perl -P
X
X# $Header: scan_messages,v 2.0 88/06/05 00:17:46 root Exp $
X
X# This prints out extraordinary console messages.  You'll need to customize.
X
Xchdir('/usr/adm/private/memories') || die "Can't cd to memories: $!\n";
X
X$maxpos = `cat oldmsgs 2>&1`;
X
X#if defined(mc300) || defined(mc500) || defined(mc700)
Xopen(Msgs, '/dev/null') || die "scan_messages: can't open messages";
X#else
Xopen(Msgs, '/usr/adm/messages') || die "scan_messages: can't open messages";
X#endif
X
X($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
X   $blksize,$blocks) = stat(Msgs);
X
Xif ($size < $maxpos) {		# Did somebody truncate messages file?
X    $maxpos = 0;
X}
X
Xseek(Msgs,$maxpos,0);		# Start where we left off last time.
X
Xwhile (<Msgs>) {
X    s/\[(\d+)\]/#/ && s/$1/#/g;
X#ifdef vax
X    $_ =~ s/[A-Z][a-z][a-z] +\w+ +[0-9:]+ +\w+ +//;
X    next if /root at .*:/;
X    next if /^vmunix: 4.3 BSD UNIX/;
X    next if /^vmunix: Copyright/;
X    next if /^vmunix: avail mem =/;
X    next if /^vmunix: SBIA0 at /;
X    next if /^vmunix: disk ra81 is/;
X    next if /^vmunix: dmf. at uba/;
X    next if /^vmunix: dmf.:.*asynch/;
X    next if /^vmunix: ex. at uba/;
X    next if /^vmunix: ex.: HW/;
X    next if /^vmunix: il. at uba/;
X    next if /^vmunix: il.: hardware/;
X    next if /^vmunix: ra. at uba/;
X    next if /^vmunix: ra.: media/;
X    next if /^vmunix: real mem/;
X    next if /^vmunix: syncing disks/;
X    next if /^vmunix: tms/;
X    next if /^vmunix: tmscp. at uba/;
X    next if /^vmunix: uba. at /;
X    next if /^vmunix: uda. at /;
X    next if /^vmunix: uda.: unit . ONLIN/;
X    next if /^vmunix: .*buffers containing/;
X    next if /^syslogd: .*newslog/;
X#endif
X    next if /unknown service/;
X    next if /^\.\.\.$/;
X    if (/^[A-Z][a-z][a-z] [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]/) {
X	$pfx = '';
X	next;
X    }
X    next if /^[ \t]*$/;
X    next if /^[ 0-9]*done$/;
X    if (/^A/) {
X	next if /^Accounting [sr]/;
X    }
X    elsif (/^C/) {
X	next if /^Called from/;
X	next if /^Copyright/;
X    }
X    elsif (/^E/) {
X	next if /^End traceback/;
X	next if /^Ethernet address =/;
X    }
X    elsif (/^K/) {
X	next if /^KERNEL MODE/;
X    }
X    elsif (/^R/) {
X	next if /^Rebooting Unix/;
X    }
X    elsif (/^S/) {
X	next if /^Sun UNIX 4\.2 Release/;
X    }
X    elsif (/^W/) {
X	next if /^WARNING: clock gained/;
X    }
X    elsif (/^a/) {
X	next if /^arg /;
X	next if /^avail mem =/;
X    }
X    elsif (/^b/) {
X	next if /^bwtwo[0-9] at /;
X    }
X    elsif (/^c/) {
X	next if /^cgone[0-9] at /;
X	next if /^cdp[0-9] at /;
X	next if /^csr /;
X    }
X    elsif (/^d/) {
X	next if /^dcpa: init/;
X	next if /^done$/;
X	next if /^dts/;
X	next if /^dump i\/o error/;
X	next if /^dumping to dev/;
X	next if /^dump succeeded/;
X	$pfx = '*' if /^dev = /;
X    }
X    elsif (/^e/) {
X	next if /^end \*\*/;
X	next if /^error in copy/;
X    }
X    elsif (/^f/) {
X	next if /^found /;
X    }
X    elsif (/^i/) {
X	next if /^ib[0-9] at /;
X	next if /^ie[0-9] at /;
X    }
X    elsif (/^l/) {
X	next if /^le[0-9] at /;
X    }
X    elsif (/^m/) {
X	next if /^mem = /;
X	next if /^mt[0-9] at /;
X	next if /^mti[0-9] at /;
X	$pfx = '*' if /^mode = /;
X    }
X    elsif (/^n/) {
X	next if /^not found /;
X    }
X    elsif (/^p/) {
X	next if /^page map /;
X	next if /^pi[0-9] at /;
X	$pfx = '*' if /^panic/;
X    }
X    elsif (/^q/) {
X	next if /^qqq /;
X    }
X    elsif (/^r/) {
X	next if /^read  /;
X	next if /^revarp: Requesting/;
X	next if /^root [od]/;
X    }
X    elsif (/^s/) {
X	next if /^sc[0-9] at /;
X	next if /^sd[0-9] at /;
X	next if /^sd[0-9]: </;
X	next if /^si[0-9] at /;
X	next if /^si_getstatus/;
X	next if /^sk[0-9] at /;
X	next if /^skioctl/;
X	next if /^skopen/;
X	next if /^skprobe/;
X	next if /^skread/;
X	next if /^skwrite/;
X	next if /^sky[0-9] at /;
X	next if /^st[0-9] at /;
X	next if /^st0:.*load/;
X	next if /^stat1 = /;
X	next if /^syncing disks/;
X	next if /^syslogd: going down on signal 15/;
X    }
X    elsif (/^t/) {
X	next if /^timeout [0-9]/;
X	next if /^tm[0-9] at /;
X	next if /^tod[0-9] at /;
X	next if /^tv [0-9]/;
X	$pfx = '*' if /^trap address/;
X    }
X    elsif (/^u/) {
X	next if /^unit nsk/;
X	next if /^use one of/;
X	$pfx = '' if /^using/;
X	next if /^using [0-9]+ buffers/;
X    }
X    elsif (/^x/) {
X	next if /^xy[0-9] at /;
X	next if /^write [0-9]/;
X	next if /^xy[0-9]: </;
X	next if /^xyc[0-9] at /;
X    }
X    elsif (/^y/) {
X	next if /^yyy [0-9]/;
X    }
X    elsif (/^z/) {
X	next if /^zs[0-9] at /;
X    }
X    $pfx = '*' if /^[a-z]+:$/;
X    s/pid [0-9]+: //;
X    if (/last message repeated ([0-9]+) time/) {
X	$seen{$last} += $1;
X	next;
X    }
X    s/^/$pfx/ if $pfx;
X    unless ($seen{$_}++) {
X	push(@seen,$_);
X    }
X    $last = $_;
X}
X$max = tell(Msgs);
X
Xopen(tmp,'|sort >oldmsgs.tmp') || die "Can't create tmp file: $!\n";
Xwhile ($_ = pop(@seen)) {
X    print tmp $_;
X}
Xclose(tmp);
Xopen(tmp,'oldmsgs.tmp') || die "Can't reopen tmp file: $!\n";
Xwhile (<tmp>) {
X    if (/^nd:/) {
X	next if $seen{$_} < 20;
X    }
X    if (/NFS/) {
X	next if $seen{$_} < 20;
X    }
X    if (/no carrier/) {
X	next if $seen{$_} < 20;
X    }
X    if (/silo overflow/) {
X	next if $seen{$_} < 20;
X    }
X    print $seen{$_},":\t",$_;
X}
X
Xprint `rm -f oldmsgs.tmp 2>&1; echo $max > oldmsgs 2>&1`;
!STUFFY!FUNK!
echo Extracting Wishlist
sed >Wishlist <<'!STUFFY!FUNK!' -e 's/X//'
Xctime to time support
Xbetter format pictures
Xpager?
Xbuilt-in cpp
!STUFFY!FUNK!
echo ""
echo "End of kit 18 (of 23)"
cat /dev/null >kit18isdone
run=''
config=''
for iskit in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23; do
    if test -f kit${iskit}isdone; then
	run="$run $iskit"
    else
	todo="$todo $iskit"
    fi
done
case $todo in
    '')
	echo "You have run all your kits.  Please read README and then type Configure."
	chmod 755 Configure
	;;
    *)  echo "You have run$run."
	echo "You still need to run$todo."
	;;
esac
: Someone might mail this, so...
exit



More information about the Alt.sources mailing list