1explain_ungetc_or_die(3) Library Functions Manual explain_ungetc_or_die(3)
2
3
4
6 explain_ungetc_or_die - push a character back to a stream and report
7 errors
8
10 #include <libexplain/ungetc.h>
11 void explain_ungetc_or_die(int c, FILE *fp);
12 int explain_ungetc_on_error(int c, FILE *fp);
13
15 The explain_ungetc_or_die function is used to call the ungetc(3) system
16 call. On failure an explanation will be printed to stderr, obtained
17 from the explain_ungetc(3) function, and then the process terminates by
18 calling exit(EXIT_FAILURE).
19
20 The explain_ungetc_on_error function is used to call the ungetc(3) sys‐
21 tem call. On failure an explanation will be printed to stderr, obtained
22 from the explain_ungetc(3) function, but still returns to the caller.
23
24 c The c, exactly as to be passed to the ungetc(3) system call.
25
26 fp The fp, exactly as to be passed to the ungetc(3) system call.
27
29 The explain_ungetc_or_die function only returns on success, see
30 ungetc(3) for more information. On failure, prints an explanation and
31 exits, it does not return.
32
33 The explain_ungetc_on_error function always returns the value return by
34 the wrapped ungetc(3) system call.
35
37 The explain_ungetc_or_die function is intended to be used in a fashion
38 similar to the following example:
39 explain_ungetc_or_die(c, fp);
40
42 ungetc(3)
43 push a character back to a stream
44
45 explain_ungetc(3)
46 explain ungetc(3) errors
47
48 exit(2) terminate the calling process
49
51 libexplain version 1.4
52 Copyright (C) 2010 Peter Miller
53
54
55
56 explain_ungetc_or_die(3)