diff options
author | Kriton Kyrimis <kyrimis@princeton.edu> | 1988-02-01 22:28:33 +0000 |
---|---|---|
committer | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1988-02-01 22:28:33 +0000 |
commit | 2e1b3b7e9018b7d16d598adb631073672439d869 (patch) | |
tree | 6ee91f55ef0c0cf0f9e15c0683ddfccd84c022be | |
parent | 9bb9d9f726fa55c70ed76abad9fe7c61d4eb4182 (diff) | |
download | perl-2e1b3b7e9018b7d16d598adb631073672439d869.tar.gz |
perl 1.0 patch 13: fix for faulty patch 12, plus random portability glitches
I botched patch #12, so that split(' ') only works on the first
line of input due to unintended interference by the optimization
that was added at the same time. Yes, I tested it, but only on
one line of input. *Sigh*
Some glitches have turned up on some of the rusty pig iron out there,
so here are some unglitchifications.
-rwxr-xr-x | Configure | 26 | ||||
-rw-r--r-- | Makefile.SH | 14 | ||||
-rw-r--r-- | arg.c | 16 | ||||
-rw-r--r-- | config.h.SH | 12 | ||||
-rw-r--r-- | makedepend.SH | 7 | ||||
-rw-r--r-- | patchlevel.h | 2 | ||||
-rw-r--r-- | spat.h | 6 | ||||
-rw-r--r-- | stab.c | 8 | ||||
-rw-r--r-- | t/op.split | 11 |
9 files changed, 89 insertions, 13 deletions
@@ -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 1.0.1.5 88/01/30 09:21:20 root Exp $ +# $Header: Configure,v 1.0.1.6 88/02/02 11:20:07 root Exp $ # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than @@ -70,10 +70,12 @@ cpp='' cppminus='' d_bcopy='' d_charsprf='' +d_crypt='' d_index='' d_statblks='' d_stdstdio='' d_strctcpy='' +d_symlink='' d_tminsys='' d_vfork='' d_voidsig='' @@ -664,6 +666,16 @@ else d_charsprf="$undef" fi +: see if crypt exists +echo " " +if $contains crypt libc.list >/dev/null 2>&1; then + echo 'crypt() found.' + d_crypt="$define" +else + echo 'crypt() not found.' + d_crypt="$undef" +fi + : index or strcpy echo " " dflt=y @@ -1233,6 +1245,16 @@ else cc=cc fi +: see if symlink exists +echo " " +if $contains symlink libc.list >/dev/null 2>&1; then + echo 'symlink() found.' + d_symlink="$define" +else + echo 'symlink() not found.' + d_symlink="$undef" +fi + : see if we should include -lnm echo " " if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then @@ -1328,10 +1350,12 @@ cpp='$cpp' cppminus='$cppminus' d_bcopy='$d_bcopy' d_charsprf='$d_charsprf' +d_crypt='$d_crypt' d_index='$d_index' d_statblks='$d_statblks' d_stdstdio='$d_stdstdio' d_strctcpy='$d_strctcpy' +d_symlink='$d_symlink' d_tminsys='$d_tminsys' d_vfork='$d_vfork' d_voidsig='$d_voidsig' diff --git a/Makefile.SH b/Makefile.SH index a486289535..8845396539 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -12,11 +12,20 @@ esac case "$0" in */*) cd `expr X$0 : 'X\(.*\)/'` ;; esac + +case "$d_symlink" in +*define*) sln='ln -s' ;; +*) sln='ln';; +esac + echo "Extracting Makefile (with variable substitutions)" cat >Makefile <<!GROK!THIS! -# $Header: Makefile.SH,v 1.0.1.4 88/01/28 10:17:59 root Exp $ +# $Header: Makefile.SH,v 1.0.1.5 88/02/02 11:20:49 root Exp $ # # $Log: Makefile.SH,v $ +# Revision 1.0.1.5 88/02/02 11:20:49 root +# patch13: added d_symlink dependency, changed TEST to ./perl TEST. +# # Revision 1.0.1.4 88/01/28 10:17:59 root # patch8: added perldb.man # @@ -44,6 +53,7 @@ SMALL = $small LARGE = $large $split mallocsrc = $mallocsrc mallocobj = $mallocobj +SLN = $sln libs = $libnm -lm !GROK!THIS! @@ -152,7 +162,7 @@ depend: makedepend test: perl chmod 755 t/TEST t/base.* t/comp.* t/cmd.* t/io.* t/op.* - cd t && (rm -f perl; ln -s ../perl . || ln ../perl .) && TEST + cd t && (rm -f perl; $(SLN) ../perl .) && ./perl TEST clist: echo $(c) | tr ' ' '\012' >.clist @@ -1,6 +1,9 @@ -/* $Header: arg.c,v 1.0.1.6 88/02/01 17:32:26 root Exp $ +/* $Header: arg.c,v 1.0.1.7 88/02/02 11:22:19 root Exp $ * * $Log: arg.c,v $ + * Revision 1.0.1.7 88/02/02 11:22:19 root + * patch13: fixed split(' ') to work right second time. Added CRYPT dependency. + * * Revision 1.0.1.6 88/02/01 17:32:26 root * patch12: made split(' ') behave like awk in ignoring leading white space. * @@ -225,7 +228,7 @@ STR ***retary; m = str_get(eval(spat->spat_runtime,Null(STR***))); if (!*m || (*m == ' ' && !m[1])) { m = "[ \\t\\n]+"; - while (isspace(*s)) s++; + spat->spat_flags |= SPAT_SKIPWHITE; } if (spat->spat_runtime->arg_type == O_ITEM && spat->spat_runtime[1].arg_type == A_SINGLE) { @@ -251,6 +254,10 @@ STR ***retary; if (!ary) myarray = ary = anew(); ary->ary_fill = -1; + if (spat->spat_flags & SPAT_SKIPWHITE) { + while (isspace(*s)) + s++; + } while (*s && (m = execute(&spat->spat_compex, s, (iters == 0), 1))) { if (spat->spat_compex.numsubs) s = spat->spat_compex.subbase; @@ -1952,8 +1959,13 @@ STR ***retary; /* where to return an array to, null if nowhere */ retary = Null(STR***); /* do_stat already did retary */ goto donumset; case O_CRYPT: +#ifdef CRYPT tmps = str_get(sarg[1]); str_set(str,crypt(tmps,str_get(sarg[2]))); +#else + fatal( + "The crypt() function is unimplemented due to excessive paranoia."); +#endif break; case O_EXP: value = exp(str_gnum(sarg[1])); diff --git a/config.h.SH b/config.h.SH index cb0eea5a9a..a1778a4568 100644 --- a/config.h.SH +++ b/config.h.SH @@ -65,6 +65,12 @@ cat <<!GROK!THIS! >config.h */ #$d_charsprf CHARSPRINTF /**/ +/* CRYPT: + * This symbol, if defined, indicates that the crypt routine is available + * to encrypt passwords and the like. + */ +#$d_crypt CRYPT /**/ + /* index: * This preprocessor symbol is defined, along with rindex, if the system * uses the strchr and strrchr routines instead. @@ -95,6 +101,12 @@ cat <<!GROK!THIS! >config.h */ #$d_strctcpy STRUCTCOPY /**/ +/* SYMLINK: + * This symbol, if defined, indicates that the symlink routine is available + * to create symbolic links. + */ +#$d_symlink SYMLINK /**/ + /* TMINSYS: * This symbol is defined if this system declares "struct tm" in * in <sys/time.h> rather than <time.h>. We can't just say diff --git a/makedepend.SH b/makedepend.SH index 6b20cac7bf..5a8d9794fe 100644 --- a/makedepend.SH +++ b/makedepend.SH @@ -15,9 +15,12 @@ esac echo "Extracting makedepend (with variable substitutions)" $spitshell >makedepend <<!GROK!THIS! $startsh -# $Header: makedepend.SH,v 1.0 87/12/18 17:54:32 root Exp $ +# $Header: makedepend.SH,v 1.0.1.1 88/02/02 11:24:05 root Exp $ # # $Log: makedepend.SH,v $ +# Revision 1.0.1.1 88/02/02 11:24:05 root +# patch13: removed spurious -I./h. +# # Revision 1.0 87/12/18 17:54:32 root # Initial revision # @@ -83,7 +86,7 @@ for file in `$cat .clist`; do -e 's|\\$||' \ -e p \ -e '}' - $cpp -I/usr/local/include -I. -I./h $file.c | \ + $cpp -I/usr/local/include -I. $file.c | \ $sed \ -e '/^# *[0-9]/!d' \ -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \ diff --git a/patchlevel.h b/patchlevel.h index bc5f1c8250..910cae8f16 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1 +1 @@ -#define PATCHLEVEL 12 +#define PATCHLEVEL 13 @@ -1,6 +1,9 @@ -/* $Header: spat.h,v 1.0 87/12/18 13:06:10 root Exp $ +/* $Header: spat.h,v 1.0.1.1 88/02/02 11:24:37 root Exp $ * * $Log: spat.h,v $ + * Revision 1.0.1.1 88/02/02 11:24:37 root + * patch13: added flag for stripping leading spaces on split. + * * Revision 1.0 87/12/18 13:06:10 root * Initial revision * @@ -20,6 +23,7 @@ struct scanpat { #define SPAT_USE_ONCE 2 /* use pattern only once per article */ #define SPAT_SCANFIRST 4 /* initial constant not anchored */ #define SPAT_SCANALL 8 /* initial constant is whole pat */ +#define SPAT_SKIPWHITE 16 /* skip leading whitespace for split */ EXT SPAT *spat_root; /* list of all spats */ EXT SPAT *curspat; /* what to do \ interps from */ @@ -1,6 +1,9 @@ -/* $Header: stab.c,v 1.0.1.1 88/01/28 10:35:17 root Exp $ +/* $Header: stab.c,v 1.0.1.2 88/02/02 11:25:53 root Exp $ * * $Log: stab.c,v $ + * Revision 1.0.1.2 88/02/02 11:25:53 root + * patch13: moved extern int out of function for a poor Xenix machine. + * * Revision 1.0.1.1 88/01/28 10:35:17 root * patch8: changed some stabents to support eval operator. * @@ -64,13 +67,14 @@ static char *sig_name[] = { ,0 }; +extern int errno; + STR * stab_str(stab) STAB *stab; { register int paren; register char *s; - extern int errno; switch (*stab->stab_name) { case '0': case '1': case '2': case '3': case '4': diff --git a/t/op.split b/t/op.split index 988af49d3d..a6bb1b47c8 100644 --- a/t/op.split +++ b/t/op.split @@ -1,8 +1,8 @@ #!./perl -# $Header: op.split,v 1.0 87/12/18 13:14:20 root Exp $ +# $Header: op.split,v 1.0.1.1 88/02/02 11:26:37 root Exp $ -print "1..4\n"; +print "1..6\n"; $FS = ':'; @@ -22,3 +22,10 @@ if (join(".",@ary) eq "a.b.c.\n") {print "ok 3\n";} else {print "not ok 3\n";} $_ = "a:b:c::::"; @ary = split(/:/); if (join(".",@ary) eq "a.b.c") {print "ok 4\n";} else {print "not ok 4\n";} + +$_ = join(':',split(' ',' a b c ')); +if ($_ eq 'a:b:c') {print "ok 5\n";} else {print "not ok 5\n";} + +$_ = join(':',split(/ */,"foo bar bie\tdoll")); +if ($_ eq "f:o:o:b:a:r:b:i:e:\t:d:o:l:l") + {print "ok 6\n";} else {print "not ok 6\n";} |