diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | config.mak | 7 | ||||
-rw-r--r-- | src/cli/Makefile.am | 6 | ||||
-rw-r--r-- | src/cli/report.c | 78 | ||||
-rw-r--r-- | src/plugins/Makefile.am | 6 |
5 files changed, 72 insertions, 31 deletions
@@ -111,6 +111,9 @@ po/stamp-it po/*.gmo po/.intltool-merge-cache +# generaged translated xml conf files +*.xml + # compiled python files *.pyc @@ -122,6 +125,9 @@ abrt.spec # autogenerated soure file src/gui-wizard-gtk/wizard_glade.c +# generated man pages +*.1 + # if you want to enable them, be aware of that 'git clean -df' won't clean them # and you have to do it *manually* # x86_64/ diff --git a/config.mak b/config.mak new file mode 100644 index 00000000..eb56606d --- /dev/null +++ b/config.mak @@ -0,0 +1,7 @@ +ASCIIDOC_SILENT = $(ASCIIDOC_SILENT_$(V)) +ASCIIDOC_SILENT_ = $(ASCIIDOC_SILENT_$(AM_DEFAULT_VERBOSITY)) +ASCIIDOC_SILENT_0 = @echo ASCIIDOC $@; + +XMLTO_SILENT = $(XMLTO_SILENT_$(V)) +XMLTO_SILENT_ = $(XMLTO_SILENT_$(AM_DEFAULT_VERBOSITY)) +XMLTO_SILENT_0 = @echo " XMLTO " $@; diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am index a7597ad6..fa28a2bb 100644 --- a/src/cli/Makefile.am +++ b/src/cli/Makefile.am @@ -1,3 +1,5 @@ +-include ../../config.mak + bin_PROGRAMS = \ abrt-handle-crashdump \ abrt-cli @@ -48,10 +50,10 @@ MAN_TXT = \ man1_MANS = ${MAN_TXT:%.txt=%.1} %.1 %.5 %.7: %.xml - xmlto man $< + $(XMLTO_SILENT) xmlto man $< > /dev/null 2>&1 %.xml: %.txt ../../asciidoc.conf - asciidoc --backend=docbook --doctype=manpage --conf-file ../../asciidoc.conf -aabrt_version=$(PACKAGE_VERSION) -o $@ $< + $(ASCIIDOC_SILENT) asciidoc --backend=docbook --doctype=manpage --conf-file ../../asciidoc.conf -aabrt_version=$(PACKAGE_VERSION) -o $@ $< CLEANFILES = $(man1_MANS) diff --git a/src/cli/report.c b/src/cli/report.c index 96bf0062..93d1abd9 100644 --- a/src/cli/report.c +++ b/src/cli/report.c @@ -422,6 +422,31 @@ static bool set_echo(bool enable) return true; } +/* Returns true if the string contains the specified number. */ +static bool is_number_in_string(unsigned number, const char *str) +{ + const char *c; + char numstr[sizeof(int) * 3 + 2]; + int len; + + len = snprintf(numstr, sizeof(numstr), "%u", number); + for (c = str; *c; c++) + { + c = strstr(c, numstr); + if (!c) + /* no such number exists in the string */ + return false; + if ((c == str || !isalnum(c[-1])) && !isalnum(c[len])) + /* found */ + return true; + + /* found, but it's part of another number. Continue + * from the next position. */ + } + + return false; +} + /** * Asks user for missing information */ @@ -584,12 +609,12 @@ char *select_event_option(GList *list_options) if (!list_options) return NULL; - unsigned count = g_list_length(list_options) - 1; - if (!count) - return NULL; + unsigned count = g_list_length(list_options); + if (count == 1) + return xstrdup((char*)list_options->data); - int pos = -1; - fprintf(stdout, _("Select how you would like to analyze the problem:\n")); + int pos = 0; + fprintf(stdout, _("How you would like to analyze the problem?\n")); for (GList *li = list_options; li; li = li->next) { char *opt = (char*)li->data; @@ -605,14 +630,9 @@ char *select_event_option(GList *list_options) unsigned ii; for (ii = 0; ii < 3; ++ii) { - fprintf(stdout, _("Choose option [0 - %u]: "), count); - fflush(NULL); - char answer[16]; - if (!fgets(answer, sizeof(answer), stdin)) - continue; - answer[strlen(answer) - 1] = '\0'; + read_from_stdin(_("Select analyzer: "), answer, sizeof(answer)); if (!*answer) continue; @@ -620,6 +640,7 @@ char *select_event_option(GList *list_options) if (picked > count) { fprintf(stdout, _("You have chosen number out of range")); + fprintf(stdout, "\n"); continue; } @@ -629,7 +650,7 @@ char *select_event_option(GList *list_options) if (ii == 3) error_msg_and_die(_("Invalid input, program exiting...")); - GList *choosen = g_list_nth(list_options, picked); + GList *choosen = g_list_nth(list_options, picked - 1); return xstrdup((char*)choosen->data); } @@ -744,30 +765,33 @@ int report(const char *dump_dir_name, int flags) else { const char *rating_str = get_problem_item_content_or_NULL(problem_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(_("How would you like to report the problem?")); + /* 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(_("Select reporter(s): "), 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); if (!config) VERB1 log("No configuration file found for '%s' reporter", reporter_name); - - if (!ask_yesno(question)) - { - puts(_("Skipping...")); + + /* Was this reporter requested? */ + if (!is_number_in_string(i, wanted_reporters)) continue; - } /* TODO: npajkovs; not implemented yet */ //const char *rating_required = get_map_string_item_or_NULL(single_plugin_settings, "RatingRequired"); diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index bf7cf966..bfa60903 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -1,3 +1,5 @@ +-include ../../config.mak + pluginslibdir = $(PLUGINS_LIB_DIR) bin_SCRIPTS = \ @@ -71,10 +73,10 @@ MAN_TXT = \ man1_MANS = ${MAN_TXT:%.txt=%.1} %.1 %.5 %.7: %.xml - xmlto man $< + $(XMLTO_SILENT) xmlto man $< > /dev/null 2>&1 %.xml: %.txt ../../asciidoc.conf - asciidoc --backend=docbook --doctype=manpage --conf-file ../../asciidoc.conf -aabrt_version=$(PACKAGE_VERSION) -o $@ $< + $(ASCIIDOC_SILENT) asciidoc --backend=docbook --doctype=manpage --conf-file ../../asciidoc.conf -aabrt_version=$(PACKAGE_VERSION) -o $@ $< CLEANFILES = $(man1_MANS) |