diff options
author | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1989-10-26 10:31:40 +0000 |
---|---|---|
committer | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1989-10-26 10:31:40 +0000 |
commit | 03a14243eca2d4d041778dac4abcfa3a19c06a56 (patch) | |
tree | 0b50fc4dff9a7d56bb58af5bffcfeb7fa3cc49fa | |
parent | a687059cbaf2c6fdccb5e0fae2aee80ec15625a8 (diff) | |
download | perl-03a14243eca2d4d041778dac4abcfa3a19c06a56.tar.gz |
perl 3.0 patch #1 (combined patch)
Configure had difficulties if the user's path had weird components.
Now Configure appends the user's path to its own.
Some machines need <netinet/in.h> included in order to define
certain macros for packing or unpacking network order data.
On Suns, the shared library is used by default. If it doesn't
contain something contained in /lib/libc.a, then Configure was
getting things wrong (such as gethostent()). Now Configure uses
the shared library if it's there in preference to libc.a.
When gcc was selected as the compiler, the cc flags defaulted to
-fpcc_struct_return. Unfortunately, the underlines should be hyphens.
Configure figures out if BSD shadow passwords are installed and
the getpw* routines now return slightly different data in the
affected fields.
Some of the prompts in Configure with regard to gid and uid types
were unclear as to their intended use. They are now a little
clearer.
Sometimes you could change a .h file and taintperl and suidperl
didn't get remade correctly because of missing dependencies
in the Makefile.
The README file was misleading about the fact that you have to
say "make test" before you can "cd t; TEST"
The reverse operator was busted in two different ways. Should work
better now. There are now regression tests for it.
Some of the optimizations that perl does are disabled after period
of time if perl decides they aren't doing any good. One of these
caused a string to be freed that was later referenced via another
pointer, causing core dumps. The free turned out to be unnecessary,
so it was removed.
The unless modifier was broken when run under the debugger, due to
the invert() routine in perl.y inverting the logic on the DB
subroutine call instead of the command the unless was modifying.
Configure vfork test was backwards. It now works like other defines.
The numeric switch optimization was broken, and caused code to be
bypassed. This has been fixed.
A split in a subroutine that has no target splits into @_.
Unfortunately, this wrongly freed any referenced arguments passed
in through @_, causing confusing behavior later in the program.
File globbing (<foo.*>) left one orphaned string each time it
called the shell to do the glob.
RCS expanded an unintended $Header in lib/perldb.pl. This has
been fixed simply by replacing the $ with a .
Some forward declarations of static functions were missing from
malloc.c.
There's a strut in malloc for mips machines to extend the overhead
union to the size of a double. This was also enabled for sparc
machines.
DEC risc machines are reported to have a buggy memcmp. I've put
some conditional code into perl.h which I think will undef MEMCMP
appropriately.
In perl.man.4, I documented the desirability of using parens even
where they aren't strictly necessary.
I've grandfathered "format stdout" to be the same as "format STDOUT".
Unary operators can be called with no argument. The corresponding
function call form using empty parens () didn't work right, though
it did for certain functions in 2.0. It now works in 3.0.
The string ordering tests were wrong for pairs of strings in which
one string was a prefix of the other. This affected lt, le, gt,
ge, and the sort operator when used with no subroutine.
$/ didn't work with the stupid code used when STDSTDIO was undefined.
The stupid code has been replaced with smarter code that can do
it right. Special thanks to Piet van Oostrum for the code.
Goulds work better if the union in STR is at an 8 byte boundary.
The fields were rearranged somewhat to provide this.
"sort keys %a" should now work right (though parens are still
desirable for readability).
bcopy() needed a forward declaration on some machines.
In x2p/Makefile.SH, added dependency on ../config.sh so that it
gets linked down from above if it got removed for some reason.
-rwxr-xr-x | Configure | 67 | ||||
-rw-r--r-- | Makefile.SH | 49 | ||||
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | arg.h | 7 | ||||
-rw-r--r-- | cmd.c | 7 | ||||
-rw-r--r-- | cmd.h | 6 | ||||
-rw-r--r-- | config.h.SH | 28 | ||||
-rw-r--r-- | cons.c | 25 | ||||
-rw-r--r-- | doio.c | 17 | ||||
-rw-r--r-- | dolist.c | 17 | ||||
-rw-r--r-- | evalargs.xc | 6 | ||||
-rw-r--r-- | lib/perldb.pl | 7 | ||||
-rw-r--r-- | malloc.c | 10 | ||||
-rw-r--r-- | patchlevel.h | 2 | ||||
-rw-r--r-- | perl.h | 19 | ||||
-rw-r--r-- | perl.man.4 | 19 | ||||
-rw-r--r-- | perl.y | 18 | ||||
-rw-r--r-- | str.c | 34 | ||||
-rw-r--r-- | str.h | 9 | ||||
-rw-r--r-- | t/op.sort | 24 | ||||
-rw-r--r-- | toke.c | 15 | ||||
-rw-r--r-- | util.h | 10 | ||||
-rw-r--r-- | x2p/Makefile.SH | 9 |
23 files changed, 311 insertions, 99 deletions
@@ -8,14 +8,14 @@ # 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 89/10/18 15:04:55 lwall Locked $ +# $Header: Configure,v 3.0.1.1 89/10/26 22:58:02 lwall Locked $ # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than # working with this copy of Configure, you may wish to get metaconfig.) : sanity checks -PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin' +PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH" export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) if test ! -t 0; then @@ -157,6 +157,7 @@ i_dirent='' d_dirnamlen='' i_fcntl='' i_grp='' +i_niin='' i_pwd='' d_pwquota='' d_pwage='' @@ -424,7 +425,6 @@ Mcc cpp egrep test -uname " for file in $loclist; do xxx=`loc $file $file $pth` @@ -513,21 +513,17 @@ esac rmlist="$rmlist loc" : get list of predefined functions in a handy place -if $test -n "$uname"; then - os=`$uname -s` -else - os=unknown -fi echo " " -if test -f /lib/libc.a; then +set /usr/lib/libc.so.[0-9]* +eval set \$$# +if test -f "$1"; then + echo "Your shared C library is in $1." + libc="$1" +elif test -f /lib/libc.a; then echo "Your C library is in /lib/libc.a. You're normal." libc=/lib/libc.a else - if test "$os" = DomainOS ; then - ans=`loc libc blurfl/dyick $libpth` - else - ans=`loc libc.a blurfl/dyick $libpth` - fi + ans=`loc libc.a blurfl/dyick $libpth` if test ! -f "$ans"; then ans=`loc clib blurfl/dyick $libpth` fi @@ -573,11 +569,9 @@ $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list if $contains '^printf$' libc.list >/dev/null 2>&1; then echo "done" else - if test "$os" = DomainOS ; then - $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list - else + $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list + $contains '^printf$' libc.list >/dev/null 2>&1 || \ $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list - fi $contains '^printf$' libc.list >/dev/null 2>&1 || \ $sed -n -e 's/^_//' \ -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list @@ -1102,7 +1096,7 @@ esac case "$ccflags" in '') case "$cc" in - gcc) dflt='-fpcc_struct_return';; + gcc) dflt='-fpcc-struct-return';; *) dflt='none';; esac ;; @@ -1553,7 +1547,7 @@ else echo "dbm.h not found." fi -: see if this is an pwd system +: see if this is a pwd system echo " " if $test -r /usr/include/pwd.h ; then i_pwd="$define" @@ -1568,10 +1562,28 @@ if $test -r /usr/include/pwd.h ; then else d_pwage="$undef" fi + if $contains 'pw_change' /usr/include/pwd.h >/dev/null 2>&1; then + d_pwchange="$define" + else + d_pwchange="$undef" + fi + if $contains 'pw_class' /usr/include/pwd.h >/dev/null 2>&1; then + d_pwclass="$define" + else + d_pwclass="$undef" + fi + if $contains 'pw_expire' /usr/include/pwd.h >/dev/null 2>&1; then + d_pwexpire="$define" + else + d_pwexpire="$undef" + fi else i_pwd="$undef" d_pwquota="$undef" d_pwage="$undef" + d_pwchange="$undef" + d_pwclass="$undef" + d_pwexpire="$undef" echo "No pwd.h found." fi @@ -1868,7 +1880,7 @@ case "$gidtype" in esac cont=true echo " " -rp="What type are group ids on this system declared as? [$dflt]" +rp="What type are the group ids are returned by getgroups()? [$dflt]" $echo $n "$rp $c" . myread gidtype="$ans" @@ -1893,6 +1905,16 @@ else echo "No grp.h found." fi +: see if this is a netinet/in.h system +echo " " +if $test -r /usr/include/netinet/in.h ; then + i_niin="$define" + echo "netinet/in.h found." +else + i_niin="$undef" + echo "No netinet/in.h found." +fi + : see if this is a sys/dir.h system echo " " if $test -r /usr/include/sys/dir.h ; then @@ -2070,7 +2092,7 @@ case "$uidtype" in esac cont=true echo " " -rp="What type are user ids on this system declared as? [$dflt]" +rp="What type are user ids returned by getuid(), etc.? [$dflt]" $echo $n "$rp $c" . myread uidtype="$ans" @@ -2307,6 +2329,7 @@ i_dirent='$i_dirent' d_dirnamlen='$d_dirnamlen' i_fcntl='$i_fcntl' i_grp='$i_grp' +i_niin='$i_niin' i_pwd='$i_pwd' d_pwquota='$d_pwquota' d_pwage='$d_pwage' diff --git a/Makefile.SH b/Makefile.SH index 6e66a4c7ed..6cb270f133 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -25,9 +25,12 @@ esac echo "Extracting Makefile (with variable substitutions)" cat >Makefile <<!GROK!THIS! -# $Header: Makefile.SH,v 3.0 89/10/18 15:06:43 lwall Locked $ +# $Header: Makefile.SH,v 3.0.1.1 89/10/26 23:00:38 lwall Locked $ # # $Log: Makefile.SH,v $ +# Revision 3.0.1.1 89/10/26 23:00:38 lwall +# patch1: Makefile.SH needed some more .h dependecies +# # Revision 3.0 89/10/18 15:06:43 lwall # 3.0 baseline # @@ -125,122 +128,121 @@ taintperl: tperl.o tperly.o $(tobj) # Replicating all this junk is yucky, but I don't see a portable way to fix it. -tperl.o: perl.c perly.h perl.h EXTERN.h regexp.h util.h INTERN.h handy.h \ - config.h stab.h +tperl.o: perl.c perly.h $(h) /bin/rm -f tperl.c $(SLN) perl.c tperl.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperl.c /bin/rm -f tperl.c -tperly.o: perly.c +tperly.o: perly.c perly.h $(h) /bin/rm -f tperly.c $(SLN) perly.c tperly.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperly.c /bin/rm -f tperly.c -sperly.o: perly.c perl.h handy.h perly.h patchlevel.h +sperly.o: perly.c perly.h patchlevel.h $(h) /bin/rm -f sperly.c $(SLN) perly.c sperly.c $(CC) -c -DTAINT -DIAMSUID $(CFLAGS) $(LARGE) sperly.c /bin/rm -f sperly.c -tarray.o: array.c +tarray.o: array.c $(h) /bin/rm -f tarray.c $(SLN) array.c tarray.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tarray.c /bin/rm -f tarray.c -tcmd.o: cmd.c +tcmd.o: cmd.c $(h) /bin/rm -f tcmd.c $(SLN) cmd.c tcmd.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcmd.c /bin/rm -f tcmd.c -tcons.o: cons.c +tcons.o: cons.c $(h) /bin/rm -f tcons.c $(SLN) cons.c tcons.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcons.c /bin/rm -f tcons.c -tconsarg.o: consarg.c +tconsarg.o: consarg.c $(h) /bin/rm -f tconsarg.c $(SLN) consarg.c tconsarg.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tconsarg.c /bin/rm -f tconsarg.c -tdoarg.o: doarg.c +tdoarg.o: doarg.c $(h) /bin/rm -f tdoarg.c $(SLN) doarg.c tdoarg.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoarg.c /bin/rm -f tdoarg.c -tdoio.o: doio.c +tdoio.o: doio.c $(h) /bin/rm -f tdoio.c $(SLN) doio.c tdoio.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoio.c /bin/rm -f tdoio.c -tdolist.o: dolist.c +tdolist.o: dolist.c $(h) /bin/rm -f tdolist.c $(SLN) dolist.c tdolist.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdolist.c /bin/rm -f tdolist.c -tdump.o: dump.c +tdump.o: dump.c $(h) /bin/rm -f tdump.c $(SLN) dump.c tdump.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdump.c /bin/rm -f tdump.c -teval.o: eval.c +teval.o: eval.c $(h) /bin/rm -f teval.c $(SLN) eval.c teval.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) teval.c /bin/rm -f teval.c -tform.o: form.c +tform.o: form.c $(h) /bin/rm -f tform.c $(SLN) form.c tform.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tform.c /bin/rm -f tform.c -thash.o: hash.c +thash.o: hash.c $(h) /bin/rm -f thash.c $(SLN) hash.c thash.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) thash.c /bin/rm -f thash.c -tregcomp.o: regcomp.c +tregcomp.o: regcomp.c $(h) /bin/rm -f tregcomp.c $(SLN) regcomp.c tregcomp.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregcomp.c /bin/rm -f tregcomp.c -tregexec.o: regexec.c +tregexec.o: regexec.c $(h) /bin/rm -f tregexec.c $(SLN) regexec.c tregexec.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregexec.c /bin/rm -f tregexec.c -tstab.o: stab.c +tstab.o: stab.c $(h) /bin/rm -f tstab.c $(SLN) stab.c tstab.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstab.c /bin/rm -f tstab.c -tstr.o: str.c +tstr.o: str.c $(h) /bin/rm -f tstr.c $(SLN) str.c tstr.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstr.c /bin/rm -f tstr.c -ttoke.o: toke.c +ttoke.o: toke.c $(h) /bin/rm -f ttoke.c $(SLN) toke.c ttoke.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) ttoke.c /bin/rm -f ttoke.c -tutil.o: util.c +tutil.o: util.c $(h) /bin/rm -f tutil.c $(SLN) util.c tutil.c $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tutil.c @@ -252,8 +254,7 @@ perl.c perly.h: perl.y mv y.tab.c perl.c mv y.tab.h perly.h -perl.o: perl.c perly.h perl.h EXTERN.h regexp.h util.h INTERN.h handy.h \ - config.h arg.h stab.h +perl.o: perl.c perly.h $(h) $(CC) -c $(CFLAGS) $(LARGE) perl.c perl.man: perl.man.1 perl.man.2 perl.man.3 perl.man.4 patchlevel.h perl @@ -65,8 +65,9 @@ Installation This will run the regression tests on the perl you just made. If it doesn't say "All tests successful" then something went wrong. See the README in the t subdirectory. Note that you can't run it - in background if this disables opening of /dev/tty. If in doubt, just - cd to the t directory and run TEST by hand. + in background if this disables opening of /dev/tty. If "make test" + bombs out, just cd to the t directory and run TEST by hand to see if + it makes any difference. 6) make install @@ -1,4 +1,4 @@ -/* $Header: arg.h,v 3.0 89/10/18 15:08:27 lwall Locked $ +/* $Header: arg.h,v 3.0.1.1 89/10/26 23:02:35 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.1 89/10/26 23:02:35 lwall + * patch1: reverse didn't work + * * Revision 3.0 89/10/18 15:08:27 lwall * 3.0 baseline * @@ -805,7 +808,7 @@ char opargs[MAXO+1] = { A(3,3,0), /* AASSIGN */ A(0,0,0), /* SASSIGN */ A(0,0,0), /* DUMP */ - A(0,0,0), /* REVERSE */ + A(0,3,0), /* REVERSE */ A(1,0,0), /* ADDROF */ A(1,1,1), /* SOCKET */ A(1,1,0), /* BIND */ @@ -1,4 +1,4 @@ -/* $Header: cmd.c,v 3.0 89/10/18 15:09:02 lwall Locked $ +/* $Header: cmd.c,v 3.0.1.1 89/10/26 23:04:21 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: cmd.c,v $ + * Revision 3.0.1.1 89/10/26 23:04:21 lwall + * patch1: heuristically disabled optimization could cause core dump + * * Revision 3.0 89/10/18 15:09:02 lwall * 3.0 baseline * @@ -416,8 +419,6 @@ until_loop: } } if (--cmd->c_short->str_u.str_useful < 0) { - str_free(cmd->c_short); - cmd->c_short = Nullstr; cmdflags &= ~CF_OPTIMIZE; cmdflags |= CFT_EVAL; /* never try this optimization again */ cmd->c_flags = cmdflags; @@ -1,4 +1,4 @@ -/* $Header: cmd.h,v 3.0 89/10/18 15:09:15 lwall Locked $ +/* $Header: cmd.h,v 3.0.1.1 89/10/26 23:05:43 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: cmd.h,v $ + * Revision 3.0.1.1 89/10/26 23:05:43 lwall + * patch1: unless was broken when run under the debugger + * * Revision 3.0 89/10/18 15:09:15 lwall * 3.0 baseline * @@ -53,6 +56,7 @@ char *cmdname[] = { #define CF_ONCE 010000 /* we've already pushed the label on the stack */ #define CF_FLIP 020000 /* on a match do flipflop */ #define CF_TERM 040000 /* value of this cmd might be returned */ +#define CF_DBSUB 0100000 /* this is an inserted cmd for debugging */ #define CFT_FALSE 0 /* c_expr is always false */ #define CFT_TRUE 1 /* c_expr is always true */ diff --git a/config.h.SH b/config.h.SH index 5cf8ad1257..7d069a23ef 100644 --- a/config.h.SH +++ b/config.h.SH @@ -385,11 +385,10 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!' */ #$d_varargs VARARGS /**/ -/* vfork: - * This symbol, if defined, remaps the vfork routine to fork if the - * vfork() routine isn't supported here. +/* VFORK: + * This symbol, if defined, indicates that vfork() exists. */ -#$d_vfork vfork fork /**/ +#$d_vfork VFORK /**/ /* VOIDSIG: * This symbol is defined if this system declares "void (*signal())()" in @@ -443,6 +442,12 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!' */ #$i_grp I_GRP /**/ +/* I_NETINET_IN: + * This symbol, if defined, indicates to the C program that it should + * include netinet/in.h. + */ +#$i_niin I_NETINET_IN /**/ + /* I_PWD: * This symbol, if defined, indicates to the C program that it should * include pwd.h. @@ -455,9 +460,24 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!' * This symbol, if defined, indicates to the C program that struct passwd * contains pw_age. */ +/* PWCHANGE: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_change. + */ +/* PWCLASS: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_class. + */ +/* PWEXPIRE: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_expire. + */ #$i_pwd I_PWD /**/ #$d_pwquota PWQUOTA /**/ #$d_pwage PWAGE /**/ +#$d_pwage PWCHANGE /**/ +#$d_pwage PWCLASS /**/ +#$d_pwage PWEXPIRE /**/ /* I_SYSDIR: * This symbol, if defined, indicates to the C program that it should @@ -1,4 +1,4 @@ -/* $Header: cons.c,v 3.0 89/10/18 15:10:23 lwall Locked $ +/* $Header: cons.c,v 3.0.1.1 89/10/26 23:09: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: cons.c,v $ + * Revision 3.0.1.1 89/10/26 23:09:01 lwall + * patch1: numeric switch optimization was broken + * patch1: unless was broken when run under the debugger + * * Revision 3.0 89/10/18 15:10:23 lwall * 3.0 baseline * @@ -285,11 +289,11 @@ int count; Newz(105,loc, max - min + 3, CMD*); loc++; + max -= min; + max++; while (count--) { i = (int)str_gnum(cur->c_short); i -= min; - max -= min; - max++; switch(cur->c_slen) { case O_LE: i++; @@ -314,6 +318,7 @@ int count; } loc--; min--; + max++; for (i = 0; i <= max; i++) if (!loc[i]) loc[i] = cur; @@ -378,7 +383,7 @@ CMD *cur; stab2arg(A_WORD,DBstab), make_list(arg), Nullarg); - cmd->c_flags |= CF_COND; + cmd->c_flags |= CF_COND|CF_DBSUB; cmd->c_line = head->c_line; cmd->c_label = head->c_label; cmd->c_file = filename; @@ -797,12 +802,14 @@ register ARG *arg; CMD * invert(cmd) -register CMD *cmd; +CMD *cmd; { - if (cmd->c_head) - cmd->c_head->c_flags ^= CF_INVERT; - else - cmd->c_flags ^= CF_INVERT; + register CMD *targ = cmd; + if (targ->c_head) + targ = targ->c_head; + if (targ->c_flags & CF_DBSUB) + targ = targ->c_next; + targ->c_flags ^= CF_INVERT; return cmd; } @@ -1,4 +1,4 @@ -/* $Header: doio.c,v 3.0 89/10/18 15:10:54 lwall Locked $ +/* $Header: doio.c,v 3.0.1.1 89/10/26 23:10:05 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.1 89/10/26 23:10:05 lwall + * patch1: Configure now checks for BSD shadow passwords + * * Revision 3.0 89/10/18 15:10:54 lwall * 3.0 baseline * @@ -1580,6 +1583,9 @@ int *arglast; (void)astore(ary, ++sp, str = str_static(&str_no)); str_numset(str, (double)pwent->pw_gid); (void)astore(ary, ++sp, str = str_static(&str_no)); +#ifdef PWCHANGE + str_numset(str, (double)pwent->pw_change); +#else #ifdef PWQUOTA str_numset(str, (double)pwent->pw_quota); #else @@ -1587,14 +1593,23 @@ int *arglast; str_set(str, pwent->pw_age); #endif #endif +#endif (void)astore(ary, ++sp, str = str_static(&str_no)); +#ifdef PWCLASS + str_set(str,pwent->pw_class); +#else str_set(str, pwent->pw_comment); +#endif (void)astore(ary, ++sp, str = str_static(&str_no)); str_set(str, pwent->pw_gecos); (void)astore(ary, ++sp, str = str_static(&str_no)); str_set(str, pwent->pw_dir); (void)astore(ary, ++sp, str = str_static(&str_no)); str_set(str, pwent->pw_shell); +#ifdef PWEXPIRE + (void)astore(ary, ++sp, str = str_static(&str_no)); + str_numset(str, (double)pwent->pw_expire); +#endif } return sp; @@ -1,4 +1,4 @@ -/* $Header: dolist.c,v 3.0 89/10/18 15:11:02 lwall Locked $ +/* $Header: dolist.c,v 3.0.1.1 89/10/26 23:11:51 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: dolist.c,v $ + * Revision 3.0.1.1 89/10/26 23:11:51 lwall + * patch1: split in a subroutine wrongly freed referenced arguments + * patch1: reverse didn't work + * * Revision 3.0 89/10/18 15:11:02 lwall * 3.0 baseline * @@ -285,8 +289,12 @@ int *arglast; #endif ary = stab_xarray(spat->spat_repl[1].arg_ptr.arg_stab); if (ary && ((ary->ary_flags & ARF_REAL) || gimme != G_ARRAY)) { - ary->ary_flags |= ARF_REAL; realarray = 1; + if (!(ary->ary_flags & ARF_REAL)) { + ary->ary_flags |= ARF_REAL; + for (i = ary->ary_fill; i >= 0; i--) + ary->ary_array[i] = Nullstr; /* don't free mere refs */ + } ary->ary_fill = -1; sp = -1; /* temporarily switch stacks */ } @@ -754,8 +762,11 @@ int *arglast; } while (i-- > 0) { *up++ = *down; - *down-- = *up; + if (i-- > 0) + *down-- = *up; } + i = arglast[2] - arglast[1]; + Copy(down+1,up,i/2,STR*); return arglast[2] - 1; } diff --git a/evalargs.xc b/evalargs.xc index b9d4a26409..d2b7c64a00 100644 --- a/evalargs.xc +++ b/evalargs.xc @@ -2,9 +2,12 @@ * kit sizes from getting too big. */ -/* $Header: evalargs.xc,v 3.0 89/10/18 15:17:16 lwall Locked $ +/* $Header: evalargs.xc,v 3.0.1.1 89/10/26 23:12:55 lwall Locked $ * * $Log: evalargs.xc,v $ + * Revision 3.0.1.1 89/10/26 23:12:55 lwall + * patch1: glob didn't free a temporary string + * * Revision 3.0 89/10/18 15:17:16 lwall * 3.0 baseline * @@ -275,6 +278,7 @@ } (void)do_open(last_in_stab,tmpstr->str_ptr); fp = stab_io(last_in_stab)->ifp; + str_free(tmpstr); } } } diff --git a/lib/perldb.pl b/lib/perldb.pl index 51f6c24e11..7b3e0aad7a 100644 --- a/lib/perldb.pl +++ b/lib/perldb.pl @@ -1,6 +1,6 @@ package DB; -$header = '$Header: perldb.pl,v 3.0 89/10/18 15:19:46 lwall Locked $'; +$header = '$Header: perldb.pl,v 3.0.1.1 89/10/26 23:14:02 lwall Locked $'; # # This file is automatically included if you do perl -d. # It's probably not useful to include this yourself. @@ -10,6 +10,9 @@ $header = '$Header: perldb.pl,v 3.0 89/10/18 15:19:46 lwall Locked $'; # have a breakpoint. It also inserts a do 'perldb.pl' before the first line. # # $Log: perldb.pl,v $ +# Revision 3.0.1.1 89/10/26 23:14:02 lwall +# patch1: RCS expanded an unintended $Header in lib/perldb.pl +# # Revision 3.0 89/10/18 15:19:46 lwall # 3.0 baseline # @@ -25,7 +28,7 @@ $| = 1; # for DB'OUT select(STDOUT); $| = 1; # for real STDOUT -$header =~ s/\$Header: perldb.pl,v 3.0 89/10/18 15:19:46 lwall Locked $/$1$2/; +$header =~ s/.Header: ([^,]+),v(\s+\S+\s+\S+).*$/$1$2/; print OUT "\nLoading DB from $header\n\n"; sub DB { @@ -1,6 +1,10 @@ -/* $Header: malloc.c,v 3.0 89/10/18 15:20:39 lwall Locked $ +/* $Header: malloc.c,v 3.0.1.1 89/10/26 23:15:05 lwall Locked $ * * $Log: malloc.c,v $ + * Revision 3.0.1.1 89/10/26 23:15:05 lwall + * patch1: some declarations were missing from malloc.c + * patch1: sparc machines had alignment problems in malloc.c + * * Revision 3.0 89/10/18 15:20:39 lwall * 3.0 baseline * @@ -27,6 +31,8 @@ static char sccsid[] = "@(#)malloc.c 4.3 (Berkeley) 9/16/83"; #include "EXTERN.h" #include "perl.h" +static findbucket(), morecore(); + /* I don't much care whether these are defined in sys/types.h--LAW */ #define u_char unsigned char @@ -44,7 +50,7 @@ static char sccsid[] = "@(#)malloc.c 4.3 (Berkeley) 9/16/83"; */ union overhead { union overhead *ov_next; /* when free */ -#ifdef mips +#if defined (mips) || defined (sparc) double strut; /* alignment problems */ #endif struct { diff --git a/patchlevel.h b/patchlevel.h index 935ec354b7..110c86f392 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1 +1 @@ -#define PATCHLEVEL 0 +#define PATCHLEVEL 1 @@ -1,4 +1,4 @@ -/* $Header: perl.h,v 3.0 89/10/18 15:21:21 lwall Locked $ +/* $Header: perl.h,v 3.0.1.1 89/10/26 23:17:08 lwall Locked $ * * Copyright (c) 1989, Larry Wall * @@ -6,6 +6,11 @@ * as specified in the README file that comes with the perl 3.0 kit. * * $Log: perl.h,v $ + * Revision 3.0.1.1 89/10/26 23:17:08 lwall + * patch1: vfork now conditionally defined based on VFORK + * patch1: DEC risc machines have a buggy memcmp + * patch1: perl.h now includes <netinet/in.h> if it exists + * * Revision 3.0 89/10/18 15:21:21 lwall * 3.0 baseline * @@ -24,6 +29,14 @@ # endif #endif +#ifndef VFORK +# define vfork fork +#endif + +#if defined(MEMCMP) && defined(mips) && BYTEORDER == 01234 +#undef MEMCMP +#endif + #ifdef MEMCPY extern char *memcpy(), *memset(); #define bcopy(s1,s2,l) memcpy(s2,s1,l) @@ -38,6 +51,10 @@ extern char *memcpy(), *memset(); #include <setjmp.h> #include <sys/param.h> /* if this needs types.h we're still wrong */ +#ifdef I_NETINET_IN +#include <netinet/in.h> +#endif + #ifndef _TYPES_ /* If types.h defines this it's easy. */ #ifndef major /* Does everyone's types.h define this? */ #include <sys/types.h> diff --git a/perl.man.4 b/perl.man.4 index 953ca8be47..af423de2cc 100644 --- a/perl.man.4 +++ b/perl.man.4 @@ -1,7 +1,10 @@ ''' Beginning of part 4 -''' $Header: perl.man.4,v 3.0 89/10/18 15:21:55 lwall Locked $ +''' $Header: perl.man.4,v 3.0.1.1 89/10/26 23:18:43 lwall Locked $ ''' ''' $Log: perl.man.4,v $ +''' Revision 3.0.1.1 89/10/26 23:18:43 lwall +''' patch1: documented the desirability of unnecessary parentheses +''' ''' Revision 3.0 89/10/18 15:21:55 lwall ''' 3.0 baseline ''' @@ -992,6 +995,18 @@ doesn't mean that you have to make use of the defaults. The defaults are there for lazy systems programmers writing one-shot programs. If you want your program to be readable, consider supplying the argument. +.Sp +Along the same lines, just because you +.I can +omit parentheses in many places doesn't mean that you ought to: +.nf + + return print reverse sort num values array; + return print(reverse(sort num (values(%array)))); + +.fi +When in doubt, parenthesize. +At the very least it will let some poor schmuck bounce on the % key in vi. .Ip 2. 4 4 Don't go through silly contortions to exit a loop at the top or the bottom, when @@ -1017,6 +1032,8 @@ See last example. .Ip 6. 4 4 For portability, when using features that may not be implemented on every machine, test the construct in an eval to see if it fails. +If you know what version or patchlevel a particular feature was implemented, +you can test $] to see if it will be there. .Ip 4. 4 4 Choose mnemonic indentifiers. .Ip 5. 4 4 @@ -1,4 +1,4 @@ -/* $Header: perl.y,v 3.0 89/10/18 15:22:04 lwall Locked $ +/* $Header: perl.y,v 3.0.1.1 89/10/26 23:20: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: perl.y,v $ + * Revision 3.0.1.1 89/10/26 23:20:41 lwall + * patch1: grandfathered "format stdout" + * patch1: operator(); is now normally equivalent to operator; + * * Revision 3.0 89/10/18 15:22:04 lwall * 3.0 baseline * @@ -276,7 +280,13 @@ decl : format ; format : FORMAT WORD '=' FORMLIST - { stab_form(stabent($2,TRUE)) = $4; Safefree($2);} + { if (strEQ($2,"stdout")) + stab_form(stabent("STDOUT",TRUE)) = $4; + else if (strEQ($2,"stderr")) + stab_form(stabent("STDERR",TRUE)) = $4; + else + stab_form(stabent($2,TRUE)) = $4; + Safefree($2);} | FORMAT '=' FORMLIST { stab_form(stabent("STDOUT",TRUE)) = $3; } ; @@ -632,6 +642,10 @@ term : '-' term %prec UMINUS Nullarg, Nullarg)); } | FUNC0 { $$ = make_op($1, 0, Nullarg, Nullarg, Nullarg); } + | FUNC1 '(' ')' + { $$ = make_op($1, 1, Nullarg, Nullarg, Nullarg); + if ($1 == O_EVAL || $1 == O_RESET) + $$ = fixeval($$); } | FUNC1 '(' expr ')' { $$ = make_op($1, 1, $3, Nullarg, Nullarg); if ($1 == O_EVAL || $1 == O_RESET) @@ -1,4 +1,4 @@ -/* $Header: str.c,v 3.0 89/10/18 15:23:38 lwall Locked $ +/* $Header: str.c,v 3.0.1.1 89/10/26 23:23: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: str.c,v $ + * Revision 3.0.1.1 89/10/26 23:23:41 lwall + * patch1: string ordering tests were wrong + * patch1: $/ now works even when STDSTDIO undefined + * * Revision 3.0 89/10/18 15:23:38 lwall * 3.0 baseline * @@ -604,14 +608,14 @@ register STR *str2; if (retval = memcmp(str1->str_ptr, str2->str_ptr, str1->str_cur)) return retval; else - return 1; + return -1; } else if (retval = memcmp(str1->str_ptr, str2->str_ptr, str2->str_cur)) return retval; else if (str1->str_cur == str2->str_cur) return 0; else - return -1; + return 1; } char * @@ -620,8 +624,6 @@ register STR *str; register FILE *fp; int append; { -#ifdef STDSTDIO /* Here is some breathtakingly efficient cheating */ - register char *bp; /* we're going to steal some values */ register int cnt; /* from the stdio struct and put EVERYTHING */ register STDCHAR *ptr; /* in the innermost loop into registers */ @@ -636,6 +638,8 @@ int append; newline = '\n'; oldbp = Nullch; /* remember last \n position (none) */ } +#ifdef STDSTDIO /* Here is some breathtakingly efficient cheating */ + cnt = fp->_cnt; /* get count into register */ str->str_nok = 0; /* invalidate number */ str->str_pok = 1; /* validate pointer */ @@ -686,16 +690,28 @@ thats_really_all_folks: #else /* !STDSTDIO */ /* The big, slow, and stupid way */ - static char buf[8192]; + { + static char buf[8192]; + char * bpe = buf + sizeof(buf) - 3; + +screamer: + bp = buf; +filler: + while ((i = getc(fp)) != EOF && (*bp++ = i) != newline && bp < bpe); + if (i == newline && get_paragraph && + (i = getc(fp)) != EOF && (*bp++ = i) != newline && bp < bpe) + goto filler; - if (fgets(buf, sizeof buf, fp) != Nullch) { + *bp = '\0'; if (append) str_cat(str, buf); else str_set(str, buf); + if (i != newline && i != EOF) { + append = -1; + goto screamer; + } } - else - str_set(str, No); #endif /* STDSTDIO */ @@ -1,4 +1,4 @@ -/* $Header: str.h,v 3.0 89/10/18 15:23:49 lwall Locked $ +/* $Header: str.h,v 3.0.1.1 89/10/26 23:24:42 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: str.h,v $ + * Revision 3.0.1.1 89/10/26 23:24:42 lwall + * patch1: rearranged some structures to align doubles better on Gould + * * Revision 3.0 89/10/18 15:23:49 lwall * 3.0 baseline * @@ -13,6 +16,7 @@ struct string { char * str_ptr; /* pointer to malloced string */ + int str_len; /* allocated size */ union { double str_nval; /* numeric value, if any */ STAB *str_stab; /* magic stab for magic "key" string */ @@ -21,7 +25,6 @@ struct string { HASH *str_hash; /* string represents an assoc array (stab?) */ ARRAY *str_array; /* string represents an array */ } str_u; - int str_len; /* allocated size */ int str_cur; /* length of str_ptr as a C string */ STR *str_magic; /* while free, link to next free str */ /* while in use, ptr to "key" for magic items */ @@ -37,6 +40,7 @@ struct string { struct stab { /* should be identical, except for str_ptr */ STBP * str_ptr; /* pointer to malloced string */ + int str_len; /* allocated size */ union { double str_nval; /* numeric value, if any */ STAB *str_stab; /* magic stab for magic "key" string */ @@ -45,7 +49,6 @@ struct stab { /* should be identical, except for str_ptr */ HASH *str_hash; /* string represents an assoc array (stab?) */ ARRAY *str_array; /* string represents an array */ } str_u; - int str_len; /* allocated size */ int str_cur; /* length of str_ptr as a C string */ STR *str_magic; /* while free, link to next free str */ /* while in use, ptr to "key" for magic items */ @@ -1,8 +1,8 @@ #!./perl -# $Header: op.sort,v 3.0 89/10/18 15:31:19 lwall Locked $ +# $Header: op.sort,v 3.0.1.1 89/10/26 23:25:37 lwall Locked $ -print "1..3\n"; +print "1..8\n"; sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; } @@ -17,3 +17,23 @@ print ($x eq 'xdogcatCainAbel' ? "ok 2\n" : "not ok 2\n"); $x = join('', sort @george, 'to', @harry); print ($x eq 'AbelAxedCainPunishedcatchaseddoggonetoxyz'?"ok 3\n":"not ok 3\n"); + +@a = (); +@b = reverse @a; +print ("@b" eq "" ? "ok 4\n" : "not ok 4 (@b)\n"); + +@a = (1); +@b = reverse @a; +print ("@b" eq "1" ? "ok 5\n" : "not ok 5 (@b)\n"); + +@a = (1,2); +@b = reverse @a; +print ("@b" eq "2 1" ? "ok 6\n" : "not ok 6 (@b)\n"); + +@a = (1,2,3); +@b = reverse @a; +print ("@b" eq "3 2 1" ? "ok 7\n" : "not ok 7 (@b)\n"); + +@a = (1,2,3,4); +@b = reverse @a; +print ("@b" eq "4 3 2 1" ? "ok 8\n" : "not ok 8 (@b)\n"); @@ -1,4 +1,4 @@ -/* $Header: toke.c,v 3.0 89/10/18 15:32:33 lwall Locked $ +/* $Header: toke.c,v 3.0.1.1 89/10/26 23:26:21 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: toke.c,v $ + * Revision 3.0.1.1 89/10/26 23:26:21 lwall + * patch1: disambiguated word after "sort" better + * * Revision 3.0 89/10/18 15:32:33 lwall * 3.0 baseline * @@ -865,7 +868,15 @@ yylex() fatal("sort is now a reserved word"); if (isascii(*s) && (isalpha(*s) || *s == '_')) { for (d = s; isalpha(*d) || isdigit(*d) || *d == '_'; d++) ; - if (d >= bufend || isspace(*d)) + strncpy(tokenbuf,s,d-s); + if (strNE(tokenbuf,"keys") && + strNE(tokenbuf,"values") && + strNE(tokenbuf,"split") && + strNE(tokenbuf,"grep") && + strNE(tokenbuf,"readdir") && + strNE(tokenbuf,"unpack") && + strNE(tokenbuf,"do") && + (d >= bufend || isspace(*d)) ) *(--s) = '\\'; /* force next ident to WORD */ } LOP(O_SORT); @@ -1,4 +1,4 @@ -/* $Header: util.h,v 3.0 89/10/18 15:33:18 lwall Locked $ +/* $Header: util.h,v 3.0.1.1 89/10/26 23:28:25 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: util.h,v $ + * Revision 3.0.1.1 89/10/26 23:28:25 lwall + * patch1: declared bcopy if necessary + * * Revision 3.0 89/10/18 15:33:18 lwall * 3.0 baseline * @@ -30,3 +33,8 @@ char *rninstr(); char *nsavestr(); FILE *mypopen(); int mypclose(); +#ifndef BCOPY +#ifndef MEMCPY +char *bcopy(); +#endif +#endif diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH index c451965028..cbbde9a133 100644 --- a/x2p/Makefile.SH +++ b/x2p/Makefile.SH @@ -18,9 +18,12 @@ case "$mallocsrc" in esac echo "Extracting x2p/Makefile (with variable substitutions)" cat >Makefile <<!GROK!THIS! -# $Header: Makefile.SH,v 3.0 89/10/18 15:33:52 lwall Locked $ +# $Header: Makefile.SH,v 3.0.1.1 89/10/26 23:29:11 lwall Locked $ # # $Log: Makefile.SH,v $ +# Revision 3.0.1.1 89/10/26 23:29:11 lwall +# patch1: in x2p/Makefile.SH, added dependency on ../config.sh +# # Revision 3.0 89/10/18 15:33:52 lwall # 3.0 baseline # @@ -144,6 +147,10 @@ hlist: shlist: echo $(sh) | tr ' ' '\012' >.shlist +config.sh: ../config.sh + rm -f config.sh + ln ../config.sh . + # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE $(obj): @ echo "You haven't done a "'"make depend" yet!'; exit 1 |