summaryrefslogtreecommitdiff
path: root/config/auto-aux/gethostbyname.c
blob: 5278874febd21cf6eee02efd4fd0b53bb22c137e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/***********************************************************************/
/*                                                                     */
/*                                OCaml                                */
/*                                                                     */
/*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         */
/*                                                                     */
/*  Copyright 2002 Institut National de Recherche en Informatique et   */
/*  en Automatique.  All rights reserved.  This file is distributed    */
/*  under the terms of the GNU Library General Public License, with    */
/*  the special exception on linking described in file ../../LICENSE.  */
/*                                                                     */
/***********************************************************************/

/* $Id: gethostbyname.c 12858 2012-08-10 14:45:51Z maranget $ */

#ifndef _REENTRANT
/* This helps detection on Digital Unix... */
#define _REENTRANT
#endif

#include <sys/types.h>
#include <netdb.h>

int main(int argc, char ** argv)
{
#if NUM_ARGS == 5
  struct hostent *hp;
  struct hostent h;
  char buffer[1000];
  int h_errno;
  hp = gethostbyname_r("www.caml.org", &h, buffer, 10, &h_errno);
#elif NUM_ARGS == 6
  struct hostent *hp;
  struct hostent h;
  char buffer[1000];
  int h_errno;
  int rc;
  rc = gethostbyname_r("www.caml.org", &h, buffer, 10, &hp, &h_errno);
#endif
  return 0;
}