~ubuntu-branches/ubuntu/hardy/curl/hardy-updates

« back to all changes in this revision

Viewing changes to lib/setup_once.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-10-30 10:56:48 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061030105648-uo8q8w9xklb40b4k
Tags: 7.15.5-1ubuntu1
* Merge from debian unstable. Remaining Ubuntu changes:
  - debian/control: Drop libdb4.2 build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __SETUP_ONCE_H
 
2
#define __SETUP_ONCE_H
 
3
/***************************************************************************
 
4
 *                                  _   _ ____  _
 
5
 *  Project                     ___| | | |  _ \| |
 
6
 *                             / __| | | | |_) | |
 
7
 *                            | (__| |_| |  _ <| |___
 
8
 *                             \___|\___/|_| \_\_____|
 
9
 *
 
10
 * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
 
11
 *
 
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.
 
15
 *
 
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.
 
19
 *
 
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 
21
 * KIND, either express or implied.
 
22
 *
 
23
 * $Id: setup_once.h,v 1.2 2006-07-31 17:12:24 yangtse Exp $
 
24
 ***************************************************************************/
 
25
 
 
26
 
 
27
/*
 
28
 * If we have the MSG_NOSIGNAL define, make sure we use
 
29
 * it as the fourth argument of send() and recv()
 
30
 */
 
31
 
 
32
#ifdef HAVE_MSG_NOSIGNAL
 
33
#define SEND_4TH_ARG MSG_NOSIGNAL
 
34
#else
 
35
#define SEND_4TH_ARG 0
 
36
#endif 
 
37
 
 
38
 
 
39
/*
 
40
 * The definitions for the return type and arguments types
 
41
 * of functions recv() and send() belong and come from the
 
42
 * configuration file. Do not define them in any other place.
 
43
 *
 
44
 * HAVE_RECV is defined if you have a function named recv()
 
45
 * which is used to read incoming data from sockets. If your
 
46
 * function has another name then don't define HAVE_RECV.
 
47
 *
 
48
 * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
 
49
 * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
 
50
 * be defined.
 
51
 *
 
52
 * HAVE_SEND is defined if you have a function named send()
 
53
 * which is used to write outgoing data on a connected socket.
 
54
 * If yours has another name then don't define HAVE_SEND.
 
55
 *
 
56
 * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
 
57
 * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
 
58
 * SEND_TYPE_RETV must also be defined.
 
59
 */
 
60
 
 
61
#ifdef HAVE_RECV
 
62
#if !defined(RECV_TYPE_ARG1) || \
 
63
    !defined(RECV_TYPE_ARG2) || \
 
64
    !defined(RECV_TYPE_ARG3) || \
 
65
    !defined(RECV_TYPE_ARG4) || \
 
66
    !defined(RECV_TYPE_RETV)
 
67
  /* */
 
68
  Error Missing_definition_of_return_and_arguments_types_of_recv
 
69
  /* */
 
70
#else
 
71
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
 
72
                                   (RECV_TYPE_ARG2)(y), \
 
73
                                   (RECV_TYPE_ARG3)(z), \
 
74
                                   (RECV_TYPE_ARG4)(SEND_4TH_ARG))
 
75
#endif
 
76
#else /* HAVE_RECV */
 
77
#ifdef DJGPP
 
78
#define sread(x,y,z) (ssize_t)read_s((int)(x), (char *)(y), (int)(z))
 
79
#endif
 
80
#ifndef sread
 
81
  /* */
 
82
  Error Missing_definition_of_macro_sread
 
83
  /* */
 
84
#endif
 
85
#endif /* HAVE_RECV */
 
86
 
 
87
#ifdef HAVE_SEND
 
88
#if !defined(SEND_TYPE_ARG1) || \
 
89
    !defined(SEND_QUAL_ARG2) || \
 
90
    !defined(SEND_TYPE_ARG2) || \
 
91
    !defined(SEND_TYPE_ARG3) || \
 
92
    !defined(SEND_TYPE_ARG4) || \
 
93
    !defined(SEND_TYPE_RETV)
 
94
  /* */
 
95
  Error Missing_definition_of_return_and_arguments_types_of_send
 
96
  /* */
 
97
#else
 
98
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
 
99
                                    (SEND_TYPE_ARG2)(y), \
 
100
                                    (SEND_TYPE_ARG3)(z), \
 
101
                                    (SEND_TYPE_ARG4)(SEND_4TH_ARG))
 
102
#endif
 
103
#else /* HAVE_SEND */
 
104
#ifdef DJGPP
 
105
#define swrite(x,y,z) (ssize_t)write_s((int)(x), (char *)(y), (int)(z))
 
106
#endif
 
107
#ifndef swrite
 
108
  /* */
 
109
  Error Missing_definition_of_macro_swrite
 
110
  /* */
 
111
#endif
 
112
#endif /* HAVE_SEND */
 
113
 
 
114
 
 
115
#endif /* __SETUP_ONCE_H */
 
116