cfgfile and line variables make no sense as the function optadditem() exists to allow library users to set options programmatically without a config file.
Micah Snyder authored on 2018/07/30 06:52:52... | ... |
@@ -1169,9 +1169,8 @@ struct optstruct *optparse(const char *cfgfile, int argc, char **argv, int verbo |
1169 | 1169 |
struct optstruct *optadditem(const char *name, const char *arg, int verbose, int toolmask, int ignore, |
1170 | 1170 |
struct optstruct *oldopts) |
1171 | 1171 |
{ |
1172 |
- int i, err = 0, sc = 0, lc=0, line = 0, ret; |
|
1172 |
+ int i, err = 0, sc = 0, lc=0, ret; |
|
1173 | 1173 |
struct optstruct *opts = NULL, *opts_last = NULL, *opt; |
1174 |
- static char cfgfile[] = "(optadditem-api)"; |
|
1175 | 1174 |
char *buff; |
1176 | 1175 |
regex_t regex; |
1177 | 1176 |
long long numarg, lnumarg; |
... | ... |
@@ -1213,7 +1212,7 @@ struct optstruct *optadditem(const char *name, const char *arg, int verbose, int |
1213 | 1213 |
opt = optget_i(opts, name); |
1214 | 1214 |
if(!opt) { |
1215 | 1215 |
if(verbose) |
1216 |
- fprintf(stderr, "ERROR: Parse error at %s:%d: Unknown option %s\n", cfgfile, line, name); |
|
1216 |
+ fprintf(stderr, "ERROR: Parse error: Unknown option %s\n", name); |
|
1217 | 1217 |
err = 1; |
1218 | 1218 |
break; |
1219 | 1219 |
} |
... | ... |
@@ -1221,7 +1220,7 @@ struct optstruct *optadditem(const char *name, const char *arg, int verbose, int |
1221 | 1221 |
|
1222 | 1222 |
if(ignore && (optentry->owner & ignore) && !(optentry->owner & toolmask)) { |
1223 | 1223 |
if(verbose) |
1224 |
- fprintf(stderr, "WARNING: Ignoring unsupported option %s at %s:%d\n", opt->name, cfgfile, line); |
|
1224 |
+ fprintf(stderr, "WARNING: Ignoring unsupported option %s\n", opt->name); |
|
1225 | 1225 |
continue; |
1226 | 1226 |
} |
1227 | 1227 |
|
... | ... |
@@ -1234,7 +1233,7 @@ struct optstruct *optadditem(const char *name, const char *arg, int verbose, int |
1234 | 1234 |
} |
1235 | 1235 |
} else { |
1236 | 1236 |
if(verbose) |
1237 |
- fprintf(stderr, "WARNING: Ignoring deprecated option %s at %s:%d\n", opt->name, cfgfile, line); |
|
1237 |
+ fprintf(stderr, "WARNING: Ignoring deprecated option %s\n", opt->name); |
|
1238 | 1238 |
} |
1239 | 1239 |
continue; |
1240 | 1240 |
} |