summaryrefslogtreecommitdiffstats
path: root/fcomp.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2019-03-21 16:42:34 +0200
committergramanas <anastasis.gramm2@gmail.com>2019-03-21 16:51:59 +0200
commit725d97bba026e8916d928d96c77b1d6c3743a98c (patch)
treec7f230824732f1d557040f9716201ba98897bc54 /fcomp.c
parent90dc7b2d2f19944b5be9b19175db14a7ece35c99 (diff)
downloadfcomp-725d97bba026e8916d928d96c77b1d6c3743a98c.tar.gz
fcomp-725d97bba026e8916d928d96c77b1d6c3743a98c.tar.bz2
fcomp-725d97bba026e8916d928d96c77b1d6c3743a98c.zip
Emacs frontend now bugfree (hopefuly)
and a small bugfix with the -F option
Diffstat (limited to 'fcomp.c')
-rw-r--r--fcomp.c8
1 files changed, 5 insertions, 3 deletions
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;
}