Consolidate error/warning output code

This commit is contained in:
Ian Barwick
2017-06-22 09:04:16 +09:00
parent d77736329a
commit 82c9b365ed

View File

@@ -177,13 +177,9 @@ parse_config(t_configuration_options *options, bool terse)
if (terse == false && config_warnings.head != NULL) if (terse == false && config_warnings.head != NULL)
{ {
ItemListCell *cell;
log_warning(_("the following problems were found in the configuration file:")); log_warning(_("the following problems were found in the configuration file:"));
for (cell = config_warnings.head; cell; cell = cell->next)
{ print_item_list(&config_warnings);
fprintf(stderr, " %s\n", cell->string);
}
} }
return true; return true;
@@ -651,24 +647,16 @@ reload_config(t_configuration_options *orig_options)
static void static void
exit_with_config_file_errors(ItemList *config_errors, ItemList *config_warnings, bool terse) exit_with_config_file_errors(ItemList *config_errors, ItemList *config_warnings, bool terse)
{ {
ItemListCell *cell;
log_error(_("following errors were found in the configuration file:")); log_error(_("following errors were found in the configuration file:"));
for (cell = config_errors->head; cell; cell = cell->next) print_item_list(config_errors);
{
fprintf(stderr, " %s\n", cell->string);
}
if (terse == false && config_warnings->head != NULL) if (terse == false && config_warnings->head != NULL)
{ {
puts(""); puts("");
log_warning(_("the following problems were also found in the configuration file:")); log_warning(_("the following problems were also found in the configuration file:"));
for (cell = config_warnings->head; cell; cell = cell->next)
{ print_item_list(config_warnings);
fprintf(stderr, " %s\n", cell->string);
}
} }
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);