]> thyrsus.com Git - comparator.git/commitdiff
Complain when you can't open an scf file.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 16 Sep 2003 04:48:41 +0000 (04:48 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 16 Sep 2003 04:48:41 +0000 (04:48 +0000)
main.c

diff --git a/main.c b/main.c
index 50a1bd8b8a619d6f984637a32cfcee4b9de345fb..43fcac86b0ecd334b44e4598e54ba51cf643afd1 100644 (file)
--- a/main.c
+++ b/main.c
@@ -291,6 +291,11 @@ static void init_scf(char *file, struct scf_t *scf, const int readfile)
 
        /* read in the SCF metadata block and add it to the in-core list */
        scf->fp   = fopen(scf->name, "r");
+       if (!scf->fp)
+       {
+           fprintf(stderr, "comparator: file %s, %s", scf->name, strerror(errno));
+           exit(1);
+       }
        fgets(buf, sizeof(buf), scf->fp);
        if (strncmp(buf, "#SCF-A 2.0", 9))
        {
@@ -494,16 +499,7 @@ main(int argc, char *argv[])
        scflist = scf;
 
        if (is_scf_file(source))
-       {
-           if (dir)
-           {
-               olddir = getcwd(NULL, 0);       /* may fail off Linux */
-               chdir(dir);
-           }
            init_scf(source, scf, 1);
-           if (dir)
-               chdir(olddir);
-       }
        else if (compile_only)
        {
            FILE        *ofp;