12 #include <sys/types.h>
14 #if defined(HAVE_SYS_BYTEORDER_H) && !defined(BYTE_ORDER)
18 # define __LITTLE_ENDIAN 1234
19 # define __BIG_ENDIAN 4321
21 # define LITTLE_ENDIAN __LITTLE_ENDIAN
22 # define BIG_ENDIAN __BIG_ENDIAN
23 # include <sys/byteorder.h>
24 # ifdef _LITTLE_ENDIAN
25 # define BYTE_ORDER __LITTLE_ENDIAN
27 # define BYTE_ORDER __BIG_ENDIAN
31 #if defined(__LCLINT__)
33 typedef unsigned int u_int32_t;
34 typedef unsigned short u_int16_t;
35 typedef unsigned char u_int8_t;
41 # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
44 unsigned long int __val[_SIGSET_NWORDS];
52 #if !defined(HAVE_S_ISTXT) && defined(HAVE_S_ISVTX)
53 #define S_ISTXT S_ISVTX
55 #if !defined(HAVE_STRUCT_STAT_ST_BIRTHTIME)
56 #if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) && defined(st_birthtime)
59 #define st_birthtime st_ctime
62 #if !defined(HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC) && defined(HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC)
63 #define st_atimespec st_atim
64 #define st_ctimespec st_ctim
65 #define st_mtimespec st_mtim
70 #ifdef HAVE_SYS_PARAM_H
71 #include <sys/param.h>
75 #define MAXPHYS (128 * 1024)
81 #define uuid_t unistd_uuid_t
84 #if defined(__LCLINT__)
86 extern int chroot (
const char *__path)
91 #if !defined(__GLIBC__) && !defined(__LCLINT__)
93 #include <crt_externs.h>
94 #define environ (*_NSGetEnviron())
101 #ifdef TIME_WITH_SYS_TIME
102 # include <sys/time.h>
105 # ifdef HAVE_SYS_TIME_H
106 # include <sys/time.h>
113 #if !defined(TIMEVAL_TO_TIMESPEC)
114 # define TIMEVAL_TO_TIMESPEC(tv, ts) { \
115 (ts)->tv_sec = (tv)->tv_sec; \
116 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
119 #if !defined(TIMESPEC_TO_TIMEVAL)
120 # define TIMESPEC_TO_TIMEVAL(tv, ts) { \
121 (tv)->tv_sec = (ts)->tv_sec; \
122 (tv)->tv_usec = (ts)->tv_nsec / 1000; \
127 #if defined(MAJOR_IN_MKDEV)
128 #include <sys/mkdev.h>
131 #if defined(MAJOR_IN_SYSMACROS)
132 #include <sys/sysmacros.h>
140 #define major(dev) (((dev) >> 8) & 0xff)
141 #define minor(dev) ((dev) & 0xff)
142 #define makedev(maj, min) (((maj) << 8) | (min))
151 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
156 # include <strings.h>
167 #if defined(__LCLINT__)
170 extern void error(
int status,
int errnum,
const char *
format, ...)
171 __attribute__ ((__format__ (__printf__, 3, 4)))
176 #if defined(HAVE_ERROR) && defined(HAVE_ERROR_H)
181 #if !defined(__LCLINT__)
182 #if defined(HAVE_SECURE_GETENV)
183 #define getenv(_s) secure_getenv(_s)
185 #if defined(HAVE___SECURE_GETENV)
186 #define getenv(_s) __secure_getenv(_s)
193 #define getopt system_getopt
199 #if defined(__LCLINT__)
201 extern char *
realpath (
const char * file_name,
char * resolved_name)
209 #if !defined(HAVE_REALPATH)
210 char *
realpath(
const char *
path,
char resolved_path []);
215 #if !defined(EXIT_FAILURE)
216 #define EXIT_FAILURE 1
222 #include <sys/file.h>
225 #if !defined(SEEK_SET) && !defined(__LCLINT__)
230 #if !defined(F_OK) && !defined(__LCLINT__)
243 # define NLENGTH(direct) (strlen((direct)->d_name))
245 # define dirent direct
246 # define NLENGTH(direct) ((direct)->d_namlen)
247 # ifdef HAVE_SYS_NDIR_H
248 # include <sys/ndir.h>
250 # ifdef HAVE_SYS_DIR_H
251 # include <sys/dir.h>
258 #if defined(__LCLINT__)
260 void *
alloca (
size_t __size)
268 # define alloca __builtin_alloca
270 # ifdef HAVE_ALLOCA_H
280 #if defined (__GLIBC__) && defined(__LCLINT__)
283 extern __const __int32_t *__ctype_tolower;
285 extern __const __int32_t *__ctype_toupper;
291 #if defined (__GLIBC__) && defined(__LCLINT__)
293 extern int isalnum(
int)
__THROW ;
294 extern
int iscntrl(
int) __THROW ;
295 extern
int isgraph(
int) __THROW ;
296 extern
int islower(
int) __THROW ;
297 extern
int ispunct(
int) __THROW ;
298 extern
int isxdigit(
int) __THROW ;
299 extern
int isascii(
int) __THROW ;
300 extern
int toascii(
int) __THROW ;
301 extern
int _toupper(
int) __THROW ;
302 extern
int _tolower(
int) __THROW ;
307 #if defined(HAVE_SYS_MMAN_H) && !defined(__LCLINT__)
308 #include <sys/mman.h>
311 #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
312 #define MAP_ANONYMOUS MAP_ANON
316 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H)
317 #include <sys/resource.h>
320 #if defined(HAVE_SYS_UTSNAME_H)
321 #include <sys/utsname.h>
324 #if defined(HAVE_SYS_WAIT_H)
325 #include <sys/wait.h>
328 #if defined(HAVE_GETOPT_H)
334 #if defined(HAVE_GRP_H)
335 #define uuid_t unistd_uuid_t
336 #define uuid_create unistd_uuid_create
337 #define uuid_compare unistd_uuid_compare
340 #undef unistd_uuid_create
341 #undef unistd_uuid_compare
344 #if defined(HAVE_LIMITS_H)
348 #if defined(HAVE_ERR_H)
352 #if defined(HAVE_LIBGEN_H)
357 #if defined __GLIBC__ && __GLIBC__ >= 2
358 #if __GLIBC_MINOR__ >= 1
359 #define __progname __assert_program_name
361 #define setprogname(pn)
363 #define __progname program_name
364 #define setprogname(pn) \
365 { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
366 else __progname = pn; \
378 #if !defined(HAVE_STPCPY)
379 char *
stpcpy(
char * dest,
const char * src);
382 #if !defined(HAVE_STPNCPY)
383 char *
stpncpy(
char * dest,
const char * src,
size_t n);
386 #if defined(NEED_MYREALLOC)
387 #define realloc(ptr,size) myrealloc(ptr,size)
388 extern void *myrealloc(
void *,
size_t);
391 #if !defined(HAVE_SETENV)
420 char *
xstrdup (
const char *str)
430 #if !defined(HAVE_SETPROCTITLE) && defined(__linux__)
431 extern int finiproctitle(
void)
434 extern int initproctitle(
int argc,
char *
argv[],
char *envp[])
438 extern int setproctitle (
const char *fmt, ...)
439 __attribute__ ((__format__ (__printf__, 1, 2)))
447 #if defined(HAVE_MCHECK_H)
449 #if defined(__LCLINT__)
454 MCHECK_DISABLED = -1,
462 extern int mcheck (
void (*__abortfunc) (
enum mcheck_status))
465 extern int mcheck_pedantic (
void (*__abortfunc) (
enum mcheck_status))
468 extern void mcheck_check_all (
void)
471 extern enum mcheck_status mprobe (
void *__ptr)
474 extern void mtrace (
void)
477 extern void muntrace (
void)
484 #if defined(__GNUC__)
485 #define xmalloc(_size) (malloc(_size) ? : vmefail(_size))
486 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size))
487 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size))
488 #define xstrdup(_str) (strcpy((char *)(malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str)))
492 #if defined(HAVE_NETDB_H)
496 #if defined(HAVE_NETINET_IN_H)
497 #include <netinet/in.h>
499 #if defined(HAVE_ARPA_INET_H)
500 #include <arpa/inet.h>
503 #if defined(HAVE_PWD_H)
509 #if defined(HAVE_LOCALE_H)
512 #if !defined(HAVE_SETLOCALE)
513 # define setlocale(Category, Locale)
516 #if defined(ENABLE_NLS) && !defined(__LCLINT__)
517 # include <libintl.h>
518 # define _(Text) dgettext (PACKAGE, Text)
519 # define D_(Text) Text
521 # undef bindtextdomain
522 # define bindtextdomain(Domain, Directory)
524 # define textdomain(Domain)
525 # define _(Text) Text
526 # define D_(Text) Text
528 # define dgettext(DomainName, Text) Text
531 #define N_(Text) Text
540 #if defined(__LCLINT__)
550 void (*gl_closedir) (
void *);
552 struct dirent *(*gl_readdir) (
void *);
554 void *(*gl_readdir) (
void *);
556 ptr_t (*gl_opendir) (
const char *);
558 int (*gl_lstat) (
const char *restrict,
struct stat *restrict);
559 int (*gl_stat) (
const char *restrict,
struct stat *restrict);
561 int (*gl_lstat) (
const char *restrict,
void *restrict);
562 int (*gl_stat) (
const char *restrict,
void *restrict);
602 extern int glob (
const char *__pattern,
int __flags,
603 int (*__errfunc) (
const char *,
int),
612 extern int glob_pattern_p (
const char *__pattern,
int __quote)
639 extern int fnmatch (
const char *__pattern,
const char *__name,
int __flags)
645 #if !defined(__cplusplus)
646 #if !defined(HAVE_S_IFSOCK)
647 #define S_IFSOCK (0xc000)
650 #if !defined(HAVE_S_ISLNK)
651 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
654 #if !defined(HAVE_S_ISSOCK)
655 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
659 #if defined(NEED_STRINGS_H)
663 #if defined(HAVE_SYS_SOCKET_H)
664 #include <sys/types.h>
665 #include <sys/socket.h>
668 #if defined(HAVE_POLL_H)
671 #if defined(HAVE_SYS_SELECT_H) && !defined(__LCLINT__)
672 #include <sys/select.h>
677 #if defined(HAVE_GETPASSPHRASE)
678 #define getpass getpassphrase
681 #if !defined(HAVE_LCHOWN)
685 #if defined(HAVE_GETMNTINFO) || defined(HAVE_GETMNTINFO_R) || defined(HAVE_MNTCTL)
686 # define GETMNTENT_ONE 0
687 # define GETMNTENT_TWO 0
688 # if defined(HAVE_SYS_MNTCTL_H)
689 # include <sys/mntctl.h>
691 # if defined(HAVE_SYS_VMOUNT_H)
692 # include <sys/vmount.h>
694 # if defined(HAVE_SYS_MOUNT_H)
695 # include <sys/mount.h>
697 #elif defined(HAVE_MNTENT_H) || !defined(HAVE_GETMNTENT) || defined(HAVE_STRUCT_MNTTAB)
698 # if defined(HAVE_MNTENT_H)
701 # define our_mntent struct mntent
702 # define our_mntdir mnt_dir
703 # elif defined(HAVE_STRUCT_MNTTAB)
710 # define our_mntent struct our_mntent
717 # define our_mntent struct our_mntent
719 # define GETMNTENT_ONE 1
720 # define GETMNTENT_TWO 0
721 #elif defined(HAVE_SYS_MNTTAB_H)
723 # include <sys/mnttab.h>
724 # define GETMNTENT_ONE 0
725 # define GETMNTENT_TWO 1
726 # define our_mntent struct mnttab
727 # define our_mntdir mnt_mountp
729 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
733 #define MOUNTED "/etc/mnttab"
736 #if defined(__LCLINT__)
737 #define FILE_RCSID(id)
739 #define FILE_RCSID(id) \
740 static inline const char *rcsid(const char *p) { \
741 return rcsid(p = id); \
745 #if defined(HAVE_SEARCH_H)
754 #if defined(__QNXNTO__)
755 #include <sys/netmgr.h>
756 #define Makedev(x,y) makedev(ND_LOCAL_NODE,(x),(y))
758 #define Makedev(x,y) makedev((x),(y))
761 #if defined(WITH_PTHREADS)
762 #if defined(HAVE_PTHREAD_H) && !defined(__LCLINT__)
770 #define SUPPORT_IMPLICIT_TAG_DATA_TYPES 1
775 #define SUPPORT_I18NSTRING_TYPE 1
780 #define SUPPORT_NOSIGNATURES 1
785 #undef SUPPORT_AR_PAYLOADS
char * getenv(const char *name)
char * xstrdup(const char *str)
void globfree(glob_t *pglob)
int setenv(const char *name, const char *value, int replace)
void * xcalloc(size_t nmemb, size_t size)
struct our_mntent * getmntent(FILE *filep)
char * realpath(const char *path, char resolved_path[])
char * stpncpy(char *dest, const char *src, size_t n)
void unsetenv(const char *name)
int fnmatch(char *__pattern, char *__name, int __flags)
void * vmefail(size_t size)
char * stpcpy(char *dest, const char *src)
int glob(const char *pattern, int flags, int(*errfunc) __P((const char *, int)), glob_t *pglob)
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
int
Save source and expand field into target.