1 : #define EX_UTILS_NO_USE_GET 1
2 : #define EX_UTILS_NO_USE_LIMIT 1
3 : #define EX_UTILS_NO_USE_OPEN 1
4 : #include "ex_utils.h"
5 :
6 : #include "opt_conf.h"
7 :
8 : int main(int argc, char *argv[])
9 8 : {
10 8 : Vstr_base *out = ex_init(NULL);
11 8 : int scan = 0;
12 :
13 8 : if (argc < 2)
14 0 : errx(EXIT_FAILURE, "args");
15 :
16 20 : while (scan < (argc - 1))
17 : {
18 8 : struct dirent **dents = NULL;
19 8 : int num = -1;
20 8 : int dscan = 0;
21 8 : const char *dir = argv[++scan];
22 :
23 8 : num = opt_conf_sc_scan_dir(dir, &dents);
24 8 : if (num == -1)
25 0 : err(EXIT_FAILURE, "scandir(%s)", dir);
26 :
27 8 : vstr_add_fmt(out, out->len,
28 : "\n Config file load order listing for: %s\n",
29 : dir);
30 :
31 68 : while (dscan < num)
32 : {
33 52 : const struct dirent *dent = dents[dscan];
34 :
35 52 : vstr_add_buf(out, out->len, dent->d_name, _D_EXACT_NAMLEN(dent));
36 52 : vstr_add_cstr_buf(out, out->len, "\n");
37 :
38 52 : free(dents[dscan]);
39 52 : ++dscan;
40 : }
41 8 : free(dents);
42 : }
43 :
44 8 : if (out->conf->malloc_bad)
45 0 : errno = ENOMEM, err(EXIT_FAILURE, "print");
46 :
47 8 : io_put_all(out, STDOUT_FILENO);
48 :
49 8 : exit (ex_exit(out, NULL));
50 : }
|