From 725d97bba026e8916d928d96c77b1d6c3743a98c Mon Sep 17 00:00:00 2001 From: gramanas Date: Thu, 21 Mar 2019 16:42:34 +0200 Subject: Emacs frontend now bugfree (hopefuly) and a small bugfix with the -F option --- fcomp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fcomp.c') diff --git a/fcomp.c b/fcomp.c index a466283..a41c75d 100644 --- a/fcomp.c +++ b/fcomp.c @@ -161,7 +161,7 @@ static void print_help(char *argv0) "Set extra invalid chars for tokens"); fprintf(stderr, "%8s %4s %15s %50s\n", "-w", "[..]", "word length", "Set min word length to count as token"); - fprintf(stderr, "%8s %4s %15s %50s\n\n", "-t", "[..]", "toekn length", + fprintf(stderr, "%8s %4s %15s %50s\n\n", "-t", "[..]", "token length", "Set max token length to parse"); fprintf(stderr, "%8s %4s %15s %50s\n", "-d", "", "debug", "Show debug information"); @@ -739,6 +739,8 @@ static int set_input(FILE **f) } *f = stdin; } else if (cfg.filestream) { + if (!cfg.file || strcmp(cfg.file, "") == 0) + return -1; *f = fmemopen(cfg.file, strlen(cfg.file), "r"); } else { *f = fopen(cfg.file, "r"); @@ -767,7 +769,7 @@ static void get_uniq(slist * l, result *r) int main(int argc, char *argv[]) { int rc = 0; - FILE *f; + FILE *f = NULL; slist token_list = { 0 }; slist ref_list = { 0 }; slist *listp = NULL; @@ -831,6 +833,6 @@ int main(int argc, char *argv[]) done: sfree(&token_list); - fclose(f); + if (f) fclose(f); return rc; } -- cgit v1.2.3