diff --git a/src/include/ctype.h b/src/include/ctype.h index 25f551d9..c43774d6 100644 --- a/src/include/ctype.h +++ b/src/include/ctype.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ctype.h,v 1.18 2005/08/08 05:53:00 espie Exp $ */ +/* $OpenBSD: ctype.h,v 1.19 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */ /* @@ -39,6 +39,7 @@ #ifndef _CTYPE_H_ #define _CTYPE_H_ + #include #define _U 0x01 @@ -78,13 +79,17 @@ int isxdigit(int); int tolower(int); int toupper(int); -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \ + || __XPG_VISIBLE > 600 int isblank(int); +#endif + +#if __BSD_VISIBLE || __XPG_VISIBLE int isascii(int); int toascii(int); int _tolower(int); int _toupper(int); -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE || __XPG_VISIBLE */ #endif /* __GNUC__ || _ANSI_LIBRARY || lint */ @@ -159,12 +164,15 @@ __CTYPE_INLINE int toupper(int c) return ((_toupper_tab_ + 1)[c]); } -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \ + || __XPG_VISIBLE > 600 __CTYPE_INLINE int isblank(int c) { return (c == ' ' || c == '\t'); } +#endif +#if __BSD_VISIBLE || __XPG_VISIBLE __CTYPE_INLINE int isascii(int c) { return ((unsigned int)c <= 0177); @@ -184,7 +192,7 @@ __CTYPE_INLINE int _toupper(int c) { return (c - 'a' + 'A'); } -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE || __XPG_VISIBLE */ #endif /* !_ANSI_LIBRARY && !lint */ diff --git a/src/include/dirent.h b/src/include/dirent.h index e32e1f0c..05e5c83c 100644 --- a/src/include/dirent.h +++ b/src/include/dirent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dirent.h,v 1.14 2005/06/18 18:09:42 millert Exp $ */ +/* $OpenBSD: dirent.h,v 1.15 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */ /*- @@ -35,10 +35,12 @@ #ifndef _DIRENT_H_ #define _DIRENT_H_ +#include + /* * POSIX doesn't mandate this, but X/Open XPG 4.2 does. */ -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE || __XPG_VISIBLE >= 420 #include #endif @@ -48,11 +50,11 @@ */ #include -#ifdef _POSIX_SOURCE -typedef void * DIR; -#else - +#if __BSD_VISIBLE || __XPG_VISIBLE #define d_ino d_fileno /* backward compatibility */ +#endif + +#if __BSD_VISIBLE /* definitions for library routines operating on directories. */ #define DIRBLKSIZ 1024 @@ -80,31 +82,36 @@ typedef struct _dirdesc { #define NULL __null #else #define NULL 0L -#endif -#endif +#endif /* __GNUG__ */ +#endif /* !NULL */ -#endif /* _POSIX_SOURCE */ +#else /* !__BSD_VISIBLE */ -#ifndef _KERNEL +typedef void * DIR; -#include +#endif /* !__BSD_VISIBLE */ +#ifndef _KERNEL __BEGIN_DECLS DIR *opendir(const char *); struct dirent *readdir(DIR *); void rewinddir(DIR *); int closedir(DIR *); -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE DIR *__opendir2(const char *, int); -long telldir(const DIR *); -void seekdir(DIR *, long); int scandir(const char *, struct dirent ***, int (*)(struct dirent *), int (*)(const void *, const void *)); int alphasort(const void *, const void *); int getdirentries(int, char *, int, long *) __attribute__ ((__bounded__(__string__,2,3))); -#endif /* not POSIX */ +#endif /* __BSD_VISIBLE */ +#if __XPG_VISIBLE +long telldir(const DIR *); +void seekdir(DIR *, long); +#endif +#if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE >= 500 int readdir_r(DIR *, struct dirent *, struct dirent **); +#endif __END_DECLS #endif /* !_KERNEL */ diff --git a/src/include/fnmatch.h b/src/include/fnmatch.h index 8e4173c7..4b27d06c 100644 --- a/src/include/fnmatch.h +++ b/src/include/fnmatch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fnmatch.h,v 1.7 2003/06/02 19:34:12 millert Exp $ */ +/* $OpenBSD: fnmatch.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */ /*- @@ -35,21 +35,21 @@ #ifndef _FNMATCH_H_ #define _FNMATCH_H_ +#include + #define FNM_NOMATCH 1 /* Match failed. */ #define FNM_NOSYS 2 /* Function not supported (unused). */ #define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ #define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ #define FNM_PERIOD 0x04 /* Period must be matched by period. */ -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE #define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ #define FNM_CASEFOLD 0x10 /* Case insensitive search. */ #define FNM_IGNORECASE FNM_CASEFOLD #define FNM_FILE_NAME FNM_PATHNAME #endif -#include - __BEGIN_DECLS int fnmatch(const char *, const char *, int); __END_DECLS diff --git a/src/include/glob.h b/src/include/glob.h index 5c9e7465..fdd33bcb 100644 --- a/src/include/glob.h +++ b/src/include/glob.h @@ -1,4 +1,4 @@ -/* $OpenBSD: glob.h,v 1.9 2004/10/07 16:56:11 millert Exp $ */ +/* $OpenBSD: glob.h,v 1.10 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: glob.h,v 1.5 1994/10/26 00:55:56 cgd Exp $ */ /* @@ -62,7 +62,6 @@ typedef struct { int (*gl_stat)(const char *, struct stat *); } glob_t; -/* Flags */ #define GLOB_APPEND 0x0001 /* Append to output from previous call. */ #define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ #define GLOB_ERR 0x0004 /* Return on error. */ @@ -71,7 +70,12 @@ typedef struct { #define GLOB_NOSORT 0x0020 /* Don't sort. */ #define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */ -#ifndef _POSIX_SOURCE +#define GLOB_NOSPACE (-1) /* Malloc call failed. */ +#define GLOB_ABORTED (-2) /* Unignored error. */ +#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */ +#define GLOB_NOSYS (-4) /* Function not supported. */ + +#if __BSD_VISIBLE #define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ @@ -79,15 +83,9 @@ typedef struct { #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ #define GLOB_LIMIT 0x2000 /* Limit pattern match output to ARG_MAX */ +#define GLOB_ABEND GLOB_ABORTED /* backward compatibility */ #endif -/* Error values returned by glob(3) */ -#define GLOB_NOSPACE (-1) /* Malloc call failed. */ -#define GLOB_ABORTED (-2) /* Unignored error. */ -#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */ -#define GLOB_NOSYS (-4) /* Function not supported. */ -#define GLOB_ABEND GLOB_ABORTED - __BEGIN_DECLS int glob(const char *, int, int (*)(const char *, int), glob_t *); void globfree(glob_t *); diff --git a/src/include/grp.h b/src/include/grp.h index 5197d44c..f4012eb6 100644 --- a/src/include/grp.h +++ b/src/include/grp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: grp.h,v 1.7 2003/06/25 21:06:33 deraadt Exp $ */ +/* $OpenBSD: grp.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ #include #include -#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) +#if __BSD_VISIBLE #define _PATH_GROUP "/etc/group" #endif @@ -56,21 +56,21 @@ struct group { __BEGIN_DECLS struct group *getgrgid(gid_t); -int getgrgid_r(gid_t, struct group *, char *, - size_t, struct group **); struct group *getgrnam(const char *); -int getgrnam_r(const char *, struct group *, char *, - size_t, struct group **); -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE struct group *getgrent(void); void setgrent(void); void endgrent(void); +int getgrgid_r(gid_t, struct group *, char *, + size_t, struct group **); +int getgrnam_r(const char *, struct group *, char *, + size_t, struct group **); +#endif +#if __BSD_VISIBLE void setgrfile(const char *); -#ifndef _XOPEN_SOURCE -char *group_from_gid(gid_t, int); int setgroupent(int); -#endif /* !_XOPEN_SOURCE */ -#endif /* !_POSIX_SOURCE */ +char *group_from_gid(gid_t, int); +#endif __END_DECLS #endif /* !_GRP_H_ */ diff --git a/src/include/limits.h b/src/include/limits.h index 5784cf19..938b64a4 100644 --- a/src/include/limits.h +++ b/src/include/limits.h @@ -1,4 +1,4 @@ -/* $OpenBSD: limits.h,v 1.11 2004/06/09 17:32:10 millert Exp $ */ +/* $OpenBSD: limits.h,v 1.12 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */ /* @@ -35,7 +35,9 @@ #ifndef _LIMITS_H_ #define _LIMITS_H_ -#if !defined(_ANSI_SOURCE) +#include + +#if __POSIX_VISIBLE #define _POSIX_ARG_MAX 4096 #define _POSIX_CHILD_MAX 25 #define _POSIX_LINK_MAX 8 @@ -62,12 +64,17 @@ #define _POSIX2_LINE_MAX 2048 #define _POSIX2_RE_DUP_MAX _POSIX_RE_DUP_MAX -/* P1003.1c */ +#if __POSIX_VISIBLE >= 200112 #define _POSIX_TTY_NAME_MAX 260 #define _POSIX_LOGIN_NAME_MAX MAXLOGNAME -#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -#define PASS_MAX 128 +#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX +#define LOGIN_NAME_MAX MAXLOGNAME +#endif +#endif /* __POSIX_VISIBLE */ + +#if __XPG_VISIBLE +#define PASS_MAX 128 /* _PASSWORD_LEN from */ #define NL_ARGMAX 9 #define NL_LANGMAX 14 @@ -77,15 +84,12 @@ #define NL_TEXTMAX 255 #define TMP_MAX 308915776 -#endif /* !_POSIX_C_SOURCE || _XOPEN_SOURCE */ - -#endif /* !_ANSI_SOURCE */ - -/* where does this belong? it is defined by P1003.1c */ -#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX -#define LOGIN_NAME_MAX MAXLOGNAME +#endif /* __XPG_VISIBLE */ #include + +#if __POSIX_VISIBLE #include +#endif #endif /* !_LIMITS_H_ */ diff --git a/src/include/math.h b/src/include/math.h index 77d59695..ac89992e 100644 --- a/src/include/math.h +++ b/src/include/math.h @@ -1,4 +1,4 @@ -/* $OpenBSD: math.h,v 1.10 2005/11/17 20:07:40 otto Exp $ */ +/* $OpenBSD: math.h,v 1.11 2005/12/13 00:35:22 millert Exp $ */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -17,6 +17,8 @@ #ifndef _MATH_H_ #define _MATH_H_ +#include + /* * ANSI/POSIX */ @@ -36,7 +38,7 @@ typedef double double_t; /* * XOPEN/SVID */ -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE || __XPG_VISIBLE #define M_E 2.7182818284590452354 /* e */ #define M_LOG2E 1.4426950408889634074 /* log 2e */ #define M_LOG10E 0.43429448190325182765 /* log 10e */ @@ -58,8 +60,9 @@ typedef double double_t; #endif extern int signgam; +#endif /* __BSD_VISIBLE || __XPG_VISIBLE */ -#if !defined(_XOPEN_SOURCE) +#if __BSD_VISIBLE enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; #define _LIB_VERSION_TYPE enum fdversion @@ -105,11 +108,8 @@ struct exception { #define TLOSS 5 #define PLOSS 6 -#endif /* !_XOPEN_SOURCE */ -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE */ - -#include __BEGIN_DECLS /* * ANSI/POSIX @@ -141,7 +141,7 @@ extern double fabs(double); extern double floor(double); extern double fmod(double, double); -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE || __XPG_VISIBLE extern double erf(double); extern double erfc(double); extern double gamma(double); @@ -157,7 +157,7 @@ extern double y0(double); extern double y1(double); extern double yn(int, double); -#if !defined(_XOPEN_SOURCE) +#if __BSD_VISIBLE || __XPG_VISIBLE >= 500 extern double acosh(double); extern double asinh(double); extern double atanh(double); @@ -200,10 +200,10 @@ extern double log1p(double); * Reentrant version of gamma & lgamma; passes signgam back by reference * as the second argument; user must allocate space for signgam. */ -#ifdef _REENTRANT +#if __BSD_VISIBLE || defined(_REENTRANT) extern double gamma_r(double, int *); extern double lgamma_r(double, int *); -#endif /* _REENTRANT */ +#endif /* __BSD_VISIBLE || _REENTRANT */ /* float versions of ANSI/POSIX functions */ @@ -289,13 +289,13 @@ extern float log1pf(float); * signgam back by reference as the second argument; user must * allocate space for signgam. */ -#ifdef _REENTRANT +#if __BSD_VISIBLE || defined(_REENTRANT) extern float gammaf_r(float, int *); extern float lgammaf_r(float, int *); -#endif /* _REENTRANT */ +#endif /* __BSD_VISIBLE || _REENTRANT */ -#endif /* !_XOPEN_SOURCE */ -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 500 */ +#endif /* __BSD_VISIBLE || __XPG_VISIBLE */ __END_DECLS #endif /* _MATH_H_ */ diff --git a/src/include/netdb.h b/src/include/netdb.h index d8b4261c..9e35bb5e 100644 --- a/src/include/netdb.h +++ b/src/include/netdb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netdb.h,v 1.24 2005/06/08 18:32:32 millert Exp $ */ +/* $OpenBSD: netdb.h,v 1.25 2005/12/13 00:35:22 millert Exp $ */ /* * ++Copyright++ 1980, 1983, 1988, 1993 @@ -88,9 +88,6 @@ #define _NETDB_H_ #include -#if (!defined(BSD)) || (BSD < 199306) -# include -#endif #include #define _PATH_HEQUIV "/etc/hosts.equiv" @@ -236,7 +233,7 @@ struct rrsetinfo { struct rdatainfo *rri_sigs; /* individual signatures */ }; -#ifndef POSIX_SOURCE +#if __BSD_VISIBLE struct servent_data { void *fp; char **aliases; @@ -258,11 +255,11 @@ __BEGIN_DECLS void endhostent(void); void endnetent(void); void endprotoent(void); -#ifndef POSIX_SOURCE +#if __BSD_VISIBLE void endprotoent_r(struct protoent_data *); #endif void endservent(void); -#ifndef POSIX_SOURCE +#if __BSD_VISIBLE void endservent_r(struct servent_data *); #endif struct hostent *gethostbyaddr(const void *, socklen_t, int); @@ -275,7 +272,7 @@ struct netent *getnetent(void); struct protoent *getprotobyname(const char *); struct protoent *getprotobynumber(int); struct protoent *getprotoent(void); -#ifndef POSIX_SOURCE +#if __BSD_VISIBLE int getprotobyname_r(const char *, struct protoent *, struct protoent_data *); int getprotobynumber_r(int, struct protoent *, @@ -285,7 +282,7 @@ int getprotoent_r(struct protoent *, struct protoent_data *); struct servent *getservbyname(const char *, const char *); struct servent *getservbyport(int, const char *); struct servent *getservent(void); -#ifndef POSIX_SOURCE +#if __BSD_VISIBLE int getservbyname_r(const char *, const char *, struct servent *, struct servent_data *); int getservbyport_r(int, const char *, struct servent *, @@ -298,11 +295,11 @@ void sethostent(int); /* void sethostfile(const char *); */ void setnetent(int); void setprotoent(int); -#ifndef POSIX_SOURCE +#if __BSD_VISIBLE void setprotoent_r(int, struct protoent_data *); #endif void setservent(int); -#ifndef POSIX_SOURCE +#if __BSD_VISIBLE void setservent_r(int, struct servent_data *); #endif diff --git a/src/include/pwd.h b/src/include/pwd.h index 7d6003f8..4d3d6495 100644 --- a/src/include/pwd.h +++ b/src/include/pwd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pwd.h,v 1.17 2004/07/13 21:09:47 millert Exp $ */ +/* $OpenBSD: pwd.h,v 1.18 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: pwd.h,v 1.9 1996/05/15 21:36:45 jtc Exp $ */ /*- @@ -41,9 +41,10 @@ #ifndef _PWD_H_ #define _PWD_H_ +#include #include -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE #define _PATH_PASSWD "/etc/passwd" #define _PATH_MASTERPASSWD "/etc/master.passwd" #define _PATH_MASTERPASSWD_LOCK "/etc/ptmp" @@ -89,14 +90,15 @@ struct passwd { time_t pw_expire; /* account expiration */ }; -#include - __BEGIN_DECLS struct passwd *getpwuid(uid_t); struct passwd *getpwnam(const char *); -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE || __XPG_VISIBLE struct passwd *getpwent(void); -#ifndef _XOPEN_SOURCE +void setpwent(void); +void endpwent(void); +#endif +#if __BSD_VISIBLE int setpassent(int); char *user_from_uid(uid_t, int); char *bcrypt_gensalt(u_int8_t); @@ -104,9 +106,6 @@ char *bcrypt(const char *, const char *); char *md5crypt(const char *, const char *); struct passwd *pw_dup(const struct passwd *); #endif -void setpwent(void); -void endpwent(void); -#endif __END_DECLS #endif /* !_PWD_H_ */ diff --git a/src/include/setjmp.h b/src/include/setjmp.h index ef02e908..28bce8a7 100644 --- a/src/include/setjmp.h +++ b/src/include/setjmp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: setjmp.h,v 1.4 2003/06/02 19:34:12 millert Exp $ */ +/* $OpenBSD: setjmp.h,v 1.5 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: setjmp.h,v 1.11 1994/12/20 10:35:44 cgd Exp $ */ /*- @@ -40,30 +40,29 @@ #ifndef _SETJMP_H_ #define _SETJMP_H_ +#include #include -#ifndef _ANSI_SOURCE +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE typedef long sigjmp_buf[_JBLEN + 1]; -#endif /* not ANSI */ +#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */ typedef long jmp_buf[_JBLEN]; -#include - __BEGIN_DECLS int setjmp(jmp_buf); void longjmp(jmp_buf, int); -#ifndef _ANSI_SOURCE +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE int sigsetjmp(sigjmp_buf, int); void siglongjmp(sigjmp_buf, int); -#endif /* not ANSI */ +#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */ -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE || __XPG_VISIBLE int _setjmp(jmp_buf); void _longjmp(jmp_buf, int); void longjmperror(void); -#endif /* neither ANSI nor POSIX */ +#endif /* __BSD_VISIBLE || __XPG_VISIBLE */ __END_DECLS #endif /* !_SETJMP_H_ */ diff --git a/src/include/signal.h b/src/include/signal.h index fd50069f..807afb50 100644 --- a/src/include/signal.h +++ b/src/include/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.8 2004/05/03 17:25:00 millert Exp $ */ +/* $OpenBSD: signal.h,v 1.9 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */ /*- @@ -35,20 +35,21 @@ #ifndef _USER_SIGNAL_H #define _USER_SIGNAL_H +#include #include -#if !defined(_ANSI_SOURCE) +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE #include #endif -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE extern __const char *__const sys_signame[_NSIG]; extern __const char *__const sys_siglist[_NSIG]; #endif __BEGIN_DECLS int raise(int); -#ifndef _ANSI_SOURCE +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE void (*bsd_signal(int, void (*)(int)))(int); int kill(pid_t, int); int sigaction(int, const struct sigaction *, struct sigaction *); @@ -99,20 +100,24 @@ extern __inline int sigismember(const sigset_t *set, int signo) { #define sigemptyset(set) (*(set) = 0, 0) #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE || __XPG_VISIBLE >= 420 int killpg(pid_t, int); -int sigblock(int); int siginterrupt(int, int); int sigpause(int); int sigreturn(struct sigcontext *); -int sigsetmask(int); int sigstack(const struct sigstack *, struct sigstack *); int sigaltstack(const struct sigaltstack *, struct sigaltstack *); -int sigvec(int, struct sigvec *, struct sigvec *); +#if __BSD_VISIBLE void psignal(unsigned int, const char *); +int sigblock(int); +int sigsetmask(int); +int sigvec(int, struct sigvec *, struct sigvec *); +#endif +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500 int sigwait(const sigset_t *, int *); -#endif /* !_POSIX_SOURCE */ -#endif /* !_ANSI_SOURCE */ +#endif +#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */ +#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */ __END_DECLS #endif /* !_USER_SIGNAL_H */ diff --git a/src/include/stdio.h b/src/include/stdio.h index 8329e00d..26d2f40c 100644 --- a/src/include/stdio.h +++ b/src/include/stdio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdio.h,v 1.32 2005/05/11 18:39:19 espie Exp $ */ +/* $OpenBSD: stdio.h,v 1.33 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */ /*- @@ -38,11 +38,12 @@ #ifndef _STDIO_H_ #define _STDIO_H_ -#if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__) +#include + +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE #include #endif -#include #include #ifdef _BSD_SIZE_T_ @@ -184,7 +185,7 @@ __END_DECLS #define FILENAME_MAX 1024 /* must be <= PATH_MAX */ /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ -#ifndef _ANSI_SOURCE +#if __BSD_VISIBLE || __XPG_VISIBLE #define P_tmpdir "/tmp/" #endif #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ @@ -235,7 +236,7 @@ size_t fwrite(const void *, size_t, size_t, FILE *) int getc(FILE *); int getchar(void); char *gets(char *); -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(__SYS_ERRLIST) +#if __BSD_VISIBLE && !defined(__SYS_ERRLIST) #define __SYS_ERRLIST extern int sys_nerr; /* perror(3) external variables */ @@ -260,12 +261,34 @@ int ungetc(int, FILE *); int vfprintf(FILE *, const char *, _BSD_VA_LIST_); int vprintf(const char *, _BSD_VA_LIST_); int vsprintf(char *, const char *, _BSD_VA_LIST_); + +#if __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE +int snprintf(char *, size_t, const char *, ...) + __attribute__((__format__ (printf, 3, 4))) + __attribute__((__nonnull__ (3))) + __attribute__((__bounded__ (__string__,1,2))); +int vfscanf(FILE *, const char *, _BSD_VA_LIST_) + __attribute__((__format__ (scanf, 2, 0))) + __attribute__((__nonnull__ (2))); +int vscanf(const char *, _BSD_VA_LIST_) + __attribute__((__format__ (scanf, 1, 0))) + __attribute__((__nonnull__ (1))); +int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_) + __attribute__((__format__ (printf, 3, 0))) + __attribute__((__nonnull__ (3))) + __attribute__((__bounded__(__string__,1,2))); +int vsscanf(const char *, const char *, _BSD_VA_LIST_) + __attribute__((__format__ (scanf, 2, 0))) + __attribute__((__nonnull__ (2))); +#endif /* __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE */ + __END_DECLS + /* * Functions defined in POSIX 1003.1. */ -#ifndef _ANSI_SOURCE +#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE #define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ #define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */ @@ -275,13 +298,30 @@ char *ctermid_r(char *); char *cuserid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); + +#if __POSIX_VISIBLE >= 199209 +int pclose(FILE *); +FILE *popen(const char *, const char *); +#endif + +#if __POSIX_VISIBLE >= 199506 void flockfile(FILE *); int ftrylockfile(FILE *); void funlockfile(FILE *); + +/* + * These are normally used through macros as defined below, but POSIX + * requires functions as well. + */ int getc_unlocked(FILE *); -int putc_unlocked(int, FILE *); int getchar_unlocked(void); +int putc_unlocked(int, FILE *); int putchar_unlocked(int); +#endif /* __POSIX_VISIBLE >= 199506 */ + +#if __XPG_VISIBLE +char *tempnam(const char *, const char *); +#endif __END_DECLS #ifndef _POSIX_THREADS @@ -290,13 +330,12 @@ __END_DECLS # define funlockfile(fp) /* nothing */ #endif - -#endif /* not ANSI */ +#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */ /* * Routines that are purely local. */ -#if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE __BEGIN_DECLS int asprintf(char **, const char *, ...) __attribute__((__format__ (printf, 2, 3))) @@ -304,32 +343,12 @@ int asprintf(char **, const char *, ...) char *fgetln(FILE *, size_t *); int fpurge(FILE *); int getw(FILE *); -int pclose(FILE *); -FILE *popen(const char *, const char *); int putw(int, FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); -char *tempnam(const char *, const char *); -int snprintf(char *, size_t, const char *, ...) - __attribute__((__format__ (printf, 3, 4))) - __attribute__((__nonnull__ (3))) - __attribute__((__bounded__ (__string__,1,2))); int vasprintf(char **, const char *, _BSD_VA_LIST_) __attribute__((__format__ (printf, 2, 0))) __attribute__((__nonnull__ (2))); -int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_) - __attribute__((__format__ (printf, 3, 0))) - __attribute__((__nonnull__ (3))) - __attribute__((__bounded__(__string__,1,2))); -int vscanf(const char *, _BSD_VA_LIST_) - __attribute__((__format__ (scanf, 1, 0))) - __attribute__((__nonnull__ (1))); -int vsscanf(const char *, const char *, _BSD_VA_LIST_) - __attribute__((__format__ (scanf, 2, 0))) - __attribute__((__nonnull__ (2))); -int vfscanf(FILE *, const char *, _BSD_VA_LIST_) - __attribute__((__format__ (scanf, 2, 0))) - __attribute__((__nonnull__ (2))); __END_DECLS /* @@ -344,7 +363,7 @@ FILE *funopen(const void *, __END_DECLS #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE */ /* * Functions internal to the implementation. @@ -392,7 +411,7 @@ static __inline int __sputc(int _c, FILE *_p) { #define clearerr(p) __sclearerr(p) #endif -#ifndef _ANSI_SOURCE +#if __POSIX_VISIBLE #define fileno(p) __sfileno(p) #endif @@ -405,12 +424,12 @@ static __inline int __sputc(int _c, FILE *_p) { * The macro implementations of putc and putc_unlocked are not * fully POSIX compliant; they do not set errno on failure */ -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE #ifndef _POSIX_THREADS #define putc(x, fp) __sputc(x, fp) #endif /* _POSIX_THREADS */ #define putc_unlocked(x, fp) __sputc(x, fp) -#endif /* _POSIX_SOURCE */ +#endif /* __BSD_VISIBLE */ #endif /* lint */ #define getchar() getc(stdin) diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 244764cc..ea714e42 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.34 2005/05/27 17:45:56 millert Exp $ */ +/* $OpenBSD: stdlib.h,v 1.35 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -36,7 +36,8 @@ #define _STDLIB_H_ #include -#if !defined(_ANSI_SOURCE) /* for quad_t, etc. */ +#include +#if __BSD_VISIBLE /* for quad_t, etc. */ #include #endif @@ -63,7 +64,7 @@ typedef struct { long rem; /* remainder */ } ldiv_t; -#if !defined(_ANSI_SOURCE) +#if __BSD_VISIBLE typedef struct { quad_t quot; /* quotient */ quad_t rem; /* remainder */ @@ -105,7 +106,6 @@ int atexit(void (*)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); -long long atoll(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t); @@ -119,28 +119,15 @@ char *gcvt(double, int, char *); char *getenv(const char *); long labs(long); ldiv_t ldiv(long, long); -long long - llabs(long long); void *malloc(size_t); -char *mkdtemp(char *); -int mkstemp(char *); -int mkstemps(char *, int); -char *mktemp(char *); void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); int rand(void); -int rand_r(unsigned int *); void *realloc(void *, size_t); void srand(unsigned); double strtod(const char *, char **); long strtol(const char *, char **, int); -long long - strtoll(const char *, char **, int); -long long - strtonum(const char *, long long, long long, const char **); unsigned long strtoul(const char *, char **, int); -unsigned long long - strtoull(const char *, char **, int); int system(const char *); /* these are currently just stubs */ @@ -150,7 +137,73 @@ int wctomb(char *, wchar_t); int mbtowc(wchar_t *, const char *, size_t); size_t wcstombs(char *, const wchar_t *, size_t); -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +/* + * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2 + */ +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE >= 500 || \ + defined(_REENTRANT) +int rand_r(unsigned int *); +#endif + +#if __BSD_VISIBLE || __XPG_VISIBLE >= 400 +double drand48(void); +double erand48(unsigned short[3]); +long jrand48(unsigned short[3]); +void lcong48(unsigned short[7]); +long lrand48(void); +long mrand48(void); +long nrand48(unsigned short[3]); +unsigned short *seed48(unsigned short[3]); +void srand48(long); + +int putenv(const char *); +#endif + +#if __BSD_VISIBLE || __XPG_VISIBLE >= 420 +long a64l(const char *); +char *l64a(long); + +char *initstate(unsigned int, char *, size_t) + __attribute__((__bounded__ (__string__,2,3))); +long random(void); +char *setstate(const char *); +void srandom(unsigned int); + +int mkstemp(char *); +char *mktemp(char *); + +char *realpath(const char *, char *); + +int setkey(const char *); + +int ttyslot(void); + +void *valloc(size_t); /* obsoleted by malloc() */ +#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */ + +/* + * ISO C99 + */ +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 +long long + atoll(const char *); +long long + llabs(long long); +long long + strtoll(const char *, char **, int); +unsigned long long + strtoull(const char *, char **, int); +#endif + +/* + * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX) + */ +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 600 +int setenv(const char *, const char *, int); +void unsetenv(const char *); +#endif + +#if __BSD_VISIBLE #if defined(alloca) && (alloca == __builtin_alloca) && (__GNUC__ < 2) void *alloca(int); /* built-in for gcc */ #else @@ -174,23 +227,20 @@ int daemon(int, int); char *devname(int, int); int getloadavg(double [], int); -long a64l(const char *); -char *l64a(long); - void cfree(void *); #ifndef _GETOPT_DEFINED_ #define _GETOPT_DEFINED_ int getopt(int, char * const *, const char *); extern char *optarg; /* getopt(3) external variables */ -extern int opterr; -extern int optind; -extern int optopt; -extern int optreset; +extern int opterr, optind, optopt, optreset; int getsubopt(char **, char * const *, char **); extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* _GETOPT_DEFINED_ */ +char *mkdtemp(char *); +int mkstemps(char *, int); + int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, @@ -198,17 +248,10 @@ int radixsort(const unsigned char **, int, const unsigned char *, int sradixsort(const unsigned char **, int, const unsigned char *, unsigned); -char *initstate(unsigned int, char *, size_t) - __attribute__((__bounded__ (__string__,2,3))); -long random(void); -char *realpath(const char *, char *); -char *setstate(const char *); -void srandom(unsigned int); void srandomdev(void); +long long + strtonum(const char *, long long, long long, const char **); -int putenv(const char *); -int setenv(const char *, const char *, int); -void unsetenv(const char *); void setproctitle(const char *, ...) __attribute__((__format__ (__printf__, 1, 2))); @@ -217,21 +260,11 @@ qdiv_t qdiv(quad_t, quad_t); quad_t strtoq(const char *, char **, int); u_quad_t strtouq(const char *, char **, int); -double drand48(void); -double erand48(unsigned short[3]); -long jrand48(unsigned short[3]); -void lcong48(unsigned short[7]); -long lrand48(void); -long mrand48(void); -long nrand48(unsigned short[3]); -unsigned short *seed48(unsigned short[3]); -void srand48(long); - u_int32_t arc4random(void); void arc4random_stir(void); void arc4random_addrandom(unsigned char *, int) __attribute__((__bounded__ (__string__,1,2))); -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE */ __END_DECLS diff --git a/src/include/string.h b/src/include/string.h index 745be2d6..7a3c5337 100644 --- a/src/include/string.h +++ b/src/include/string.h @@ -1,4 +1,4 @@ -/* $OpenBSD: string.h,v 1.15 2005/03/30 03:04:16 deraadt Exp $ */ +/* $OpenBSD: string.h,v 1.16 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ /*- @@ -34,6 +34,8 @@ #ifndef _STRING_H_ #define _STRING_H_ + +#include #include #ifdef _BSD_SIZE_T_ @@ -49,8 +51,6 @@ typedef _BSD_SIZE_T_ size_t; #endif #endif -#include - __BEGIN_DECLS void *memchr(const void *, int, size_t); int memcmp(const void *, const void *, size_t); @@ -69,8 +69,6 @@ int strcoll(const char *, const char *); char *strcpy(char *, const char *); size_t strcspn(const char *, const char *); char *strerror(int); -int strerror_r(int, char *, size_t) - __attribute__ ((__bounded__(__string__,2,3))); size_t strlen(const char *); char *strncat(char *, const char *, size_t) __attribute__ ((__bounded__(__string__,1,3))); @@ -86,8 +84,12 @@ char *strtok_r(char *, const char *, char **); size_t strxfrm(char *, const char *, size_t) __attribute__ ((__bounded__(__string__,1,3))); -/* Nonstandard routines */ -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE || __XPG_VISIBLE +void *memccpy(void *, const void *, int, size_t) + __attribute__ ((__bounded__(__buffer__,1,4))); +#endif + +#if __BSD_VISIBLE || __XPG_VISIBLE >= 420 int bcmp(const void *, const void *, size_t); void bcopy(const void *, void *, size_t) __attribute__ ((__bounded__(__buffer__,1,3))) @@ -96,18 +98,24 @@ void bzero(void *, size_t) __attribute__ ((__bounded__(__buffer__,1,2))); int ffs(int); char *index(const char *, int); -void *memccpy(void *, const void *, int, size_t) - __attribute__ ((__bounded__(__buffer__,1,4))); char *rindex(const char *, int); int strcasecmp(const char *, const char *); +int strncasecmp(const char *, const char *, size_t); char *strdup(const char *); +#endif + +#if __BSD_VISIBLE || __XPG_VISIBLE >= 600 +int strerror_r(int, char *, size_t) + __attribute__ ((__bounded__(__string__,2,3))); +#endif + +#if __BSD_VISIBLE char *strcasestr(const char *, const char *); size_t strlcat(char *, const char *, size_t) __attribute__ ((__bounded__(__string__,1,3))); size_t strlcpy(char *, const char *, size_t) __attribute__ ((__bounded__(__string__,1,3))); void strmode(int, char *); -int strncasecmp(const char *, const char *, size_t); char *strsep(char **, const char *); char *strsignal(int); #endif diff --git a/src/include/time.h b/src/include/time.h index 1e4e933c..41ebba4a 100644 --- a/src/include/time.h +++ b/src/include/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.16 2003/08/01 17:38:33 avsm Exp $ */ +/* $OpenBSD: time.h,v 1.17 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -41,6 +41,7 @@ #ifndef _TIME_H_ #define _TIME_H_ +#include #include #ifndef NULL @@ -66,7 +67,23 @@ typedef _BSD_SIZE_T_ size_t; #undef _BSD_SIZE_T_ #endif -#define CLOCKS_PER_SEC 100 +#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE +/* + * Frequency of the clock ticks reported by times(). Deprecated - use + * sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.) + */ +#define CLK_TCK 100 +#endif + +#define CLOCKS_PER_SEC 100 /* frequency of ticks reported by clock(). */ + +#ifndef _TIMESPEC_DECLARED +#define _TIMESPEC_DECLARED +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +}; +#endif struct tm { int tm_sec; /* seconds after the minute [0-60] */ @@ -82,8 +99,6 @@ struct tm { char *tm_zone; /* timezone abbreviation */ }; -#include - __BEGIN_DECLS struct timespec; char *asctime(const struct tm *); @@ -105,19 +120,18 @@ struct tm *gmtime_r(const time_t *, struct tm *); struct tm *localtime_r(const time_t *, struct tm *); int nanosleep(const struct timespec *, struct timespec *); -#if !defined(_ANSI_SOURCE) -#define CLK_TCK 100 +#if __POSIX_VISIBLE extern char *tzname[2]; void tzset(void); -#endif /* not ANSI */ +#endif -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#if __BSD_VISIBLE char *timezone(int, int); void tzsetwall(void); time_t timelocal(struct tm *); time_t timegm(struct tm *); time_t timeoff(struct tm *, const long); -#endif /* neither ANSI nor POSIX */ +#endif __END_DECLS #endif /* !_TIME_H_ */ diff --git a/src/include/unistd.h b/src/include/unistd.h index 8bca390b..0c732d11 100644 --- a/src/include/unistd.h +++ b/src/include/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.56 2005/11/24 02:09:13 deraadt Exp $ */ +/* $OpenBSD: unistd.h,v 1.57 2005/12/13 00:35:22 millert Exp $ */ /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ /*- @@ -43,6 +43,13 @@ #define STDOUT_FILENO 1 /* standard output file descriptor */ #define STDERR_FILENO 2 /* standard error file descriptor */ +#if __XPG_VISIBLE || __POSIX_VISIBLE >= 200112 +#define F_ULOCK 0 /* unlock locked section */ +#define F_LOCK 1 /* lock a section for exclusive use */ +#define F_TLOCK 2 /* test and lock a section for exclusive use */ +#define F_TEST 3 /* test a section for locks by other procs */ +#endif + #ifndef NULL #ifdef __GNUG__ #define NULL __null @@ -58,9 +65,6 @@ unsigned int alarm(unsigned int); int chdir(const char *); int chown(const char *, uid_t, gid_t); int close(int); -size_t confstr(int, char *, size_t) - __attribute__((__bounded__(__string__,2,3))); -char *cuserid(char *); int dup(int); int dup2(int, int); int execl(const char *, const char *, ...) @@ -82,14 +86,9 @@ uid_t geteuid(void); gid_t getgid(void); int getgroups(int, gid_t *); char *getlogin(void); -int getlogin_r(char *, size_t) - __attribute__((__bounded__(__string__,1,2))) - __attribute__((__bounded__(__minbytes__,1,32))); pid_t getpgrp(void); pid_t getpid(void); -pid_t getpgid(pid_t); pid_t getppid(void); -pid_t getsid(pid_t); uid_t getuid(void); int isatty(int); int link(const char *, const char *); @@ -101,76 +100,129 @@ ssize_t read(int, void *, size_t) __attribute__((__bounded__(__buffer__,2,3))); int rmdir(const char *); int setgid(gid_t); -int setpgid(pid_t, pid_t); -pid_t setsid(void); int setuid(uid_t); unsigned int sleep(unsigned int); long sysconf(int); pid_t tcgetpgrp(int); int tcsetpgrp(int, pid_t); char *ttyname(int); -int ttyname_r(int, char *, size_t) - __attribute__((__bounded__(__string__,2,3))); int unlink(const char *); ssize_t write(int, const void *, size_t) __attribute__((__bounded__(__buffer__,2,3))); -#ifndef _POSIX_SOURCE +#if __POSIX_VISIBLE || __XPG_VISIBLE >= 300 +pid_t setsid(void); +int setpgid(pid_t, pid_t); +#endif -/* structure timeval required for select() */ -#include +#if __POSIX_VISIBLE >= 199209 || __XPG_VISIBLE +size_t confstr(int, char *, size_t) + __attribute__((__bounded__(__string__,2,3))); +#ifndef _GETOPT_DEFINED_ +#define _GETOPT_DEFINED_ +int getopt(int, char * const *, const char *); +extern char *optarg; /* getopt(3) external variables */ +extern int opterr, optind, optopt, optreset; +/* XXX - getsubopt does not belong here */ +int getsubopt(char **, char * const *, char **); +extern char *suboptarg; /* getsubopt(3) external variable */ +#endif /* _GETOPT_DEFINED_ */ +#endif -/* - * X/Open CAE Specification Issue 5 Version 2 - */ -#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \ - (_XOPEN_VERSION - 0) >= 500 +#if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE +int fsync(int); +int ftruncate(int, off_t); +int getlogin_r(char *, size_t) + __attribute__((__bounded__(__string__,1,2))) + __attribute__((__bounded__(__minbytes__,1,32))); +#endif + +#if __XPG_VISIBLE || __BSD_VISIBLE +char *crypt(const char *, const char *); +int encrypt(char *, int); +int fchdir(int); +int fchown(int, uid_t, gid_t); +long gethostid(void); +char *getwd(char *) + __attribute__ ((__bounded__(__minbytes__,1,1024))); +int lchown(const char *, uid_t, gid_t); +int mkstemp(char *); +char *mktemp(char *); +int nice(int); +int readlink(const char *, char *, size_t) + __attribute__ ((__bounded__(__string__,2,3))); +int setkey(const char *); +int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */ +int setregid(gid_t, gid_t); +int setreuid(uid_t, uid_t); +void swab(const void *, void *, size_t); +void sync(void); +int truncate(const char *, off_t); +unsigned int ualarm(unsigned int, unsigned int); +int usleep(useconds_t); +pid_t vfork(void); +#endif + +#if __XPG_VISIBLE >= 420 +pid_t getpgid(pid_t); +pid_t getsid(pid_t); +#endif + +#if __XPG_VISIBLE >= 500 ssize_t pread(int, void *, size_t, off_t); ssize_t pwrite(int, const void *, size_t, off_t); +int ttyname_r(int, char *, size_t) + __attribute__((__bounded__(__string__,2,3))); #endif -int acct(const char *); -void *brk(void *); +#if __BSD_VISIBLE || __XPG_VISIBLE <= 500 +/* Interfaces withdrawn by X/Open Issue 5 Version 0 */ +void *brk(void *); int chroot(const char *); -#if !defined(_XOPEN_SOURCE) -int closefrom(int); +int getdtablesize(void); +int getpagesize(void); +char *getpass(const char *); +void *sbrk(int); #endif -char *crypt(const char *, const char *); + +#if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420 +int lockf(int, int, off_t); +#endif + +#if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420 || __BSD_VISIBLE +int symlink(const char *, const char *); +int gethostname(char *, size_t) + __attribute__ ((__bounded__(__string__,1,2))); +int setegid(gid_t); +int seteuid(uid_t); +#endif + +#if __BSD_VISIBLE +int acct(const char *); +int closefrom(int); int des_cipher(const char *, char *, int32_t, int); int des_setkey(const char *key); -int encrypt(char *, int); void endusershell(void); int exect(const char *, char * const *, char * const *); -int fchdir(int); -int fchown(int, uid_t, gid_t); char *fflagstostr(u_int32_t); -int fsync(int); -int ftruncate(int, off_t); int getdomainname(char *, size_t) __attribute__ ((__bounded__(__string__,1,2))); -int getdtablesize(void); int getgrouplist(const char *, gid_t, gid_t *, int *); -long gethostid(void); -int gethostname(char *, size_t) - __attribute__ ((__bounded__(__string__,1,2))); mode_t getmode(const void *, mode_t); -int getpagesize(void); int getresgid(gid_t *, gid_t *, gid_t *); int getresuid(uid_t *, uid_t *, uid_t *); -char *getpass(const char *); char *getusershell(void); -char *getwd(char *) - __attribute__ ((__bounded__(__minbytes__,1,1024))); int initgroups(const char *, gid_t); int iruserok(u_int32_t, int, const char *, const char *); int iruserok_sa(const void *, int, int, const char *, const char *); -int lchown(const char *, uid_t, gid_t); +int issetugid(void); +char *mkdtemp(char *); +int mkstemps(char *, int); int nfssvc(int, void *); -int nice(int); void psignal(unsigned int, const char *); -extern __const char *__const sys_siglist[]; int profil(char *, size_t, unsigned long, unsigned int) __attribute__ ((__bounded__(__string__,1,2))); +int quotactl(const char *, int, int, char *); int rcmd(char **, int, const char *, const char *, const char *, int *); int rcmd_af(char **, int, const char *, @@ -179,75 +231,33 @@ int rcmdsh(char **, int, const char *, const char *, const char *, char *); char *re_comp(const char *); int re_exec(const char *); -int readlink(const char *, char *, size_t) - __attribute__ ((__bounded__(__string__,2,3))); int reboot(int); int revoke(const char *); int rfork(int opts); int rresvport(int *); int rresvport_af(int *, int); int ruserok(const char *, int, const char *, const char *); -int quotactl(const char *, int, int, char *); -void *sbrk(int); - -#if !defined(_XOPEN_SOURCE) && !defined(_SELECT_DEFINED_) -#define _SELECT_DEFINED_ +#ifndef _SELECT_DEFINED_ +#define _SELECT_DECLARED +struct timeval; int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #endif - int setdomainname(const char *, size_t); -int setegid(gid_t); -int seteuid(uid_t); int setgroups(int, const gid_t *); int sethostid(long); int sethostname(const char *, size_t); -int setkey(const char *); int setlogin(const char *); void *setmode(const char *); -int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */ -int setregid(gid_t, gid_t); int setresgid(gid_t, gid_t, gid_t); int setresuid(uid_t, uid_t, uid_t); -int setreuid(uid_t, uid_t); int setrgid(gid_t); int setruid(uid_t); void setusershell(void); int strtofflags(char **, u_int32_t *, u_int32_t *); -void swab(const void *, void *, size_t); int swapctl(int cmd, const void *arg, int misc); -int symlink(const char *, const char *); -void sync(void); int syscall(int, ...); -int truncate(const char *, off_t); -int ttyslot(void); -unsigned int ualarm(unsigned int, unsigned int); -int usleep(useconds_t); -void *valloc(size_t); /* obsoleted by malloc() */ -pid_t vfork(void); -int issetugid(void); - -#ifndef _GETOPT_DEFINED_ -#define _GETOPT_DEFINED_ -int getopt(int, char * const *, const char *); -extern char *optarg; /* getopt(3) external variables */ -extern int opterr; -extern int optind; -extern int optopt; -extern int optreset; -int getsubopt(char **, char * const *, char **); -extern char *suboptarg; /* getsubopt(3) external variable */ -#endif /* _GETOPT_DEFINED_ */ -#endif /* !_POSIX_SOURCE */ - -#if (!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \ - !defined(_XOPEN_SOURCE)) || \ - (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1) -#define F_ULOCK 0 -#define F_LOCK 1 -#define F_TLOCK 2 -#define F_TEST 3 -int lockf(int, int, off_t); -#endif /* (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || ... */ +extern __const char *__const sys_siglist[]; /* XXX - also in signal.h */ +#endif /* __BSD_VISIBLE */ __END_DECLS #endif /* !_UNISTD_H_ */