]> git.ozlabs.org Git - ccan/blobdiff - ccan/strset/_info
ccanlint: enhance and streamline "output" testing lines.
[ccan] / ccan / strset / _info
index 81e8f53cca08b73a3c1322d2da1cb6b7d4064c9a..982a9c0f851ae7d5485b42cc2e53578125613e14 100644 (file)
@@ -1,5 +1,6 @@
-#include <string.h>
 #include "config.h"
+#include <stdio.h>
+#include <string.h>
 
 /**
  * strset - an ordered set of strings
  * Example:
  *     // Print all words in order.
  *     #include <ccan/strset/strset.h>
- *     #include <ccan/grab_file/grab_file.h>
+ *     #include <ccan/tal/grab_file/grab_file.h>
  *     #include <err.h>
  *     #include <string.h>
  *
  *     static bool dump(const char *member, void *unused)
  *     {
  *             printf("%s ", member);
- *             return false;
+ *             return true; // Keep going with iteration.
  *     }
  *
  *     int main(void)
  *             char *file, *word;
  *
  *             strset_init(&words);
- *             file = grab_fd(NULL, 0, NULL);
+ *             file = grab_fd(NULL, 0);
  *             if (!file)
  *                     err(1, "Reading stdin");
  *
  *             for (word = strtok(file, " \t\r\n");
  *                  word;
  *                  word = strtok(NULL, " \t\r\n")) {
- *                     strset_set(&words, word);
+ *                     strset_add(&words, word);
  *             }
  *             strset_iterate(&words, dump, NULL);
  *             printf("\n");
  *             return 0;
  *     }
- *     // Given "foo bar" outputs "bar foo "
- *     // Given "foo foo bar" outputs "bar foo "
+ *     // Given "foo bar" outputs "bar foo \n"
+ *     // Given "foo foo bar" outputs "bar foo \n"
  *
- * License: Public domain (but some dependencies are LGPL!)
+ * License: CC0 (but some dependencies are LGPL!)
  * Author: Rusty Russell <rusty@rustcorp.com.au>
  * Ccanlint:
  *     license_depends_compat FAIL