From: Jaakko Heinonen Date: Wed, 9 Oct 2002 13:18:19 +0000 (+0000) Subject: improved options error reporting X-Git-Tag: upstream/0.6.1~2^2~270 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=260365f6312bdbadc5c65ee6aec86e2bfaea1494;p=pkg%2Fabook.git improved options error reporting --- diff --git a/abook.c b/abook.c index d4de3ec..e1a7dac 100644 --- 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); diff --git a/options.c b/options.c index 3947a38..1eed8d4 100644 --- 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; }