From 5968d267af06efed88b99fcf3492e482964f0f2e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 12 Sep 2003 09:11:35 +0000 Subject: [PATCH] Almost to statistics. --- main.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 9a05f96..d51add5 100644 --- a/main.c +++ b/main.c @@ -466,6 +466,10 @@ main(int argc, char *argv[]) { char *olddir, *source = argv[optind]; + scf = (struct scf_t *)calloc(sizeof(struct scf_t), 1); + scf->next = scflist; + scflist = scf; + if (is_scf_file(source)) { if (dir) @@ -473,10 +477,7 @@ main(int argc, char *argv[]) olddir = getcwd(NULL, 0); /* may fail off Linux */ chdir(dir); } - scf = (struct scf_t *)malloc(sizeof(struct scf_t)); init_scf(source, scf); - scf->next = scflist; - scflist = scf; if (dir) chdir(olddir); } @@ -526,6 +527,9 @@ main(int argc, char *argv[]) /* consistency checks on the SCFs */ for (scf = scflist; scf->next->next; scf = scf->next) { + if (!scf->fp) + continue; + if (strcmp(scf->normalization, scf->next->normalization)) { fprintf(stderr, @@ -552,10 +556,11 @@ main(int argc, char *argv[]) /* finish reading in all SCFs */ for (scf = scflist; scf->next; scf = scf->next) - { - read_scf(scf); - fclose(scf->fp); - } + if (scf->fp) + { + read_scf(scf); + fclose(scf->fp); + } } -- 2.43.0