From: Kriton Kyrimis Date: Mon, 1 Feb 1988 22:28:33 +0000 (+0000) Subject: perl 1.0 patch 13: fix for faulty patch 12, plus random portability glitches X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2e1b3b7e9018b7d16d598adb631073672439d869;p=p5sagit%2Fp5-mst-13.2.git 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. --- diff --git a/Configure b/Configure index d55cb72..991f3bb 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 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 a486289..8845396 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 <.clist diff --git a/arg.c b/arg.c index e3b3c88..74da53c 100644 --- a/arg.c +++ b/arg.c @@ -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 cb0eea5..a1778a4 100644 --- a/config.h.SH +++ b/config.h.SH @@ -65,6 +65,12 @@ cat <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 <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 rather than . We can't just say diff --git a/makedepend.SH b/makedepend.SH index 6b20cac..5a8d979 100644 --- a/makedepend.SH +++ b/makedepend.SH @@ -15,9 +15,12 @@ esac echo "Extracting makedepend (with variable substitutions)" $spitshell >makedepend <stab_name) { case '0': case '1': case '2': case '3': case '4': diff --git a/t/op.split b/t/op.split index 988af49..a6bb1b4 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";}