3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 * $Id: setup_once.h,v 1.2 2007-03-15 19:22:13 andy Exp $
24 ***************************************************************************/
27 /********************************************************************
31 * Content of header files lib/setup_once.h and ares/setup_once.h *
32 * must be kept in sync. Modify the other one if you change this. *
34 ********************************************************************/
38 * If we have the MSG_NOSIGNAL define, make sure we use
39 * it as the fourth argument of function send()
42 #ifdef HAVE_MSG_NOSIGNAL
43 #define SEND_4TH_ARG MSG_NOSIGNAL
45 #define SEND_4TH_ARG 0
50 * The definitions for the return type and arguments types
51 * of functions recv() and send() belong and come from the
52 * configuration file. Do not define them in any other place.
54 * HAVE_RECV is defined if you have a function named recv()
55 * which is used to read incoming data from sockets. If your
56 * function has another name then don't define HAVE_RECV.
58 * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
59 * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
62 * HAVE_SEND is defined if you have a function named send()
63 * which is used to write outgoing data on a connected socket.
64 * If yours has another name then don't define HAVE_SEND.
66 * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
67 * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
68 * SEND_TYPE_RETV must also be defined.
72 #if !defined(RECV_TYPE_ARG1) || \
73 !defined(RECV_TYPE_ARG2) || \
74 !defined(RECV_TYPE_ARG3) || \
75 !defined(RECV_TYPE_ARG4) || \
76 !defined(RECV_TYPE_RETV)
78 Error Missing_definition_of_return_and_arguments_types_of_recv
81 #define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
82 (RECV_TYPE_ARG2)(y), \
83 (RECV_TYPE_ARG3)(z), \
89 Error Missing_definition_of_macro_sread
92 #endif /* HAVE_RECV */
95 #if !defined(SEND_TYPE_ARG1) || \
96 !defined(SEND_QUAL_ARG2) || \
97 !defined(SEND_TYPE_ARG2) || \
98 !defined(SEND_TYPE_ARG3) || \
99 !defined(SEND_TYPE_ARG4) || \
100 !defined(SEND_TYPE_RETV)
102 Error Missing_definition_of_return_and_arguments_types_of_send
105 #define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
106 (SEND_TYPE_ARG2)(y), \
107 (SEND_TYPE_ARG3)(z), \
108 (SEND_TYPE_ARG4)(SEND_4TH_ARG))
110 #else /* HAVE_SEND */
113 Error Missing_definition_of_macro_swrite
116 #endif /* HAVE_SEND */
120 * Uppercase macro versions of ANSI/ISO is*() functions/macros which
121 * avoid negative number inputs with argument byte codes > 127.
124 #define ISSPACE(x) (isspace((int) ((unsigned char)x)))
125 #define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
126 #define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
127 #define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))
128 #define ISGRAPH(x) (isgraph((int) ((unsigned char)x)))
129 #define ISALPHA(x) (isalpha((int) ((unsigned char)x)))
130 #define ISPRINT(x) (isprint((int) ((unsigned char)x)))
134 * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type.
137 #ifndef HAVE_SIG_ATOMIC_T
138 typedef int sig_atomic_t;
139 #define HAVE_SIG_ATOMIC_T
144 * Default return type for signal handlers.
148 #define RETSIGTYPE void
152 #endif /* __SETUP_ONCE_H */