summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-04-25 14:41:26 +0000
committerOlivier Blin <oblin@mandriva.com>2007-04-25 14:41:26 +0000
commitb214349247d85764ae1b0b982c09f12ab6fd0bcb (patch)
tree53f4a24b35f6e0c79a11dd847551703a98076436
parentd518e4b3a4ee5121c3b115ac8968bbf5384d8948 (diff)
downloaddrakx-b214349247d85764ae1b0b982c09f12ab6fd0bcb.tar
drakx-b214349247d85764ae1b0b982c09f12ab6fd0bcb.tar.gz
drakx-b214349247d85764ae1b0b982c09f12ab6fd0bcb.tar.bz2
drakx-b214349247d85764ae1b0b982c09f12ab6fd0bcb.tar.xz
drakx-b214349247d85764ae1b0b982c09f12ab6fd0bcb.zip
add generic ask_from_list_comments() and ask_from_list() implementation using the index returned by ask_from_list_index()
-rw-r--r--mdk-stage1/frontend-common.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/mdk-stage1/frontend-common.c b/mdk-stage1/frontend-common.c
index a66db457a..6ea2984cd 100644
--- a/mdk-stage1/frontend-common.c
+++ b/mdk-stage1/frontend-common.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdarg.h>
+#include <string.h>
#include <probing.h>
@@ -43,3 +44,21 @@ void error_message(char *msg, ...)
verror_message(msg, args);
va_end(args);
}
+
+enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_comments, char ** choice)
+{
+ int answer = 0;
+ enum return_type results;
+
+ results = ask_from_list_index(msg, elems, elems_comments, &answer);
+
+ if (results == RETURN_OK)
+ *choice = strdup(elems[answer]);
+
+ return results;
+}
+
+enum return_type ask_from_list(char *msg, char ** elems, char ** choice)
+{
+ return ask_from_list_comments(msg, elems, NULL, choice);
+}