perl 3.0 patch #6 patch 5 continued
Larry Wall [Fri, 17 Nov 1989 03:02:59 +0000 (03:02 +0000)]
See patch 5.

14 files changed:
patchlevel.h
perl.h
perl.man.1
perl.man.2
perl.man.3
perl.man.4
perly.c
stab.c
str.c
toke.c
util.c
util.h
x2p/s2p.SH
x2p/walk.c

index 51d80f3..fb8ed65 100644 (file)
@@ -1 +1 @@
-#define PATCHLEVEL 5
+#define PATCHLEVEL 6
diff --git a/perl.h b/perl.h
index 2f7131f..a9e3f14 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1,4 +1,4 @@
-/* $Header: perl.h,v 3.0.1.2 89/11/11 04:39:38 lwall Locked $
+/* $Header: perl.h,v 3.0.1.3 89/11/17 15:28:57 lwall Locked $
  *
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,10 @@
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       perl.h,v $
+ * Revision 3.0.1.3  89/11/17  15:28:57  lwall
+ * patch5: byteorder now is a hex value
+ * patch5: Configure now looks for <time.h> including <sys/time.h>
+ * 
  * Revision 3.0.1.2  89/11/11  04:39:38  lwall
  * patch2: Configure may now set -DDEBUGGING
  * patch2: netinet/in.h needed sys/types.h some places
@@ -35,7 +39,7 @@
 #   define vfork fork
 #endif
 
-#if defined(MEMCMP) && defined(mips) && BYTEORDER == 01234
+#if defined(MEMCMP) && defined(mips) && BYTEORDER == 0x1234
 #undef MEMCMP
 #endif
 
@@ -67,11 +71,14 @@ extern char *memcpy(), *memset();
 
 #if defined(TMINSYS) || defined(I_SYSTIME)
 #include <sys/time.h>
-#ifdef TIMETOO
+#ifdef I_TIMETOO
 #include <time.h>
 #endif
 #else
 #include <time.h>
+#ifdef I_SYSTIMETOO
+#include <time.h>
+#endif
 #endif
 
 #include <sys/times.h>
@@ -238,7 +245,7 @@ EXT STR *Str;
 #define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len)
 
 #ifndef BYTEORDER
-#define BYTEORDER 01234
+#define BYTEORDER 0x1234
 #endif
 
 #if defined(htonl) && !defined(HTONL)
@@ -254,7 +261,7 @@ EXT STR *Str;
 #define NTOHS
 #endif
 #ifndef HTONL
-#if (BYTEORDER != 04321) && (BYTEORDER != 087654321)
+#if (BYTEORDER != 0x4321) && (BYTEORDER != 0x87654321)
 #define HTONS
 #define HTONL
 #define NTOHS
@@ -266,7 +273,7 @@ EXT STR *Str;
 #define ntohl my_ntohl
 #endif
 #else
-#if (BYTEORDER == 04321) || (BYTEORDER == 087654321)
+#if (BYTEORDER == 0x4321) || (BYTEORDER == 0x87654321)
 #undef HTONS
 #undef HTONL
 #undef NTOHS
index f61350b..33a48a3 100644 (file)
@@ -1,7 +1,10 @@
 .rn '' }`
-''' $Header: perl.man.1,v 3.0.1.1 89/11/11 04:41:22 lwall Locked $
+''' $Header: perl.man.1,v 3.0.1.2 89/11/17 15:30:03 lwall Locked $
 ''' 
 ''' $Log:      perl.man.1,v $
+''' Revision 3.0.1.2  89/11/17  15:30:03  lwall
+''' patch5: fixed some manual typos and indent problems
+''' 
 ''' Revision 3.0.1.1  89/11/11  04:41:22  lwall
 ''' patch2: explained about sh and ${1+"$@"}
 ''' patch2: documented that space must separate word and '' string
@@ -413,7 +416,7 @@ scalar variables and values are interpreted as strings or numbers
 as appropriate to the context.
 A scalar is interpreted as TRUE in the boolean sense if it is not the null
 string or 0.
-Booleans returned by operators are 1 for true and \'0\' or \'\' (the null
+Booleans returned by operators are 1 for true and 0 or \'\' (the null
 string) for false.
 .PP
 There are actually two varieties of null string: defined and undefined.
@@ -831,7 +834,7 @@ The only things that need to be declared in
 .I perl
 are report formats and subroutines.
 See the sections below for more information on those declarations.
-All uninitialized objects user-created objects are assumed to
+All uninitialized user-created objects are assumed to
 start with a null or 0 value until they
 are defined by some explicit operation such as assignment.
 The sequence of commands is executed just once, unlike in
@@ -1031,9 +1034,9 @@ In addition to the above, you could write
 
 .ne 6
        foo: {
-               $abc = 1, last foo      if /^abc/;
-               $def = 1, last foo      if /^def/;
-               $xyz = 1, last foo      if /^xyz/;
+               $abc = 1, last foo  if /^abc/;
+               $def = 1, last foo  if /^def/;
+               $xyz = 1, last foo  if /^xyz/;
                $nothing = 1;
        }
 
index c310cfc..ddd5365 100644 (file)
@@ -1,7 +1,10 @@
 ''' Beginning of part 2
-''' $Header: perl.man.2,v 3.0.1.1 89/11/11 04:43:10 lwall Locked $
+''' $Header: perl.man.2,v 3.0.1.2 89/11/17 15:30:16 lwall Locked $
 '''
 ''' $Log:      perl.man.2,v $
+''' Revision 3.0.1.2  89/11/17  15:30:16  lwall
+''' patch5: fixed some manual typos and indent problems
+''' 
 ''' Revision 3.0.1.1  89/11/11  04:43:10  lwall
 ''' patch2: made some line breaks depend on troff vs. nroff
 ''' patch2: example of unshift had args backwards
@@ -140,7 +143,7 @@ Here's an example of looking up non-numeric uids:
                $uid{$login} = $uid;
                $gid{$login} = $gid;
        }
-       @ary = <$pattern>;      # get filenames
+       @ary = <${pattern}>;    # get filenames
        if ($uid{$user} eq \'\') {
                die "$user not in passwd file";
        }
index 456c228..c5359f9 100644 (file)
@@ -1,7 +1,11 @@
 ''' Beginning of part 3
-''' $Header: perl.man.3,v 3.0.1.1 89/11/11 04:45:06 lwall Locked $
+''' $Header: perl.man.3,v 3.0.1.2 89/11/17 15:31:05 lwall Locked $
 '''
 ''' $Log:      perl.man.3,v $
+''' Revision 3.0.1.2  89/11/17  15:31:05  lwall
+''' patch5: fixed some manual typos and indent problems
+''' patch5: added warning about print making an array context
+''' 
 ''' Revision 3.0.1.1  89/11/11  04:45:06  lwall
 ''' patch2: made some line breaks depend on troff vs. nroff
 ''' 
@@ -288,6 +292,9 @@ If LIST is also omitted, prints $_ to
 To set the default output channel to something other than
 .I STDOUT
 use the select operation.
+Note that, because print takes a LIST, anything in the LIST is evaluated
+in an array context, and any subroutine that you call will have one or more
+of its expressions evaluated in an array context.
 .Ip "printf(FILEHANDLE LIST)" 8 10
 .Ip "printf(LIST)" 8
 .Ip "printf FILEHANDLE LIST" 8
@@ -699,7 +706,7 @@ For example:
 
 .fi
 produces the output \*(L'h:i:t:h:e:r:e\*(R'.
-.P
+.Sp
 The NUM parameter can be used to partially split a line
 .nf
 
index 5d3b8c9..5f768aa 100644 (file)
@@ -1,7 +1,11 @@
 ''' Beginning of part 4
-''' $Header: perl.man.4,v 3.0.1.2 89/11/11 04:46:40 lwall Locked $
+''' $Header: perl.man.4,v 3.0.1.3 89/11/17 15:32:25 lwall Locked $
 '''
 ''' $Log:      perl.man.4,v $
+''' Revision 3.0.1.3  89/11/17  15:32:25  lwall
+''' patch5: fixed some manual typos and indent problems
+''' patch5: clarified difference between $! and $@
+''' 
 ''' Revision 3.0.1.2  89/11/11  04:46:40  lwall
 ''' patch2: made some line breaks depend on troff vs. nroff
 ''' patch2: clarified operation of ^ and $ when $* is false
@@ -49,22 +53,22 @@ be of highest precedence, just like a normal function call.
 Examples:
 .nf
 
-       chdir $foo || die;      # (chdir $foo) || die
-       chdir($foo) || die;     # (chdir $foo) || die
-       chdir ($foo) || die;    # (chdir $foo) || die
-       chdir +($foo) || die;   # (chdir $foo) || die
+       chdir $foo || die;\h'|3i'# (chdir $foo) || die
+       chdir($foo) || die;\h'|3i'# (chdir $foo) || die
+       chdir ($foo) || die;\h'|3i'# (chdir $foo) || die
+       chdir +($foo) || die;\h'|3i'# (chdir $foo) || die
 
 but, because * is higher precedence than ||:
 
-       chdir $foo * 20;        # chdir ($foo * 20)
-       chdir($foo) * 20;       # (chdir $foo) * 20
-       chdir ($foo) * 20;      # (chdir $foo) * 20
-       chdir +($foo) * 20;     # chdir ($foo * 20)
+       chdir $foo * 20;\h'|3i'# chdir ($foo * 20)
+       chdir($foo) * 20;\h'|3i'# (chdir $foo) * 20
+       chdir ($foo) * 20;\h'|3i'# (chdir $foo) * 20
+       chdir +($foo) * 20;\h'|3i'# chdir ($foo * 20)
 
-       rand 10 * 20;           # rand (10 * 20)
-       rand(10) * 20;          # (rand 10) * 20
-       rand (10) * 20;         # (rand 10) * 20
-       rand +(10) * 20;        # rand (10 * 20)
+       rand 10 * 20;\h'|3i'# rand (10 * 20)
+       rand(10) * 20;\h'|3i'# (rand 10) * 20
+       rand (10) * 20;\h'|3i'# (rand 10) * 20
+       rand +(10) * 20;\h'|3i'# rand (10 * 20)
 
 .fi
 In the absence of parentheses,
@@ -801,14 +805,18 @@ important.)
 .Ip $! 8 2
 If used in a numeric context, yields the current value of errno, with all the
 usual caveats.
+(This means that you shouldn't depend on the value of $! to be anything
+in particular unless you've gotten a specific error return indicating a
+system error.)
 If used in a string context, yields the corresponding system error string.
 You can assign to $! in order to set errno
 if, for instance, you want $! to return the string for error n, or you want
 to set the exit value for the die operator.
 (Mnemonic: What just went bang?)
 .Ip $@ 8 2
-The error message from the last eval command.
-If null, the last eval parsed and executed correctly.
+The perl syntax error message from the last eval command.
+If null, the last eval parsed and executed correctly (although the operations
+you invoked may have failed in the normal fashion).
 (Mnemonic: Where was the syntax error \*(L"at\*(R"?)
 .Ip $< 8 2
 The real uid of this process.
@@ -1041,14 +1049,14 @@ Just outdent it a little to make it more visible:
 Don't be afraid to use loop labels\*(--they're there to enhance readability as
 well as to allow multi-level loop breaks.
 See last example.
-.Ip 6. 4 4
+.Ip 4. 4 4
 For portability, when using features that may not be implemented on every
 machine, test the construct in an eval to see if it fails.
 If you know what version or patchlevel a particular feature was implemented,
 you can test $] to see if it will be there.
-.Ip 4. 4 4
-Choose mnemonic identifiers.
 .Ip 5. 4 4
+Choose mnemonic identifiers.
+.Ip 6. 4 4
 Be consistent.
 .Sh "Debugging"
 If you invoke
diff --git a/perly.c b/perly.c
index 645ac3d..db62100 100644 (file)
--- a/perly.c
+++ b/perly.c
@@ -1,4 +1,4 @@
-char rcsid[] = "$Header: perly.c,v 3.0.1.1 89/11/11 04:50:04 lwall Locked $\nPatch level: ###\n";
+char rcsid[] = "$Header: perly.c,v 3.0.1.2 89/11/17 15:34:42 lwall Locked $\nPatch level: ###\n";
 /*
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,9 @@ char rcsid[] = "$Header: perly.c,v 3.0.1.1 89/11/11 04:50:04 lwall Locked $\nPat
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       perly.c,v $
+ * Revision 3.0.1.2  89/11/17  15:34:42  lwall
+ * patch5: fixed possible confusion about current effective gid
+ * 
  * Revision 3.0.1.1  89/11/11  04:50:04  lwall
  * patch2: moved yydebug to where its type didn't matter
  * 
@@ -426,7 +429,7 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
            fatal("Can't do setuid\n");
        }
 
-       if (statbuf.st_mode & S_ISGID && statbuf.st_gid != getegid())
+       if (statbuf.st_mode & S_ISGID && statbuf.st_gid != egid)
 #ifdef SETEGID
            (void)setegid(statbuf.st_gid);
 #else
@@ -458,7 +461,10 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
            setuid((UIDTYPE)uid);
 #endif
 #endif
+       uid = (int)getuid();
        euid = (int)geteuid();
+       gid = (int)getgid();
+       egid = (int)getegid();
        if (!cando(S_IEXEC,TRUE,&statbuf))
            fatal("Permission denied\n");       /* they can't do this */
     }
diff --git a/stab.c b/stab.c
index d1f3571..5b06198 100644 (file)
--- a/stab.c
+++ b/stab.c
@@ -1,4 +1,4 @@
-/* $Header: stab.c,v 3.0.1.1 89/11/11 04:55:07 lwall Locked $
+/* $Header: stab.c,v 3.0.1.2 89/11/17 15:35:37 lwall Locked $
  *
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,9 @@
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       stab.c,v $
+ * Revision 3.0.1.2  89/11/17  15:35:37  lwall
+ * patch5: sighandler() needed to be static
+ * 
  * Revision 3.0.1.1  89/11/11  04:55:07  lwall
  * patch2: sys_errlist[sys_nerr] is illegal
  * 
@@ -19,8 +22,6 @@
 
 #include <signal.h>
 
-/* This oughta be generated by Configure. */
-
 static char *sig_name[] = {
     SIG_NAME,0
 };
@@ -188,7 +189,7 @@ STR *str;
     STAB *stab = mstr->str_u.str_stab;
     char *s;
     int i;
-    int sighandler();
+    static int sighandler();
 
     switch (mstr->str_rare) {
     case 'E':
@@ -421,6 +422,7 @@ char *sig;
     return 0;
 }
 
+static int
 sighandler(sig)
 int sig;
 {
diff --git a/str.c b/str.c
index ee76096..06d185e 100644 (file)
--- a/str.c
+++ b/str.c
@@ -1,4 +1,4 @@
-/* $Header: str.c,v 3.0.1.2 89/11/11 04:56:22 lwall Locked $
+/* $Header: str.c,v 3.0.1.3 89/11/17 15:38:23 lwall Locked $
  *
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,10 @@
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       str.c,v $
+ * Revision 3.0.1.3  89/11/17  15:38:23  lwall
+ * patch5: some machines typedef unchar too
+ * patch5: substitution on leading components occasionally caused <> corruption
+ * 
  * Revision 3.0.1.2  89/11/11  04:56:22  lwall
  * patch2: uchar gives Crays fits
  * 
@@ -666,6 +670,7 @@ int append;
        bpx = bp - str->str_ptr;        /* prepare for possible relocation */
        if (get_paragraph && oldbp)
            obpx = oldbp - str->str_ptr;
+       str->str_cur = bpx;
        STR_GROW(str, bpx + cnt + 2);
        bp = str->str_ptr + bpx;        /* reconstitute our pointer */
        if (get_paragraph && oldbp)
@@ -843,7 +848,7 @@ STR *src;
                    else if (*d == '[' && s[-1] == ']') { /* char class? */
                        int weight = 2;         /* let's weigh the evidence */
                        char seen[256];
-                       unsigned char unchar = 0, lastunchar;
+                       unsigned char un_char = 0, last_un_char;
 
                        Zero(seen,256,char);
                        *--s = '\0';
@@ -860,12 +865,12 @@ STR *src;
                                weight -= 100;
                        }
                        for (d++; d < s; d++) {
-                           lastunchar = unchar;
-                           unchar = (unsigned char)*d;
+                           last_un_char = un_char;
+                           un_char = (unsigned char)*d;
                            switch (*d) {
                            case '&':
                            case '$':
-                               weight -= seen[unchar] * 10;
+                               weight -= seen[un_char] * 10;
                                if (isalpha(d[1]) || isdigit(d[1]) ||
                                  d[1] == '_') {
                                    d = scanreg(d,s,tokenbuf);
@@ -883,7 +888,7 @@ STR *src;
                                }
                                break;
                            case '\\':
-                               unchar = 254;
+                               un_char = 254;
                                if (d[1]) {
                                    if (index("wds",d[1]))
                                        weight += 100;
@@ -901,8 +906,8 @@ STR *src;
                                    weight += 100;
                                break;
                            case '-':
-                               if (lastunchar < d[1] || d[1] == '\\') {
-                                   if (index("aA01! ",lastunchar))
+                               if (last_un_char < d[1] || d[1] == '\\') {
+                                   if (index("aA01! ",last_un_char))
                                        weight += 30;
                                    if (index("zZ79~",d[1]))
                                        weight += 30;
@@ -916,12 +921,12 @@ STR *src;
                                        weight -= 150;
                                    d = bufptr;
                                }
-                               if (unchar == lastunchar + 1)
+                               if (un_char == last_un_char + 1)
                                    weight += 5;
-                               weight -= seen[unchar];
+                               weight -= seen[un_char];
                                break;
                            }
-                           seen[unchar]++;
+                           seen[un_char]++;
                        }
 #ifdef DEBUGGING
                        if (debug & 512)
diff --git a/toke.c b/toke.c
index 1d9474e..e295a87 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1,4 +1,4 @@
-/* $Header: toke.c,v 3.0.1.2 89/11/11 05:04:42 lwall Locked $
+/* $Header: toke.c,v 3.0.1.3 89/11/17 15:43:15 lwall Locked $
  *
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,11 @@
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       toke.c,v $
+ * Revision 3.0.1.3  89/11/17  15:43:15  lwall
+ * patch5: IBM PC/RT compiler can't deal with UNI() and LOP() macros
+ * patch5: } misadjusted expection of subsequent term or operator
+ * patch5: y/abcde// didn't work
+ * 
  * Revision 3.0.1.2  89/11/11  05:04:42  lwall
  * patch2: fixed a CLINE macro conflict
  * 
@@ -78,6 +83,52 @@ register char *s;
     return s;
 }
 
+#ifdef CRIPPLED_CC
+
+#undef UNI
+#undef LOP
+#define UNI(f) return uni(f,s)
+#define LOP(f) return lop(f,s)
+
+int
+uni(f,s)
+int f;
+char *s;
+{
+    yylval.ival = f;
+    expectterm = TRUE;
+    bufptr = s;
+    if (*s == '(')
+       return FUNC1;
+    s = skipspace(s);
+    if (*s == '(')
+       return FUNC1;
+    else
+       return UNIOP;
+}
+
+int
+lop(f,s)
+int f;
+char *s;
+{
+    if (*s != '(')
+       s = skipspace(s);
+    if (*s == '(') {
+       *s = META('(');
+       bufptr = oldbufptr;
+       return '(';
+    }
+    else {
+       yylval.ival=f;
+       expectterm = TRUE;
+       bufptr = s;
+       return LISTOP;
+    }
+}
+
+#endif /* CRIPPLED_CC */
+
 yylex()
 {
     register char *s = bufptr;
@@ -309,11 +360,7 @@ yylex()
        TERM(tmp);
     case '}':
        tmp = *s++;
-       for (d = s; *d == ' ' || *d == '\t'; d++) ;
-       if (*d == '\n' || *d == '#')
-           OPERATOR(tmp);              /* block end */
-       else
-           TERM(tmp);                  /* associative array end */
+       RETURN(tmp);
     case '&':
        s++;
        tmp = *s++;
@@ -1547,7 +1594,7 @@ register char *s;
     yylval.arg = arg;
     if (!*r) {
        Safefree(r);
-       r = t;
+       r = t; rlen = tlen;
     }
     for (i = 0, j = 0; i < tlen; i++,j++) {
        if (j >= rlen)
diff --git a/util.c b/util.c
index e267578..d49978e 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1,4 +1,4 @@
-/* $Header: util.c,v 3.0.1.1 89/11/11 05:06:13 lwall Locked $
+/* $Header: util.c,v 3.0.1.2 89/11/17 15:46:35 lwall Locked $
  *
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,10 @@
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       util.c,v $
+ * Revision 3.0.1.2  89/11/17  15:46:35  lwall
+ * patch5: BZERO separate from BCOPY now
+ * patch5: byteorder now is a hex value
+ * 
  * Revision 3.0.1.1  89/11/11  05:06:13  lwall
  * patch2: made dup2 a little better
  * 
@@ -911,8 +915,8 @@ char *f;
 }
 #endif
 
-#ifndef BCOPY
 #ifndef MEMCPY
+#ifndef BCOPY
 char *
 bcopy(from,to,len)
 register char *from;
@@ -925,7 +929,9 @@ register int len;
        *to++ = *from++;
     return retval;
 }
+#endif
 
+#ifndef BZERO
 char *
 bzero(loc,len)
 register char *loc;
@@ -979,7 +985,7 @@ char *pat, *args;
 #endif /* VARARGS */
 
 #ifdef MYSWAP
-#if BYTEORDER != 04321
+#if BYTEORDER != 0x4321
 short
 my_swap(s)
 short s;
@@ -1000,24 +1006,24 @@ register long l;
 {
     union {
        long result;
-       char c[4];
+       char c[sizeof(long)];
     } u;
 
-#if BYTEORDER == 01234
+#if BYTEORDER == 0x1234
     u.c[0] = (l >> 24) & 255;
     u.c[1] = (l >> 16) & 255;
     u.c[2] = (l >> 8) & 255;
     u.c[3] = l & 255;
     return u.result;
 #else
-#if ((BYTEORDER - 01111) & 0444) || !(BYTEORDER & 7)
+#if ((BYTEORDER - 0x1111) & 0x444) || !(BYTEORDER & 0xf)
     fatal("Unknown BYTEORDER\n");
 #else
     register int o;
     register int s;
 
-    for (o = BYTEORDER - 01111, s = 0; s < 32; o >>= 3, s += 8) {
-       u.c[o & 7] = (l >> s) & 255;
+    for (o = BYTEORDER - 0x1111, s = 0; s < (sizeof(long)*8); o >>= 4, s += 8) {
+       u.c[o & 0xf] = (l >> s) & 255;
     }
     return u.result;
 #endif
@@ -1030,17 +1036,17 @@ register long l;
 {
     union {
        long l;
-       char c[4];
+       char c[sizeof(long)];
     } u;
 
-#if BYTEORDER == 01234
+#if BYTEORDER == 0x1234
     u.c[0] = (l >> 24) & 255;
     u.c[1] = (l >> 16) & 255;
     u.c[2] = (l >> 8) & 255;
     u.c[3] = l & 255;
     return u.l;
 #else
-#if ((BYTEORDER - 01111) & 0444) || !(BYTEORDER & 7)
+#if ((BYTEORDER - 0x1111) & 0x444) || !(BYTEORDER & 0xf)
     fatal("Unknown BYTEORDER\n");
 #else
     register int o;
@@ -1048,15 +1054,15 @@ register long l;
 
     u.l = l;
     l = 0;
-    for (o = BYTEORDER - 01111, s = 0; s < 32; o >>= 3, s += 8) {
-       l |= (u.c[o & 7] & 255) << s;
+    for (o = BYTEORDER - 0x1111, s = 0; s < (sizeof(long)*8); o >>= 4, s += 8) {
+       l |= (u.c[o & 0xf] & 255) << s;
     }
     return l;
 #endif
 #endif
 }
 
-#endif /* BYTEORDER != 04321 */
+#endif /* BYTEORDER != 0x4321 */
 #endif /* HTONS */
 
 FILE *
diff --git a/util.h b/util.h
index 85862eb..7a14bcb 100644 (file)
--- a/util.h
+++ b/util.h
@@ -1,4 +1,4 @@
-/* $Header: util.h,v 3.0.1.1 89/10/26 23:28:25 lwall Locked $
+/* $Header: util.h,v 3.0.1.2 89/11/17 15:48:01 lwall Locked $
  *
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,9 @@
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       util.h,v $
+ * Revision 3.0.1.2  89/11/17  15:48:01  lwall
+ * patch5: BZERO separate from BCOPY now
+ * 
  * Revision 3.0.1.1  89/10/26  23:28:25  lwall
  * patch1: declared bcopy if necessary
  * 
@@ -33,8 +36,11 @@ char *rninstr();
 char   *nsavestr();
 FILE   *mypopen();
 int    mypclose();
-#ifndef BCOPY
 #ifndef MEMCPY
+#ifndef BCOPY
 char   *bcopy();
 #endif
+#ifndef BZERO
+char   *bzero();
+#endif
 #endif
index e428d41..fc85209 100644 (file)
@@ -28,9 +28,13 @@ $spitshell >s2p <<!GROK!THIS!
 : In the following dollars and backticks do not need the extra backslash.
 $spitshell >>s2p <<'!NO!SUBS!'
 
-# $Header: s2p.SH,v 3.0.1.1 89/11/11 05:08:25 lwall Locked $
+# $Header: s2p.SH,v 3.0.1.2 89/11/17 15:51:27 lwall Locked $
 #
 # $Log:        s2p.SH,v $
+# Revision 3.0.1.2  89/11/17  15:51:27  lwall
+# patch5: in s2p, line labels without a subsequent statement were done wrong
+# patch5: s2p left residue in /tmp
+# 
 # Revision 3.0.1.1  89/11/11  05:08:25  lwall
 # patch2: in s2p, + within patterns needed backslashing
 # patch2: s2p was printing out some debugging info to the output file
@@ -109,7 +113,11 @@ line: while (<>) {
            $toplabel = $label;
        }
        $_ = "$label:";
-       if ($lastlinewaslabel++) {$_ .= "\t;";}
+       if ($lastlinewaslabel++) {
+           $indent += 4;
+           print body "\t" x ($indent / 8), ' ' x ($indent % 8), ";\n";
+           $indent -= 4;
+       }
        if ($indent >= 2) {
            $indent -= 2;
            $indmod = 2;
@@ -198,6 +206,11 @@ line: while (<>) {
        redo line;
     }
 }
+if ($lastlinewaslabel++) {
+    $indent += 4;
+    print body "\t" x ($indent / 8), ' ' x ($indent % 8), ";\n";
+    $indent -= 4;
+}
 
 print body "}\n";
 if ($appendseen || $tseen || !$assumen) {
@@ -259,10 +272,10 @@ eval \"exec $bin/perl -S \$0 \$*\"
     }
 }
 
-unlink "/tmp/sperl$$", "/tmp/sperl2$$";
+unlink "/tmp/sperl$$", "/tmp/sperl2$$", "/tmp/sperl2$$.c";
 
 sub Die {
-    unlink "/tmp/sperl$$", "/tmp/sperl2$$";
+    unlink "/tmp/sperl$$", "/tmp/sperl2$$", "/tmp/sperl2$$.c";
     die $_[0];
 }
 sub make_filehandle {
index d0ea341..62b64a4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: walk.c,v 3.0.1.1 89/11/11 05:09:33 lwall Locked $
+/* $Header: walk.c,v 3.0.1.2 89/11/17 15:53:00 lwall Locked $
  *
  *    Copyright (c) 1989, Larry Wall
  *
@@ -6,6 +6,9 @@
  *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       walk.c,v $
+ * Revision 3.0.1.2  89/11/17  15:53:00  lwall
+ * patch5: on Pyramids, index(s, '}' + 128) doesn't find meta-}
+ * 
  * Revision 3.0.1.1  89/11/11  05:09:33  lwall
  * patch2: in a2p, awk script with no line actions still needs main loop
  * 
@@ -1419,10 +1422,12 @@ sub Pick {\n\
        if (!s)
            fatal("Illegal for loop: %s",d);
        *s++ = '\0';
-       t = index(s,'}' + 128);
-       if (!t)
-           t = index(s,']' + 128);
-       if (t)
+       for (t = s; i = *t; t++) {
+           i &= 127;
+           if (i == '}' || i == ']')
+               break;
+       }
+       if (*t)
            *t = '\0';
        str = str_new(0);
        str_set(str,d+1);