]> git.deb.at Git - pkg/abook.git/commitdiff
improved options error reporting
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Wed, 9 Oct 2002 13:18:19 +0000 (13:18 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Wed, 9 Oct 2002 13:18:19 +0000 (13:18 +0000)
abook.c
options.c

diff --git a/abook.c b/abook.c
index d4de3ec5679d71620fa311c790998618ec03072e..e1a7dac67aebdf0a5788cec3dc22321ac2329a37 100644 (file)
--- a/abook.c
+++ b/abook.c
@@ -104,7 +104,10 @@ init_abook()
        set_filenames();
        check_abook_directory();
        init_opts();
-       load_opts(rcfile);
+       if(load_opts(rcfile)) {
+               printf("Press enter to continue...\n");
+               fgetc(stdin);
+       }
 
        signal(SIGKILL, quit_abook_sig);
        signal(SIGTERM, quit_abook_sig);
index 3947a38a959855a5621c4673c00bafbb8b198033..1eed8d489aa885da960c82236da8d9f6a6a8d5d2 100644 (file)
--- a/options.c
+++ b/options.c
@@ -339,7 +339,7 @@ load_opts(char *filename)
        FILE *in;
        char *line = NULL;
        int n;
-       bool err = FALSE;
+       int err = 0;
        
        if((in = fopen(filename, "r")) == NULL)
                return -1;
@@ -354,7 +354,7 @@ load_opts(char *filename)
                if(line && *line) {
                        opt_line_remove_comments(line);
                        if(*line)
-                               err = opt_parse_line(line, n, filename);
+                               err += opt_parse_line(line, n, filename) ? 1:0;
                }
 
                my_free(line);
@@ -362,11 +362,6 @@ load_opts(char *filename)
 
        free(line);
 
-       if(err) {
-               printf("Press enter to continue...\n");
-               fgetc(stdin);
-       }
-       
        return err;
 }