version 1.1.1.2, 2012/05/29 12:26:49
|
version 1.1.1.4, 2013/07/22 10:46:12
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 1996, 1998-2005, 2008, 2009-2010 | * Copyright (c) 1996, 1998-2005, 2008, 2009-2013 |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 29
|
Line 29
|
* Macros and functions that may be missing on some operating systems. |
* Macros and functions that may be missing on some operating systems. |
*/ |
*/ |
|
|
|
#ifndef __GNUC_PREREQ__ |
|
# ifdef __GNUC__ |
|
# define __GNUC_PREREQ__(ma, mi) \ |
|
((__GNUC__ > (ma)) || (__GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))) |
|
# else |
|
# define __GNUC_PREREQ__(ma, mi) 0 |
|
# endif |
|
#endif |
|
|
/* Define away __attribute__ for non-gcc or old gcc */ |
/* Define away __attribute__ for non-gcc or old gcc */ |
#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 | #if !defined(__attribute__) && !__GNUC_PREREQ__(2, 5) |
# define __attribute__(x) |
# define __attribute__(x) |
#endif |
#endif |
|
|
/* For catching format string mismatches */ |
/* For catching format string mismatches */ |
#ifndef __printflike |
#ifndef __printflike |
# if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7) | # if __GNUC_PREREQ__(2, 7) |
# define __printflike(f, v) __attribute__((__format__ (__printf__, f, v))) |
# define __printflike(f, v) __attribute__((__format__ (__printf__, f, v))) |
# else |
# else |
# define __printflike(f, v) |
# define __printflike(f, v) |
# endif |
# endif |
#endif |
#endif |
|
|
|
/* Hint to compiler that returned pointer is unique (malloc but not realloc). */ |
|
#ifndef __malloc_like |
|
# if __GNUC_PREREQ__(2, 96) |
|
# define __malloc_like __attribute__((__malloc__)) |
|
# else |
|
# define __malloc_like |
|
# endif |
|
#endif |
|
|
|
#ifndef __dso_public |
|
# ifdef HAVE_DSO_VISIBILITY |
|
# if defined(__GNUC__) |
|
# define __dso_public __attribute__((__visibility__("default"))) |
|
# define __dso_hidden __attribute__((__visibility__("hidden"))) |
|
# elif defined(__SUNPRO_C) |
|
# define __dso_public __global |
|
# define __dso_hidden __hidden |
|
# else |
|
# define __dso_public __declspec(dllexport) |
|
# define __dso_hidden |
|
# endif |
|
# else |
|
# define __dso_public |
|
# define __dso_hidden |
|
# endif |
|
#endif |
|
|
/* |
/* |
* Some systems lack full limit definitions. |
* Some systems lack full limit definitions. |
*/ |
*/ |
Line 55
|
Line 91
|
#endif |
#endif |
|
|
#ifndef PATH_MAX |
#ifndef PATH_MAX |
# ifdef MAXPATHLEN | # ifdef _POSIX_PATH_MAX |
# define PATH_MAX MAXPATHLEN | # define PATH_MAX _POSIX_PATH_MAX |
# else |
# else |
# ifdef _POSIX_PATH_MAX | # define PATH_MAX 256 |
# define PATH_MAX _POSIX_PATH_MAX | |
# else | |
# define PATH_MAX 1024 | |
# endif | |
# endif |
# endif |
#endif |
#endif |
|
|
#ifndef MAXHOSTNAMELEN | #ifndef HOST_NAME_MAX |
# define MAXHOSTNAMELEN 64 | # ifdef _POSIX_HOST_NAME_MAX |
| # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX |
| # else |
| # define HOST_NAME_MAX 255 |
| # endif |
#endif |
#endif |
|
|
/* |
/* |
Line 113
|
Line 149
|
#endif |
#endif |
|
|
/* |
/* |
* BSD defines these in <sys/param.h> but others may not. | * BSD defines these in <sys/param.h> but we don't include that anymore. |
*/ |
*/ |
#ifndef MIN |
#ifndef MIN |
# define MIN(a,b) (((a)<(b))?(a):(b)) |
# define MIN(a,b) (((a)<(b))?(a):(b)) |
Line 122
|
Line 158
|
# define MAX(a,b) (((a)>(b))?(a):(b)) |
# define MAX(a,b) (((a)>(b))?(a):(b)) |
#endif |
#endif |
|
|
|
/* Macros to set/clear/test flags. */ |
|
#undef SET |
|
#define SET(t, f) ((t) |= (f)) |
|
#undef CLR |
|
#define CLR(t, f) ((t) &= ~(f)) |
|
#undef ISSET |
|
#define ISSET(t, f) ((t) & (f)) |
|
|
/* |
/* |
|
* Some systems define this in <sys/param.h> but we don't include that anymore. |
|
*/ |
|
#ifndef howmany |
|
# define howmany(x, y) (((x) + ((y) - 1)) / (y)) |
|
#endif |
|
|
|
/* |
* Older systems may be missing stddef.h and/or offsetof macro |
* Older systems may be missing stddef.h and/or offsetof macro |
*/ |
*/ |
#ifndef offsetof |
#ifndef offsetof |
Line 197 typedef struct sigaction sigaction_t;
|
Line 248 typedef struct sigaction sigaction_t;
|
#ifndef HAVE_GETPROGNAME |
#ifndef HAVE_GETPROGNAME |
# ifdef HAVE___PROGNAME |
# ifdef HAVE___PROGNAME |
extern const char *__progname; |
extern const char *__progname; |
# define getprogname() (__progname) | # define getprogname() (__progname) |
# else |
# else |
const char *getprogname(void); |
const char *getprogname(void); |
void setprogname(const char *); |
void setprogname(const char *); |
#endif /* HAVE___PROGNAME */ | # endif /* HAVE___PROGNAME */ |
#endif /* !HAVE_GETPROGNAME */ |
#endif /* !HAVE_GETPROGNAME */ |
|
|
/* |
/* |
Line 257 extern int errno;
|
Line 308 extern int errno;
|
# endif |
# endif |
#endif |
#endif |
|
|
|
/* For sig2str() */ |
|
#ifndef SIG2STR_MAX |
|
# define SIG2STR_MAX 32 |
|
#endif |
|
|
#ifndef WCOREDUMP |
#ifndef WCOREDUMP |
# define WCOREDUMP(x) ((x) & 0x80) |
# define WCOREDUMP(x) ((x) & 0x80) |
#endif |
#endif |
Line 348 int unsetenv(const char *);
|
Line 404 int unsetenv(const char *);
|
#endif |
#endif |
#ifndef HAVE_STRSIGNAL |
#ifndef HAVE_STRSIGNAL |
char *strsignal(int); |
char *strsignal(int); |
|
#endif |
|
#ifndef HAVE_SIG2STR |
|
int sig2str(int, char *); |
#endif |
#endif |
|
|
#endif /* _SUDO_MISSING_H */ |
#endif /* _SUDO_MISSING_H */ |