summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/stdio-frontend.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-04-30 17:23:04 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-04-30 17:23:04 +0000
commit324ebed124c5b0f78a1e343fbbd6ee41c2814b49 (patch)
treea7ef301fd2b693090efc71ad725bd33ecfc589f4 /mdk-stage1/stdio-frontend.c
parenta0252e4b88e646f21e649a64124870f265b7c45c (diff)
downloaddrakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar.gz
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar.bz2
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.tar.xz
drakx-backup-do-not-use-324ebed124c5b0f78a1e343fbbd6ee41c2814b49.zip
Provide some description of the drivers
Diffstat (limited to 'mdk-stage1/stdio-frontend.c')
-rw-r--r--mdk-stage1/stdio-frontend.c78
1 files changed, 21 insertions, 57 deletions
diff --git a/mdk-stage1/stdio-frontend.c b/mdk-stage1/stdio-frontend.c
index a8622bf1c..ec6601e9c 100644
--- a/mdk-stage1/stdio-frontend.c
+++ b/mdk-stage1/stdio-frontend.c
@@ -254,25 +254,38 @@ void end_progression(void)
enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_comments, char ** choice)
{
char ** sav_elems = elems;
- int i, j;
+ int i = 1;
+ int j = 0;
+
+ printf("> %s\n[ 0] Cancel", msg);
- printf("> %s\n(0) Cancel\n", msg);
- i = 1;
while (elems && *elems) {
- printf("(%d) %s (%s)\n", i, *elems, *elems_comments);
+ if (elems_comments && *elems_comments) {
+ printf("\n[%2d] %s (%s)", i, *elems, *elems_comments);
+ j = 0;
+ } else {
+ if (j == 0)
+ printf("\n");
+ printf("[%2d] %-14s ", i, *elems);
+ j++;
+ }
+ if (j == 4)
+ j = 0;
+
+ if (elems_comments)
+ elems_comments++;
i++;
elems++;
- elems_comments++;
}
- printf("? ");
+ printf("\n? ");
j = get_int_response();
if (j == 0)
return RETURN_BACK;
- if (j >= 1 && j < i) {
+ if (j >= 1 && j <= i) {
*choice = strdup(sav_elems[j-1]);
return RETURN_OK;
}
@@ -283,56 +296,7 @@ enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_
enum return_type ask_from_list(char *msg, char ** elems, char ** choice)
{
- char ** sav_elems = elems;
- int i, j;
-
- i = 0;
- while (elems && *elems) {
- i++;
- elems++;
- }
-
- if (i < 10) {
- printf("> %s\n(0) Cancel\n", msg);
- for (j=0; j<i; j++)
- printf("(%d) %s\n", j+1, sav_elems[j]);
- }
- else {
- printf("> %s\n( 0) Cancel\n", msg);
- if (i < 20)
- for (j=0; j<i; j++)
- printf("(%2d) %s\n", j+1, sav_elems[j]);
- else {
- if (i < 40)
- for (j=0; j<i-1; j += 2)
- printf("(%2d) %-34s (%2d) %s\n", j+1, sav_elems[j], j+2, sav_elems[j+1]);
- else
- for (j=0; j<i-3; j += 4)
- printf("(%2d) %-14s (%2d) %-14s (%2d) %-14s (%2d) %s\n",
- j+1, sav_elems[j], j+2, sav_elems[j+1], j+3, sav_elems[j+2], j+4, sav_elems[j+3]);
- if (j < i) {
- while (j < i) {
- printf("(%2d) %-14s ", j+1, sav_elems[j]);
- j++;
- }
- printf("\n");
- }
- }
- }
-
- printf("? ");
-
- j = get_int_response();
-
- if (j == 0)
- return RETURN_BACK;
-
- if (j >= 1 && j <= i) {
- *choice = strdup(sav_elems[j-1]);
- return RETURN_OK;
- }
-
- return RETURN_ERROR;
+ return ask_from_list_comments(msg, elems, NULL, choice);
}