]> git.ozlabs.org Git - ccan/blob - ccan/tal/path/_info
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / tal / path / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 /**
6  * tal/path - routines to manipulate paths
7  *
8  * This code helps manage paths.
9  *
10  * License: BSD-MIT
11  * Author: Rusty Russell <rusty@rustcorp.com.au>
12  *
13  * Example:
14  *      // Program to print out full path names, recursively.
15  *      #include <ccan/tal/path/path.h>
16  *      #include <sys/types.h>
17  *      #include <dirent.h>
18  *      #include <stdio.h>
19  *      #include <ccan/err/err.h>
20  *
21  *      static void dump(const char *dir)
22  *      {
23  *              struct dirent *di;
24  *              DIR *d = opendir(dir);
25  *              if (!d) {
26  *                      warn("Failed to open %s", dir);
27  *                      return;
28  *              }
29  *              printf("%s\n", dir);
30  *              while ((di = readdir(d)) != NULL) {
31  *                      char *path;
32  *                      if (streq(di->d_name, ".") || streq(di->d_name, ".."))
33  *                              continue;
34  *                      path = path_join(NULL, dir, di->d_name);
35  *                      if (path_is_dir(path))
36  *                              dump(path);
37  *                      tal_free(path);
38  *              }
39  *              closedir(d);
40  *      }
41  *
42  *      int main(void)
43  *      {
44  *              dump(path_cwd(NULL));
45  *              return 0;
46  *      }
47  */
48 int main(int argc, char *argv[])
49 {
50         /* Expect exactly one argument */
51         if (argc != 2)
52                 return 1;
53
54         if (strcmp(argv[1], "depends") == 0) {
55                 printf("ccan/str\n");
56                 printf("ccan/take\n");
57                 printf("ccan/tal\n");
58                 printf("ccan/tal/str\n");
59                 return 0;
60         }
61
62         return 1;
63 }