]> git.ozlabs.org Git - ccan/blobdiff - ccan/ccan_tokenizer/_info
ccanlint: Move ccanlint test options from _info comments to code
[ccan] / ccan / ccan_tokenizer / _info
index ad01ceae846bc3cb2518a15ee55f733ea0ede16d..f5116b4fc80103957d6e74feb7ee1ac8b7def9c3 100644 (file)
@@ -1,6 +1,6 @@
+#include "config.h"
 #include <string.h>
 #include <stdio.h>
-#include "config.h"
 
 /**
  * ccan_tokenizer - A full-text lexer for C source files
@@ -11,7 +11,7 @@
  * Example:
  *
  * #include <ccan/ccan_tokenizer/ccan_tokenizer.h>
- * #include <ccan/grab_file/grab_file.h>
+ * #include <ccan/tal/grab_file/grab_file.h>
  * #include <err.h>
  *
  * static void token_list_stats(const struct token_list *tl) {
@@ -48,7 +48,6 @@
  * }
  *
  * int main(int argc, char *argv[]) {
- *     size_t len;
  *     char *file;
  *     struct token_list *tl;
  *     tok_message_queue mq;
  *             fprintf(stderr, "Usage: %s source_file\n", argv[0]);
  *             return 1;
  *     }
- *     file = grab_file(NULL, argv[1], &len);
+ *     file = grab_file(NULL, argv[1]);
  *     if (!file)
  *             err(1, "Could not read file %s", argv[1]);
  *
  *     //tokenize the contents
- *     tl = tokenize(file, file, len, &mq);
+ *     tl = tokenize(file, file, strlen(file), &mq);
  *
  *     //print warnings, errors, etc.
  *     while (queue_count(mq)) {
  * }
  *
  * License: BSD (3 clause)
- *
- * Ccanlint:
- *     // We actually depend on the LGPL dependencies
- *     license_depends_compat FAIL
- *     // We don't put the license line in all files.
- *     license_comment FAIL
  */
 int main(int argc, char *argv[])
 {
@@ -102,5 +95,13 @@ int main(int argc, char *argv[])
                return 0;
        }
 
+       if (strcmp(argv[1], "ccanlint") == 0) {
+               /* We actually depend on the LGPL dependencies */
+               printf("license_depends_compat FAIL\n");
+               /* We don't put the license line in all files. */
+               printf("license_comment FAIL\n");
+               return 0;
+       }
+
        return 1;
 }