view perl.diff @ 2:9f567da916dd default tip

cancel rev 1
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 13 Jun 2019 20:51:20 +0900
parents 0240ed5457bb
children
line wrap: on
line source

commit c22d7b27db077eac80d305ddf16f844fa4ad1019
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Sun Dec 29 16:45:14 2013 +0100

    Regeneration of Configure with metaconfig
    
    I've used the latest version of dist with metaconfig 3.5-172:
    	http://sourceforge.net/projects/dist/
    
    Run metaconfig with the -M option.
    
    Changes:
     - Renamed obsolete symbols. Metaconfig still wrongly see obsolete symbols.
     - Two quotes was not closed in makedepend.SH
     - makedepend.SH doesn't take into account lines containing <command-line>,
       <built-int>,... generated by cpp.
     - Removed the header lines of MANIFEST to not confuse the new Configure

diff --git a/Configure b/Configure
index 64215f7..fe74757 100755
--- a/Configure
+++ b/Configure

[snipped]

diff --git a/MANIFEST b/MANIFEST
index 085b831..571af4e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,7 +1,3 @@
-After all the perl kits are run you should have the following files:
-
-Filename		Kit Description
---------		--- -----------
 Configure                6  Run this first
 EXTERN.h                10  Included before foreign .h files
 INTERN.h                10  Included before domestic .h files
@@ -110,3 +106,5 @@ x2p/str.h               10  Public declarations for the above
 x2p/util.c               9  Utility routines
 x2p/util.h              10  Public declarations for the above
 x2p/walk.c               1  Parse tree walker
+config_h.SH                  Produces config.h
+confmagic.h                  Magic symbol remapping
diff --git a/arg.c b/arg.c
index 66e73ac..b7c4eb2 100644
--- a/arg.c
+++ b/arg.c
@@ -498,7 +498,7 @@ register STAB *stab;
 		filegid = statbuf.st_gid;
 		if (*inplace) {
 		    str_cat(str,inplace);
-#ifdef RENAME
+#ifdef HAS_RENAME
 		    rename(oldname,str->str_ptr);
 #else
 		    UNLINK(str->str_ptr);
@@ -571,7 +571,7 @@ STAB *stab;
 
     while (stio->fp) {
 
-#ifdef STDSTDIO			/* (the code works without this) */
+#ifdef USE_STDIO_PTR			/* (the code works without this) */
 	if (stio->fp->_cnt)		/* cheat a little, since */
 	    return FALSE;		/* this is the most usual case */
 #endif
@@ -664,7 +664,7 @@ STR ***retary;
 	    apush(ary,str_nmake((double)statbuf.st_atime));
 	    apush(ary,str_nmake((double)statbuf.st_mtime));
 	    apush(ary,str_nmake((double)statbuf.st_ctime));
-#ifdef STATBLOCKS
+#ifdef HAS_STAT_BLOCKS
 	    apush(ary,str_nmake((double)statbuf.st_blksize));
 	    apush(ary,str_nmake((double)statbuf.st_blocks));
 #else
@@ -1036,7 +1036,7 @@ STR **sarg;
 	    if (val < 0) {
 		val = -val;
 		for (elem = tmpary+2; *elem; elem++)
-#ifdef KILLPG
+#ifdef HAS_KILLPG
 		    if (killpg((int)(str_gnum(*elem)),val))	/* BSD */
 #else
 		    if (kill(-(int)(str_gnum(*elem)),val))	/* SYSV */
@@ -1910,7 +1910,7 @@ STR ***retary;		/* where to return an array to, null if nowhere */
 	str = apop(arg[1].arg_ptr.arg_stab->stab_array);
 	if (!str)
 	    return &str_no;
-#ifdef STRUCTCOPY
+#ifdef USE_STRUCT_COPY
 	*(arg->arg_ptr.arg_str) = *str;
 #else
 	bcopy((char*)str, (char*)arg->arg_ptr.arg_str, sizeof *str);
@@ -1922,7 +1922,7 @@ STR ***retary;		/* where to return an array to, null if nowhere */
 	str = ashift(arg[1].arg_ptr.arg_stab->stab_array);
 	if (!str)
 	    return &str_no;
-#ifdef STRUCTCOPY
+#ifdef USE_STRUCT_COPY
 	*(arg->arg_ptr.arg_str) = *str;
 #else
 	bcopy((char*)str, (char*)arg->arg_ptr.arg_str, sizeof *str);
@@ -2107,7 +2107,7 @@ STR ***retary;		/* where to return an array to, null if nowhere */
 	retary = Null(STR***);		/* do_stat already did retary */
 	goto donumset;
     case O_CRYPT:
-#ifdef CRYPT
+#ifdef HAS_CRYPT
 	tmps = str_get(sarg[1]);
 	str_set(str,crypt(tmps,str_get(sarg[2])));
 #else
@@ -2257,7 +2257,7 @@ STR ***retary;		/* where to return an array to, null if nowhere */
 	goto donumset;
     case O_RENAME:
 	tmps = str_get(sarg[1]);
-#ifdef RENAME
+#ifdef HAS_RENAME
 	value = (double)(rename(tmps,str_get(sarg[2])) >= 0);
 #else
 	tmps2 = str_get(sarg[2]);
@@ -2326,11 +2326,11 @@ STR ***retary;		/* where to return an array to, null if nowhere */
 	    if (statbuf.st_gid == (maxarg ? getegid() : getgid()))
 		str = &str_yes;	/* ok as "group" */
 	    else {
-#ifdef GETGROUPS
+#ifdef HAS_GETGROUPS
 #ifndef NGROUPS
 #define NGROUPS 32
 #endif
-		GIDTYPE gary[NGROUPS];
+		Gid_t gary[NGROUPS];
 
 		str = &str_no;
 		anum = getgroups(NGROUPS,gary);
@@ -2386,7 +2386,7 @@ STR ***retary;		/* where to return an array to, null if nowhere */
 	    str = &str_no;
 	break;
     case O_FTLINK:
-#ifdef SYMLINK
+#ifdef HAS_SYMLINK
 	if (lstat(str_get(sarg[1]),&statbuf) >= 0 &&
 	  (statbuf.st_mode & S_IFMT) == S_IFLNK )
 	    str = &str_yes;
@@ -2394,7 +2394,7 @@ STR ***retary;		/* where to return an array to, null if nowhere */
 #endif
 	    str = &str_no;
 	break;
-#ifdef SYMLINK
+#ifdef HAS_SYMLINK
     case O_SYMLINK:
 	tmps = str_get(sarg[1]);
 	value = (double)(symlink(tmps,str_get(sarg[2])) >= 0);
diff --git a/makedepend.SH b/makedepend.SH
index 8c7951c..c09171c 100644
--- a/makedepend.SH
+++ b/makedepend.SH
@@ -97,6 +97,11 @@ for file in `$cat .clist`; do
 	-e '}'
     $cpp -I/usr/local/include -I. $file.c | \
     $sed \
+    -e '/^#.*<stdin>/d' \
+    -e '/^#.*<builtin>/d' \
+    -e '/^#.*<built-in>/d' \
+    -e '/^#.*<command line>/d' \
+    -e '/^#.*<command-line>/d' \
 	-e '/^# *[0-9]/!d' \
 	-e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
 	-e 's|: \./|: |' \
@@ -110,7 +115,7 @@ make shlist || ($echo "Searching for .SH files..."; \
 	$echo *.SH */*.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
 if $test -s .deptmp; then
     for file in `cat .shlist`; do
-	$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
+	$echo `$expr X$file : 'X\(.*\).SH'`: $file config.sh \; \
 	    /bin/sh $file >> .deptmp
     done
     $echo "Updating Makefile..."
@@ -141,7 +146,7 @@ else
     <.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
        >> Makefile.new
     for file in `$cat .shlist`; do
-	$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
+	$echo `$expr X$file : 'X\(.*\).SH'`: $file config.sh \; \
 	    /bin/sh $file >> Makefile.new
     done
 fi
diff --git a/perl.h b/perl.h
index 10d377c..b1e4f07 100644
--- a/perl.h
+++ b/perl.h
@@ -36,7 +36,7 @@
 #define VOIDUSED 1
 #include "config.h"
 
-#ifndef BCOPY
+#ifndef HAS_BCOPY
 #   define bcopy(s1,s2,l) memcpy(s2,s1,l);
 #   define bzero(s,l) memset(s,0,l);
 #endif
@@ -47,7 +47,7 @@
 #include <sys/param.h>
 #include <sys/stat.h>
 
-#ifdef TMINSYS
+#ifdef TM_IN_SYS
 #include <sys/time.h>
 #else
 #include <time.h>
@@ -202,10 +202,10 @@ EXT struct stat statbuf;
 EXT struct tms timesbuf;
 EXT int uid;
 EXT int euid;
-UIDTYPE getuid();
-UIDTYPE geteuid();
-GIDTYPE getgid();
-GIDTYPE getegid();
+Uid_t getuid();
+Uid_t geteuid();
+Gid_t getgid();
+Gid_t getegid();
 EXT int unsafe;
 
 #ifdef DEBUGGING
@@ -238,7 +238,7 @@ double atof();
 long time();
 struct tm *gmtime(), *localtime();
 
-#ifdef EUNICE
+#ifdef EUNICE_SYSTEM
 #define UNLINK unlnk
 int unlnk();
 #else
diff --git a/perly.c b/perly.c
index 9ec6705..54a756d 100644
--- a/perly.c
+++ b/perly.c
@@ -808,7 +808,7 @@ yylex()
 	    OPERATOR(PRINT);
 	}
 	if (strEQ(d,"symlink"))
-#ifdef SYMLINK
+#ifdef HAS_SYMLINK
 	    FUN2(O_SYMLINK);
 #else
 	    fatal("symlink() not supported on this machine");
@@ -2203,7 +2203,7 @@ register ARG *arg;
 	    str_numset(str,(double)(strNE(tmps,str_get(s2))));
 	    break;
 	case O_CRYPT:
-#ifdef CRYPT
+#ifdef HAS_CRYPT
 	    tmps = str_get(s1);
 	    str_set(str,crypt(tmps,str_get(s2)));
 #else
diff --git a/stab.c b/stab.c
index 4790e3c..d37458d 100644
--- a/stab.c
+++ b/stab.c
@@ -179,12 +179,12 @@ STAB *stab;
 	sprintf(s,"%d",(int)getegid());
       add_groups:
 	while (*s) s++;
-#ifdef GETGROUPS
+#ifdef HAS_GETGROUPS
 #ifndef NGROUPS
 #define NGROUPS 32
 #endif
 	{
-	    GIDTYPE gary[NGROUPS];
+	    Gid_t gary[NGROUPS];
 
 	    i = getgroups(NGROUPS,gary);
 	    while (i >= 0) {
diff --git a/str.c b/str.c
index f1902b6..dc7c27d 100644
--- a/str.c
+++ b/str.c
@@ -342,7 +342,7 @@ str_gets(str,fp)
 register STR *str;
 register FILE *fp;
 {
-#ifdef STDSTDIO		/* Here is some breathtakingly efficient cheating */
+#ifdef USE_STDIO_PTR		/* Here is some breathtakingly efficient cheating */
 
     register char *bp;		/* we're going to steal some values */
     register int cnt;		/*  from the stdio struct and put EVERYTHING */
@@ -406,7 +406,7 @@ thats_really_all_folks:
     *bp = '\0';
     str->str_cur = bp - str->str_ptr;	/* set length */
 
-#else /* !STDSTDIO */	/* The big, slow, and stupid way */
+#else /* !USE_STDIO_PTR */	/* The big, slow, and stupid way */
 
     static char buf[4192];
 
@@ -415,7 +415,7 @@ thats_really_all_folks:
     else
 	str_set(str, No);
 
-#endif /* STDSTDIO */
+#endif /* USE_STDIO_PTR */
 
     return str->str_cur ? str->str_ptr : Nullch;
 }
diff --git a/util.c b/util.c
index 4577a2a..06f131d 100644
--- a/util.c
+++ b/util.c
@@ -310,7 +310,7 @@ char *nam;
     return i;
 }
 
-#ifdef EUNICE
+#ifdef EUNICE_SYSTEM
 unlnk(f)	/* unlink all versions of a file */
 char *f;
 {
diff --git a/x2p/str.c b/x2p/str.c
index 6d53f4f..b7e2bd2 100644
--- a/x2p/str.c
+++ b/x2p/str.c
@@ -280,7 +280,7 @@ str_gets(str,fp)
 register STR *str;
 register FILE *fp;
 {
-#ifdef STDSTDIO		/* Here is some breathtakingly efficient cheating */
+#ifdef USE_STDIO_PTR		/* Here is some breathtakingly efficient cheating */
 
     register char *bp;		/* we're going to steal some values */
     register int cnt;		/*  from the stdio struct and put EVERYTHING */
@@ -327,7 +327,7 @@ thats_all_folks:
     *bp = '\0';
     str->str_cur = bp - str->str_ptr;	/* set length */
 
-#else /* !STDSTDIO */	/* The big, slow, and stupid way */
+#else /* !USE_STDIO_PTR */	/* The big, slow, and stupid way */
 
     static char buf[4192];
 
@@ -336,7 +336,7 @@ thats_all_folks:
     else
 	str_set(str, No);
 
-#endif /* STDSTDIO */
+#endif /* USE_STDIO_PTR */
 
     return str->str_cur ? str->str_ptr : Nullch;
 }

commit d36e347825ef111c80a5d359daaba811c4a17c30
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Sun Dec 29 17:12:50 2013 +0100

    Remove redeclarations of standard functions/variables
    
    and include errno.h

diff --git a/arg.c b/arg.c
index b7c4eb2..6cb602c 100644
--- a/arg.c
+++ b/arg.c
@@ -84,7 +84,6 @@
 #include <signal.h>
 
 ARG *debarg;
-long time();
 
 bool
 do_match(s,arg)
@@ -476,8 +475,6 @@ register char *name;
     return TRUE;
 }
 
-extern int errno;
-
 FILE *
 nextargv(stab)
 register STAB *stab;
@@ -1386,8 +1383,6 @@ STR ***retary;		/* where to return an array to, null if nowhere */
     STAB *stab;
     ARRAY *ary;
     bool assigning = FALSE;
-    double exp(), log(), sqrt(), modf();
-    char *crypt(), *getenv();
 
     if (!arg)
 	return &str_no;
diff --git a/perl.h b/perl.h
index b1e4f07..64baaf3 100644
--- a/perl.h
+++ b/perl.h
@@ -43,6 +43,7 @@
 
 #include <stdio.h>
 #include <ctype.h>
+#include <errno.h>
 #include <setjmp.h>
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -78,12 +79,6 @@ typedef struct compex COMPEX;
 #include "array.h"
 #include "hash.h"
 
-#ifdef CHARSPRINTF
-    char *sprintf();
-#else
-    int sprintf();
-#endif
-
 /* A string is TRUE if not "" or "0". */
 #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
 EXT char *Yes INIT("1");
@@ -202,10 +197,6 @@ EXT struct stat statbuf;
 EXT struct tms timesbuf;
 EXT int uid;
 EXT int euid;
-Uid_t getuid();
-Uid_t geteuid();
-Gid_t getgid();
-Gid_t getegid();
 EXT int unsafe;
 
 #ifdef DEBUGGING
@@ -234,10 +225,6 @@ EXT jmp_buf eval_env;
 
 EXT char *goto_targ INIT(Nullch);	/* cmd_exec gets strange when set */
 
-double atof();
-long time();
-struct tm *gmtime(), *localtime();
-
 #ifdef EUNICE_SYSTEM
 #define UNLINK unlnk
 int unlnk();
diff --git a/perly.c b/perly.c
index 54a756d..23e77e2 100644
--- a/perly.c
+++ b/perly.c
@@ -74,7 +74,6 @@ register char **env;
 {
     register STR *str;
     register char *s;
-    char *index(), *strcpy();
 
     uid = (int)getuid();
     euid = (int)geteuid();
@@ -2028,8 +2027,6 @@ register ARG *arg;
     register char *tmps;
     int i;
     long tmplong;
-    double exp(), log(), sqrt(), modf();
-    char *crypt();
 
     if (!arg || !arg->arg_len)
 	return;
diff --git a/stab.c b/stab.c
index d37458d..d739eba 100644
--- a/stab.c
+++ b/stab.c
@@ -78,10 +78,6 @@ static char *sig_name[] = {
     ,0
     };
 
-extern int errno;
-extern int sys_nerr;
-extern char *sys_errlist[];
-
 STR *
 stab_str(stab)
 STAB *stab;
diff --git a/str.c b/str.c
index dc7c27d..ed25ea2 100644
--- a/str.c
+++ b/str.c
@@ -75,8 +75,6 @@ double num;
     str->str_nok = 1;		/* validate number */
 }
 
-extern int errno;
-
 char *
 str_2ptr(str)
 register STR *str;
diff --git a/util.c b/util.c
index 06f131d..651fb6a 100644
--- a/util.c
+++ b/util.c
@@ -43,7 +43,6 @@ safemalloc(size)
 MEM_SIZE size;
 {
     char *ptr;
-    char *malloc();
 
     ptr = malloc(size?size:1);	/* malloc(0) is NASTY on our system */
 #ifdef DEBUGGING
@@ -67,7 +66,6 @@ char *where;
 MEM_SIZE size;
 {
     char *ptr;
-    char *realloc();
 
     if (!where)
 	fatal("Null realloc");
@@ -220,8 +218,6 @@ int newlen;
     }
 }
 
-extern int errno;
-
 /*VARARGS1*/
 fatal(pat,a1,a2,a3,a4)
 char *pat;

commit be5bd2a49cfb0479c264539cae073006498acede
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Sun Dec 29 17:16:10 2013 +0100

    Include some missing standard headers

diff --git a/perl.h b/perl.h
index 64baaf3..3061843 100644
--- a/perl.h
+++ b/perl.h
@@ -44,10 +44,17 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <errno.h>
+#include <math.h>
 #include <setjmp.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 
+#ifdef HAS_BCOPY
+#include <strings.h>
+#endif
+
 #ifdef TM_IN_SYS
 #include <sys/time.h>
 #else
@@ -56,6 +63,10 @@
 
 #include <sys/times.h>
 
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+
 typedef struct arg ARG;
 typedef struct cmd CMD;
 typedef struct formcmd FCMD;

commit b8cd70615a262c20aa1da5b64286f4d8e48af242
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Sun Dec 29 17:18:14 2013 +0100

    Rename setenv in xsetenv

diff --git a/stab.c b/stab.c
index d739eba..faa2cd0 100644
--- a/stab.c
+++ b/stab.c
@@ -293,7 +293,7 @@ STR *str;
 	}
     }
     else if (stab == envstab && envname) {
-	setenv(envname,str_get(str));
+	xsetenv(envname,str_get(str));
 				/* And you'll never guess what the dog had */
 	safefree(envname);	/*   in its mouth... */
 	envname = Nullch;
diff --git a/util.c b/util.c
index 651fb6a..2bd8d7a 100644
--- a/util.c
+++ b/util.c
@@ -259,7 +259,7 @@ static bool firstsetenv = TRUE;
 extern char **environ;
 
 void
-setenv(nam,val)
+xsetenv(nam,val)
 char *nam, *val;
 {
     register int i=envix(nam);		/* where does it go? */
diff --git a/util.h b/util.h
index 4f92eeb..3a7e003 100644
--- a/util.h
+++ b/util.h
@@ -28,7 +28,7 @@ void	prexit();
 char	*get_a_line();
 char	*savestr();
 int	makedir();
-void	setenv();
+void	xsetenv();
 int	envix();
 void	notincl();
 char	*getval();

commit 675c82ddd9690f03b0e7f86b6f7ccb83ecad41d4
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Sun Dec 29 18:13:43 2013 +0100

    Set real uid and gid in a more portable way
    
    Call setreuid or setregid if setruid or setrgid (resp.) are not available
    and die if no suitable function are available.
    
    From the source code of Perl 5

diff --git a/stab.c b/stab.c
index faa2cd0..346c917 100644
--- a/stab.c
+++ b/stab.c
@@ -261,18 +261,41 @@ STR *str;
 	    errno = (int)str_gnum(str);		/* will anyone ever use this? */
 	    break;
 	case '<':
+	{
+	    int r;
 	    uid = (int)str_gnum(str);
-	    if (setruid(uid) < 0)
+#ifdef HAS_SETRUID
+            r = setruid(uid);
+#else
+#ifdef HAS_SETREUID
+            r = setreuid(uid, (Uid_t)-1);
+#else
+	    fatal("setruid() not implemented");
+#endif
+#endif
+	    if (r < 0)
 		uid = (int)getuid();
 	    break;
+	}
 	case '>':
 	    euid = (int)str_gnum(str);
 	    if (seteuid(euid) < 0)
 		euid = (int)geteuid();
 	    break;
 	case '(':
-	    setrgid((int)str_gnum(str));
+	{
+	   int a = (int)str_gnum(str);
+#ifdef HAS_SETRGID
+            setrgid(uid);
+#else
+#ifdef HAS_SETREGID
+            setregid(uid, (Uid_t)-1);
+#else
+            fatal("setrgid() not implemented");
+#endif
+#endif
 	    break;
+	} 
 	case ')':
 	    setegid((int)str_gnum(str));
 	    break;

commit 0c719a8f72c3967fedc0d1b3a344d0a5686a051c
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Sun Dec 29 21:23:29 2013 +0100

    Fix problem with strcpy args overlapping in scanconst
    
    Pointers passed to strcpy cannot be part of the same string.
    Replaced by memmove which allows memory overlapping.
    
    This was causing case 11 of t/op.pat to fail in some architectures.

diff --git a/perly.c b/perly.c
index 23e77e2..82701d6 100644
--- a/perly.c
+++ b/perly.c
@@ -986,7 +986,7 @@ char *string;
 		*d = '\0';
 		break;
 	    }
-	    strcpy(d,d+1);
+	    memmove(d,d+1,strlen(d+1)+1);
 	    switch(*d) {
 	    case 'n':
 		*d = '\n';

commit ef4afd7f7cc44696aebcd04b114cd6e207e4c025
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 09:33:14 2013 +0100

    The declaration of fatal was incomplete in util.c
    
    The four last arguments was declared implicitly as int instead of
    char*.
    
    This caused a crash wheneved fatal was called on some architectures.

diff --git a/util.c b/util.c
index 2bd8d7a..1494d1f 100644
--- a/util.c
+++ b/util.c
@@ -220,7 +220,7 @@ int newlen;
 
 /*VARARGS1*/
 fatal(pat,a1,a2,a3,a4)
-char *pat;
+char *pat,*a1,*a2,*a3,*a4;
 {
     extern FILE *e_fp;
     extern char *e_tmpname;

commit 387b17436fa8d4cb471ad120790766d3860ad161
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 09:34:44 2013 +0100

    Use rm -rf and not rm -f in io.fs to delete the tmp directory

diff --git a/t/io.fs b/t/io.fs
index 50e272e..b7495f6 100644
--- a/t/io.fs
+++ b/t/io.fs
@@ -7,7 +7,7 @@ print "1..20\n";
 $wd = `pwd`;
 chop($wd);
 
-`rm -f tmp; mkdir tmp 2>/dev/null`;
+`rm -rf tmp; mkdir tmp 2>/dev/null`;
 chdir './tmp';
 `/bin/rm -rf a b c x`;
 

commit 596555b9b737bb853e2438ad7a53a356bd44ca56
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 11:37:50 2013 +0100

    Define wanted libraries for metaconfig
    
    Namely nm, m and crypt. This is done in U/Myinit.U
    Configure will add libraries on this list that are installed on the system
    to $libs used by Makefile.SH
    
    Also, remove the reference to deprecated $libnm in Makefile.SH
    
    Note: There is still a reference to $libnm in x2p/Makefile.SH

diff --git a/Makefile.SH b/Makefile.SH
index a6bc00c..1d9d8bd 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -69,7 +69,7 @@ mallocsrc = $mallocsrc
 mallocobj = $mallocobj
 SLN = $sln
 
-libs = $libnm -lm
+libs = $libs
 !GROK!THIS!
 
 cat >>Makefile <<'!NO!SUBS!'
diff --git a/U/Myinit.U b/U/Myinit.U
new file mode 100644
index 0000000..0d18ad9
--- /dev/null
+++ b/U/Myinit.U
@@ -0,0 +1,27 @@
+?RCS: $Id: Myinit.U 1 2006-08-24 12:32:52Z rmanfredi $
+?RCS:
+?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
+?RCS: 
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?RCS: $Log: Myinit.U,v $
+?RCS: Revision 3.0.1.1  1994/10/31  09:47:29  ram
+?RCS: patch44: leading comment states this unit comes before option processing
+?RCS:
+?RCS: Revision 3.0  1993/08/18  12:05:07  ram
+?RCS: Baseline for dist 3.0 netwide release.
+?RCS:
+?X: 
+?X: If you want to initialize any default values, copy this unit to your
+?X: personal U directory and add the assignments to the end.  This file
+?X: is included after variables are initialized but before any old
+?X: config.sh file is read in and before any Configure switch processing.
+?X:
+?MAKE:Myinit: Init 
+?MAKE:	-pick add $@ %<
+?LINT: nocomment
+libswanted='nm m crypt'

commit 2fce1746da9cee013723b01dd5226861082bd592
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 13:09:33 2013 +0100

    Use LOC_SED to specify the path of sed to perl
    
    This was causing t/comp.cpp to fail.

diff --git a/perly.c b/perly.c
index 82701d6..7b0411a 100644
--- a/perly.c
+++ b/perly.c
@@ -168,8 +168,8 @@ register char **env;
     if (strEQ(filename,"-"))
 	argv[0] = "";
     if (preprocess) {
-	sprintf(buf, "\
-/bin/sed -e '/^[^#]/b' \
+	sprintf(buf, \
+LOC_SED " -e '/^[^#]/b' \
  -e '/^#[ 	]*include[ 	]/b' \
  -e '/^#[ 	]*define[ 	]/b' \
  -e '/^#[ 	]*if[ 	]/b' \

commit 5fb619870bd0f8d254459b57c6030bb47d2f1d1f
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 14:26:48 2013 +0100

    Double the number of tries for case 2 in t/op.time
    
    It was not enough on some systems.

diff --git a/t/op.time b/t/op.time
old mode 100644
new mode 100755
index 87ef260..7b4b529
--- a/t/op.time
+++ b/t/op.time
@@ -12,7 +12,7 @@ while (($now = time) == $beg) {}
 
 if ($now > $beg && $now - $beg < 10){print "ok 1\n";} else {print "not ok 1\n";}
 
-for ($i = 0; $i < 100000; $i++) {
+for ($i = 0; $i < 199998; $i++) {
     ($nowuser, $nowsys) = times;
     $i = 200000 if $nowuser > $beguser && $nowsys > $begsys;
     last if time - $beg > 20;

commit c63024577814284b2419708e841114183efcf625
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 17:06:28 2013 +0100

    Remove empty %type declaration in perl.y
    
    Byacc was forgiving about that but not Bison.

diff --git a/perl.y b/perl.y
index fc6bf89..282c995 100644
--- a/perl.y
+++ b/perl.y
@@ -77,7 +77,6 @@ char *tokename[] = {
 %token <arg> RSTRING TRANS
 
 %type <ival> prog decl format
-%type <stabval>
 %type <cmdval> block lineseq line loop cond sideff nexpr else
 %type <arg> expr sexpr term
 %type <arg> condmod loopmod cexpr

commit 241cbb688ab3ad1e1076baad2c8719bd0e5761ea
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Tue Dec 31 15:21:44 2013 +0100

    YYDEBUG was tested with #ifdef instead of #if
    
    YYDEBUG may exists and be defined to 0 to disable Yacc debugging.

diff --git a/perly.c b/perly.c
index 7b0411a..c2d2ea4 100644
--- a/perly.c
+++ b/perly.c
@@ -87,7 +87,7 @@ register char **env;
 #ifdef DEBUGGING
 	case 'D':
 	    debug = atoi(argv[0]+2);
-#ifdef YYDEBUG
+#if YYDEBUG
 	    yydebug = (debug & 1);
 #endif
 	    break;
@@ -316,7 +316,7 @@ yylex()
     static bool firstline = TRUE;
 
   retry:
-#ifdef YYDEBUG
+#if YYDEBUG
     if (yydebug)
 	if (index(s,'\n'))
 	    fprintf(stderr,"Tokener at %s",s);

commit 13475190a06e733cbcfd2695d28337f6c90029de
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 17:45:45 2013 +0100

    Add some missing declarations in perl.h
    
    of functions defined in perly.c and used in perl.y

diff --git a/perl.h b/perl.h
index 3061843..1f277b2 100644
--- a/perl.h
+++ b/perl.h
@@ -107,6 +107,8 @@ EXT STR *Str;
 
 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
 
+EXT unsigned int cmdline;
+
 CMD *add_label();
 CMD *block_head();
 CMD *append_line();
@@ -121,6 +123,14 @@ SPAT *stab2spat();
 
 STAB *stabent();
 
+ARG *l();
+ARG *mod_match();
+ARG *addflags();
+ARG *hide_ary();
+ARG *make_list();
+ARG *listish();
+ARG *cval_to_arg();
+ARG *cmd_to_arg();
 ARG *stab2arg();
 ARG *op_new();
 ARG *make_op();

commit 95dc5be0e2bbe7701b633da1e247f4c67ae38ef2
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Mon Dec 30 17:52:42 2013 +0100

    Extends the support of crypt()
    
    crypt() may be declared in unistd.h but on some systems it is in
    crypt.h.
    
     - included a new metaconfig unit: i_crypt that checks if crypt.h is
       available (taken from another version of metaconfig).
     - modified d_crypt unit so it includes crypt.h when available.

diff --git a/U/d_crypt.U b/U/d_crypt.U
new file mode 100644
index 0000000..2a24b35
--- /dev/null
+++ b/U/d_crypt.U
@@ -0,0 +1,86 @@
+?RCS: $Id: d_crypt.U 167 2013-05-08 17:58:00Z rmanfredi $
+?RCS:
+?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
+?RCS: 
+?RCS: You may redistribute only under the terms of the Artistic License,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic License; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS: 
+?RCS: $Log: d_crypt.U,v $
+?RCS: Revision 3.0.1.1  1997/02/28  15:31:47  ram
+?RCS: patch61: replaced .a with $_a all over the place
+?RCS:
+?RCS: Revision 3.0  1993/08/18  12:05:52  ram
+?RCS: Baseline for dist 3.0 netwide release.
+?RCS:
+?MAKE:d_crypt cryptlib: Loc test xlibpth libpth Setvar _a Trylink cat i_unistd i_crypt
+?MAKE:	-pick add $@ %<
+?S:d_crypt:
+?S:	This variable conditionally defines the CRYPT symbol, which
+?S:	indicates to the C program that the crypt() routine is available
+?S:	to encrypt passwords and the like.
+?S:.
+?S:cryptlib:
+?S:	This variable holds -lcrypt or the path to a libcrypt.a archive if
+?S:	the crypt() function is not defined in the standard C library. It is
+?S:	up to the Makefile to use this.
+?S:.
+?C:HAS_CRYPT (CRYPT):
+?C:	This symbol, if defined, indicates that the crypt routine is available
+?C:	to encrypt passwords and the like.
+?C:.
+?H:#$d_crypt HAS_CRYPT		/**/
+?H:.
+?LINT:set d_crypt
+?T:val
+: see if crypt exists
+$cat >try.c <<EOC
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#$i_crypt I_CRYPT
+#ifdef I_CRYPT
+#include <crypt.h>
+#endif
+int main(void)
+{
+	static char ret;
+	ret |= *crypt("key", "salt");
+	return ret ? 0 : 1;
+}
+EOC
+cyn=crypt
+set d_crypt -lcrypt
+eval $trylink
+
+case "$d_crypt" in
+$define) cryptlib='';;
+*)
+	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
+	if $test -z "$cryptlib"; then
+		echo 'crypt() NOT found.' >&4
+		val="$undef"
+	else
+		val="$define"
+	fi
+;;
+esac
+
diff --git a/U/i_crypt.U b/U/i_crypt.U
new file mode 100644
index 0000000..4e13b7a
--- /dev/null
+++ b/U/i_crypt.U
@@ -0,0 +1,24 @@
+?RCS: $Id: i_crypt.U,v $
+?RCS:
+?RCS: Copyright (c) 2002 Jarkko Hietaniemi
+?RCS:
+?RCS: You may distribute under the terms of either the GNU General Public
+?RCS: License or the Artistic License, as specified in the README file.
+?RCS:
+?MAKE:i_crypt: Inhdr
+?MAKE:	-pick add $@ %<
+?S:i_crypt:
+?S:	This variable conditionally defines the I_CRYPT symbol, and indicates
+?S:	whether a C program should include <crypt.h>.
+?S:.
+?C:I_CRYPT:
+?C:	This symbol, if defined, indicates that <crypt.h> exists and
+?C:	should be included.
+?C:.
+?H:#$i_crypt	I_CRYPT		/**/
+?H:.
+?LINT:set i_crypt
+: see if this is a crypt.h system
+set crypt.h i_crypt
+eval $inhdr
+
diff --git a/perl.h b/perl.h
index 1f277b2..acdcc07 100644
--- a/perl.h
+++ b/perl.h
@@ -42,6 +42,9 @@
 #endif
 
 #include <stdio.h>
+#ifdef I_CRYPT
+#include <crypt.h>
+#endif
 #include <ctype.h>
 #include <errno.h>
 #include <math.h>

commit 802441c1bd4d86bf044eeb3c669efd5ed7ca97cc
Author: Christophe Staïesse <chastai@skynet.be>
Date:   Tue Dec 31 14:40:34 2013 +0100

    Support for case-insensitive filesystems sometimes in use on Mac OS X.
    
    makedepend.SH creates a file named 'makefile' which overwrites Makefile
    on case-insensitive filesystems.
    
    This file has been renamed by defining the firstmakefile variable
    through a hint loaded by Configure (see metaconfig documentation).
    
    firstmakefile must be a file which is searched before Makefile by make.
    Here, we used GNUmakefile and thus we assume that GNU Make is used which is
    normally the case on Mac OS X.
    
    From the source code of Perl 5

diff --git a/hints/darwin.sh b/hints/darwin.sh
new file mode 100644
index 0000000..04eeb86
--- /dev/null
+++ b/hints/darwin.sh
@@ -0,0 +1,5 @@
+# Case-insensitive filesystems don't get along with Makefile and
+# makefile in the same place.  Since Darwin uses GNU make, this dodges
+# the problem.
+
+firstmakefile=GNUmakefile;