From 260365f6312bdbadc5c65ee6aec86e2bfaea1494 Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Wed, 9 Oct 2002 13:18:19 +0000 Subject: [PATCH 1/1] improved options error reporting --- abook.c | 5 ++++- options.c | 9 ++------- 2 files changed, 6 insertions(+), 8 deletions(-) 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; } -- 2.39.2