summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-04-11 20:32:40 +0000
committerLarry Wall <lwall@netlabs.com>1991-04-11 20:32:40 +0000
commit1c3d792e8fc9c2a36edfbd6c01156ef7e635040f (patch)
tree6f06abb825287c1e22b967a7030a38e336a62e89
parentfe14fcc35f78a371a174a1d14256c2f35ae4262b (diff)
downloadperl-1c3d792e8fc9c2a36edfbd6c01156ef7e635040f.tar.gz
perl 4.0 patch 1: (combined patch)
Subject: Configure now handles defaults much better Subject: Configure now knows if config.sh was built on this machine Subject: Configure now checks file existence more efficiently Subject: Configure now handles stupid SCO csh Configure has been heavily revised. Many of the tests that used to simply force a decision now check that decision against the previous value of the variable, and offer to let you change it. The default now is to keep the old value, so that you don't lose information from your previous run. Because of this, it's now more important to know whether, in fact, config.sh was produced on this machine and on this version of the operating system. config.sh now contains a lastuname variable which contains the output of uname -a. If this matches the current output of uname -a, Configure defaults to including the old config.sh. Otherwise not. If there is no valid config.sh, then Configure looks defaults for the current architecture in the hints/ subdirectory instead. The guesswork I've done in this section of code is phenomenal, so you'll have to instruct me where I've misparsed the output of uname (a problem in portability all of its own). Subject: Configure now differentiates getgroups() type from getgid() type Subject: Configure now figures out malloc ptr type Subject: Configure now does better on sprintf() Configure was assuming that the array of values returned from getgroups was the same type as the gids returned by other system calls. Unfortunately, reality set in. Likewise for malloc() and sprintf(), which there is only one portable way to find out the return value of: try it one way or the other, and see if it blows up. Subject: C flags are now settable on a per-file basis Subject: reduced maximum branch distance in eval.c Certain compilers and/or optimizers get bozoed out by large compilation units, or by large structures within those units. Previously, you either had to change the compiler flags for all the files, or do hairy editing in Makefile.SH and remake the Makefile, necessitating a make depend. Now there is a script called cflags.SH whose duty it is to return the proper CFLAGS for any given C file. You can change the flags in just one spot now and they will be immediately reflected in the next make (or even in the current make, if one is running). Eventually I expect that any of the hints files could modify cflags.SH, but I haven't done that yet. The particular problem of long jump offsets in eval.c has been at least partially alleviated by locating some of the labels in the middle of the function instead of at the end. This still doesn't help the poor Vax when you compile with -g, since it puts a jump to the end of the function to allocate the stack frame and then jumps back to the beginning of the function to execute it. For now Vaxen will have to stick with -O or hand assemble eval.c and teval.c with a -J switch. Subject: fixed "Bad free" error Subject: fixed debugger coredump on subroutines Subject: regexec only allocated space for 9 subexpresssions These are problems that were reported on the net and had unofficial patches. Now they have official patches. Be sure to patch a copy of your files without the unofficial patches, or the patch program will get confused. Subject: you may now use "die" and "caller" in a signal handler Someone pointed out that using die to raise an exception out of a signal handler trashed the expression value stack if the exception was caught by eval. While fixing that, I also fixed the longstanding problem that signal handlers didn't have a normal call frame, which prevented the caller function from working. Subject: fixed undefined environ problem Subject: hopefully straightened out some of the Xenix mess Subject: random cleanup in cpp namespace Just keeping up with the current progress in non-standardization. Subject: fixed failed fork to return undef as documented The open function returns undef on failed implicit forks. The Book assumed that the same was true of an explicit fork. I've made the function behave like the Book says. It's a pity there's no way to have an undefined value that returns -1 in a numeric context but false in a boolean context... Subject: generalized the yaccpar fixer some Thanks to Andy Dougherty, perly.fixer now knows how to fix SVR3 2.2's yaccpar code to do dynamic parse stack allocation. He also made it easy for other people to insert their code there. Hooray! Subject: find2perl sometimes needs to stat on the 2nd leg of a -o Subject: find2perl didn't correctly handle switches with an argument of 0 In attempting to delay the lstat to the last moment, in case a filename could be rejected on the basis of its name, find2perl neglected to take into account the fact that control might pass to the 2nd half of a -o without executing all of the 1st half, in particular without executing the lstat. find2perl was wisely removing leading zeroes from numbers that would mistakenly be interpreted as octal numbers by Perl. Unfortunately, this caused it to delete the number 0 entirely. Subject: fixed dumpvar not to dump internal debugging info Subject: substr($ENV{"PATH"},0,0) = "/foo:" didn't modify environment Subject: $foo .= <BAR> could cause core dump for certain lengths of $foo Subject: perl -de "print" wouldn't stop at the first statement Random glitchy little things. Subject: I'm at NetLabs now I'm now working for NetLabs, Inc., and I hadn't changed my address everywhere.
-rw-r--r--MANIFEST31
-rw-r--r--Makefile.SH55
-rw-r--r--README17
-rw-r--r--cflags.SH80
-rw-r--r--cmd.c29
-rw-r--r--config_h.SH11
-rw-r--r--consarg.c13
-rw-r--r--doarg.c28
-rw-r--r--doio.c17
-rw-r--r--eval.c117
-rw-r--r--hints/3b2.sh1
-rw-r--r--hints/aix_rs.sh1
-rw-r--r--hints/aix_rt.sh1
-rw-r--r--hints/apollo_C6_7.sh1
-rw-r--r--hints/aux.sh2
-rw-r--r--hints/dnix.sh1
-rw-r--r--hints/dynix.sh1
-rw-r--r--hints/fps.sh1
-rw-r--r--hints/genix.sh1
-rw-r--r--hints/hp9000_300.sh2
-rw-r--r--hints/hp9000_400.sh2
-rw-r--r--hints/hpux.sh4
-rw-r--r--hints/i386.sh1
-rw-r--r--lib/dumpvar.pl2
-rw-r--r--patchlevel.h2
-rw-r--r--t/README2
-rw-r--r--x2p/find2perl.SH23
-rw-r--r--x2p/handy.h11
28 files changed, 335 insertions, 122 deletions
diff --git a/MANIFEST b/MANIFEST
index 38226400de..d4058a5426 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -12,6 +12,7 @@ Wishlist Some things that may or may not happen
arg.h Public declarations for the above
array.c Numerically subscripted arrays
array.h Public declarations for the above
+cflags.SH A script that emits C compilation flags per file
client A client to test sockets
cmd.c Command interpreter
cmd.h Public declarations for the above
@@ -86,6 +87,36 @@ h2pl/tcbreak2 cbreak test routine using .pl
handy.h Handy definitions
hash.c Associative arrays
hash.h Public declarations for the above
+hints/3b2.sh
+hints/aix_rs.sh
+hints/aix_rt.sh
+hints/apollo_C6_7.sh
+hints/aux.sh
+hints/dnix.sh
+hints/dynix.sh
+hints/fps.sh
+hints/genix.sh
+hints/hp9000_300.sh
+hints/hp9000_400.sh
+hints/hpux.sh
+hints/i386.sh
+hints/mips.sh
+hints/ncr_tower.sh
+hints/next.sh
+hints/osf_1.sh
+hints/sco_2_3_0.sh
+hints/sco_2_3_1.sh
+hints/sco_2_3_2.sh
+hints/sco_2_3_3.sh
+hints/sco_3.sh
+hints/sgi.sh
+hints/sunos_3_4.sh
+hints/sunos_3_5.sh
+hints/sunos_4_0_1.sh
+hints/sunos_4_0_2.sh
+hints/ultrix_3.sh
+hints/ultrix_4.sh
+hints/uts.sh
installperl Perl script to do "make install" dirty work
ioctl.pl Sample ioctl.pl
lib/abbrev.pl An abbreviation table builder
diff --git a/Makefile.SH b/Makefile.SH
index af9e4acff1..5f5182543d 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -25,9 +25,12 @@ esac
echo "Extracting Makefile (with variable substitutions)"
cat >Makefile <<!GROK!THIS!
-# $Header: Makefile.SH,v 4.0 91/03/20 00:58:54 lwall Locked $
+# $RCSfile: Makefile.SH,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:30:39 $
#
# $Log: Makefile.SH,v $
+# Revision 4.0.1.1 91/04/11 17:30:39 lwall
+# patch1: C flags are now settable on a per-file basis
+#
# Revision 4.0 91/03/20 00:58:54 lwall
# 4.0 baseline.
#
@@ -40,7 +43,6 @@ scriptdir = $scriptdir
privlib = $installprivlib
mansrc = $mansrc
manext = $manext
-CFLAGS = $ccflags $optimize
LDFLAGS = $ldflags
CLDFLAGS = $ldflags
SMALL = $small
@@ -56,6 +58,9 @@ public = perl taintperl $suidperl
!GROK!THIS!
cat >>Makefile <<'!NO!SUBS!'
+
+CFLAGS = `sh cflags.SH $@`
+
private =
scripts = h2ph
@@ -99,7 +104,7 @@ addedbyconf = Makefile.old bsd eunice filexp loc pdp11 usg v7
SHELL = /bin/sh
.c.o:
- $(CC) -c $(CFLAGS) $(LARGE) $*.c
+ $(CC) -c $(CFLAGS) $*.c
all: $(public) $(private) $(util) uperl.o $(scripts)
cd x2p; $(MAKE) all
@@ -107,6 +112,8 @@ all: $(public) $(private) $(util) uperl.o $(scripts)
# This is the standard version that contains no "taint" checks and is
# used for all scripts that aren't set-id or running under something set-id.
+# The $& notation is tells Sequent machines that it can do a parallel make,
+# and is harmless otherwise.
perl: $& perly.o $(obj) usersub.o
$(CC) $(LARGE) $(CLDFLAGS) $(obj) perly.o usersub.o $(libs) -o perl
@@ -140,121 +147,121 @@ taintperl: $& tperly.o tperl.o $(tobj) usersub.o
tperly.o: perly.c perly.h $(h)
/bin/rm -f tperly.c
$(SLN) perly.c tperly.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperly.c
+ $(CC) -c -DTAINT $(CFLAGS) tperly.c
/bin/rm -f tperly.c
tperl.o: perl.c perly.h patchlevel.h perl.h $(h)
/bin/rm -f tperl.c
$(SLN) perl.c tperl.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tperl.c
+ $(CC) -c -DTAINT $(CFLAGS) tperl.c
/bin/rm -f tperl.c
sperl.o: perl.c perly.h patchlevel.h $(h)
/bin/rm -f sperl.c
$(SLN) perl.c sperl.c
- $(CC) -c -DTAINT -DIAMSUID $(CFLAGS) $(LARGE) sperl.c
+ $(CC) -c -DTAINT -DIAMSUID $(CFLAGS) sperl.c
/bin/rm -f sperl.c
tarray.o: array.c $(h)
/bin/rm -f tarray.c
$(SLN) array.c tarray.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tarray.c
+ $(CC) -c -DTAINT $(CFLAGS) tarray.c
/bin/rm -f tarray.c
tcmd.o: cmd.c $(h)
/bin/rm -f tcmd.c
$(SLN) cmd.c tcmd.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcmd.c
+ $(CC) -c -DTAINT $(CFLAGS) tcmd.c
/bin/rm -f tcmd.c
tcons.o: cons.c $(h) perly.h
/bin/rm -f tcons.c
$(SLN) cons.c tcons.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tcons.c
+ $(CC) -c -DTAINT $(CFLAGS) tcons.c
/bin/rm -f tcons.c
tconsarg.o: consarg.c $(h)
/bin/rm -f tconsarg.c
$(SLN) consarg.c tconsarg.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tconsarg.c
+ $(CC) -c -DTAINT $(CFLAGS) tconsarg.c
/bin/rm -f tconsarg.c
tdoarg.o: doarg.c $(h)
/bin/rm -f tdoarg.c
$(SLN) doarg.c tdoarg.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoarg.c
+ $(CC) -c -DTAINT $(CFLAGS) tdoarg.c
/bin/rm -f tdoarg.c
tdoio.o: doio.c $(h)
/bin/rm -f tdoio.c
$(SLN) doio.c tdoio.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdoio.c
+ $(CC) -c -DTAINT $(CFLAGS) tdoio.c
/bin/rm -f tdoio.c
tdolist.o: dolist.c $(h)
/bin/rm -f tdolist.c
$(SLN) dolist.c tdolist.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdolist.c
+ $(CC) -c -DTAINT $(CFLAGS) tdolist.c
/bin/rm -f tdolist.c
tdump.o: dump.c $(h)
/bin/rm -f tdump.c
$(SLN) dump.c tdump.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tdump.c
+ $(CC) -c -DTAINT $(CFLAGS) tdump.c
/bin/rm -f tdump.c
teval.o: eval.c $(h)
/bin/rm -f teval.c
$(SLN) eval.c teval.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) teval.c
+ $(CC) -c -DTAINT $(CFLAGS) teval.c
/bin/rm -f teval.c
tform.o: form.c $(h)
/bin/rm -f tform.c
$(SLN) form.c tform.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tform.c
+ $(CC) -c -DTAINT $(CFLAGS) tform.c
/bin/rm -f tform.c
thash.o: hash.c $(h)
/bin/rm -f thash.c
$(SLN) hash.c thash.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) thash.c
+ $(CC) -c -DTAINT $(CFLAGS) thash.c
/bin/rm -f thash.c
tregcomp.o: regcomp.c $(h)
/bin/rm -f tregcomp.c
$(SLN) regcomp.c tregcomp.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregcomp.c
+ $(CC) -c -DTAINT $(CFLAGS) tregcomp.c
/bin/rm -f tregcomp.c
tregexec.o: regexec.c $(h)
/bin/rm -f tregexec.c
$(SLN) regexec.c tregexec.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tregexec.c
+ $(CC) -c -DTAINT $(CFLAGS) tregexec.c
/bin/rm -f tregexec.c
tstab.o: stab.c $(h)
/bin/rm -f tstab.c
$(SLN) stab.c tstab.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstab.c
+ $(CC) -c -DTAINT $(CFLAGS) tstab.c
/bin/rm -f tstab.c
tstr.o: str.c $(h) perly.h
/bin/rm -f tstr.c
$(SLN) str.c tstr.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tstr.c
+ $(CC) -c -DTAINT $(CFLAGS) tstr.c
/bin/rm -f tstr.c
ttoke.o: toke.c $(h) perly.h
/bin/rm -f ttoke.c
$(SLN) toke.c ttoke.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) ttoke.c
+ $(CC) -c -DTAINT $(CFLAGS) ttoke.c
/bin/rm -f ttoke.c
tutil.o: util.c $(h)
/bin/rm -f tutil.c
$(SLN) util.c tutil.c
- $(CC) -c -DTAINT $(CFLAGS) $(LARGE) tutil.c
+ $(CC) -c -DTAINT $(CFLAGS) tutil.c
/bin/rm -f tutil.c
perly.h: perly.c
@@ -270,7 +277,7 @@ perly.c: perly.y
echo 'extern YYSTYPE yylval;' >>perly.h
perly.o: perly.c perly.h $(h)
- $(CC) -c $(CFLAGS) $(LARGE) perly.c
+ $(CC) -c $(CFLAGS) perly.c
install: all
./perl installperl
diff --git a/README b/README
index 4f80bc6945..3ff706d41f 100644
--- a/README
+++ b/README
@@ -69,8 +69,11 @@ Installation
Most of them should have been taken care of by running the Configure script.
If you have any additional changes to make to the C definitions, they
- can be done in the Makefile, or in config.h. Bear in mind that they will
- get undone next time you run Configure.
+ can be done in cflags.SH. For instance, to turn off the optimizer
+ on eval.c, find the line in the switch structure for eval.c and
+ put the command $optimize='-g' before the ;;. You will probably
+ want to change the entry for teval.c too. To change the C flags
+ for all the files, edit config.sh and change either $ccflags or $optimize.
3) make depend
@@ -91,10 +94,13 @@ Installation
Some compilers will not compile or optimize the larger files without
some extra switches to use larger jump offsets or allocate larger
- internal tables. It's okay to insert rules for specific files into
+ internal tables. You can customize the switches for each file in
+ cflags.SH. It's okay to insert rules for specific files into
Makefile.SH, since a default rule only takes effect in the
absence of a specific rule.
+ Most of the following hints are now done automatically by Configure.
+
The 3b2 needs to turn off -O.
Compilers with limited switch tables may have to define -DSMALLSWITCHES
Domain/OS 10.3 (at least) native C 6.7 may need -opt 2 for eval.c
@@ -106,7 +112,7 @@ Installation
SGI machines may need -Ddouble="long float" and -O1.
Vax-based systems may need to hand assemble teval.s with a -J switch.
Ultrix on MIPS machines may need -DLANGUAGE_C.
- Ultrix 4.0 on MIPS machines may need -Olimit 2820 or so.
+ Ultrix 4.0 on MIPS machines may need -Olimit 2900 or so.
Ultrix 3.[01] on MIPS needs to undefine WAITPID--the system call is busted.
MIPS machines may need to undef d_volatile.
MIPS machines may need to turn off -O on cmd.c, perl.c and tperl.c.
@@ -138,7 +144,8 @@ Installation
See the README in the t subdirectory. Note that you can't run it
in background if this disables opening of /dev/tty. If "make test"
bombs out, just cd to the t directory and run TEST by hand to see if
- it makes any difference.
+ it makes any difference. If individual tests bomb, you can run
+ them by hand, e.g., ./perl op/groups.t
6) make install
diff --git a/cflags.SH b/cflags.SH
new file mode 100644
index 0000000000..52a122eb1e
--- /dev/null
+++ b/cflags.SH
@@ -0,0 +1,80 @@
+case $CONFIG in
+'')
+ if test ! -f config.sh; then
+ ln ../config.sh . || \
+ ln ../../config.sh . || \
+ ln ../../../config.sh . || \
+ (echo "Can't find config.sh."; exit 1)
+ fi 2>/dev/null
+ . ./config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+
+also=': '
+case $# in
+1) also='echo 1>&2 " CFLAGS = "'
+esac
+
+case $# in
+0) set *.c; echo "The current C flags are:" ;;
+*) set `echo "$* " | sed 's/\.o /.c /g'`
+esac
+for file do
+
+ case "$#" in
+ 1) ;;
+ *) echo $n " $file $c" ;;
+ esac
+
+ case "$file" in
+ array.c) ;;
+ cmd.c) ;;
+ cons.c) ;;
+ consarg.c) ;;
+ doarg.c) ;;
+ doio.c) ;;
+ dolist.c) ;;
+ dump.c) ;;
+ eval.c) ;;
+ form.c) ;;
+ hash.c) ;;
+ malloc.c) ;;
+ perl.c) ;;
+ perly.c) ;;
+ regcomp.c) ;;
+ regexec.c) ;;
+ stab.c) ;;
+ str.c) ;;
+ toke.c) ;;
+ usersub.c) ;;
+ util.c) ;;
+ tarray.c) ;;
+ tcmd.c) ;;
+ tcons.c) ;;
+ tconsarg.c) ;;
+ tdoarg.c) ;;
+ tdoio.c) ;;
+ tdolist.c) ;;
+ tdump.c) ;;
+ teval.c) ;;
+ tform.c) ;;
+ thash.c) ;;
+ tmalloc.c) ;;
+ tperl.c) ;;
+ tperly.c) ;;
+ tregcomp.c) ;;
+ tregexec.c) ;;
+ tstab.c) ;;
+ tstr.c) ;;
+ ttoke.c) ;;
+ tusersub.c) ;;
+ tutil.c) ;;
+ *) ;;
+ esac
+
+ echo "$ccflags $optimize $large $split"
+ eval "$also $ccflags $optimize $large $split"
+done
diff --git a/cmd.c b/cmd.c
index 539b42b834..e8d3288f12 100644
--- a/cmd.c
+++ b/cmd.c
@@ -1,4 +1,4 @@
-/* $Header: cmd.c,v 4.0 91/03/20 01:04:18 lwall Locked $
+/* $RCSfile: cmd.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:36:16 $
*
* Copyright (c) 1989, Larry Wall
*
@@ -6,6 +6,9 @@
* as specified in the README file that comes with the perl 3.0 kit.
*
* $Log: cmd.c,v $
+ * Revision 4.0.1.1 91/04/11 17:36:16 lwall
+ * patch1: you may now use "die" and "caller" in a signal handler
+ *
* Revision 4.0 91/03/20 01:04:18 lwall
* 4.0 baseline.
*
@@ -908,7 +911,7 @@ until_loop:
}
#ifdef DEBUGGING
-# ifndef VARARGS
+# ifndef I_VARARGS
/*VARARGS1*/
deb(pat,a1,a2,a3,a4,a5,a6,a7,a8)
char *pat;
@@ -1086,6 +1089,23 @@ HASH **hptr;
}
void
+saveaptr(aptr)
+ARRAY **aptr;
+{
+ register STR *str;
+
+ str = Str_new(17,0);
+ str->str_state = SS_SAPTR;
+ str->str_u.str_array = *aptr; /* remember value */
+ if (str->str_ptr) {
+ Safefree(str->str_ptr);
+ str->str_len = 0;
+ }
+ str->str_ptr = (char*)aptr; /* remember pointer */
+ (void)apush(savestack,str);
+}
+
+void
savelist(sarg,maxsarg)
register STR **sarg;
int maxsarg;
@@ -1156,6 +1176,11 @@ int base;
value->str_ptr = Nullch;
str_free(value);
break;
+ case SS_SAPTR: /* ARRAY* reference */
+ *((ARRAY**)value->str_ptr) = value->str_u.str_array;
+ value->str_ptr = Nullch;
+ str_free(value);
+ break;
case SS_SNSTAB:
stab = (STAB*)value->str_magic;
value->str_magic = Nullstr;
diff --git a/config_h.SH b/config_h.SH
index b0cfe990c5..57a0f1bae4 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -591,6 +591,12 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!'
*/
#define GIDTYPE $gidtype /**/
+/* GROUPSTYPE
+ * This symbol has a value like gid_t, int, ushort, or whatever type is
+ * used in the return value of getgroups().
+ */
+#define GROUPSTYPE $groupstype /**/
+
/* I_FCNTL
* This manifest constant tells the C program to include <fcntl.h>.
*/
@@ -740,6 +746,11 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!'
#$i_my_dir I_MY_DIR /**/
#$d_dirnamlen DIRNAMLEN /**/
+/* MALLOCPTRTYPE
+ * This symbol defines the kind of ptr returned by malloc and realloc.
+ */
+#define MALLOCPTRTYPE $mallocptrtype /**/
+
/* RANDBITS
* This symbol contains the number of bits of random number the rand()
diff --git a/consarg.c b/consarg.c
index e6886f2c23..c606f8e26c 100644
--- a/consarg.c
+++ b/consarg.c
@@ -1,4 +1,4 @@
-/* $Header: consarg.c,v 4.0 91/03/20 01:06:15 lwall Locked $
+/* $RCSfile: consarg.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:38:34 $
*
* Copyright (c) 1989, Larry Wall
*
@@ -6,6 +6,9 @@
* as specified in the README file that comes with the perl 3.0 kit.
*
* $Log: consarg.c,v $
+ * Revision 4.0.1.1 91/04/11 17:38:34 lwall
+ * patch1: fixed "Bad free" error
+ *
* Revision 4.0 91/03/20 01:06:15 lwall
* 4.0 baseline.
*
@@ -555,10 +558,12 @@ register ARG *arg;
if (str) {
arg->arg_type = O_ITEM; /* note arg1 type is already SINGLE */
str_free(s1);
- str_free(s2);
arg[1].arg_ptr.arg_str = str;
- arg[2].arg_ptr.arg_str = Nullstr;
- arg[2].arg_type = A_NULL;
+ if (s2) {
+ str_free(s2);
+ arg[2].arg_ptr.arg_str = Nullstr;
+ arg[2].arg_type = A_NULL;
+ }
}
}
}
diff --git a/doarg.c b/doarg.c
index 4a5fe24cde..045b59769b 100644
--- a/doarg.c
+++ b/doarg.c
@@ -1,4 +1,4 @@
-/* $Header: doarg.c,v 4.0 91/03/20 01:06:42 lwall Locked $
+/* $RCSfile: doarg.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:40:14 $
*
* Copyright (c) 1989, Larry Wall
*
@@ -6,6 +6,10 @@
* as specified in the README file that comes with the perl 3.0 kit.
*
* $Log: doarg.c,v $
+ * Revision 4.0.1.1 91/04/11 17:40:14 lwall
+ * patch1: fixed undefined environ problem
+ * patch1: fixed debugger coredump on subroutines
+ *
* Revision 4.0 91/03/20 01:06:42 lwall
* 4.0 baseline.
*
@@ -20,10 +24,6 @@
extern unsigned char fold[];
-#ifndef __STDC__
-extern char **environ;
-#endif /* ! __STDC__ */
-
#ifdef BUGGY_MSC
#pragma function(memcmp)
#endif /* BUGGY_MSC */
@@ -831,8 +831,8 @@ register STR **sarg;
*t = '\0';
xs = str_get(*sarg);
xlen = (*sarg)->str_cur;
- if (*xs == 'S' && xs[1] == 't' && xs[2] == 'B'
- && xlen == sizeof(STBP) && strlen(xs) < xlen) {
+ if (*xs == 'S' && xs[1] == 't' && xs[2] == 'B' && xs[3] == '\0'
+ && xlen == sizeof(STBP)) {
STR *tmpstr = Str_new(24,0);
stab_fullname(tmpstr, ((STAB*)(*sarg))); /* a stab value! */
@@ -934,6 +934,12 @@ int *arglast;
}
if (!stab)
fatal("Undefined subroutine called");
+ if (!(sub = stab_sub(stab))) {
+ STR *tmpstr = arg[0].arg_ptr.arg_str;
+
+ stab_fullname(tmpstr, stab);
+ fatal("Undefined subroutine \"%s\" called",tmpstr->str_ptr);
+ }
if (arg->arg_type == O_DBSUBR && !sub->usersub) {
str = stab_val(DBsub);
saveitem(str);
@@ -942,14 +948,6 @@ int *arglast;
if (!sub)
fatal("No DBsub routine");
}
- else {
- if (!(sub = stab_sub(stab))) {
- STR *tmpstr = arg[0].arg_ptr.arg_str;
-
- stab_fullname(tmpstr, stab);
- fatal("Undefined subroutine \"%s\" called",tmpstr->str_ptr);
- }
- }
str = Str_new(15, sizeof(CSV));
str->str_state = SS_SCSV;
(void)apush(savestack,str);
diff --git a/doio.c b/doio.c
index f467a279ca..0477b0b8c3 100644
--- a/doio.c
+++ b/doio.c
@@ -1,4 +1,4 @@
-/* $Header: doio.c,v 4.0 91/03/20 01:07:06 lwall Locked $
+/* $RCSfile: doio.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:41:06 $
*
* Copyright (c) 1989, Larry Wall
*
@@ -6,6 +6,9 @@
* as specified in the README file that comes with the perl 3.0 kit.
*
* $Log: doio.c,v $
+ * Revision 4.0.1.1 91/04/11 17:41:06 lwall
+ * patch1: hopefully straightened out some of the Xenix mess
+ *
* Revision 4.0 91/03/20 01:07:06 lwall
* 4.0 baseline.
*
@@ -19,17 +22,13 @@
#include <netdb.h>
#endif
-#ifdef M_UNIX
-#if defined(HAS_SELECT) && !defined(I_SYS_TIME)
-#include <sys/select.h>
-#endif
-#endif
-
-#ifdef M_XENIX
#ifdef HAS_SELECT
+#ifdef I_SYS_SELECT
+#ifndef I_SYS_TIME
#include <sys/select.h>
#endif
#endif
+#endif
#if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
#include <sys/ipc.h>
@@ -2430,7 +2429,7 @@ int effective;
#define NGROUPS 32
#endif
{
- GIDTYPE gary[NGROUPS];
+ GROUPSTYPE gary[NGROUPS];
int anum;
anum = getgroups(NGROUPS,gary);
diff --git a/eval.c b/eval.c
index 51ffd0c0d4..6185142582 100644
--- a/eval.c
+++ b/eval.c
@@ -1,4 +1,4 @@
-/* $Header: eval.c,v 4.0 91/03/20 01:16:48 lwall Locked $
+/* $RCSfile: eval.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:43:48 $
*
* Copyright (c) 1989, Larry Wall
*
@@ -6,6 +6,10 @@
* as specified in the README file that comes with the perl 3.0 kit.
*
* $Log: eval.c,v $
+ * Revision 4.0.1.1 91/04/11 17:43:48 lwall
+ * patch1: fixed failed fork to return undef as documented
+ * patch1: reduced maximum branch distance in eval.c
+ *
* Revision 4.0 91/03/20 01:16:48 lwall
* 4.0 baseline.
*
@@ -1857,6 +1861,8 @@ register int sp;
case O_FORK:
#ifdef HAS_FORK
anum = fork();
+ if (anum < 0)
+ goto say_undef;
if (!anum) {
if (tmpstab = stabent("$",allstabs))
str_numset(STAB_STR(tmpstab),(double)getpid());
@@ -1978,6 +1984,62 @@ register int sp;
else
value = (double)scanoct(tmps, 99, &argtype);
goto donumset;
+
+/* These common exits are hidden here in the middle of the switches for the
+/* benefit of those machines with limited branch addressing. Sigh. */
+
+array_return:
+#ifdef DEBUGGING
+ if (debug) {
+ dlevel--;
+ if (debug & 8) {
+ anum = sp - arglast[0];
+ switch (anum) {
+ case 0:
+ deb("%s RETURNS ()\n",opname[optype]);
+ break;
+ case 1:
+ deb("%s RETURNS (\"%s\")\n",opname[optype],str_get(st[1]));
+ break;
+ default:
+ tmps = str_get(st[1]);
+ deb("%s RETURNS %d ARGS (\"%s\",%s\"%s\")\n",opname[optype],
+ anum,tmps,anum==2?"":"...,",str_get(st[anum]));
+ break;
+ }
+ }
+ }
+#endif
+ return sp;
+
+say_yes:
+ str = &str_yes;
+ goto normal_return;
+
+say_no:
+ str = &str_no;
+ goto normal_return;
+
+say_undef:
+ str = &str_undef;
+ goto normal_return;
+
+say_zero:
+ value = 0.0;
+ /* FALL THROUGH */
+
+donumset:
+ str_numset(str,value);
+ STABSET(str);
+ st[1] = str;
+#ifdef DEBUGGING
+ if (debug) {
+ dlevel--;
+ if (debug & 8)
+ deb("%s RETURNS \"%f\"\n",opname[optype],value);
+ }
+#endif
+ return arglast[0] + 1;
#ifdef SMALLSWITCHES
}
else
@@ -2837,57 +2899,4 @@ register int sp;
}
#endif
return arglast[0] + 1;
-
-array_return:
-#ifdef DEBUGGING
- if (debug) {
- dlevel--;
- if (debug & 8) {
- anum = sp - arglast[0];
- switch (anum) {
- case 0:
- deb("%s RETURNS ()\n",opname[optype]);
- break;
- case 1:
- deb("%s RETURNS (\"%s\")\n",opname[optype],str_get(st[1]));
- break;
- default:
- tmps = str_get(st[1]);
- deb("%s RETURNS %d ARGS (\"%s\",%s\"%s\")\n",opname[optype],
- anum,tmps,anum==2?"":"...,",str_get(st[anum]));
- break;
- }
- }
- }
-#endif
- return sp;
-
-say_yes:
- str = &str_yes;
- goto normal_return;
-
-say_no:
- str = &str_no;
- goto normal_return;
-
-say_undef:
- str = &str_undef;
- goto normal_return;
-
-say_zero:
- value = 0.0;
- /* FALL THROUGH */
-
-donumset:
- str_numset(str,value);
- STABSET(str);
- st[1] = str;
-#ifdef DEBUGGING
- if (debug) {
- dlevel--;
- if (debug & 8)
- deb("%s RETURNS \"%f\"\n",opname[optype],value);
- }
-#endif
- return arglast[0] + 1;
}
diff --git a/hints/3b2.sh b/hints/3b2.sh
new file mode 100644
index 0000000000..5b67dab8f2
--- /dev/null
+++ b/hints/3b2.sh
@@ -0,0 +1 @@
+optimize='-g'
diff --git a/hints/aix_rs.sh b/hints/aix_rs.sh
new file mode 100644
index 0000000000..5b67dab8f2
--- /dev/null
+++ b/hints/aix_rs.sh
@@ -0,0 +1 @@
+optimize='-g'
diff --git a/hints/aix_rt.sh b/hints/aix_rt.sh
new file mode 100644
index 0000000000..83bb7a13c7
--- /dev/null
+++ b/hints/aix_rt.sh
@@ -0,0 +1 @@
+ccflags="$ccflags -a -DCRIPPLED_CC"
diff --git a/hints/apollo_C6_7.sh b/hints/apollo_C6_7.sh
new file mode 100644
index 0000000000..f85b4d2a8c
--- /dev/null
+++ b/hints/apollo_C6_7.sh
@@ -0,0 +1 @@
+optimize='-opt 2'
diff --git a/hints/aux.sh b/hints/aux.sh
new file mode 100644
index 0000000000..f34ed6225a
--- /dev/null
+++ b/hints/aux.sh
@@ -0,0 +1,2 @@
+optimize='-O'
+ccflags="$ccflags -B/usr/lib/bin/'
diff --git a/hints/dnix.sh b/hints/dnix.sh
new file mode 100644
index 0000000000..5b67dab8f2
--- /dev/null
+++ b/hints/dnix.sh
@@ -0,0 +1 @@
+optimize='-g'
diff --git a/hints/dynix.sh b/hints/dynix.sh
new file mode 100644
index 0000000000..34bc1b938a
--- /dev/null
+++ b/hints/dynix.sh
@@ -0,0 +1 @@
+d_castneg=undef
diff --git a/hints/fps.sh b/hints/fps.sh
new file mode 100644
index 0000000000..1132e74b9d
--- /dev/null
+++ b/hints/fps.sh
@@ -0,0 +1 @@
+ccflags="$ccflags -J -DBADSWITCH"
diff --git a/hints/genix.sh b/hints/genix.sh
new file mode 100644
index 0000000000..16b6879b46
--- /dev/null
+++ b/hints/genix.sh
@@ -0,0 +1 @@
+i_varargs=undef
diff --git a/hints/hp9000_300.sh b/hints/hp9000_300.sh
new file mode 100644
index 0000000000..956bf08d07
--- /dev/null
+++ b/hints/hp9000_300.sh
@@ -0,0 +1,2 @@
+optimize='+O1'
+ccflags="$ccflags -Wc,-Nw500"
diff --git a/hints/hp9000_400.sh b/hints/hp9000_400.sh
new file mode 100644
index 0000000000..956bf08d07
--- /dev/null
+++ b/hints/hp9000_400.sh
@@ -0,0 +1,2 @@
+optimize='+O1'
+ccflags="$ccflags -Wc,-Nw500"
diff --git a/hints/hpux.sh b/hints/hpux.sh
new file mode 100644
index 0000000000..83a149ce1e
--- /dev/null
+++ b/hints/hpux.sh
@@ -0,0 +1,4 @@
+d_syscall=$undef
+echo " "
+echo "NOTE: regression test op.read may fail due to an NFS bug in HP/UX."
+echo "If so, don't worry about it."
diff --git a/hints/i386.sh b/hints/i386.sh
new file mode 100644
index 0000000000..0a810ffea8
--- /dev/null
+++ b/hints/i386.sh
@@ -0,0 +1 @@
+ldflags='-L/usr/ucblib'
diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl
index b3fb02b00a..5427494485 100644
--- a/lib/dumpvar.pl
+++ b/lib/dumpvar.pl
@@ -23,7 +23,7 @@ sub main'dumpvar {
}
print ")\n";
}
- if ($key ne "_$package" && defined %entry) {
+ if ($key ne "_$package" && $key ne "_DB" && defined %entry) {
print "\%$key = (\n";
foreach $key (sort keys(%entry)) {
print " $key\t'",&unctrl($entry{$key}),"'\n";
diff --git a/patchlevel.h b/patchlevel.h
index 935ec354b7..110c86f392 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1 +1 @@
-#define PATCHLEVEL 0
+#define PATCHLEVEL 1
diff --git a/t/README b/t/README
index 1c079409c3..47ab845193 100644
--- a/t/README
+++ b/t/README
@@ -8,4 +8,4 @@ If you put out extra lines with a '#' character on the front, you don't
have to worry about removing the extra print statements later since TEST
ignores lines beginning with '#'.
-If you come up with new tests, send them to lwall@jpl-devvax.jpl.nasa.gov.
+If you come up with new tests, send them to lwall@netlabs.com.
diff --git a/x2p/find2perl.SH b/x2p/find2perl.SH
index 56983f35d1..f850247391 100644
--- a/x2p/find2perl.SH
+++ b/x2p/find2perl.SH
@@ -202,7 +202,8 @@ while (@ARGV) {
}
if (@ARGV) {
if ($ARGV[0] eq '-o') {
- local($indent) = $indent - 4;
+ $statdone = 0 if $indent == 1 && $delayedstat;
+ $saw_or++;
$out .= "\n" . &tab . "||\n";
shift;
}
@@ -317,6 +318,7 @@ sub dodir {
next if $_ eq '.';
next if $_ eq '..';
$name = "$dir/$_";
+ $nlink = 0;
&wanted;
}
}
@@ -627,11 +629,21 @@ sub tab {
local($tabstring);
$tabstring = "\t" x ($indent / 2) . ' ' x ($indent % 2 * 4);
- if ($_ !~ /^(name|print)/) {
- if (!$statdone) {
- $tabstring .= <<'ENDOFSTAT' . $tabstring;
+ if (!$statdone) {
+ if ($_ =~ /^(name|print)/) {
+ $delayedstat++;
+ }
+ else {
+ if ($saw_or) {
+ $tabstring .= <<'ENDOFSTAT' . $tabstring;
+($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) &&
+ENDOFSTAT
+ }
+ else {
+ $tabstring .= <<'ENDOFSTAT' . $tabstring;
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
ENDOFSTAT
+ }
$statdone = 1;
}
}
@@ -650,7 +662,8 @@ sub fileglob_to_re {
sub n {
local($n) = @_;
- $n =~ s/^-0*/< / || $n =~ s/^\+0*/> / || $n =~ s/^0*/== /;
+ $n =~ s/^-/< / || $n =~ s/^\+/> / || $n =~ s/^/== /;
+ $n =~ s/ 0*(\d)/ $1/;
$n;
}
diff --git a/x2p/handy.h b/x2p/handy.h
index 84e0c3de6e..e50cbc3866 100644
--- a/x2p/handy.h
+++ b/x2p/handy.h
@@ -1,4 +1,4 @@
-/* $Header: handy.h,v 4.0 91/03/20 01:57:45 lwall Locked $
+/* $RCSfile: handy.h,v $$Revision: 4.0.1.1 $$Date: 91/04/12 09:29:08 $
*
* Copyright (c) 1989, Larry Wall
*
@@ -6,6 +6,9 @@
* as specified in the README file that comes with the perl 3.0 kit.
*
* $Log: handy.h,v $
+ * Revision 4.0.1.1 91/04/12 09:29:08 lwall
+ * patch1: random cleanup in cpp namespace
+ *
* Revision 4.0 91/03/20 01:57:45 lwall
* 4.0 baseline.
*
@@ -16,6 +19,12 @@
#define Nullfp Null(FILE*)
#define bool char
+#ifdef TRUE
+#undef TRUE
+#endif
+#ifdef FALSE
+#undef FALSE
+#endif
#define TRUE (1)
#define FALSE (0)