--- src/cli/report.c | 41 ++++++++++++++++++++++++++--------------- 1 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/src/cli/report.c b/src/cli/report.c index f2c2380..1e2eec9 100644 --- a/src/cli/report.c +++ b/src/cli/report.c @@ -745,30 +745,41 @@ int report(const char *dump_dir_name, int flags) else { const char *rating_str = get_crash_item_content_or_NULL(crash_data, FILENAME_RATING); - unsigned rating = rating_str ? xatou(rating_str) : 4; + unsigned i, rating = rating_str ? xatou(rating_str) : 4; + GList *li; + char wanted_reporters[255];
- /* For every reporter, ask if user really wants to report using it. */ - for (GList *li = report_events; li; li = li->next) + puts(_("Available reporters:")); + /* Print list of reporters and ask the user which should be used. */ + for (li = report_events, i = 1; li; li = li->next, i++) { char *reporter_name = (char *) li->data; event_config_t *config = get_event_config(reporter_name); - char question[255]; - char *show_reporter_name; - if (config) - show_reporter_name = (config->screen_name) ? config->screen_name : reporter_name; - else - show_reporter_name = reporter_name;
- snprintf(question, sizeof(question), _("Report using %s?"), show_reporter_name); + printf("%d) %s\n", i, (config && config->screen_name) ? config->screen_name : reporter_name); + } + + read_from_stdin(_("Which reporter(s) do you want to use? "), wanted_reporters, sizeof(wanted_reporters)); + + for (li = report_events, i = 1; li; li = li->next, i++) + { + char *reporter_name = (char *) li->data; + event_config_t *config = get_event_config(reporter_name); + char reporter_number[10], *c; + int len;
if (!config) VERB1 log("No configuration file found for '%s' reporter", reporter_name); - - if (!ask_yesno(question)) - { - puts(_("Skipping...")); - continue; + + /* Was this reporter requested? */ + len = snprintf(reporter_number, sizeof(reporter_number), "%d", i); + for (c = wanted_reporters; *c; c++) { + c = strstr(c, reporter_number); + if (!c || ((c == wanted_reporters || !isdigit(c[-1])) && !isdigit(c[len]))) + break; } + if (!c || !*c) + continue;
/* TODO: npajkovs; not implemented yet */ //const char *rating_required = get_map_string_item_or_NULL(single_plugin_settings, "RatingRequired");