From 92ff7f21ad0b167f8d742a9d7b5f93704a57619c Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Thu, 24 Apr 2008 02:02:49 +0000 Subject: Major coding style cleanup. Updated all shared code from my other projects. The configure option requesting AFS kaserver support (and thus building kasetkey) is now --with-kaserver instead of --with-afs. If KRB5_CONFIG was explicitly set in the environment, don't use a different krb5-config based on --with-krb4 or --with-krb5. If krb5-config isn't executable, don't use it. This allows one to force library probing by setting KRB5_CONFIG to point to a nonexistent file. Sanity-check the results of krb5-config before proceeding and error out in configure if they don't work. Stop setting Stanford-specific compile-time defaults for the wallet server and port. --- portable/system.h | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 portable/system.h (limited to 'portable/system.h') diff --git a/portable/system.h b/portable/system.h new file mode 100644 index 0000000..1408ba7 --- /dev/null +++ b/portable/system.h @@ -0,0 +1,111 @@ +/* $Id$ + * + * Declarations of routines and variables in the C library. Including this + * file is the equivalent of including all of the following headers, portably: + * + * #include + * #include + * #include + * #include + * #include + * #include + * #include + * #include + * #include + * + * Missing functions are provided via #define or prototyped if available. + * Also provides some standard #defines. + * + * Written by Russ Allbery + * This work is hereby placed in the public domain by its author. + */ + +#ifndef PORTABLE_SYSTEM_H +#define PORTABLE_SYSTEM_H 1 + +/* Make sure we have our configuration information. */ +#include + +/* BEGIN_DECL and __attribute__. */ +#include + +/* A set of standard ANSI C headers. We don't care about pre-ANSI systems. */ +#include +#include +#include +#include +#include +#include +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDINT_H +# include +#endif +#if HAVE_UNISTD_H +# include +#endif + +/* SCO OpenServer gets int32_t from here. */ +#if HAVE_SYS_BITYPES_H +# include +#endif + +/* Get the bool type. */ +#include + +BEGIN_DECLS + +/* + * Provide prototypes for functions not declared in system headers. Use the + * HAVE_DECL macros for those functions that may be prototyped but + * implemented incorrectly or implemented without a prototype. + */ +#if !HAVE_ASPRINTF +extern int asprintf(char **, const char *, ...); +extern int vasprintf(char **, const char *, va_list); +#endif +#if !HAVE_DECL_SNPRINTF +extern int snprintf(char *, size_t, const char *, ...) + __attribute__((__format__(printf, 3, 4))); +#endif +#if !HAVE_DECL_VSNPRINTF +extern int vsnprintf(char *, size_t, const char *, va_list); +#endif +#if !HAVE_STRLCAT +extern size_t strlcat(char *, const char *, size_t); +#endif +#if !HAVE_STRLCPY +extern size_t strlcpy(char *, const char *, size_t); +#endif + +END_DECLS + +/* Windows provides snprintf under a different name. */ +#ifdef _WIN32 +# define snprintf _snprintf +#endif + +/* + * POSIX requires that these be defined in . If one of them has + * been defined, all the rest almost certainly have. + */ +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +# define STDOUT_FILENO 1 +# define STDERR_FILENO 2 +#endif + +/* + * C99 requires va_copy. Older versions of GCC provide __va_copy. Per the + * Autoconf manual, memcpy is a generally portable fallback. + */ +#ifndef va_copy +# ifdef __va_copy +# define va_copy(d, s) __va_copy((d), (s)) +# else +# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list)) +# endif +#endif + +#endif /* !PORTABLE_SYSTEM_H */ -- cgit v1.2.3