X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=options.c;h=e9885a98aa9b8e1d5b0e86e70aa60753f390027a;hb=6ef8b9e9bb1470c46fb0188f353020b7595c318d;hp=4e65f5ac10d79e163167dcb0d9a68d4e458537e9;hpb=fa5c9dddc25aeea5f3b42d82b40f13c8aa1137b9;p=pkg%2Fabook.git diff --git a/options.c b/options.c index 4e65f5a..e9885a9 100644 --- a/options.c +++ b/options.c @@ -64,17 +64,19 @@ static struct option abook_vars[] = { { "use_ascii_only", OT_BOOL, BOOL_USE_ASCII_ONLY, FALSE }, + { "add_email_prevent_duplicates", OT_BOOL, BOOL_ADD_EMAIL_PREVENT_DUPLICATES, FALSE }, + { NULL } }; static unsigned char bool_opts[BOOL_MAX]; -static int int_opts[INT_MAX]; +static int int_opts[INT_MAXIMUM]; static char *str_opts[STR_MAX]; static void set_int(enum int_opts opt, int value) { - assert(opt >= 0 && opt < INT_MAX); + assert(opt >= 0 && opt < INT_MAXIMUM); int_opts[opt] = value; } @@ -101,7 +103,7 @@ set_str(enum str_opts opt, char *value) int opt_get_int(enum int_opts opt) { - assert(opt >= 0 && opt < INT_MAX); + assert(opt >= 0 && opt < INT_MAXIMUM); return int_opts[opt]; } @@ -109,7 +111,7 @@ opt_get_int(enum int_opts opt) bool opt_get_bool(enum bool_opts opt) { - assert(opt >= 0 && opt < STR_MAX); + assert(opt >= 0 && opt < BOOL_MAX); return bool_opts[opt]; } @@ -337,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; @@ -352,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); @@ -360,11 +362,6 @@ load_opts(char *filename) free(line); - if(err) { - printf("Press any key to continue...\n"); - fgetc(stdin); - } - return err; }