Signed-off-by: Wei Xing <skyxwwalker@gmail.com>
Co-authored-by: Wei Xing <skyxwwalker@gmail.com>
if ((p = (struct map2id_s *)malloc(sizeof(*p))) == NULL) {
novm("rc_read_mapfile");
if ((p = (struct map2id_s *)malloc(sizeof(*p))) == NULL) {
novm("rc_read_mapfile");
} else {
error("rc_read_mapfile: malformed line in %s, line %d", filename, lnr);
} else {
error("rc_read_mapfile: malformed line in %s, line %d", filename, lnr);
if ((pos = strcspn(p, "\t ")) == 0) {
error("%s: line %d: bogus format: %s", filename, line, p);
if ((pos = strcspn(p, "\t ")) == 0) {
error("%s: line %d: bogus format: %s", filename, line, p);
if (option->status != ST_UNDEF) {
error("%s: line %d: duplicate option line: %s", filename, line, p);
if (option->status != ST_UNDEF) {
error("%s: line %d: duplicate option line: %s", filename, line, p);
switch (option->type) {
case OT_STR:
if (set_option_str(filename, line, option, p) < 0)
switch (option->type) {
case OT_STR:
if (set_option_str(filename, line, option, p) < 0)
return (-1);
break;
case OT_INT:
if (set_option_int(filename, line, option, p) < 0)
return (-1);
break;
case OT_INT:
if (set_option_int(filename, line, option, p) < 0)
return (-1);
break;
case OT_SRV:
if (set_option_srv(filename, line, option, p) < 0)
return (-1);
break;
case OT_SRV:
if (set_option_srv(filename, line, option, p) < 0)
return (-1);
break;
case OT_AUO:
if (set_option_auo(filename, line, option, p) < 0)
return (-1);
break;
case OT_AUO:
if (set_option_auo(filename, line, option, p) < 0)
return (-1);
break;
default:
return (-1);
break;
default: