summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-11-25 09:07:35 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-11-25 09:07:35 +0100
commitf1b53db468e6e5fba2d672cde32cc5c5f091972b (patch)
tree444b546955ab1a2fd70c15676de2063069ba6fcc
parent2d7eeb7fc0fedc73e9fdb9ef46ee1df98d0f729e (diff)
downloadeo_tokenizer-f1b53db468e6e5fba2d672cde32cc5c5f091972b.zip
eo_tokenizer-f1b53db468e6e5fba2d672cde32cc5c5f091972b.tar.gz
support FILE... as input args
-rw-r--r--main.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/main.c b/main.c
index 12ba6ee..a45a32f 100644
--- a/main.c
+++ b/main.c
@@ -9,40 +9,41 @@ int _eo_tokenizer_log_dom = -1;
int main(int argc, char **argv)
{
+ int i;
char *fpath;
Eo_Tokenizer *toknz;
if (argc < 2)
{
- fprintf(stderr, "usage %s input_file\n", argv[0]);
+ fprintf(stderr, "usage: %s 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)
+ for (i = 1; i < argc; i++)
{
- ERR("error accessing file %s : %s", fpath, strerror(errno));
- exit(EXIT_FAILURE);
+ toknz = eo_tokenizer_get();
+ if (!toknz)
+ {
+ ERR("can't create eo_tokenizer");
+ eina_shutdown();
+ exit(EXIT_FAILURE);
+ }
+
+ fpath = argv[i];
+ if (access(fpath, F_OK) != 0)
+ {
+ ERR("error accessing file %s : %s", fpath, strerror(errno));
+ continue;
+ }
+ eo_tokenizer_walk(toknz, fpath);
+
+ eo_tokenizer_free(toknz);
}
- toknz = eo_tokenizer_get();
- 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;