perl 2.0 patch #13

The Superuser lroot at jpl-devvax.JPL.NASA.GOV
Fri Aug 5 18:43:57 AEST 1988


System: perl version 2.0
Patch #: 13
Priority: LOW
Subject: Configure now supports alternate C compilers better
Subject: form feed no longer produced before first page
Subject: fixed loop stack overflow on goto
Subject: fixed recursive subroutine storage management
Subject: a2p was treating strings and numbers as variables
Subject: dumb typo in last patch

Description:
	Configure now figures out which C compiler you want early enough
	for it to do some good in the other tests that Configure does.

	It turned out to be easy to make "goto" exit loops without overflowing
	the label stack.  So I did.

	I botched the analysis routine that figures out which temporaries
	in the syntax tree have to be saved in the event of recursion.
	Hopefully I've improved it.

	a2p was treating strings and numbers as variables.  The string
		"abc" ++b
	was being translated to 
		"abc"++ . $b
	Turned out the grammar was wrong.

	In the last patch in walk.c I said str_cur when I meant str_ptr.
	Dumb, dumb, dumb.

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:
		Configure -d	# omit -d if you wish to change C compiler
		make depend
		make
		make test
		make install
		cd x2p
		make
		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 at 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: 12
1c1
< #define PATCHLEVEL 12
---
> #define PATCHLEVEL 13

Index: Configure
Prereq: 2.0.1.3
*** Configure.old	Fri Aug  5 01:31:28 1988
--- Configure	Fri Aug  5 01:31:31 1988
***************
*** 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 2.0.1.3 88/08/03 21:59:07 root Exp $
  #
  # Yes, you may rip this off to use in other distribution packages.
  # (Note: this Configure script was generated automatically.  Rather than
--- 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 2.0.1.4 88/08/05 01:23:27 root Exp $
  #
  # Yes, you may rip this off to use in other distribution packages.
  # (Note: this Configure script was generated automatically.  Rather than
***************
*** 66,75 ****
  mailx=''
  mail=''
  cpp=''
  Log=''
  Header=''
  bin=''
- cc=''
  contains=''
  cppstdin=''
  cppminus=''
--- 66,75 ----
  mailx=''
  mail=''
  cpp=''
+ perl=''
  Log=''
  Header=''
  bin=''
  contains=''
  cppstdin=''
  cppminus=''
***************
*** 112,117 ****
--- 112,118 ----
  huge=''
  ccflags=''
  ldflags=''
+ cc=''
  n=''
  c=''
  package=''
***************
*** 152,165 ****
  
  : Now test for existence of everything in MANIFEST
  
  (cd ..; cat `awk 'NR>4{print $1}' MANIFEST` >/dev/null || kill $$)
  
  attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
  attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
  attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
  attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
  attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
! pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /lib"
  d_newshome="/usr/NeWS"
  defvoidused=7
  
--- 153,169 ----
  
  : Now test for existence of everything in MANIFEST
  
+ echo "First let's make sure your kit is complete.  Checking..."
  (cd ..; cat `awk 'NR>4{print $1}' MANIFEST` >/dev/null || kill $$)
+ echo " "
  
  attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
  attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
+ attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
  attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
  attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
  attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
! pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /lib /usr/local/lib"
  d_newshome="/usr/NeWS"
  defvoidused=7
  
***************
*** 387,400 ****
      echo "Hopefully test is built into your sh."
      ;;
  /bin/test)
!     echo " "
!     dflt=n
!     rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)"
!     echo $n "$rp $c"
!     . myread
!     case "$ans" in
!     y*) test=test ;;
!     esac
      ;;
  *)
      test=test
--- 391,400 ----
      echo "Hopefully test is built into your sh."
      ;;
  /bin/test)
!     if sh -c "PATH= test true" >/dev/null 2>&1; then
! 	echo "Using the test built into your sh."
! 	test=test
!     fi
      ;;
  *)
      test=test
***************
*** 627,632 ****
--- 627,955 ----
  fi
  rm -f try today
  
+ : set up shell script to do ~ expansion
+ cat >filexp <<EOSS
+ $startsh
+ : expand filename
+ case "\$1" in
+  ~/*|~)
+     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
+     ;;
+  ~*)
+     if $test -f /bin/csh; then
+ 	/bin/csh -f -c "glob \$1"
+ 	echo ""
+     else
+ 	name=\`$expr x\$1 : '..\([^/]*\)'\`
+ 	dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
+ 	if $test ! -d "\$dir"; then
+ 	    me=\`basename \$0\`
+ 	    echo "\$me: can't locate home directory for: \$name" >&2
+ 	    exit 1
+ 	fi
+ 	case "\$1" in
+ 	*/*)
+ 	    echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
+ 	    ;;
+ 	*)
+ 	    echo \$dir
+ 	    ;;
+ 	esac
+     fi
+     ;;
+ *)
+     echo \$1
+     ;;
+ esac
+ EOSS
+ chmod +x filexp
+ $eunicefix filexp
+ 
+ : determine where manual pages go
+ case "$mansrc" in
+ '')
+     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
+     ;;
+ *)  dflt="$mansrc"
+     ;;
+ esac
+ cont=true
+ while $test "$cont" ; do
+     echo " "
+     rp="Where do the manual pages (source) go? [$dflt]"
+     $echo $n "$rp $c"
+     . myread
+     mansrc=`filexp "$ans"`
+     if test -d $mansrc; then
+ 	cont=''
+     else
+ 	dflt=n
+ 	rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
+ 	$echo $n "$rp $c"
+ 	. myread
+ 	dflt=''
+ 	case "$ans" in
+ 	y*) cont='';;
+ 	esac
+     fi
+ done
+ case "$mansrc" in
+ *l)
+     manext=l
+     ;;
+ *n)
+     manext=n
+     ;;
+ *C)
+     manext=C
+     ;;
+ *)
+     manext=1
+     ;;
+ esac
+ 
+ : see what memory models we can support
+ case "$models" in
+ '')
+     : We may not use Cppsym or we get a circular dependency through cc.
+     : But this should work regardless of which cc we eventually use.
+     cat >pdp11.c <<'EOP'
+ main() {
+ #ifdef pdp11
+     exit(0);
+ #else
+     exit(1);
+ #endif
+ }
+ EOP
+     cc -o pdp11 pdp11.c >/dev/null 2>&1
+     if pdp11 2>/dev/null; then
+ 	dflt='unsplit split'
+     else
+ 	ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
+ 	case "$ans" in
+ 	X) dflt='none';;
+ 	*)  if $test -d /lib/small || $test -d /usr/lib/small; then
+ 		dflt='small'
+ 	    else
+ 		dflt=''
+ 	    fi
+ 	    if $test -d /lib/medium || $test -d /usr/lib/medium; then
+ 		dflt="$dflt medium"
+ 	    fi
+ 	    if $test -d /lib/large || $test -d /usr/lib/large; then
+ 		dflt="$dflt large"
+ 	    fi
+ 	    if $test -d /lib/huge || $test -d /usr/lib/huge; then
+ 		dflt="$dflt huge"
+ 	    fi
+ 	esac
+     fi
+     ;;
+ *)  dflt="$models" ;;
+ esac
+ $cat <<EOM
+  
+ Some systems have different model sizes.  On most systems they are called
+ small, medium, large, and huge.  On the PDP11 they are called unsplit and
+ split.  If your system doesn't support different memory models, say "none".
+ If you wish to force everything to one memory model, say "none" here and
+ put the appropriate flags later when it asks you for other cc and ld flags.
+ Venix systems may wish to put "none" and let the compiler figure things out.
+ (In the following question multiple model names should be space separated.)
+ 
+ EOM
+ rp="Which models are supported? [$dflt]"
+ $echo $n "$rp $c"
+ . myread
+ models="$ans"
+ 
+ case "$models" in
+ none)
+     small=''
+     medium=''
+     large=''
+     huge=''
+     unsplit=''
+     split=''
+     ;;
+ *split)
+     case "$split" in
+     '') 
+ 	if $contains '\-i' $mansrc/ld.1 >/dev/null 2>&1 || \
+ 	   $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1; then
+ 	    dflt='-i'
+ 	else
+ 	    dflt='none'
+ 	fi
+ 	;;
+     *) dflt="$split";;
+     esac
+     rp="What flag indicates separate I and D space? [$dflt]"
+     $echo $n "$rp $c"
+     . myread
+     case "$ans" in
+     none) ans='';;
+     esac
+     split="$ans"
+     unsplit=''
+     ;;
+ *large*|*small*|*medium*|*huge*)
+     case "$model" in
+     *large*)
+ 	case "$large" in
+ 	'') dflt='-Ml';;
+ 	*) dflt="$large";;
+ 	esac
+ 	rp="What flag indicates large model? [$dflt]"
+ 	$echo $n "$rp $c"
+ 	. myread
+ 	case "$ans" in
+ 	none) ans='';
+ 	esac
+ 	large="$ans"
+ 	;;
+     *) large='';;
+     esac
+     case "$model" in
+     *huge*)
+ 	case "$huge" in
+ 	'') dflt='-Mh';;
+ 	*) dflt="$huge";;
+ 	esac
+ 	rp="What flag indicates huge model? [$dflt]"
+ 	$echo $n "$rp $c"
+ 	. myread
+ 	case "$ans" in
+ 	none) ans='';
+ 	esac
+ 	huge="$ans"
+ 	;;
+     *) huge="$large";;
+     esac
+     case "$model" in
+     *medium*)
+ 	case "$medium" in
+ 	'') dflt='-Mm';;
+ 	*) dflt="$medium";;
+ 	esac
+ 	rp="What flag indicates medium model? [$dflt]"
+ 	$echo $n "$rp $c"
+ 	. myread
+ 	case "$ans" in
+ 	none) ans='';
+ 	esac
+ 	medium="$ans"
+ 	;;
+     *) medium="$large";;
+     esac
+     case "$model" in
+     *small*)
+ 	case "$small" in
+ 	'') dflt='none';;
+ 	*) dflt="$small";;
+ 	esac
+ 	rp="What flag indicates small model? [$dflt]"
+ 	$echo $n "$rp $c"
+ 	. myread
+ 	case "$ans" in
+ 	none) ans='';
+ 	esac
+ 	small="$ans"
+ 	;;
+     *) small='';;
+     esac
+     ;;
+ *)
+     echo "Unrecognized memory models--you may have to edit Makefile.SH"
+     ;;
+ esac
+ 
+ : see if we need a special compiler
+ echo " "
+ if usg; then
+     case "$cc" in
+     '')
+ 	case "$Mcc" in
+ 	/*) dflt='Mcc'
+ 	    ;;
+ 	*)
+ 	    case "$large" in
+ 	    -M*)
+ 		dflt='cc'
+ 		;;
+ 	    *)
+ 		if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
+ 		    dflt='cc -M'
+ 		else
+ 		    dflt='cc'
+ 		fi
+ 		;;
+ 	    esac
+ 	    ;;
+ 	esac
+ 	;;
+     *)  dflt="$cc";;
+     esac
+     $cat <<'EOM'
+  
+ On some systems the default C compiler will not resolve multiple global
+ references that happen to have the same name.  On some such systems the
+ "Mcc" command may be used to force these to be resolved.  On other systems
+ a "cc -M" command is required.  (Note that the -M flag on other systems
+ indicates a memory model to use!)  If you have the Gnu C compiler, you
+ might wish to use that instead.  What command will force resolution on
+ EOM
+     $echo $n "this system? [$dflt] $c"
+     rp="Command to resolve multiple refs? [$dflt]"
+     . myread
+     cc="$ans"
+ else
+     case "$cc" in
+     '') dflt=cc;;
+     *) dflt="$cc";;
+     esac
+     rp="Use which C compiler? [$dflt]"
+     $echo $n "$rp $c"
+     . myread
+     cc="$ans"
+ fi
+ case "$cc" in
+ gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
+ esac
+ 
+ case "$ccflags" in
+ '') dflt='none';;
+ *) dflt="$ccflags";;
+ esac
+ echo " "
+ rp="Any additional cc flags? [$dflt]"
+ $echo $n "$rp $c"
+ . myread
+ case "$ans" in
+ none) ans='';
+ esac
+ ccflags="$ans"
+ 
+ case "$ldflags" in
+ '') if venix; then
+ 	dflt='-i -z'
+     else
+ 	dflt='none'
+     fi
+     ;;
+ *) dflt="$ldflags";;
+ esac
+ echo " "
+ rp="Any additional ld flags? [$dflt]"
+ $echo $n "$rp $c"
+ . myread
+ case "$ans" in
+ none) ans='';
+ esac
+ ldflags="$ans"
+ rmlist="$rmlist pdp11"
+ 
  : see how we invoke the C preprocessor
  echo " "
  echo "Now, how can we feed standard input to your C preprocessor..."
***************
*** 635,680 ****
  #define XYZ xyz
  ABC.XYZ
  EOT
! echo 'Maybe "'$cpp'" will work...'
! $cpp <testcpp.c >testcpp.out 2>&1
  if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
      echo "Yup, it does."
!     cppstdin="$cpp"
      cppminus='';
  else
!     echo 'Nope, maybe "'$cpp' -" will work...'
!     $cpp - <testcpp.c >testcpp.out 2>&1
      if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  	echo "Yup, it does."
  	cppstdin="$cpp"
! 	cppminus='-';
      else
! 	echo 'No such luck...maybe "cc -E" will work...'
! 	cc -E <testcpp.c >testcpp.out 2>&1
  	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  	    echo "It works!"
! 	    cppstdin='cc -E'
! 	    cppminus='';
  	else
! 	    echo 'Nixed again...maybe "cc -E -" will work...'
! 	    cc -E - <testcpp.c >testcpp.out 2>&1
  	    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  		echo "Hooray, it works!  I was beginning to wonder."
! 		cppstdin='cc -E'
  		cppminus='-';
  	    else
! 		echo 'Nope...maybe "cc -P" will work...'
! 		cc -P <testcpp.c >testcpp.out 2>&1
  		if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  		    echo "Yup, that does."
! 		    cppstdin='cc -P'
  		    cppminus='';
  		else
! 		    echo 'Nope...maybe "cc -P -" will work...'
! 		    cc -P - <testcpp.c >testcpp.out 2>&1
  		    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  			echo "Yup, that does."
! 			cppstdin='cc -P'
  			cppminus='-';
  		    else
  			echo 'Hmm...perhaps you already told me...'
--- 958,1003 ----
  #define XYZ xyz
  ABC.XYZ
  EOT
! echo 'Maybe "'"$cc"' -E" will work...'
! $cc -E <testcpp.c >testcpp.out 2>&1
  if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
      echo "Yup, it does."
!     cppstdin="$cc -E"
      cppminus='';
  else
!     echo 'Nope, maybe "'$cpp'" will work...'
!     $cpp <testcpp.c >testcpp.out 2>&1
      if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  	echo "Yup, it does."
  	cppstdin="$cpp"
! 	cppminus='';
      else
! 	echo 'No such luck...maybe "'$cpp' -" will work...'
! 	$cpp - <testcpp.c >testcpp.out 2>&1
  	if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  	    echo "It works!"
! 	    cppstdin="$cpp"
! 	    cppminus='-';
  	else
! 	    echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
! 	    $cc -E - <testcpp.c >testcpp.out 2>&1
  	    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  		echo "Hooray, it works!  I was beginning to wonder."
! 		cppstdin="$cc -E"
  		cppminus='-';
  	    else
! 		echo 'Nope...maybe "'"$cc"' -P" will work...'
! 		$cc -P <testcpp.c >testcpp.out 2>&1
  		if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  		    echo "Yup, that does."
! 		    cppstdin="$cc -P"
  		    cppminus='';
  		else
! 		    echo 'Nope...maybe "'"$cc"' -P -" will work...'
! 		    $cc -P - <testcpp.c >testcpp.out 2>&1
  		    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  			echo "Yup, that does."
! 			cppstdin="$cc -P"
  			cppminus='-';
  		    else
  			echo 'Hmm...perhaps you already told me...'
***************
*** 686,694 ****
  			    echo "Hooray, you did!  I was beginning to wonder."
  			else
  			    echo 'Uh-uh.  Time to get fancy...'
! 			    echo 'Trying (cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
! 			    cppstdin='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
  			    cppminus='';
  			    $cppstdin <testcpp.c >testcpp.out 2>&1
  			    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  				echo "Eureka!."
--- 1009,1021 ----
  			    echo "Hooray, you did!  I was beginning to wonder."
  			else
  			    echo 'Uh-uh.  Time to get fancy...'
! 			    cd ..
! 			    echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
! 			    echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
! 			    chmod 755 cppstdin
! 			    cppstdin=`pwd`/cppstdin
  			    cppminus='';
+ 			    cd UU
  			    $cppstdin <testcpp.c >testcpp.out 2>&1
  			    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  				echo "Eureka!."
***************
*** 730,736 ****
  cat >.ucbsprf.c <<'EOF'
  main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
  EOF
! if cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
      echo "Your sprintf() returns (int)."
      d_charsprf="$undef"
  else
--- 1057,1063 ----
  cat >.ucbsprf.c <<'EOF'
  main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
  EOF
! if $cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
      echo "Your sprintf() returns (int)."
      d_charsprf="$undef"
  else
***************
*** 958,964 ****
  	foo = bar;
  }
  EOCP
! if cc -c try.c >/dev/null 2>&1 ; then
      d_strctcpy="$define"
      echo "Yup, it can."
  else
--- 1285,1291 ----
  	foo = bar;
  }
  EOCP
! if $cc -c try.c >/dev/null 2>&1 ; then
      d_strctcpy="$define"
      echo "Yup, it can."
  else
***************
*** 1040,1062 ****
  	exit(0);
  }
  EOCP
!     if cc -S -DTRY=7 try.c >.out 2>&1 ; then
! 	voidflags=7
! 	echo "It appears to support void fully."
  	if $contains warning .out >/dev/null 2>&1; then
  	    echo "However, you might get some warnings that look like this:"
  	    $cat .out
  	fi
      else
! 	echo "Hmm, you compiler has some difficulty with void.  Checking further..."
! 	if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
  	    echo "It supports 1..."
! 	    if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  		voidflags=3
  		echo "And it supports 2 but not 4."
  	    else
  		echo "It doesn't support 2..."
! 		if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  		    voidflags=5
  		    echo "But it supports 4."
  		else
--- 1367,1389 ----
  	exit(0);
  }
  EOCP
!     if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
! 	voidflags=$defvoidused
! 	echo "It appears to support void."
  	if $contains warning .out >/dev/null 2>&1; then
  	    echo "However, you might get some warnings that look like this:"
  	    $cat .out
  	fi
      else
! 	echo "Hmm, your compiler has some difficulty with void.  Checking further..."
! 	if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
  	    echo "It supports 1..."
! 	    if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  		voidflags=3
  		echo "And it supports 2 but not 4."
  	    else
  		echo "It doesn't support 2..."
! 		if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
  		    voidflags=5
  		    echo "But it supports 4."
  		else
***************
*** 1100,1143 ****
  . myread
  gidtype="$ans"
  
- : set up shell script to do ~ expansion
- cat >filexp <<EOSS
- $startsh
- : expand filename
- case "\$1" in
-  ~/*|~)
-     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
-     ;;
-  ~*)
-     if $test -f /bin/csh; then
- 	/bin/csh -f -c "glob \$1"
- 	echo ""
-     else
- 	name=\`$expr x\$1 : '..\([^/]*\)'\`
- 	dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
- 	if $test ! -d "\$dir"; then
- 	    me=\`basename \$0\`
- 	    echo "\$me: can't locate home directory for: \$name" >&2
- 	    exit 1
- 	fi
- 	case "\$1" in
- 	*/*)
- 	    echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
- 	    ;;
- 	*)
- 	    echo \$dir
- 	    ;;
- 	esac
-     fi
-     ;;
- *)
-     echo \$1
-     ;;
- esac
- EOSS
- chmod +x filexp
- $eunicefix filexp
- 
  : determine where private executables go
  case "$privlib" in
  '')
--- 1427,1432 ----
***************
*** 1179,1185 ****
      printf("%d\n",i);
  }
  EOCP
!     if cc try.c -o try >/dev/null 2>&1 ; then
  	dflt=`try`
      else
  	dflt='?'
--- 1468,1474 ----
      printf("%d\n",i);
  }
  EOCP
!     if $cc try.c -o try >/dev/null 2>&1 ; then
  	dflt=`try`
      else
  	dflt='?'
***************
*** 1263,1590 ****
      fi
  done
  
- : determine where manual pages go
- case "$mansrc" in
- '')
-     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
-     ;;
- *)  dflt="$mansrc"
-     ;;
- esac
- cont=true
- while $test "$cont" ; do
-     echo " "
-     rp="Where do the manual pages (source) go? [$dflt]"
-     $echo $n "$rp $c"
-     . myread
-     mansrc=`filexp "$ans"`
-     if test -d $mansrc; then
- 	cont=''
-     else
- 	dflt=n
- 	rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
- 	$echo $n "$rp $c"
- 	. myread
- 	dflt=''
- 	case "$ans" in
- 	y*) cont='';;
- 	esac
-     fi
- done
- case "$mansrc" in
- *l)
-     manext=l
-     ;;
- *n)
-     manext=n
-     ;;
- *C)
-     manext=C
-     ;;
- *)
-     manext=1
-     ;;
- esac
- 
- : get C preprocessor symbols handy
- echo " "
- echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
- $cat <<EOSS >Cppsym
- $startsh
- case "\$1" in
- -l) list=true
-     shift
-     ;;
- esac
- unknown=''
- case "\$list\$#" in
- 1|2)
-     for sym do
- 	if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
- 	    exit 0
- 	elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
- 		:
- 	else
- 	    unknown="\$unknown \$sym"
- 	fi
-     done
-     set X \$unknown
-     shift
-     ;;
- esac
- case \$# in
- 0) exit 1;;
- esac
- echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
- #ifdef \1\\
- exit 0; _ _ _ _\1\\	 \1\\
- #endif\\
- /' >/tmp/Cppsym\$\$
- echo exit 1 >>/tmp/Cppsym\$\$
- $cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
- case "\$list" in
- true) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
- *)
-     sh /tmp/Cppsym2\$\$
-     status=\$?
-     ;;
- esac
- $rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
- exit \$status
- EOSS
- chmod +x Cppsym
- $eunicefix Cppsym
- echo "Your C preprocessor defines the following symbols:"
- Cppsym -l $attrlist >Cppsym.true
- cat Cppsym.true
- rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
- 
- : see what memory models we can support
- case "$models" in
- '')
-     if Cppsym pdp11; then
- 	dflt='unsplit split'
-     else
- 	ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
- 	case "$ans" in
- 	X) dflt='none';;
- 	*)  if $test -d /lib/small || $test -d /usr/lib/small; then
- 		dflt='small'
- 	    else
- 		dflt=''
- 	    fi
- 	    if $test -d /lib/medium || $test -d /usr/lib/medium; then
- 		dflt="$dflt medium"
- 	    fi
- 	    if $test -d /lib/large || $test -d /usr/lib/large; then
- 		dflt="$dflt large"
- 	    fi
- 	    if $test -d /lib/huge || $test -d /usr/lib/huge; then
- 		dflt="$dflt huge"
- 	    fi
- 	esac
-     fi
-     ;;
- *)  dflt="$models" ;;
- esac
- $cat <<EOM
-  
- Some systems have different model sizes.  On most systems they are called
- small, medium, large, and huge.  On the PDP11 they are called unsplit and
- split.  If your system doesn't support different memory models, say "none".
- If you wish to force everything to one memory model, say "none" here and
- put the appropriate flags later when it asks you for other cc and ld flags.
- Venix systems may wish to put "none" and let the compiler figure things out.
- (In the following question multiple model names should be space separated.)
- 
- EOM
- rp="Which models are supported? [$dflt]"
- $echo $n "$rp $c"
- . myread
- models="$ans"
- 
- case "$models" in
- none)
-     small=''
-     medium=''
-     large=''
-     huge=''
-     unsplit=''
-     split=''
-     ;;
- *split)
-     case "$split" in
-     '') 
- 	if $contains '\-i' $mansrc/ld.1 >/dev/null 2>&1 || \
- 	   $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1; then
- 	    dflt='-i'
- 	else
- 	    dflt='none'
- 	fi
- 	;;
-     *) dflt="$split";;
-     esac
-     rp="What flag indicates separate I and D space? [$dflt]"
-     $echo $n "$rp $c"
-     . myread
-     case "$ans" in
-     none) ans='';;
-     esac
-     split="$ans"
-     unsplit=''
-     ;;
- *large*|*small*|*medium*|*huge*)
-     case "$model" in
-     *large*)
- 	case "$large" in
- 	'') dflt='-Ml';;
- 	*) dflt="$large";;
- 	esac
- 	rp="What flag indicates large model? [$dflt]"
- 	$echo $n "$rp $c"
- 	. myread
- 	case "$ans" in
- 	none) ans='';
- 	esac
- 	large="$ans"
- 	;;
-     *) large='';;
-     esac
-     case "$model" in
-     *huge*)
- 	case "$huge" in
- 	'') dflt='-Mh';;
- 	*) dflt="$huge";;
- 	esac
- 	rp="What flag indicates huge model? [$dflt]"
- 	$echo $n "$rp $c"
- 	. myread
- 	case "$ans" in
- 	none) ans='';
- 	esac
- 	huge="$ans"
- 	;;
-     *) huge="$large";;
-     esac
-     case "$model" in
-     *medium*)
- 	case "$medium" in
- 	'') dflt='-Mm';;
- 	*) dflt="$medium";;
- 	esac
- 	rp="What flag indicates medium model? [$dflt]"
- 	$echo $n "$rp $c"
- 	. myread
- 	case "$ans" in
- 	none) ans='';
- 	esac
- 	medium="$ans"
- 	;;
-     *) medium="$large";;
-     esac
-     case "$model" in
-     *small*)
- 	case "$small" in
- 	'') dflt='none';;
- 	*) dflt="$small";;
- 	esac
- 	rp="What flag indicates small model? [$dflt]"
- 	$echo $n "$rp $c"
- 	. myread
- 	case "$ans" in
- 	none) ans='';
- 	esac
- 	small="$ans"
- 	;;
-     *) small='';;
-     esac
-     ;;
- *)
-     echo "Unrecognized memory models--you may have to edit Makefile.SH"
-     ;;
- esac
- 
- case "$ccflags" in
- '') dflt='none';;
- *) dflt="$ccflags";;
- esac
- echo " "
- rp="Any additional cc flags? [$dflt]"
- $echo $n "$rp $c"
- . myread
- case "$ans" in
- none) ans='';
- esac
- ccflags="$ans"
- 
- case "$ldflags" in
- '') if venix; then
- 	dflt='-i -z'
-     else
- 	dflt='none'
-     fi
-     ;;
- *) dflt="$ldflags";;
- esac
- echo " "
- rp="Any additional ld flags? [$dflt]"
- $echo $n "$rp $c"
- . myread
- case "$ans" in
- none) ans='';
- esac
- ldflags="$ans"
- 
- : see if we need a special compiler
- echo " "
- if usg; then
-     case "$cc" in
-     '')
- 	case "$Mcc" in
- 	/*) dflt='Mcc'
- 	    ;;
- 	*)
- 	    case "$large" in
- 	    -M*)
- 		dflt='cc'
- 		;;
- 	    *)
- 		if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
- 		    dflt='cc -M'
- 		else
- 		    dflt='cc'
- 		fi
- 		;;
- 	    esac
- 	    ;;
- 	esac
- 	;;
-     *)  dflt="$cc";;
-     esac
-     $cat <<'EOM'
-  
- On some systems the default C compiler will not resolve multiple global
- references that happen to have the same name.  On some such systems the
- "Mcc" command may be used to force these to be resolved.  On other systems
- a "cc -M" command is required.  (Note that the -M flag on other systems
- indicates a memory model to use!)  If you have the Gnu C compiler, you
- might wish to use that instead.  What command will force resolution on
- EOM
-     $echo $n "this system? [$dflt] $c"
-     rp="Command to resolve multiple refs? [$dflt]"
-     . myread
-     cc="$ans"
- else
-     case "$cc" in
-     '') dflt=cc;;
-     *) dflt="$cc";;
-     esac
-     rp="Use which C compiler? [$dflt]"
-     $echo $n "$rp $c"
-     . myread
-     cc="$ans"
- fi
- 
  : see if we should include -lnm
  echo " "
  if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
--- 1552,1557 ----
***************
*** 1672,1681 ****
  mailx='$mailx'
  mail='$mail'
  cpp='$cpp'
  Log='$Log'
  Header='$Header'
  bin='$bin'
- cc='$cc'
  contains='$contains'
  cppstdin='$cppstdin'
  cppminus='$cppminus'
--- 1639,1648 ----
  mailx='$mailx'
  mail='$mail'
  cpp='$cpp'
+ perl='$perl'
  Log='$Log'
  Header='$Header'
  bin='$bin'
  contains='$contains'
  cppstdin='$cppstdin'
  cppminus='$cppminus'
***************
*** 1718,1723 ****
--- 1685,1691 ----
  huge='$huge'
  ccflags='$ccflags'
  ldflags='$ldflags'
+ cc='$cc'
  n='$n'
  c='$c'
  package='$package'

Index: x2p/a2p.y
Prereq: 2.0.1.2
*** x2p/a2p.y.old	Fri Aug  5 01:32:21 1988
--- x2p/a2p.y	Fri Aug  5 01:32:23 1988
***************
*** 1,7 ****
  %{
! /* $Header: a2p.y,v 2.0.1.2 88/08/03 22:49:27 root Exp $
   *
   * $Log:	a2p.y,v $
   * Revision 2.0.1.2  88/08/03  22:49:27  root
   * patch11: in a2p, newlines weren't allowed following comma
   * 
--- 1,10 ----
  %{
! /* $Header: a2p.y,v 2.0.1.3 88/08/05 01:30:15 root Exp $
   *
   * $Log:	a2p.y,v $
+  * Revision 2.0.1.3  88/08/05  01:30:15  root
+  * patch13: a2p was treating strings and numbers as variables
+  * 
   * Revision 2.0.1.2  88/08/03  22:49:27  root
   * patch11: in a2p, newlines weren't allowed following comma
   * 
***************
*** 158,163 ****
--- 161,170 ----
  
  term	: variable
  		{ $$ = $1; }
+ 	| NUMBER
+ 		{ $$ = oper1(ONUM,$1); }
+ 	| STRING
+ 		{ $$ = oper1(OSTR,$1); }
  	| term '+' term
  		{ $$ = oper2(OADD,$1,$3); }
  	| term '-' term
***************
*** 248,258 ****
  		{ $$ = oper3(OGSUB,oper1(OREGEX,$3),$5,$7); }
  	;
  
! variable: NUMBER
! 		{ $$ = oper1(ONUM,$1); }
! 	| STRING
! 		{ $$ = oper1(OSTR,$1); }
! 	| VAR
  		{ $$ = oper1(OVAR,$1); }
  	| VAR '[' expr_list ']'
  		{ $$ = oper2(OVAR,$1,$3); }
--- 255,261 ----
  		{ $$ = oper3(OGSUB,oper1(OREGEX,$3),$5,$7); }
  	;
  
! variable: VAR
  		{ $$ = oper1(OVAR,$1); }
  	| VAR '[' expr_list ']'
  		{ $$ = oper2(OVAR,$1,$3); }

Index: config.h.SH
*** config.h.SH.old	Fri Aug  5 01:31:39 1988
--- config.h.SH	Fri Aug  5 01:31:40 1988
***************
*** 250,255 ****
--- 250,256 ----
   *	The package designer should define VOIDUSED to indicate the requirements
   *	of the package.  This can be done either by #defining VOIDUSED before
   *	including config.h, or by defining defvoidused in Myinit.U.  If the
+  *	latter approach is taken, only those flags will be tested.  If the
   *	level of void support necessary is not present, defines void to int.
   */
  #ifndef VOIDUSED

Index: form.c
Prereq: 2.0.1.1
*** form.c.old	Fri Aug  5 01:31:44 1988
--- form.c	Fri Aug  5 01:31:45 1988
***************
*** 1,6 ****
! /* $Header: form.c,v 2.0.1.1 88/07/12 17:16:52 root Exp $
   *
   * $Log:	form.c,v $
   * Revision 2.0.1.1  88/07/12  17:16:52  root
   * patch6: removed useless assign
   * 
--- 1,9 ----
! /* $Header: form.c,v 2.0.1.2 88/08/05 01:26:20 root Exp $
   *
   * $Log:	form.c,v $
+  * Revision 2.0.1.2  88/08/05  01:26:20  root
+  * patch13: no form feed first
+  * 
   * Revision 2.0.1.1  88/07/12  17:16:52  root
   * patch6: removed useless assign
   * 
***************
*** 255,261 ****
  	    }
  	    stio->top_stab = topstab;
  	}
! 	if (stio->lines_left >= 0)
  	    putc('\f',ofp);
  	stio->lines_left = stio->page_len;
  	stio->page++;
--- 258,264 ----
  	    }
  	    stio->top_stab = topstab;
  	}
! 	if (stio->lines_left >= 0 && stio->page > 0)
  	    putc('\f',ofp);
  	stio->lines_left = stio->page_len;
  	stio->page++;

Index: perl.man.2
Prereq: 2.0.1.4
*** perl.man.2.old	Fri Aug  5 01:31:53 1988
--- perl.man.2	Fri Aug  5 01:31:57 1988
***************
*** 1,7 ****
  ''' Beginning of part 2
! ''' $Header: perl.man.2,v 2.0.1.4 88/08/03 22:22:48 root Exp $
  '''
  ''' $Log:	perl.man.2,v $
  ''' Revision 2.0.1.4  88/08/03  22:22:48  root
  ''' patch11: random typos and clarifications
  ''' 
--- 1,10 ----
  ''' Beginning of part 2
! ''' $Header: perl.man.2,v 2.0.1.5 88/08/05 01:27:31 root Exp $
  '''
  ''' $Log:	perl.man.2,v $
+ ''' Revision 2.0.1.5  88/08/05  01:27:31  root
+ ''' patch13: clarified goto problems
+ ''' 
  ''' Revision 2.0.1.4  88/08/03  22:22:48  root
  ''' patch11: random typos and clarifications
  ''' 
***************
*** 33,40 ****
  I may change its semantics at any time, consistent with support for translated
  .I sed
  scripts.
! Using it to exit loops bypasses the loop exit code and can cause core dumps
! after a while.
  Use it at your own risk.
  Better yet, don't use it at all.
  .Ip "hex(EXPR)" 8 2
--- 36,44 ----
  I may change its semantics at any time, consistent with support for translated
  .I sed
  scripts.
! Using it to exit loops bypasses the loop exit code with the result that
! .I foreach
! loops will not restart correctly.
  Use it at your own risk.
  Better yet, don't use it at all.
  .Ip "hex(EXPR)" 8 2

Index: perly.c
Prereq: 2.0.1.5
*** perly.c.old	Fri Aug  5 01:32:08 1988
--- perly.c	Fri Aug  5 01:32:12 1988
***************
*** 1,6 ****
! char rcsid[] = "$Header: perly.c,v 2.0.1.5 88/08/03 22:34:43 root Exp $";
  /*
   * $Log:	perly.c,v $
   * Revision 2.0.1.5  88/08/03  22:34:43  root
   * patch11: 
   * patch11: 
--- 1,10 ----
! char rcsid[] = "$Header: perly.c,v 2.0.1.6 88/08/05 01:29:43 root Exp $";
  /*
   * $Log:	perly.c,v $
+  * Revision 2.0.1.6  88/08/05  01:29:43  root
+  * patch13: fixed loop stack overflow on goto
+  * patch13: fixed recursive subroutine storage management
+  * 
   * Revision 2.0.1.5  88/08/03  22:34:43  root
   * patch11: 
   * patch11: 
***************
*** 442,448 ****
  
      savestack = anew(Nullstab);		/* for saving non-local values */
  
!     setjmp(top_env);	/* sets goto_targ on longjump */
  
  #ifdef DEBUGGING
      if (debug & 1024)
--- 446,453 ----
  
      savestack = anew(Nullstab);		/* for saving non-local values */
  
!     if (setjmp(top_env))	/* sets goto_targ on longjump */
! 	loop_ptr = 0;		/* start label stack again */
  
  #ifdef DEBUGGING
      if (debug & 1024)
***************
*** 2034,2040 ****
  	if (cmd->c_spat)
  	    spat_tosave(cmd->c_spat);
  	if (cmd->c_expr)
! 	    arg_tosave(cmd->c_expr);
  	switch (cmd->c_type) {
  	case C_WHILE:
  	case C_BLOCK:
--- 2039,2045 ----
  	if (cmd->c_spat)
  	    spat_tosave(cmd->c_spat);
  	if (cmd->c_expr)
! 	    arg_tosave(cmd->c_expr,FALSE);
  	switch (cmd->c_type) {
  	case C_WHILE:
  	case C_BLOCK:
***************
*** 2046,2052 ****
  	    break;
  	case C_EXPR:
  	    if (cmd->ucmd.acmd.ac_expr)
! 		arg_tosave(cmd->ucmd.acmd.ac_expr);
  	    break;
  	}
  	cmd = cmd->c_next;
--- 2051,2057 ----
  	    break;
  	case C_EXPR:
  	    if (cmd->ucmd.acmd.ac_expr)
! 		arg_tosave(cmd->ucmd.acmd.ac_expr,FALSE);
  	    break;
  	}
  	cmd = cmd->c_next;
***************
*** 2056,2074 ****
  }
  
  static int
! arg_tosave(arg)
  register ARG *arg;
  {
      register int i;
      int saving = FALSE;
  
!     for (i = 1; i <= arg->arg_len; i++) {
  	switch (arg[i].arg_type) {
  	case A_NULL:
  	    break;
  	case A_LEXPR:
  	case A_EXPR:
! 	    saving |= arg_tosave(arg[i].arg_ptr.arg_arg);
  	    break;
  	case A_CMD:
  	    cmd_tosave(arg[i].arg_ptr.arg_cmd);
--- 2061,2080 ----
  }
  
  static int
! arg_tosave(arg,saveme)
  register ARG *arg;
+ int saveme;
  {
      register int i;
      int saving = FALSE;
  
!     for (i = arg->arg_len; i >= 1; i--) {
  	switch (arg[i].arg_type) {
  	case A_NULL:
  	    break;
  	case A_LEXPR:
  	case A_EXPR:
! 	    saving |= arg_tosave(arg[i].arg_ptr.arg_arg,saving);
  	    break;
  	case A_CMD:
  	    cmd_tosave(arg[i].arg_ptr.arg_cmd);
***************
*** 2100,2106 ****
  	saving = TRUE;
  	break;
      }
!     if (saving)
  	apush(tosave,arg->arg_ptr.arg_str);
      return saving;
  }
--- 2106,2112 ----
  	saving = TRUE;
  	break;
      }
!     if (saveme)
  	apush(tosave,arg->arg_ptr.arg_str);
      return saving;
  }
***************
*** 2112,2118 ****
      int saving = FALSE;
  
      if (spat->spat_runtime)
! 	saving |= arg_tosave(spat->spat_runtime);
      if (spat->spat_repl) {
  	saving |= arg_tosave(spat->spat_repl);
      }
--- 2118,2124 ----
      int saving = FALSE;
  
      if (spat->spat_runtime)
! 	saving |= arg_tosave(spat->spat_runtime,FALSE);
      if (spat->spat_repl) {
  	saving |= arg_tosave(spat->spat_repl);
      }

Index: x2p/walk.c
Prereq: 2.0.1.3
*** x2p/walk.c.old	Fri Aug  5 01:32:31 1988
--- x2p/walk.c	Fri Aug  5 01:32:34 1988
***************
*** 1,6 ****
! /* $Header: walk.c,v 2.0.1.3 88/08/03 22:54:39 root Exp $
   *
   * $Log:	walk.c,v $
   * Revision 2.0.1.3  88/08/03  22:54:39  root
   * patch11: a2p was being really stupid about comparisons with literal strings
   * patch11: a2p tried to make a local declaration on a null argument list
--- 1,9 ----
! /* $Header: walk.c,v 2.0.1.4 88/08/05 01:31:14 root Exp $
   *
   * $Log:	walk.c,v $
+  * Revision 2.0.1.4  88/08/05  01:31:14  root
+  * patch13: dumb typo in last patch
+  * 
   * Revision 2.0.1.3  88/08/03  22:54:39  root
   * patch11: a2p was being really stupid about comparisons with literal strings
   * patch11: a2p tried to make a local declaration on a null argument list
***************
*** 352,358 ****
  	tmp2str = walk(1,level,ops[node+3].ival,&numarg);
  	numeric |= numarg;
  	if (!numeric ||
! 	 (!numarg && (*tmp2str->str_cur == '"' || *tmp2str->str_cur == '\''))) {
  	    t = tmpstr->str_ptr;
  	    if (strEQ(t,"=="))
  		str_set(tmpstr,"eq");
--- 355,361 ----
  	tmp2str = walk(1,level,ops[node+3].ival,&numarg);
  	numeric |= numarg;
  	if (!numeric ||
! 	 (!numarg && (*tmp2str->str_ptr == '"' || *tmp2str->str_ptr == '\''))) {
  	    t = tmpstr->str_ptr;
  	    if (strEQ(t,"=="))
  		str_set(tmpstr,"eq");



More information about the Comp.sources.bugs mailing list