#ifndef _SUDO_MISSING_H
#define _SUDO_MISSING_H
#include <stdio.h>
#ifdef __STDC__
# include <stdarg.h>
#else
# include <varargs.h>
#endif
#ifndef __P
# if defined (__cplusplus) || defined (__STDC__)
# define __P(args) args
# else
# define __P(args) ()
# endif
#endif
#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
# define __attribute__(x)
#endif
#ifndef __printflike
# if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7)
# define __printflike(f, v) __attribute__((__format__ (__printf__, f, v)))
# else
# define __printflike(f, v)
# endif
#endif
#ifndef OPEN_MAX
# define OPEN_MAX 256
#endif
#ifndef INT_MAX
# define INT_MAX 0x7fffffff
#endif
#ifndef PATH_MAX
# ifdef MAXPATHLEN
# define PATH_MAX MAXPATHLEN
# else
# ifdef _POSIX_PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
# else
# define PATH_MAX 1024
# endif
# endif
#endif
#ifndef MAXHOSTNAMELEN
# define MAXHOSTNAMELEN 64
#endif
#ifndef _S_IFMT
# define _S_IFMT S_IFMT
#endif
#ifndef _S_IFREG
# define _S_IFREG S_IFREG
#endif
#ifndef _S_IFDIR
# define _S_IFDIR S_IFDIR
#endif
#ifndef _S_IFLNK
# define _S_IFLNK S_IFLNK
#endif
#ifndef S_ISREG
# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#endif
#ifndef S_ISDIR
# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#endif
#ifndef S_IRWXU
# define S_IRWXU 0000700
#endif
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
# define STDOUT_FILENO 1
#endif
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
#ifndef SEEK_SET
# define SEEK_SET 0
#endif
#ifndef SEEK_CUR
# define SEEK_CUR 1
#endif
#ifndef SEEK_END
# define SEEK_END 2
#endif
#ifndef MIN
# define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef MAX
# define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef offsetof
# ifdef __offsetof
# define offsetof(type, field) __offsetof(type, field)
# else
# define offsetof(type, field) ((size_t)(&((type *)0)->field))
# endif
#endif
#ifndef HAVE_ISBLANK
int isblank __P((int));
# define isblank(_x) ((_x) == ' ' || (_x) == '\t')
#endif
#if !defined(HAVE_STRCHR) && !defined(strchr)
# define strchr(_s, _c) index(_s, _c)
#endif
#if !defined(HAVE_STRRCHR) && !defined(strrchr)
# define strrchr(_s, _c) rindex(_s, _c)
#endif
#if !defined(HAVE_MEMCPY) && !defined(memcpy)
# define memcpy(_d, _s, _n) (bcopy(_s, _d, _n))
#endif
#if !defined(HAVE_MEMSET) && !defined(memset)
# define memset(_s, _x, _n) (bzero(_s, _n))
#endif
#ifdef HAVE__INNETGR
# define innetgr(n, h, u, d) (_innetgr(n, h, u, d))
# define HAVE_INNETGR 1
#endif
#ifndef O_NOCTTY
# define O_NOCTTY 0
#endif
#ifndef HAVE_SIGACTION
# define SA_ONSTACK SV_ONSTACK
# define SA_RESTART SV_INTERRUPT
# define SA_RESETHAND SV_RESETHAND
# define sa_handler sv_handler
# define sa_mask sv_mask
# define sa_flags sv_flags
typedef struct sigvec sigaction_t;
typedef int sigset_t;
int sigaction __P((int sig, const sigaction_t *act, sigaction_t *oact));
int sigemptyset __P((sigset_t *));
int sigfillset __P((sigset_t *));
int sigaddset __P((sigset_t *, int));
int sigdelset __P((sigset_t *, int));
int sigismember __P((sigset_t *, int));
int sigprocmask __P((int, const sigset_t *, sigset_t *));
#endif
#ifdef HAVE_SIGACTION
# ifndef HAVE_SIGACTION_T
typedef struct sigaction sigaction_t;
# endif
# ifndef SA_INTERRUPT
# define SA_INTERRUPT 0
# endif
# ifndef SA_RESTART
# define SA_RESTART 0
# endif
#endif
#if !defined(HAVE_DIRFD) && defined(HAVE_DD_FD)
# define dirfd(_d) ((_d)->dd_fd)
# define HAVE_DIRFD
#endif
#if !defined(HAVE_FUTIMES) && defined(HAVE_FUTIMESAT)
# define futimes(_f, _tv) futimesat(_f, NULL, _tv)
# define HAVE_FUTIMES
#endif
#if !defined(HAVE_KILLPG) && !defined(killpg)
# define killpg(s) kill(-(s))
#endif
#ifndef HAVE_GETPROGNAME
# ifdef HAVE___PROGNAME
extern const char *__progname;
# define getprogname() (__progname)
# else
const char *getprogname __P((void));
#endif
#endif
#if defined(HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
extern int errno;
#endif
#ifndef timevalclear
# define timevalclear(tv) ((tv)->tv_sec = (tv)->tv_usec = 0)
#endif
#ifndef timevalisset
# define timevalisset(tv) ((tv)->tv_sec || (tv)->tv_usec)
#endif
#ifndef timevalcmp
# define timevalcmp(tv1, tv2, op) \
(((tv1)->tv_sec == (tv2)->tv_sec) ? \
((tv1)->tv_usec op (tv2)->tv_usec) : \
((tv1)->tv_sec op (tv2)->tv_sec))
#endif
#ifndef timevaladd
# define timevaladd(tv1, tv2) \
do { \
(tv1)->tv_sec += (tv2)->tv_sec; \
(tv1)->tv_usec += (tv2)->tv_usec; \
if ((tv1)->tv_usec >= 1000000) { \
(tv1)->tv_sec++; \
(tv1)->tv_usec -= 1000000; \
} \
} while (0)
#endif
#ifndef timevalsub
# define timevalsub(tv1, tv2) \
do { \
(tv1)->tv_sec -= (tv2)->tv_sec; \
(tv1)->tv_usec -= (tv2)->tv_usec; \
if ((tv1)->tv_usec < 0) { \
(tv1)->tv_sec--; \
(tv1)->tv_usec += 1000000; \
} \
} while (0)
#endif
#if !defined(NSIG)
# if defined(_NSIG)
# define NSIG _NSIG
# elif defined(__NSIG)
# define NSIG __NSIG
# else
# define NSIG 64
# endif
#endif
#ifndef WCOREDUMP
# define WCOREDUMP(x) ((x) & 0x80)
#endif
#if defined(__hpux)
int innetgr __P((const char *, const char *, const char *, const char *));
#endif
#if defined(__hpux) || defined(__sun)
int getdomainname __P((char *, size_t));
#endif
struct timeval;
struct timespec;
#ifndef HAVE_CLOSEFROM
void closefrom __P((int));
#endif
#ifndef HAVE_GETCWD
char *getcwd __P((char *, size_t size));
#endif
#ifndef HAVE_GETLINE
ssize_t getline __P((char **, size_t *, FILE *));
#endif
#ifndef HAVE_UTIMES
int utimes __P((const char *, const struct timeval *));
#endif
#ifdef HAVE_FUTIME
int futimes __P((int, const struct timeval *));
#endif
#ifndef HAVE_SNPRINTF
int snprintf __P((char *, size_t, const char *, ...))
__printflike(3, 4);
#endif
#ifndef HAVE_VSNPRINTF
int vsnprintf __P((char *, size_t, const char *, va_list))
__printflike(3, 0);
#endif
#ifndef HAVE_ASPRINTF
int asprintf __P((char **, const char *, ...))
__printflike(2, 3);
#endif
#ifndef HAVE_VASPRINTF
int vasprintf __P((char **, const char *, va_list))
__printflike(2, 0);
#endif
#ifndef HAVE_STRCASECMP
int strcasecmp __P((const char *, const char *));
#endif
#ifndef HAVE_STRLCAT
size_t strlcat __P((char *, const char *, size_t));
#endif
#ifndef HAVE_STRLCPY
size_t strlcpy __P((char *, const char *, size_t));
#endif
#ifndef HAVE_MEMRCHR
void *memrchr __P((const void *, int, size_t));
#endif
#ifndef HAVE_MKSTEMPS
int mkstemps __P((char *, int));
#endif
#ifndef HAVE_NANOSLEEP
int nanosleep __P((const struct timespec *, struct timespec *));
#endif
#ifndef HAVE_SETENV
int setenv __P((const char *, const char *, int));
#endif
#ifndef HAVE_UNSETENV
int unsetenv __P((const char *));
#endif
#ifndef HAVE_STRSIGNAL
char *strsignal __P((int));
#endif
#ifndef HAVE_SETSID
pid_t setsid __P((void));
#endif
#endif