summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-01-29 21:16:07 +0000
committerjkh <jkh@FreeBSD.org>1997-01-29 21:16:07 +0000
commitac85456797b8074dad5c1af1bb141abb9206d6ec (patch)
tree83e9095e674d2b5b7677942ffdfd7332a9da62a1 /usr.sbin
parent0b1072afc897dc6d26f0ca8ff58a0e989a760229 (diff)
downloadFreeBSD-src-ac85456797b8074dad5c1af1bb141abb9206d6ec.zip
FreeBSD-src-ac85456797b8074dad5c1af1bb141abb9206d6ec.tar.gz
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/misc.c19
-rw-r--r--usr.sbin/sade/sade.h4
-rw-r--r--usr.sbin/sysinstall/misc.c19
-rw-r--r--usr.sbin/sysinstall/sysinstall.h4
-rw-r--r--usr.sbin/sysinstall/user.c40
5 files changed, 50 insertions, 36 deletions
diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c
index 19fd9de..e7d4063 100644
--- a/usr.sbin/sade/misc.c
+++ b/usr.sbin/sade/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/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 1704887..4ed2476 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.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/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c
index 19fd9de..e7d4063 100644
--- a/usr.sbin/sysinstall/misc.c
+++ b/usr.sbin/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/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 1704887..4ed2476 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/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/usr.sbin/sysinstall/user.c b/usr.sbin/sysinstall/user.c
index 6c42ecc..f3006e3 100644
--- a/usr.sbin/sysinstall/user.c
+++ b/usr.sbin/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;
OpenPOWER on IntegriCloud