| 1 |
/* |
| 2 |
* libmowgli: A collection of useful routines for programming. |
| 3 |
* stdinc.h: Pulls in the base system includes for libmowgli. |
| 4 |
* |
| 5 |
* Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk> |
| 6 |
* |
| 7 |
* Permission to use, copy, modify, and/or distribute this software for any |
| 8 |
* purpose with or without fee is hereby granted, provided that the above |
| 9 |
* copyright notice and this permission notice is present in all copies. |
| 10 |
* |
| 11 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 12 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 13 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 14 |
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| 15 |
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 16 |
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 17 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 18 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 19 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 20 |
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 21 |
* POSSIBILITY OF SUCH DAMAGE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef MOWGLI_SRC_LIBMOWGLI_CORE_STDINC_H_INCLUDE_GUARD |
| 25 |
#define MOWGLI_SRC_LIBMOWGLI_CORE_STDINC_H_INCLUDE_GUARD 1 |
| 26 |
|
| 27 |
#include <ctype.h> |
| 28 |
#include <errno.h> |
| 29 |
#include <fcntl.h> |
| 30 |
#include <inttypes.h> |
| 31 |
#include <limits.h> |
| 32 |
#include <setjmp.h> |
| 33 |
#include <signal.h> |
| 34 |
#include <stdarg.h> |
| 35 |
#include <stdbool.h> |
| 36 |
#include <stddef.h> |
| 37 |
#include <stdint.h> |
| 38 |
#include <stdio.h> |
| 39 |
#include <stdlib.h> |
| 40 |
#include <string.h> |
| 41 |
#include <sys/stat.h> |
| 42 |
#include <sys/types.h> |
| 43 |
#include <time.h> |
| 44 |
|
| 45 |
/* socket stuff */ |
| 46 |
#ifndef _WIN32 |
| 47 |
# include <arpa/inet.h> |
| 48 |
# include <dirent.h> |
| 49 |
# include <grp.h> |
| 50 |
# include <libgen.h> |
| 51 |
# include <netdb.h> |
| 52 |
# include <netinet/in.h> |
| 53 |
# include <sys/resource.h> |
| 54 |
# include <sys/socket.h> |
| 55 |
# include <sys/time.h> |
| 56 |
# include <sys/wait.h> |
| 57 |
# include <unistd.h> |
| 58 |
#else |
| 59 |
# define WINVER 0x0501 |
| 60 |
# define WIN32_LEAN_AND_MEAN |
| 61 |
# include <direct.h> |
| 62 |
# include <io.h> |
| 63 |
# include <process.h> |
| 64 |
# include <sys/timeb.h> |
| 65 |
# include <windows.h> |
| 66 |
# include <winsock2.h> |
| 67 |
# include <ws2tcpip.h> |
| 68 |
# include "platform/win32/win32_stdinc.h" |
| 69 |
#endif |
| 70 |
|
| 71 |
#ifdef _MSC_VER |
| 72 |
# pragma warning (disable: 4996) |
| 73 |
#endif |
| 74 |
|
| 75 |
#ifdef FALSE |
| 76 |
# undef FALSE |
| 77 |
#endif |
| 78 |
|
| 79 |
#ifdef TRUE |
| 80 |
# undef TRUE |
| 81 |
#endif |
| 82 |
|
| 83 |
typedef enum {FALSE, TRUE} mowgli_boolean_t; |
| 84 |
|
| 85 |
/* Macros for min/max. */ |
| 86 |
#ifndef MIN |
| 87 |
# define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
| 88 |
#endif |
| 89 |
|
| 90 |
#ifndef MAX |
| 91 |
# define MAX(a, b) (((a) > (b)) ? (a) : (b)) |
| 92 |
#endif |
| 93 |
|
| 94 |
/* OpenSSL stuff */ |
| 95 |
#ifdef HAVE_OPENSSL |
| 96 |
# if defined(__APPLE__) |
| 97 |
# include <AvailabilityMacros.h> |
| 98 |
# ifdef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER |
| 99 |
# undef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER |
| 100 |
# define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER |
| 101 |
# endif |
| 102 |
# endif |
| 103 |
# include <openssl/rand.h> |
| 104 |
# include <openssl/ssl.h> |
| 105 |
# include <openssl/err.h> |
| 106 |
#endif |
| 107 |
|
| 108 |
#endif /* MOWGLI_SRC_LIBMOWGLI_CORE_STDINC_H_INCLUDE_GUARD */ |