1explain_gethostbyname_or_dieL(i3b)rary Functions Maneuxapllain_gethostbyname_or_die(3)
2
3
4

NAME

6       explain_gethostbyname_or_die - get host address by host name and report
7       errors
8

SYNOPSIS

10       #include <libexplain/gethostbyname.h>
11       struct hostent *explain_gethostbyname_or_die(const char *name);
12       struct hostent *explain_gethostbyname_on_error(const char *name);
13

DESCRIPTION

15       The explain_gethostbyname_or_die function is used to call the  gethost‐
16       byname(3)  system  call.  On  failure an explanation will be printed to
17       stderr, obtained from the explain_gethostbyname(3) function,  and  then
18       the process terminates by calling exit(EXIT_FAILURE).
19
20       The  explain_gethostbyname_on_error  function is used to call the geth‐
21       ostbyname(3) system call. On failure an explanation will be printed  to
22       stderr,  obtained from the explain_gethostbyname(3) function, but still
23       returns to the caller.
24
25       name    The name, exactly as to be passed to the gethostbyname(3)  sys‐
26               tem call.
27

RETURN VALUE

29       The  explain_gethostbyname_or_die function only returns on success, see
30       gethostbyname(3) for more information. On failure, prints  an  explana‐
31       tion and exits, it does not return.
32
33       The  explain_gethostbyname_on_error  function  always returns the value
34       return by the wrapped gethostbyname(3) system call.
35

EXAMPLE

37       The explain_gethostbyname_or_die function is intended to be used  in  a
38       fashion similar to the following example:
39              struct hostent *result = explain_gethostbyname_or_die(name);
40

SEE ALSO

42       gethostbyname(3)
43               get host address given host name
44
45       explain_gethostbyname(3)
46               explain gethostbyname(3) errors
47
48       exit(2) terminate the calling process
49
51       libexplain version 1.4
52       Copyright (C) 2013 Peter Miller
53
54
55
56                                               explain_gethostbyname_or_die(3)
Impressum