From ac85456797b8074dad5c1af1bb141abb9206d6ec Mon Sep 17 00:00:00 2001 From: jkh Date: Wed, 29 Jan 1997 21:16:07 +0000 Subject: Fix broken layout help (this is what broke the TCP help screen). Allow DITEM_NO_ECHO to be encoded in layout field types and make user.c use it for the password item. --- release/sysinstall/misc.c | 19 +++++++++++-------- release/sysinstall/sysinstall.h | 4 ++++ release/sysinstall/user.c | 40 ++++++++++++++++++++-------------------- 3 files changed, 35 insertions(+), 28 deletions(-) (limited to 'release') diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c index 19fd9de..e7d4063 100644 --- a/release/sysinstall/misc.c +++ b/release/sysinstall/misc.c @@ -347,18 +347,17 @@ Mount(char *mountp, void *dev) WINDOW * openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height) { - WINDOW *win; - char help[FILENAME_MAX]; - + WINDOW *win; + static char help[FILENAME_MAX]; + /* We need a curses window */ win = newwin(LINES, COLS, 0, 0); if (win) { /* Say where our help comes from */ if (helpfile) { - systemHelpFile(helpfile, help); - use_helpfile(help); + use_helpline("Press F1 for more information on this screen."); + use_helpfile(systemHelpFile(helpfile, help)); } - /* Setup a nice screen for us to splat stuff onto */ draw_box(win, y, x, height, width, dialog_attr, border_attr); wattrset(win, dialog_attr); @@ -378,10 +377,13 @@ initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max) n = 0; while (layout[n].help != NULL) { - switch (layout[n].type) { + int t = TYPE_OF_OBJ(layout[n].type); + + switch (t) { case STRINGOBJ: layout[n].obj = NewStringObj(win, layout[n].prompt, layout[n].var, layout[n].y + y, layout[n].x + x, layout[n].len, layout[n].maxlen); + ((StringObj *)layout[n].obj)->attr_mask = ATTR_OF_OBJ(layout[n].type); break; case BUTTONOBJ: @@ -391,7 +393,7 @@ initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max) default: msgFatal("Don't support this object yet!"); } - AddObj(&obj, layout[n].type, (void *) layout[n].obj); + AddObj(&obj, t, (void *) layout[n].obj); n++; } *max = n - 1; @@ -412,6 +414,7 @@ layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj, int *n, int max, help_line[i] = '\0'; use_helpline(help_line); display_helpline(win, LINES - 1, COLS - 1); + wrefresh(win); /* Ask for libdialog to do its stuff */ ret = PollObj(obj); diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 1704887..4ed2476 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -186,6 +186,10 @@ typedef struct _variable { char *value; } Variable; +#define NO_ECHO_OBJ(type) ((type) | (DITEM_NO_ECHO << 16)) +#define TYPE_OF_OBJ(type) ((type) & 0xff) +#define ATTR_OF_OBJ(type) ((type) >> 16) + /* A screen layout structure */ typedef struct _layout { int y; /* x & Y co-ordinates */ diff --git a/release/sysinstall/user.c b/release/sysinstall/user.c index 6c42ecc..f3006e3 100644 --- a/release/sysinstall/user.c +++ b/release/sysinstall/user.c @@ -122,7 +122,7 @@ static Layout userLayout[] = { #define LAYOUT_PASSWD 3 { 3, 43, 15, PASSWD_FIELD_LEN - 1, "Password:", "The password for this user (enter this field with care!)", - passwd, STRINGOBJ, NULL }, + passwd, NO_ECHO_OBJ(STRINGOBJ), NULL }, #define LAYOUT_GECOS 4 { 8, 6, 33, GECOS_FIELD_LEN - 1, "Full name:", "The user's full name (comment)", @@ -368,15 +368,15 @@ userAddGroup(dialogMenuItem *self) reenter: cancelbutton = okbutton = 0; - while (layoutDialogLoop(ds_win, groupLayout, &obj, &n, max, &cancelbutton, &cancel)) { - if (firsttime && n == LAYOUT_GNAME) { - /* fill in the blanks, well, just the GID */ - completeGroup(); - RefreshStringObj(groupLayout[LAYOUT_GID].obj); - firsttime = FALSE; - } + if (firsttime) { + /* fill in the blanks, well, just the GID */ + completeGroup(); + RefreshStringObj(groupLayout[LAYOUT_GID].obj); + firsttime = FALSE; } + while (layoutDialogLoop(ds_win, groupLayout, &obj, &n, max, &cancelbutton, &cancel)); + if (!cancel && !verifyGroupSettings()) goto reenter; @@ -693,20 +693,20 @@ userAddUser(dialogMenuItem *self) reenter: cancelbutton = okbutton = 0; - while (layoutDialogLoop(ds_win, userLayout, &obj, &n, max, &cancelbutton, &cancel)) { - if (firsttime && n == LAYOUT_UNAME) { - /* fill in the blanks, well, just the GID */ - completeUser(); - RefreshStringObj(userLayout[LAYOUT_UID].obj); - RefreshStringObj(userLayout[LAYOUT_UGROUP].obj); - RefreshStringObj(userLayout[LAYOUT_GECOS].obj); - RefreshStringObj(userLayout[LAYOUT_UMEMB].obj); - RefreshStringObj(userLayout[LAYOUT_HOMEDIR].obj); - RefreshStringObj(userLayout[LAYOUT_SHELL].obj); - firsttime = FALSE; - } + if (firsttime) { + /* fill in the blanks, well, just the GID */ + completeUser(); + RefreshStringObj(userLayout[LAYOUT_UID].obj); + RefreshStringObj(userLayout[LAYOUT_UGROUP].obj); + RefreshStringObj(userLayout[LAYOUT_GECOS].obj); + RefreshStringObj(userLayout[LAYOUT_UMEMB].obj); + RefreshStringObj(userLayout[LAYOUT_HOMEDIR].obj); + RefreshStringObj(userLayout[LAYOUT_SHELL].obj); + firsttime = FALSE; } + while (layoutDialogLoop(ds_win, userLayout, &obj, &n, max, &cancelbutton, &cancel)); + if (!cancel && !verifyUserSettings(ds_win)) goto reenter; -- cgit v1.1