lwall@netlabs.com (Larry Wall) (04/17/91)
Submitted-by: Larry Wall <lwall@netlabs.com> Posting-number: Volume 18, Issue 35 Archive-name: perl/part17 [There are 36 kits for perl version 4.0.] #! /bin/sh # Make a new directory for the perl sources, cd to it, and run kits 1 # thru 36 through sh. When all 36 kits have been run, read README. echo "This is perl 4.0 kit 17 (of 36). If kit 17 is complete, the line" echo '"'"End of kit 17 (of 36)"'" will echo at the end.' echo "" export PATH || (echo "You didn't use sh, you clunch." ; kill $$) mkdir lib 2>/dev/null echo Extracting util.c sed >util.c <<'!STUFFY!FUNK!' -e 's/X//' X/* $RCSfile: util.c,v $$Revision: 4.0.1.1 $$Date: 91/04/12 09:19:25 $ 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: util.c,v $ X * Revision 4.0.1.1 91/04/12 09:19:25 lwall X * patch1: random cleanup in cpp namespace X * X * Revision 4.0 91/03/20 01:56:39 lwall X * 4.0 baseline. X * X */ X X#include "EXTERN.h" X#include "perl.h" X X#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX) X#include <signal.h> X#endif X X#ifdef I_VFORK X# include <vfork.h> X#endif X X#ifdef I_VARARGS X# include <varargs.h> X#endif X X#ifdef I_FCNTL X# include <fcntl.h> X#endif X#ifdef I_SYS_FILE X# include <sys/file.h> X#endif X X#define FLUSH X Xstatic char nomem[] = "Out of memory!\n"; X X/* paranoid version of malloc */ X X#ifdef DEBUGGING Xstatic int an = 0; X#endif X X/* NOTE: Do not call the next three routines directly. Use the macros X * in handy.h, so that we can easily redefine everything to do tracking of X * allocated hunks back to the original New to track down any memory leaks. X */ X Xchar * Xsafemalloc(size) X#ifdef MSDOS Xunsigned long size; X#else XMEM_SIZE size; X#endif /* MSDOS */ X{ X char *ptr; X#ifndef __STDC__ X char *malloc(); X#endif /* ! __STDC__ */ X X#ifdef MSDOS X if (size > 0xffff) { X fprintf(stderr, "Allocation too large: %lx\n", size) FLUSH; X exit(1); X } X#endif /* MSDOS */ X#ifdef DEBUGGING X if ((long)size < 0) X fatal("panic: malloc"); X#endif X ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */ X#ifdef DEBUGGING X# ifndef I286 X if (debug & 128) X fprintf(stderr,"0x%x: (%05d) malloc %d bytes\n",ptr,an++,size); X# else X if (debug & 128) X fprintf(stderr,"0x%lx: (%05d) malloc %d bytes\n",ptr,an++,size); X# endif X#endif X if (ptr != Nullch) X return ptr; X else { X fputs(nomem,stderr) FLUSH; X exit(1); X } X /*NOTREACHED*/ X#ifdef lint X return ptr; X#endif X} X X/* paranoid version of realloc */ X Xchar * Xsaferealloc(where,size) Xchar *where; X#ifndef MSDOS XMEM_SIZE size; X#else Xunsigned long size; X#endif /* MSDOS */ X{ X char *ptr; X#ifndef __STDC__ X char *realloc(); X#endif /* ! __STDC__ */ X X#ifdef MSDOS X if (size > 0xffff) { X fprintf(stderr, "Reallocation too large: %lx\n", size) FLUSH; X exit(1); X } X#endif /* MSDOS */ X if (!where) X fatal("Null realloc"); X#ifdef DEBUGGING X if ((long)size < 0) X fatal("panic: realloc"); X#endif X ptr = realloc(where,size?size:1); /* realloc(0) is NASTY on our system */ X#ifdef DEBUGGING X# ifndef I286 X if (debug & 128) { X fprintf(stderr,"0x%x: (%05d) rfree\n",where,an++); X fprintf(stderr,"0x%x: (%05d) realloc %d bytes\n",ptr,an++,size); X } X# else X if (debug & 128) { X fprintf(stderr,"0x%lx: (%05d) rfree\n",where,an++); X fprintf(stderr,"0x%lx: (%05d) realloc %d bytes\n",ptr,an++,size); X } X# endif X#endif X if (ptr != Nullch) X return ptr; X else { X fputs(nomem,stderr) FLUSH; X exit(1); X } X /*NOTREACHED*/ X#ifdef lint X return ptr; X#endif X} X X/* safe version of free */ X Xvoid Xsafefree(where) Xchar *where; X{ X#ifdef DEBUGGING X# ifndef I286 X if (debug & 128) X fprintf(stderr,"0x%x: (%05d) free\n",where,an++); X# else X if (debug & 128) X fprintf(stderr,"0x%lx: (%05d) free\n",where,an++); X# endif X#endif X if (where) { X free(where); X } X} X X#ifdef LEAKTEST X X#define ALIGN sizeof(long) X Xchar * Xsafexmalloc(x,size) Xint x; XMEM_SIZE size; X{ X register char *where; X X where = safemalloc(size + ALIGN); X xcount[x]++; X where[0] = x % 100; X where[1] = x / 100; X return where + ALIGN; X} X Xchar * Xsafexrealloc(where,size) Xchar *where; XMEM_SIZE size; X{ X return saferealloc(where - ALIGN, size + ALIGN) + ALIGN; X} X Xvoid Xsafexfree(where) Xchar *where; X{ X int x; X X if (!where) X return; X where -= ALIGN; X x = where[0] + 100 * where[1]; X xcount[x]--; X safefree(where); X} X Xxstat() X{ X register int i; X X for (i = 0; i < MAXXCOUNT; i++) { X if (xcount[i] != lastxcount[i]) { X fprintf(stderr,"%2d %2d\t%ld\n", i / 100, i % 100, xcount[i]); X lastxcount[i] = xcount[i]; X } X } X} X X#endif /* LEAKTEST */ X X/* copy a string up to some (non-backslashed) delimiter, if any */ X Xchar * Xcpytill(to,from,fromend,delim,retlen) Xregister char *to; Xregister char *from; Xregister char *fromend; Xregister int delim; Xint *retlen; X{ X char *origto = to; X X for (; from < fromend; from++,to++) { X if (*from == '\\') { X if (from[1] == delim) X from++; X else if (from[1] == '\\') X *to++ = *from++; X } X else if (*from == delim) X break; X *to = *from; X } X *to = '\0'; X *retlen = to - origto; X return from; X} X X/* return ptr to little string in big string, NULL if not found */ X/* This routine was donated by Corey Satten. */ X Xchar * Xinstr(big, little) Xregister char *big; Xregister char *little; X{ X register char *s, *x; X register int first; X X if (!little) X return big; X first = *little++; X if (!first) X return big; X while (*big) { X if (*big++ != first) X continue; X for (x=big,s=little; *s; /**/ ) { X if (!*x) X return Nullch; X if (*s++ != *x++) { X s--; X break; X } X } X if (!*s) X return big-1; X } X return Nullch; X} X X/* same as instr but allow embedded nulls */ X Xchar * Xninstr(big, bigend, little, lend) Xregister char *big; Xregister char *bigend; Xchar *little; Xchar *lend; X{ X register char *s, *x; X register int first = *little; X register char *littleend = lend; X X if (!first && little > littleend) X return big; X bigend -= littleend - little++; X while (big <= bigend) { X if (*big++ != first) X continue; X for (x=big,s=little; s < littleend; /**/ ) { X if (*s++ != *x++) { X s--; X break; X } X } X if (s >= littleend) X return big-1; X } X return Nullch; X} X X/* reverse of the above--find last substring */ X Xchar * Xrninstr(big, bigend, little, lend) Xregister char *big; Xchar *bigend; Xchar *little; Xchar *lend; X{ X register char *bigbeg; X register char *s, *x; X register int first = *little; X register char *littleend = lend; X X if (!first && little > littleend) X return bigend; X bigbeg = big; X big = bigend - (littleend - little++); X while (big >= bigbeg) { X if (*big-- != first) X continue; X for (x=big+2,s=little; s < littleend; /**/ ) { X if (*s++ != *x++) { X s--; X break; X } X } X if (s >= littleend) X return big+1; X } X return Nullch; X} X Xunsigned char fold[] = { X 0, 1, 2, 3, 4, 5, 6, 7, X 8, 9, 10, 11, 12, 13, 14, 15, X 16, 17, 18, 19, 20, 21, 22, 23, X 24, 25, 26, 27, 28, 29, 30, 31, X 32, 33, 34, 35, 36, 37, 38, 39, X 40, 41, 42, 43, 44, 45, 46, 47, X 48, 49, 50, 51, 52, 53, 54, 55, X 56, 57, 58, 59, 60, 61, 62, 63, X 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g', X 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', X 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', X 'x', 'y', 'z', 91, 92, 93, 94, 95, X 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G', X 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', X 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', X 'X', 'Y', 'Z', 123, 124, 125, 126, 127, X 128, 129, 130, 131, 132, 133, 134, 135, X 136, 137, 138, 139, 140, 141, 142, 143, X 144, 145, 146, 147, 148, 149, 150, 151, X 152, 153, 154, 155, 156, 157, 158, 159, X 160, 161, 162, 163, 164, 165, 166, 167, X 168, 169, 170, 171, 172, 173, 174, 175, X 176, 177, 178, 179, 180, 181, 182, 183, X 184, 185, 186, 187, 188, 189, 190, 191, X 192, 193, 194, 195, 196, 197, 198, 199, X 200, 201, 202, 203, 204, 205, 206, 207, X 208, 209, 210, 211, 212, 213, 214, 215, X 216, 217, 218, 219, 220, 221, 222, 223, X 224, 225, 226, 227, 228, 229, 230, 231, X 232, 233, 234, 235, 236, 237, 238, 239, X 240, 241, 242, 243, 244, 245, 246, 247, X 248, 249, 250, 251, 252, 253, 254, 255 X}; X Xstatic unsigned char freq[] = { X 1, 2, 84, 151, 154, 155, 156, 157, X 165, 246, 250, 3, 158, 7, 18, 29, X 40, 51, 62, 73, 85, 96, 107, 118, X 129, 140, 147, 148, 149, 150, 152, 153, X 255, 182, 224, 205, 174, 176, 180, 217, X 233, 232, 236, 187, 235, 228, 234, 226, X 222, 219, 211, 195, 188, 193, 185, 184, X 191, 183, 201, 229, 181, 220, 194, 162, X 163, 208, 186, 202, 200, 218, 198, 179, X 178, 214, 166, 170, 207, 199, 209, 206, X 204, 160, 212, 216, 215, 192, 175, 173, X 243, 172, 161, 190, 203, 189, 164, 230, X 167, 248, 227, 244, 242, 255, 241, 231, X 240, 253, 169, 210, 245, 237, 249, 247, X 239, 168, 252, 251, 254, 238, 223, 221, X 213, 225, 177, 197, 171, 196, 159, 4, X 5, 6, 8, 9, 10, 11, 12, 13, X 14, 15, 16, 17, 19, 20, 21, 22, X 23, 24, 25, 26, 27, 28, 30, 31, X 32, 33, 34, 35, 36, 37, 38, 39, X 41, 42, 43, 44, 45, 46, 47, 48, X 49, 50, 52, 53, 54, 55, 56, 57, X 58, 59, 60, 61, 63, 64, 65, 66, X 67, 68, 69, 70, 71, 72, 74, 75, X 76, 77, 78, 79, 80, 81, 82, 83, X 86, 87, 88, 89, 90, 91, 92, 93, X 94, 95, 97, 98, 99, 100, 101, 102, X 103, 104, 105, 106, 108, 109, 110, 111, X 112, 113, 114, 115, 116, 117, 119, 120, X 121, 122, 123, 124, 125, 126, 127, 128, X 130, 131, 132, 133, 134, 135, 136, 137, X 138, 139, 141, 142, 143, 144, 145, 146 X}; X Xvoid Xfbmcompile(str, iflag) XSTR *str; Xint iflag; X{ X register unsigned char *s; X register unsigned char *table; X register int i; X register int len = str->str_cur; X int rarest = 0; X unsigned int frequency = 256; X X Str_Grow(str,len+258); X#ifndef lint X table = (unsigned char*)(str->str_ptr + len + 1); X#else X table = Null(unsigned char*); X#endif X s = table - 2; X for (i = 0; i < 256; i++) { X table[i] = len; X } X i = 0; X#ifndef lint X while (s >= (unsigned char*)(str->str_ptr)) X#endif X { X if (table[*s] == len) { X#ifndef pdp11 X if (iflag) X table[*s] = table[fold[*s]] = i; X#else X if (iflag) { X int j; X j = fold[*s]; X table[j] = i; X table[*s] = i; X } X#endif /* pdp11 */ X else X table[*s] = i; X } X s--,i++; X } X str->str_pok |= SP_FBM; /* deep magic */ X X#ifndef lint X s = (unsigned char*)(str->str_ptr); /* deeper magic */ X#else X s = Null(unsigned char*); X#endif X if (iflag) { X register unsigned int tmp, foldtmp; X str->str_pok |= SP_CASEFOLD; X for (i = 0; i < len; i++) { X tmp=freq[s[i]]; X foldtmp=freq[fold[s[i]]]; X if (tmp < frequency && foldtmp < frequency) { X rarest = i; X /* choose most frequent among the two */ X frequency = (tmp > foldtmp) ? tmp : foldtmp; X } X } X } X else { X for (i = 0; i < len; i++) { X if (freq[s[i]] < frequency) { X rarest = i; X frequency = freq[s[i]]; X } X } X } X str->str_rare = s[rarest]; X str->str_state = rarest; X#ifdef DEBUGGING X if (debug & 512) X fprintf(stderr,"rarest char %c at %d\n",str->str_rare, str->str_state); X#endif X} X Xchar * Xfbminstr(big, bigend, littlestr) Xunsigned char *big; Xregister unsigned char *bigend; XSTR *littlestr; X{ X register unsigned char *s; X register int tmp; X register int littlelen; X register unsigned char *little; X register unsigned char *table; X register unsigned char *olds; X register unsigned char *oldlittle; X X#ifndef lint X if (!(littlestr->str_pok & SP_FBM)) X return ninstr((char*)big,(char*)bigend, X littlestr->str_ptr, littlestr->str_ptr + littlestr->str_cur); X#endif X X littlelen = littlestr->str_cur; X#ifndef lint X if (littlestr->str_pok & SP_TAIL && !multiline) { /* tail anchored? */ X if (littlelen > bigend - big) X return Nullch; X little = (unsigned char*)littlestr->str_ptr; X if (littlestr->str_pok & SP_CASEFOLD) { /* oops, fake it */ X big = bigend - littlelen; /* just start near end */ X if (bigend[-1] == '\n' && little[littlelen-1] != '\n') X big--; X } X else { X s = bigend - littlelen; X if (*s == *little && bcmp(s,little,littlelen)==0) X return (char*)s; /* how sweet it is */ X else if (bigend[-1] == '\n' && little[littlelen-1] != '\n' X && s > big) { X s--; X if (*s == *little && bcmp(s,little,littlelen)==0) X return (char*)s; X } X return Nullch; X } X } X table = (unsigned char*)(littlestr->str_ptr + littlelen + 1); X#else X table = Null(unsigned char*); X#endif X if (--littlelen >= bigend - big) X return Nullch; X s = big + littlelen; X oldlittle = little = table - 2; X if (littlestr->str_pok & SP_CASEFOLD) { /* case insensitive? */ X if (s < bigend) { X top1: X if (tmp = table[*s]) { X#ifdef POINTERRIGOR X if (bigend - s > tmp) { X s += tmp; X goto top1; X } X#else X if ((s += tmp) < bigend) X goto top1; X#endif X return Nullch; X } X else { X tmp = littlelen; /* less expensive than calling strncmp() */ X olds = s; X while (tmp--) { X if (*--s == *--little || fold[*s] == *little) X continue; X s = olds + 1; /* here we pay the price for failure */ X little = oldlittle; X if (s < bigend) /* fake up continue to outer loop */ X goto top1; X return Nullch; X } X#ifndef lint X return (char *)s; X#endif X } X } X } X else { X if (s < bigend) { X top2: X if (tmp = table[*s]) { X#ifdef POINTERRIGOR X if (bigend - s > tmp) { X s += tmp; X goto top2; X } X#else X if ((s += tmp) < bigend) X goto top2; X#endif X return Nullch; X } X else { X tmp = littlelen; /* less expensive than calling strncmp() */ X olds = s; X while (tmp--) { X if (*--s == *--little) X continue; X s = olds + 1; /* here we pay the price for failure */ X little = oldlittle; X if (s < bigend) /* fake up continue to outer loop */ X goto top2; X return Nullch; X } X#ifndef lint X return (char *)s; X#endif X } X } X } X return Nullch; X} X Xchar * Xscreaminstr(bigstr, littlestr) XSTR *bigstr; XSTR *littlestr; X{ X register unsigned char *s, *x; X register unsigned char *big; X register int pos; X register int previous; X register int first; X register unsigned char *little; X register unsigned char *bigend; X register unsigned char *littleend; X X if ((pos = screamfirst[littlestr->str_rare]) < 0) X return Nullch; X#ifndef lint X little = (unsigned char *)(littlestr->str_ptr); X#else X little = Null(unsigned char *); X#endif X littleend = little + littlestr->str_cur; X first = *little++; X previous = littlestr->str_state; X#ifndef lint X big = (unsigned char *)(bigstr->str_ptr); X#else X big = Null(unsigned char*); X#endif X bigend = big + bigstr->str_cur; X big -= previous; X while (pos < previous) { X#ifndef lint X if (!(pos += screamnext[pos])) X#endif X return Nullch; X } X if (littlestr->str_pok & SP_CASEFOLD) { /* case insignificant? */ X do { X if (big[pos] != first && big[pos] != fold[first]) X continue; X for (x=big+pos+1,s=little; s < littleend; /**/ ) { X if (x >= bigend) X return Nullch; X if (*s++ != *x++ && fold[*(s-1)] != *(x-1)) { X s--; X break; X } X } X if (s == littleend) X#ifndef lint X return (char *)(big+pos); X#else X return Nullch; X#endif X } while ( X#ifndef lint X pos += screamnext[pos] /* does this goof up anywhere? */ X#else X pos += screamnext[0] X#endif X ); X } X else { X do { X if (big[pos] != first) X continue; X for (x=big+pos+1,s=little; s < littleend; /**/ ) { X if (x >= bigend) X return Nullch; X if (*s++ != *x++) { X s--; X break; X } X } X if (s == littleend) X#ifndef lint X return (char *)(big+pos); X#else X return Nullch; X#endif X } while ( X#ifndef lint X pos += screamnext[pos] X#else X pos += screamnext[0] X#endif X ); X } X return Nullch; X} X X/* copy a string to a safe spot */ X Xchar * Xsavestr(str) Xchar *str; X{ X register char *newaddr; X X New(902,newaddr,strlen(str)+1,char); X (void)strcpy(newaddr,str); X return newaddr; X} X X/* same thing but with a known length */ X Xchar * Xnsavestr(str, len) Xchar *str; Xregister int len; X{ X register char *newaddr; X X New(903,newaddr,len+1,char); X (void)bcopy(str,newaddr,len); /* might not be null terminated */ X newaddr[len] = '\0'; /* is now */ X return newaddr; X} X X/* grow a static string to at least a certain length */ X Xvoid Xgrowstr(strptr,curlen,newlen) Xchar **strptr; Xint *curlen; Xint newlen; X{ X if (newlen > *curlen) { /* need more room? */ X if (*curlen) X Renew(*strptr,newlen,char); X else X New(905,*strptr,newlen,char); X *curlen = newlen; X } X} X X#ifndef I_VARARGS X/*VARARGS1*/ Xmess(pat,a1,a2,a3,a4) Xchar *pat; Xlong a1, a2, a3, a4; X{ X char *s; X X s = buf; X (void)sprintf(s,pat,a1,a2,a3,a4); X s += strlen(s); X if (s[-1] != '\n') { X if (curcmd->c_line) { X (void)sprintf(s," at %s line %ld", X stab_val(curcmd->c_filestab)->str_ptr, (long)curcmd->c_line); X s += strlen(s); X } X if (last_in_stab && X stab_io(last_in_stab) && X stab_io(last_in_stab)->lines ) { X (void)sprintf(s,", <%s> line %ld", X last_in_stab == argvstab ? "" : stab_name(last_in_stab), X (long)stab_io(last_in_stab)->lines); X s += strlen(s); X } X (void)strcpy(s,".\n"); X } X} X X/*VARARGS1*/ Xfatal(pat,a1,a2,a3,a4) Xchar *pat; Xlong a1, a2, a3, a4; X{ X extern FILE *e_fp; X extern char *e_tmpname; X char *tmps; X X mess(pat,a1,a2,a3,a4); X if (in_eval) { X str_set(stab_val(stabent("@",TRUE)),buf); X tmps = "_EVAL_"; X while (loop_ptr >= 0 && (!loop_stack[loop_ptr].loop_label || X strNE(tmps,loop_stack[loop_ptr].loop_label) )) { X#ifdef DEBUGGING X if (debug & 4) { X deb("(Skipping label #%d %s)\n",loop_ptr, X loop_stack[loop_ptr].loop_label); X } X#endif X loop_ptr--; X } X#ifdef DEBUGGING X if (debug & 4) { X deb("(Found label #%d %s)\n",loop_ptr, X loop_stack[loop_ptr].loop_label); X } X#endif X if (loop_ptr < 0) { X in_eval = 0; X fatal("Bad label: %s", tmps); X } X longjmp(loop_stack[loop_ptr].loop_env, 1); X } X fputs(buf,stderr); X (void)fflush(stderr); X if (e_fp) X (void)UNLINK(e_tmpname); X statusvalue >>= 8; X exit((int)((errno&255)?errno:((statusvalue&255)?statusvalue:255))); X} X X/*VARARGS1*/ Xwarn(pat,a1,a2,a3,a4) Xchar *pat; Xlong a1, a2, a3, a4; X{ X mess(pat,a1,a2,a3,a4); X fputs(buf,stderr); X#ifdef LEAKTEST X#ifdef DEBUGGING X if (debug & 4096) X xstat(); X#endif X#endif X (void)fflush(stderr); X} X#else X/*VARARGS0*/ Xmess(args) Xva_list args; X{ X char *pat; X char *s; X#ifdef CHARVSPRINTF X char *vsprintf(); X#else X int vsprintf(); X#endif X X s = buf; X#ifdef lint X pat = Nullch; X#else X pat = va_arg(args, char *); X#endif X (void) vsprintf(s,pat,args); X X s += strlen(s); X if (s[-1] != '\n') { X if (curcmd->c_line) { X (void)sprintf(s," at %s line %ld", X stab_val(curcmd->c_filestab)->str_ptr, (long)curcmd->c_line); X s += strlen(s); X } X if (last_in_stab && X stab_io(last_in_stab) && X stab_io(last_in_stab)->lines ) { X (void)sprintf(s,", <%s> line %ld", X last_in_stab == argvstab ? "" : last_in_stab->str_magic->str_ptr, X (long)stab_io(last_in_stab)->lines); X s += strlen(s); X } X (void)strcpy(s,".\n"); X } X} X X/*VARARGS0*/ Xfatal(va_alist) Xva_dcl X{ X va_list args; X extern FILE *e_fp; X extern char *e_tmpname; X char *tmps; X X#ifndef lint X va_start(args); X#else X args = 0; X#endif X mess(args); X va_end(args); X if (in_eval) { X str_set(stab_val(stabent("@",TRUE)),buf); X tmps = "_EVAL_"; X while (loop_ptr >= 0 && (!loop_stack[loop_ptr].loop_label || X strNE(tmps,loop_stack[loop_ptr].loop_label) )) { X#ifdef DEBUGGING X if (debug & 4) { X deb("(Skipping label #%d %s)\n",loop_ptr, X loop_stack[loop_ptr].loop_label); X } X#endif X loop_ptr--; X } X#ifdef DEBUGGING X if (debug & 4) { X deb("(Found label #%d %s)\n",loop_ptr, X loop_stack[loop_ptr].loop_label); X } X#endif X if (loop_ptr < 0) { X in_eval = 0; X fatal("Bad label: %s", tmps); X } X longjmp(loop_stack[loop_ptr].loop_env, 1); X } X fputs(buf,stderr); X (void)fflush(stderr); X if (e_fp) X (void)UNLINK(e_tmpname); X statusvalue >>= 8; X exit((int)((errno&255)?errno:((statusvalue&255)?statusvalue:255))); X} X X/*VARARGS0*/ Xwarn(va_alist) Xva_dcl X{ X va_list args; X X#ifndef lint X va_start(args); X#else X args = 0; X#endif X mess(args); X va_end(args); X X fputs(buf,stderr); X#ifdef LEAKTEST X#ifdef DEBUGGING X if (debug & 4096) X xstat(); X#endif X#endif X (void)fflush(stderr); X} X#endif X Xvoid Xsetenv(nam,val) Xchar *nam, *val; X{ X register int i=envix(nam); /* where does it go? */ X X if (environ == origenviron) { /* need we copy environment? */ X int j; X int max; X char **tmpenv; X X for (max = i; environ[max]; max++) ; X New(901,tmpenv, max+2, char*); X for (j=0; j<max; j++) /* copy environment */ X tmpenv[j] = savestr(environ[j]); X tmpenv[max] = Nullch; X environ = tmpenv; /* tell exec where it is now */ X } X if (!val) { X while (environ[i]) { X environ[i] = environ[i+1]; X i++; X } X return; X } X if (!environ[i]) { /* does not exist yet */ X Renew(environ, i+2, char*); /* just expand it a bit */ X environ[i+1] = Nullch; /* make sure it's null terminated */ X } X else X Safefree(environ[i]); X New(904, environ[i], strlen(nam) + strlen(val) + 2, char); X#ifndef MSDOS X (void)sprintf(environ[i],"%s=%s",nam,val);/* all that work just for this */ X#else X /* MS-DOS requires environment variable names to be in uppercase */ X /* [Tom Dinger, 27 August 1990: Well, it doesn't _require_ it, but X * some utilities and applications may break because they only look X * for upper case strings. (Fixed strupr() bug here.)] X */ X strcpy(environ[i],nam); strupr(environ[i]); X (void)sprintf(environ[i] + strlen(nam),"=%s",val); X#endif /* MSDOS */ X} X Xint Xenvix(nam) Xchar *nam; X{ X register int i, len = strlen(nam); X X for (i = 0; environ[i]; i++) { X if (strnEQ(environ[i],nam,len) && environ[i][len] == '=') X break; /* strnEQ must come first to avoid */ X } /* potential SEGV's */ X return i; X} X X#ifdef EUNICE Xunlnk(f) /* unlink all versions of a file */ Xchar *f; X{ X int i; X X for (i = 0; unlink(f) >= 0; i++) ; X return i ? 0 : -1; X} X#endif X X#ifndef HAS_MEMCPY X#ifndef HAS_BCOPY Xchar * Xbcopy(from,to,len) Xregister char *from; Xregister char *to; Xregister int len; X{ X char *retval = to; X X while (len--) X *to++ = *from++; X return retval; X} X#endif X X#ifndef HAS_BZERO Xchar * Xbzero(loc,len) Xregister char *loc; Xregister int len; X{ X char *retval = loc; X X while (len--) X *loc++ = 0; X return retval; X} X#endif X#endif X X#ifdef I_VARARGS X#ifndef HAS_VPRINTF X X#ifdef CHARVSPRINTF Xchar * X#else Xint X#endif Xvsprintf(dest, pat, args) Xchar *dest, *pat, *args; X{ X FILE fakebuf; X X fakebuf._ptr = dest; X fakebuf._cnt = 32767; X#ifndef _IOSTRG X#define _IOSTRG 0 X#endif X fakebuf._flag = _IOWRT|_IOSTRG; X _doprnt(pat, args, &fakebuf); /* what a kludge */ X (void)putc('\0', &fakebuf); X#ifdef CHARVSPRINTF X return(dest); X#else X return 0; /* perl doesn't use return value */ X#endif X} X X#ifdef DEBUGGING Xint Xvfprintf(fd, pat, args) XFILE *fd; Xchar *pat, *args; X{ X _doprnt(pat, args, fd); X return 0; /* wrong, but perl doesn't use the return value */ X} X#endif X#endif /* HAS_VPRINTF */ X#endif /* I_VARARGS */ X X#ifdef MYSWAP X#if BYTEORDER != 0x4321 Xshort Xmy_swap(s) Xshort s; X{ X#if (BYTEORDER & 1) == 0 X short result; X X result = ((s & 255) << 8) + ((s >> 8) & 255); X return result; X#else X return s; X#endif X} X Xlong Xhtonl(l) Xregister long l; X{ X union { X long result; X char c[sizeof(long)]; X } u; X X#if BYTEORDER == 0x1234 X u.c[0] = (l >> 24) & 255; X u.c[1] = (l >> 16) & 255; X u.c[2] = (l >> 8) & 255; X u.c[3] = l & 255; X return u.result; X#else X#if ((BYTEORDER - 0x1111) & 0x444) || !(BYTEORDER & 0xf) X fatal("Unknown BYTEORDER\n"); X#else X register int o; X register int s; X X for (o = BYTEORDER - 0x1111, s = 0; s < (sizeof(long)*8); o >>= 4, s += 8) { X u.c[o & 0xf] = (l >> s) & 255; X } X return u.result; X#endif X#endif X} X Xlong Xntohl(l) Xregister long l; X{ X union { X long l; X char c[sizeof(long)]; X } u; X X#if BYTEORDER == 0x1234 X u.c[0] = (l >> 24) & 255; X u.c[1] = (l >> 16) & 255; X u.c[2] = (l >> 8) & 255; X u.c[3] = l & 255; X return u.l; X#else X#if ((BYTEORDER - 0x1111) & 0x444) || !(BYTEORDER & 0xf) X fatal("Unknown BYTEORDER\n"); X#else X register int o; X register int s; X X u.l = l; X l = 0; X for (o = BYTEORDER - 0x1111, s = 0; s < (sizeof(long)*8); o >>= 4, s += 8) { X l |= (u.c[o & 0xf] & 255) << s; X } X return l; X#endif X#endif X} X X#endif /* BYTEORDER != 0x4321 */ X#endif /* HAS_HTONS */ X X#ifndef MSDOS XFILE * Xmypopen(cmd,mode) Xchar *cmd; Xchar *mode; X{ X int p[2]; X register int this, that; X register int pid; X STR *str; X int doexec = strNE(cmd,"-"); X X if (pipe(p) < 0) X return Nullfp; X this = (*mode == 'w'); X that = !this; X while ((pid = (doexec?vfork():fork())) < 0) { X if (errno != EAGAIN) { X close(p[this]); X if (!doexec) X fatal("Can't fork"); X return Nullfp; X } X sleep(5); X } X if (pid == 0) { X#define THIS that X#define THAT this X close(p[THAT]); X if (p[THIS] != (*mode == 'r')) { X dup2(p[THIS], *mode == 'r'); X close(p[THIS]); X } X if (doexec) { X#if !defined(I_FCNTL) || !defined(F_SETFD) X int fd; X X#ifndef NOFILE X#define NOFILE 20 X#endif X for (fd = 3; fd < NOFILE; fd++) X close(fd); X#endif X do_exec(cmd); /* may or may not use the shell */ X _exit(1); X } X if (tmpstab = stabent("$",allstabs)) X str_numset(STAB_STR(tmpstab),(double)getpid()); X forkprocess = 0; X hclear(pidstatus, FALSE); /* we have no children */ X return Nullfp; X#undef THIS X#undef THAT X } X do_execfree(); /* free any memory malloced by child on vfork */ X close(p[that]); X if (p[that] < p[this]) { X dup2(p[this], p[that]); X close(p[this]); X p[this] = p[that]; X } X str = afetch(fdpid,p[this],TRUE); X str->str_u.str_useful = pid; X forkprocess = pid; X return fdopen(p[this], mode); X} X#endif /* !MSDOS */ X X#ifdef NOTDEF Xdumpfds(s) Xchar *s; X{ X int fd; X struct stat tmpstatbuf; X X fprintf(stderr,"%s", s); X for (fd = 0; fd < 32; fd++) { X if (fstat(fd,&tmpstatbuf) >= 0) X fprintf(stderr," %d",fd); X } X fprintf(stderr,"\n"); X} X#endif X X#ifndef HAS_DUP2 Xdup2(oldfd,newfd) Xint oldfd; Xint newfd; X{ X#if defined(HAS_FCNTL) && defined(F_DUPFD) X close(newfd); X fcntl(oldfd, F_DUPFD, newfd); X#else X int fdtmp[20]; X int fdx = 0; X int fd; X X if (oldfd == newfd) X return 0; X close(newfd); X while ((fd = dup(oldfd)) != newfd) /* good enough for low fd's */ X fdtmp[fdx++] = fd; X while (fdx > 0) X close(fdtmp[--fdx]); X#endif X} X#endif X X#ifndef MSDOS Xint Xmypclose(ptr) XFILE *ptr; X{ X#ifdef VOIDSIG X void (*hstat)(), (*istat)(), (*qstat)(); X#else X int (*hstat)(), (*istat)(), (*qstat)(); X#endif X int status; X STR *str; X int pid; X X str = afetch(fdpid,fileno(ptr),TRUE); X astore(fdpid,fileno(ptr),Nullstr); X fclose(ptr); X pid = (int)str->str_u.str_useful; X hstat = signal(SIGHUP, SIG_IGN); X istat = signal(SIGINT, SIG_IGN); X qstat = signal(SIGQUIT, SIG_IGN); X pid = wait4pid(pid, &status, 0); X signal(SIGHUP, hstat); X signal(SIGINT, istat); X signal(SIGQUIT, qstat); X return(pid < 0 ? pid : status); X} X Xint Xwait4pid(pid,statusp,flags) Xint pid; Xint *statusp; Xint flags; X{ X int result; X STR *str; X char spid[16]; X X if (!pid) X return -1; X#ifdef HAS_WAIT4 X return wait4((pid==-1)?0:pid,statusp,flags,Null(struct rusage *)); X#else X#ifdef HAS_WAITPID X return waitpid(pid,statusp,flags); X#else X if (pid > 0) { X sprintf(spid, "%d", pid); X str = hfetch(pidstatus,spid,strlen(spid),FALSE); X if (str != &str_undef) { X *statusp = (int)str->str_u.str_useful; X hdelete(pidstatus,spid,strlen(spid)); X return pid; X } X } X else { X HENT *entry; X X hiterinit(pidstatus); X if (entry = hiternext(pidstatus)) { X pid = atoi(hiterkey(entry,statusp)); X str = hiterval(entry); X *statusp = (int)str->str_u.str_useful; X sprintf(spid, "%d", pid); X hdelete(pidstatus,spid,strlen(spid)); X return pid; X } X } X if (flags) X fatal("Can't do waitpid with flags"); X else { X while ((result = wait(statusp)) != pid && pid > 0 && result >= 0) X pidgone(result,*statusp); X if (result < 0) X *statusp = -1; X } X return result; X#endif X#endif X} X Xpidgone(pid,status) Xint pid; Xint status; X{ X#if defined(HAS_WAIT4) || defined(HAS_WAITPID) X#else X register STR *str; X char spid[16]; X X sprintf(spid, "%d", pid); X str = hfetch(pidstatus,spid,strlen(spid),TRUE); X str->str_u.str_useful = status; X#endif X return; X} X#endif /* !MSDOS */ X X#ifndef HAS_MEMCMP Xmemcmp(s1,s2,len) Xregister unsigned char *s1; Xregister unsigned char *s2; Xregister int len; X{ X register int tmp; X X while (len--) { X if (tmp = *s1++ - *s2++) X return tmp; X } X return 0; X} X#endif /* HAS_MEMCMP */ X Xvoid Xrepeatcpy(to,from,len,count) Xregister char *to; Xregister char *from; Xint len; Xregister int count; X{ X register int todo; X register char *frombase = from; X X if (len == 1) { X todo = *from; X while (count-- > 0) X *to++ = todo; X return; X } X while (count-- > 0) { X for (todo = len; todo > 0; todo--) { X *to++ = *from++; X } X from = frombase; X } X} X X#ifndef CASTNEGFLOAT Xunsigned long Xcastulong(f) Xdouble f; X{ X long along; X X#if CASTFLAGS & 2 X# define BIGDOUBLE 2147483648.0 X if (f >= BIGDOUBLE) X return (unsigned long)(f-(long)(f/BIGDOUBLE)*BIGDOUBLE)|0x80000000; X#endif X if (f >= 0.0) X return (unsigned long)f; X along = (long)f; X return (unsigned long)along; X} X#endif X X#ifndef HAS_RENAME Xint Xsame_dirent(a,b) Xchar *a; Xchar *b; X{ X char *fa = rindex(a,'/'); X char *fb = rindex(b,'/'); X struct stat tmpstatbuf1; X struct stat tmpstatbuf2; X#ifndef MAXPATHLEN X#define MAXPATHLEN 1024 X#endif X char tmpbuf[MAXPATHLEN+1]; X X if (fa) X fa++; X else X fa = a; X if (fb) X fb++; X else X fb = b; X if (strNE(a,b)) X return FALSE; X if (fa == a) X strcpy(tmpbuf,"."); X else X strncpy(tmpbuf, a, fa - a); X if (stat(tmpbuf, &tmpstatbuf1) < 0) X return FALSE; X if (fb == b) X strcpy(tmpbuf,"."); X else X strncpy(tmpbuf, b, fb - b); X if (stat(tmpbuf, &tmpstatbuf2) < 0) X return FALSE; X return tmpstatbuf1.st_dev == tmpstatbuf2.st_dev && X tmpstatbuf1.st_ino == tmpstatbuf2.st_ino; X} X#endif /* !HAS_RENAME */ X Xunsigned long Xscanoct(start, len, retlen) Xchar *start; Xint len; Xint *retlen; X{ X register char *s = start; X register unsigned long retval = 0; X X while (len-- && *s >= '0' && *s <= '7') { X retval <<= 3; X retval |= *s++ - '0'; X } X *retlen = s - start; X return retval; X} X Xunsigned long Xscanhex(start, len, retlen) Xchar *start; Xint len; Xint *retlen; X{ X register char *s = start; X register unsigned long retval = 0; X char *tmp; X X while (len-- && *s && (tmp = index(hexdigit, *s))) { X retval <<= 4; X retval |= (tmp - hexdigit) & 15; X s++; X } X *retlen = s - start; X return retval; X} !STUFFY!FUNK! echo Extracting PACKINGLIST@3 sed >PACKINGLIST@3 <<'!STUFFY!FUNK!' -e 's/X//' XAfter all the perl kits are run you should have the following files: X XFilename Kit Description X-------- --- ----------- XConfigure:AA 7 Run this first XConfigure:AB 14 XCopying 15 The GNU General Public License XEXTERN.h 36 Included before foreign .h files XINTERN.h 36 Included before domestic .h files XMANIFEST 27 This list of files XMakefile.SH 28 Precursor to Makefile XPACKINGLIST 17 Which files came from which kits XREADME 1 The Instructions XREADME.uport 1 Special instructions for Microports XREADME.xenix 1 Special instructions for Xenix XWishlist 36 Some things that may or may not happen Xarg.h 20 Public declarations for the above Xarray.c 30 Numerically subscripted arrays Xarray.h 36 Public declarations for the above Xcflags.SH 34 A script that emits C compilation flags per file Xclient 36 A client to test sockets Xcmd.c 19 Command interpreter Xcmd.h 31 Public declarations for the above Xconfig.H 25 Sample config.h Xconfig_h.SH 23 Produces config.h Xcons.c 13 Routines to construct cmd nodes of a parse tree Xconsarg.c 20 Routines to construct arg nodes of a parse tree Xdoarg.c 12 Scalar expression evaluation Xdoio.c:AA 3 I/O operations Xdoio.c:AB 28 Xdolist.c 11 Array expression evaluation Xdump.c 29 Debugging output Xeg/ADB 36 An adb wrapper to put in your crash dir Xeg/README 1 Intro to example perl scripts Xeg/changes 35 A program to list recently changed files Xeg/down 36 A program to do things to subdirectories Xeg/dus 36 A program to do du -s on non-mounted dirs Xeg/findcp 35 A find wrapper that implements a -cp switch Xeg/findtar 22 A find wrapper that pumps out a tar file Xeg/g/gcp 33 A program to do a global rcp Xeg/g/gcp.man 34 Manual page for gcp Xeg/g/ged 36 A program to do a global edit Xeg/g/ghosts 35 A sample /etc/ghosts file Xeg/g/gsh 33 A program to do a global rsh Xeg/g/gsh.man 33 Manual page for gsh Xeg/muck 26 A program to find missing make dependencies Xeg/muck.man 36 Manual page for muck Xeg/myrup 35 A program to find lightly loaded machines Xeg/nih 10 Script to insert #! workaround Xeg/relink 33 A program to change symbolic links Xeg/rename 34 A program to rename files Xeg/rmfrom 36 A program to feed doomed filenames to Xeg/scan/scan_df 34 Scan for filesystem anomalies Xeg/scan/scan_last 34 Scan for login anomalies Xeg/scan/scan_messages 30 Scan for console message anomalies Xeg/scan/scan_passwd 35 Scan for passwd file anomalies Xeg/scan/scan_ps 18 Scan for process anomalies Xeg/scan/scan_sudo 35 Scan for sudo anomalies Xeg/scan/scan_suid 33 Scan for setuid anomalies Xeg/scan/scanner 34 An anomaly reporter Xeg/shmkill 36 A program to remove unused shared memory Xeg/sysvipc/README 1 Intro to Sys V IPC examples Xeg/sysvipc/ipcmsg 35 Example of SYS V IPC message queues Xeg/sysvipc/ipcsem 35 Example of Sys V IPC semaphores Xeg/sysvipc/ipcshm 35 Example of Sys V IPC shared memory Xeg/travesty 35 A program to print travesties of its input text Xeg/van/empty 35 A program to empty the trashcan Xeg/van/unvanish 34 A program to undo what vanish does Xeg/van/vanexp 36 A program to expire vanished files Xeg/van/vanish 34 A program to put files in a trashcan Xeg/who 36 A sample who program Xemacs/perl-mode.el 21 Emacs major mode for perl Xemacs/perldb.el 18 Emacs debugging Xemacs/perldb.pl 16 Emacs debugging Xemacs/tedstuff 27 Some optional patches Xeval.c:AA 6 The expression evaluator Xeval.c:AB 23 Xform.c 28 Format processing Xform.h 35 Public declarations for the above Xgettest 36 A little script to test the get* routines Xh2ph.SH 11 A thing to turn C .h file into perl .ph files Xh2pl/README 1 How to turn .ph files into .pl files Xh2pl/cbreak.pl 36 cbreak routines using .ph Xh2pl/cbreak2.pl 36 cbreak routines using .pl Xh2pl/eg/sizeof.ph 36 Sample sizeof array initialization Xh2pl/eg/sys/errno.pl 34 Sample translated errno.pl Xh2pl/eg/sys/ioctl.pl 31 Sample translated ioctl.pl Xh2pl/eg/sysexits.pl 36 Sample translated sysexits.pl Xh2pl/getioctlsizes 36 Program to extract types from ioctl.h Xh2pl/mksizes 35 Program to make %sizeof array. Xh2pl/mkvars 35 Program to make .pl from .ph files Xh2pl/tcbreak 36 cbreak test routine using .ph Xh2pl/tcbreak2 25 cbreak test routine using .pl Xhandy.h 32 Handy definitions Xhash.c 26 Associative arrays Xhash.h 34 Public declarations for the above Xhints/3b2.sh 36 Xhints/aix_rs.sh 36 Xhints/aix_rt.sh 36 Xhints/apollo_C6_7.sh 36 Xhints/aux.sh 36 Xhints/dnix.sh 36 Xhints/dynix.sh 36 Xhints/fps.sh 36 Xhints/genix.sh 36 Xhints/hp9000_300.sh 36 Xhints/hp9000_400.sh 36 Xhints/hpux.sh 36 Xhints/i386.sh 36 Xhints/mips.sh 36 Xhints/ncr_tower.sh 36 Xhints/next.sh 36 Xhints/osf_1.sh 36 Xhints/sco_2_3_0.sh 36 Xhints/sco_2_3_1.sh 36 Xhints/sco_2_3_2.sh 36 Xhints/sco_2_3_3.sh 36 Xhints/sco_3.sh 36 Xhints/sgi.sh 36 Xhints/sunos_3_4.sh 36 Xhints/sunos_3_5.sh 36 Xhints/sunos_4_0_1.sh 36 Xhints/sunos_4_0_2.sh 36 Xhints/ultrix_3.sh 36 Xhints/ultrix_4.sh 36 Xhints/uts.sh 35 Xinstallperl 31 Perl script to do "make install" dirty work Xioctl.pl 32 Sample ioctl.pl Xlib/abbrev.pl 36 An abbreviation table builder Xlib/bigfloat.pl 29 An arbitrary precision floating point package Xlib/bigint.pl 29 An arbitrary precision integer arithmetic package Xlib/bigrat.pl 31 An arbitrary precision rational arithmetic package Xlib/cacheout.pl 28 Manages output filehandles when you need too many Xlib/complete.pl 34 A command completion subroutine Xlib/ctime.pl 23 A ctime workalike Xlib/dumpvar.pl 35 A variable dumper Xlib/flush.pl 36 Routines to do single flush Xlib/getopt.pl 35 Perl library supporting option parsing Xlib/getopts.pl 35 Perl library supporting option parsing Xlib/importenv.pl 36 Perl routine to get environment into variables Xlib/look.pl 35 A "look" equivalent Xlib/perldb.pl 26 Perl debugging routines Xlib/pwd.pl 35 Routines to keep track of PWD environment variable Xlib/stat.pl 17 Perl library supporting stat function Xlib/syslog.pl 30 Perl library supporting syslogging Xlib/termcap.pl 32 Perl library supporting termcap usage Xlib/timelocal.pl 31 Perl library supporting inverse of localtime, gmtime Xlib/validate.pl 32 Perl library supporting wholesale file mode validation Xmakedepend.SH 30 Precursor to makedepend Xmakedir.SH 34 Precursor to makedir Xmalloc.c 12 A version of malloc you might not want Xmsdos/Changes.dds 13 Expanation of MS-DOS patches by Diomidis Spinellis Xmsdos/Makefile 24 MS-DOS makefile Xmsdos/README.msdos 1 Compiling and usage information Xmsdos/Wishlist.dds 35 My wishlist Xmsdos/chdir.c 32 A chdir that can change drives Xmsdos/config.h 22 Definitions for msdos Xmsdos/dir.h 34 MS-DOS header for directory access functions Xmsdos/directory.c 32 MS-DOS directory access functions. Xmsdos/eg/crlf.bat 35 Convert files from unix to MS-DOS line termination Xmsdos/eg/drives.bat 35 List the system drives and their characteristics Xmsdos/eg/lf.bat 35 Convert files from MS-DOS to Unix line termination Xmsdos/glob.c 36 A command equivalent to csh glob Xmsdos/msdos.c 30 MS-DOS ioctl, sleep, gete?[gu]if, spawn, aspawn Xmsdos/popen.c 32 My_popen and my_pclose for MS-DOS Xmsdos/usage.c 34 How to invoke perl under MS-DOS Xos2/Makefile 33 Makefile for OS/2 Xos2/README.OS2 1 Notes for OS/2 Xos2/a2p.cs 36 Compiler script for a2p Xos2/a2p.def 36 Linker defs for a2p Xos2/alarm.c 31 An implementation of alarm() Xos2/alarm.h 36 Header file for same Xos2/config.h 25 Configuration file for OS/2 Xos2/dir.h 34 Directory header Xos2/director.c 30 Directory routines Xos2/eg/alarm.pl 36 Example of alarm code Xos2/eg/os2.pl 34 Sample script for OS/2 Xos2/eg/syscalls.pl 36 Example of syscall on OS/2 Xos2/glob.c 34 Globbing routines Xos2/makefile 33 Make file Xos2/mktemp.c 36 Mktemp() using TMP Xos2/os2.c 30 Unix compatibility functions Xos2/perl.bad 36 names of protect-only API calls for BIND Xos2/perl.cs 36 Compiler script for perl Xos2/perl.def 36 Linker defs for perl Xos2/perldb.dif 35 Changes to make the debugger work Xos2/perlglob.bad 36 names of protect-only API calls for BIND Xos2/perlglob.cs 36 Compiler script for perlglob Xos2/perlglob.def 36 Linker defs for perlglob Xos2/perlsh.cmd 36 Poor man's shell for os2 Xos2/popen.c 25 Code for opening pipes Xos2/s2p.cmd 28 s2p as command file Xos2/selfrun.bat 36 A self running perl script for DOS Xos2/selfrun.cmd 36 Example of extproc feature Xos2/suffix.c 29 Code for creating backup filenames Xpatchlevel.h 19 The current patch level of perl Xperl.c 16 main() Xperl.h 19 Global declarations Xperl.man:AA 2 The manual page(s) Xperl.man:AB 5 Xperl.man:AC 8 Xperl.man:AD 10 Xperlsh 16 A poor man's perl shell Xperly.fixer 32 A program to remove yacc stack limitations Xperly.y 22 Yacc grammar for perl Xregcomp.c 18 Regular expression compiler Xregcomp.h 29 Private declarations for above Xregexec.c 21 Regular expression evaluator Xregexp.h 35 Public declarations for the above Xserver 36 A server to test sockets Xspat.h 34 Search pattern declarations Xstab.c 24 Symbol table stuff Xstab.h 32 Public declarations for the above Xstr.c 15 String handling package Xstr.h 31 Public declarations for the above Xt/README 1 Instructions for regression tests Xt/TEST 34 The regression tester Xt/base/cond.t 36 See if conditionals work Xt/base/if.t 36 See if if works Xt/base/lex.t 35 See if lexical items work Xt/base/pat.t 36 See if pattern matching works Xt/base/term.t 35 See if various terms work Xt/cmd/elsif.t 36 See if else-if works Xt/cmd/for.t 35 See if for loops work Xt/cmd/mod.t 36 See if statement modifiers work Xt/cmd/subval.t 32 See if subroutine values work Xt/cmd/switch.t 15 See if switch optimizations work Xt/cmd/while.t 33 See if while loops work Xt/comp/cmdopt.t 33 See if command optimization works Xt/comp/cpp.t 36 See if C preprocessor works Xt/comp/decl.t 36 See if declarations work Xt/comp/multiline.t 35 See if multiline strings work Xt/comp/package.t 36 See if packages work Xt/comp/script.t 36 See if script invokation works Xt/comp/term.t 34 See if more terms work Xt/io/argv.t 35 See if ARGV stuff works Xt/io/dup.t 36 See if >& works right Xt/io/fs.t 33 See if directory manipulations work Xt/io/inplace.t 36 See if inplace editing works Xt/io/pipe.t 35 See if secure pipes work Xt/io/print.t 36 See if print commands work Xt/io/tell.t 35 See if file seeking works Xt/lib/big.t 31 See if lib/bigint.pl works Xt/op/append.t 36 See if . works Xt/op/array.t 31 See if array operations work Xt/op/auto.t 33 See if autoincrement et all work Xt/op/chop.t 36 See if chop works Xt/op/cond.t 36 See if conditional expressions work Xt/op/dbm.t 33 See if dbm binding works Xt/op/delete.t 14 See if delete works Xt/op/do.t 35 See if subroutines work Xt/op/each.t 35 See if associative iterators work Xt/op/eval.t 35 See if eval operator works Xt/op/exec.t 36 See if exec and system work Xt/op/exp.t 36 See if math functions work Xt/op/flip.t 36 See if range operator works Xt/op/fork.t 12 See if fork works Xt/op/glob.t 36 See if <*> works Xt/op/goto.t 36 See if goto works Xt/op/groups.t 36 See if $( works Xt/op/index.t 34 See if index works Xt/op/int.t 36 See if int works Xt/op/join.t 36 See if join works Xt/op/list.t 33 See if array lists work Xt/op/local.t 35 See if local works Xt/op/magic.t 35 See if magic variables work Xt/op/mkdir.t 36 See if mkdir works Xt/op/oct.t 36 See if oct and hex work Xt/op/ord.t 36 See if ord works Xt/op/pack.t 36 See if pack and unpack work Xt/op/pat.t 32 See if esoteric patterns work Xt/op/push.t 35 See if push and pop work Xt/op/range.t 35 See if .. works Xt/op/re_tests 33 Input file for op.regexp Xt/op/read.t 21 See if read() works Xt/op/regexp.t 35 See if regular expressions work Xt/op/repeat.t 34 See if x operator works Xt/op/s.t 31 See if substitutions work Xt/op/sleep.t 36 See if sleep works Xt/op/sort.t 27 See if sort works Xt/op/split.t 34 See if split works Xt/op/sprintf.t 36 See if sprintf works Xt/op/stat.t 30 See if stat works Xt/op/study.t 1 See if study works Xt/op/substr.t 34 See if substr works Xt/op/time.t 35 See if time functions work Xt/op/undef.t 34 See if undef works Xt/op/unshift.t 36 See if unshift works Xt/op/vec.t 35 See if vectors work Xt/op/write.t 34 See if write works Xtoke.c:AA 4 The tokener Xtoke.c:AB 28 Xusersub.c 32 User supplied (possibly proprietary) subroutines Xusub/Makefile 36 Makefile for curseperl Xusub/README 1 Instructions for user supplied subroutines Xusub/curses.mus 14 Glue routines for BSD curses Xusub/man2mus 34 A manual page to .mus translator Xusub/mus 33 A .mus to .c translator Xusub/pager 32 A sample pager in curseperl Xusub/usersub.c 36 An initialization file to call curses glue routines Xutil.c 17 Utility routines Xutil.h 35 Public declarations for the above Xx2p/EXTERN.h 36 Same as above Xx2p/INTERN.h 36 Same as above Xx2p/Makefile.SH 33 Precursor to Makefile Xx2p/a2p.h 29 Global declarations Xx2p/a2p.man 29 Manual page for awk to perl translator Xx2p/a2p.y 27 A yacc grammer for awk Xx2p/a2py.c 24 Awk compiler, sort of Xx2p/find2perl.SH 26 A find to perl translator Xx2p/handy.h 35 Handy definitions Xx2p/hash.c 31 Associative arrays again Xx2p/hash.h 34 Public declarations for the above Xx2p/s2p.SH 27 Sed to perl translator Xx2p/s2p.man 33 Manual page for sed to perl translator Xx2p/str.c 13 String handling package Xx2p/str.h 35 Public declarations for the above Xx2p/util.c 30 Utility routines Xx2p/util.h 35 Public declarations for the above Xx2p/walk.c 9 Parse tree walker !STUFFY!FUNK! echo Extracting lib/stat.pl sed >lib/stat.pl <<'!STUFFY!FUNK!' -e 's/X//' X;# $Header: stat.pl,v 4.0 91/03/20 01:26:16 lwall Locked $ X X;# Usage: X;# require 'stat.pl'; X;# @ary = stat(foo); X;# $st_dev = @ary[$ST_DEV]; X;# X$ST_DEV = 0 + $[; X$ST_INO = 1 + $[; X$ST_MODE = 2 + $[; X$ST_NLINK = 3 + $[; X$ST_UID = 4 + $[; X$ST_GID = 5 + $[; X$ST_RDEV = 6 + $[; X$ST_SIZE = 7 + $[; X$ST_ATIME = 8 + $[; X$ST_MTIME = 9 + $[; X$ST_CTIME = 10 + $[; X$ST_BLKSIZE = 11 + $[; X$ST_BLOCKS = 12 + $[; X X;# Usage: X;# require 'stat.pl'; X;# do Stat('foo'); # sets st_* as a side effect X;# Xsub Stat { X ($st_dev,$st_ino,$st_mode,$st_nlink,$st_uid,$st_gid,$st_rdev,$st_size, X $st_atime,$st_mtime,$st_ctime,$st_blksize,$st_blocks) = stat(shift(@_)); X} X X1; !STUFFY!FUNK! echo " " echo "End of kit 17 (of 36)" cat /dev/null >kit17isdone 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 24 25 26 27 28 29 30 31 32 33 34 35 36; 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." for combo in *:AA; do if test -f "$combo"; then realfile=`basename $combo :AA` cat $realfile:[A-Z][A-Z] >$realfile rm -rf $realfile:[A-Z][A-Z] fi done rm -rf kit*isdone chmod 755 Configure ;; *) echo "You have run$run." echo "You still need to run$todo." ;; esac : Someone might mail this, so... exit exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.