perl 4.0 patch 14: patch #11, continued
[p5sagit/p5-mst-13.2.git] / perl.h
diff --git a/perl.h b/perl.h
index ff95c26..4ab86d9 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1,52 +1,65 @@
-/* $Header: perl.h,v 3.0.1.5 90/02/28 17:52:28 lwall Locked $
+/* $RCSfile: perl.h,v $$Revision: 4.0.1.3 $$Date: 91/06/10 01:25:10 $
  *
- *    Copyright (c) 1989, Larry Wall
+ *    Copyright (c) 1991, Larry Wall
  *
- *    You may distribute under the terms of the GNU General Public License
- *    as specified in the README file that comes with the perl 3.0 kit.
+ *    You may distribute under the terms of either the GNU General Public
+ *    License or the Artistic License, as specified in the README file.
  *
  * $Log:       perl.h,v $
- * Revision 3.0.1.5  90/02/28  17:52:28  lwall
- * patch9: Configure now determines whether volatile is supported
- * patch9: volatilized some more variables for super-optimizing compilers
- * patch9: unused VREG symbol deleted
- * patch9: perl can now start up other interpreters scripts  
- * patch9: you may now undef $/ to have no input record separator
- * patch9: nested evals clobbered their longjmp environment
+ * Revision 4.0.1.3  91/06/10  01:25:10  lwall
+ * patch10: certain pattern optimizations were botched
  * 
- * Revision 3.0.1.4  89/12/21  20:07:35  lwall
- * patch7: arranged for certain registers to be restored after longjmp()
- * patch7: Configure now compiles a test program to figure out time.h fiasco
- * patch7: Configure now detects DG/UX thingies like [sg]etpgrp2 and utime.h
- * patch7: memcpy() and memset() return void in __STDC__
- * patch7: errno may now be a macro with an lvalue
- * patch7: ANSI strerror() is now supported
- * patch7: Xenix support for sys/ndir.h, cross compilation
+ * Revision 4.0.1.2  91/06/07  11:28:33  lwall
+ * patch4: new copyright notice
+ * patch4: made some allowances for "semi-standard" C
+ * patch4: many, many itty-bitty portability fixes
  * 
- * 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 4.0.1.1  91/04/11  17:49:51  lwall
+ * patch1: hopefully straightened out some of the Xenix mess
  * 
- * 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
- * patch2: more <sys/time.h> and <time.h> wrangling
- * patch2: yydebug moved to where type doesn't matter  
- * 
- * Revision 3.0.1.1  89/10/26  23:17:08  lwall
- * patch1: vfork now conditionally defined based on VFORK
- * patch1: DEC risc machines have a buggy memcmp
- * patch1: perl.h now includes <netinet/in.h> if it exists
- * 
- * Revision 3.0  89/10/18  15:21:21  lwall
- * 3.0 baseline
+ * Revision 4.0  91/03/20  01:37:56  lwall
+ * 4.0 baseline.
  * 
  */
 
-#define VOIDUSED 1
+#define VOIDWANT 1
 #include "config.h"
 
-#if defined(HASVOLATILE) || defined(__STDC__)
+#ifdef MSDOS
+/* This stuff now in the MS-DOS config.h file. */
+#else /* !MSDOS */
+
+/*
+ * The following symbols are defined if your operating system supports
+ * functions by that name.  All Unixes I know of support them, thus they
+ * are not checked by the configuration script, but are directly defined
+ * here.
+ */
+#define HAS_ALARM
+#define HAS_CHOWN
+#define HAS_CHROOT
+#define HAS_FORK
+#define HAS_GETLOGIN
+#define HAS_GETPPID
+#define HAS_KILL
+#define HAS_LINK
+#define HAS_PIPE
+#define HAS_WAIT
+#define HAS_UMASK
+/*
+ * The following symbols are defined if your operating system supports
+ * password and group functions in general.  All Unix systems do.
+ */
+#define HAS_GROUP
+#define HAS_PASSWD
+
+#endif /* !MSDOS */
+
+#if defined(__STDC__) || defined(_AIX) || defined(__stdc__)
+# define STANDARD_C 1
+#endif
+
+#if defined(HASVOLATILE) || defined(STANDARD_C)
 #define VOLATILE volatile
 #else
 #define VOLATILE
 #   endif
 #endif
 
-#ifndef VFORK
+#ifndef HAS_VFORK
 #   define vfork fork
 #endif
 
-#ifdef GETPGRP2
-#   ifndef GETPGRP
-#      define GETPGRP
+#ifdef HAS_GETPGRP2
+#   ifndef HAS_GETPGRP
+#      define HAS_GETPGRP
 #   endif
 #   define getpgrp getpgrp2
 #endif
 
-#ifdef SETPGRP2
-#   ifndef SETPGRP
-#      define SETPGRP
+#ifdef HAS_SETPGRP2
+#   ifndef HAS_SETPGRP
+#      define HAS_SETPGRP
 #   endif
 #   define setpgrp setpgrp2
 #endif
 
-#if defined(MEMCMP) && defined(mips) && BYTEORDER == 0x1234
-#undef MEMCMP
-#endif
-
-#ifdef MEMCPY
-#ifndef memcpy
-#ifdef __STDC__
-extern void *memcpy(), *memset();
-#else
-extern char *memcpy(), *memset();
-#endif
+#include <stdio.h>
+#include <ctype.h>
+#include <setjmp.h>
+#ifndef MSDOS
+#ifdef PARAM_NEEDS_TYPES
+#include <sys/types.h>
 #endif
-#define bcopy(s1,s2,l) memcpy(s2,s1,l)
-#define bzero(s,l) memset(s,0,l)
+#include <sys/param.h>
 #endif
-#ifndef BCMP           /* prefer bcmp slightly 'cuz it doesn't order */
-#define bcmp(s1,s2,l) memcmp(s1,s2,l)
+#ifdef STANDARD_C
+/* Use all the "standard" definitions */
+#include <stdlib.h>
+#include <string.h>
+#endif /* STANDARD_C */
+
+#if defined(HAS_MEMCMP) && defined(mips) && BYTEORDER == 0x1234
+#undef HAS_MEMCMP
 #endif
 
-#include <stdio.h>
-#include <ctype.h>
-#include <setjmp.h>
-#include <sys/param.h> /* if this needs types.h we're still wrong */
+#ifdef HAS_MEMCPY
+
+#  ifndef STANDARD_C
+#    ifndef memcpy
+extern char * memcpy(), *memset();
+extern int memcmp();
+#    endif /* ndef memcpy */
+#  endif /* ndef STANDARD_C */
+
+#   ifndef bcopy
+#      define bcopy(s1,s2,l) memcpy(s2,s1,l)
+#   endif
+#   ifndef bzero
+#      define bzero(s,l) memset(s,0,l)
+#   endif
+#endif /* HAS_MEMCPY */
+
+#ifndef HAS_BCMP               /* prefer bcmp slightly 'cuz it doesn't order */
+#   ifndef bcmp
+#      define bcmp(s1,s2,l) memcmp(s1,s2,l)
+#   endif
+#endif
 
 #ifndef _TYPES_                /* If types.h defines this it's easy. */
 #ifndef major          /* Does everyone's types.h define this? */
@@ -116,7 +147,7 @@ extern char *memcpy(), *memset();
 #   include <time.h>
 #endif
 
-#ifdef I_SYSTIME
+#ifdef I_SYS_TIME
 #   ifdef SYSTIMEKERNEL
 #      define KERNEL
 #   endif
@@ -126,24 +157,30 @@ extern char *memcpy(), *memset();
 #   endif
 #endif
 
+#ifndef MSDOS
 #include <sys/times.h>
+#endif
 
-#if defined(STRERROR) && (!defined(MKDIR) || !defined(RMDIR))
-#undef STRERROR
+#if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
+#undef HAS_STRERROR
 #endif
 
 #include <errno.h>
+#ifndef MSDOS
 #ifndef errno
 extern int errno;     /* ANSI allows errno to be an lvalue expr */
 #endif
+#endif
 
-#ifdef STRERROR
+#ifndef strerror
+#ifdef HAS_STRERROR
 char *strerror();
 #else
 extern int sys_nerr;
 extern char *sys_errlist[];
 #define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
 #endif
+#endif
 
 #ifdef I_SYSIOCTL
 #ifndef _IOCTL_
@@ -152,22 +189,34 @@ extern char *sys_errlist[];
 #endif
 
 #if defined(mc300) || defined(mc500) || defined(mc700) /* MASSCOMP */
-#ifdef SOCKETPAIR
-#undef SOCKETPAIR
+#ifdef HAS_SOCKETPAIR
+#undef HAS_SOCKETPAIR
 #endif
-#ifdef NDBM
-#undef NDBM
+#ifdef HAS_NDBM
+#undef HAS_NDBM
 #endif
 #endif
 
-#ifdef NDBM
+#ifdef HAS_GDBM
+#ifdef I_GDBM
+#include <gdbm.h>
+#endif
+#define SOME_DBM
+#ifdef HAS_NDBM
+#undef HAS_NDBM
+#endif
+#ifdef HAS_ODBM
+#undef HAS_ODBM
+#endif
+#else
+#ifdef HAS_NDBM
 #include <ndbm.h>
 #define SOME_DBM
-#ifdef ODBM
-#undef ODBM
+#ifdef HAS_ODBM
+#undef HAS_ODBM
 #endif
 #else
-#ifdef ODBM
+#ifdef HAS_ODBM
 #ifdef NULL
 #undef NULL            /* suppress redefinition message */
 #endif
@@ -182,8 +231,9 @@ extern char *sys_errlist[];
 #define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent)
 #define dbm_close(db) dbmclose()
 #define dbm_firstkey(db) firstkey()
-#endif /* ODBM */
-#endif /* NDBM */
+#endif /* HAS_ODBM */
+#endif /* HAS_NDBM */
+#endif /* HAS_GDBM */
 #ifdef SOME_DBM
 EXT char *dbmkey;
 EXT int dbmlen;
@@ -197,25 +247,138 @@ EXT int dbmlen;
 #define ntohi ntohl
 #endif
 
-#if defined(I_DIRENT) && !defined(xenix)
+#if defined(I_DIRENT)
 #   include <dirent.h>
 #   define DIRENT dirent
 #else
-#   ifdef I_SYSDIR
-#      ifdef hp9000s500
-#          include <ndir.h>    /* may be wrong in the future */
-#      else
-#          include <sys/dir.h>
-#      endif
+#   ifdef I_SYS_NDIR
+#      include <sys/ndir.h>
 #      define DIRENT direct
 #   else
-#      ifdef I_SYSNDIR
-#          include <sys/ndir.h>
+#      ifdef I_SYS_DIR
+#          ifdef hp9000s500
+#              include <ndir.h>        /* may be wrong in the future */
+#          else
+#              include <sys/dir.h>
+#          endif
 #          define DIRENT direct
 #      endif
 #   endif
 #endif
 
+#ifdef FPUTS_BOTCH
+/* work around botch in SunOS 4.0.1 and 4.0.2 */
+#   ifndef fputs
+#      define fputs(str,fp) fprintf(fp,"%s",str)
+#   endif
+#endif
+
+/*
+ * The following gobbledygook brought to you on behalf of __STDC__.
+ * (I could just use #ifndef __STDC__, but this is more bulletproof
+ * in the face of half-implementations.)
+ */
+
+#ifndef S_IFMT
+#   ifdef _S_IFMT
+#      define S_IFMT _S_IFMT
+#   else
+#      define S_IFMT 0170000
+#   endif
+#endif
+
+#ifndef S_ISDIR
+#   define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISCHR
+#   define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
+#endif
+
+#ifndef S_ISBLK
+#   ifdef S_IFBLK
+#      define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
+#   else
+#      define S_ISBLK(m) (0)
+#   endif
+#endif
+
+#ifndef S_ISREG
+#   define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
+#endif
+
+#ifndef S_ISFIFO
+#   ifdef S_IFIFO
+#      define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
+#   else
+#      define S_ISFIFO(m) (0)
+#   endif
+#endif
+
+#ifndef S_ISLNK
+#   ifdef _S_ISLNK
+#      define S_ISLNK(m) _S_ISLNK(m)
+#   else
+#      ifdef _S_IFLNK
+#          define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
+#      else
+#          ifdef S_IFLNK
+#              define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
+#          else
+#              define S_ISLNK(m) (0)
+#          endif
+#      endif
+#   endif
+#endif
+
+#ifndef S_ISSOCK
+#   ifdef _S_ISSOCK
+#      define S_ISSOCK(m) _S_ISSOCK(m)
+#   else
+#      ifdef _S_IFSOCK
+#          define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
+#      else
+#          ifdef S_IFSOCK
+#              define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
+#          else
+#              define S_ISSOCK(m) (0)
+#          endif
+#      endif
+#   endif
+#endif
+
+#ifndef S_IRUSR
+#   ifdef S_IREAD
+#      define S_IRUSR S_IREAD
+#      define S_IWUSR S_IWRITE
+#      define S_IXUSR S_IEXEC
+#   else
+#      define S_IRUSR 0400
+#      define S_IWUSR 0200
+#      define S_IXUSR 0100
+#   endif
+#   define S_IRGRP (S_IRUSR>>3)
+#   define S_IWGRP (S_IWUSR>>3)
+#   define S_IXGRP (S_IXUSR>>3)
+#   define S_IROTH (S_IRUSR>>6)
+#   define S_IWOTH (S_IWUSR>>6)
+#   define S_IXOTH (S_IXUSR>>6)
+#endif
+
+#ifndef S_ISUID
+#   define S_ISUID 04000
+#endif
+
+#ifndef S_ISGID
+#   define S_ISGID 02000
+#endif
+
+#ifdef f_next
+#undef f_next
+#endif
+
+typedef unsigned int STRLEN;
+
 typedef struct arg ARG;
 typedef struct cmd CMD;
 typedef struct formcmd FCMD;
@@ -228,6 +391,7 @@ typedef struct htbl HASH;
 typedef struct regexp REGEXP;
 typedef struct stabptrs STBP;
 typedef struct stab STAB;
+typedef struct callsave CSV;
 
 #include "handy.h"
 #include "regexp.h"
@@ -245,7 +409,7 @@ typedef struct stab STAB;
 #   define I286
 #endif
 
-#ifndef        __STDC__
+#ifndef        STANDARD_C
 #ifdef CHARSPRINTF
     char *sprintf();
 #else
@@ -309,30 +473,38 @@ EXT STR *Str;
 
 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
 
+#ifndef MSDOS
 #define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len)
+#define Str_Grow str_grow
+#else
+/* extra parentheses intentionally NOT placed around "len"! */
+#define STR_GROW(str,len) if ((str)->str_len < (unsigned long)len) \
+               str_grow(str,(unsigned long)len)
+#define Str_Grow(str,len) str_grow(str,(unsigned long)(len))
+#endif /* MSDOS */
 
 #ifndef BYTEORDER
 #define BYTEORDER 0x1234
 #endif
 
-#if defined(htonl) && !defined(HTONL)
-#define HTONL
+#if defined(htonl) && !defined(HAS_HTONL)
+#define HAS_HTONL
 #endif
-#if defined(htons) && !defined(HTONS)
-#define HTONS
+#if defined(htons) && !defined(HAS_HTONS)
+#define HAS_HTONS
 #endif
-#if defined(ntohl) && !defined(NTOHL)
-#define NTOHL
+#if defined(ntohl) && !defined(HAS_NTOHL)
+#define HAS_NTOHL
 #endif
-#if defined(ntohs) && !defined(NTOHS)
-#define NTOHS
+#if defined(ntohs) && !defined(HAS_NTOHS)
+#define HAS_NTOHS
 #endif
-#ifndef HTONL
-#if (BYTEORDER != 0x4321) && (BYTEORDER != 0x87654321)
-#define HTONS
-#define HTONL
-#define NTOHS
-#define NTOHL
+#ifndef HAS_HTONL
+#if (BYTEORDER & 0xffff) != 0x4321
+#define HAS_HTONS
+#define HAS_HTONL
+#define HAS_NTOHS
+#define HAS_NTOHL
 #define MYSWAP
 #define htons my_swap
 #define htonl my_htonl
@@ -340,14 +512,25 @@ EXT STR *Str;
 #define ntohl my_ntohl
 #endif
 #else
-#if (BYTEORDER == 0x4321) || (BYTEORDER == 0x87654321)
-#undef HTONS
-#undef HTONL
-#undef NTOHS
-#undef NTOHL
+#if (BYTEORDER & 0xffff) == 0x4321
+#undef HAS_HTONS
+#undef HAS_HTONL
+#undef HAS_NTOHS
+#undef HAS_NTOHL
 #endif
 #endif
 
+#ifdef CASTNEGFLOAT
+#define U_S(what) ((unsigned short)(what))
+#define U_I(what) ((unsigned int)(what))
+#define U_L(what) ((unsigned long)(what))
+#else
+unsigned long castulong();
+#define U_S(what) ((unsigned int)castulong(what))
+#define U_I(what) ((unsigned int)castulong(what))
+#define U_L(what) (castulong(what))
+#endif
+
 CMD *add_label();
 CMD *block_head();
 CMD *append_line();
@@ -402,7 +585,7 @@ char *scanpat();
 char *scansubst();
 char *scantrans();
 char *scanstr();
-char *scanreg();
+char *scanident();
 char *str_append_till();
 char *str_gets();
 char *str_grow();
@@ -428,6 +611,10 @@ void do_sprintf();
 void do_accept();
 void do_pipe();
 void do_vecset();
+void do_unshift();
+void do_execfree();
+void magicalize();
+void magicname();
 void savelist();
 void saveitem();
 void saveint();
@@ -441,15 +628,17 @@ ARRAY *saveary();
 
 EXT char **origargv;
 EXT int origargc;
-EXT line_t line INIT(0);
+EXT char **origenviron;
+extern char **environ;
+
 EXT line_t subline INIT(0);
 EXT STR *subname INIT(Nullstr);
 EXT int arybase INIT(0);
 
 struct outrec {
-    line_t  o_lines;
-    char    *o_str;
-    int     o_len;
+    long       o_lines;
+    char       *o_str;
+    int                o_len;
 };
 
 EXT struct outrec outrec;
@@ -469,6 +658,7 @@ EXT STAB *leftstab INIT(Nullstab);
 EXT STAB *amperstab INIT(Nullstab);
 EXT STAB *rightstab INIT(Nullstab);
 EXT STAB *DBstab INIT(Nullstab);
+EXT STAB *DBline INIT(Nullstab);
 EXT STAB *DBsub INIT(Nullstab);
 
 EXT HASH *defstash;            /* main symbol table */
@@ -480,11 +670,13 @@ EXT STR *curstname;               /* name of current package */
 EXT STR *freestrroot INIT(Nullstr);
 EXT STR *lastretstr INIT(Nullstr);
 EXT STR *DBsingle INIT(Nullstr);
+EXT STR *DBtrace INIT(Nullstr);
+EXT STR *DBsignal INIT(Nullstr);
 
 EXT int lastspbase;
 EXT int lastsize;
 
-EXT char *filename;
+EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEF");
 EXT char *origfilename;
 EXT FILE * VOLATILE rsfp;
 EXT char buf[1024];
@@ -495,7 +687,8 @@ EXT char *bufend;
 
 EXT STR *linestr INIT(Nullstr);
 
-EXT int record_separator INIT('\n');
+EXT char *rs INIT("\n");
+EXT int rschar INIT('\n');     /* final char of rs, or 0777 if none */
 EXT int rslen INIT(1);
 EXT char *ofs INIT(Nullch);
 EXT int ofslen INIT(0);
@@ -508,9 +701,11 @@ EXT char *nointrp INIT("");
 EXT bool preprocess INIT(FALSE);
 EXT bool minus_n INIT(FALSE);
 EXT bool minus_p INIT(FALSE);
+EXT bool minus_l INIT(FALSE);
 EXT bool minus_a INIT(FALSE);
 EXT bool doswitches INIT(FALSE);
 EXT bool dowarn INIT(FALSE);
+EXT bool doextract INIT(FALSE);
 EXT bool allstabs INIT(FALSE); /* init all customary symbols in symbol table?*/
 EXT bool sawampersand INIT(FALSE);     /* must save all match strings */
 EXT bool sawstudy INIT(FALSE);         /* do fbminstr on all strings */
@@ -518,6 +713,11 @@ EXT bool sawi INIT(FALSE);         /* study must assume case insensitive */
 EXT bool sawvec INIT(FALSE);
 EXT bool localizing INIT(FALSE);       /* are we processing a local() list? */
 
+#ifndef MAXSYSFD
+#   define MAXSYSFD 2
+#endif
+EXT int maxsysfd INIT(MAXSYSFD);       /* top fd to pass to subprocesses */
+
 #ifdef CSH
 char *cshname INIT(CSH);
 int cshlen INIT(0);
@@ -527,7 +727,11 @@ int cshlen INIT(0);
 EXT bool tainted INIT(FALSE);          /* using variables controlled by $< */
 #endif
 
+#ifndef MSDOS
 #define TMPPATH "/tmp/perl-eXXXXXX"
+#else
+#define TMPPATH "plXXXXXX"
+#endif /* MSDOS */
 EXT char *e_tmpname;
 EXT FILE *e_fp INIT(Nullfp);
 
@@ -548,12 +752,15 @@ FILE *popen();
 STR *interp();
 void free_arg();
 STIO *stio_new();
+void hoistmust();
 
 EXT struct stat statbuf;
 EXT struct stat statcache;
 STAB *statstab INIT(Nullstab);
 STR *statname;
+#ifndef MSDOS
 EXT struct tms timesbuf;
+#endif
 EXT int uid;
 EXT int euid;
 EXT int gid;
@@ -573,6 +780,7 @@ EXT char *debdelim;
 #define YYDEBUG 1
 #endif
 EXT int perldb INIT(0);
+#define YYMAXDEPTH 300
 
 EXT line_t cmdline INIT(NOLINE);
 
@@ -595,6 +803,12 @@ EXT jmp_buf top_env;
 
 EXT char * VOLATILE goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
 
+struct ufuncs {
+    int (*uf_val)();
+    int (*uf_set)();
+    int uf_index;
+};
+
 EXT ARRAY *stack;              /* THE STACK */
 
 EXT ARRAY * VOLATILE savestack;                /* to save non-local values on */
@@ -602,19 +816,26 @@ EXT ARRAY * VOLATILE savestack;           /* to save non-local values on */
 EXT ARRAY *tosave;             /* strings to save on recursive subroutine */
 
 EXT ARRAY *lineary;            /* lines of script for debugger */
+EXT ARRAY *dbargs;             /* args to call listed by caller function */
 
-EXT ARRAY *pidstatary;         /* keep pids and statuses by fd for mypopen */
+EXT ARRAY *fdpid;              /* keep fd-to-pid mappings for mypopen */
+EXT HASH *pidstatus;           /* keep pid-to-status mappings for waitpid */
 
 EXT int *di;                   /* for tmp use in debuggers */
 EXT char *dc;
 EXT short *ds;
 
+/* Fix these up for __STDC__ */
+EXT long basetime INIT(0);
+char *mktemp();
+#ifndef STANDARD_C
+/* All of these are in stdlib.h or time.h for ANSI C */
 double atof();
 long time();
 struct tm *gmtime(), *localtime();
-char *mktemp();
 char *index(), *rindex();
 char *strcpy(), *strcat();
+#endif /* ! STANDARD_C */
 
 #ifdef EUNICE
 #define UNLINK unlnk
@@ -623,15 +844,15 @@ int unlnk();
 #define UNLINK unlink
 #endif
 
-#ifndef SETREUID
-#ifdef SETRESUID
+#ifndef HAS_SETREUID
+#ifdef HAS_SETRESUID
 #define setreuid(r,e) setresuid(r,e,-1)
-#define SETREUID
+#define HAS_SETREUID
 #endif
 #endif
-#ifndef SETREGID
-#ifdef SETRESGID
+#ifndef HAS_SETREGID
+#ifdef HAS_SETRESGID
 #define setregid(r,e) setresgid(r,e,-1)
-#define SETREGID
+#define HAS_SETREGID
 #endif
 #endif