1explain_strndup_or_die(3)  Library Functions Manual  explain_strndup_or_die(3)
2
3
4

NAME

6       explain_strndup_or_die - duplicate a string and report errors
7

SYNOPSIS

9       #include <libexplain/strndup.h>
10       char *explain_strndup_or_die(const char *data, size_t data_size);
11       char *explain_strndup_on_error(const char *data, size_t data_size);
12

DESCRIPTION

14       The explain_strndup_or_die function is used to call the strndup(3) sys‐
15       tem call. On failure an explanation will be printed to stderr, obtained
16       from  the  explain_strndup(3) function, and then the process terminates
17       by calling exit(EXIT_FAILURE).
18
19       The explain_strndup_on_error function is used to  call  the  strndup(3)
20       system  call.  On  failure  an  explanation  will be printed to stderr,
21       obtained from the explain_strndup(3) function, but still returns to the
22       caller.
23
24       data    The  data,  exactly  as  to  be passed to the strndup(3) system
25               call.
26
27       data_size
28               The data_size, exactly as to be passed to the strndup(3) system
29               call.
30

RETURN VALUE

32       The  explain_strndup_or_die  function  only  returns  on  success,  see
33       strndup(3) for more information. On failure, prints an explanation  and
34       exits, it does not return.
35
36       The  explain_strndup_on_error  function always returns the value return
37       by the wrapped strndup(3) system call.
38

EXAMPLE

40       The explain_strndup_or_die function is intended to be used in a fashion
41       similar to the following example:
42              char *result = explain_strndup_or_die(data, data_size);
43

SEE ALSO

45       strndup(3)
46               duplicate a string
47
48       explain_strndup(3)
49               explain strndup(3) errors
50
51       exit(2) terminate the calling process
52
54       libexplain version 1.4
55       Copyright (C) 2009 Peter Miller
56
57
58
59                                                     explain_strndup_or_die(3)
Impressum