From 324ebed124c5b0f78a1e343fbbd6ee41c2814b49 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 30 Apr 2001 17:23:04 +0000 Subject: Provide some description of the drivers --- mdk-stage1/stdio-frontend.c | 78 ++++++++++++--------------------------------- 1 file changed, 21 insertions(+), 57 deletions(-) (limited to 'mdk-stage1/stdio-frontend.c') 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 %s\n( 0) Cancel\n", msg); - if (i < 20) - for (j=0; 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); } -- cgit v1.2.1