Path: utzoo!mnetor!uunet!bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: comp.sources.unix Subject: v13i012: Perl patches 6 to 10, Patch6-Patch10 Message-ID: <365@fig.bbn.com> Date: 3 Feb 88 18:58:10 GMT Organization: BBN Laboratories Inc., Cambridge MA Lines: 2221 Approved: rsalz@uunet.UU.NET Submitted-by: Rich $alz Posting-number: Volume 13, Issue 12 Archive-name: perl/patches6-10 This is the second of two files containing the first 10 official patches to perl. They are copies of the articles as I received them on my machine. When you unpack this you will get five separate patch files, each of which will have to be fed through patch. Make sure to install all 10 patches. /r$ #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'patch6' <<'END_OF_FILE' XPath: bbn.com!bbn!husc6!cmcl2!beta!hc!ames!elroy!devvax!lroot XFrom: lroot@devvax.JPL.NASA.GOV (The Superuser) XNewsgroups: comp.sources.bugs XSubject: perl 1.0 patch #6 XSummary: This is an official patch for perl 1.0. Please apply it. XMessage-ID: <1156@devvax.JPL.NASA.GOV> XDate: 26 Jan 88 20:35:04 GMT XOrganization: Jet Propulsion Laboratory, Pasadena, CA XLines: 97 X XSystem: perl version 1.0 XPatch #: 6 XPriority: LOW XSubject: printf doesn't finish processing format string when out of args. XFrom: isis!aburt (Andrew Burt) X XDescription: X printf "%% %d %%", 1; produces "% 1 %%", which is counterintuitive. X XFix: From rn, say "| patch -d DIR", where DIR is your perl source X directory. Outside of rn, say "cd DIR; patch #define PATCHLEVEL 6 X XIndex: arg.c XPrereq: 1.0.1.2 X*** arg.c.old Tue Jan 26 12:31:23 1988 X--- arg.c Tue Jan 26 12:31:25 1988 X*************** X*** 1,6 **** X! /* $Header: arg.c,v 1.0.1.2 88/01/24 03:52:34 root Exp $ X * X * $Log: arg.c,v $ X * Revision 1.0.1.2 88/01/24 03:52:34 root X * patch 2: added STATBLKS dependencies. X * X--- 1,9 ---- X! /* $Header: arg.c,v 1.0.1.3 88/01/26 12:30:33 root Exp $ X * X * $Log: arg.c,v $ X+ * Revision 1.0.1.3 88/01/26 12:30:33 root X+ * patch 6: sprintf didn't finish processing format string when out of args. X+ * X * Revision 1.0.1.2 88/01/24 03:52:34 root X * patch 2: added STATBLKS dependencies. X * X*************** X*** 646,656 **** X register char *t; X bool dolong; X char ch; X X str_set(str,""); X len--; /* don't count pattern string */ X sarg++; X! for (s = str_get(*(sarg++)); *sarg && *s && len; len--) { X dolong = FALSE; X for (t = s; *t && *t != '%'; t++) ; X if (!*t) X--- 649,664 ---- X register char *t; X bool dolong; X char ch; X+ static STR *sargnull = &str_no; X X str_set(str,""); X len--; /* don't count pattern string */ X sarg++; X! for (s = str_get(*(sarg++)); *s; len--) { X! if (len <= 0 || !*sarg) { X! sarg = &sargnull; X! len = 0; X! } X dolong = FALSE; X for (t = s; *t && *t != '%'; t++) ; X if (!*t) END_OF_FILE if test 3112 -ne `wc -c <'patch6'`; then echo shar: \"'patch6'\" unpacked with wrong size! fi # end of 'patch6' fi if test -f 'patch7' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patch7'\" else echo shar: Extracting \"'patch7'\" \(7604 characters\) sed "s/^X//" >'patch7' <<'END_OF_FILE' XPath: bbn.com!bbn!uwmcsd1!ig!agate!pasteur!ames!elroy!devvax!lroot XFrom: lroot@devvax.JPL.NASA.GOV (The Superuser) XNewsgroups: comp.sources.bugs XSubject: perl 1.0 patch #7 XSummary: This is an official patch for perl 1.0. Please apply it. XMessage-ID: <1158@devvax.JPL.NASA.GOV> XDate: 26 Jan 88 23:04:26 GMT XOrganization: Jet Propulsion Laboratory, Pasadena, CA XLines: 273 X XSystem: perl version 1.0 XPatch #: 7 XPriority: HIGH if malloc.c doesn't compile XSubject: use of included malloc.c should be optional XFrom: gatech!skeeve!arnold (Arnold D. Robbins) X XDescription: X The version of malloc.c that comes with perl was not really intended X to be used everywhere--it was included mostly for debugging purposes. X It's a nice little package, however, so I'm making it optional (via X Configure) as to whether you want it or not. X XFix: From rn, say "| patch -p0 -d DIR", where DIR is your perl source X directory. Outside of rn, say "cd DIR; patch -p0 >> You must say -p0 to patch, or it will try to patch ./Makefile.SH twice, X>>> instead of patching both ./Makefile.SH and x2p/Makefile.SH. X X If patch indicates that patchlevel is the wrong version, you may need X to apply one or more previous patches, or the patch may already X have been applied. See the patchlevel.h file to find out what has or X has not been applied. In any event, don't continue with the patch. X X If you are missing previous patches they can be obtained from me: X X Larry Wall X lwall@jpl-devvax.jpl.nasa.gov X X If you send a mail message of the following form it will greatly speed X processing: X X Subject: Command X @SH mailpatch PATH perl 1.0 LIST X ^ note the c X X where PATH is a return path FROM ME TO YOU in Internet notation, and X LIST is the number of one or more patches you need, separated by spaces, X commas, and/or hyphens. Saying 35- says everything from 35 to the end. X X You can also get the patches via anonymous FTP from X jpl-devvax.jpl.nasa.gov (128.149.8.43). X XIndex: patchlevel.h XPrereq: 6 X1c1 X< #define PATCHLEVEL 6 X--- X> #define PATCHLEVEL 7 X XIndex: Configure XPrereq: 1.0.1.2 X*** Configure.old Tue Jan 26 14:16:00 1988 X--- Configure Tue Jan 26 14:16:05 1988 X*************** X*** 8,14 **** X # and edit it to reflect your system. Some packages may include samples X # of config.h for certain machines, so you might look for one of those.) X # X! # $Header: Configure,v 1.0.1.2 88/01/24 03:51:55 root Exp $ X # X # Yes, you may rip this off to use in other distribution packages. X # (Note: this Configure script was generated automatically. Rather than X--- 8,14 ---- X # and edit it to reflect your system. Some packages may include samples X # of config.h for certain machines, so you might look for one of those.) X # X! # $Header: Configure,v 1.0.1.3 88/01/26 14:14:14 root Exp $ X # X # Yes, you may rip this off to use in other distribution packages. X # (Note: this Configure script was generated automatically. Rather than X*************** X*** 79,84 **** X--- 79,87 ---- X d_voidsig='' X libc='' X libnm='' X+ mallocsrc='' X+ mallocobj='' X+ usemymalloc='' X mansrc='' X manext='' X models='' X*************** X*** 1249,1255 **** X--- 1252,1283 ---- X esac X fi X X+ : determine which malloc to compile in X echo " " X+ case "$usemymalloc" in X+ '') X+ if bsd || v7; then X+ dflt='y' X+ else X+ dflt='n' X+ fi X+ ;; X+ *) dflt="$usemymalloc" X+ ;; X+ esac X+ rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]" X+ $echo $n "$rp $c" X+ . myread X+ case "$ans" in X+ '') ans=$dflt;; X+ esac X+ usemymalloc="$ans" X+ case "$ans" in X+ y*) mallocsrc='malloc.c'; mallocobj='malloc.o';; X+ *) mallocsrc=''; mallocobj='';; X+ esac X+ X+ echo " " X echo "End of configuration questions." X echo " " X X*************** X*** 1309,1314 **** X--- 1337,1345 ---- X d_voidsig='$d_voidsig' X libc='$libc' X libnm='$libnm' X+ mallocsrc='$mallocsrc' X+ mallocobj='$mallocobj' X+ usemymalloc='$usemymalloc' X mansrc='$mansrc' X manext='$manext' X models='$models' X XIndex: Makefile.SH XPrereq: 1.0.1.2 X*** Makefile.SH.old Tue Jan 26 14:55:03 1988 X--- Makefile.SH Tue Jan 26 14:15:06 1988 X*************** X*** 14,22 **** X esac X echo "Extracting Makefile (with variable substitutions)" X cat >Makefile <Makefile <Makefile <Makefile <'patch8' <<'END_OF_FILE' XPath: bbn.com!bbn!uwmcsd1!ig!agate!pasteur!ames!elroy!devvax!lroot XFrom: lroot@devvax.JPL.NASA.GOV (The Superuser) XNewsgroups: comp.sources.bugs XSubject: perl 1.0 patch #8 XSummary: This is an official patch for perl 1.0. Please apply it. XMessage-ID: <1174@devvax.JPL.NASA.GOV> XDate: 28 Jan 88 19:44:05 GMT XOrganization: Jet Propulsion Laboratory, Pasadena, CA XLines: 1437 X XSystem: perl version 1.0 XPatch #: 8 XPriority: ENHANCEMENT XSubject: perl needed an eval operator and a symbolic debugger XFrom: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) X XDescription: X I didn't add an eval operator to the original perl because X I hadn't thought of any good uses for it. Recently I thought X of some. Along with creating the eval operator, this patch X introduces a symbolic debugger for perl scripts, which makes X use of eval to interpret some debugging commands. Having eval X also lets me emulate awk's FOO=bar command line behavior with X a line such as the one a2p now inserts at the beginning of X translated scripts. X XFix: From rn, say "| patch -p0 -d DIR", where DIR is your perl source X ^^^ X directory. Outside of rn, say "cd DIR; patch -p0 >>> YOU MUST USE THE -p0 SWITCH ABOVE OR PATCH WON'T WORK RIGHT. <<<< X X If patch indicates that patchlevel is the wrong version, you may need X to apply one or more previous patches, or the patch may already X have been applied. See the patchlevel.h file to find out what has or X has not been applied. In any event, don't continue with the patch. X X If you are missing previous patches they can be obtained from me: X X Larry Wall X lwall@jpl-devvax.jpl.nasa.gov X X If you send a mail message of the following form it will greatly speed X processing: X X Subject: Command X @SH mailpatch PATH perl 1.0 LIST X ^ note the c X X where PATH is a return path FROM ME TO YOU in Internet notation, and X LIST is the number of one or more patches you need, separated by spaces, X commas, and/or hyphens. Saying 35- says everything from 35 to the end. X X You can also get the patches via anonymous FTP from X jpl-devvax.jpl.nasa.gov (128.149.8.43). X XIndex: patchlevel.h XPrereq: 7 X1c1 X< #define PATCHLEVEL 7 X--- X> #define PATCHLEVEL 8 X XIndex: Makefile.SH XPrereq: 1.0.1.3 X*** Makefile.SH.old Thu Jan 28 11:08:32 1988 X--- Makefile.SH Thu Jan 28 11:08:33 1988 X*************** X*** 14,22 **** X esac X echo "Extracting Makefile (with variable substitutions)" X cat >Makefile <Makefile <>Makefile <<'!NO!SUBS!' X X! public = perl X X private = X X! manpages = perl.man X X util = X X--- 50,60 ---- X X cat >>Makefile <<'!NO!SUBS!' X X! public = perl perldb X X private = X X! manpages = perl.man perldb.man X X util = X XIf you are sitting there wondering why patch didn't find x2p/a2py.c, perhaps Xit is because you didn't say -p0 to patch. If so, abort patch now and run Xit again as you did, but add the following switches: -p0 -N X XIndex: x2p/a2py.c XPrereq: 1.0 X*** x2p/a2py.c.old Thu Jan 28 11:18:17 1988 X--- x2p/a2py.c Thu Jan 28 11:18:18 1988 X*************** X*** 1,6 **** X! /* $Header: a2py.c,v 1.0 87/12/18 17:50:33 root Exp $ X * X * $Log: a2py.c,v $ X * Revision 1.0 87/12/18 17:50:33 root X * Initial revision X * X--- 1,9 ---- X! /* $Header: a2py.c,v 1.0.1.1 88/01/28 11:07:08 root Exp $ X * X * $Log: a2py.c,v $ X+ * Revision 1.0.1.1 88/01/28 11:07:08 root X+ * patch8: added support for FOO=bar switches using eval. X+ * X * Revision 1.0 87/12/18 17:50:33 root X * Initial revision X * X*************** X*** 114,119 **** X--- 117,126 ---- X X tmpstr = walk(0,0,root,&i); X str = str_make("#!/bin/perl\n\n"); X+ str_cat(str, X+ "eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_]+=)(.*)/ && shift;\n"); X+ str_cat(str, X+ " # process any FOO=bar switches\n\n"); X if (do_opens && opens) { X str_scat(str,opens); X str_free(opens); X XIndex: arg.c XPrereq: 1.0.1.3 X*** arg.c.old Thu Jan 28 11:08:43 1988 X--- arg.c Thu Jan 28 11:08:46 1988 X*************** X*** 1,8 **** X! /* $Header: arg.c,v 1.0.1.3 88/01/26 12:30:33 root Exp $ X * X * $Log: arg.c,v $ X! * Revision 1.0.1.3 88/01/26 12:30:33 root X! * patch 6: sprintf didn't finish processing format string when out of args. X * X * Revision 1.0.1.2 88/01/24 03:52:34 root X * patch 2: added STATBLKS dependencies. X--- 1,8 ---- X! /* $Header: arg.c,v 1.0.1.4 88/01/28 10:22:06 root Exp $ X * X * $Log: arg.c,v $ X! * Revision 1.0.1.4 88/01/28 10:22:06 root X! * patch8: added eval operator. X * X * Revision 1.0.1.2 88/01/24 03:52:34 root X * patch 2: added STATBLKS dependencies. X*************** X*** 1190,1195 **** X--- 1190,1196 ---- X opargs[O_UNSHIFT] = A(1,0,0); X opargs[O_LINK] = A(1,1,0); X opargs[O_REPEAT] = A(1,1,0); X+ opargs[O_EVAL] = A(1,0,0); X } X X #ifdef VOIDSIG X*************** X*** 2091,2096 **** X--- 2092,2102 ---- X astore(ary,0,str); X } X value = (double)(ary->ary_fill + 1); X+ break; X+ case O_EVAL: X+ str_sset(str, X+ do_eval(arg[1].arg_type != A_NULL ? sarg[1] : defstab->stab_val) ); X+ STABSET(str); X break; X } X #ifdef DEBUGGING X XIndex: arg.h XPrereq: 1.0 X*** arg.h.old Thu Jan 28 11:08:59 1988 X--- arg.h Thu Jan 28 11:09:00 1988 X*************** X*** 1,6 **** X! /* $Header: arg.h,v 1.0 87/12/18 13:04:39 root Exp $ X * X * $Log: arg.h,v $ X * Revision 1.0 87/12/18 13:04:39 root X * Initial revision X * X--- 1,9 ---- X! /* $Header: arg.h,v 1.0.1.1 88/01/28 10:22:40 root Exp $ X * X * $Log: arg.h,v $ X+ * Revision 1.0.1.1 88/01/28 10:22:40 root X+ * patch8: added eval operator. X+ * X * Revision 1.0 87/12/18 13:04:39 root X * Initial revision X * X*************** X*** 111,117 **** X #define O_UNSHIFT 102 X #define O_LINK 103 X #define O_REPEAT 104 X! #define MAXO 105 X X #ifndef DOINIT X extern char *opname[]; X--- 114,121 ---- X #define O_UNSHIFT 102 X #define O_LINK 103 X #define O_REPEAT 104 X! #define O_EVAL 105 X! #define MAXO 106 X X #ifndef DOINIT X extern char *opname[]; X*************** X*** 222,228 **** X "UNSHIFT", X "LINK", X "REPEAT", X! "105" X }; X #endif X X--- 226,233 ---- X "UNSHIFT", X "LINK", X "REPEAT", X! "EVAL", X! "106" X }; X #endif X X XIndex: t/base.lex XPrereq: 1.0 X*** t/base.lex.old Thu Jan 28 11:17:55 1988 X--- t/base.lex Thu Jan 28 11:17:56 1988 X*************** X*** 1,8 **** X #!./perl X X! # $Header: base.lex,v 1.0 87/12/18 13:11:51 root Exp $ X X! print "1..4\n"; X X $ # this is the register X = 'x'; X--- 1,8 ---- X #!./perl X X! # $Header: base.lex,v 1.0.1.1 88/01/28 10:37:00 root Exp $ X X! print "1..6\n"; X X $ # this is the register X = 'x'; X*************** X*** 21,23 **** X--- 21,32 ---- X $x = '\\'; # '; X X if (length($x) == 1) {print "ok 4\n";} else {print "not ok 4\n";} X+ X+ eval 'while (0) { X+ print "foo\n"; X+ } X+ /^/ && (print "ok 5\n"); X+ '; X+ X+ eval '$foo{1} / 1;'; X+ if (!$@) {print "ok 6\n";} else {print "not ok 6\n";} X XIndex: cmd.h XPrereq: 1.0 X*** cmd.h.old Thu Jan 28 11:09:05 1988 X--- cmd.h Thu Jan 28 11:09:06 1988 X*************** X*** 1,6 **** X! /* $Header: cmd.h,v 1.0 87/12/18 13:04:59 root Exp $ X * X * $Log: cmd.h,v $ X * Revision 1.0 87/12/18 13:04:59 root X * Initial revision X * X--- 1,9 ---- X! /* $Header: cmd.h,v 1.0.1.1 88/01/28 10:23:07 root Exp $ X * X * $Log: cmd.h,v $ X+ * Revision 1.0.1.1 88/01/28 10:23:07 root X+ * patch8: added eval_root for eval operator. X+ * X * Revision 1.0 87/12/18 13:04:59 root X * Initial revision X * X*************** X*** 106,111 **** X--- 109,115 ---- X #define Nullcmd Null(CMD*) X X EXT CMD *main_root INIT(Nullcmd); X+ EXT CMD *eval_root INIT(Nullcmd); X X EXT struct compcmd { X CMD *comp_true; X XIndex: t/op.eval X*** t/op.eval.old Thu Jan 28 11:18:04 1988 X--- t/op.eval Thu Jan 28 11:18:04 1988 X*************** X*** 0 **** X--- 1,20 ---- X+ #!./perl X+ X+ print "1..6\n"; X+ X+ eval 'print "ok 1\n";'; X+ X+ if ($@ eq '') {print "ok 2\n";} else {print "not ok 2\n";} X+ X+ eval "\$foo\n = # this is a comment\n'ok 3';"; X+ print $foo,"\n"; X+ X+ eval "\$foo\n = # this is a comment\n'ok 4\n';"; X+ print $foo; X+ X+ eval ' X+ $foo ='; # this tests for a call through yyerror() X+ if ($@ =~ /line 2/) {print "ok 5\n";} else {print "not ok 5\n";} X+ X+ eval '$foo = /'; # this tests for a call through fatal() X+ if ($@ =~ /Search/) {print "ok 6\n";} else {print "not ok 6\n";} X XIndex: perl.h XPrereq: 1.0.1.2 X*** perl.h.old Thu Jan 28 11:09:13 1988 X--- perl.h Thu Jan 28 11:09:14 1988 X*************** X*** 1,6 **** X! /* $Header: perl.h,v 1.0.1.2 88/01/24 03:53:47 root Exp $ X * X * $Log: perl.h,v $ X * Revision 1.0.1.2 88/01/24 03:53:47 root X * patch 2: hid str_peek() in #ifdef DEBUGGING. X * X--- 1,9 ---- X! /* $Header: perl.h,v 1.0.1.3 88/01/28 10:24:17 root Exp $ X * X * $Log: perl.h,v $ X+ * Revision 1.0.1.3 88/01/28 10:24:17 root X+ * patch8: added eval operator. X+ * X * Revision 1.0.1.2 88/01/24 03:53:47 root X * patch 2: hid str_peek() in #ifdef DEBUGGING. X * X*************** X*** 103,109 **** X STR *arg_to_str(); X STR *str_new(); X STR *stab_str(); X! STR *eval(); X X FCMD *load_format(); X X--- 106,113 ---- X STR *arg_to_str(); X STR *str_new(); X STR *stab_str(); X! STR *eval(); /* this evaluates expressions */ X! STR *do_eval(); /* this evaluates eval operator */ X X FCMD *load_format(); X X*************** X*** 164,169 **** X--- 168,174 ---- X EXT char tokenbuf[256]; X EXT int expectterm INIT(TRUE); X EXT int lex_newlines INIT(FALSE); X+ EXT int in_eval INIT(FALSE); X X FILE *popen(); X /* char *str_get(); */ X*************** X*** 196,201 **** X--- 201,207 ---- X EXT int loop_ptr INIT(-1); X X EXT jmp_buf top_env; X+ EXT jmp_buf eval_env; X X EXT char *goto_targ INIT(Nullch); /* cmd_exec gets strange when set */ X X XIndex: perl.y XPrereq: 1.0 X*** perl.y.old Thu Jan 28 11:09:22 1988 X--- perl.y Thu Jan 28 11:09:24 1988 X*************** X*** 1,6 **** X! /* $Header: perl.y,v 1.0 87/12/18 15:48:59 root Exp $ X * X * $Log: perl.y,v $ X * Revision 1.0 87/12/18 15:48:59 root X * Initial revision X * X--- 1,9 ---- X! /* $Header: perl.y,v 1.0.1.1 88/01/28 10:25:31 root Exp $ X * X * $Log: perl.y,v $ X+ * Revision 1.0.1.1 88/01/28 10:25:31 root X+ * patch8: added eval operator. X+ * X * Revision 1.0 87/12/18 15:48:59 root X * Initial revision X * X*************** X*** 97,103 **** X %% /* RULES */ X X prog : lineseq X! { main_root = block_head($1); } X ; X X compblock: block CONTINUE block X--- 100,109 ---- X %% /* RULES */ X X prog : lineseq X! { if (in_eval) X! eval_root = block_head($1); X! else X! main_root = block_head($1); } X ; X X compblock: block CONTINUE block X XIndex: perldb X*** perldb.old Thu Jan 28 11:17:03 1988 X--- perldb Thu Jan 28 11:17:04 1988 X*************** X*** 0 **** X--- 1,296 ---- X+ #!/bin/perl X+ X+ # $Header: perldb,v 1.0.1.1 88/01/28 10:27:16 root Exp $ X+ # X+ # $Log: perldb,v $ X+ # Revision 1.0.1.1 88/01/28 10:27:16 root X+ # patch8: created this file. X+ # X+ # X+ X+ $tmp = "/tmp/pdb$$"; # default temporary file, -o overrides. X+ X+ # parse any switches X+ X+ while ($ARGV[0] =~ /^-/) { X+ $_ = shift; X+ /^-o$/ && ($tmp = shift,next); X+ die "Unrecognized switch: $_"; X+ } X+ X+ $filename = shift; X+ die "Usage: perldb [-o output] scriptname arguments" unless $filename; X+ X+ open(script,$filename) || die "Can't find $filename"; X+ X+ open(tmp, ">$tmp") || die "Can't make temp script"; X+ X+ $perl = '/bin/perl'; X+ $init = 1; X+ $state = 'statement'; X+ X+ # now translate script to contain DB calls at the appropriate places X+ X+ while (