_info.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "config.h"
  4. /**
  5. * list - double linked list routines
  6. *
  7. * The list header contains routines for manipulating double linked lists.
  8. * It defines two types: struct list_head used for anchoring lists, and
  9. * struct list_node which is usually embedded in the structure which is placed
  10. * in the list.
  11. *
  12. * Example:
  13. * #include <err.h>
  14. * #include "list/list.h"
  15. *
  16. * struct parent {
  17. * const char *name;
  18. * struct list_head children;
  19. * unsigned int num_children;
  20. * };
  21. *
  22. * struct child {
  23. * const char *name;
  24. * struct list_node list;
  25. * };
  26. *
  27. * int main(int argc, char *argv[])
  28. * {
  29. * struct parent p;
  30. * struct child *c;
  31. * unsigned int i;
  32. *
  33. * if (argc < 2)
  34. * errx(1, "Usage: %s parent children...", argv[0]);
  35. *
  36. * p.name = argv[1];
  37. * for (i = 2; i < argc, i++) {
  38. * c = malloc(sizeof(*c));
  39. * c->name = argv[i];
  40. * list_add(&p.children, &c->list);
  41. * p.num_children++;
  42. * }
  43. *
  44. * printf("%s has %u children:", p.name, p.num_children);
  45. * list_for_each(&p.children, c, list)
  46. * printf("%s ", c->name);
  47. * printf("\n");
  48. * return 0;
  49. * }
  50. */
  51. int main(int argc, char *argv[])
  52. {
  53. if (argc != 2)
  54. return 1;
  55. if (strcmp(argv[1], "depends") == 0) {
  56. printf("ccan/container_of\n");
  57. return 0;
  58. }
  59. return 1;
  60. }