From: Larry Wall Date: Thu, 21 Dec 1989 07:38:16 +0000 (+0000) Subject: perl 3.0 patch #7 (combined patch) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d8f2e4ccb684dfafc2c7b30a318ebf5798a9a1a4;p=p5sagit%2Fp5-mst-13.2.git perl 3.0 patch #7 (combined patch) The select operator didn't interpret bit vectors correctly on non-little-endian machines such as Suns. Rather than bollux up the rather straightforward interpretation of bit vectors, I made the select operator rearrange the bytes as necessary. So it is still true that vec($foo,0,1) refers to the first bit of the first byte of string $foo, even on big-endian machines. The send() socket operator didn't correctly allow you to specify a TO argument even though this was documented. (The TO argument is desirable for sending datagram packets.) In ANSI standard C, they decided that longjmp() didn't have to guarantee anything about registers. Several people sent me some patches that declared certain variables as volatile rather than register for such compilers. Rather than go that route, however, I wanted to keep some of these variables in registers, so I just made sure that the important ones are restored from non-register locations after longjmp(). I think "volatile" encourages people to punt too easily. The foreach construct still had some difficulty with two nested foreach loops referring to the same array, and to a single foreach that called its enclosing subroutine recursively. I think I've got this straight now. You wouldn't think a little iterator would give some much trouble. A pattern like /b*/ wouldn't match a null string before the first character. And certain patterns didn't match correctly at end of string. The upshot was that $_ = 'aaa'; s/b*/x/g; produced 'axaxa' rather than the expected 'xaxaxax'. This has been fixed. Note however that the split operator will still not match a null string before the first character, so that split(/b*/,'aaa') produces ('a','a','a'), not ('','a','a','a',''). The saga continues, and hopefully concludes. I realized I was fighting a losing battle trying to grep out all the includes from and . There are just too many funny includes, symbols, links and such on too many kinds of machines. Configure now compiles a test program several different ways to figure out which way to define the various symbols. Configure now lets you pick between yacc or bison for your compiler compiler. If you pick bison, be sure you have alloca somewhere on your system. The ANSI function strerror() is now supported where available. In addition, errno may now be a macro with an lvalue, so errno isn't declared extern if it's defined as a macro in . The memcpy() and memset() are now allowed to return void. There is now support for sys/ndir.h for systems such as Xenix. It's now also easier to cross compile on a 386 for a 286. DG/UX has functions setpgrp2() and getpgrp2() to keep the BSD sematics separate from the SystemV semantics. So now we have yet another wonderful non-standard way of doing things. There is also a utime.h file which lets them put time stamps on files to microsecond resolutions, though perl doesn't take advantage of this. The list of optional libraries to be searched for now includes -lnet_s, -lnsl_s, -lsocket and -lx. We can now find .h files down in /usr/include/lan. Microport systems have problems. I've added some CRIPPLED_CC support for them, but you still need to read the README.uport file for some extra rigamarole. In the README file, there are now hints for what to do if your compile doesn't work right, and specific hints for machines known to require certain switches. The grep operator with a simple first argument, such as grep(1,@array), didn't work right. That one seems silly, but grep($_,@array) didn't work either. Now it does. A /$pat/ followed by a // wrongly freed the runtime pattern twice, causing ill-will on the part of all concerned. The ord() function now always returns positive even on signed-char machines. This seems to be less surprising to people. If you still want a signed value on such machines, you can always use unpack. The lib/complete.pl file misused the @_ array. The array has been renamed. In the man page, I clarified that s`pat`repl` does command substitution on the replacement string, that $timeleft from select() is likely not implemented in many places, and that the qualified form package'filehandle works as well as $package'variable. It is also explicitly stated that certain identifiers (non-alpha, STDIN, etc.) are always resolved in package main's symbol table. Perl didn't grok setuid scripts that had a space on the first line between the shebang and the interpreter name. In stab.c, sighandler() may now return either void or int, depending on the value of VOIDSIG. You couldn't debug a script that used -p or -n because they would try to slap an extra } on the end of the perldb.pl file. This upset the parser. The interpration of strings like " ''$foo'' " caused problems because the tokener didn't realize that neither single quote following the variable was indicating a package qualifier. (It knew the last one wasn't, but was confused about the first one.) Merely changing an if to a while fixed it. Well, two if's. Another place we don't want ' to be interpreted as a package qualifier is if it's the delimiter for an m'pat' or s'pat'repl'. These have been grandfathered to look like a match and a substitution. There were a couple of problems in a2p. First, the ops array was dimensioned too big on 286's. Second, there was a problem involving passing a union where I should've passed a member of the union, which meant user-defined functions didn't work right on some machines. --- diff --git a/Configure b/Configure index 5f53877..4e8856f 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.3 89/11/17 15:01:21 lwall Locked $ +# $Header: Configure,v 3.0.1.4 89/12/21 18:57:00 lwall Locked $ # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than @@ -115,6 +115,7 @@ d_flock='' d_getgrps='' d_gethent='' d_getpgrp='' +d_getpgrp2='' d_getprior='' d_htonl='' d_index='' @@ -132,6 +133,7 @@ d_rmdir='' d_setegid='' d_seteuid='' d_setpgrp='' +d_setpgrp2='' d_setprior='' d_setregid='' d_setresgid='' @@ -146,12 +148,9 @@ socketlib='' d_statblks='' d_stdstdio='' d_strctcpy='' +d_strerror='' d_symlink='' d_syscall='' -d_tminsys='' -i_systime='' -i_timetoo='' -i_systimetoo='' d_varargs='' d_vfork='' d_voidsig='' @@ -172,6 +171,11 @@ d_pwclass='' d_pwexpire='' i_sysdir='' i_sysioctl='' +i_sysndir='' +i_time='' +i_systime='' +d_systimekernel='' +i_utime='' i_varargs='' i_vfork='' intsize='' @@ -206,8 +210,9 @@ stdchar='' uidtype='' voidflags='' defvoidused='' -lib='' +yacc='' privlib='' +lib='' CONFIG='' : set package name package=perl @@ -219,7 +224,9 @@ echo " " define='define' undef='undef' -libpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large /usr/lib/small /lib/small' +: change the next line if compiling for Xenix/286 on Xenix/386 +xlibpth='/usr/lib/386 /lib/386' +libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small' smallmach='pdp11 i8086 z8000 i80286 iAPX286' rmlist='kit[1-9]isdone kit[1-9][0-9]isdone' trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 @@ -245,12 +252,12 @@ attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800" attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc" attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX" attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386" -attrlist="$attrlist i186" +attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__" pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb" d_newshome="/usr/NeWS" defvoidused=7 -libswanted="net nm ndir ndbm dbm sun bsd c_s" -inclwanted='/usr/netinclude /usr/include/sun /usr/include/bsd' +libswanted="net_s net nsl_s nsl socket nm ndir ndbm dbm sun bsd x c_s" +inclwanted='/usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan' : some greps do not return status, grrr. echo "grimblepritz" >grimble if grep blurfldyick grimble >/dev/null 2>&1 ; then @@ -1104,11 +1111,17 @@ case "$libswanted" in '') libswanted='c_s';; esac for thislib in $libswanted; do + case "$thislib" in + dbm) thatlib=ndbm;; + *_s) thatlib=NONE;; + *) thatlib="${thislib}_s";; + *) thatlib=NONE;; + esac xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib` if test -f $xxx; then echo "Found -l$thislib." case "$dflt" in - *-l$thislib*);; + *-l$thislib*|*-l$thatlib*);; *) dflt="$dflt -l$thislib";; esac else @@ -1120,11 +1133,11 @@ for thislib in $libswanted; do *) dflt="$dflt $xxx";; esac else - xxx=`loc Slib$thislib.a X /usr/lib /usr/local/lib /lib` + xxx=`loc Slib$thislib.a X $xlibpth` if test -f $xxx; then echo "Found -l$thislib." case "$dflt" in - *-l$thislib*);; + *-l$thislib*|*-l$thatlib*);; *) dflt="$dflt -l$thislib";; esac else @@ -1151,6 +1164,7 @@ cc command line when linking. Other systems use shared libraries by default. There may be other libraries needed to compile $package on your machine as well. If your system needs the "-lc_s" option, include it here. Include any other special libraries here as well. +Say "none" for none. EOM echo " " @@ -1347,7 +1361,10 @@ case "$libs" in if test ! -f $try; then try=`loc $thislib blurfl/dyick $libpth` if test ! -f $try; then - try='' + try=`loc Slib$thislib.a blurfl/dyick $xlibpth` + if test ! -f $try; then + try='' + fi fi fi fi @@ -1377,13 +1394,13 @@ else ans=`loc clib blurfl/dyick $libpth` fi if test ! -f "$ans"; then - ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth` + ans=`loc Slibc.a blurfl/dyick $xlibpth` fi if test ! -f "$ans"; then - ans=`loc Mlibc.a blurfl/dyick $libpth` + ans=`loc Mlibc.a blurfl/dyick $xlibpth` fi if test ! -f "$ans"; then - ans=`loc Llibc.a blurfl/dyick $libpth` + ans=`loc Llibc.a blurfl/dyick $xlibpth` fi if test -f "$ans"; then echo "Your C library is in $ans, of all places." @@ -1522,14 +1539,14 @@ if $contains '^crypt$' libc.list >/dev/null 2>&1; then d_crypt="$define" cryptlib='' else - cryptlib=`loc Slibcrypt.a "" /lib/386 /lib` + cryptlib=`loc Slibcrypt.a "" $xlibpth` if $test -z "$cryptlib"; then - cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib` + cryptlib=`loc Mlibcrypt.a "" $xlibpth` else cryptlib=-lcrypt fi if $test -z "$cryptlib"; then - cryptlib=`loc Llibcrypt.a "" /lib/386 /lib` + cryptlib=`loc Llibcrypt.a "" $xlibpth` else cryptlib=-lcrypt fi @@ -1636,6 +1653,10 @@ eval $inlibc set getpgrp d_getpgrp eval $inlibc +: see if getpgrp2 exists +set getpgrp2 d_getpgrp2 +eval $inlibc + : see if getpriority exists set getpriority d_getprior eval $inlibc @@ -1792,6 +1813,10 @@ eval $inlibc set setpgrp d_setpgrp eval $inlibc +: see if setpgrp2 exists +set setpgrp2 d_setpgrp2 +eval $inlibc + : see if setpriority exists set setpriority d_setprior eval $inlibc @@ -1923,6 +1948,10 @@ else fi $rm -f try.* +: see if strerror exists +set strerror d_strerror +eval $inlibc + : see if symlink exists set symlink d_symlink eval $inlibc @@ -1931,31 +1960,71 @@ eval $inlibc set syscall d_syscall eval $inlibc -: see if struct tm is defined in sys/time.h -echo " " -if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then - echo "You have struct tm defined in rather than ." - d_tminsys="$undef" - if test -f /usr/include/sys/time.h; then - i_systime="$define" - else - i_systime="$undef" - fi -else - echo "You have struct tm defined in rather than ." - d_tminsys="$define" - i_systime="$define" -fi -if $contains '^#.*include.*' /usr/include/sys/time.h >/dev/null 2>&1 ; then - i_timetoo="$undef" -else - i_timetoo="$define" -fi -if $contains '^#.*include.*' /usr/include/time.h >/dev/null 2>&1 ; then - i_systimetoo="$undef" -else - i_systimetoo="$define" -fi +: see if we should include time.h, sys/time.h, or both +cat <<'EOM' + +Testing to see if we should include , or both. +I'm now running the test program... +EOM +$cat >try.c <<'EOCP' +#ifdef I_TIME +#include +#endif +#ifdef I_SYSTIME +#ifdef SYSTIMEKERNEL +#define KERNEL +#endif +#include +#endif +main() +{ + struct tm foo; +#ifdef S_TIMEVAL + struct timeval bar; +#endif + if (foo.tm_sec == foo.tm_sec) + exit(0); +#ifdef S_TIMEVAL + if (bar.tv_sec == bar.tv_sec) + exit(0); +#endif + exit(1); +} +EOCP +flags='' +for s_timeval in '-DS_TIMEVAL' ''; do + for d_systimekernel in '' '-DSYSTIMEKERNEL'; do + for i_time in '' '-DI_TIME'; do + for i_systime in '-DI_SYSTIME' ''; do + case "$flags" in + '') echo Trying $i_time $i_systime $d_systimekernel $s_timeval + if $cc try.c $ccflags \ + $i_time $i_systime $d_systimekernel $s_timeval \ + -o try >/dev/null 2>&1 ; then + set X $i_time $i_systime $d_systimekernel $s_timeval + shift + flags="$*" + echo Succeeded with $flags + fi + ;; + esac + done + done + done +done +case "$flags" in +*SYSTIMEKERNEL*) d_systimekernel="$define";; +*) d_systimekernel="$undef";; +esac +case "$flags" in +*I_TIME*) i_time="$define";; +*) i_time="$undef";; +esac +case "$flags" in +*I_SYSTIME*) i_systime="$define";; +*) i_systime="$undef";; +esac +$rm -f try.c try : see if this is a varargs system echo " " @@ -2120,10 +2189,10 @@ fi echo " " if $test -r /usr/include/sys/dir.h ; then i_sysdir="$define" - echo "sysdir.h found." + echo "sys/dir.h found." else i_sysdir="$undef" - echo "No sysdir.h found." + echo "No sys/dir.h found." fi : see if ioctl defs are in sgtty/termio or sys/ioctl @@ -2136,6 +2205,27 @@ else echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h." fi +: see if this is a sys/ndir.h system +echo " " +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." +else + i_sysndir="$undef" + echo "No sys/ndir.h found." +fi + +: see if this is DG/UX with a funky utime.h +echo " " +if $test -r /usr/include/utime.h ; then + i_utime="$define" + echo "utime.h found." +else + i_utime="$undef" + echo "No utime.h found, but that's ok." +fi + : see if this is a varargs system echo " " if $test -r /usr/include/varargs.h ; then @@ -2347,6 +2437,21 @@ y*) mallocsrc='malloc.c'; mallocobj='malloc.o';; *) mallocsrc=''; mallocobj='';; esac +: determine compiler compiler +case "$yacc" in +'') dflt=yacc;; +*) dflt="$yacc";; +esac +cont=true + echo " " +rp="Which compiler compiler (yacc or bison) will you use? [$dflt]" +$echo $n "$rp $c" +. myread +case "$ans" in +'') ans="$dflt";; +esac +yacc="$ans" + echo " " echo "End of configuration questions." echo " " @@ -2439,6 +2544,7 @@ d_flock='$d_flock' d_getgrps='$d_getgrps' d_gethent='$d_gethent' d_getpgrp='$d_getpgrp' +d_getpgrp2='$d_getpgrp2' d_getprior='$d_getprior' d_htonl='$d_htonl' d_index='$d_index' @@ -2456,6 +2562,7 @@ d_rmdir='$d_rmdir' d_setegid='$d_setegid' d_seteuid='$d_seteuid' d_setpgrp='$d_setpgrp' +d_setpgrp2='$d_setpgrp2' d_setprior='$d_setprior' d_setregid='$d_setregid' d_setresgid='$d_setresgid' @@ -2470,12 +2577,9 @@ socketlib='$socketlib' d_statblks='$d_statblks' d_stdstdio='$d_stdstdio' d_strctcpy='$d_strctcpy' +d_strerror='$d_strerror' d_symlink='$d_symlink' d_syscall='$d_syscall' -d_tminsys='$d_tminsys' -i_systime='$i_systime' -i_timetoo='$i_timetoo' -i_systimetoo='$i_systimetoo' d_varargs='$d_varargs' d_vfork='$d_vfork' d_voidsig='$d_voidsig' @@ -2496,6 +2600,11 @@ d_pwclass='$d_pwclass' d_pwexpire='$d_pwexpire' i_sysdir='$i_sysdir' i_sysioctl='$i_sysioctl' +i_sysndir='$i_sysndir' +i_time='$i_time' +i_systime='$i_systime' +d_systimekernel='$d_systimekernel' +i_utime='$i_utime' i_varargs='$i_varargs' i_vfork='$i_vfork' intsize='$intsize' @@ -2530,8 +2639,9 @@ stdchar='$stdchar' uidtype='$uidtype' voidflags='$voidflags' defvoidused='$defvoidused' -lib='$lib' +yacc='$yacc' privlib='$privlib' +lib='$lib' CONFIG=true EOT @@ -2549,6 +2659,7 @@ case "$ans" in *) : in case they cannot read eval $ans;; esac +: if this fails, just run all the .SH files by hand . ./config.sh echo " " diff --git a/MANIFEST b/MANIFEST index edd1931..0472fa7 100644 --- a/MANIFEST +++ b/MANIFEST @@ -7,6 +7,7 @@ MANIFEST This list of files Makefile.SH Precursor to Makefile PACKINGLIST Which files came from which kits README The Instructions +README.uport Special instructions for Microports Wishlist Some things that may or may not happen arg.h Public declarations for the above array.c Numerically subscripted arrays diff --git a/Makefile.SH b/Makefile.SH index 1adbcfa..73890cb 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -25,9 +25,12 @@ esac echo "Extracting Makefile (with variable substitutions)" cat >Makefile <Makefile <.shlist # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE -perly.o $(obj): +$(obj): @ echo "You haven't done a "'"make depend" yet!'; exit 1 makedepend: makedepend.SH /bin/sh makedepend.SH diff --git a/README b/README index df96044..eea93d8 100644 --- a/README +++ b/README @@ -60,6 +60,27 @@ Installation This will attempt to make perl in the current directory. + If you can't compile successfully, try adding a -DCRIPPLED_CC flag. + (Just because you get no errors doesn't mean it compiled right!) + This simplifies some complicated expressions for compilers that + get indigestion easily. If that has no effect, try turning off + optimization. If you have missing routines, you probably need to + add some library or other, or you need to undefine some feature that + Configure thought was there but is defective or incomplete. + + Some compilers will not compile or optimize the larger files without + some extra switches to use larger jump offsets or allocate larger + internal tables. It's okay to insert rules for specific files into + Makefile.SH, since a default rule only take effect in the + absence of a specific rule. + + The 3b2 needs to turn off -O. + AIX/RT may need a -a switch and -DCRIPPLED_CC. + SGI machines may need -Ddouble="long float". + Ultrix (2.3) may need to hand assemble teval.s with a -J switch. + SCO Xenix may need -m25000 for yacc. + Genix needs to use libc rather than libc_s, or #undef VARARGS. + 5) make test This will run the regression tests on the perl you just made. @@ -88,7 +109,7 @@ Installation Context diffs are the best, then normal diffs. Don't send ed scripts-- I've probably changed my copy since the version you have. - Watch for perl patches in comp.sources.bugs. Patches will generally be + Watch for perl patches in comp.lang.perl. Patches will generally be in a form usable by the patch program. If you are just now bringing up perl and aren't sure how many patches there are, write to me and I'll send any you don't have. Your current patch level is shown in patchlevel.h. diff --git a/README.uport b/README.uport new file mode 100644 index 0000000..b2b5712 --- /dev/null +++ b/README.uport @@ -0,0 +1,34 @@ +From dwm@uf.msc.umn.edu Tue Dec 19 15:03:27 1989 +Subject: perl on Microport Un*x 2.4 + +Here are the steps to get perl patchlevel 6 running on Microport Un*x 2.4. + +(1) Get the directory routines (opendir, readdir, etc) from an archive + somewhere. I got mine from uunet: comp.sources.unix/volume9/gwyn-dir-lib + and comp.sources.unix/volume10/dir-lib.pch. Compile a large memory + version of the library and put it in /usr/lib/large/dir.a. Also put + the dir.h include file in /usr/include/sys. [ If you don't want to + do this make sure I_SYSDIR does not defined in config.sh ] + +(2) Configure causes sh to get a segmentation fault when it does the + ". config.sh" near line 2551. You will have to remove that line + from Configure and make sure you get your configuration info right + the first time or start over if you make a mistake. + +[Or just run the .SH files by hand and proceed to the make depend.] + +(3) If you are using C-shell, put a blank line at the start of Configure so it + wont get executed by the C-shell. If you are using ksh, you will have to + execute Configure with 'sh Configure'. Configure does not work with + ksh. + +(4) When you run Configure, select compilation option -DCRIPPLED_CC. + I also selected -DDEBUGGING to make debugging easier. I recommend it. + You can use -O, but you will then have to compile consarg.c and util.c + separately without -O because the optimizer generates bad code for these + routines. The optimizer also dies harmlessly while optimizing cmd.c, + eval.c (who can blame it? [sorry, Larry]), and toke.c. + I am still trying to isolate the remaining optimization problems in + consarg.c and util.c. + +[The rest of the previously published instructions are no longer necessary.] diff --git a/arg.h b/arg.h index ffeed2f..bb98ea7 100644 --- a/arg.h +++ b/arg.h @@ -1,4 +1,4 @@ -/* $Header: arg.h,v 3.0.1.1 89/10/26 23:02:35 lwall Locked $ +/* $Header: arg.h,v 3.0.1.2 89/12/21 19:13:14 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: arg.h,v $ + * Revision 3.0.1.2 89/12/21 19:13:14 lwall + * patch7: send() didn't allow a TO argument + * * Revision 3.0.1.1 89/10/26 23:02:35 lwall * patch1: reverse didn't work * @@ -815,7 +818,7 @@ char opargs[MAXO+1] = { A(1,1,0), /* CONNECT */ A(1,1,0), /* LISTEN */ A(1,1,0), /* ACCEPT */ - A(1,1,2), /* SEND */ + A(1,1,3), /* SEND */ A(1,1,1), /* RECV */ A(1,1,1), /* SSELECT */ A(1,1,1), /* SOCKETPAIR */ diff --git a/cmd.c b/cmd.c index c623d54..36c36bd 100644 --- a/cmd.c +++ b/cmd.c @@ -1,4 +1,4 @@ -/* $Header: cmd.c,v 3.0.1.3 89/11/17 15:04:36 lwall Locked $ +/* $Header: cmd.c,v 3.0.1.4 89/12/21 19:17:41 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: cmd.c,v $ + * Revision 3.0.1.4 89/12/21 19:17:41 lwall + * patch7: arranged for certain registers to be restored after longjmp() + * patch7: made nested or recursive foreach work right + * * Revision 3.0.1.3 89/11/17 15:04:36 lwall * patch5: nested foreach on same array didn't work * @@ -32,27 +36,30 @@ static STR str_chop; void grow_dlevel(); +/* do longjmps() clobber register variables? */ + +#if defined(cray) || defined(__STDC__) +#define JMPCLOBBER +#endif + /* This is the main command loop. We try to spend as much time in this loop * as possible, so lots of optimizations do their activities in here. This * means things get a little sloppy. */ int -cmd_exec(cmd,gimme,sp) -#ifdef cray /* nobody else has complained yet */ -CMD *cmd; -#else -register CMD *cmd; -#endif +cmd_exec(cmdparm,gimme,sp) +CMD *VOLATILE cmdparm; int gimme; int sp; { - SPAT *oldspat; - int oldsave; - int aryoptsave; + register CMD *cmd = cmdparm; + SPAT *VOLATILE oldspat; + VOLATILE int oldsave; + VOLATILE int aryoptsave; #ifdef DEBUGGING - int olddlevel; - int entdlevel; + VOLATILE int olddlevel; + VOLATILE int entdlevel; #endif register STR *retstr = &str_undef; register char *tmps; @@ -61,8 +68,8 @@ int sp; register char *go_to = goto_targ; register int newsp = -2; register STR **st = stack->ary_array; - FILE *fp; - ARRAY *ar; + VOLATILE FILE *fp; + VOLATILE ARRAY *ar; lastsize = 0; #ifdef DEBUGGING @@ -167,31 +174,48 @@ tail_recursion_entry: } #endif } - switch (setjmp(loop_stack[loop_ptr].loop_env)) { - case O_LAST: /* not done unless go_to found */ - go_to = Nullch; +#ifdef JMPCLOBBER + cmdparm = cmd; +#endif + if (match = setjmp(loop_stack[loop_ptr].loop_env)) { +#ifdef JMPCLOBBER st = stack->ary_array; /* possibly reallocated */ - if (lastretstr) { - retstr = lastretstr; - newsp = -2; - } - else { - newsp = sp + lastsize; - retstr = st[newsp]; - } + cmd = cmdparm; + cmdflags = cmd->c_flags|CF_ONCE; +#endif + switch (match) { + case O_LAST: /* not done unless go_to found */ + go_to = Nullch; + if (lastretstr) { + retstr = lastretstr; + newsp = -2; + } + else { + newsp = sp + lastsize; + retstr = st[newsp]; + } #ifdef DEBUGGING - olddlevel = dlevel; + olddlevel = dlevel; #endif - curspat = oldspat; - if (savestack->ary_fill > oldsave) - restorelist(oldsave); - goto next_cmd; - case O_NEXT: /* not done unless go_to found */ - go_to = Nullch; - goto next_iter; - case O_REDO: /* not done unless go_to found */ - go_to = Nullch; - goto doit; + curspat = oldspat; + if (savestack->ary_fill > oldsave) + restorelist(oldsave); + goto next_cmd; + case O_NEXT: /* not done unless go_to found */ + go_to = Nullch; +#ifdef JMPCLOBBER + newsp = -2; + retstr = &str_undef; +#endif + goto next_iter; + case O_REDO: /* not done unless go_to found */ + go_to = Nullch; +#ifdef JMPCLOBBER + newsp = -2; + retstr = &str_undef; +#endif + goto doit; + } } oldspat = curspat; oldsave = savestack->ary_fill; @@ -572,7 +596,7 @@ until_loop: newsp = eval(cmd->c_expr,gimme && (cmdflags & CF_TERM),sp); st = stack->ary_array; /* possibly reallocated */ retstr = st[newsp]; - if (newsp > sp) + if (newsp > sp && retstr) match = str_true(retstr); else match = FALSE; @@ -725,29 +749,46 @@ until_loop: } #endif } - switch (setjmp(loop_stack[loop_ptr].loop_env)) { - case O_LAST: - /* retstr = lastretstr; */ +#ifdef JMPCLOBBER + cmdparm = cmd; +#endif + if (match = setjmp(loop_stack[loop_ptr].loop_env)) { +#ifdef JMPCLOBBER st = stack->ary_array; /* possibly reallocated */ - if (lastretstr) { - retstr = lastretstr; + cmd = cmdparm; + cmdflags = cmd->c_flags|CF_ONCE; + go_to = goto_targ; +#endif + switch (match) { + case O_LAST: + if (lastretstr) { + retstr = lastretstr; + newsp = -2; + } + else { + newsp = sp + lastsize; + retstr = st[newsp]; + } + curspat = oldspat; + if (savestack->ary_fill > oldsave) + restorelist(oldsave); + goto next_cmd; + case O_NEXT: +#ifdef JMPCLOBBER newsp = -2; - } - else { - newsp = sp + lastsize; - retstr = st[newsp]; - } - curspat = oldspat; - if (savestack->ary_fill > oldsave) - restorelist(oldsave); - goto next_cmd; - case O_NEXT: - goto next_iter; - case O_REDO: + retstr = &str_undef; +#endif + goto next_iter; + case O_REDO: #ifdef DEBUGGING - dlevel = olddlevel; + dlevel = olddlevel; #endif - goto doit; +#ifdef JMPCLOBBER + newsp = -2; + retstr = &str_undef; +#endif + goto doit; + } } oldspat = curspat; oldsave = savestack->ary_fill; @@ -1010,6 +1051,7 @@ int maxsarg; str = Str_new(18,0); str_sset(str,sarg[i]); (void)apush(savestack,str); /* remember the value */ + sarg[i]->str_u.str_useful = -1; } } diff --git a/config.h.SH b/config.h.SH index ad19da7..af686c6 100644 --- a/config.h.SH +++ b/config.h.SH @@ -167,6 +167,12 @@ sed <config.h -e 's!^#undef!/\*#undef!' */ #$d_getpgrp GETPGRP /**/ +/* GETPGRP2: + * This symbol, if defined, indicates that the getpgrp2() (as in DG/UX) + * routine is available to get the current process group. + */ +#$d_getpgrp2 GETPGRP2 /**/ + /* GETPRIORITY: * This symbol, if defined, indicates that the getpriority() routine is * available to get a process's priority. @@ -294,6 +300,12 @@ sed <config.h -e 's!^#undef!/\*#undef!' */ #$d_setpgrp SETPGRP /**/ +/* SETPGRP2: + * This symbol, if defined, indicates that the setpgrp2() (as in DG/UX) + * routine is available to set the current process group. + */ +#$d_setpgrp2 SETPGRP2 /**/ + /* SETPRIORITY: * This symbol, if defined, indicates that the setpriority() routine is * available to set a process's priority. @@ -373,6 +385,12 @@ sed <config.h -e 's!^#undef!/\*#undef!' */ #$d_strctcpy STRUCTCOPY /**/ +/* STRERROR: + * This symbol, if defined, indicates that the strerror() routine is + * available to translate error numbers to strings. + */ +#$d_strerror STRERROR /**/ + /* SYMLINK: * This symbol, if defined, indicates that the symlink routine is available * to create symbolic links. @@ -385,28 +403,6 @@ sed <config.h -e 's!^#undef!/\*#undef!' */ #$d_syscall SYSCALL /**/ -/* TMINSYS: - * This symbol is defined if this system declares "struct tm" in - * in rather than . We can't just say - * -I/usr/include/sys because some systems have both time files, and - * the -I trick gets the wrong one. - */ -/* I_SYSTIME: - * This symbol is defined if this system has the file . - */ -/* I_TIMETOO: - * This symbol is defined if exists but doesn't include - * . - */ -/* I_SYSTIMETOO: - * This symbol is defined if exists but isn't included - * by . - */ -#$d_tminsys TMINSYS /**/ -#$i_systime I_SYSTIME /**/ -#$i_timetoo I_TIMETOO /**/ -#$i_systimetoo I_SYSTIMETOO /**/ - /* VARARGS: * This symbol, if defined, indicates to the C program that it should * include varargs.h. @@ -524,6 +520,32 @@ sed <config.h -e 's!^#undef!/\*#undef!' */ #$i_sysioctl I_SYSIOCTL /**/ +/* I_SYSNDIR: + * This symbol, if defined, indicates to the C program that it should + * include sys/ndir.h. + */ +#$i_sysndir I_SYSNDIR /**/ + +/* I_TIME: + * This symbol is defined if the program should include . + */ +/* I_SYSTIME: + * This symbol is defined if the program should include . + */ +/* I_SYSTIMEKERNEL: + * This symbol is defined if the program should include + * with KERNEL defined. + */ +#$i_time I_TIME /**/ +#$i_systime I_SYSTIME /**/ +#$d_systimekernel SYSTIMEKERNEL /**/ + +/* I_UTIME: + * This symbol, if defined, indicates to the C program that it should + * include utime.h (a DG/UX thingie). + */ +#$i_utime I_UTIME /**/ + /* I_VARARGS: * This symbol, if defined, indicates to the C program that it should * include varargs.h. diff --git a/lib/complete.pl b/lib/complete.pl index fd50674..334d539 100644 --- a/lib/complete.pl +++ b/lib/complete.pl @@ -24,14 +24,14 @@ sub Complete { local ($prompt) = shift (@_); local ($c, $cmp, $l, $r, $ret, $return, $test); - @_ = sort @_; + @_cmp_lst = sort @_; system 'stty raw -echo'; loop: { print $prompt, $return; while (($c = getc(stdin)) ne "\r") { if ($c eq "\t") { # (TAB) attempt completion @_match = (); - foreach $cmp (@_) { + foreach $cmp (@_cmp_lst) { push (@_match, $cmp) if $cmp =~ /^$return/; } $test = $_match[0]; @@ -50,7 +50,7 @@ sub Complete { } elsif ($c eq "\004") { # (^D) completion list print "\r\n"; - foreach $cmp (@_) { + foreach $cmp (@_cmp_lst) { print "$cmp\r\n" if $cmp =~ /^$return/; } redo loop; diff --git a/patchlevel.h b/patchlevel.h index fb8ed65..e19cd94 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1 +1 @@ -#define PATCHLEVEL 6 +#define PATCHLEVEL 7 diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH index 84ab66b..fec6548 100644 --- a/x2p/Makefile.SH +++ b/x2p/Makefile.SH @@ -18,11 +18,14 @@ case "$mallocsrc" in esac echo "Extracting x2p/Makefile (with variable substitutions)" cat >Makefile <Makefile < #include