Commit 806f94eb authored by Rusty Russell's avatar Rusty Russell

ccan_tokenizer: switch example from grab_file to ccan/grab_file.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 6b8e498b
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Example: * Example:
* *
* #include <ccan/ccan_tokenizer/ccan_tokenizer.h> * #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> * #include <err.h>
* *
* static void token_list_stats(const struct token_list *tl) { * static void token_list_stats(const struct token_list *tl) {
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
* } * }
* *
* int main(int argc, char *argv[]) { * int main(int argc, char *argv[]) {
* size_t len;
* char *file; * char *file;
* struct token_list *tl; * struct token_list *tl;
* tok_message_queue mq; * tok_message_queue mq;
...@@ -59,12 +58,12 @@ ...@@ -59,12 +58,12 @@
* fprintf(stderr, "Usage: %s source_file\n", argv[0]); * fprintf(stderr, "Usage: %s source_file\n", argv[0]);
* return 1; * return 1;
* } * }
* file = grab_file(NULL, argv[1], &len); * file = grab_file(NULL, argv[1]);
* if (!file) * if (!file)
* err(1, "Could not read file %s", argv[1]); * err(1, "Could not read file %s", argv[1]);
* *
* //tokenize the contents * //tokenize the contents
* tl = tokenize(file, file, len, &mq); * tl = tokenize(file, file, strlen(file), &mq);
* *
* //print warnings, errors, etc. * //print warnings, errors, etc.
* while (queue_count(mq)) { * while (queue_count(mq)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment