[comp.sources.bugs] perl 3.0 patch #37

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (10/20/90)

System: perl version 3.0
Patch #: 37
Priority: HIGH
Subject: tried to take strlen of integer on systems without wait4 or waitpid
Subject: hash.c called ndbm function on dbm system
Subject: /foo.*bar$/ wrongly optimized to do tail matching on "foo"
Subject: split out separate Sys V IPC features
Subject: changed all calls of loc to ./loc in Configure
Subject: added cryptlib support to Makefile
Subject: mentioned Apollo 10.3 and Sun 3.5 problems in README
Subject: cray has weird restrictions on setjmp locations
Subject: h2ph now recognizes Ior() and such on Convex
Subject: changed some ". config.sh" to ". ./config.sh"
Subject: missing -f on rm in makelib.SH
Subject: unreachable return eliminated
Subject: fixed typos in shm example
Subject: fixed various typos in man page

Description:
	I tried to take the strlen of an integer on systems without wait4()
	or waitpid().  For some reason this didn't work too well...

	In hash.c there was a call to dbm_nextkey() which needed to be
	ifdefed on old dbm systems.

	A pattern such as /foo.*bar$/ was wrongly optimized to do
	tail matching on "foo".  This was a longstanding bug that
	was unmasked by patch 36.

	Some systems have some SYS V IPC but not all of it.  Configure
	now figures this out.

	Patch 36 put the user's PATH in front of Configures, but to make
	it work right I needed to change all calls of loc to ./loc in
	Configure.

	$cryptlib needed to be mentioned in the Makefile.

	Apollo 10.3 and Sun 3.5 have some compilation problems, so I
	mentioned them in README.

	Cray has weird restrictions on setjmp locations--you can't say
		if (result = setjmp(...))

	Random typos and cleanup.

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
		make depend
		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 3.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.1.143).

Index: patchlevel.h
Prereq: 36
1c1
< #define PATCHLEVEL 36
---
> #define PATCHLEVEL 37

Index: Configure
Prereq: 3.0.1.10
*** Configure.old	Sat Oct 20 02:22:30 1990
--- Configure	Sat Oct 20 02:22:53 1990
***************
*** 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 3.0.1.10 90/10/15 14:37:52 lwall Locked $
  #
  # 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 3.0.1.11 90/10/20 01:55:30 lwall Locked $
  #
  # Yes, you may rip this off to use in other distribution packages.
  # (Note: this Configure script was generated automatically.  Rather than
***************
*** 155,160 ****
--- 155,163 ----
  d_symlink=''
  d_syscall=''
  d_sysvipc=''
+ d_ipcmsg=''
+ d_ipcsem=''
+ d_ipcshm=''
  d_truncate=''
  d_varargs=''
  d_vfork=''
***************
*** 513,519 ****
  test
  "
  for file in $loclist; do
!     xxx=`loc $file $file $pth`
      eval $file=$xxx
      eval _$file=$xxx
      case "$xxx" in
--- 516,522 ----
  test
  "
  for file in $loclist; do
!     xxx=`./loc $file $file $pth`
      eval $file=$xxx
      eval _$file=$xxx
      case "$xxx" in
***************
*** 529,535 ****
  echo "Don't worry if any of the following aren't found..."
  ans=offhand
  for file in $trylist; do
!     xxx=`loc $file $file $pth`
      eval $file=$xxx
      eval _$file=$xxx
      case "$xxx" in
--- 532,538 ----
  echo "Don't worry if any of the following aren't found..."
  ans=offhand
  for file in $trylist; do
!     xxx=`./loc $file $file $pth`
      eval $file=$xxx
      eval _$file=$xxx
      case "$xxx" in
***************
*** 639,645 ****
  : determine where public executables go
  case "$bin" in
  '')
!     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
      ;;
  *)  dflt="$bin"
      ;;
--- 642,648 ----
  : determine where public executables go
  case "$bin" in
  '')
!     dflt=`./loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
      ;;
  *)  dflt="$bin"
      ;;
***************
*** 676,682 ****
  EOM
  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 /usr/man/man.L`
      ;;
  *)  dflt="$mansrc"
      ;;
--- 679,685 ----
  EOM
  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 /usr/man/man.L`
      ;;
  *)  dflt="$mansrc"
      ;;
***************
*** 810,816 ****
      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
--- 813,819 ----
      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
***************
*** 999,1005 ****
      cc="$ans"
  fi
  case "$cc" in
! gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
  esac
  
  : determine optimize, if desired, or use for debug flag also
--- 1002,1008 ----
      cc="$ans"
  fi
  case "$cc" in
! gcc*) cpp=`./loc gcc-cpp $cpp $pth`;;
  esac
  
  : determine optimize, if desired, or use for debug flag also
***************
*** 1130,1136 ****
      *) thatlib="${thislib}_s";;
      *) thatlib=NONE;;
      esac
!     xxx=`loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/local/lib /lib`
      if test -f $xxx; then
  	echo "Found -l$thislib."
  	case "$dflt" in
--- 1133,1139 ----
      *) thatlib="${thislib}_s";;
      *) thatlib=NONE;;
      esac
!     xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/local/lib /lib`
      if test -f $xxx; then
  	echo "Found -l$thislib."
  	case "$dflt" in
***************
*** 1138,1144 ****
  	*) dflt="$dflt -l$thislib";;
  	esac
      else
! 	xxx=`loc lib$thislib.a X $libpth`
  	if test -f $xxx; then
  	    echo "Found $xxx."
  	    case "$dflt" in
--- 1141,1147 ----
  	*) dflt="$dflt -l$thislib";;
  	esac
      else
! 	xxx=`./loc lib$thislib.a X $libpth`
  	if test -f $xxx; then
  	    echo "Found $xxx."
  	    case "$dflt" in
***************
*** 1146,1152 ****
  	    *) dflt="$dflt $xxx";;
  	    esac
  	else
! 	    xxx=`loc Slib$thislib.a X $xlibpth`
  	    if test -f $xxx; then
  		echo "Found -l$thislib."
  		case "$dflt" in
--- 1149,1155 ----
  	    *) dflt="$dflt $xxx";;
  	    esac
  	else
! 	    xxx=`./loc Slib$thislib.a X $xlibpth`
  	    if test -f $xxx; then
  		echo "Found -l$thislib."
  		case "$dflt" in
***************
*** 1364,1370 ****
  '') libpth='/usr/ccs/lib /lib /usr/lib /usr/local/lib';;
  esac
  case "$libs" in
! *-lc_s*) libc=`loc libc_s.a $libc $libpth`
  esac
  libnames='';
  case "$libs" in
--- 1367,1373 ----
  '') libpth='/usr/ccs/lib /lib /usr/lib /usr/local/lib';;
  esac
  case "$libs" in
! *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
  esac
  libnames='';
  case "$libs" in
***************
*** 1372,1384 ****
  *)  for thislib in $libs; do
  	case "$thislib" in
  	-l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
! 	    try=`loc lib$thislib.a blurfl/dyick $libpth`
  	    if test ! -f $try; then
! 		try=`loc lib$thislib blurfl/dyick $libpth`
  		if test ! -f $try; then
! 		    try=`loc $thislib blurfl/dyick $libpth`
  		    if test ! -f $try; then
! 			try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
  			if test ! -f $try; then
  			    try=''
  			fi
--- 1375,1387 ----
  *)  for thislib in $libs; do
  	case "$thislib" in
  	-l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
! 	    try=`./loc lib$thislib.a blurfl/dyick $libpth`
  	    if test ! -f $try; then
! 		try=`./loc lib$thislib blurfl/dyick $libpth`
  		if test ! -f $try; then
! 		    try=`./loc $thislib blurfl/dyick $libpth`
  		    if test ! -f $try; then
! 			try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
  			if test ! -f $try; then
  			    try=''
  			fi
***************
*** 1405,1427 ****
      echo "Your C library is in /lib/libc.a.  You're normal."
      libc=/lib/libc.a
  else
!     ans=`loc libc.a blurfl/dyick $libpth`
      if test ! -f "$ans"; then
! 	ans=`loc Slibc.a blurfl/dyick $xlibpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`loc Mlibc.a blurfl/dyick $xlibpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`loc Llibc.a blurfl/dyick $xlibpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`loc libc blurfl/dyick $libpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`loc clib blurfl/dyick $libpth`
      else
! 	libnames="$libnames "`loc clib blurfl/dyick $libpth`
      fi
      if test -f "$ans"; then
  	echo "Your C library is in $ans, of all places."
--- 1408,1430 ----
      echo "Your C library is in /lib/libc.a.  You're normal."
      libc=/lib/libc.a
  else
!     ans=`./loc libc.a blurfl/dyick $libpth`
      if test ! -f "$ans"; then
! 	ans=`./loc Slibc.a blurfl/dyick $xlibpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`./loc Mlibc.a blurfl/dyick $xlibpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`./loc Llibc.a blurfl/dyick $xlibpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`./loc libc blurfl/dyick $libpth`
      fi
      if test ! -f "$ans"; then
! 	ans=`./loc clib blurfl/dyick $libpth`
      else
! 	libnames="$libnames "`./loc clib blurfl/dyick $libpth`
      fi
      if test -f "$ans"; then
  	echo "Your C library is in $ans, of all places."
***************
*** 1599,1617 ****
      d_crypt="$define"
      cryptlib=''
  else
!     cryptlib=`loc Slibcrypt.a "" $xlibpth`
      if $test -z "$cryptlib"; then
! 	cryptlib=`loc Mlibcrypt.a "" $xlibpth`
      else
  	cryptlib=-lcrypt
      fi
      if $test -z "$cryptlib"; then
! 	cryptlib=`loc Llibcrypt.a "" $xlibpth`
      else
  	cryptlib=-lcrypt
      fi
      if $test -z "$cryptlib"; then
! 	cryptlib=`loc libcrypt.a "" $libpth`
      else
  	cryptlib=-lcrypt
      fi
--- 1602,1620 ----
      d_crypt="$define"
      cryptlib=''
  else
!     cryptlib=`./loc Slibcrypt.a "" $xlibpth`
      if $test -z "$cryptlib"; then
! 	cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
      else
  	cryptlib=-lcrypt
      fi
      if $test -z "$cryptlib"; then
! 	cryptlib=`./loc Llibcrypt.a "" $xlibpth`
      else
  	cryptlib=-lcrypt
      fi
      if $test -z "$cryptlib"; then
! 	cryptlib=`./loc libcrypt.a "" $libpth`
      else
  	cryptlib=-lcrypt
      fi
***************
*** 1765,1770 ****
--- 1768,1788 ----
      echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
  fi
  
+ : see if there is System V IPC
+ set msgget d_ipcmsg
+ eval $inlibc
+ 
+ set semget d_ipcsem
+ eval $inlibc
+ 
+ set shmget d_ipcshm
+ eval $inlibc
+ 
+ case "$d_ipcmsg$d_ipcsem$d_ipcshm" in
+ *define*) d_sysvipc="$define";;
+ *) d_sysvipc="$undef";;
+ esac
+ 
  : see if killpg exists
  set killpg d_killpg
  eval $inlibc
***************
*** 1787,1793 ****
  
  : see if ndbm is available
  echo " "
! xxx=`loc ndbm.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      d_ndbm="$define"
      echo "ndbm.h found."
--- 1805,1811 ----
  
  : see if ndbm is available
  echo " "
! xxx=`./loc ndbm.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      d_ndbm="$define"
      echo "ndbm.h found."
***************
*** 1798,1804 ****
  
  : see if we have the old dbm
  echo " "
! xxx=`loc dbm.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      d_odbm="$define"
      echo "dbm.h found."
--- 1816,1822 ----
  
  : see if we have the old dbm
  echo " "
! xxx=`./loc dbm.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      d_odbm="$define"
      echo "dbm.h found."
***************
*** 2096,2105 ****
  esac
  $rm -f try.c try
  
- : see if there is System V IPC
- set msgget d_sysvipc
- eval $inlibc
- 
  : see if truncate exists
  set truncate d_truncate
  eval $inlibc
--- 2114,2119 ----
***************
*** 2280,2286 ****
  
  : see if this is a netinet/in.h system
  echo " "
! xxx=`loc netinet/in.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      i_niin="$define"
      echo "netinet/in.h found."
--- 2294,2300 ----
  
  : see if this is a netinet/in.h system
  echo " "
! xxx=`./loc netinet/in.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      i_niin="$define"
      echo "netinet/in.h found."
***************
*** 2311,2317 ****
  
  : see if this is a sys/ndir.h system
  echo " "
! xxx=`loc sys/ndir.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      i_sysndir="$define"
      echo "sys/ndir.h found."
--- 2325,2331 ----
  
  : see if this is a sys/ndir.h system
  echo " "
! xxx=`./loc sys/ndir.h x /usr/include /usr/local/include $inclwanted`
  if test -f $xxx; then
      i_sysndir="$define"
      echo "sys/ndir.h found."
***************
*** 2515,2520 ****
--- 2529,2535 ----
  Log='$Log'
  Header='$Header'
  
+ 
  : determine which malloc to compile in
  echo " "
  case "$usemymalloc" in
***************
*** 2730,2735 ****
--- 2745,2753 ----
  d_symlink='$d_symlink'
  d_syscall='$d_syscall'
  d_sysvipc='$d_sysvipc'
+ d_ipcmsg='$d_ipcmsg'
+ d_ipcsem='$d_ipcsem'
+ d_ipcshm='$d_ipcshm'
  d_truncate='$d_truncate'
  d_varargs='$d_varargs'
  d_vfork='$d_vfork'

Index: Makefile.SH
Prereq: 3.0.1.9
*** Makefile.SH.old	Sat Oct 20 02:23:31 1990
--- Makefile.SH	Sat Oct 20 02:23:36 1990
***************
*** 25,33 ****
  
  echo "Extracting Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
! # $Header: Makefile.SH,v 3.0.1.9 90/10/15 14:41:34 lwall Locked $
  #
  # $Log:	Makefile.SH,v $
  # Revision 3.0.1.9  90/10/15  14:41:34  lwall
  # patch29: various portability fixes
  # 
--- 25,36 ----
  
  echo "Extracting Makefile (with variable substitutions)"
  cat >Makefile <<!GROK!THIS!
! # $Header: Makefile.SH,v 3.0.1.10 90/10/20 01:59:21 lwall Locked $
  #
  # $Log:	Makefile.SH,v $
+ # Revision 3.0.1.10  90/10/20  01:59:21  lwall
+ # patch37: added cryptlib support to Makefile
+ # 
  # Revision 3.0.1.9  90/10/15  14:41:34  lwall
  # patch29: various portability fixes
  # 
***************
*** 79,85 ****
  mallocobj = $mallocobj
  SLN = $sln
  
! libs = $libs
  
  public = perl taintperl $suidperl
  
--- 82,88 ----
  mallocobj = $mallocobj
  SLN = $sln
  
! libs = $libs $cryptlib
  
  public = perl taintperl $suidperl
  

Index: README
*** README.old	Sat Oct 20 02:23:47 1990
--- README	Sat Oct 20 02:23:51 1990
***************
*** 95,102 ****
--- 95,104 ----
      absence of a specific rule.
  
      The 3b2 needs to turn off -O.
+     Domain/OS 10.3 (at least) native C 6.7 may need -opt 2 for eval.c
      AIX/RT may need a -a switch and -DCRIPPLED_CC.
      SUNOS 4.0.[12] needs #define fputs(str,fp) fprintf(fp,"%s",str) in perl.h
+     SUNOS 3.[45] should use the system malloc.
      SGI machines may need -Ddouble="long float".
      Ultrix (2.3) may need to hand assemble teval.s with a -J switch.
      Ultrix on MIPS machines may need -DLANGUAGE_C.

Index: cmd.c
Prereq: 3.0.1.9
*** cmd.c.old	Sat Oct 20 02:24:14 1990
--- cmd.c	Sat Oct 20 02:24:20 1990
***************
*** 1,4 ****
! /* $Header: cmd.c,v 3.0.1.9 90/10/15 15:32:39 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
--- 1,4 ----
! /* $Header: cmd.c,v 3.0.1.10 90/10/20 02:01:56 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
***************
*** 6,11 ****
--- 6,14 ----
   *    as specified in the README file that comes with the perl 3.0 kit.
   *
   * $Log:	cmd.c,v $
+  * Revision 3.0.1.10  90/10/20  02:01:56  lwall
+  * patch37: cray has weird restrictions on setjmp locations
+  * 
   * Revision 3.0.1.9  90/10/15  15:32:39  lwall
   * patch29: non-existent array values no longer cause core dumps
   * patch29: scripts now run at almost full speed under the debugger
***************
*** 205,211 ****
  #ifdef JMPCLOBBER
  		cmdparm = cmd;
  #endif
! 		if (match = setjmp(loop_stack[loop_ptr].loop_env)) {
  		    st = stack->ary_array;	/* possibly reallocated */
  #ifdef JMPCLOBBER
  		    cmd = cmdparm;
--- 208,215 ----
  #ifdef JMPCLOBBER
  		cmdparm = cmd;
  #endif
! 		match = setjmp(loop_stack[loop_ptr].loop_env);
! 		if (match) {
  		    st = stack->ary_array;	/* possibly reallocated */
  #ifdef JMPCLOBBER
  		    cmd = cmdparm;
***************
*** 808,814 ****
  #ifdef JMPCLOBBER
  	cmdparm = cmd;
  #endif
! 	if (match = setjmp(loop_stack[loop_ptr].loop_env)) {
  	    st = stack->ary_array;	/* possibly reallocated */
  #ifdef JMPCLOBBER
  	    cmd = cmdparm;
--- 812,819 ----
  #ifdef JMPCLOBBER
  	cmdparm = cmd;
  #endif
! 	match = setjmp(loop_stack[loop_ptr].loop_env);
! 	if (match) {
  	    st = stack->ary_array;	/* possibly reallocated */
  #ifdef JMPCLOBBER
  	    cmd = cmdparm;

Index: config_h.SH
*** config_h.SH.old	Sat Oct 20 02:24:41 1990
--- config_h.SH	Sat Oct 20 02:24:46 1990
***************
*** 424,430 ****
--- 424,446 ----
  /* SYSVIPC:
   *	This symbol, if defined, indicates that System V IPC exists.
   */
+ /* IPCMSG:
+  *	This symbol, if defined, indicates that System V IPC messages exist.
+  */
+ /* IPCSEM:
+  *	This symbol, if defined, indicates that System V IPC semaphores exist.
+  */
+ /* IPCSHM:
+  *	This symbol, if defined, indicates that System V IPC shared memory
+  *	exists.
+  */
  #$d_sysvipc	SYSVIPC	/**/
+ 
+ #$d_ipcmsg	IPCMSG	/**/
+ 
+ #$d_ipcsem	IPCSEM	/**/
+ 
+ #$d_ipcshm	IPCSHM	/**/
  
  /* TRUNCATE:
   *	This symbol, if defined, indicates that the truncate routine is

Index: doio.c
Prereq: 3.0.1.11
*** doio.c.old	Sat Oct 20 02:25:22 1990
--- doio.c	Sat Oct 20 02:25:36 1990
***************
*** 1,4 ****
! /* $Header: doio.c,v 3.0.1.11 90/10/15 16:16:11 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
--- 1,4 ----
! /* $Header: doio.c,v 3.0.1.12 90/10/20 02:04:18 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
***************
*** 6,11 ****
--- 6,14 ----
   *    as specified in the README file that comes with the perl 3.0 kit.
   *
   * $Log:	doio.c,v $
+  * Revision 3.0.1.12  90/10/20  02:04:18  lwall
+  * patch37: split out separate Sys V IPC features
+  * 
   * Revision 3.0.1.11  90/10/15  16:16:11  lwall
   * patch29: added SysV IPC
   * patch29: file - didn't auto-close cleanly
***************
*** 85,94 ****
--- 88,103 ----
  
  #ifdef SYSVIPC
  #include <sys/ipc.h>
+ #ifdef IPCMSG
  #include <sys/msg.h>
+ #endif
+ #ifdef IPCSEM
  #include <sys/sem.h>
+ #endif
+ #ifdef IPCSHM
  #include <sys/shm.h>
  #endif
+ #endif
  
  #ifdef I_PWD
  #include <pwd.h>
***************
*** 2341,2352 ****
--- 2350,2371 ----
      errno = 0;
      switch (optype)
      {
+ #ifdef IPCMSG
      case O_MSGGET:
  	return msgget(key, flags);
+ #endif
+ #ifdef IPCSEM
      case O_SEMGET:
  	return semget(key, n, flags);
+ #endif
+ #ifdef IPCSHM
      case O_SHMGET:
  	return shmget(key, n, flags);
+ #endif
+ #if !defined(IPCMSG) || !defined(IPCSEM) || !defined(IPCSHM)
+     default:
+ 	fatal("%s not implemented", opname[optype]);
+ #endif
      }
      return -1;			/* should never happen */
  }
***************
*** 2372,2385 ****
--- 2391,2409 ----
  
      switch (optype)
      {
+ #ifdef IPCMSG
      case O_MSGCTL:
  	if (cmd == IPC_STAT || cmd == IPC_SET)
  	    infosize = sizeof(struct msqid_ds);
  	break;
+ #endif
+ #ifdef IPCSHM
      case O_SHMCTL:
  	if (cmd == IPC_STAT || cmd == IPC_SET)
  	    infosize = sizeof(struct shmid_ds);
  	break;
+ #endif
+ #ifdef IPCSEM
      case O_SEMCTL:
  	if (cmd == IPC_STAT || cmd == IPC_SET)
  	    infosize = sizeof(struct semid_ds);
***************
*** 2392,2397 ****
--- 2416,2426 ----
  	    infosize = semds.sem_nsems * sizeof(ushort);
  	}
  	break;
+ #endif
+ #if !defined(IPCMSG) || !defined(IPCSEM) || !defined(IPCSHM)
+     default:
+ 	fatal("%s not implemented", opname[optype]);
+ #endif
      }
  
      if (infosize)
***************
*** 2419,2433 ****
--- 2448,2468 ----
      errno = 0;
      switch (optype)
      {
+ #ifdef IPCMSG
      case O_MSGCTL:
  	ret = msgctl(id, cmd, a);
  	break;
+ #endif
+ #ifdef IPCSEM
      case O_SEMCTL:
  	ret = semctl(id, n, cmd, a);
  	break;
+ #endif
+ #ifdef IPCSHM
      case O_SHMCTL:
  	ret = shmctl(id, cmd, a);
  	break;
+ #endif
      }
      if (getinfo && ret >= 0) {
  	astr->str_cur = infosize;
***************
*** 2440,2445 ****
--- 2475,2481 ----
  do_msgsnd(arglast)
  int *arglast;
  {
+ #ifdef IPCMSG
      register STR **st = stack->ary_array;
      register int sp = arglast[0];
      STR *mstr;
***************
*** 2456,2461 ****
--- 2492,2500 ----
      }
      errno = 0;
      return msgsnd(id, mbuf, msize, flags);
+ #else
+     fatal("msgsnd not implemented");
+ #endif
  }
  
  int
***************
*** 2462,2467 ****
--- 2501,2507 ----
  do_msgrcv(arglast)
  int *arglast;
  {
+ #ifdef IPCMSG
      register STR **st = stack->ary_array;
      register int sp = arglast[0];
      STR *mstr;
***************
*** 2486,2491 ****
--- 2526,2534 ----
  	mstr->str_ptr[sizeof(long)+ret] = '\0';
      }
      return ret;
+ #else
+     fatal("msgrcv not implemented");
+ #endif
  }
  
  int
***************
*** 2492,2497 ****
--- 2535,2541 ----
  do_semop(arglast)
  int *arglast;
  {
+ #ifdef IPCSEM
      register STR **st = stack->ary_array;
      register int sp = arglast[0];
      STR *opstr;
***************
*** 2509,2514 ****
--- 2553,2561 ----
      }
      errno = 0;
      return semop(id, opbuf, opsize/sizeof(struct sembuf));
+ #else
+     fatal("semop not implemented");
+ #endif
  }
  
  int
***************
*** 2516,2521 ****
--- 2563,2569 ----
  int optype;
  int *arglast;
  {
+ #ifdef IPCSHM
      register STR **st = stack->ary_array;
      register int sp = arglast[0];
      STR *mstr;
***************
*** 2558,2563 ****
--- 2606,2614 ----
  	    bzero(shm + mpos + n, msize - n);
      }
      return shmdt(shm);
+ #else
+     fatal("shm I/O not implemented");
+ #endif
  }
  
  #endif /* SYSVIPC */

Index: h2ph.SH
*** h2ph.SH.old	Sat Oct 20 02:26:03 1990
--- h2ph.SH	Sat Oct 20 02:26:06 1990
***************
*** 6,12 ****
  	ln ../../../config.sh . || \
  	(echo "Can't find config.sh."; exit 1)
      fi
!     . config.sh
      ;;
  esac
  : This forces SH files to create target in same directory as SH file.
--- 6,12 ----
  	ln ../../../config.sh . || \
  	(echo "Can't find config.sh."; exit 1)
      fi
!     . ./config.sh
      ;;
  esac
  : This forces SH files to create target in same directory as SH file.
***************
*** 177,183 ****
  		$new .= 'defined';
  	    }
  	    elsif (/^\(/) {
! 		s/^\((\w),/("$1",/ if $id =~ /^_IO[WR]*$/;	# cheat
  		$new .= " &$id";
  	    }
  	    elsif ($isatype{$id}) {
--- 177,183 ----
  		$new .= 'defined';
  	    }
  	    elsif (/^\(/) {
! 		s/^\((\w),/("$1",/ if $id =~ /^_IO[WR]*$/i;	# cheat
  		$new .= " &$id";
  	    }
  	    elsif ($isatype{$id}) {

Index: hash.c
Prereq: 3.0.1.6
*** hash.c.old	Sat Oct 20 02:26:16 1990
--- hash.c	Sat Oct 20 02:26:20 1990
***************
*** 1,4 ****
! /* $Header: hash.c,v 3.0.1.6 90/10/15 17:32:52 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
--- 1,4 ----
! /* $Header: hash.c,v 3.0.1.7 90/10/20 02:10:00 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
***************
*** 6,11 ****
--- 6,14 ----
   *    as specified in the README file that comes with the perl 3.0 kit.
   *
   * $Log:	hash.c,v $
+  * Revision 3.0.1.7  90/10/20  02:10:00  lwall
+  * patch37: hash.c called ndbm function on dbm system
+  * 
   * Revision 3.0.1.6  90/10/15  17:32:52  lwall
   * patch29: non-existent array values no longer cause core dumps
   * patch29: %foo = () will now clear dbm files
***************
*** 402,408 ****
--- 405,419 ----
      if ((old_dbm = tb->tbl_dbm) && dodbm) {
  	while (dkey = dbm_firstkey(tb->tbl_dbm), dkey.dptr) {
  	    do {
+ #ifdef NDBM
+ #ifdef _CX_UX
  		nextdkey = dbm_nextkey(tb->tbl_dbm, dkey);
+ #else
+ 		nextdkey = dbm_nextkey(tb->tbl_dbm);
+ #endif
+ #else
+ 		nextdkey = nextkey(dkey);
+ #endif
  		dbm_delete(tb->tbl_dbm,dkey);
  		dkey = nextdkey;
  	    } while (dkey.dptr);	/* one way or another, this works */

Index: eg/sysvipc/ipcshm
*** eg/sysvipc/ipcshm.old	Sat Oct 20 02:25:54 1990
--- eg/sysvipc/ipcshm	Sat Oct 20 02:25:56 1990
***************
*** 13,20 ****
  
  $SIZE = 32;
  $id = shmget(0x1234, $SIZE, ($send ? 0 : &IPC_CREAT) | 0644);
! die "Can't get message queue: $!\n" unless defined($id);
! print "message queue id: $id\n";
  
  if ($send) {
  	while (<STDIN>) {
--- 13,20 ----
  
  $SIZE = 32;
  $id = shmget(0x1234, $SIZE, ($send ? 0 : &IPC_CREAT) | 0644);
! die "Can't get shared memory: $!\n" unless defined($id);
! print "shared memory id: $id\n";
  
  if ($send) {
  	while (<STDIN>) {

Index: makelib.SH
*** makelib.SH.old	Sat Oct 20 02:26:42 1990
--- makelib.SH	Sat Oct 20 02:26:44 1990
***************
*** 1,2 ****
  echo "makelib.SH has been renamed to h2ph.SH"
! rm makelib
--- 1,2 ----
  echo "makelib.SH has been renamed to h2ph.SH"
! rm -f makelib

Index: perl_man.1
Prereq: 3.0.1.8
*** perl_man.1.old	Sat Oct 20 02:27:10 1990
--- perl_man.1	Sat Oct 20 02:27:23 1990
***************
*** 1,7 ****
  .rn '' }`
! ''' $Header: perl_man.1,v 3.0.1.8 90/10/15 18:16:19 lwall Locked $
  ''' 
  ''' $Log:	perl_man.1,v $
  ''' Revision 3.0.1.8  90/10/15  18:16:19  lwall
  ''' patch29: added DATA filehandle to read stuff after __END__
  ''' patch29: added cmp and <=>
--- 1,10 ----
  .rn '' }`
! ''' $Header: perl_man.1,v 3.0.1.9 90/10/20 02:14:24 lwall Locked $
  ''' 
  ''' $Log:	perl_man.1,v $
+ ''' Revision 3.0.1.9  90/10/20  02:14:24  lwall
+ ''' patch37: fixed various typos in man page
+ ''' 
  ''' Revision 3.0.1.8  90/10/15  18:16:19  lwall
  ''' patch29: added DATA filehandle to read stuff after __END__
  ''' patch29: added cmp and <=>
***************
*** 54,60 ****
  ..
  .de Ip
  .br
! .ie \\n.$>=3 .ne \\$3
  .el .ne 3
  .IP "\\$1" \\$2
  ..
--- 57,63 ----
  ..
  .de Ip
  .br
! .ie \\n(.$>=3 .ne \\$3
  .el .ne 3
  .IP "\\$1" \\$2
  ..

Index: perl_man.3
Prereq: 3.0.1.9
*** perl_man.3.old	Sat Oct 20 02:28:40 1990
--- perl_man.3	Sat Oct 20 02:28:53 1990
***************
*** 1,7 ****
  ''' Beginning of part 3
! ''' $Header: perl_man.3,v 3.0.1.9 90/10/16 10:02:43 lwall Locked $
  '''
  ''' $Log:	perl_man.3,v $
  ''' Revision 3.0.1.9  90/10/16  10:02:43  lwall
  ''' patch29: you can now read into the middle string
  ''' patch29: index and substr now have optional 3rd args
--- 1,10 ----
  ''' Beginning of part 3
! ''' $Header: perl_man.3,v 3.0.1.10 90/10/20 02:15:17 lwall Locked $
  '''
  ''' $Log:	perl_man.3,v $
+ ''' Revision 3.0.1.10  90/10/20  02:15:17  lwall
+ ''' patch37: patch37: fixed various typos in man page
+ ''' 
  ''' Revision 3.0.1.9  90/10/16  10:02:43  lwall
  ''' patch29: you can now read into the middle string
  ''' patch29: index and substr now have optional 3rd args
***************
*** 727,733 ****
  Calls the System V IPC function semop to perform semaphore operations
  such as signaling and waiting.  OPSTRING must be a packed array of
  semop structures.  Each semop structure can be generated with
! 'pack("sss", $semnum, $semop, $semflag)'.  The number of semaphore
  operations is implied by the length of OPSTRING.  Returns true if
  successful, or false if there is an error.  As an example, the
  following code waits on semaphore $semnum of semaphore id $semid:
--- 730,736 ----
  Calls the System V IPC function semop to perform semaphore operations
  such as signaling and waiting.  OPSTRING must be a packed array of
  semop structures.  Each semop structure can be generated with
! \&'pack("sss", $semnum, $semop, $semflag)'.  The number of semaphore
  operations is implied by the length of OPSTRING.  Returns true if
  successful, or false if there is an error.  As an example, the
  following code waits on semaphore $semnum of semaphore id $semid:
***************
*** 734,740 ****
  .nf
  
  	$semop = pack("sss", $semnum, -1, 0);
! 	die "Semaphore trouble: $!\n" unless semop($semid, $semop);
  
  .fi
  To signal the semaphore, replace "-1" with "1".
--- 737,743 ----
  .nf
  
  	$semop = pack("sss", $semnum, -1, 0);
! 	die "Semaphore trouble: $!\en" unless semop($semid, $semop);
  
  .fi
  To signal the semaphore, replace "-1" with "1".

Index: perl_man.4
Prereq: 3.0.1.11
*** perl_man.4.old	Sat Oct 20 02:29:32 1990
--- perl_man.4	Sat Oct 20 02:29:47 1990
***************
*** 1,7 ****
  ''' Beginning of part 4
! ''' $Header: perl_man.4,v 3.0.1.11 90/10/16 10:04:28 lwall Locked $
  '''
  ''' $Log:	perl_man.4,v $
  ''' Revision 3.0.1.11  90/10/16  10:04:28  lwall
  ''' patch29: added @###.## fields to format
  ''' 
--- 1,10 ----
  ''' Beginning of part 4
! ''' $Header: perl_man.4,v 3.0.1.12 90/10/20 02:15:43 lwall Locked $
  '''
  ''' $Log:	perl_man.4,v $
+ ''' Revision 3.0.1.12  90/10/20  02:15:43  lwall
+ ''' patch37: patch37: fixed various typos in man page
+ ''' 
  ''' Revision 3.0.1.11  90/10/16  10:04:28  lwall
  ''' patch29: added @###.## fields to format
  ''' 
***************
*** 808,814 ****
  
  or, used numerically,
  
! 	warn "No checksumming!\n" if $] < 3.019;
  
  .fi
  (Mnemonic: Is this version of perl in the right bracket?)
--- 811,817 ----
  
  or, used numerically,
  
! 	warn "No checksumming!\en" if $] < 3.019;
  
  .fi
  (Mnemonic: Is this version of perl in the right bracket?)
***************
*** 905,911 ****
  The array INC contains the list of places to look for
  .I perl
  scripts to be
! evaluated by the \*(L"do EXPR\*(R" command or the \*(L"require\*(r" command.
  It initially consists of the arguments to any
  .B \-I
  command line switches, followed
--- 908,914 ----
  The array INC contains the list of places to look for
  .I perl
  scripts to be
! evaluated by the \*(L"do EXPR\*(R" command or the \*(L"require\*(R" command.
  It initially consists of the arguments to any
  .B \-I
  command line switches, followed

Index: regcomp.c
Prereq: 3.0.1.6
*** regcomp.c.old	Sat Oct 20 02:30:09 1990
--- regcomp.c	Sat Oct 20 02:30:16 1990
***************
*** 7,15 ****
   * blame Henry for some of the lack of readability.
   */
  
! /* $Header: regcomp.c,v 3.0.1.6 90/10/16 10:17:33 lwall Locked $
   *
   * $Log:	regcomp.c,v $
   * Revision 3.0.1.6  90/10/16  10:17:33  lwall
   * patch29: patterns with multiple short literal strings sometimes failed
   * 
--- 7,18 ----
   * blame Henry for some of the lack of readability.
   */
  
! /* $Header: regcomp.c,v 3.0.1.7 90/10/20 02:18:32 lwall Locked $
   *
   * $Log:	regcomp.c,v $
+  * Revision 3.0.1.7  90/10/20  02:18:32  lwall
+  * patch37: /foo.*bar$/ wrongly optimized to do tail matching on "foo"
+  * 
   * Revision 3.0.1.6  90/10/16  10:17:33  lwall
   * patch29: patterns with multiple short literal strings sometimes failed
   * 
***************
*** 250,256 ****
  		len = 0;
  		curback = 0;
  		back = 0;
! 		while (scan != NULL) {
  			if (OP(scan) == BRANCH) {
  			    if (OP(regnext(scan)) == BRANCH) {
  				curback = -30000;
--- 253,259 ----
  		len = 0;
  		curback = 0;
  		back = 0;
! 		while (OP(scan) != END) {
  			if (OP(scan) == BRANCH) {
  			    if (OP(regnext(scan)) == BRANCH) {
  				curback = -30000;
***************
*** 288,300 ****
  				str_sset(longest,longish);
  			    str_nset(longish,"",0);
  			}
! 			else if (index(simple,OP(scan)))
  			    curback++;
  			scan = regnext(scan);
  		}
! 		if (longish->str_cur > longest->str_cur)
  		    str_sset(longest,longish);
! 		str_free(longish);
  		if (longest->str_cur) {
  			r->regmust = longest;
  			if (back < 0)
--- 291,312 ----
  				str_sset(longest,longish);
  			    str_nset(longish,"",0);
  			}
! 			else if (index(simple,OP(scan))) {
  			    curback++;
+ 			    len = 0;
+ 			    if (longish->str_cur > longest->str_cur)
+ 				str_sset(longest,longish);
+ 			    str_nset(longish,"",0);
+ 			}
  			scan = regnext(scan);
  		}
! 
! 		/* Prefer earlier on tie, unless we can tail match latter */
! 
! 		if (longish->str_cur + (OP(first) == EOL) > longest->str_cur)
  		    str_sset(longest,longish);
! 		else
! 		    str_nset(longish,"",0);
  		if (longest->str_cur) {
  			r->regmust = longest;
  			if (back < 0)
***************
*** 304,314 ****
  			  > !(sawstudy || fold || OP(first) == EOL) )
  				fbmcompile(r->regmust,fold);
  			r->regmust->str_u.str_useful = 100;
! 			if (OP(first) == EOL) /* is match anchored to EOL? */
  			    r->regmust->str_pok |= SP_TAIL;
  		}
  		else
  			str_free(longest);
  	}
  
  	r->do_folding = fold;
--- 316,327 ----
  			  > !(sawstudy || fold || OP(first) == EOL) )
  				fbmcompile(r->regmust,fold);
  			r->regmust->str_u.str_useful = 100;
! 			if (OP(first) == EOL && longish->str_cur)
  			    r->regmust->str_pok |= SP_TAIL;
  		}
  		else
  			str_free(longest);
+ 		str_free(longish);
  	}
  
  	r->do_folding = fold;

Index: x2p/s2p.SH
Prereq: 3.0.1.5
*** x2p/s2p.SH.old	Sat Oct 20 02:31:02 1990
--- x2p/s2p.SH	Sat Oct 20 02:31:07 1990
***************
*** 11,17 ****
  	ln ../../../config.sh . || \
  	(echo "Can't find config.sh."; exit 1)
      fi
!     . config.sh
      ;;
  esac
  echo "Extracting s2p (with variable substitutions)"
--- 11,17 ----
  	ln ../../../config.sh . || \
  	(echo "Can't find config.sh."; exit 1)
      fi
!     . ./config.sh
      ;;
  esac
  echo "Extracting s2p (with variable substitutions)"
***************
*** 28,36 ****
  : In the following dollars and backticks do not need the extra backslash.
  $spitshell >>s2p <<'!NO!SUBS!'
  
! # $Header: s2p.SH,v 3.0.1.5 90/10/16 11:32:40 lwall Locked $
  #
  # $Log:	s2p.SH,v $
  # Revision 3.0.1.5  90/10/16  11:32:40  lwall
  # patch29: s2p modernized
  # 
--- 28,39 ----
  : In the following dollars and backticks do not need the extra backslash.
  $spitshell >>s2p <<'!NO!SUBS!'
  
! # $Header: s2p.SH,v 3.0.1.6 90/10/20 02:21:43 lwall Locked $
  #
  # $Log:	s2p.SH,v $
+ # Revision 3.0.1.6  90/10/20  02:21:43  lwall
+ # patch37: changed some ". config.sh" to ". ./config.sh"
+ # 
  # Revision 3.0.1.5  90/10/16  11:32:40  lwall
  # patch29: s2p modernized
  # 

Index: util.c
Prereq: 3.0.1.8
*** util.c.old	Sat Oct 20 02:30:37 1990
--- util.c	Sat Oct 20 02:30:44 1990
***************
*** 1,4 ****
! /* $Header: util.c,v 3.0.1.8 90/10/16 11:26:57 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
--- 1,4 ----
! /* $Header: util.c,v 3.0.1.9 90/10/20 02:21:01 lwall Locked $
   *
   *    Copyright (c) 1989, Larry Wall
   *
***************
*** 6,11 ****
--- 6,15 ----
   *    as specified in the README file that comes with the perl 3.0 kit.
   *
   * $Log:	util.c,v $
+  * Revision 3.0.1.9  90/10/20  02:21:01  lwall
+  * patch37: tried to take strlen of integer on systems without wait4 or waitpid
+  * patch37: unreachable return eliminated
+  * 
   * Revision 3.0.1.8  90/10/16  11:26:57  lwall
   * patch29: added waitpid
   * patch29: various portability fixes
***************
*** 1341,1350 ****
  #else
      if (pid > 0) {
  	sprintf(spid, "%d", pid);
! 	str = hfetch(pidstatus,spid,strlen(pid),FALSE);
  	if (str != &str_undef) {
  	    *statusp = (int)str->str_u.str_useful;
! 	    hdelete(pidstatus,spid,strlen(pid));
  	    return pid;
  	}
      }
--- 1345,1354 ----
  #else
      if (pid > 0) {
  	sprintf(spid, "%d", pid);
! 	str = hfetch(pidstatus,spid,strlen(spid),FALSE);
  	if (str != &str_undef) {
  	    *statusp = (int)str->str_u.str_useful;
! 	    hdelete(pidstatus,spid,strlen(spid));
  	    return pid;
  	}
      }
***************
*** 1357,1363 ****
  	    str = hiterval(entry);
  	    *statusp = (int)str->str_u.str_useful;
  	    sprintf(spid, "%d", pid);
! 	    hdelete(pidstatus,spid,strlen(pid));
  	    return pid;
  	}
      }
--- 1361,1367 ----
  	    str = hiterval(entry);
  	    *statusp = (int)str->str_u.str_useful;
  	    sprintf(spid, "%d", pid);
! 	    hdelete(pidstatus,spid,strlen(spid));
  	    return pid;
  	}
      }
***************
*** 1373,1381 ****
  	if (result < 0)
  	    *statusp = -1;
      }
  #endif
  #endif
-     return result;
  }
  #endif /* !MSDOS */
  
--- 1377,1385 ----
  	if (result < 0)
  	    *statusp = -1;
      }
+     return result;
  #endif
  #endif
  }
  #endif /* !MSDOS */
  
***************
*** 1389,1395 ****
      char spid[16];
  
      sprintf(spid, "%d", pid);
!     str = hfetch(pidstatus,pid,strlen(pid),TRUE);
      str->str_u.str_useful = status;
  #endif
      return;
--- 1393,1399 ----
      char spid[16];
  
      sprintf(spid, "%d", pid);
!     str = hfetch(pidstatus,spid,strlen(spid),TRUE);
      str->str_u.str_useful = status;
  #endif
      return;

### End of patch 37 ###