1explain_readdir_or_die(3) Library Functions Manual explain_readdir_or_die(3)
2
3
4
6 explain_readdir_or_die - read directory entry and report errors
7
9 #include <libexplain/readdir.h>
10 struct dirent *explain_readdir_or_die(DIR *dir);
11
13 The explain_readdir_or_die function is used to call the readdir(2) sys‐
14 tem call. On failure an explanation will be printed to stderr,
15 obtained from explain_readdir(3), and then the process terminates by
16 calling exit(EXIT_FAILURE).
17
18 This function is intended to be used in a fashion similar to the fol‐
19 lowing example:
20 explain_readdir_or_die(dir);
21
22 dir The dir, exactly as to be passed to the readdir(2) system call.
23
24 Returns:
25 a pointer to a dirent structure, or NULL if end‐of‐file is
26 reached. On failure, prints an explanation and exits.
27
29 readdir(2)
30 read directory entry
31
32 explain_readdir(3)
33 explain readdir(2) errors
34
35 exit(2) terminate the calling process
36
38 libexplain version 1.4
39 Copyright (C) 2008 Peter Miller
40
41
42
43 explain_readdir_or_die(3)