From e69985db3b702556521dadf52aa6aa78cb669625 Mon Sep 17 00:00:00 2001 From: Albert Cahalan Date: Sat, 21 Nov 2009 03:39:50 +0000 Subject: [PATCH] report conflicting options --- src/parse.gperf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/parse.gperf b/src/parse.gperf index 506ef2c1e..e16546807 100644 --- a/src/parse.gperf +++ b/src/parse.gperf @@ -226,5 +226,17 @@ void parse_one_option(struct cfginfo *restrict tmpcfg, const char *str, const ch } unsigned offset = uintptr &~ FLAGMASK; + + char *dupecheck; + memcpy(&dupecheck, offset+(char*)tmpcfg, sizeof(char*)); + if(dupecheck) + { + if(src) + printf("Option '%s' in config file '%s' sets '%s' again.\n",str,src,cfg->name); + else + printf("Command line option '--%s' sets '%s' again.\n",str,cfg->name); + exit(53); + } + memcpy(offset+(char*)tmpcfg, &opt, sizeof(char*)); }