diff options
author | Miroslav Lichvar <mlichvar@redhat.com> | 2011-04-19 16:07:47 +0200 |
---|---|---|
committer | Miroslav Lichvar <mlichvar@redhat.com> | 2011-05-05 17:16:00 +0200 |
commit | 0159b489446bada0a8c8bbbabef9a443b4a21fe1 (patch) | |
tree | 874da85cbbae38405da38db0e2b8dea2a8f9d668 /src/cli | |
parent | afa3ecbd33fe6a6d13255255076ecc1ba90a9926 (diff) | |
download | abrt-0159b489446bada0a8c8bbbabef9a443b4a21fe1.tar.gz abrt-0159b489446bada0a8c8bbbabef9a443b4a21fe1.tar.xz abrt-0159b489446bada0a8c8bbbabef9a443b4a21fe1.zip |
abrt-cli: improve analyzer selection dialog
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/report.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/cli/report.c b/src/cli/report.c index 989fb0f5..93d1abd9 100644 --- a/src/cli/report.c +++ b/src/cli/report.c @@ -609,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) + 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; @@ -630,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; @@ -645,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; } @@ -654,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); } |