From: Larry Wall Date: Fri, 19 Oct 1990 13:31:07 +0000 (+0000) Subject: perl 3.0 patch #37 (combined patch) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e5d73d7778736a8bd9f7f44aad5289ad2c783a16;p=p5sagit%2Fp5-mst-13.2.git perl 3.0 patch #37 (combined patch) I tried to take the strlen of an integer on systems without wait4() or waitpid(). For some reason this didn't work too well... In hash.c there was a call to dbm_nextkey() which needed to be ifdefed on old dbm systems. A pattern such as /foo.*bar$/ was wrongly optimized to do tail matching on "foo". This was a longstanding bug that was unmasked by patch 36. Some systems have some SYS V IPC but not all of it. Configure now figures this out. Patch 36 put the user's PATH in front of Configures, but to make it work right I needed to change all calls of loc to ./loc in Configure. $cryptlib needed to be mentioned in the Makefile. Apollo 10.3 and Sun 3.5 have some compilation problems, so I mentioned them in README. Cray has weird restrictions on setjmp locations--you can't say if (result = setjmp(...)) Random typos and cleanup. --- diff --git a/Configure b/Configure index ca11e13..c1cdf6b 100755 --- a/Configure +++ b/Configure @@ -8,7 +8,7 @@ # and edit it to reflect your system. Some packages may include samples # of config.h for certain machines, so you might look for one of those.) # -# $Header: Configure,v 3.0.1.10 90/10/15 14:37:52 lwall Locked $ +# $Header: Configure,v 3.0.1.11 90/10/20 01:55:30 lwall Locked $ # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than @@ -155,6 +155,9 @@ d_strerror='' d_symlink='' d_syscall='' d_sysvipc='' +d_ipcmsg='' +d_ipcsem='' +d_ipcshm='' d_truncate='' d_varargs='' d_vfork='' @@ -513,7 +516,7 @@ egrep test " for file in $loclist; do - xxx=`loc $file $file $pth` + xxx=`./loc $file $file $pth` eval $file=$xxx eval _$file=$xxx case "$xxx" in @@ -529,7 +532,7 @@ echo " " echo "Don't worry if any of the following aren't found..." ans=offhand for file in $trylist; do - xxx=`loc $file $file $pth` + xxx=`./loc $file $file $pth` eval $file=$xxx eval _$file=$xxx case "$xxx" in @@ -639,7 +642,7 @@ $eunicefix filexp : determine where public executables go case "$bin" in '') - dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` + dflt=`./loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` ;; *) dflt="$bin" ;; @@ -676,7 +679,7 @@ $package has manual pages that need to be installed in source form. EOM case "$mansrc" in '') - dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1 /usr/man/man.L` + dflt=`./loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1 /usr/man/man.L` ;; *) dflt="$mansrc" ;; @@ -810,7 +813,7 @@ EOP if pdp11 2>/dev/null; then dflt='unsplit split' else - ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` + ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` case "$ans" in X) dflt='none';; *) if $test -d /lib/small || $test -d /usr/lib/small; then @@ -999,7 +1002,7 @@ else cc="$ans" fi case "$cc" in -gcc*) cpp=`loc gcc-cpp $cpp $pth`;; +gcc*) cpp=`./loc gcc-cpp $cpp $pth`;; esac : determine optimize, if desired, or use for debug flag also @@ -1130,7 +1133,7 @@ for thislib in $libswanted; do *) thatlib="${thislib}_s";; *) thatlib=NONE;; esac - xxx=`loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/local/lib /lib` + xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/local/lib /lib` if test -f $xxx; then echo "Found -l$thislib." case "$dflt" in @@ -1138,7 +1141,7 @@ for thislib in $libswanted; do *) dflt="$dflt -l$thislib";; esac else - xxx=`loc lib$thislib.a X $libpth` + xxx=`./loc lib$thislib.a X $libpth` if test -f $xxx; then echo "Found $xxx." case "$dflt" in @@ -1146,7 +1149,7 @@ for thislib in $libswanted; do *) dflt="$dflt $xxx";; esac else - xxx=`loc Slib$thislib.a X $xlibpth` + xxx=`./loc Slib$thislib.a X $xlibpth` if test -f $xxx; then echo "Found -l$thislib." case "$dflt" in @@ -1364,7 +1367,7 @@ case "$libpth" in '') libpth='/usr/ccs/lib /lib /usr/lib /usr/local/lib';; esac case "$libs" in -*-lc_s*) libc=`loc libc_s.a $libc $libpth` +*-lc_s*) libc=`./loc libc_s.a $libc $libpth` esac libnames=''; case "$libs" in @@ -1372,13 +1375,13 @@ case "$libs" in *) for thislib in $libs; do case "$thislib" in -l*) thislib=`expr X$thislib : 'X-l\(.*\)'` - try=`loc lib$thislib.a blurfl/dyick $libpth` + try=`./loc lib$thislib.a blurfl/dyick $libpth` if test ! -f $try; then - try=`loc lib$thislib blurfl/dyick $libpth` + try=`./loc lib$thislib blurfl/dyick $libpth` if test ! -f $try; then - try=`loc $thislib blurfl/dyick $libpth` + try=`./loc $thislib blurfl/dyick $libpth` if test ! -f $try; then - try=`loc Slib$thislib.a blurfl/dyick $xlibpth` + try=`./loc Slib$thislib.a blurfl/dyick $xlibpth` if test ! -f $try; then try='' fi @@ -1405,23 +1408,23 @@ elif test -f /lib/libc.a; then echo "Your C library is in /lib/libc.a. You're normal." libc=/lib/libc.a else - ans=`loc libc.a blurfl/dyick $libpth` + ans=`./loc libc.a blurfl/dyick $libpth` if test ! -f "$ans"; then - ans=`loc Slibc.a blurfl/dyick $xlibpth` + ans=`./loc Slibc.a blurfl/dyick $xlibpth` fi if test ! -f "$ans"; then - ans=`loc Mlibc.a blurfl/dyick $xlibpth` + ans=`./loc Mlibc.a blurfl/dyick $xlibpth` fi if test ! -f "$ans"; then - ans=`loc Llibc.a blurfl/dyick $xlibpth` + ans=`./loc Llibc.a blurfl/dyick $xlibpth` fi if test ! -f "$ans"; then - ans=`loc libc blurfl/dyick $libpth` + ans=`./loc libc blurfl/dyick $libpth` fi if test ! -f "$ans"; then - ans=`loc clib blurfl/dyick $libpth` + ans=`./loc clib blurfl/dyick $libpth` else - libnames="$libnames "`loc clib blurfl/dyick $libpth` + libnames="$libnames "`./loc clib blurfl/dyick $libpth` fi if test -f "$ans"; then echo "Your C library is in $ans, of all places." @@ -1599,19 +1602,19 @@ if $contains '^crypt$' libc.list >/dev/null 2>&1; then d_crypt="$define" cryptlib='' else - cryptlib=`loc Slibcrypt.a "" $xlibpth` + cryptlib=`./loc Slibcrypt.a "" $xlibpth` if $test -z "$cryptlib"; then - cryptlib=`loc Mlibcrypt.a "" $xlibpth` + cryptlib=`./loc Mlibcrypt.a "" $xlibpth` else cryptlib=-lcrypt fi if $test -z "$cryptlib"; then - cryptlib=`loc Llibcrypt.a "" $xlibpth` + cryptlib=`./loc Llibcrypt.a "" $xlibpth` else cryptlib=-lcrypt fi if $test -z "$cryptlib"; then - cryptlib=`loc libcrypt.a "" $libpth` + cryptlib=`./loc libcrypt.a "" $libpth` else cryptlib=-lcrypt fi @@ -1765,6 +1768,21 @@ else echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h." fi +: see if there is System V IPC +set msgget d_ipcmsg +eval $inlibc + +set semget d_ipcsem +eval $inlibc + +set shmget d_ipcshm +eval $inlibc + +case "$d_ipcmsg$d_ipcsem$d_ipcshm" in +*define*) d_sysvipc="$define";; +*) d_sysvipc="$undef";; +esac + : see if killpg exists set killpg d_killpg eval $inlibc @@ -1787,7 +1805,7 @@ eval $inlibc : see if ndbm is available echo " " -xxx=`loc ndbm.h x /usr/include /usr/local/include $inclwanted` +xxx=`./loc ndbm.h x /usr/include /usr/local/include $inclwanted` if test -f $xxx; then d_ndbm="$define" echo "ndbm.h found." @@ -1798,7 +1816,7 @@ fi : see if we have the old dbm echo " " -xxx=`loc dbm.h x /usr/include /usr/local/include $inclwanted` +xxx=`./loc dbm.h x /usr/include /usr/local/include $inclwanted` if test -f $xxx; then d_odbm="$define" echo "dbm.h found." @@ -2096,10 +2114,6 @@ case "$flags" in esac $rm -f try.c try -: see if there is System V IPC -set msgget d_sysvipc -eval $inlibc - : see if truncate exists set truncate d_truncate eval $inlibc @@ -2280,7 +2294,7 @@ fi : see if this is a netinet/in.h system echo " " -xxx=`loc netinet/in.h x /usr/include /usr/local/include $inclwanted` +xxx=`./loc netinet/in.h x /usr/include /usr/local/include $inclwanted` if test -f $xxx; then i_niin="$define" echo "netinet/in.h found." @@ -2311,7 +2325,7 @@ fi : see if this is a sys/ndir.h system echo " " -xxx=`loc sys/ndir.h x /usr/include /usr/local/include $inclwanted` +xxx=`./loc sys/ndir.h x /usr/include /usr/local/include $inclwanted` if test -f $xxx; then i_sysndir="$define" echo "sys/ndir.h found." @@ -2515,6 +2529,7 @@ uidtype="$ans" Log='$Log' Header='$Header' + : determine which malloc to compile in echo " " case "$usemymalloc" in @@ -2730,6 +2745,9 @@ d_strerror='$d_strerror' d_symlink='$d_symlink' d_syscall='$d_syscall' d_sysvipc='$d_sysvipc' +d_ipcmsg='$d_ipcmsg' +d_ipcsem='$d_ipcsem' +d_ipcshm='$d_ipcshm' d_truncate='$d_truncate' d_varargs='$d_varargs' d_vfork='$d_vfork' diff --git a/Makefile.SH b/Makefile.SH index 39a7f09..3197d60 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -25,9 +25,12 @@ esac echo "Extracting Makefile (with variable substitutions)" cat >Makefile <ary_array; /* possibly reallocated */ #ifdef JMPCLOBBER cmd = cmdparm; @@ -808,7 +812,8 @@ until_loop: #ifdef JMPCLOBBER cmdparm = cmd; #endif - if (match = setjmp(loop_stack[loop_ptr].loop_env)) { + match = setjmp(loop_stack[loop_ptr].loop_env); + if (match) { st = stack->ary_array; /* possibly reallocated */ #ifdef JMPCLOBBER cmd = cmdparm; diff --git a/config.h.SH b/config.h.SH index 3eee31f..28ede3d 100644 --- a/config.h.SH +++ b/config.h.SH @@ -424,8 +424,24 @@ sed <config.h -e 's!^#undef!/\*#undef!' /* SYSVIPC: * This symbol, if defined, indicates that System V IPC exists. */ +/* IPCMSG: + * This symbol, if defined, indicates that System V IPC messages exist. + */ +/* IPCSEM: + * This symbol, if defined, indicates that System V IPC semaphores exist. + */ +/* IPCSHM: + * This symbol, if defined, indicates that System V IPC shared memory + * exists. + */ #$d_sysvipc SYSVIPC /**/ +#$d_ipcmsg IPCMSG /**/ + +#$d_ipcsem IPCSEM /**/ + +#$d_ipcshm IPCSHM /**/ + /* TRUNCATE: * This symbol, if defined, indicates that the truncate routine is * available to truncate files. diff --git a/doio.c b/doio.c index 9dee302..54d01cf 100644 --- a/doio.c +++ b/doio.c @@ -1,4 +1,4 @@ -/* $Header: doio.c,v 3.0.1.11 90/10/15 16:16:11 lwall Locked $ +/* $Header: doio.c,v 3.0.1.12 90/10/20 02:04:18 lwall Locked $ * * Copyright (c) 1989, Larry Wall * @@ -6,6 +6,9 @@ * as specified in the README file that comes with the perl 3.0 kit. * * $Log: doio.c,v $ + * Revision 3.0.1.12 90/10/20 02:04:18 lwall + * patch37: split out separate Sys V IPC features + * * Revision 3.0.1.11 90/10/15 16:16:11 lwall * patch29: added SysV IPC * patch29: file - didn't auto-close cleanly @@ -85,10 +88,16 @@ #ifdef SYSVIPC #include +#ifdef IPCMSG #include +#endif +#ifdef IPCSEM #include +#endif +#ifdef IPCSHM #include #endif +#endif #ifdef I_PWD #include @@ -2341,12 +2350,22 @@ int *arglast; errno = 0; switch (optype) { +#ifdef IPCMSG case O_MSGGET: return msgget(key, flags); +#endif +#ifdef IPCSEM case O_SEMGET: return semget(key, n, flags); +#endif +#ifdef IPCSHM case O_SHMGET: return shmget(key, n, flags); +#endif +#if !defined(IPCMSG) || !defined(IPCSEM) || !defined(IPCSHM) + default: + fatal("%s not implemented", opname[optype]); +#endif } return -1; /* should never happen */ } @@ -2372,14 +2391,19 @@ int *arglast; switch (optype) { +#ifdef IPCMSG case O_MSGCTL: if (cmd == IPC_STAT || cmd == IPC_SET) infosize = sizeof(struct msqid_ds); break; +#endif +#ifdef IPCSHM case O_SHMCTL: if (cmd == IPC_STAT || cmd == IPC_SET) infosize = sizeof(struct shmid_ds); break; +#endif +#ifdef IPCSEM case O_SEMCTL: if (cmd == IPC_STAT || cmd == IPC_SET) infosize = sizeof(struct semid_ds); @@ -2392,6 +2416,11 @@ int *arglast; infosize = semds.sem_nsems * sizeof(ushort); } break; +#endif +#if !defined(IPCMSG) || !defined(IPCSEM) || !defined(IPCSHM) + default: + fatal("%s not implemented", opname[optype]); +#endif } if (infosize) @@ -2419,15 +2448,21 @@ int *arglast; errno = 0; switch (optype) { +#ifdef IPCMSG case O_MSGCTL: ret = msgctl(id, cmd, a); break; +#endif +#ifdef IPCSEM case O_SEMCTL: ret = semctl(id, n, cmd, a); break; +#endif +#ifdef IPCSHM case O_SHMCTL: ret = shmctl(id, cmd, a); break; +#endif } if (getinfo && ret >= 0) { astr->str_cur = infosize; @@ -2440,6 +2475,7 @@ int do_msgsnd(arglast) int *arglast; { +#ifdef IPCMSG register STR **st = stack->ary_array; register int sp = arglast[0]; STR *mstr; @@ -2456,12 +2492,16 @@ int *arglast; } errno = 0; return msgsnd(id, mbuf, msize, flags); +#else + fatal("msgsnd not implemented"); +#endif } int do_msgrcv(arglast) int *arglast; { +#ifdef IPCMSG register STR **st = stack->ary_array; register int sp = arglast[0]; STR *mstr; @@ -2486,12 +2526,16 @@ int *arglast; mstr->str_ptr[sizeof(long)+ret] = '\0'; } return ret; +#else + fatal("msgrcv not implemented"); +#endif } int do_semop(arglast) int *arglast; { +#ifdef IPCSEM register STR **st = stack->ary_array; register int sp = arglast[0]; STR *opstr; @@ -2509,6 +2553,9 @@ int *arglast; } errno = 0; return semop(id, opbuf, opsize/sizeof(struct sembuf)); +#else + fatal("semop not implemented"); +#endif } int @@ -2516,6 +2563,7 @@ do_shmio(optype, arglast) int optype; int *arglast; { +#ifdef IPCSHM register STR **st = stack->ary_array; register int sp = arglast[0]; STR *mstr; @@ -2558,6 +2606,9 @@ int *arglast; bzero(shm + mpos + n, msize - n); } return shmdt(shm); +#else + fatal("shm I/O not implemented"); +#endif } #endif /* SYSVIPC */ diff --git a/eg/sysvipc/ipcshm b/eg/sysvipc/ipcshm index 70588ff..d40e46b 100644 --- a/eg/sysvipc/ipcshm +++ b/eg/sysvipc/ipcshm @@ -13,8 +13,8 @@ $send = ($mode eq "s"); $SIZE = 32; $id = shmget(0x1234, $SIZE, ($send ? 0 : &IPC_CREAT) | 0644); -die "Can't get message queue: $!\n" unless defined($id); -print "message queue id: $id\n"; +die "Can't get shared memory: $!\n" unless defined($id); +print "shared memory id: $id\n"; if ($send) { while () { diff --git a/h2ph.SH b/h2ph.SH index 903cad3..fa33efc 100644 --- a/h2ph.SH +++ b/h2ph.SH @@ -6,7 +6,7 @@ case $CONFIG in ln ../../../config.sh . || \ (echo "Can't find config.sh."; exit 1) fi - . config.sh + . ./config.sh ;; esac : This forces SH files to create target in same directory as SH file. @@ -177,7 +177,7 @@ sub expr { $new .= 'defined'; } elsif (/^\(/) { - s/^\((\w),/("$1",/ if $id =~ /^_IO[WR]*$/; # cheat + s/^\((\w),/("$1",/ if $id =~ /^_IO[WR]*$/i; # cheat $new .= " &$id"; } elsif ($isatype{$id}) { diff --git a/hash.c b/hash.c index 8a288df..73ac5b9 100644 --- a/hash.c +++ b/hash.c @@ -1,4 +1,4 @@ -/* $Header: hash.c,v 3.0.1.6 90/10/15 17:32:52 lwall Locked $ +/* $Header: hash.c,v 3.0.1.7 90/10/20 02:10:00 lwall Locked $ * * Copyright (c) 1989, Larry Wall * @@ -6,6 +6,9 @@ * as specified in the README file that comes with the perl 3.0 kit. * * $Log: hash.c,v $ + * Revision 3.0.1.7 90/10/20 02:10:00 lwall + * patch37: hash.c called ndbm function on dbm system + * * Revision 3.0.1.6 90/10/15 17:32:52 lwall * patch29: non-existent array values no longer cause core dumps * patch29: %foo = () will now clear dbm files @@ -402,7 +405,15 @@ int dodbm; if ((old_dbm = tb->tbl_dbm) && dodbm) { while (dkey = dbm_firstkey(tb->tbl_dbm), dkey.dptr) { do { +#ifdef NDBM +#ifdef _CX_UX nextdkey = dbm_nextkey(tb->tbl_dbm, dkey); +#else + nextdkey = dbm_nextkey(tb->tbl_dbm); +#endif +#else + nextdkey = nextkey(dkey); +#endif dbm_delete(tb->tbl_dbm,dkey); dkey = nextdkey; } while (dkey.dptr); /* one way or another, this works */ diff --git a/makelib.SH b/makelib.SH index e74ba8d..53dd9f2 100644 --- a/makelib.SH +++ b/makelib.SH @@ -1,2 +1,2 @@ echo "makelib.SH has been renamed to h2ph.SH" -rm makelib +rm -f makelib diff --git a/patchlevel.h b/patchlevel.h index d248b35..1bff899 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1 +1 @@ -#define PATCHLEVEL 36 +#define PATCHLEVEL 37 diff --git a/perl.man.1 b/perl.man.1 index 4f926a4..a085493 100644 --- a/perl.man.1 +++ b/perl.man.1 @@ -1,7 +1,10 @@ .rn '' }` -''' $Header: perl_man.1,v 3.0.1.8 90/10/15 18:16:19 lwall Locked $ +''' $Header: perl_man.1,v 3.0.1.9 90/10/20 02:14:24 lwall Locked $ ''' ''' $Log: perl.man.1,v $ +''' Revision 3.0.1.9 90/10/20 02:14:24 lwall +''' patch37: fixed various typos in man page +''' ''' Revision 3.0.1.8 90/10/15 18:16:19 lwall ''' patch29: added DATA filehandle to read stuff after __END__ ''' patch29: added cmp and <=> @@ -54,7 +57,7 @@ .. .de Ip .br -.ie \\n.$>=3 .ne \\$3 +.ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. diff --git a/perl.man.3 b/perl.man.3 index 92b2676..80b2ad3 100644 --- a/perl.man.3 +++ b/perl.man.3 @@ -1,7 +1,10 @@ ''' Beginning of part 3 -''' $Header: perl_man.3,v 3.0.1.9 90/10/16 10:02:43 lwall Locked $ +''' $Header: perl_man.3,v 3.0.1.10 90/10/20 02:15:17 lwall Locked $ ''' ''' $Log: perl.man.3,v $ +''' Revision 3.0.1.10 90/10/20 02:15:17 lwall +''' patch37: patch37: fixed various typos in man page +''' ''' Revision 3.0.1.9 90/10/16 10:02:43 lwall ''' patch29: you can now read into the middle string ''' patch29: index and substr now have optional 3rd args @@ -727,14 +730,14 @@ the undefined value if there is an error. Calls the System V IPC function semop to perform semaphore operations such as signaling and waiting. OPSTRING must be a packed array of semop structures. Each semop structure can be generated with -'pack("sss", $semnum, $semop, $semflag)'. The number of semaphore +\&'pack("sss", $semnum, $semop, $semflag)'. The number of semaphore operations is implied by the length of OPSTRING. Returns true if successful, or false if there is an error. As an example, the following code waits on semaphore $semnum of semaphore id $semid: .nf $semop = pack("sss", $semnum, -1, 0); - die "Semaphore trouble: $!\n" unless semop($semid, $semop); + die "Semaphore trouble: $!\en" unless semop($semid, $semop); .fi To signal the semaphore, replace "-1" with "1". diff --git a/perl.man.4 b/perl.man.4 index 145284e..6a0ef6c 100644 --- a/perl.man.4 +++ b/perl.man.4 @@ -1,7 +1,10 @@ ''' Beginning of part 4 -''' $Header: perl_man.4,v 3.0.1.11 90/10/16 10:04:28 lwall Locked $ +''' $Header: perl_man.4,v 3.0.1.12 90/10/20 02:15:43 lwall Locked $ ''' ''' $Log: perl.man.4,v $ +''' Revision 3.0.1.12 90/10/20 02:15:43 lwall +''' patch37: patch37: fixed various typos in man page +''' ''' Revision 3.0.1.11 90/10/16 10:04:28 lwall ''' patch29: added @###.## fields to format ''' @@ -808,7 +811,7 @@ Example: or, used numerically, - warn "No checksumming!\n" if $] < 3.019; + warn "No checksumming!\en" if $] < 3.019; .fi (Mnemonic: Is this version of perl in the right bracket?) @@ -905,7 +908,7 @@ See $0 for the command name. The array INC contains the list of places to look for .I perl scripts to be -evaluated by the \*(L"do EXPR\*(R" command or the \*(L"require\*(r" command. +evaluated by the \*(L"do EXPR\*(R" command or the \*(L"require\*(R" command. It initially consists of the arguments to any .B \-I command line switches, followed diff --git a/regcomp.c b/regcomp.c index 04d62c3..99dd81b 100644 --- a/regcomp.c +++ b/regcomp.c @@ -7,9 +7,12 @@ * blame Henry for some of the lack of readability. */ -/* $Header: regcomp.c,v 3.0.1.6 90/10/16 10:17:33 lwall Locked $ +/* $Header: regcomp.c,v 3.0.1.7 90/10/20 02:18:32 lwall Locked $ * * $Log: regcomp.c,v $ + * Revision 3.0.1.7 90/10/20 02:18:32 lwall + * patch37: /foo.*bar$/ wrongly optimized to do tail matching on "foo" + * * Revision 3.0.1.6 90/10/16 10:17:33 lwall * patch29: patterns with multiple short literal strings sometimes failed * @@ -250,7 +253,7 @@ int fold; len = 0; curback = 0; back = 0; - while (scan != NULL) { + while (OP(scan) != END) { if (OP(scan) == BRANCH) { if (OP(regnext(scan)) == BRANCH) { curback = -30000; @@ -288,13 +291,22 @@ int fold; str_sset(longest,longish); str_nset(longish,"",0); } - else if (index(simple,OP(scan))) + else if (index(simple,OP(scan))) { curback++; + len = 0; + if (longish->str_cur > longest->str_cur) + str_sset(longest,longish); + str_nset(longish,"",0); + } scan = regnext(scan); } - if (longish->str_cur > longest->str_cur) + + /* Prefer earlier on tie, unless we can tail match latter */ + + if (longish->str_cur + (OP(first) == EOL) > longest->str_cur) str_sset(longest,longish); - str_free(longish); + else + str_nset(longish,"",0); if (longest->str_cur) { r->regmust = longest; if (back < 0) @@ -304,11 +316,12 @@ int fold; > !(sawstudy || fold || OP(first) == EOL) ) fbmcompile(r->regmust,fold); r->regmust->str_u.str_useful = 100; - if (OP(first) == EOL) /* is match anchored to EOL? */ + if (OP(first) == EOL && longish->str_cur) r->regmust->str_pok |= SP_TAIL; } else str_free(longest); + str_free(longish); } r->do_folding = fold; diff --git a/util.c b/util.c index 74df0fd..c1c7d5a 100644 --- a/util.c +++ b/util.c @@ -1,4 +1,4 @@ -/* $Header: util.c,v 3.0.1.8 90/10/16 11:26:57 lwall Locked $ +/* $Header: util.c,v 3.0.1.9 90/10/20 02:21:01 lwall Locked $ * * Copyright (c) 1989, Larry Wall * @@ -6,6 +6,10 @@ * as specified in the README file that comes with the perl 3.0 kit. * * $Log: util.c,v $ + * Revision 3.0.1.9 90/10/20 02:21:01 lwall + * patch37: tried to take strlen of integer on systems without wait4 or waitpid + * patch37: unreachable return eliminated + * * Revision 3.0.1.8 90/10/16 11:26:57 lwall * patch29: added waitpid * patch29: various portability fixes @@ -1341,10 +1345,10 @@ int flags; #else if (pid > 0) { sprintf(spid, "%d", pid); - str = hfetch(pidstatus,spid,strlen(pid),FALSE); + str = hfetch(pidstatus,spid,strlen(spid),FALSE); if (str != &str_undef) { *statusp = (int)str->str_u.str_useful; - hdelete(pidstatus,spid,strlen(pid)); + hdelete(pidstatus,spid,strlen(spid)); return pid; } } @@ -1357,7 +1361,7 @@ int flags; str = hiterval(entry); *statusp = (int)str->str_u.str_useful; sprintf(spid, "%d", pid); - hdelete(pidstatus,spid,strlen(pid)); + hdelete(pidstatus,spid,strlen(spid)); return pid; } } @@ -1373,9 +1377,9 @@ int flags; if (result < 0) *statusp = -1; } + return result; #endif #endif - return result; } #endif /* !MSDOS */ @@ -1389,7 +1393,7 @@ int status; char spid[16]; sprintf(spid, "%d", pid); - str = hfetch(pidstatus,pid,strlen(pid),TRUE); + str = hfetch(pidstatus,spid,strlen(spid),TRUE); str->str_u.str_useful = status; #endif return; diff --git a/x2p/s2p.SH b/x2p/s2p.SH index 553cfd6..9898dcf 100644 --- a/x2p/s2p.SH +++ b/x2p/s2p.SH @@ -11,7 +11,7 @@ case $CONFIG in ln ../../../config.sh . || \ (echo "Can't find config.sh."; exit 1) fi - . config.sh + . ./config.sh ;; esac echo "Extracting s2p (with variable substitutions)" @@ -28,9 +28,12 @@ $spitshell >s2p <>s2p <<'!NO!SUBS!' -# $Header: s2p.SH,v 3.0.1.5 90/10/16 11:32:40 lwall Locked $ +# $Header: s2p.SH,v 3.0.1.6 90/10/20 02:21:43 lwall Locked $ # # $Log: s2p.SH,v $ +# Revision 3.0.1.6 90/10/20 02:21:43 lwall +# patch37: changed some ". config.sh" to ". ./config.sh" +# # Revision 3.0.1.5 90/10/16 11:32:40 lwall # patch29: s2p modernized #