_info 1.2 KB

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