Print this page
Ensured various XPG7 stuff are declared properly in sys/stat.h (and cleanup)
New documentation for wcslen, wcsnlen, wcscasecmp (and friends), wcsdup.
Various other tweaks and markup improvements.
first round of POSIX 2008 stuff

@@ -18,10 +18,11 @@
  *
  * CDDL HEADER END
  */
 
 /*
+ * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  * Copyright (c) 2013 Gary Mills
  *
  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 

@@ -46,16 +47,16 @@
 #define R_OK    4       /* Test for Read permission */
 #define W_OK    2       /* Test for Write permission */
 #define X_OK    1       /* Test for eXecute permission */
 #define F_OK    0       /* Test for existence of File */
 
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+#if defined(_XPG4_2) || !defined(_STRICT_SYMBOLS)
 #define F_ULOCK 0       /* Unlock a previously locked region */
 #define F_LOCK  1       /* Lock a region for exclusive use */
 #define F_TLOCK 2       /* Test and lock a region for exclusive use */
 #define F_TEST  3       /* Test a region for other processes locks */
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
+#endif /*
 
 /* Symbolic constants for the "lseek" routine: */
 
 #ifndef SEEK_SET
 #define SEEK_SET        0       /* Set file pointer to "offset" */

@@ -67,25 +68,25 @@
 
 #ifndef SEEK_END
 #define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
 #endif
 
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
+#if !defined(_STRICT_SYMBOLS)
 #ifndef SEEK_DATA
 #define SEEK_DATA       3       /* Set file pointer to next data past offset */
 #endif
 
 #ifndef SEEK_HOLE
 #define SEEK_HOLE       4       /* Set file pointer to next hole past offset */
 #endif
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
+#endif /* !defined(_STRICT_SYMBOLS)
 
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
+#if !defined(_STRICT_SYMBOLS)
 /* Path names: */
 #define GF_PATH "/etc/group"    /* Path name of the "group" file */
 #define PF_PATH "/etc/passwd"   /* Path name of the "passwd" file */
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
+#endif
 
 /*
  * compile-time symbolic constants,
  * Support does not mean the feature is enabled.
  * Use pathconf/sysconf to obtain actual configuration value.

@@ -239,119 +240,104 @@
 #define lockf64                         lockf
 #define tell64                          tell
 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 #endif  /* _LP64 && _LARGEFILE64_SOURCE */
 
-#if defined(__STDC__)
-
 extern int access(const char *, int);
 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 extern int acct(const char *);
 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
 extern unsigned alarm(unsigned);
+
 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
-#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
-        defined(__EXTENSIONS__)
+#if (!defined(_STRICT_SYMBOLS)) || (defined(_XPG4_2) && !defined(_XPG6))
 extern int brk(void *);
-#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
+extern void *sbrk(intptr_t);
+#endif
+
 extern int chdir(const char *);
 extern int chown(const char *, uid_t, gid_t);
+
 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
-#if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \
-        !defined(_XPG6)) || defined(__EXTENSIONS__)
+#if (!defined(_STRICT_SYMBOLS)) || (defined(_XOPEN_SOURCE) && !defined(_XPG6))
 extern int chroot(const char *);
-#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */
+#endif
+
 extern int close(int);
+
 #if defined(_XPG4) || defined(__EXTENSIONS__)
 extern size_t confstr(int, char *, size_t);
 extern char *crypt(const char *, const char *);
-#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
+extern void encrypt(char *, int);
+#endif
+
 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
         defined(__EXTENSIONS__)
 extern char *ctermid(char *);
-#endif /* (!defined(_POSIX_C_SOURCE) ... */
+#endif
+
 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
 extern char *ctermid_r(char *);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
+#endif
+
 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
 #if !defined(_XPG6) || defined(__EXTENSIONS__)
 extern char *cuserid(char *);
 #endif
+
 extern int dup(int);
 extern int dup2(int, int);
 extern int dup3(int, int, int);
-#if defined(_XPG4) || defined(__EXTENSIONS__)
-extern void encrypt(char *, int);
-#endif /* defined(XPG4) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void endusershell(void);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
+
 extern int execl(const char *, const char *, ...);
 extern int execle(const char *, const char *, ...);
 extern int execlp(const char *, const char *, ...);
 extern int execv(const char *, char *const *);
 extern int execve(const char *, char *const *, char *const *);
 extern int execvp(const char *, char *const *);
 extern void _exit(int)
         __NORETURN;
 /*
- * The following fattach prototype is duplicated in <stropts.h>. The
- * duplication is necessitated by XPG4.2 which requires the prototype
+ * The following fattach & fdetach prototypes are duplicated in <stropts.h>.
+ * The duplication is necessitated by XPG4.2 which requires the prototype
  * be defined in <stropts.h>.
  */
 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 extern int fattach(int, const char *);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern int fchdir(int);
-extern int fchown(int, uid_t, gid_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 extern int fchroot(int);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
-        defined(__EXTENSIONS__)
-extern int fdatasync(int);
-#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
-/*
- * The following fdetach prototype is duplicated in <stropts.h>. The
- * duplication is necessitated by XPG4.2 which requires the prototype
- * be defined in <stropts.h>.
- */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 extern int fdetach(const char *);
-#endif /* !defined(__XOPEN_OR_POSIX)... */
+#endif
+
+#if !defined(_STRICT_SYMBOLS) || (_POSIX_C_SOURCE > 2)
+extern int fdatasync(int);
+extern int fsync(int);
+#endif
+
 extern pid_t fork(void);
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern pid_t fork1(void);
-extern pid_t forkall(void);
-#endif /* !defined(__XOPEN_OR_POSIX)... */
 extern long fpathconf(int, int);
-#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
-        defined(__EXTENSIONS__)
-extern int fsync(int);
-#endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
+
 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
         (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
         defined(__EXTENSIONS__)
 extern int ftruncate(int, off_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
-extern char *getcwd(char *, size_t);
-#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
-        defined(__EXTENSIONS__)
-extern int getdtablesize(void);
 #endif
+
+extern char *getcwd(char *, size_t);
 extern gid_t getegid(void);
 extern uid_t geteuid(void);
 extern gid_t getgid(void);
 extern int getgroups(int, gid_t *);
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+
+#if (!defined(_STRICT_SYMBOLS)) || defined(_XPG4_2)
+extern int fchdir(int);
+extern int fchown(int, uid_t, gid_t);
 extern long gethostid(void);
 #endif
+
 #if defined(_XPG4_2)
 extern int gethostname(char *, size_t);
-#elif  !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
+#elif  !defined(_STRICT_SYMBOLS)
 extern int gethostname(char *, int);
 #endif
 
 #ifndef __GETLOGIN_DEFINED      /* Avoid duplicate in stdlib.h */
 #define __GETLOGIN_DEFINED

@@ -373,48 +359,42 @@
 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
 #if !defined(_XPG6) || defined(__EXTENSIONS__)
 extern char *getpass(const char *);
 #endif
 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+
+#if (!defined(_STRICT_SYMBOLS)) || (defined(_XPG4_2) && !defined(_XPG6))
+extern int getdtablesize(void);
 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
-#if !defined(_XPG6) || defined(__EXTENSIONS__)
 extern int getpagesize(void);
 #endif
-extern pid_t getpgid(pid_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
+
 extern pid_t getpid(void);
 extern pid_t getppid(void);
 extern pid_t getpgrp(void);
 
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-char *gettxt(const char *, const char *);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+#if !defined(_STRICT_SYMBOLS) || defined(_XPG4_2)
+extern pid_t getpgid(pid_t);
 extern pid_t getsid(pid_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
+extern int lchown(const char *, uid_t, gid_t);
+#endif
+
 extern uid_t getuid(void);
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern char *getusershell(void);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern char *getwd(char *);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
+extern int isatty(int);
+
 /*
  * The following ioctl prototype is duplicated in <stropts.h>. The
  * duplication is necessitated by XPG4.2 which requires the prototype
  * be defined in <stropts.h>.
  */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
+#if !defined(_STRICT_SYMBOLS)
 extern int ioctl(int, int, ...);
 extern int isaexec(const char *, char *const *, char *const *);
 extern int issetugid(void);
 #endif
-extern int isatty(int);
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern int lchown(const char *, uid_t, gid_t);
-#endif
+
+
 extern int link(const char *, const char *);
 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 extern offset_t llseek(int, offset_t, int);
 #endif
 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \

@@ -496,14 +476,10 @@
 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 /* per RFC 3542; This is also defined in netdb.h */
 extern int rresvport_af(int *, int);
 #endif
 
-#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
-        defined(__EXTENSIONS__)
-extern void *sbrk(intptr_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
 extern int setegid(gid_t);
 extern int seteuid(uid_t);
 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
 extern int setgid(gid_t);

@@ -517,21 +493,27 @@
 extern int setregid(gid_t, gid_t);
 extern int setreuid(uid_t, uid_t);
 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
 extern pid_t setsid(void);
 extern int setuid(uid_t);
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void setusershell(void);
-#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
 extern unsigned sleep(unsigned);
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
+
+#if !defined(_STRICT_SYMBOLS)
+extern char *gettxt(const char *, const char *);
+extern void endusershell(void);
+extern pid_t fork1(void);
+extern pid_t forkall(void);
+extern char *getusershell(void);
+extern void setusershell(void);
 extern int stime(const time_t *);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
+#endif
+
 #if defined(_XPG4)
 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
 extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t);
 #endif /* defined(_XPG4) */
+
 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
 extern int symlink(const char *, const char *);
 extern void sync(void);
 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
 #if defined(_XPG5) && !defined(_XPG6)

@@ -539,58 +521,55 @@
 #pragma redefine_extname sysconf __sysconf_xpg5
 #else /* __PRAGMA_REDEFINE_EXTNAME */
 #define sysconf __sysconf_xpg5
 #endif  /* __PRAGMA_REDEFINE_EXTNAME */
 #endif /* defined(_XPG5) && !defined(_XPG6) */
-extern long sysconf(int);
-extern pid_t tcgetpgrp(int);
-extern int tcsetpgrp(int, pid_t);
+
 #if !defined(__XOPEN_OR_POSIX) || \
         (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
         defined(__EXTENSIONS__)
 extern off_t tell(int);
-#endif /* !defined(__XOPEN_OR_POSIX)... */
+#endif
+
 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
         (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
         defined(__EXTENSIONS__)
 extern int truncate(const char *, off_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
+#endif
+
+extern long sysconf(int);
+extern pid_t tcgetpgrp(int);
+extern int tcsetpgrp(int, pid_t);
 extern char *ttyname(int);
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern useconds_t ualarm(useconds_t, useconds_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
 extern int unlink(const char *);
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
+extern ssize_t write(int, const void *, size_t);
+
+#if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS)
+extern char *getwd(char *);
+extern useconds_t ualarm(useconds_t, useconds_t);
 extern int usleep(useconds_t);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
 extern pid_t vfork(void) __RETURNS_TWICE;
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void vhangup(void);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern ssize_t write(int, const void *, size_t);
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void yield(void);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
+#pragma unknown_control_flow(vfork)
+#endif
 
-#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
-        defined(__EXTENSIONS__)
-        /* || defined(_XPG7) */
+#if defined(_XPG7) || defined(_ATFILE_SOURCE) || !defined(_STRICT_SYMBOLS)
 extern int faccessat(int, const char *, int, int);
 extern int fchownat(int, const char *, uid_t, gid_t, int);
 extern int linkat(int, const char *, int, const char *, int);
 extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD,
         char *_RESTRICT_KYWD, size_t);
 extern int renameat(int, const char *, int, const char *);
 extern int symlinkat(const char *, int, const char *);
 extern int unlinkat(int, const char *, int);
-#endif  /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
+#endif
+
+#if !defined(_STRICT_SYMBOLS)
 extern int get_nprocs(void);
 extern int get_nprocs_conf(void);
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
+extern void vhangup(void);
+extern void yield(void);
+#endif
 
 /* transitional large file interface versions */
 #if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
             !defined(__PRAGMA_REDEFINE_EXTNAME))
 extern int ftruncate64(int, off64_t);

@@ -600,331 +579,10 @@
 extern off64_t  tell64(int);
 extern int      truncate64(const char *, off64_t);
 extern int      lockf64(int, int, off64_t);
 #endif  /* _LARGEFILE64_SOURCE */
 
-#else  /* __STDC__ */
-
-extern int access();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int acct();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern unsigned alarm();
-#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
-        defined(__EXTENSIONS__)
-extern int brk();
-#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
-extern int chdir();
-extern int chown();
-#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-        defined(__EXTENSIONS__)
-extern int chroot();
-#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
-extern int close();
-#if defined(_XPG4) || defined(__EXTENSIONS__)
-extern size_t confstr();
-extern char *crypt();
-#endif /* defined(XPG4) || defined(__EXTENSIONS__) */
-#if !defined(_POSIX_C_SOURCE) || defined(_XPG3) || defined(__EXTENSIONS__)
-extern char *ctermid();
-#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XPG3)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
-extern char *ctermid_r();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
-#if !defined(_XPG6) || defined(__EXTENSIONS__)
-extern char *cuserid();
-#endif
-extern int dup();
-extern int dup2();
-extern int dup3();
-#if defined(_XPG4) || defined(__EXTENSIONS__)
-extern void encrypt();
-#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void endusershell();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern int execl();
-extern int execle();
-extern int execlp();
-extern int execv();
-extern int execve();
-extern int execvp();
-extern void _exit();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int fattach();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern int fchdir();
-extern int fchown();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int fchroot();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
-        defined(__EXTENSIONS__)
-extern int fdatasync();
-#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
-#if !defined(__XOPEN_OR_POSIX)
-extern int fdetach();
-#endif /* !defined(__XOPEN_OR_POSIX) */
-extern pid_t fork();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern pid_t fork1();
-extern pid_t forkall();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern long fpathconf();
-#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
-        defined(__EXTENSIONS__)
-extern int fsync();
-#endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
-#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
-        (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
-        defined(__EXTENSIONS__)
-extern int ftruncate();
-#endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */
-extern char *getcwd();
-#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
-        defined(__EXTENSIONS__)
-extern int getdtablesize();
-#endif
-extern gid_t getegid();
-extern uid_t geteuid();
-extern gid_t getgid();
-extern int getgroups();
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern long gethostid();
-#endif
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern int gethostname();
-#endif
-
-#ifndef __GETLOGIN_DEFINED      /* Avoid duplicate in stdlib.h */
-#define __GETLOGIN_DEFINED
-#ifndef __USE_LEGACY_LOGNAME__
-#ifdef __PRAGMA_REDEFINE_EXTNAME
-#pragma redefine_extname getlogin       getloginx
-#else   /* __PRAGMA_REDEFINE_EXTNAME */
-extern char *getloginx();
-#define getlogin        getloginx
-#endif  /* __PRAGMA_REDEFINE_EXTNAME */
-#endif  /* __USE_LEGACY_LOGNAME__ */
-extern char *getlogin();
-#endif  /* __GETLOGIN_DEFINED */
-
-#if defined(_XPG4) || defined(__EXTENSIONS__)
-extern int  getopt();
-extern char *optarg;
-extern int  opterr, optind, optopt;
-#if !defined(_XPG6) || defined(__EXTENSIONS__)
-extern char *getpass();
-#endif
-#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-#if !defined(_XPG6) || defined(__EXTENSIONS__)
-extern int getpagesize();
-#endif
-extern pid_t getpgid();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-extern pid_t getpid();
-extern pid_t getppid();
-extern pid_t getpgrp();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-char *gettxt();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern pid_t getsid();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
-extern uid_t getuid();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern char *getusershell();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern char *getwd();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int ioctl();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int isaexec();
-extern int issetugid();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern int isatty();
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern int lchown();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
-extern int link();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern offset_t llseek();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
-        (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
-        defined(__EXTENSIONS__)
-extern int lockf();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-extern off_t lseek();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int mincore();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-        defined(__EXTENSIONS__)
-extern int nice();
-#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
-extern long pathconf();
-extern int pause();
-extern int pipe();
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \
-        (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
-        defined(__EXTENSIONS__)
-extern ssize_t pread();
-#endif
-#if !defined(_LP64) && \
-        (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__))
-extern void profil();
-extern int ptrace();
-#endif
-#if !defined(__XOPEN_OR_POSIX) || \
-        ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \
-        defined(__EXTENSIONS__)
-extern int pthread_atfork();
-#endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ...  */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \
-        (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
-        defined(__EXTENSIONS__)
-extern ssize_t pwrite();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */
-extern ssize_t read();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-/* per RFC 3542; This is also defined in netdb.h */
-extern int rcmd_af();
-#endif
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern ssize_t readlink();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \
-        defined(__EXTENSIONS__)
-extern int rename();
-#endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int resolvepath();
-/* per RFC 3542; This is also defined in netdb.h */
-extern int rexec_af();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern int rmdir();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-/* per RFC 3542; This is also defined in netdb.h */
-extern int rresvport_af();
-#endif
-#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
-        defined(__EXTENSIONS__)
-extern void *sbrk();
-#endif /* !defined(__XOPEN_OR_POSIX)|| (defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
-extern int setegid();
-extern int seteuid();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
-extern int setgid();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int setgroups();
-extern int sethostname();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern int setpgid();
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern pid_t setpgrp();
-extern int setregid();
-extern int setreuid();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-extern pid_t setsid();
-extern int setuid();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void setusershell();
-#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
-extern unsigned sleep();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int stime();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-#if defined(_XPG4)
-/* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
-extern void swab();
-#endif /* defined(_XPG4) */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern int symlink();
-extern void sync();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if defined(_XPG5)
-#ifdef __PRAGMA_REDEFINE_EXTNAME
-#pragma redefine_extname sysconf __sysconf_xpg5
-extern long sysconf();
-#else /* __PRAGMA_REDEFINE_EXTNAME */
-extern long __sysconf_xpg5();
-#define sysconf __sysconf_xpg5
-#endif  /* __PRAGMA_REDEFINE_EXTNAME */
-#endif  /* defined(_XPG5) */
-extern pid_t tcgetpgrp();
-extern int tcsetpgrp();
-#if !defined(__XOPEN_OR_POSIX) || \
-        (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
-        defined(__EXTENSIONS__)
-extern off_t tell();
-#endif /* !defined(__XOPEN_OR_POSIX)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
-        (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
-        defined(__EXTENSIONS__)
-extern int truncate();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-extern char *ttyname();
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern useconds_t ualarm();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-extern int unlink();
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern int usleep();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-extern pid_t vfork();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void vhangup();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-extern ssize_t write();
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern void yield();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-
-#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
-        defined(__EXTENSIONS__)
-        /* || defined(_XPG7) */
-extern int faccessat();
-extern int fchownat();
-extern int linkat();
-extern ssize_t readlinkat();
-extern int renameat();
-extern int symlinkat();
-extern int unlinkat();
-#endif  /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
-#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
-extern int get_nprocs();
-extern int get_nprocs_conf();
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
-
-/* transitional large file interface versions */
-#if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
-            !defined(__PRAGMA_REDEFINE_EXTNAME))
-extern int ftruncate64();
-extern off64_t lseek64();
-extern ssize_t pread64();
-extern ssize_t pwrite64();
-extern off64_t tell64();
-extern int truncate64();
-extern int lockf64();
-#endif  /* _LARGEFILE64_SOURCE */
-
-#endif /* __STDC__ */
-
-#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
-#pragma unknown_control_flow(vfork)
-#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
-
 /*
  * getlogin_r() & ttyname_r() prototypes are defined here.
  */
 
 /*

@@ -961,12 +619,10 @@
 
 #if     defined(__EXTENSIONS__) || defined(_REENTRANT) || \
         !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
         defined(_POSIX_PTHREAD_SEMANTICS)
 
-#if     defined(__STDC__)
-
 #if     (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
 
 #ifndef __USE_LEGACY_LOGNAME__
 #ifdef  __PRAGMA_REDEFINE_EXTNAME
 #pragma redefine_extname getlogin_r __posix_getloginx_r

@@ -1033,87 +689,10 @@
 
 extern char *ttyname_r(int, char *, int);
 
 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
 
-#else  /* __STDC__ */
-
-#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
-
-#ifndef __USE_LEGACY_LOGNAME__
-#ifdef  __PRAGMA_REDEFINE_EXTNAME
-#pragma redefine_extname getlogin_r __posix_getloginx_r
-extern int getlogin_r();
-#else   /* __PRAGMA_REDEFINE_EXTNAME */
-extern int __posix_getloginx_r();
-#define getlogin_r      __posix_getloginx_r
-#endif  /* __PRAGMA_REDEFINE_EXTNAME */
-#else   /* __USE_LEGACY_LOGNAME__ */
-#ifdef __PRAGMA_REDEFINE_EXTNAME
-#pragma redefine_extname getlogin_r __posix_getlogin_r
-extern int getlogin_r();
-#else  /* __PRAGMA_REDEFINE_EXTNAME */
-extern int __posix_getlogin_r();
-
-#ifdef  __lint
-
-#define getlogin_r      __posix_getlogin_r
-
-#else /* !__lint */
-
-static int
-getlogin_r(__name, __len)
-        char *__name;
-        int __len;
-{
-        return (__posix_getlogin_r(__name, __len));
-}
-#endif /* !__lint */
-#endif /* __PRAGMA_REDEFINE_EXTNAME */
-#endif  /* __USE_LEGACY_LOGNAME__ */
-
-#ifdef __PRAGMA_REDEFINE_EXTNAME
-#pragma redefine_extname ttyname_r __posix_ttyname_r
-extern int ttyname_r();
-#else  /* __PRAGMA_REDEFINE_EXTNAME */
-
-extern int __posix_ttyname_r();
-
-#ifdef  __lint
-
-#define ttyname_r       __posix_ttyname_r
-
-#else /* !__lint */
-
-ttyname_r(__fildes, __buf, __size)
-        int __fildes;
-        char *__buf;
-        size_t __size;
-{
-        return (__posix_ttyname_r(__fildes, __buf, __size));
-}
-#endif /* !__lint */
-#endif /* __PRAGMA_REDEFINE_EXTNAME */
-
-#else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
-
-#ifndef __USE_LEGACY_LOGNAME__
-#ifdef __PRAGMA_REDEFINE_EXTNAME
-#pragma redefine_extname getlogin_r     getloginx_r
-#else   /* __PRAGMA_REDEFINE_EXTNAME */
-extern char *getloginx_r();
-#define getlogin_r      getloginx_r
-#endif  /* __PRAGMA_REDEFINE_EXTNAME */
-#endif  /* __USE_LEGACY_LOGNAME__ */
-extern char *getlogin_r();
-
-extern char *ttyname_r();
-
-#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
-
-#endif /* __STDC__ */
-
 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
 
 #ifdef  __cplusplus
 }
 #endif