summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..2b420f2
--- /dev/null
+++ b/main.c
@@ -0,0 +1,50 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "eo_tokenizer.h"
+
+int _eo_tokenizer_log_dom = -1;
+
+int main(int argc, char **argv)
+{
+ char *fpath;
+ Eo_Tokenizer *toknz;
+
+ if (argc < 2)
+ {
+ fprintf(stderr, "usage %s input_file\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ fpath = argv[1];
+
+ eina_init();
+
+ eina_log_color_disable_set(EINA_FALSE);
+ _eo_tokenizer_log_dom = eina_log_domain_register("eo_toknz", EINA_COLOR_CYAN);
+
+ if (access(fpath, F_OK) != 0)
+ {
+ ERR("error accessing file %s : %s", fpath, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ toknz = eo_tokenizer_get(fpath);
+ if (!toknz)
+ {
+ ERR("can't create eo_tokenizer");
+ eina_shutdown();
+ exit(EXIT_FAILURE);
+ }
+
+ eo_tokenizer_walk(toknz, fpath);
+
+ eo_tokenizer_free(toknz);
+
+ eina_shutdown();
+
+ return EXIT_SUCCESS;
+}
+