6 /* Copyright (C) 2004 - 2006 by Daniel Stenberg et al
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation for any purpose and without fee is hereby granted, provided
10 * that the above copyright notice appear in all copies and that both that
11 * copyright notice and this permission notice appear in supporting
12 * documentation, and that the name of M.I.T. not be used in advertising or
13 * publicity pertaining to distribution of the software without specific,
14 * written prior permission. M.I.T. makes no representations about the
15 * suitability of this software for any purpose. It is provided "as is"
16 * without express or implied warranty.
20 /********************************************************************
24 * Content of header files lib/setup_once.h and ares/setup_once.h *
25 * must be kept in sync. Modify the other one if you change this. *
27 ********************************************************************/
31 * If we have the MSG_NOSIGNAL define, make sure we use
32 * it as the fourth argument of send() and recv()
35 #ifdef HAVE_MSG_NOSIGNAL
36 #define SEND_4TH_ARG MSG_NOSIGNAL
38 #define SEND_4TH_ARG 0
43 * The definitions for the return type and arguments types
44 * of functions recv() and send() belong and come from the
45 * configuration file. Do not define them in any other place.
47 * HAVE_RECV is defined if you have a function named recv()
48 * which is used to read incoming data from sockets. If your
49 * function has another name then don't define HAVE_RECV.
51 * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
52 * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
55 * HAVE_SEND is defined if you have a function named send()
56 * which is used to write outgoing data on a connected socket.
57 * If yours has another name then don't define HAVE_SEND.
59 * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
60 * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
61 * SEND_TYPE_RETV must also be defined.
65 #if !defined(RECV_TYPE_ARG1) || \
66 !defined(RECV_TYPE_ARG2) || \
67 !defined(RECV_TYPE_ARG3) || \
68 !defined(RECV_TYPE_ARG4) || \
69 !defined(RECV_TYPE_RETV)
71 Error Missing_definition_of_return_and_arguments_types_of_recv
74 #define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
75 (RECV_TYPE_ARG2)(y), \
76 (RECV_TYPE_ARG3)(z), \
77 (RECV_TYPE_ARG4)(SEND_4TH_ARG))
81 #define sread(x,y,z) (ssize_t)read_s((int)(x), (char *)(y), (int)(z))
85 Error Missing_definition_of_macro_sread
88 #endif /* HAVE_RECV */
91 #if !defined(SEND_TYPE_ARG1) || \
92 !defined(SEND_QUAL_ARG2) || \
93 !defined(SEND_TYPE_ARG2) || \
94 !defined(SEND_TYPE_ARG3) || \
95 !defined(SEND_TYPE_ARG4) || \
96 !defined(SEND_TYPE_RETV)
98 Error Missing_definition_of_return_and_arguments_types_of_send
101 #define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
102 (SEND_TYPE_ARG2)(y), \
103 (SEND_TYPE_ARG3)(z), \
104 (SEND_TYPE_ARG4)(SEND_4TH_ARG))
106 #else /* HAVE_SEND */
108 #define swrite(x,y,z) (ssize_t)write_s((int)(x), (char *)(y), (int)(z))
112 Error Missing_definition_of_macro_swrite
115 #endif /* HAVE_SEND */
119 * Uppercase macro versions of ANSI/ISO is*() functions/macros which
120 * avoid negative number inputs whith argument byte codes > 127.
123 #define ISSPACE(x) (isspace((int) ((unsigned char)x)))
124 #define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
125 #define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
126 #define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))
127 #define ISGRAPH(x) (isgraph((int) ((unsigned char)x)))
128 #define ISALPHA(x) (isalpha((int) ((unsigned char)x)))
131 #endif /* __SETUP_ONCE_H */