[comp.sources.bugs] perl 2.0 patch #9

lroot@devvax.JPL.NASA.GOV (The Superuser) (07/15/88)

System: perl version 2.0
Patch #: 9
Priority: MEDIUM-HIGH
Subject: optimization of && and || to "if" and "unless" occasionally failed
Subject: delete $ENV{$var} didn't delete environment variable
Subject: reset 'E' didn't wipe out the environment
Subject: random manual page cleanup
Subject: some machines can't do utime 0,1,$file
Subject: gcc complained about "\$", so it's now "\\$"

Description:
	Certain occurrences of && and || can be optimized to look like
	"if" and "unless" modifiers, which are more efficient.  Unfortunately
	the optimization sometimes prevented the right side from evaluating
	at all, depending on what was there.  For example, this fails:

		1 && do {print "succeeded\n";};

	The special operations reset and delete didn't work as expected
	when used on the $ENV{} array.  Now you can use them to wipe out
	your environment, and not just the array.

	Some machines apparently can't set the access and modification times
	of a file to small numbers like 0 and 1, so test 18 of io.fs was
	failing.  It now sets them to 500000000 and 500000001.

	The gnu C compiler complained about "\$" in x2p/walk.c, so it's
	now "\\$".

	There has been a major cleanup of the manual to make it prettier
	on high-resolution printers.  Most of the changes are courtesy
	of Steve Thomas, who obviously put in a lot of work on it.

Fix:	From rn, say "| patch -p -N -d DIR", where DIR is your perl source
	directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
	If you don't have the patch program, apply the following by hand,
	or get patch (version 2.0, latest patchlevel).

	After patching:
		make
		make test
		make install

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel.h file to find out what has or
	has not been applied.  In any event, don't continue with the patch.

	If you are missing previous patches they can be obtained from me:

	Larry Wall
	lwall@jpl-devvax.jpl.nasa.gov

	If you send a mail message of the following form it will greatly speed
	processing:

	Subject: Command
	@SH mailpatch PATH perl 2.0 LIST
		   ^ note the c

	where PATH is a return path FROM ME TO YOU either in Internet notation,
	or in bang notation from some well-known host, and LIST is the number
	of one or more patches you need, separated by spaces, commas, and/or
	hyphens.  Saying 35- says everything from 35 to the end.


	You can also get the patches via anonymous FTP from
	jpl-devvax.jpl.nasa.gov (128.149.8.43).

Index: patchlevel.h
Prereq: 8
1c1
< #define PATCHLEVEL 8
---
> #define PATCHLEVEL 9

Index: eval.c
Prereq: 2.0.1.3
*** eval.c.old	Fri Jul 15 01:39:48 1988
--- eval.c	Fri Jul 15 01:39:51 1988
***************
*** 1,6 ****
! /* $Header: eval.c,v 2.0.1.3 88/07/13 21:21:35 root Exp $
   *
   * $Log:	eval.c,v $
   * Revision 2.0.1.3  88/07/13  21:21:35  root
   * patch8: changed occurences of vestigial tmps to tmpstr
   * 
--- 1,9 ----
! /* $Header: eval.c,v 2.0.1.4 88/07/15 01:30:08 root Exp $
   *
   * $Log:	eval.c,v $
+  * Revision 2.0.1.4  88/07/15  01:30:08  root
+  * patch9: delete $ENV{$var} didn't delete environment variable
+  * 
   * Revision 2.0.1.3  88/07/13  21:21:35  root
   * patch8: changed occurences of vestigial tmps to tmpstr
   * 
***************
*** 689,694 ****
--- 692,699 ----
      case O_DELETE:
  	tmpstab = arg[2].arg_ptr.arg_stab;		/* XXX */
  	str = hdelete(tmpstab->stab_hash,str_get(sarg[1]));
+ 	if (tmpstab == envstab)
+ 	    setenv(str_get(sarg[1]),Nullch);
  	if (!str)
  	    str = &str_no;
  	break;

Index: t/io.fs
Prereq: 2.0
*** t/io.fs.old	Fri Jul 15 01:40:17 1988
--- t/io.fs	Fri Jul 15 01:40:17 1988
***************
*** 1,6 ****
  #!./perl
  
! # $Header: io.fs,v 2.0 88/06/05 00:12:59 root Exp $
  
  print "1..22\n";
  
--- 1,6 ----
  #!./perl
  
! # $Header: io.fs,v 2.0.1.1 88/07/15 01:35:39 root Exp $
  
  print "1..22\n";
  
***************
*** 56,67 ****
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
      $blksize,$blocks) = stat('a');
  if ($ino == 0) {print "ok 15\n";} else {print "not ok 15\n";}
! $foo = (utime 0,1,'b');
  if ($foo == 1) {print "ok 16\n";} else {print "not ok 16 $foo\n";}
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
      $blksize,$blocks) = stat('b');
  if ($ino) {print "ok 17\n";} else {print "not ok 17\n";}
! if ($atime == 0 && $mtime == 1) {print "ok 18\n";} else {print "not ok 18 $atime $mtime\n";}
  
  if ((unlink 'b') == 1) {print "ok 19\n";} else {print "not ok 19\n";}
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
--- 56,68 ----
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
      $blksize,$blocks) = stat('a');
  if ($ino == 0) {print "ok 15\n";} else {print "not ok 15\n";}
! $foo = (utime 500000000,500000001,'b');
  if ($foo == 1) {print "ok 16\n";} else {print "not ok 16 $foo\n";}
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
      $blksize,$blocks) = stat('b');
  if ($ino) {print "ok 17\n";} else {print "not ok 17\n";}
! if ($atime == 500000000 && $mtime == 500000001)
!     {print "ok 18\n";} else {print "not ok 18 $atime $mtime\n";}
  
  if ((unlink 'b') == 1) {print "ok 19\n";} else {print "not ok 19\n";}
  ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,

Index: perl.man.1
Prereq: 2.0.1.2
2c2
< ''' $Header: perl.man.1,v 2.0.1.2 88/07/11 22:36:49 root Exp $
---
> ''' $Header: perl.man.1,v 2.0.1.3 88/07/15 01:31:24 root Exp $
4a5,7
> ''' Revision 2.0.1.3  88/07/15  01:31:24  root
> ''' patch9: random cleanup
> ''' 
57a61
> .UC
59c63
< perl - Practical Extraction and Report Language
---
> perl \- Practical Extraction and Report Language
61c65,66
< .B perl [options] filename args
---
> .B perl
> [options] filename args
82c87,93
< There are also translators to turn your sed and awk scripts into perl scripts.
---
> There are also translators to turn your
> .I sed
> and
> .I awk
> scripts into
> .I perl
> scripts.
96c107
< Passed in implicity via standard input.
---
> Passed in implicitly via standard input.
98c109,111
< arguments to a stdin script you must explicitly specify a - for the script name.
---
> arguments to a
> .I stdin
> script you must explicitly specify a \- for the script name.
114c127
< 	#!/usr/bin/perl -spi.bak	# same as -s -p -i.bak
---
> 	#!/usr/bin/perl \-spi.bak	# same as \-s \-p \-i.bak
121c134,137
< turns on autosplit mode when used with a \-n or \-p.
---
> turns on autosplit mode when used with a
> .B \-n
> or
> .BR \-p .
124c140,143
< the \-n or \-p.
---
> the
> .B \-n
> or
> .BR \-p .
127c146
< 	perl -ane 'print pop(@F),"\en";'
---
> 	perl \-ane \'print pop(@F), "\en";\'
132,133c151,152
< 		@F = split(' ');
< 		print pop(@F),"\en";
---
> 		@F = split(\' \');
> 		print pop(@F), "\en";
138c157
< .B \-D<number>
---
> .BI \-D number
141c160
< .B \-D14.
---
> .BR \-D14 .
145c164
< .B \-e commandline
---
> .BI \-e " commandline"
156c175
< .B \-i<extension>
---
> .BI \-i extension
164c183
< Saying \*(L"perl -p -i.bak -e "s/foo/bar/;" .\|.\|. \*(R" is the same as using
---
> Saying \*(L"perl \-p \-i.bak \-e "s/foo/bar/;" .\|.\|. \*(R" is the same as using
169c188
< 	#!/usr/bin/perl -pi.bak
---
> 	#!/usr/bin/perl \-pi.bak
178,179c197,198
< 			rename($ARGV,$ARGV . '.bak');
< 			open(ARGVOUT,">$ARGV");
---
> 			rename($ARGV, $ARGV . \'.bak\');
> 			open(ARGVOUT, ">$ARGV");
191c210,212
< except that the \-i form doesn't need to compare $ARGV to $oldargv to know when
---
> except that the
> .B \-i
> form doesn't need to compare $ARGV to $oldargv to know when
194c215,217
< Note that stdout is restored as the default output filehandle after the loop.
---
> Note that
> .I stdout
> is restored as the default output filehandle after the loop.
199c222
< .B \-I<directory>
---
> .BI \-I directory
209c232
< over filename arguments somewhat like \*(L"sed -n\*(R" or \fIawk\fR:
---
> over filename arguments somewhat like \*(L"sed \-n\*(R" or \fIawk\fR:
225c248
< 	find . -mtime +7 -print | perl -ne 'chop;unlink;'
---
> 	find . \-mtime +7 \-print | perl \-ne \'chop;unlink;\'
228c251
< This is faster than using the -exec switch find because you don't have to
---
> This is faster than using the \-exec switch of find because you don't have to
259c282
< .I perl.
---
> .IR perl .
266c289
< after the script name but before any filename arguments (or before a --).
---
> after the script name but before any filename arguments (or before a \-\|\-).
271c294
< invoked with a -xyz switch.
---
> invoked with a \-xyz switch.
275c298
< 	#!/usr/bin/perl -s
---
> 	#!/usr/bin/perl \-s
281c304,306
< makes perl use the PATH environment variable to search for the script
---
> makes
> .I perl
> use the PATH environment variable to search for the script
288c313
< 	eval "exec /usr/bin/perl -S $0 $*"
---
> 	eval "exec /usr/bin/perl \-S $0 $*"
293c318,320
< which proceeds to try to execute the perl script as a shell script.
---
> which proceeds to try to execute the
> .I perl
> script as a shell script.
295c322,324
< starts up the perl interpreter.
---
> starts up the
> .I perl
> interpreter.
297,298c326,333
< so the -S tells perl to search for the script if necessary.
< After perl locates the script, it parses the lines and ignores them because
---
> so the
> .B \-S
> tells
> .I perl
> to search for the script if necessary.
> After
> .I perl
> locates the script, it parses the lines and ignores them because
302c337,339
< allows perl to do unsafe operations.
---
> allows
> .I perl
> to do unsafe operations.
307c344,346
< prints the version and patchlevel of your perl executable.
---
> prints the version and patchlevel of your
> .I perl
> executable.
316c355,356
< Perl has about two and a half data types: scalars, arrays of scalars, and
---
> .I Perl
> has about two and a half data types: scalars, arrays of scalars, and
326c366
< Booleans returned by operators are 1 for true and '0' or '' (the null
---
> Booleans returned by operators are 1 for true and \'0\' or \'\' (the null
337c377
<     $days{'Feb'}\h'|2i'# one value from an associative array
---
>     $days{\'Feb\'}\h'|2i'# one value from an associative array
387c427
< Hint: you could say open(LOG,'logfile') rather than open(log,'logfile').)
---
> Hint: you could say open(LOG,\'logfile\') rather than open(log,\'logfile\').)
394c434
< .I perl.
---
> .IR perl .
405c445,447
< reported until perl finds another line containing the quote character, which
---
> reported until
> .I perl
> finds another line containing the quote character, which
412c454
<     $Price = '$100';\h'|3.5i'# not interpreted
---
>     $Price = \'$100\';\h'|3.5i'# not interpreted
427c469
<     @foo = ('cc', '\-E', $bar);
---
>     @foo = (\'cc\', \'\-E\', $bar);
431c473
<     $foo = ('cc', '\-E', $bar);
---
>     $foo = (\'cc\', \'\-E\', $bar);
441c483
<     ($map{'red'}, $map{'blue'}, $map{'green'}) = (0x00f, 0x0f0, 0xf00);
---
>     ($map{\'red\'}, $map{\'blue\'}, $map{\'green\'}) = (0x00f, 0x0f0, 0xf00);
503c545
< and if it is null, $ARGV[0] is set to '-', which when opened gives you standard
---
> and if it is null, $ARGV[0] is set to \'-\', which when opened gives you standard
517c559
< 	unshift(@ARGV, '\-') \|if \|$#ARGV < $[;
---
> 	unshift(@ARGV, \'\-\') \|if \|$#ARGV < $[;
556c598,599
< @ARGV list, and if you haven't set @ARGV, will input from stdin.
---
> @ARGV list, and if you haven't set @ARGV, will input from
> .IR stdin .
575c618
< 		chmod 0644,$_;
---
> 		chmod 0644, $_;
581c624
< 	open(foo,"echo *.c | tr -s ' \et\er\ef' '\e\e012\e\e012\e\e012\e\e012'|");
---
> 	open(foo, "echo *.c | tr \-s \' \et\er\ef\' \'\e\e012\e\e012\e\e012\e\e012\'|");
584c627
< 		chmod 0644,$_;
---
> 		chmod 0644, $_;
593c636
< 	chmod 0644,<*.c>;
---
> 	chmod 0644, <*.c>;
661,665c704,708
<     if (!open(foo)) { die "Can't open $foo"; }
<     die "Can't open $foo" unless open(foo);
<     open(foo) || die "Can't open $foo";	# foo or bust!
<     open(foo) ? die "Can't open $foo" : 'hi mom';
< 			    # a bit exotic, that last one
---
> 	if (!open(foo)) { die "Can't open $foo"; }
> 	die "Can't open $foo" unless open(foo);
> 	open(foo) || die "Can't open $foo";	# foo or bust!
> 	open(foo) ? die "Can't open $foo" : \'hi mom\';
> 				# a bit exotic, that last one
692c735
< .I last
---
> .IR last ,
762,763c805,806
< 	for ((10,9,8,7,6,5,4,3,2,1,'BOOM')) {
< 	    print $_,"\en"; sleep(1);
---
> 	for ((10,9,8,7,6,5,4,3,2,1,\'BOOM\')) {
> 		print $_, "\en"; sleep(1);
767c810
< 	foreach $item (split(/:[\e\e\en:]*/,$ENV{'TERMCAP'}) {
---
> 	foreach $item (split(/:[\e\e\en:]*/, $ENV{\'TERMCAP\'}) {
912,913c955,956
< 	print '-' x 80;		# print row of dashes
< 	print '-' x80;		# illegal, x80 is identifier
---
> 	print \'\-\' x 80;		# print row of dashes
> 	print \'\-\' x80;		# illegal, x80 is identifier
915c958
< 	print "\et" x ($tab/8), ' ' x ($tab%8);	# tab over
---
> 	print "\et" x ($tab/8), \' \' x ($tab%8);	# tab over
920c963
< .Ip .. 8
---
> .Ip .\|. 8
922c965
< Each .. operator maintains its own boolean state.
---
> Each .\|. operator maintains its own boolean state.
932c975
< The .. operator is primarily intended for doing line number ranges after
---
> The .\|. operator is primarily intended for doing line number ranges after
938c981
< The final sequence number in a range has the string 'E0' appended to it, which
---
> The final sequence number in a range has the string \'E0\' appended to it, which
943c986
< If either operand of .. is static, that operand is implicitly compared to
---
> If either operand of .\|. is static, that operand is implicitly compared to
949c992
<     if (101 .. 200) { print; }	# print 2nd hundred lines
---
>     if (101 .\|. 200) { print; }	# print 2nd hundred lines
951c994
<     next line if (1 .. /^$/);	# skip header lines
---
>     next line if (1 .\|. /^$/);	# skip header lines
953c996
<     s/^/> / if (/^$/ .. eof());	# quote body
---
>     s/^/> / if (/^$/ .\|. eof());	# quote body
960,961c1003,1005
< If the argument is omitted, tests $_, except for \-t, which tests stdin.
< It returns 1 for true and '' for false.
---
> If the argument is omitted, tests $_, except for \-t, which tests
> .IR stdin .
> It returns 1 for true and \'\' for false.
967c1011
< 	\-w	File is writeable by effective uid.
---
> 	\-w	File is writable by effective uid.
971c1015
< 	\-W	File is writeable by real uid.
---
> 	\-W	File is writable by real uid.
1011,1012c1055,1056
< Note that -s/a/b/ does not do a negated substitution.
< Saying -exp($foo) still works as expected, however\*(--only single letters
---
> Note that \-s/a/b/ does not do a negated substitution.
> Saying \-exp($foo) still works as expected, however\*(--only single letters
1024c1068,1069
< filehandle you've been handed (usually via stdin).
---
> filehandle you've been handed (usually via
> .IR stdin ).
1049,1050c1094,1095
< 	'Now is the time for all' . "\|\e\|n" .
< 	'good men to come to.'
---
> 	\'Now is the time for all\' . "\|\e\|n" .
> 	\'good men to come to.\'
1060c1105
< pattern /^[a-zA-Z]*[0-9]*$/, the increment is done
---
> pattern /^[a\-zA\-Z]*[0\-9]*$/, the increment is done
1064,1067c1109,1112
< 	print ++($foo = '99');	# prints '100'
< 	print ++($foo = 'a0');	# prints 'a1'
< 	print ++($foo = 'Az');	# prints 'Ba'
< 	print ++($foo = 'zz');	# prints 'aaa'
---
> 	print ++($foo = \'99\');	# prints \*(L'100\*(R'
> 	print ++($foo = \'a0\');	# prints \*(L'a1\*(R'
> 	print ++($foo = \'Az\');	# prints \*(L'Ba\*(R'
> 	print ++($foo = \'zz\');	# prints \*(L'aaa\*(R'
1080c1125
< Searches a string for a pattern, and returns true (1) or false ('').
---
> Searches a string for a pattern, and returns true (1) or false (\'\').
1086,1088c1131,1133
< If you prepend an `m' you can use any pair of characters as delimiters.
< This is particularly useful for matching Unix path names that contain `/'.
< If the final delimiter is followed by the optional letter `i', the matching is
---
> If you prepend an \*(L'm\*(R' you can use any pair of characters as delimiters.
> This is particularly useful for matching Unix path names that contain \*(L'/\*(R'.
> If the final delimiter is followed by the optional letter \*(L'i\*(R', the matching is
1092c1137
< array consisting of the subexpressions matched by the parens in pattern,
---
> array consisting of the subexpressions matched by the parentheses in pattern,
1099c1144
<     open(tty, '/dev/tty');
---
>     open(tty, \'/dev/tty\');
1102c1147
<     if (/Version: \|*\|([0-9.]*\|)\|/\|) { $version = $1; }
---
>     if (/Version: \|*\|([0\-9.]*\|)\|/\|) { $version = $1; }
1106c1151
<     if (($F1,$F2,$Etc) = ($foo =~ /^(\eS+)\es+(\eS+)\es*(.*)/))
---
>     if (($F1, $F2, $Etc) = ($foo =~ /^(\eS+)\es+(\eS+)\es*(.*)/))
1118c1163
< This is a useful optimization when you only want to see the first occurence of
---
> This is a useful optimization when you only want to see the first occurrence of
1121c1166,1168
< Returns the arctangent of X/Y in the range -PI to PI.
---
> Returns the arctangent of X/Y in the range
> .if t \-\(*p to \(*p.
> .if n \-PI to PI.
1125c1172,1173
< See example under die().
---
> See example under
> .IR die .
1133,1134c1181,1182
< 	$cnt = chmod 0755,'foo','bar';
< 	chmod 0755,@executables;
---
> 	$cnt = chmod 0755, \'foo\', \'bar\';
> 	chmod 0755, @executables;
1158c1206
< 	chop($cwd = `pwd`);
---
> 	chop($cwd = \`pwd\`);
1170,1171c1218,1219
< 	$cnt = chown $uid,$gid,'foo','bar';
< 	chown $uid,$gid,@filenames;
---
> 	$cnt = chown $uid, $gid, \'foo\', \'bar\';
> 	chown $uid, $gid, @filenames;
1184c1232
< 	open(pass,'/etc/passwd') || die "Can't open passwd";
---
> 	open(pass, \'/etc/passwd\') || die "Can't open passwd";
1191c1239
< 	if ($uid{$user} eq '') {
---
> 	if ($uid{$user} eq \'\') {
1195c1243
< 		unshift(@ary,$uid{$user},$gid{$user});
---
> 		unshift(@ary, $uid{$user}, $gid{$user});
1217c1265
< 	open(output,'|sort >foo');	# pipe to sort
---
> 	open(output, \'|sort >foo\');	# pipe to sort
1220c1268
< 	open(input,'foo');	# get sort's results
---
> 	open(input, \'foo\');	# get sort's results
1242c1290,1292
< (But it would be faster to use the reset command.)
---
> (But it would be faster to use the
> .I reset
> command.)
1244c1294,1296
< Prints the value of EXPR to stderr and exits with the current value of $!
---
> Prints the value of EXPR to
> .I stderr
> and exits with the current value of $!
1246c1298
< If $! is 0, exits with the value of ($? >> 8) (`command` status).
---
> If $! is 0, exits with the value of ($? >> 8) (\`command\` status).
1252c1304
< 	die "Can't cd to spool.\en" unless chdir '/usr/spool/news';
---
> 	die "Can't cd to spool.\en" unless chdir \'/usr/spool/news\';
1254c1306
< 	chdir '/usr/spool/news' || die "Can't cd to spool.\en" 
---
> 	chdir \'/usr/spool/news\' || die "Can't cd to spool.\en" 
1297,1298c1349,1354
< as a perl script.
< It's primary use is to include subroutines from a perl subroutine library.
---
> as a
> .I perl
> script.
> Its primary use is to include subroutines from a
> .I perl
> subroutine library.
1300d1355
< 	do 'stat.pl';
1301a1357,1358
> 	do \'stat.pl\';
> 
1304c1361
< 	eval `cat stat.pl`;
---
> 	eval \`cat stat.pl\`;
1308c1365,1367
< filename for error messages, and searches all the -I libraries if the file
---
> filename for error messages, and searches all the
> .B \-I
> libraries if the file
1313c1372
< (The main problem with #include is that cpp doesn't grok # comments--a
---
> (The main problem with #include is that cpp doesn't grok # comments\*(--a
1354c1413
< Use eof(ARGV) or eof without the parens to test EACH file in a while (<>) loop.
---
> Use eof(ARGV) or eof without the parentheses to test EACH file in a while (<>) loop.
1362c1421
< 			print "--------------\en";
---
> 			print "\-\|\-\|\-\|\-\|\-\|\-\|\-\|\-\|\-\|\-\|\-\|\-\|\-\|\-\en";
1378,1379c1437,1442
< EXPR is parsed and executed as if it were a little perl program.
< It is executed in the context of the current perl program, so that
---
> EXPR is parsed and executed as if it were a little
> .I perl
> program.
> It is executed in the context of the current
> .I perl
> program, so that
1391c1454
< If there are any, the entire argument is passed to /bin/sh -c for parsing.
---
> If there are any, the entire argument is passed to \*(L"/bin/sh \-c\*(R" for parsing.
1399c1462
< 	exec '/bin/echo', 'Your arguments are: ', @ARGV;
---
> 	exec \'/bin/echo\', \'Your arguments are: \', @ARGV;
1416c1479,1481
< Returns e to the power of EXPR.
---
> Returns
> .I e
> to the power of EXPR.
1429,1430c1494
<     ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
<        = gmtime(time);
---
>     ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
1434,1435c1498,1499
< In particular this means that $mon has the range 0..11 and $wday has the
< range 0..6.
---
> In particular this means that $mon has the range 0.\|.11 and $wday has the
> range 0.\|.6.

Index: perl.man.2
Prereq: 2.0.1.2
2c2
< ''' $Header: perl.man.2,v 2.0.1.2 88/07/11 22:41:50 root Exp $
---
> ''' $Header: perl.man.2,v 2.0.1.3 88/07/15 01:31:36 root Exp $
4a5,7
> ''' Revision 2.0.1.3  88/07/15  01:31:36  root
> ''' patch9: random cleanup
> ''' 
24c27,29
< the sed-to-perl translator easier.
---
> the
> .IR sed -to- perl
> translator easier.
32c37
< If the substring is not found, returns one less than the base, ordinarily -1.
---
> If the substring is not found, returns one less than the base, ordinarily \-1.
42c47
<     $_ = join(\|':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);
---
>     $_ = join(\|\':\', $login,$passwd,$uid,$gid,$gcos,$home,$shell);
60c65
< 		print pop(keys),'=',pop(values),"\en";
---
> 		print pop(keys), \'=\', pop(values), "\en";
67c72
< 		print $key,'=',$ENV{$key},"\en";
---
> 		print $key, \'=\', $ENV{$key}, "\en";
77,78c82,83
< 	$cnt = kill 1,$child1,$child2;
< 	kill 9,@goners;
---
> 	$cnt = kill 1, $child1, $child2;
> 	kill 9, @goners;
112c117
< (The \*(L"do 'filename';\*(R" operator also counts as an eval.)
---
> (The \*(L"do \'filename\';\*(R" operator also counts as an eval.)
124c129
< 		local($result) = '';
---
> 		local($result) = \'\';
144,145c149
<     ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
<        = localtime(time);
---
>     ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
149,150c153,154
< In particular this means that $mon has the range 0..11 and $wday has the
< range 0..6.
---
> In particular this means that $mon has the range 0.\|.11 and $wday has the
> range 0.\|.6.
152c156,158
< Returns logarithm (base e) of EXPR.
---
> Returns logarithm (base
> .IR e )
> of EXPR.
198,199c204,208
< Opening '\-' opens stdin and opening '>\-' opens stdout.
< Open returns 1 upon success, '' otherwise.
---
> Opening \'\-\' opens
> .I stdin
> and opening \'>\-\' opens
> .IR stdout .
> Open returns 1 upon success, \'\' otherwise.
208c217
< 	open(LOG, '>>/usr/spool/news/twitlog'\|);	# (log is reserved)
---
> 	open(LOG, \'>>/usr/spool/news/twitlog\'\|);	# (log is reserved)
218c227
< 		do process($file,'fh00');	# no pun intended
---
> 		do process($file, \'fh00\');	# no pun intended
221,222c230,231
< 	sub process {{
< 		local($filename,$input) = @_;
---
> 	sub process {
> 		local($filename, $input) = @_;
224c233
< 		unless (open($input,$filename)) {
---
> 		unless (open($input, $filename)) {
226c235
< 			last;		# note block inside sub
---
> 			return;
230c239
< 				do process($1,$input);
---
> 				do process($1, $input);
235c244
< 	}}
---
> 	}
242c251,254
< Here is a script that saves, redirects, and restores stdout and stdin:
---
> Here is a script that saves, redirects, and restores
> .I stdout
> and
> .IR stdin :
247,248c259,260
< 	open(saveout,">&stdout");
< 	open(saveerr,">&stderr");
---
> 	open(saveout, ">&stdout");
> 	open(saveerr, ">&stderr");
250,251c262,263
< 	open(stdout,">foo.out") || die "Can't redirect stdout";
< 	open(stderr,">&stdout") || die "Can't dup stdout";
---
> 	open(stdout, ">foo.out") || die "Can't redirect stdout";
> 	open(stderr, ">&stdout") || die "Can't dup stdout";
257c269
< 	print stderr "stderr 1\en";	# subprocesses too
---
> 	print stderr "stderr 1\en"; 	# subprocesses too
262,263c274,275
< 	open(stdout,">&saveout");
< 	open(stderr,">&saveerr");
---
> 	open(stdout, ">&saveout");
> 	open(stderr, ">&saveerr");
269c281
< If you open a pipe on the command \*(L"-\*(R", i.e. either \*(L"|-\*(R" or \*(L"-|\*(R",
---
> If you open a pipe on the command \*(L"\-\*(R", i.e. either \*(L"|\-\*(R" or \*(L"\-|\*(R",
274,276c286,293
< filehandle is piped from/to the stdout/stdin of the child process.
< In the child process the filehandle isn't opened--i/o happens from/to
< the new stdout or stdin.
---
> filehandle is piped from/to the
> .IR stdout / stdin
> of the child process.
> In the child process the filehandle isn't opened\*(--i/o happens from/to
> the new
> .I stdout
> or
> .IR stdin .
285,286c302,303
< 	open(FOO,"|tr '[a-z]' '[A-Z]'");
< 	open(FOO,"|-") || exec 'tr', '[a-z]', '[A-Z]';
---
> 	open(FOO, "|tr \'[a\-z]\' \'[A\-Z]\'");
> 	open(FOO, "|\-") || exec \'tr\', \'[a\-z]\', \'[A\-Z]\';
288,289c305,306
< 	open(FOO,"cat -n $file|");
< 	open(FOO,"-|") || exec 'cat', '-n', $file;
---
> 	open(FOO, "cat \-n $file|");
> 	open(FOO, "\-|") || exec \'cat\', \'\-n\', $file;
302c319
< 	$tmp = $ARRAY[$#ARRAY]; $#ARRAY--;
---
> 	$tmp = $ARRAY[$#ARRAY\-\|\-];
313,314c330,334
< If LIST is also omitted, prints $_ to stdout.
< To set the default output channel to something other than stdout use the select operation.
---
> If LIST is also omitted, prints $_ to
> .IR stdout .
> To set the default output channel to something other than
> .I stdout
> use the select operation.
326c346
< 	    $ARRAY[$#ARRAY+1] = $value;
---
> 	    $ARRAY[++$#ARRAY] = $value;
388,389c408,409
<     reset 'X';	\h'|2i'# reset all X variables
<     reset 'a-z';\h'|2i'# reset lower case variables
---
>     reset \'X\';	\h'|2i'# reset all X variables
>     reset \'a\-z\';\h'|2i'# reset lower case variables
393c413
< Note: resetting "A-Z" is not recommended since you'll wipe out your ARGV and ENV
---
> Note: resetting \*(L"A\-Z\*(R" is not recommended since you'll wipe out your ARGV and ENV
400c420,422
< It's the preferred method\*(--use of an explicit return is a bit slower.)
---
> That's the preferred method\*(--use of an explicit
> .I return
> is a bit slower.)
405c427
< The \*(L"g\*(R" is optional, and if present, indicates that all occurences
---
> The \*(L"g\*(R" is optional, and if present, indicates that all occurrences
434,437c456,459
<     $_ = 'abc123xyz';
<     s/\ed+/$&*2/e;		# yields 'abc246xyz'
<     s/\ed+/sprintf("%5d",$&)/e;	# yields 'abc  246xyz'
<     s/\w/$& x 2/e;		# yields 'aabbcc  246xxyyzz'
---
>     $_ = \'abc123xyz\';
>     s/\ed+/$&*2/e;		# yields \*(L'abc246xyz\*(R'
>     s/\ed+/sprintf("%5d",$&)/e;	# yields \*(L'abc  246xyz\*(R'
>     s/\ew/$& x 2/e;		# yields \*(L'aabbcc  246xxyyzz\*(R'
464c486
<     $^ = 'report1_top';
---
>     $^ = \'report1_top\';
466c488
<     $^ = 'report2_top';
---
>     $^ = \'report2_top\';
494c516
< a -1, 0, or 1, depending on how the elements of the array are to be ordered.
---
> a \-1, 0, or 1, depending on how the elements of the array are to be ordered.
506c528
< 	    $age{$a} < $age{$b} ? -1 : $age{$a} > $age{$b} ? 1 : 0;
---
> 	    $age{$a} < $age{$b} ? \-1 : $age{$a} > $age{$b} ? 1 : 0;
511,513c533,535
< 	sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
< 	@harry = ('dog','cat','x','Cain','Abel');
< 	@george = ('gone','chased','yz','Punished','Axed');
---
> 	sub reverse { $a lt $b ? 1 : $a gt $b ? \-1 : 0; }
> 	@harry = (\'dog\',\'cat\',\'x\',\'Cain\',\'Abel\');
> 	@george = (\'gone\',\'chased\',\'yz\',\'Punished\',\'Axed\');
518c540
< 	print sort @george,'to',@harry;
---
> 	print sort @george, \'to\', @harry;
538c560
< 	print join(':',split(/ */,'hi there'));
---
> 	print join(\':\', split(/ */, \'hi there\'));
541c563
< produces the output 'h:i:t:h:e:r:e'.
---
> produces the output \*(L'h:i:t:h:e:r:e\*(R'.
545c567
< As a special case, specifying a space ('\ ') will split on white space
---
> As a special case, specifying a space (\'\ \') will split on white space
548c570,572
< Thus, split('\ ') can be used to emulate awk's default behavior, whereas
---
> Thus, split(\'\ \') can be used to emulate
> .IR awk 's
> default behavior, whereas
556c580
< 	open(passwd, '/etc/passwd');
---
> 	open(passwd, \'/etc/passwd\');
578c602,604
< Sets the random number seed for the rand operator.
---
> Sets the random number seed for the
> .I rand
> operator.
603c629
< to be searched is made, so we know, for example, where all the `k' characters
---
> to be searched is made, so we know, for example, where all the \*(L'k\*(R' characters
609c635
< For example, here is a loop which inserts index producing entries before an line
---
> For example, here is a loop which inserts index producing entries before any line
624,625c650,651
< In searching for /\ebfoo\eb/, only those locations in $_ that contain `f'
< will be looked at, because `f' is rarer than `o'.
---
> In searching for /\ebfoo\eb/, only those locations in $_ that contain \*(L'f\*(R'
> will be looked at, because \*(L'f\*(R' is rarer than \*(L'o\*(R'.
641c667
< 	$search = 'while (<>) { study;';
---
> 	$search = \'while (<>) { study;\';
643c669
< 	    $search .= "\e++$seen{\e$ARGV} if /\eb$word\eb/;\en";
---
> 	    $search .= "++\e$seen{\e$ARGV} if /\eb$word\eb/;\en";
651c677
< 	    print $file,"\en";
---
> 	    print $file, "\en";
665c691,692
< See also exec.
---
> See also
> .IR exec .
674c701
< 	$symlink_exists = (eval 'symlink("","");', $@ eq '');
---
> 	$symlink_exists = (eval \'symlink("","");\', $@ eq \'\');
694c721
< Translates all occurences of the characters found in the search list with
---
> Translates all occurrences of the characters found in the search list with
710c737
<     $ARGV[1] \|=~ \|y/A-Z/a-z/;	\h'|3i'# canonicalize to lower case
---
>     $ARGV[1] \|=~ \|y/A\-Z/a\-z/;	\h'|3i'# canonicalize to lower case
714c741
<     ($HOST = $host) =~ tr/a-z/A-Z/;
---
>     ($HOST = $host) =~ tr/a\-z/A\-Z/;
716c743
<     y/\e001-@[-_{-\e177/ /;	\h'|3i'# change non-alphas to space
---
>     y/\e001\-@[\-_{\-\e177/ /;	\h'|3i'# change non-alphas to space
727c754
< 	$cnt = unlink 'a','b','c';
---
> 	$cnt = unlink \'a\', \'b\', \'c\';
732,733c759,762
< Note: unlink will not delete directories unless you are superuser and the \-U
< flag is supplied to perl.
---
> Note: unlink will not delete directories unless you are superuser and the
> .B \-U
> flag is supplied to
> .IR perl .
736,737c765,769
< Does the opposite of a shift.
< Or the opposite of a push, depending on how you look at it.
---
> Does the opposite of a
> .IR shift .
> Or the opposite of a
> .IR push ,
> depending on how you look at it.
742c774
< 	unshift(ARGV,'-e') unless $ARGV[0] =~ /^-/;
---
> 	unshift(ARGV, \'\-e\') unless $ARGV[0] =~ /^\-/;
757c789
< 	utime $now,$now,@ARGV;
---
> 	utime $now, $now, @ARGV;
791c823,825
< which starts out as stdout but may be changed by the
---
> which starts out as
> .I stdout
> but may be changed by the
798c832,833
< Perl operators have the following associativity and precedence:
---
> .I Perl
> operators have the following associativity and precedence:
804c839
< right\h'|1i'= += -= *= etc.
---
> right\h'|1i'= += \-= *= etc.
806c841
< nonassoc\h'|1i'..
---
> nonassoc\h'|1i'.\|.
814c849
< nonassoc\h'|1i'-r -w -x etc.
---
> nonassoc\h'|1i'\-r \-w \-x etc.
816c851
< left\h'|1i'+ - .
---
> left\h'|1i'+ \- .
821,822c856,857
< nonassoc\h'|1i'++ --
< left\h'|1i''('
---
> nonassoc\h'|1i'++ \-\|\-
> left\h'|1i'\*(L'(\*(R'
852c887,889
< To create local variables see the \*(L"local\*(R" operator.
---
> To create local variables see the
> .I local
> operator.
892c929
< 	while ($_ = get_line(\|)) {
---
> 	while ($_ = do get_line(\|)) {
899c936
< Use array assignment to local list to name your formal arguments:
---
> Use array assignment to a local list to name your formal arguments:
902c939
< 		local($key,$value) = @_;
---
> 		local($key, $value) = @_;
929,930c966,967
< $` returns everything before the matched string.
< $' returns everything after the matched string.
---
> $\` returns everything before the matched string.
> $\' returns everything after the matched string.
966c1003
< 	s/.*(some_string)[^\000]*/$1/;
---
> 	s/.*(some_string)[^\e000]*/$1/;
1001c1038
< with multiple <, >, or | characters to specify, respectively, left justfication,
---
> with multiple <, >, or | characters to specify, respectively, left justification,
1037a1075
> .ft C
1081a1120
> .ft R
1083a1123
> .fi
1086d1125
< .fi
1096c1135
< to take the chance that someone would say reset \*(L"a-zA-Z\*(R" and wipe them all
---
> to take the chance that someone would say reset \*(L"a\-zA\-Z\*(R" and wipe them all
1114,1115c1153,1154
< 	y/a-z/A-Z/
< 	$_ =~ y/a-z/A-Z/
---
> 	y/a\-z/A\-Z/
> 	$_ =~ y/a\-z/A\-Z/
1132c1171,1173
< Works like awk's RS variable, including treating blank lines as delimiters
---
> Works like
> .IR awk 's
> RS variable, including treating blank lines as delimiters
1140,1141c1181,1185
< In order to get behavior more like awk, set this variable as you would set
< awk's OFS variable to specify what is printed between fields.
---
> In order to get behavior more like
> .IR awk ,
> set this variable as you would set
> .IR awk 's
> OFS variable to specify what is printed between fields.
1147,1148c1191,1195
< In order to get behavior more like awk, set this variable as you would set
< awk's ORS variable to specify what is printed at the end of the print.
---
> In order to get behavior more like
> .IR awk ,
> set this variable as you would set
> .IR awk 's
> ORS variable to specify what is printed at the end of the print.
1150c1197,1198
< Also, it's just like /, but it's what you get \*(L"back\*(R" from perl.)
---
> Also, it's just like /, but it's what you get \*(L"back\*(R" from
> .IR perl .)
1153,1154c1201,1208
< This variable is a half-hearted attempt to emulate awk's OFMT variable.
< There are times, however, when awk and perl have differing notions of what
---
> This variable is a half-hearted attempt to emulate
> .IR awk 's
> OFMT variable.
> There are times, however, when
> .I awk
> and
> .I perl
> have differing notions of what
1157c1211,1213
< explicitly to get awk's value.
---
> explicitly to get
> .IR awk 's
> value.
1169c1225
< (Mnemonic: lines_on_page - lines_printed.)
---
> (Mnemonic: lines_on_page \- lines_printed.)
1182c1238,1240
< Note that stdout will typically be line buffered if output is to the
---
> Note that
> .I stdout
> will typically be line buffered if output is to the
1185c1243,1245
< such as when you are running a perl script under rsh and want to see the
---
> such as when you are running a
> .I perl
> script under rsh and want to see the
1194c1254,1256
< The status returned by the last backtick (``) command or system operator.
---
> The status returned by the last backtick (\`\`) command or
> .I system
> operator.
1203c1265
< .Ip $` 8 4
---
> .Ip $\` 8 4
1205,1206c1267,1268
< (Mnemonic: ` often precedes a quoted string.)
< .Ip $' 8 4
---
> (Mnemonic: \` often precedes a quoted string.)
> .Ip $\' 8 4
1208c1270
< (Mnemonic: ' often follows a quoted string.)
---
> (Mnemonic: \' often follows a quoted string.)
1213c1275
< 	$_ = 'abcdefghi';
---
> 	$_ = \'abcdefghi\';
1215c1277
< 	print "$`:$&:$'\n";	# prints abc:def:ghi
---
> 	print "$\`:$&:$\'\n";  	# prints abc:def:ghi
1267c1329,1330
< Default is "\e034", the same as SUBSEP in awk.
---
> Default is "\e034", the same as SUBSEP in
> .IR awk .
1301c1364
< (Mnemonic: parens are used to GROUP things.
---
> (Mnemonic: parentheses are used to GROUP things.
1309c1372
< (Mnemonic: parens are used to GROUP things.
---
> (Mnemonic: parentheses are used to GROUP things.
1320c1383,1385
< The array INC contains the list of places to look for perl scripts to be
---
> The array INC contains the list of places to look for
> .I perl
> scripts to be
1322,1323c1387,1392
< It initially consists of the arguments to any -I command line switches, followed
< by the default perl library, probably \*(L"/usr/local/lib/perl\*(R".
---
> It initially consists of the arguments to any
> .B \-I
> command line switches, followed
> by the default
> .I perl
> library, probably \*(L"/usr/local/lib/perl\*(R".
1335c1404
< 		print "Caught a SIG$sig--shutting down\en";
---
> 		print "Caught a SIG$sig\-\|\-shutting down\en";
1340,1341c1409,1410
< 	$SIG{'INT'} = 'handler';
< 	$SIG{'QUIT'} = 'handler';
---
> 	$SIG{\'INT\'} = \'handler\';
> 	$SIG{\'QUIT\'} = \'handler\';
1343,1344c1412,1413
< 	$SIG{'INT'} = 'DEFAULT';	# restore default action
< 	$SIG{'QUIT'} = 'IGNORE';	# ignore SIGQUIT
---
> 	$SIG{\'INT\'} = \'DEFAULT\';	# restore default action
> 	$SIG{\'QUIT\'} = \'IGNORE\';	# ignore SIGQUIT
1356,1358c1425,1427
<     $ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
<     $ENV{'SHELL'} = '/bin/sh' if $ENV{'SHELL'};
<     $ENV{'IFS'} = '' if $ENV{'IFS'};
---
>     $ENV{\'PATH\'} = \'/bin:/usr/bin\';    # or whatever you need
>     $ENV{\'SHELL\'} = \'/bin/sh\' if $ENV{\'SHELL\'};
>     $ENV{\'IFS\'} = \'\' if $ENV{\'IFS\'};
1384c1453,1455
< Accustomed awk users should take special note of the following:
---
> Accustomed
> .IR awk
> users should take special note of the following:
1386c1457,1459
< Semicolons are required after all simple statements in perl.  Newline
---
> Semicolons are required after all simple statements in
> .IR perl .
> Newline
1391c1464,1465
< Variables begin with $ or @ in perl.
---
> Variables begin with $ or @ in
> .IR perl .
1404c1478,1480
< And split has different arguments.
---
> And the
> .I split
> operator has different arguments.
1411,1416c1487
< The current filename is $ARGV, not $FILENAME.
< NR, RS, ORS, OFS, and OFMT have equivalents with other symbols.
< FS doesn't have an equivalent, since you have to be explicit about
< split statements.
< .Ip * 4 2
< $<digit> does not refer to fields--it refers to substrings matched by the last
---
> $<digit> does not refer to fields\*(--it refers to substrings matched by the last
1419c1490,1492
< The print statement does not add field and record separators unless you set
---
> The
> .I print
> statement does not add field and record separators unless you set
1424c1497
< The range operator is \*(L"..\*(R", not comma.
---
> The range operator is \*(L".\|.\*(R", not comma.
1434c1507
< (Using the null string would render \*(L"/pat/ /pat/\*(R" unparseable,
---
> (Using the null string would render \*(L"/pat/ /pat/\*(R" unparsable,
1439c1512,1516
< Next, exit, and continue work differently.
---
> .IR Next ,
> .I exit
> and
> .I continue
> work differently.
1448c1525
< 	  FNR	\h'|2.5i'$.
---
> 	  FNR	\h'|2.5i'$. \- something
1451c1528
< 	  NR	\h'|2.5i'$. sometimes
---
> 	  NR	\h'|2.5i'$.
1457c1534
< 	  RSTART	\h'|2.5i'length($`)
---
> 	  RSTART	\h'|2.5i'length($\`)
1462c1539,1541
< When in doubt, run the awk construct through a2p and see what it gives you.
---
> When in doubt, run the
> .I awk
> construct through a2p and see what it gives you.
1470c1549,1556
< Break and continue become last and next, respectively.
---
> .I Break
> and
> .I continue
> become
> .I last
> and
> .IR next ,
> respectively.
1474c1560,1561
< Variables begin with $ or @ in perl.
---
> Variables begin with $ or @ in
> .IR perl .
1488c1575,1577
< Seasoned sed programmers should take note of the following:
---
> Seasoned
> .I sed
> programmers should take note of the following:
1494c1583
< The range operator is .. rather than comma.
---
> The range operator is .\|. rather than comma.
1504c1593,1594
< Perl does substitution only in certain constructs such as double quotes,
---
> .I Perl
> does substitution only in certain constructs such as double quotes,
1508c1598,1599
< Perl compiles the whole program before executing it.
---
> .I Perl
> compiles the whole program before executing it.
1521c1612,1613
< Perl is at the mercy of the C compiler's definitions of various operations
---
> .I Perl
> is at the mercy of the C compiler's definitions of various operations
1527c1619
< a given token may not be longer than 255 characters;
---
> a given identifier may not be longer than 255 characters;
1531c1623
< no component of your PATH may be longer than 255 if you use -S.
---
> no component of your PATH may be longer than 255 if you use \-S.

Index: perly.c
Prereq: 2.0.1.3
*** perly.c.old	Fri Jul 15 01:40:02 1988
--- perly.c	Fri Jul 15 01:40:06 1988
***************
*** 1,6 ****
! char rcsid[] = "$Header: perly.c,v 2.0.1.3 88/07/12 17:34:12 root Exp $";
  /*
   * $Log:	perly.c,v $
   * Revision 2.0.1.3  88/07/12  17:34:12  root
   * patch6: forced DOSUID if IAMSUID
   * patch6: added some static evaluation for sin, cos, atan2 and **
--- 1,9 ----
! char rcsid[] = "$Header: perly.c,v 2.0.1.4 88/07/15 01:34:03 root Exp $";
  /*
   * $Log:	perly.c,v $
+  * Revision 2.0.1.4  88/07/15  01:34:03  root
+  * patch9: optimization of && and || to if and unless occasionally failed
+  * 
   * Revision 2.0.1.3  88/07/12  17:34:12  root
   * patch6: forced DOSUID if IAMSUID
   * patch6: added some static evaluation for sin, cos, atan2 and **
***************
*** 637,642 ****
--- 640,646 ----
      if (acmd && !cmd->ucmd.acmd.ac_expr && 
        (arg->arg_type == O_AND || arg->arg_type == O_OR) ) {
  	dehoist(arg,1);
+ 	arg[2].arg_flags &= ~AF_SPECIAL;	/* don't suppress eval */
  	dehoist(arg,2);
  	cmd->ucmd.acmd.ac_expr = arg[2].arg_ptr.arg_arg;
  	cmd->c_expr = arg[1].arg_ptr.arg_arg;
***************
*** 643,649 ****
  	if (arg->arg_type == O_OR)
  	    cmd->c_flags ^= CF_INVERT;		/* || is like unless */
  	arg->arg_len = 0;
! 	arg_free(arg);
  	arg = cmd->c_expr;
      }
  
--- 647,653 ----
  	if (arg->arg_type == O_OR)
  	    cmd->c_flags ^= CF_INVERT;		/* || is like unless */
  	arg->arg_len = 0;
! 	free_arg(arg);
  	arg = cmd->c_expr;
      }
  

Index: str.c
Prereq: 2.0.1.1
*** str.c.old	Fri Jul 15 01:40:12 1988
--- str.c	Fri Jul 15 01:40:13 1988
***************
*** 1,6 ****
! /* $Header: str.c,v 2.0.1.1 88/06/28 16:38:11 root Exp $
   *
   * $Log:	str.c,v $
   * Revision 2.0.1.1  88/06/28  16:38:11  root
   * patch1: autoincrement of '' didn't work right.
   * 
--- 1,9 ----
! /* $Header: str.c,v 2.0.1.2 88/07/15 01:34:52 root Exp $
   *
   * $Log:	str.c,v $
+  * Revision 2.0.1.2  88/07/15  01:34:52  root
+  * patch9: reset 'E' didn't wipe out the environment
+  * 
   * Revision 2.0.1.1  88/06/28  16:38:11  root
   * patch1: autoincrement of '' didn't work right.
   * 
***************
*** 12,17 ****
--- 15,22 ----
  #include "EXTERN.h"
  #include "perl.h"
  
+ extern char **environ;
+ 
  str_reset(s)
  register char *s;
  {
***************
*** 48,53 ****
--- 53,60 ----
  		}
  		if (stab->stab_hash) {
  		    hclear(stab->stab_hash);
+ 		    if (stab == envstab)
+ 			environ[0] = Nullch;
  		}
  	    }
  	}

Index: util.c
Prereq: 2.0.1.1
*** util.c.old	Fri Jul 15 01:40:21 1988
--- util.c	Fri Jul 15 01:40:22 1988
***************
*** 1,6 ****
! /* $Header: util.c,v 2.0.1.1 88/07/11 23:12:55 root Exp $
   *
   * $Log:	util.c,v $
   * Revision 2.0.1.1  88/07/11  23:12:55  root
   * patch2: increased maximum error message size from 256 to 1024
   * 
--- 1,9 ----
! /* $Header: util.c,v 2.0.1.2 88/07/15 01:36:46 root Exp $
   *
   * $Log:	util.c,v $
+  * Revision 2.0.1.2  88/07/15  01:36:46  root
+  * patch9: passing null value to setenv() now destroys environment variable
+  * 
   * Revision 2.0.1.1  88/07/11  23:12:55  root
   * patch2: increased maximum error message size from 256 to 1024
   * 
***************
*** 499,504 ****
--- 502,514 ----
  {
      register int i=envix(nam);		/* where does it go? */
  
+     if (!val) {
+ 	while (environ[i]) {
+ 	    environ[i] = environ[i+1];
+ 	    i++;
+ 	}
+ 	return;
+     }
      if (!environ[i]) {			/* does not exist yet */
  	if (firstsetenv) {		/* need we copy environment? */
  	    int j;

Index: x2p/walk.c
Prereq: 2.0.1.1
*** x2p/walk.c.old	Fri Jul 15 01:40:27 1988
--- x2p/walk.c	Fri Jul 15 01:40:30 1988
***************
*** 1,6 ****
! /* $Header: walk.c,v 2.0.1.1 88/07/11 23:35:57 root Exp $
   *
   * $Log:	walk.c,v $
   * Revision 2.0.1.1  88/07/11  23:35:57  root
   * patch2: changes to support translation of 1985 awk
   * patch2: handles multiple opens to same file better
--- 1,9 ----
! /* $Header: walk.c,v 2.0.1.2 88/07/15 01:39:36 root Exp $
   *
   * $Log:	walk.c,v $
+  * Revision 2.0.1.2  88/07/15  01:39:36  root
+  * patch9: gcc complained about "\$", so it's now "\\$"
+  * 
   * Revision 2.0.1.1  88/07/11  23:35:57  root
   * patch2: changes to support translation of 1985 awk
   * patch2: handles multiple opens to same file better
***************
*** 804,810 ****
  	    tmp2str=walk(1,level,ops[node+2].ival,&numarg);
  	    str_set(tmp3str,"($s_ = '\"'.(");
  	    str_scat(tmp3str,tmp2str);
! 	    str_cat(tmp3str,").'\"') =~ s/&/\$&/g, ");
  	    str_set(tmp2str,"eval $s_");
  	    s = (*s == 'g' ? "ge" : "e");
  	    i++;
--- 807,813 ----
  	    tmp2str=walk(1,level,ops[node+2].ival,&numarg);
  	    str_set(tmp3str,"($s_ = '\"'.(");
  	    str_scat(tmp3str,tmp2str);
! 	    str_cat(tmp3str,").'\"') =~ s/&/\\$&/g, ");
  	    str_set(tmp2str,"eval $s_");
  	    s = (*s == 'g' ? "ge" : "e");
  	    i++;