diff options
Diffstat (limited to 'mdk-stage1/newt-frontend.c')
| -rw-r--r-- | mdk-stage1/newt-frontend.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/mdk-stage1/newt-frontend.c b/mdk-stage1/newt-frontend.c index 731818a0d..c0489b58d 100644 --- a/mdk-stage1/newt-frontend.c +++ b/mdk-stage1/newt-frontend.c @@ -1,7 +1,7 @@ /* - * Guillaume Cottenceau (gc@mandrakesoft.com) + * Guillaume Cottenceau (gc) * - * Copyright 2000 Mandrakesoft + * Copyright 2000 Mandriva * * This software may be freely redistributed under the terms of the GNU * public license. @@ -24,6 +24,7 @@ * Each different frontend must implement all functions defined in frontend.h */ +#define _GNU_SOURCE #include <stdlib.h> #include <unistd.h> @@ -31,7 +32,7 @@ #include <stdio.h> #include <stdarg.h> #include <sys/time.h> -#include "newt/newt.h" +#include <newt.h> #include <probing.h> @@ -43,12 +44,16 @@ void init_frontend(char * welcome_msg) for (i=0; i<38; i++) printf("\n"); newtInit(); newtCls(); - - newtDrawRootText(0, 0, welcome_msg); - if (welcome_msg[0]) + if (welcome_msg[0]) { + char *msg; + int cols, rows; + newtGetScreenSize(&cols, &rows); + asprintf(&msg, " %-*s", cols - 1, welcome_msg); + newtDrawRootText(0, 0, msg); + free(msg); newtPushHelpLine(" <Alt-F1> for here, <Alt-F3> to see the logs, <Alt-F4> for kernel msg"); - + } newtRefresh(); } @@ -174,7 +179,7 @@ void end_progression_raw(void) enum return_type ask_from_list_index(char *msg, char ** elems, char ** elems_comments, int * answer) { - char * items[500]; + char * items[50000]; int rc; if (elems_comments) { @@ -294,7 +299,7 @@ static int mynewtWinEntries(char * title, char * text, int suggestedWidth, int f for (i = 0; i < numItems; i++) { newtComponent entr = newtEntry(-1, -1, items[i].value ? *items[i].value : NULL, dataWidth, - items[i].value, items[i].flags); + (const char**)items[i].value, items[i].flags); newtGridSetField(subgrid, 0, i, NEWT_GRID_COMPONENT, newtLabel(-1, -1, items[i].text), @@ -356,7 +361,7 @@ enum return_type ask_from_entries(char *msg, char ** questions, char *** answers entries[i].value = NULL; if (*answers == NULL) - *answers = (char **) malloc(sizeof(char *) * i); + *answers = (char **) calloc(1, sizeof(char *) * i); else already_answers = *answers; |
