diff options
Diffstat (limited to 'mdk-stage1/newt-frontend.c')
-rw-r--r-- | mdk-stage1/newt-frontend.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c index 494751d90..6d55c9ab7 100644 --- a/mdk-stage1/newt-frontend.c +++ b/mdk-stage1/newt-frontend.c @@ -242,6 +242,7 @@ enum return_type ask_from_entries(char *msg, char ** questions, char *** answers struct newtWinEntry entries[50]; int j, i = 0; int rc; + char ** already_answers = NULL; while (questions && *questions) { entries[i].text = *questions; @@ -252,11 +253,18 @@ enum return_type ask_from_entries(char *msg, char ** questions, char *** answers entries[i].text = NULL; entries[i].value = NULL; - *answers = (char **) malloc(sizeof(char *) * i); + if (*answers == NULL) + *answers = (char **) malloc(sizeof(char *) * i); + else + already_answers = *answers; for (j = 0 ; j < i ; j++) { entries[j].value = &((*answers)[j]); - *(entries[j].value) = NULL; + if (already_answers && *already_answers) { + *(entries[j].value) = *already_answers; + already_answers++; + } else + *(entries[j].value) = NULL; } rc = newtWinEntries("Please fill entries...", msg, 52, 5, 5, entry_size, entries, "Ok", "Cancel", NULL); |