mirror of
https://github.com/opnsense/src.git
synced 2026-06-13 10:40:19 -04:00
Do something I've wanted to do for quite some time - collapse all the
common layout code into some work functions and make all the layout-using routine adopt them. Also reorganize includes and generally clean up.
This commit is contained in:
parent
f2400d4658
commit
e5b09b7d10
39 changed files with 866 additions and 1600 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: anonFTP.c,v 1.17 1996/09/06 05:58:27 jkh Exp $
|
||||
* $Id: anonFTP.c,v 1.18 1996/12/09 08:22:09 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Coranth Gryphon. All rights reserved.
|
||||
|
|
@ -36,20 +36,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "sysinstall.h"
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <dialog.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "dialog.priv.h"
|
||||
#include "colors.h"
|
||||
#include "sysinstall.h"
|
||||
|
||||
/* This doesn't change until FTP itself changes */
|
||||
|
||||
|
|
@ -95,55 +85,36 @@ static int okbutton, cancelbutton;
|
|||
#define ANONFTP_DIALOG_WIDTH COLS - 16
|
||||
#define ANONFTP_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
static Layout layout[] = {
|
||||
#define LAYOUT_UID 0
|
||||
{ 2, 3, 8, ANONFTP_UID_LEN - 1,
|
||||
"UID:", "What user ID to assign to FTP Admin",
|
||||
tconf.uid, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UID 1
|
||||
|
||||
#define LAYOUT_GROUP 1
|
||||
{ 2, 15, 15, ANONFTP_GROUP_LEN - 1,
|
||||
"Group:", "Group name that ftp process belongs to",
|
||||
tconf.group, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GROUP 2
|
||||
|
||||
#define LAYOUT_COMMENT 2
|
||||
{ 2, 35, 24, ANONFTP_COMMENT_LEN - 1,
|
||||
"Comment:", "Password file comment for FTP Admin",
|
||||
tconf.comment, STRINGOBJ, NULL },
|
||||
#define LAYOUT_COMMENT 3
|
||||
|
||||
#define LAYOUT_HOMEDIR 3
|
||||
{ 9, 10, 43, ANONFTP_HOMEDIR_LEN - 1,
|
||||
"FTP Root Directory:",
|
||||
"The top directory to chroot to when doing anonymous ftp",
|
||||
tconf.homedir, STRINGOBJ, NULL },
|
||||
#define LAYOUT_HOMEDIR 4
|
||||
|
||||
#define LAYOUT_UPLOAD 4
|
||||
{ 14, 20, 22, ANONFTP_UPLOAD_LEN - 1,
|
||||
"Upload Subdirectory:", "Designated sub-directory that holds uploads",
|
||||
tconf.upload, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UPLOAD 5
|
||||
|
||||
#define LAYOUT_OKBUTTON 5
|
||||
{ 19, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 6
|
||||
|
||||
#define LAYOUT_CANCELBUTTON 6
|
||||
{ 19, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 7
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
|
@ -194,7 +165,7 @@ createFtpUser(void)
|
|||
if (tpw->pw_uid != FTP_UID)
|
||||
msgConfirm("FTP user already exists with a different uid.");
|
||||
|
||||
return (DITEM_SUCCESS); /* succeeds if already exists */
|
||||
return DITEM_SUCCESS; /* succeeds if already exists */
|
||||
}
|
||||
|
||||
sprintf(pwline, "%s::%s:%d::0:0:%s:%s:/bin/date\n", FTP_NAME, tconf.uid, gid, tconf.comment, tconf.homedir);
|
||||
|
|
@ -202,13 +173,13 @@ createFtpUser(void)
|
|||
fptr = fopen(_PATH_MASTERPASSWD,"a");
|
||||
if (! fptr) {
|
||||
msgConfirm("Could not open master password file.");
|
||||
return (DITEM_FAILURE);
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
fprintf(fptr, pwline);
|
||||
fclose(fptr);
|
||||
msgNotify("Remaking password file: %s", _PATH_MASTERPASSWD);
|
||||
vsystem("pwd_mkdb -p %s", _PATH_MASTERPASSWD);
|
||||
return (DITEM_SUCCESS);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* This is it - how to get the setup values */
|
||||
|
|
@ -216,38 +187,28 @@ static int
|
|||
anonftpOpenDialog(void)
|
||||
{
|
||||
WINDOW *ds_win;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
ComposeObj *obj = NULL;
|
||||
int n = 0, cancel = FALSE;
|
||||
int max;
|
||||
char help[FILENAME_MAX];
|
||||
char title[80];
|
||||
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0) {
|
||||
if (!(ds_win = openLayoutDialog(ANONFTP_HELPFILE, " Anonymous FTP Configuration ",
|
||||
ANONFTP_DIALOG_X, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_WIDTH, ANONFTP_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open anonymous ftp dialog window!!");
|
||||
return(DITEM_FAILURE);
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
systemHelpFile(ANONFTP_HELPFILE, help);
|
||||
use_helpfile(help);
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_X, ANONFTP_DIALOG_HEIGHT, ANONFTP_DIALOG_WIDTH, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_X + 20, " Anonymous FTP Configuration ");
|
||||
|
||||
draw_box(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 8, ANONFTP_DIALOG_HEIGHT - 11, ANONFTP_DIALOG_WIDTH - 17,
|
||||
/* Draw a sub-box for the path configuration */
|
||||
draw_box(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 8,
|
||||
ANONFTP_DIALOG_HEIGHT - 11, ANONFTP_DIALOG_WIDTH - 17,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
sprintf(title, " Path Configuration ");
|
||||
mvwaddstr(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 22, title);
|
||||
|
||||
/** Initialize the config Data Structure **/
|
||||
|
||||
bzero(&tconf, sizeof(tconf));
|
||||
|
||||
SAFE_STRCPY(tconf.group, FTP_GROUP);
|
||||
|
|
@ -256,110 +217,12 @@ anonftpOpenDialog(void)
|
|||
SAFE_STRCPY(tconf.homedir, FTP_HOMEDIR);
|
||||
sprintf(tconf.uid, "%d", FTP_UID);
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
|
||||
n = 0;
|
||||
#define lt layout[n]
|
||||
|
||||
while (lt.help != NULL) {
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + ANONFTP_DIALOG_Y, lt.x + ANONFTP_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + ANONFTP_DIALOG_Y, lt.x + ANONFTP_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
while (first->prev)
|
||||
first = first->prev;
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
cancelbutton = 0;
|
||||
cancel = FALSE;
|
||||
okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_CR:
|
||||
case SEL_TAB:
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
quit = TRUE;
|
||||
if (cancelbutton)
|
||||
cancel = TRUE;
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
}
|
||||
|
||||
obj = initLayoutDialog(ds_win, layout, ANONFTP_DIALOG_X, ANONFTP_DIALOG_Y, &max);
|
||||
|
||||
cancelbutton = okbutton = 0;
|
||||
while (layoutDialogLoop(ds_win, layout, &obj, &n, max, &cancelbutton, &cancel));
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
use_helpfile(NULL);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: apache.c,v 1.28 1996/11/04 12:56:15 jkh Exp $
|
||||
* $Id: apache.c,v 1.29 1996/12/09 08:22:09 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Coranth Gryphon. All rights reserved.
|
||||
|
|
@ -36,17 +36,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "dialog.priv.h"
|
||||
#include "colors.h"
|
||||
#include "sysinstall.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
|
||||
#define APACHE_HELPFILE "apache"
|
||||
|
|
@ -104,84 +95,60 @@ static int okbutton, cancelbutton;
|
|||
#define APACHE_DIALOG_WIDTH COLS
|
||||
#define APACHE_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
static Layout layout[] = {
|
||||
#define LAYOUT_HOSTNAME 0
|
||||
{ 1, 2, 30, HOSTNAME_FIELD_LEN - 1,
|
||||
"Host Name:",
|
||||
"What name to report this host as to client browsers",
|
||||
tconf.hostname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_HOSTNAME 0
|
||||
|
||||
#define LAYOUT_EMAIL 1
|
||||
{ 1, 40, 32, APACHE_EMAIL_LEN - 1,
|
||||
"Email Address:",
|
||||
"The email address of the site maintainer, e.g. webmaster@bar.com",
|
||||
tconf.email, STRINGOBJ, NULL },
|
||||
#define LAYOUT_EMAIL 1
|
||||
|
||||
#define LAYOUT_WELCOME 2
|
||||
{ 5, 5, 20, APACHE_WELCOME_LEN - 1,
|
||||
"Default Document:",
|
||||
"The name of the default document found in each directory",
|
||||
tconf.welcome, STRINGOBJ, NULL },
|
||||
#define LAYOUT_WELCOME 2
|
||||
|
||||
#define LAYOUT_DEFUSER 3
|
||||
{ 5, 40, 14, APACHE_DEFUSER_LEN - 1,
|
||||
"Default UserID:", "Default UID for access to web pages",
|
||||
tconf.defuser, STRINGOBJ, NULL },
|
||||
#define LAYOUT_DEFUSER 3
|
||||
|
||||
#define LAYOUT_DEFGROUP 4
|
||||
{ 5, 60, 14, APACHE_DEFGROUP_LEN - 1,
|
||||
"Default Group ID:", "Default GID for access to web pages",
|
||||
tconf.defgroup, STRINGOBJ, NULL },
|
||||
#define LAYOUT_DEFGROUP 4
|
||||
|
||||
#define LAYOUT_DOCROOT 5
|
||||
{ 10, 4, 36, APACHE_DOCROOT_LEN - 1,
|
||||
"Root Document Path:",
|
||||
"The top directory that holds the system web pages",
|
||||
tconf.docroot, STRINGOBJ, NULL },
|
||||
#define LAYOUT_DOCROOT 5
|
||||
|
||||
#define LAYOUT_USERDIR 6
|
||||
{ 10, 50, 14, APACHE_USERDIR_LEN - 1,
|
||||
"User Directory:",
|
||||
"Personal sub-directory that holds users' web pages (eg. ~/Web)",
|
||||
tconf.userdir, STRINGOBJ, NULL },
|
||||
#define LAYOUT_USERDIR 6
|
||||
|
||||
#define LAYOUT_LOGDIR 7
|
||||
{ 14, 4, 28, APACHE_LOGDIR_LEN - 1,
|
||||
"Log Dir:", "Directory to put httpd log files",
|
||||
tconf.logdir, STRINGOBJ, NULL },
|
||||
#define LAYOUT_LOGDIR 7
|
||||
|
||||
#define LAYOUT_ACCESSLOG 8
|
||||
{ 14, 38, 16, APACHE_ACCESSLOG_LEN - 1,
|
||||
"Access Log:", "Name of log file to report access",
|
||||
tconf.accesslog, STRINGOBJ, NULL },
|
||||
#define LAYOUT_ACCESSLOG 8
|
||||
|
||||
#define LAYOUT_ERRORLOG 9
|
||||
{ 14, 60, 16, APACHE_ERRORLOG_LEN - 1,
|
||||
"Error Log:", "Name of log file to report errors",
|
||||
tconf.errorlog, STRINGOBJ, NULL },
|
||||
#define LAYOUT_ERRORLOG 9
|
||||
|
||||
#define LAYOUT_OKBUTTON 10
|
||||
{ 19, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 10
|
||||
|
||||
#define LAYOUT_CANCELBUTTON 11
|
||||
{ 19, 45, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 11
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
|
@ -190,32 +157,21 @@ static int
|
|||
apacheOpenDialog(void)
|
||||
{
|
||||
WINDOW *ds_win;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
ComposeObj *obj = NULL;
|
||||
int n = 0, cancel = FALSE;
|
||||
int max;
|
||||
char *tmp;
|
||||
char help[FILENAME_MAX];
|
||||
char title[80];
|
||||
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0)
|
||||
{
|
||||
if (!(ds_win = openLayoutDialog(APACHE_HELPFILE, " Apache HTTPD Configuration ",
|
||||
APACHE_DIALOG_X, APACHE_DIALOG_Y, APACHE_DIALOG_WIDTH, APACHE_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open apache dialog window!!");
|
||||
return(DITEM_SUCCESS);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
systemHelpFile(APACHE_HELPFILE, help);
|
||||
use_helpfile(help);
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, APACHE_DIALOG_Y, APACHE_DIALOG_X, APACHE_DIALOG_HEIGHT, APACHE_DIALOG_WIDTH, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, APACHE_DIALOG_Y, APACHE_DIALOG_X + 20, " Apache HTTPD Configuration ");
|
||||
|
||||
/* Draw a sub-box for the path configuration */
|
||||
draw_box(ds_win, APACHE_DIALOG_Y + 9, APACHE_DIALOG_X + 1, APACHE_DIALOG_HEIGHT - 13, APACHE_DIALOG_WIDTH - 2,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
|
|
@ -223,7 +179,6 @@ apacheOpenDialog(void)
|
|||
mvwaddstr(ds_win, APACHE_DIALOG_Y + 9, APACHE_DIALOG_X + 22, title);
|
||||
|
||||
/** Initialize the config Data Structure **/
|
||||
|
||||
bzero(&tconf, sizeof(tconf));
|
||||
|
||||
tmp = variable_get(VAR_DOMAINNAME);
|
||||
|
|
@ -244,120 +199,19 @@ apacheOpenDialog(void)
|
|||
|
||||
sprintf(tconf.docroot, "%s/%s", APACHE_BASE,DATA_SUBDIR);
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
|
||||
n = 0;
|
||||
|
||||
#define lt layout[n]
|
||||
|
||||
while (lt.help != NULL) {
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + APACHE_DIALOG_Y, lt.x + APACHE_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
while (first->prev)
|
||||
first = first->prev;
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
cancelbutton = 0;
|
||||
cancel = FALSE;
|
||||
okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
/* We are in the Hostname field - calculate the e-mail addr */
|
||||
if (n == LAYOUT_HOSTNAME) {
|
||||
if ((tmp = index(tconf.hostname, '.')) != NULL) {
|
||||
sprintf(tconf.email,"webmaster@%s",tmp+1);
|
||||
RefreshStringObj(layout[LAYOUT_EMAIL].obj);
|
||||
}
|
||||
obj = initLayoutDialog(ds_win, layout, APACHE_DIALOG_X, APACHE_DIALOG_Y, &max);
|
||||
|
||||
cancelbutton = okbutton = 0;
|
||||
while (layoutDialogLoop(ds_win, layout, &obj, &n, max, &cancelbutton, &cancel)) {
|
||||
if (n == LAYOUT_HOSTNAME) {
|
||||
if ((tmp = index(tconf.hostname, '.')) != NULL) {
|
||||
sprintf(tconf.email, "webmaster@%s", tmp + 1);
|
||||
RefreshStringObj(layout[LAYOUT_EMAIL].obj);
|
||||
}
|
||||
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_TAB:
|
||||
case SEL_CR:
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
quit = TRUE;
|
||||
if (cancelbutton)
|
||||
cancel = TRUE;
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
use_helpfile(NULL);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: devices.c,v 1.55 1996/12/14 23:08:52 jkh Exp $
|
||||
* $Id: devices.c,v 1.56 1996/12/26 21:03:04 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -35,20 +35,17 @@
|
|||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
static Device *Devices[DEV_MAX];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.84 1996/12/14 23:08:58 jkh Exp $
|
||||
* $Id: dist.c,v 1.85 1996/12/29 05:28:39 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -34,8 +34,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include "sysinstall.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
unsigned int Dists;
|
||||
unsigned int DESDists;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dmenu.c,v 1.27 1996/11/09 16:46:56 joerg Exp $
|
||||
* $Id: dmenu.c,v 1.28 1996/12/09 08:22:12 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "sysinstall.h"
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MAX_MENU 15
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: ftp.c,v 1.20 1996/12/11 19:35:26 jkh Exp $
|
||||
* $Id: ftp.c,v 1.21 1997/01/01 12:36:06 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: keymap.c,v 1.1 1996/11/09 16:47:02 joerg Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -37,7 +38,6 @@ struct keymapInfo {
|
|||
};
|
||||
|
||||
#include "keymap.h"
|
||||
#include "sysinstall.h"
|
||||
|
||||
/*
|
||||
* keymap.h is being automatically generated by the Makefile. It
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
|
||||
* $Id: main.c,v 1.32 1996/12/12 08:33:37 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -35,7 +35,6 @@
|
|||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: media.c,v 1.68 1996/12/12 08:36:25 jkh Exp $
|
||||
* $Id: media.c,v 1.69 1996/12/14 23:09:04 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -34,8 +34,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include "sysinstall.h"
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/param.h>
|
||||
|
|
@ -47,8 +46,6 @@
|
|||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
static int
|
||||
genericHook(dialogMenuItem *self, DeviceType type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Miscellaneous support routines..
|
||||
*
|
||||
* $Id: misc.c,v 1.25 1996/12/12 22:38:41 jkh Exp $
|
||||
* $Id: misc.c,v 1.26 1996/12/17 00:00:14 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -344,6 +344,123 @@ Mount(char *mountp, void *dev)
|
|||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
WINDOW *
|
||||
openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height)
|
||||
{
|
||||
WINDOW *win;
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
mvwaddstr(win, y, x + 20, title);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
|
||||
ComposeObj *
|
||||
initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max)
|
||||
{
|
||||
ComposeObj *obj = NULL, *first;
|
||||
int n;
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
|
||||
n = 0;
|
||||
while (layout[n].help != NULL) {
|
||||
switch (layout[n].type) {
|
||||
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);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
layout[n].obj = NewButtonObj(win, layout[n].prompt, layout[n].var, layout[n].y + y, layout[n].x + x);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, layout[n].type, (void *) layout[n].obj);
|
||||
n++;
|
||||
}
|
||||
*max = n - 1;
|
||||
/* Find the first object in the list */
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
return first;
|
||||
}
|
||||
|
||||
int
|
||||
layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj, int *n, int max, int *cbutton, int *cancel)
|
||||
{
|
||||
char help_line[80];
|
||||
int ret, i, len = strlen(layout[*n].help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? layout[*n].help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(obj);
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
case SEL_ESC: /* Bail out */
|
||||
*cancel = TRUE;
|
||||
return FALSE;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
case KEY_DOWN:
|
||||
case SEL_CR:
|
||||
case SEL_TAB:
|
||||
if (*n < max)
|
||||
++*n;
|
||||
else
|
||||
*n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cbutton && *cbutton)
|
||||
*cancel = TRUE;
|
||||
else
|
||||
*cancel = FALSE;
|
||||
return FALSE;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (*n)
|
||||
--*n;
|
||||
else
|
||||
*n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tootle them forcefully! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WINDOW *
|
||||
savescr(void)
|
||||
{
|
||||
|
|
@ -360,3 +477,4 @@ restorescr(WINDOW *w)
|
|||
wrefresh(w);
|
||||
delwin(w);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: package.c,v 1.49 1996/11/04 12:56:28 jkh Exp $
|
||||
* $Id: package.c,v 1.50 1996/12/11 09:35:04 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -34,15 +34,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "sysinstall.h"
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include "sysinstall.h"
|
||||
|
||||
/* Like package_extract, but assumes current media device */
|
||||
int
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.95 1996/12/17 00:00:15 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.96 1996/12/29 05:51:39 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -37,13 +37,17 @@
|
|||
#ifndef _SYSINSTALL_H_INCLUDE
|
||||
#define _SYSINSTALL_H_INCLUDE
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dialog.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "colors.h"
|
||||
#include "libdisk.h"
|
||||
#include "dist.h"
|
||||
#include "version.h"
|
||||
|
|
@ -173,6 +177,19 @@ typedef struct _variable {
|
|||
char *value;
|
||||
} Variable;
|
||||
|
||||
/* A screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
/* For attribs */
|
||||
#define MAX_ATTRIBS 200
|
||||
#define MAX_NAME 64
|
||||
|
|
@ -342,6 +359,9 @@ extern DMenu MenuHTMLDoc; /* HTML Documentation menu */
|
|||
extern DMenu MenuUsermgmt; /* User management menu */
|
||||
extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */
|
||||
|
||||
/* Stuff from libdialog which isn't properly declared outside */
|
||||
extern void display_helpfile(void);
|
||||
extern void display_helpline(WINDOW *w, int y, int width);
|
||||
|
||||
/*** Prototypes ***/
|
||||
|
||||
|
|
@ -562,6 +582,11 @@ extern dialogMenuItem *item_add(dialogMenuItem *list, char *prompt, char *title,
|
|||
extern void items_free(dialogMenuItem *list, int *curr, int *max);
|
||||
extern int Mkdir(char *);
|
||||
extern int Mount(char *, void *data);
|
||||
extern WINDOW *openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height);
|
||||
extern ComposeObj *initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max);
|
||||
extern int layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj,
|
||||
int *n, int max, int *cbutton, int *cancel);
|
||||
|
||||
extern WINDOW *savescr(void);
|
||||
extern void restorescr(WINDOW *w);
|
||||
extern char *sstrncpy(char *dst, const char *src, int size);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: tcpip.c,v 1.52 1996/12/12 22:44:22 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.53 1996/12/14 23:09:08 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
|
|
@ -37,17 +37,8 @@
|
|||
* -jkh
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "dialog.priv.h"
|
||||
#include "colors.h"
|
||||
#include "sysinstall.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
/* The help file for the TCP/IP setup screen */
|
||||
#define TCP_HELPFILE "tcp"
|
||||
|
|
@ -65,62 +56,49 @@ static char ipaddr[IPADDR_FIELD_LEN], netmask[IPADDR_FIELD_LEN], extras[EXTRAS_F
|
|||
#define TCP_DIALOG_WIDTH COLS - 16
|
||||
#define TCP_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
static Layout layout[] = {
|
||||
#define LAYOUT_HOSTNAME 0
|
||||
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
|
||||
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
|
||||
"Host:", "Your fully-qualified hostname, e.g. foo.bar.com",
|
||||
hostname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_DOMAINNAME 1
|
||||
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
|
||||
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
|
||||
"Domain:",
|
||||
"The name of the domain that your machine is in, e.g. bar.com",
|
||||
domainname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GATEWAY 2
|
||||
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Gateway:",
|
||||
"IP address of host forwarding packets to non-local destinations",
|
||||
gateway, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NAMESERVER 3
|
||||
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Name server:", "IP address of your local DNS server",
|
||||
nameserver, STRINGOBJ, NULL },
|
||||
#define LAYOUT_IPADDR 4
|
||||
{ 10, 10, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 10, 10, 18, IPADDR_FIELD_LEN - 1,
|
||||
"IP Address:",
|
||||
"The IP address to be used for this interface",
|
||||
ipaddr, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NETMASK 5
|
||||
{ 10, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 10, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Netmask:",
|
||||
"The netmask for this interface, e.g. 0xffffff00 for a class C network",
|
||||
netmask, STRINGOBJ, NULL },
|
||||
#define LAYOUT_EXTRAS 6
|
||||
{ 14, 10, 37, HOSTNAME_FIELD_LEN - 1,
|
||||
{ 14, 10, 37, HOSTNAME_FIELD_LEN - 1,
|
||||
"Extra options to ifconfig:",
|
||||
"Any interface-specific options to ifconfig you would like to add",
|
||||
extras, STRINGOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 7
|
||||
{ 19, 15, 0, 0,
|
||||
{ 19, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 8
|
||||
{ 19, 35, 0, 0,
|
||||
{ 19, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
#define _validByte(b) ((b) >= 0 && (b) <= 255)
|
||||
|
|
@ -147,9 +125,8 @@ verifyIP(char *ip)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Check for the settings on the screen - the per interface stuff is
|
||||
/* Check for the settings on the screen - the per-interface stuff is
|
||||
moved to the main handling code now to do it on the fly - sigh */
|
||||
|
||||
static int
|
||||
verifySettings(void)
|
||||
{
|
||||
|
|
@ -174,11 +151,9 @@ tcpOpenDialog(Device *devp)
|
|||
{
|
||||
WINDOW *ds_win, *save;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max;
|
||||
int n = 0, cancel = FALSE;
|
||||
int max, ret;
|
||||
char *tmp;
|
||||
char help[FILENAME_MAX];
|
||||
char title[80];
|
||||
|
||||
if (!RunningAsInit) {
|
||||
|
|
@ -188,18 +163,16 @@ tcpOpenDialog(Device *devp)
|
|||
}
|
||||
save = savescr();
|
||||
dialog_clear_norefresh();
|
||||
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open TCP/IP dialog window!!");
|
||||
if (!(ds_win = openLayoutDialog(TCP_HELPFILE, " Network Configuration ",
|
||||
TCP_DIALOG_X, TCP_DIALOG_Y, TCP_DIALOG_WIDTH, TCP_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open TCP/IP dialog window!!");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
use_helpfile(systemHelpFile(TCP_HELPFILE, help));
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X, TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20, " Network Configuration ");
|
||||
/* Draw interface configuration box */
|
||||
draw_box(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 8, TCP_DIALOG_HEIGHT - 13, TCP_DIALOG_WIDTH - 17,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
|
|
@ -236,6 +209,7 @@ tcpOpenDialog(Device *devp)
|
|||
SAFE_STRCPY(extras, cp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Look up values already recorded with the system, or blank the string variables ready to accept some new data */
|
||||
tmp = variable_get(VAR_HOSTNAME);
|
||||
if (tmp)
|
||||
|
|
@ -258,75 +232,21 @@ tcpOpenDialog(Device *devp)
|
|||
else
|
||||
bzero(nameserver, sizeof(nameserver));
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
n = 0;
|
||||
#define lt layout[n]
|
||||
while (lt.help != NULL) {
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
obj = initLayoutDialog(ds_win, layout, TCP_DIALOG_X, TCP_DIALOG_Y, &max);
|
||||
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
if (n == LAYOUT_HOSTNAME) {
|
||||
/* We are in the Hostname field - calculate the domainname */
|
||||
if ((tmp = index(hostname, '.')) != NULL) {
|
||||
sstrncpy(domainname, tmp + 1, strlen(tmp));
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
}
|
||||
}
|
||||
else if (n == LAYOUT_IPADDR) {
|
||||
while (layoutDialogLoop(ds_win, layout, &obj, &n, max, &cancelbutton, &cancel)) {
|
||||
if (n == LAYOUT_IPADDR) {
|
||||
/* Insert a default value for the netmask, 0xffffff00 is
|
||||
the most appropriate one (entire class C, or subnetted
|
||||
class A/B network). */
|
||||
if(netmask[0] == '\0') {
|
||||
if (netmask[0] == '\0') {
|
||||
strcpy(netmask, "255.255.255.0");
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (n == LAYOUT_DOMAINNAME) {
|
||||
if (!index(hostname, '.') && domainname[0]) {
|
||||
strcat(hostname, ".");
|
||||
|
|
@ -334,68 +254,24 @@ tcpOpenDialog(Device *devp)
|
|||
RefreshStringObj(layout[LAYOUT_HOSTNAME].obj);
|
||||
}
|
||||
}
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_TAB:
|
||||
case SEL_CR:
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
else {
|
||||
if (verifySettings())
|
||||
quit = TRUE;
|
||||
else if (n == LAYOUT_HOSTNAME) {
|
||||
if (((tmp = index(hostname, '.')) != NULL) && !domainname[0]) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
|
||||
/* BODGE ALERT! */
|
||||
if (((tmp = index(hostname, '.')) != NULL) && (strlen(domainname)==0)) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[1].obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (!verifySettings())
|
||||
goto reenter;
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
use_helpfile(NULL);
|
||||
|
||||
/* We actually need to inform the rest of sysinstall about this
|
||||
data now - if the user hasn't selected cancel, save the stuff
|
||||
out to the environment via the variable_set layers */
|
||||
data now if the user hasn't selected cancel. Save the stuff
|
||||
out to the environment via the variable_set() mechanism */
|
||||
|
||||
if (!cancel) {
|
||||
DevInfo *di;
|
||||
|
|
@ -431,12 +307,13 @@ tcpOpenDialog(Device *devp)
|
|||
}
|
||||
if (ipaddr[0])
|
||||
variable_set2(VAR_IPADDR, ipaddr);
|
||||
restorescr(save);
|
||||
configResolv(); /* XXX this will do it on the MFS copy XXX */
|
||||
return DITEM_SUCCESS;
|
||||
ret = DITEM_SUCCESS;
|
||||
}
|
||||
else
|
||||
ret = DITEM_FAILURE;
|
||||
restorescr(save);
|
||||
return DITEM_FAILURE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -11,18 +11,13 @@
|
|||
* incurred with its use.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "sysinstall.h"
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
#define VTY_STATUS_LINE 24
|
||||
#define TTY_STATUS_LINE 23
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: user.c,v 1.4 1996/12/14 23:09:10 jkh Exp $
|
||||
* $Id: user.c,v 1.5 1996/12/15 11:22:37 joerg Exp $
|
||||
*
|
||||
* Copyright (c) 1996
|
||||
* Jörg Wunsch. All rights reserved.
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
* Jordan K Hubbard. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
@ -33,19 +34,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <utmp.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "dialog.priv.h"
|
||||
#include "colors.h"
|
||||
#include "sysinstall.h"
|
||||
#include <utmp.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/param.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
/* The help file for the user mgmt screen */
|
||||
#define USER_HELPFILE "usermgmt"
|
||||
|
|
@ -87,87 +80,74 @@ static int okbutton, cancelbutton;
|
|||
#define USER_DIALOG_WIDTH COLS - 16
|
||||
#define USER_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
/* The group configuration menu. */
|
||||
static Layout groupLayout[] = {
|
||||
#define LAYOUT_GNAME 0
|
||||
{ 4, 10, 20, GNAME_FIELD_LEN - 1,
|
||||
"Group name:", "The alphanumeric name of the new group (mandatory)",
|
||||
gname, STRINGOBJ, NULL },
|
||||
{ 4, 10, 20, GNAME_FIELD_LEN - 1,
|
||||
"Group name:", "The alphanumeric name of the new group (mandatory)",
|
||||
gname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GID 1
|
||||
{ 4, 38, 10, GID_FIELD_LEN - 1,
|
||||
"GID:", "The numerical ID for this group (leave blank for automatic choice)",
|
||||
gid, STRINGOBJ, NULL },
|
||||
{ 4, 38, 10, GID_FIELD_LEN - 1,
|
||||
"GID:", "The numerical ID for this group (leave blank for automatic choice)",
|
||||
gid, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GMEMB 2
|
||||
{ 11, 10, 40, GMEMB_FIELD_LEN - 1,
|
||||
"Group members:", "Who belongs to this group (i.e., gets access rights for it)",
|
||||
gmemb, STRINGOBJ, NULL },
|
||||
{ 11, 10, 40, GMEMB_FIELD_LEN - 1,
|
||||
"Group members:", "Who belongs to this group (i.e., gets access rights for it)",
|
||||
gmemb, STRINGOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 3
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 4
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
/* The user configuration menu. */
|
||||
static Layout userLayout[] = {
|
||||
#define LAYOUT_UNAME 0
|
||||
{ 3, 6, UT_NAMESIZE, UT_NAMESIZE + 4,
|
||||
"Login ID:", "The login name of the new user (mandatory)",
|
||||
uname, STRINGOBJ, NULL },
|
||||
{ 3, 6, UT_NAMESIZE, UT_NAMESIZE + 4,
|
||||
"Login ID:", "The login name of the new user (mandatory)",
|
||||
uname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UID 1
|
||||
{ 3, 23, 8, UID_FIELD_LEN - 1,
|
||||
"UID:", "The numerical ID for this user (leave blank for automatic choice)",
|
||||
uid, STRINGOBJ, NULL },
|
||||
{ 3, 23, 8, UID_FIELD_LEN - 1,
|
||||
"UID:", "The numerical ID for this user (leave blank for automatic choice)",
|
||||
uid, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UGROUP 2
|
||||
{ 3, 33, 8, UGROUP_FIELD_LEN - 1,
|
||||
"Group:", "The login group name for this user (leave blank for automatic choice)",
|
||||
ugroup, STRINGOBJ, NULL },
|
||||
{ 3, 33, 8, UGROUP_FIELD_LEN - 1,
|
||||
"Group:", "The login group name for this user (leave blank for automatic choice)",
|
||||
ugroup, STRINGOBJ, NULL },
|
||||
#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 },
|
||||
{ 3, 43, 15, PASSWD_FIELD_LEN - 1,
|
||||
"Password:", "The password for this user (enter this field with care!)",
|
||||
passwd, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GECOS 4
|
||||
{ 8, 6, 33, GECOS_FIELD_LEN - 1,
|
||||
"Full name:", "The user's full name (comment)",
|
||||
gecos, STRINGOBJ, NULL },
|
||||
{ 8, 6, 33, GECOS_FIELD_LEN - 1,
|
||||
"Full name:", "The user's full name (comment)",
|
||||
gecos, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UMEMB 5
|
||||
{ 8, 43, 15, UMEMB_FIELD_LEN - 1,
|
||||
"Member groups:", "The groups this user belongs to (i.e. gets access rights for)",
|
||||
umemb, STRINGOBJ, NULL },
|
||||
{ 8, 43, 15, UMEMB_FIELD_LEN - 1,
|
||||
"Member groups:", "The groups this user belongs to (i.e. gets access rights for)",
|
||||
umemb, STRINGOBJ, NULL },
|
||||
#define LAYOUT_HOMEDIR 6
|
||||
{ 13, 6, 20, HOMEDIR_FIELD_LEN - 1,
|
||||
"Home directory:", "The user's home directory (leave blank for default)",
|
||||
homedir, STRINGOBJ, NULL },
|
||||
{ 13, 6, 20, HOMEDIR_FIELD_LEN - 1,
|
||||
"Home directory:", "The user's home directory (leave blank for default)",
|
||||
homedir, STRINGOBJ, NULL },
|
||||
#define LAYOUT_SHELL 7
|
||||
{ 13, 29, 29, SHELL_FIELD_LEN - 1,
|
||||
"Login shell:", "The user's login shell (leave blank for default)",
|
||||
shell, STRINGOBJ, NULL },
|
||||
{ 13, 29, 29, SHELL_FIELD_LEN - 1,
|
||||
"Login shell:", "The user's login shell (leave blank for default)",
|
||||
shell, STRINGOBJ, NULL },
|
||||
#define LAYOUT_U_OKBUTTON 8
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_U_CANCELBUTTON 9
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
/* whine */
|
||||
|
|
@ -357,10 +337,8 @@ userAddGroup(dialogMenuItem *self)
|
|||
{
|
||||
WINDOW *ds_win, *save;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max, firsttime=TRUE;
|
||||
char help[FILENAME_MAX];
|
||||
int n = 0, cancel = FALSE, ret;
|
||||
int max, firsttime = TRUE;
|
||||
|
||||
if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
msgConfirm("This option may only be used after the system is installed, sorry!");
|
||||
|
|
@ -370,18 +348,14 @@ userAddGroup(dialogMenuItem *self)
|
|||
save = savescr();
|
||||
dialog_clear_norefresh();
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open AddGroup dialog window!!");
|
||||
if (!(ds_win = openLayoutDialog(USER_HELPFILE, " User and Group Management ",
|
||||
USER_DIALOG_X, USER_DIALOG_Y, USER_DIALOG_WIDTH, USER_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open addgroup dialog window!!");
|
||||
return(DITEM_FAILURE);
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
use_helpfile(systemHelpFile(USER_HELPFILE, help));
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, USER_DIALOG_Y, USER_DIALOG_X, USER_DIALOG_HEIGHT, USER_DIALOG_WIDTH,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, USER_DIALOG_Y, USER_DIALOG_X + 18, " Users and Group Management ");
|
||||
/* Draw a group entry box */
|
||||
draw_box(ds_win, USER_DIALOG_Y + 2, USER_DIALOG_X + 8, USER_DIALOG_HEIGHT - 6,
|
||||
USER_DIALOG_WIDTH - 17, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
|
|
@ -391,115 +365,22 @@ userAddGroup(dialogMenuItem *self)
|
|||
CLEAR(gid);
|
||||
CLEAR(gmemb);
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
n = 0;
|
||||
#define lt groupLayout[n]
|
||||
while (lt.help != NULL) {
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
obj = initLayoutDialog(ds_win, groupLayout, USER_DIALOG_X, USER_DIALOG_Y, &max);
|
||||
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_TAB:
|
||||
case SEL_CR:
|
||||
if (firsttime && n == LAYOUT_GNAME)
|
||||
{
|
||||
/* fill in the blanks, well, just the GID */
|
||||
completeGroup();
|
||||
RefreshStringObj(groupLayout[LAYOUT_GID].obj);
|
||||
firsttime = FALSE;
|
||||
}
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
else {
|
||||
if (verifyGroupSettings())
|
||||
quit = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
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;
|
||||
}
|
||||
}
|
||||
#undef lt
|
||||
|
||||
if (!verifyGroupSettings())
|
||||
goto reenter;
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
|
|
@ -507,11 +388,12 @@ userAddGroup(dialogMenuItem *self)
|
|||
|
||||
if (!cancel) {
|
||||
addGroup(ds_win);
|
||||
restorescr(save);
|
||||
return DITEM_SUCCESS;
|
||||
ret = DITEM_SUCCESS;
|
||||
}
|
||||
else
|
||||
ret = DITEM_FAILURE;
|
||||
restorescr(save);
|
||||
return DITEM_FAILURE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Check for the settings on the screen. */
|
||||
|
|
@ -776,10 +658,8 @@ userAddUser(dialogMenuItem *self)
|
|||
{
|
||||
WINDOW *ds_win, *save;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max, firsttime=TRUE;
|
||||
char help[FILENAME_MAX];
|
||||
int n = 0, cancel = FALSE, ret;
|
||||
int max, firsttime = TRUE;
|
||||
|
||||
if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
msgConfirm("This option may only be used after the system is installed, sorry!");
|
||||
|
|
@ -788,19 +668,16 @@ userAddUser(dialogMenuItem *self)
|
|||
|
||||
save = savescr();
|
||||
dialog_clear_norefresh();
|
||||
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open AddUser dialog window!!");
|
||||
if (!(ds_win = openLayoutDialog(USER_HELPFILE, " User and Group Management ",
|
||||
USER_DIALOG_X, USER_DIALOG_Y, USER_DIALOG_WIDTH, USER_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open adduser dialog window!!");
|
||||
return(DITEM_FAILURE);
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
use_helpfile(systemHelpFile(USER_HELPFILE, help));
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, USER_DIALOG_Y, USER_DIALOG_X, USER_DIALOG_HEIGHT, USER_DIALOG_WIDTH,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, USER_DIALOG_Y, USER_DIALOG_X + 18, " Users and Group Management ");
|
||||
/* Draw a user entry box */
|
||||
draw_box(ds_win, USER_DIALOG_Y + 1, USER_DIALOG_X + 3, USER_DIALOG_HEIGHT - 5,
|
||||
USER_DIALOG_WIDTH - 6, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
|
|
@ -814,124 +691,28 @@ userAddUser(dialogMenuItem *self)
|
|||
CLEAR(umemb);
|
||||
CLEAR(homedir);
|
||||
CLEAR(shell);
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
n = 0;
|
||||
#define lt userLayout[n]
|
||||
while (lt.help != NULL) {
|
||||
if (n == LAYOUT_PASSWD)
|
||||
DialogInputAttrs = DITEM_NO_ECHO; /* This will affect the new string object if set */
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
DialogInputAttrs = 0;
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
obj = initLayoutDialog(ds_win, userLayout, USER_DIALOG_X, USER_DIALOG_Y, &max);
|
||||
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_TAB:
|
||||
case SEL_CR:
|
||||
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 (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
else {
|
||||
if (verifyUserSettings(ds_win))
|
||||
quit = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
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;
|
||||
}
|
||||
}
|
||||
#undef lt
|
||||
|
||||
if (!verifyUserSettings(ds_win))
|
||||
goto reenter;
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
|
|
@ -939,10 +720,11 @@ userAddUser(dialogMenuItem *self)
|
|||
|
||||
if (!cancel) {
|
||||
addUser(ds_win);
|
||||
restorescr(save);
|
||||
return DITEM_SUCCESS;
|
||||
ret = DITEM_SUCCESS;
|
||||
}
|
||||
else
|
||||
ret = DITEM_FAILURE;
|
||||
restorescr(save);
|
||||
return DITEM_FAILURE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,13 @@
|
|||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: wizard.c,v 1.7 1995/12/07 10:34:25 peter Exp $
|
||||
* $Id: wizard.c,v 1.8 1996/04/28 20:54:11 jkh Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <sys/types.h>
|
||||
#include "sysinstall.h"
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
|
||||
u_char mbr[] = {
|
||||
250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: devices.c,v 1.55 1996/12/14 23:08:52 jkh Exp $
|
||||
* $Id: devices.c,v 1.56 1996/12/26 21:03:04 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -35,20 +35,17 @@
|
|||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
static Device *Devices[DEV_MAX];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dmenu.c,v 1.27 1996/11/09 16:46:56 joerg Exp $
|
||||
* $Id: dmenu.c,v 1.28 1996/12/09 08:22:12 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "sysinstall.h"
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MAX_MENU 15
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: keymap.c,v 1.1 1996/11/09 16:47:02 joerg Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -37,7 +38,6 @@ struct keymapInfo {
|
|||
};
|
||||
|
||||
#include "keymap.h"
|
||||
#include "sysinstall.h"
|
||||
|
||||
/*
|
||||
* keymap.h is being automatically generated by the Makefile. It
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
|
||||
* $Id: main.c,v 1.32 1996/12/12 08:33:37 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -35,7 +35,6 @@
|
|||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Miscellaneous support routines..
|
||||
*
|
||||
* $Id: misc.c,v 1.25 1996/12/12 22:38:41 jkh Exp $
|
||||
* $Id: misc.c,v 1.26 1996/12/17 00:00:14 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -344,6 +344,123 @@ Mount(char *mountp, void *dev)
|
|||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
WINDOW *
|
||||
openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height)
|
||||
{
|
||||
WINDOW *win;
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
mvwaddstr(win, y, x + 20, title);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
|
||||
ComposeObj *
|
||||
initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max)
|
||||
{
|
||||
ComposeObj *obj = NULL, *first;
|
||||
int n;
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
|
||||
n = 0;
|
||||
while (layout[n].help != NULL) {
|
||||
switch (layout[n].type) {
|
||||
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);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
layout[n].obj = NewButtonObj(win, layout[n].prompt, layout[n].var, layout[n].y + y, layout[n].x + x);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, layout[n].type, (void *) layout[n].obj);
|
||||
n++;
|
||||
}
|
||||
*max = n - 1;
|
||||
/* Find the first object in the list */
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
return first;
|
||||
}
|
||||
|
||||
int
|
||||
layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj, int *n, int max, int *cbutton, int *cancel)
|
||||
{
|
||||
char help_line[80];
|
||||
int ret, i, len = strlen(layout[*n].help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? layout[*n].help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(obj);
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
case SEL_ESC: /* Bail out */
|
||||
*cancel = TRUE;
|
||||
return FALSE;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
case KEY_DOWN:
|
||||
case SEL_CR:
|
||||
case SEL_TAB:
|
||||
if (*n < max)
|
||||
++*n;
|
||||
else
|
||||
*n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cbutton && *cbutton)
|
||||
*cancel = TRUE;
|
||||
else
|
||||
*cancel = FALSE;
|
||||
return FALSE;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (*n)
|
||||
--*n;
|
||||
else
|
||||
*n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tootle them forcefully! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WINDOW *
|
||||
savescr(void)
|
||||
{
|
||||
|
|
@ -360,3 +477,4 @@ restorescr(WINDOW *w)
|
|||
wrefresh(w);
|
||||
delwin(w);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.95 1996/12/17 00:00:15 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.96 1996/12/29 05:51:39 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -37,13 +37,17 @@
|
|||
#ifndef _SYSINSTALL_H_INCLUDE
|
||||
#define _SYSINSTALL_H_INCLUDE
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dialog.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "colors.h"
|
||||
#include "libdisk.h"
|
||||
#include "dist.h"
|
||||
#include "version.h"
|
||||
|
|
@ -173,6 +177,19 @@ typedef struct _variable {
|
|||
char *value;
|
||||
} Variable;
|
||||
|
||||
/* A screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
/* For attribs */
|
||||
#define MAX_ATTRIBS 200
|
||||
#define MAX_NAME 64
|
||||
|
|
@ -342,6 +359,9 @@ extern DMenu MenuHTMLDoc; /* HTML Documentation menu */
|
|||
extern DMenu MenuUsermgmt; /* User management menu */
|
||||
extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */
|
||||
|
||||
/* Stuff from libdialog which isn't properly declared outside */
|
||||
extern void display_helpfile(void);
|
||||
extern void display_helpline(WINDOW *w, int y, int width);
|
||||
|
||||
/*** Prototypes ***/
|
||||
|
||||
|
|
@ -562,6 +582,11 @@ extern dialogMenuItem *item_add(dialogMenuItem *list, char *prompt, char *title,
|
|||
extern void items_free(dialogMenuItem *list, int *curr, int *max);
|
||||
extern int Mkdir(char *);
|
||||
extern int Mount(char *, void *data);
|
||||
extern WINDOW *openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height);
|
||||
extern ComposeObj *initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max);
|
||||
extern int layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj,
|
||||
int *n, int max, int *cbutton, int *cancel);
|
||||
|
||||
extern WINDOW *savescr(void);
|
||||
extern void restorescr(WINDOW *w);
|
||||
extern char *sstrncpy(char *dst, const char *src, int size);
|
||||
|
|
|
|||
|
|
@ -11,18 +11,13 @@
|
|||
* incurred with its use.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "sysinstall.h"
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
#define VTY_STATUS_LINE 24
|
||||
#define TTY_STATUS_LINE 23
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,13 @@
|
|||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: wizard.c,v 1.7 1995/12/07 10:34:25 peter Exp $
|
||||
* $Id: wizard.c,v 1.8 1996/04/28 20:54:11 jkh Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <sys/types.h>
|
||||
#include "sysinstall.h"
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
|
||||
u_char mbr[] = {
|
||||
250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: anonFTP.c,v 1.17 1996/09/06 05:58:27 jkh Exp $
|
||||
* $Id: anonFTP.c,v 1.18 1996/12/09 08:22:09 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Coranth Gryphon. All rights reserved.
|
||||
|
|
@ -36,20 +36,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "sysinstall.h"
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <dialog.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "dialog.priv.h"
|
||||
#include "colors.h"
|
||||
#include "sysinstall.h"
|
||||
|
||||
/* This doesn't change until FTP itself changes */
|
||||
|
||||
|
|
@ -95,55 +85,36 @@ static int okbutton, cancelbutton;
|
|||
#define ANONFTP_DIALOG_WIDTH COLS - 16
|
||||
#define ANONFTP_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
static Layout layout[] = {
|
||||
#define LAYOUT_UID 0
|
||||
{ 2, 3, 8, ANONFTP_UID_LEN - 1,
|
||||
"UID:", "What user ID to assign to FTP Admin",
|
||||
tconf.uid, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UID 1
|
||||
|
||||
#define LAYOUT_GROUP 1
|
||||
{ 2, 15, 15, ANONFTP_GROUP_LEN - 1,
|
||||
"Group:", "Group name that ftp process belongs to",
|
||||
tconf.group, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GROUP 2
|
||||
|
||||
#define LAYOUT_COMMENT 2
|
||||
{ 2, 35, 24, ANONFTP_COMMENT_LEN - 1,
|
||||
"Comment:", "Password file comment for FTP Admin",
|
||||
tconf.comment, STRINGOBJ, NULL },
|
||||
#define LAYOUT_COMMENT 3
|
||||
|
||||
#define LAYOUT_HOMEDIR 3
|
||||
{ 9, 10, 43, ANONFTP_HOMEDIR_LEN - 1,
|
||||
"FTP Root Directory:",
|
||||
"The top directory to chroot to when doing anonymous ftp",
|
||||
tconf.homedir, STRINGOBJ, NULL },
|
||||
#define LAYOUT_HOMEDIR 4
|
||||
|
||||
#define LAYOUT_UPLOAD 4
|
||||
{ 14, 20, 22, ANONFTP_UPLOAD_LEN - 1,
|
||||
"Upload Subdirectory:", "Designated sub-directory that holds uploads",
|
||||
tconf.upload, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UPLOAD 5
|
||||
|
||||
#define LAYOUT_OKBUTTON 5
|
||||
{ 19, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 6
|
||||
|
||||
#define LAYOUT_CANCELBUTTON 6
|
||||
{ 19, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 7
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
|
@ -194,7 +165,7 @@ createFtpUser(void)
|
|||
if (tpw->pw_uid != FTP_UID)
|
||||
msgConfirm("FTP user already exists with a different uid.");
|
||||
|
||||
return (DITEM_SUCCESS); /* succeeds if already exists */
|
||||
return DITEM_SUCCESS; /* succeeds if already exists */
|
||||
}
|
||||
|
||||
sprintf(pwline, "%s::%s:%d::0:0:%s:%s:/bin/date\n", FTP_NAME, tconf.uid, gid, tconf.comment, tconf.homedir);
|
||||
|
|
@ -202,13 +173,13 @@ createFtpUser(void)
|
|||
fptr = fopen(_PATH_MASTERPASSWD,"a");
|
||||
if (! fptr) {
|
||||
msgConfirm("Could not open master password file.");
|
||||
return (DITEM_FAILURE);
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
fprintf(fptr, pwline);
|
||||
fclose(fptr);
|
||||
msgNotify("Remaking password file: %s", _PATH_MASTERPASSWD);
|
||||
vsystem("pwd_mkdb -p %s", _PATH_MASTERPASSWD);
|
||||
return (DITEM_SUCCESS);
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
/* This is it - how to get the setup values */
|
||||
|
|
@ -216,38 +187,28 @@ static int
|
|||
anonftpOpenDialog(void)
|
||||
{
|
||||
WINDOW *ds_win;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
ComposeObj *obj = NULL;
|
||||
int n = 0, cancel = FALSE;
|
||||
int max;
|
||||
char help[FILENAME_MAX];
|
||||
char title[80];
|
||||
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0) {
|
||||
if (!(ds_win = openLayoutDialog(ANONFTP_HELPFILE, " Anonymous FTP Configuration ",
|
||||
ANONFTP_DIALOG_X, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_WIDTH, ANONFTP_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open anonymous ftp dialog window!!");
|
||||
return(DITEM_FAILURE);
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
systemHelpFile(ANONFTP_HELPFILE, help);
|
||||
use_helpfile(help);
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_X, ANONFTP_DIALOG_HEIGHT, ANONFTP_DIALOG_WIDTH, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, ANONFTP_DIALOG_Y, ANONFTP_DIALOG_X + 20, " Anonymous FTP Configuration ");
|
||||
|
||||
draw_box(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 8, ANONFTP_DIALOG_HEIGHT - 11, ANONFTP_DIALOG_WIDTH - 17,
|
||||
/* Draw a sub-box for the path configuration */
|
||||
draw_box(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 8,
|
||||
ANONFTP_DIALOG_HEIGHT - 11, ANONFTP_DIALOG_WIDTH - 17,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
sprintf(title, " Path Configuration ");
|
||||
mvwaddstr(ds_win, ANONFTP_DIALOG_Y + 7, ANONFTP_DIALOG_X + 22, title);
|
||||
|
||||
/** Initialize the config Data Structure **/
|
||||
|
||||
bzero(&tconf, sizeof(tconf));
|
||||
|
||||
SAFE_STRCPY(tconf.group, FTP_GROUP);
|
||||
|
|
@ -256,110 +217,12 @@ anonftpOpenDialog(void)
|
|||
SAFE_STRCPY(tconf.homedir, FTP_HOMEDIR);
|
||||
sprintf(tconf.uid, "%d", FTP_UID);
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
|
||||
n = 0;
|
||||
#define lt layout[n]
|
||||
|
||||
while (lt.help != NULL) {
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + ANONFTP_DIALOG_Y, lt.x + ANONFTP_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + ANONFTP_DIALOG_Y, lt.x + ANONFTP_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
while (first->prev)
|
||||
first = first->prev;
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
cancelbutton = 0;
|
||||
cancel = FALSE;
|
||||
okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_CR:
|
||||
case SEL_TAB:
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
quit = TRUE;
|
||||
if (cancelbutton)
|
||||
cancel = TRUE;
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
}
|
||||
|
||||
obj = initLayoutDialog(ds_win, layout, ANONFTP_DIALOG_X, ANONFTP_DIALOG_Y, &max);
|
||||
|
||||
cancelbutton = okbutton = 0;
|
||||
while (layoutDialogLoop(ds_win, layout, &obj, &n, max, &cancelbutton, &cancel));
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
use_helpfile(NULL);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: devices.c,v 1.55 1996/12/14 23:08:52 jkh Exp $
|
||||
* $Id: devices.c,v 1.56 1996/12/26 21:03:04 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -35,20 +35,17 @@
|
|||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
static Device *Devices[DEV_MAX];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.84 1996/12/14 23:08:58 jkh Exp $
|
||||
* $Id: dist.c,v 1.85 1996/12/29 05:28:39 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -34,8 +34,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include "sysinstall.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
unsigned int Dists;
|
||||
unsigned int DESDists;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dmenu.c,v 1.27 1996/11/09 16:46:56 joerg Exp $
|
||||
* $Id: dmenu.c,v 1.28 1996/12/09 08:22:12 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "sysinstall.h"
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MAX_MENU 15
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: ftp.c,v 1.20 1996/12/11 19:35:26 jkh Exp $
|
||||
* $Id: ftp.c,v 1.21 1997/01/01 12:36:06 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: keymap.c,v 1.1 1996/11/09 16:47:02 joerg Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -37,7 +38,6 @@ struct keymapInfo {
|
|||
};
|
||||
|
||||
#include "keymap.h"
|
||||
#include "sysinstall.h"
|
||||
|
||||
/*
|
||||
* keymap.h is being automatically generated by the Makefile. It
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
|
||||
* $Id: main.c,v 1.32 1996/12/12 08:33:37 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -35,7 +35,6 @@
|
|||
*/
|
||||
|
||||
#include "sysinstall.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: media.c,v 1.68 1996/12/12 08:36:25 jkh Exp $
|
||||
* $Id: media.c,v 1.69 1996/12/14 23:09:04 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -34,8 +34,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include "sysinstall.h"
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/param.h>
|
||||
|
|
@ -47,8 +46,6 @@
|
|||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
static int
|
||||
genericHook(dialogMenuItem *self, DeviceType type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Miscellaneous support routines..
|
||||
*
|
||||
* $Id: misc.c,v 1.25 1996/12/12 22:38:41 jkh Exp $
|
||||
* $Id: misc.c,v 1.26 1996/12/17 00:00:14 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -344,6 +344,123 @@ Mount(char *mountp, void *dev)
|
|||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
WINDOW *
|
||||
openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height)
|
||||
{
|
||||
WINDOW *win;
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
mvwaddstr(win, y, x + 20, title);
|
||||
}
|
||||
return win;
|
||||
}
|
||||
|
||||
ComposeObj *
|
||||
initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max)
|
||||
{
|
||||
ComposeObj *obj = NULL, *first;
|
||||
int n;
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
|
||||
n = 0;
|
||||
while (layout[n].help != NULL) {
|
||||
switch (layout[n].type) {
|
||||
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);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
layout[n].obj = NewButtonObj(win, layout[n].prompt, layout[n].var, layout[n].y + y, layout[n].x + x);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, layout[n].type, (void *) layout[n].obj);
|
||||
n++;
|
||||
}
|
||||
*max = n - 1;
|
||||
/* Find the first object in the list */
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
return first;
|
||||
}
|
||||
|
||||
int
|
||||
layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj, int *n, int max, int *cbutton, int *cancel)
|
||||
{
|
||||
char help_line[80];
|
||||
int ret, i, len = strlen(layout[*n].help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? layout[*n].help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(obj);
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
case SEL_ESC: /* Bail out */
|
||||
*cancel = TRUE;
|
||||
return FALSE;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
case KEY_DOWN:
|
||||
case SEL_CR:
|
||||
case SEL_TAB:
|
||||
if (*n < max)
|
||||
++*n;
|
||||
else
|
||||
*n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cbutton && *cbutton)
|
||||
*cancel = TRUE;
|
||||
else
|
||||
*cancel = FALSE;
|
||||
return FALSE;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (*n)
|
||||
--*n;
|
||||
else
|
||||
*n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tootle them forcefully! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WINDOW *
|
||||
savescr(void)
|
||||
{
|
||||
|
|
@ -360,3 +477,4 @@ restorescr(WINDOW *w)
|
|||
wrefresh(w);
|
||||
delwin(w);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: package.c,v 1.49 1996/11/04 12:56:28 jkh Exp $
|
||||
* $Id: package.c,v 1.50 1996/12/11 09:35:04 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -34,15 +34,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "sysinstall.h"
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include "sysinstall.h"
|
||||
|
||||
/* Like package_extract, but assumes current media device */
|
||||
int
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.95 1996/12/17 00:00:15 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.96 1996/12/29 05:51:39 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -37,13 +37,17 @@
|
|||
#ifndef _SYSINSTALL_H_INCLUDE
|
||||
#define _SYSINSTALL_H_INCLUDE
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dialog.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "colors.h"
|
||||
#include "libdisk.h"
|
||||
#include "dist.h"
|
||||
#include "version.h"
|
||||
|
|
@ -173,6 +177,19 @@ typedef struct _variable {
|
|||
char *value;
|
||||
} Variable;
|
||||
|
||||
/* A screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
/* For attribs */
|
||||
#define MAX_ATTRIBS 200
|
||||
#define MAX_NAME 64
|
||||
|
|
@ -342,6 +359,9 @@ extern DMenu MenuHTMLDoc; /* HTML Documentation menu */
|
|||
extern DMenu MenuUsermgmt; /* User management menu */
|
||||
extern DMenu MenuFixit; /* Fixit floppy/CDROM/shell menu */
|
||||
|
||||
/* Stuff from libdialog which isn't properly declared outside */
|
||||
extern void display_helpfile(void);
|
||||
extern void display_helpline(WINDOW *w, int y, int width);
|
||||
|
||||
/*** Prototypes ***/
|
||||
|
||||
|
|
@ -562,6 +582,11 @@ extern dialogMenuItem *item_add(dialogMenuItem *list, char *prompt, char *title,
|
|||
extern void items_free(dialogMenuItem *list, int *curr, int *max);
|
||||
extern int Mkdir(char *);
|
||||
extern int Mount(char *, void *data);
|
||||
extern WINDOW *openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height);
|
||||
extern ComposeObj *initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max);
|
||||
extern int layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj,
|
||||
int *n, int max, int *cbutton, int *cancel);
|
||||
|
||||
extern WINDOW *savescr(void);
|
||||
extern void restorescr(WINDOW *w);
|
||||
extern char *sstrncpy(char *dst, const char *src, int size);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: tcpip.c,v 1.52 1996/12/12 22:44:22 jkh Exp $
|
||||
* $Id: tcpip.c,v 1.53 1996/12/14 23:09:08 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
|
|
@ -37,17 +37,8 @@
|
|||
* -jkh
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "dialog.priv.h"
|
||||
#include "colors.h"
|
||||
#include "sysinstall.h"
|
||||
#include <sys/param.h>
|
||||
|
||||
/* The help file for the TCP/IP setup screen */
|
||||
#define TCP_HELPFILE "tcp"
|
||||
|
|
@ -65,62 +56,49 @@ static char ipaddr[IPADDR_FIELD_LEN], netmask[IPADDR_FIELD_LEN], extras[EXTRAS_F
|
|||
#define TCP_DIALOG_WIDTH COLS - 16
|
||||
#define TCP_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
static Layout layout[] = {
|
||||
#define LAYOUT_HOSTNAME 0
|
||||
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
|
||||
{ 1, 2, 25, HOSTNAME_FIELD_LEN - 1,
|
||||
"Host:", "Your fully-qualified hostname, e.g. foo.bar.com",
|
||||
hostname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_DOMAINNAME 1
|
||||
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
|
||||
{ 1, 35, 20, HOSTNAME_FIELD_LEN - 1,
|
||||
"Domain:",
|
||||
"The name of the domain that your machine is in, e.g. bar.com",
|
||||
domainname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GATEWAY 2
|
||||
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 5, 2, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Gateway:",
|
||||
"IP address of host forwarding packets to non-local destinations",
|
||||
gateway, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NAMESERVER 3
|
||||
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 5, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Name server:", "IP address of your local DNS server",
|
||||
nameserver, STRINGOBJ, NULL },
|
||||
#define LAYOUT_IPADDR 4
|
||||
{ 10, 10, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 10, 10, 18, IPADDR_FIELD_LEN - 1,
|
||||
"IP Address:",
|
||||
"The IP address to be used for this interface",
|
||||
ipaddr, STRINGOBJ, NULL },
|
||||
#define LAYOUT_NETMASK 5
|
||||
{ 10, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
{ 10, 35, 18, IPADDR_FIELD_LEN - 1,
|
||||
"Netmask:",
|
||||
"The netmask for this interface, e.g. 0xffffff00 for a class C network",
|
||||
netmask, STRINGOBJ, NULL },
|
||||
#define LAYOUT_EXTRAS 6
|
||||
{ 14, 10, 37, HOSTNAME_FIELD_LEN - 1,
|
||||
{ 14, 10, 37, HOSTNAME_FIELD_LEN - 1,
|
||||
"Extra options to ifconfig:",
|
||||
"Any interface-specific options to ifconfig you would like to add",
|
||||
extras, STRINGOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 7
|
||||
{ 19, 15, 0, 0,
|
||||
{ 19, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 8
|
||||
{ 19, 35, 0, 0,
|
||||
{ 19, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
#define _validByte(b) ((b) >= 0 && (b) <= 255)
|
||||
|
|
@ -147,9 +125,8 @@ verifyIP(char *ip)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Check for the settings on the screen - the per interface stuff is
|
||||
/* Check for the settings on the screen - the per-interface stuff is
|
||||
moved to the main handling code now to do it on the fly - sigh */
|
||||
|
||||
static int
|
||||
verifySettings(void)
|
||||
{
|
||||
|
|
@ -174,11 +151,9 @@ tcpOpenDialog(Device *devp)
|
|||
{
|
||||
WINDOW *ds_win, *save;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max;
|
||||
int n = 0, cancel = FALSE;
|
||||
int max, ret;
|
||||
char *tmp;
|
||||
char help[FILENAME_MAX];
|
||||
char title[80];
|
||||
|
||||
if (!RunningAsInit) {
|
||||
|
|
@ -188,18 +163,16 @@ tcpOpenDialog(Device *devp)
|
|||
}
|
||||
save = savescr();
|
||||
dialog_clear_norefresh();
|
||||
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open TCP/IP dialog window!!");
|
||||
if (!(ds_win = openLayoutDialog(TCP_HELPFILE, " Network Configuration ",
|
||||
TCP_DIALOG_X, TCP_DIALOG_Y, TCP_DIALOG_WIDTH, TCP_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open TCP/IP dialog window!!");
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
use_helpfile(systemHelpFile(TCP_HELPFILE, help));
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X, TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X + 20, " Network Configuration ");
|
||||
/* Draw interface configuration box */
|
||||
draw_box(ds_win, TCP_DIALOG_Y + 9, TCP_DIALOG_X + 8, TCP_DIALOG_HEIGHT - 13, TCP_DIALOG_WIDTH - 17,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
|
|
@ -236,6 +209,7 @@ tcpOpenDialog(Device *devp)
|
|||
SAFE_STRCPY(extras, cp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Look up values already recorded with the system, or blank the string variables ready to accept some new data */
|
||||
tmp = variable_get(VAR_HOSTNAME);
|
||||
if (tmp)
|
||||
|
|
@ -258,75 +232,21 @@ tcpOpenDialog(Device *devp)
|
|||
else
|
||||
bzero(nameserver, sizeof(nameserver));
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
n = 0;
|
||||
#define lt layout[n]
|
||||
while (lt.help != NULL) {
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + TCP_DIALOG_Y, lt.x + TCP_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
obj = initLayoutDialog(ds_win, layout, TCP_DIALOG_X, TCP_DIALOG_Y, &max);
|
||||
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
if (n == LAYOUT_HOSTNAME) {
|
||||
/* We are in the Hostname field - calculate the domainname */
|
||||
if ((tmp = index(hostname, '.')) != NULL) {
|
||||
sstrncpy(domainname, tmp + 1, strlen(tmp));
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
}
|
||||
}
|
||||
else if (n == LAYOUT_IPADDR) {
|
||||
while (layoutDialogLoop(ds_win, layout, &obj, &n, max, &cancelbutton, &cancel)) {
|
||||
if (n == LAYOUT_IPADDR) {
|
||||
/* Insert a default value for the netmask, 0xffffff00 is
|
||||
the most appropriate one (entire class C, or subnetted
|
||||
class A/B network). */
|
||||
if(netmask[0] == '\0') {
|
||||
if (netmask[0] == '\0') {
|
||||
strcpy(netmask, "255.255.255.0");
|
||||
RefreshStringObj(layout[LAYOUT_NETMASK].obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (n == LAYOUT_DOMAINNAME) {
|
||||
if (!index(hostname, '.') && domainname[0]) {
|
||||
strcat(hostname, ".");
|
||||
|
|
@ -334,68 +254,24 @@ tcpOpenDialog(Device *devp)
|
|||
RefreshStringObj(layout[LAYOUT_HOSTNAME].obj);
|
||||
}
|
||||
}
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_TAB:
|
||||
case SEL_CR:
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
else {
|
||||
if (verifySettings())
|
||||
quit = TRUE;
|
||||
else if (n == LAYOUT_HOSTNAME) {
|
||||
if (((tmp = index(hostname, '.')) != NULL) && !domainname[0]) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[LAYOUT_DOMAINNAME].obj);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
}
|
||||
|
||||
/* BODGE ALERT! */
|
||||
if (((tmp = index(hostname, '.')) != NULL) && (strlen(domainname)==0)) {
|
||||
SAFE_STRCPY(domainname, tmp + 1);
|
||||
RefreshStringObj(layout[1].obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (!verifySettings())
|
||||
goto reenter;
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
use_helpfile(NULL);
|
||||
|
||||
/* We actually need to inform the rest of sysinstall about this
|
||||
data now - if the user hasn't selected cancel, save the stuff
|
||||
out to the environment via the variable_set layers */
|
||||
data now if the user hasn't selected cancel. Save the stuff
|
||||
out to the environment via the variable_set() mechanism */
|
||||
|
||||
if (!cancel) {
|
||||
DevInfo *di;
|
||||
|
|
@ -431,12 +307,13 @@ tcpOpenDialog(Device *devp)
|
|||
}
|
||||
if (ipaddr[0])
|
||||
variable_set2(VAR_IPADDR, ipaddr);
|
||||
restorescr(save);
|
||||
configResolv(); /* XXX this will do it on the MFS copy XXX */
|
||||
return DITEM_SUCCESS;
|
||||
ret = DITEM_SUCCESS;
|
||||
}
|
||||
else
|
||||
ret = DITEM_FAILURE;
|
||||
restorescr(save);
|
||||
return DITEM_FAILURE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -11,18 +11,13 @@
|
|||
* incurred with its use.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "sysinstall.h"
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
#include "sysinstall.h"
|
||||
|
||||
#define VTY_STATUS_LINE 24
|
||||
#define TTY_STATUS_LINE 23
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: user.c,v 1.4 1996/12/14 23:09:10 jkh Exp $
|
||||
* $Id: user.c,v 1.5 1996/12/15 11:22:37 joerg Exp $
|
||||
*
|
||||
* Copyright (c) 1996
|
||||
* Jörg Wunsch. All rights reserved.
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
*
|
||||
* Copyright (c) 1995
|
||||
* Gary J Palmer. All rights reserved.
|
||||
* Jordan K Hubbard. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
@ -33,19 +34,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <utmp.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
#include <dialog.h>
|
||||
#include "ui_objects.h"
|
||||
#include "dir.h"
|
||||
#include "dialog.priv.h"
|
||||
#include "colors.h"
|
||||
#include "sysinstall.h"
|
||||
#include <utmp.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/param.h>
|
||||
#include <sysexits.h>
|
||||
|
||||
/* The help file for the user mgmt screen */
|
||||
#define USER_HELPFILE "usermgmt"
|
||||
|
|
@ -87,87 +80,74 @@ static int okbutton, cancelbutton;
|
|||
#define USER_DIALOG_WIDTH COLS - 16
|
||||
#define USER_DIALOG_HEIGHT LINES - 2
|
||||
|
||||
/* The screen layout structure */
|
||||
typedef struct _layout {
|
||||
int y; /* x & Y co-ordinates */
|
||||
int x;
|
||||
int len; /* The size of the dialog on the screen */
|
||||
int maxlen; /* How much the user can type in ... */
|
||||
char *prompt; /* The string for the prompt */
|
||||
char *help; /* The display for the help line */
|
||||
void *var; /* The var to set when this changes */
|
||||
int type; /* The type of the dialog to create */
|
||||
void *obj; /* The obj pointer returned by libdialog */
|
||||
} Layout;
|
||||
|
||||
/* The group configuration menu. */
|
||||
static Layout groupLayout[] = {
|
||||
#define LAYOUT_GNAME 0
|
||||
{ 4, 10, 20, GNAME_FIELD_LEN - 1,
|
||||
"Group name:", "The alphanumeric name of the new group (mandatory)",
|
||||
gname, STRINGOBJ, NULL },
|
||||
{ 4, 10, 20, GNAME_FIELD_LEN - 1,
|
||||
"Group name:", "The alphanumeric name of the new group (mandatory)",
|
||||
gname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GID 1
|
||||
{ 4, 38, 10, GID_FIELD_LEN - 1,
|
||||
"GID:", "The numerical ID for this group (leave blank for automatic choice)",
|
||||
gid, STRINGOBJ, NULL },
|
||||
{ 4, 38, 10, GID_FIELD_LEN - 1,
|
||||
"GID:", "The numerical ID for this group (leave blank for automatic choice)",
|
||||
gid, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GMEMB 2
|
||||
{ 11, 10, 40, GMEMB_FIELD_LEN - 1,
|
||||
"Group members:", "Who belongs to this group (i.e., gets access rights for it)",
|
||||
gmemb, STRINGOBJ, NULL },
|
||||
{ 11, 10, 40, GMEMB_FIELD_LEN - 1,
|
||||
"Group members:", "Who belongs to this group (i.e., gets access rights for it)",
|
||||
gmemb, STRINGOBJ, NULL },
|
||||
#define LAYOUT_OKBUTTON 3
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_CANCELBUTTON 4
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
/* The user configuration menu. */
|
||||
static Layout userLayout[] = {
|
||||
#define LAYOUT_UNAME 0
|
||||
{ 3, 6, UT_NAMESIZE, UT_NAMESIZE + 4,
|
||||
"Login ID:", "The login name of the new user (mandatory)",
|
||||
uname, STRINGOBJ, NULL },
|
||||
{ 3, 6, UT_NAMESIZE, UT_NAMESIZE + 4,
|
||||
"Login ID:", "The login name of the new user (mandatory)",
|
||||
uname, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UID 1
|
||||
{ 3, 23, 8, UID_FIELD_LEN - 1,
|
||||
"UID:", "The numerical ID for this user (leave blank for automatic choice)",
|
||||
uid, STRINGOBJ, NULL },
|
||||
{ 3, 23, 8, UID_FIELD_LEN - 1,
|
||||
"UID:", "The numerical ID for this user (leave blank for automatic choice)",
|
||||
uid, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UGROUP 2
|
||||
{ 3, 33, 8, UGROUP_FIELD_LEN - 1,
|
||||
"Group:", "The login group name for this user (leave blank for automatic choice)",
|
||||
ugroup, STRINGOBJ, NULL },
|
||||
{ 3, 33, 8, UGROUP_FIELD_LEN - 1,
|
||||
"Group:", "The login group name for this user (leave blank for automatic choice)",
|
||||
ugroup, STRINGOBJ, NULL },
|
||||
#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 },
|
||||
{ 3, 43, 15, PASSWD_FIELD_LEN - 1,
|
||||
"Password:", "The password for this user (enter this field with care!)",
|
||||
passwd, STRINGOBJ, NULL },
|
||||
#define LAYOUT_GECOS 4
|
||||
{ 8, 6, 33, GECOS_FIELD_LEN - 1,
|
||||
"Full name:", "The user's full name (comment)",
|
||||
gecos, STRINGOBJ, NULL },
|
||||
{ 8, 6, 33, GECOS_FIELD_LEN - 1,
|
||||
"Full name:", "The user's full name (comment)",
|
||||
gecos, STRINGOBJ, NULL },
|
||||
#define LAYOUT_UMEMB 5
|
||||
{ 8, 43, 15, UMEMB_FIELD_LEN - 1,
|
||||
"Member groups:", "The groups this user belongs to (i.e. gets access rights for)",
|
||||
umemb, STRINGOBJ, NULL },
|
||||
{ 8, 43, 15, UMEMB_FIELD_LEN - 1,
|
||||
"Member groups:", "The groups this user belongs to (i.e. gets access rights for)",
|
||||
umemb, STRINGOBJ, NULL },
|
||||
#define LAYOUT_HOMEDIR 6
|
||||
{ 13, 6, 20, HOMEDIR_FIELD_LEN - 1,
|
||||
"Home directory:", "The user's home directory (leave blank for default)",
|
||||
homedir, STRINGOBJ, NULL },
|
||||
{ 13, 6, 20, HOMEDIR_FIELD_LEN - 1,
|
||||
"Home directory:", "The user's home directory (leave blank for default)",
|
||||
homedir, STRINGOBJ, NULL },
|
||||
#define LAYOUT_SHELL 7
|
||||
{ 13, 29, 29, SHELL_FIELD_LEN - 1,
|
||||
"Login shell:", "The user's login shell (leave blank for default)",
|
||||
shell, STRINGOBJ, NULL },
|
||||
{ 13, 29, 29, SHELL_FIELD_LEN - 1,
|
||||
"Login shell:", "The user's login shell (leave blank for default)",
|
||||
shell, STRINGOBJ, NULL },
|
||||
#define LAYOUT_U_OKBUTTON 8
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
{ 18, 15, 0, 0,
|
||||
"OK", "Select this if you are happy with these settings",
|
||||
&okbutton, BUTTONOBJ, NULL },
|
||||
#define LAYOUT_U_CANCELBUTTON 9
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
{ 18, 35, 0, 0,
|
||||
"CANCEL", "Select this if you wish to cancel this screen",
|
||||
&cancelbutton, BUTTONOBJ, NULL },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
/* whine */
|
||||
|
|
@ -357,10 +337,8 @@ userAddGroup(dialogMenuItem *self)
|
|||
{
|
||||
WINDOW *ds_win, *save;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max, firsttime=TRUE;
|
||||
char help[FILENAME_MAX];
|
||||
int n = 0, cancel = FALSE, ret;
|
||||
int max, firsttime = TRUE;
|
||||
|
||||
if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
msgConfirm("This option may only be used after the system is installed, sorry!");
|
||||
|
|
@ -370,18 +348,14 @@ userAddGroup(dialogMenuItem *self)
|
|||
save = savescr();
|
||||
dialog_clear_norefresh();
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open AddGroup dialog window!!");
|
||||
if (!(ds_win = openLayoutDialog(USER_HELPFILE, " User and Group Management ",
|
||||
USER_DIALOG_X, USER_DIALOG_Y, USER_DIALOG_WIDTH, USER_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open addgroup dialog window!!");
|
||||
return(DITEM_FAILURE);
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
use_helpfile(systemHelpFile(USER_HELPFILE, help));
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, USER_DIALOG_Y, USER_DIALOG_X, USER_DIALOG_HEIGHT, USER_DIALOG_WIDTH,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, USER_DIALOG_Y, USER_DIALOG_X + 18, " Users and Group Management ");
|
||||
/* Draw a group entry box */
|
||||
draw_box(ds_win, USER_DIALOG_Y + 2, USER_DIALOG_X + 8, USER_DIALOG_HEIGHT - 6,
|
||||
USER_DIALOG_WIDTH - 17, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
|
|
@ -391,115 +365,22 @@ userAddGroup(dialogMenuItem *self)
|
|||
CLEAR(gid);
|
||||
CLEAR(gmemb);
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
n = 0;
|
||||
#define lt groupLayout[n]
|
||||
while (lt.help != NULL) {
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
obj = initLayoutDialog(ds_win, groupLayout, USER_DIALOG_X, USER_DIALOG_Y, &max);
|
||||
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_TAB:
|
||||
case SEL_CR:
|
||||
if (firsttime && n == LAYOUT_GNAME)
|
||||
{
|
||||
/* fill in the blanks, well, just the GID */
|
||||
completeGroup();
|
||||
RefreshStringObj(groupLayout[LAYOUT_GID].obj);
|
||||
firsttime = FALSE;
|
||||
}
|
||||
if (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
else {
|
||||
if (verifyGroupSettings())
|
||||
quit = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
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;
|
||||
}
|
||||
}
|
||||
#undef lt
|
||||
|
||||
if (!verifyGroupSettings())
|
||||
goto reenter;
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
|
|
@ -507,11 +388,12 @@ userAddGroup(dialogMenuItem *self)
|
|||
|
||||
if (!cancel) {
|
||||
addGroup(ds_win);
|
||||
restorescr(save);
|
||||
return DITEM_SUCCESS;
|
||||
ret = DITEM_SUCCESS;
|
||||
}
|
||||
else
|
||||
ret = DITEM_FAILURE;
|
||||
restorescr(save);
|
||||
return DITEM_FAILURE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Check for the settings on the screen. */
|
||||
|
|
@ -776,10 +658,8 @@ userAddUser(dialogMenuItem *self)
|
|||
{
|
||||
WINDOW *ds_win, *save;
|
||||
ComposeObj *obj = NULL;
|
||||
ComposeObj *first, *last;
|
||||
int n=0, quit=FALSE, cancel=FALSE, ret;
|
||||
int max, firsttime=TRUE;
|
||||
char help[FILENAME_MAX];
|
||||
int n = 0, cancel = FALSE, ret;
|
||||
int max, firsttime = TRUE;
|
||||
|
||||
if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
|
||||
msgConfirm("This option may only be used after the system is installed, sorry!");
|
||||
|
|
@ -788,19 +668,16 @@ userAddUser(dialogMenuItem *self)
|
|||
|
||||
save = savescr();
|
||||
dialog_clear_norefresh();
|
||||
|
||||
/* We need a curses window */
|
||||
ds_win = newwin(LINES, COLS, 0, 0);
|
||||
if (ds_win == 0)
|
||||
msgFatal("Cannot open AddUser dialog window!!");
|
||||
if (!(ds_win = openLayoutDialog(USER_HELPFILE, " User and Group Management ",
|
||||
USER_DIALOG_X, USER_DIALOG_Y, USER_DIALOG_WIDTH, USER_DIALOG_HEIGHT))) {
|
||||
beep();
|
||||
msgConfirm("Cannot open adduser dialog window!!");
|
||||
return(DITEM_FAILURE);
|
||||
}
|
||||
|
||||
/* Say where our help comes from */
|
||||
use_helpfile(systemHelpFile(USER_HELPFILE, help));
|
||||
|
||||
/* Setup a nice screen for us to splat stuff onto */
|
||||
draw_box(ds_win, USER_DIALOG_Y, USER_DIALOG_X, USER_DIALOG_HEIGHT, USER_DIALOG_WIDTH,
|
||||
dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
mvwaddstr(ds_win, USER_DIALOG_Y, USER_DIALOG_X + 18, " Users and Group Management ");
|
||||
/* Draw a user entry box */
|
||||
draw_box(ds_win, USER_DIALOG_Y + 1, USER_DIALOG_X + 3, USER_DIALOG_HEIGHT - 5,
|
||||
USER_DIALOG_WIDTH - 6, dialog_attr, border_attr);
|
||||
wattrset(ds_win, dialog_attr);
|
||||
|
|
@ -814,124 +691,28 @@ userAddUser(dialogMenuItem *self)
|
|||
CLEAR(umemb);
|
||||
CLEAR(homedir);
|
||||
CLEAR(shell);
|
||||
|
||||
/* Loop over the layout list, create the objects, and add them
|
||||
onto the chain of objects that dialog uses for traversal*/
|
||||
n = 0;
|
||||
#define lt userLayout[n]
|
||||
while (lt.help != NULL) {
|
||||
if (n == LAYOUT_PASSWD)
|
||||
DialogInputAttrs = DITEM_NO_ECHO; /* This will affect the new string object if set */
|
||||
switch (lt.type) {
|
||||
case STRINGOBJ:
|
||||
lt.obj = NewStringObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X,
|
||||
lt.len, lt.maxlen);
|
||||
break;
|
||||
|
||||
case BUTTONOBJ:
|
||||
lt.obj = NewButtonObj(ds_win, lt.prompt, lt.var,
|
||||
lt.y + USER_DIALOG_Y, lt.x + USER_DIALOG_X);
|
||||
break;
|
||||
|
||||
default:
|
||||
msgFatal("Don't support this object yet!");
|
||||
}
|
||||
AddObj(&obj, lt.type, (void *) lt.obj);
|
||||
DialogInputAttrs = 0;
|
||||
n++;
|
||||
}
|
||||
max = n - 1;
|
||||
|
||||
/* Find the last object we can traverse to */
|
||||
last = obj;
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
/* Find the first object in the list */
|
||||
first = obj;
|
||||
for (first = obj; first->prev; first = first->prev);
|
||||
|
||||
/* Some more initialisation before we go into the main input loop */
|
||||
n = 0;
|
||||
obj = initLayoutDialog(ds_win, userLayout, USER_DIALOG_X, USER_DIALOG_Y, &max);
|
||||
|
||||
reenter:
|
||||
cancelbutton = okbutton = 0;
|
||||
|
||||
/* Incoming user data - DUCK! */
|
||||
while (!quit) {
|
||||
char help_line[80];
|
||||
int i, len = strlen(lt.help);
|
||||
|
||||
/* Display the help line at the bottom of the screen */
|
||||
for (i = 0; i < 79; i++)
|
||||
help_line[i] = (i < len) ? lt.help[i] : ' ';
|
||||
help_line[i] = '\0';
|
||||
use_helpline(help_line);
|
||||
display_helpline(ds_win, LINES - 1, COLS - 1);
|
||||
|
||||
/* Ask for libdialog to do its stuff */
|
||||
ret = PollObj(&obj);
|
||||
|
||||
/* Handle special case stuff that libdialog misses. Sigh */
|
||||
switch (ret) {
|
||||
/* Bail out */
|
||||
case SEL_ESC:
|
||||
quit = TRUE, cancel=TRUE;
|
||||
break;
|
||||
|
||||
/* This doesn't work for list dialogs. Oh well. Perhaps
|
||||
should special case the move from the OK button ``up''
|
||||
to make it go to the interface list, but then it gets
|
||||
awkward for the user to go back and correct screw up's
|
||||
in the per-interface section */
|
||||
|
||||
case KEY_DOWN:
|
||||
case SEL_TAB:
|
||||
case SEL_CR:
|
||||
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 (n < max)
|
||||
++n;
|
||||
else
|
||||
n = 0;
|
||||
break;
|
||||
|
||||
/* The user has pressed enter over a button object */
|
||||
case SEL_BUTTON:
|
||||
if (cancelbutton)
|
||||
cancel = TRUE, quit = TRUE;
|
||||
else {
|
||||
if (verifyUserSettings(ds_win))
|
||||
quit = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
case SEL_BACKTAB:
|
||||
if (n)
|
||||
--n;
|
||||
else
|
||||
n = max;
|
||||
break;
|
||||
|
||||
case KEY_F(1):
|
||||
display_helpfile();
|
||||
|
||||
/* They tried some key combination we don't support - tell them! */
|
||||
default:
|
||||
beep();
|
||||
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;
|
||||
}
|
||||
}
|
||||
#undef lt
|
||||
|
||||
if (!verifyUserSettings(ds_win))
|
||||
goto reenter;
|
||||
|
||||
/* Clear this crap off the screen */
|
||||
dialog_clear_norefresh();
|
||||
|
|
@ -939,10 +720,11 @@ userAddUser(dialogMenuItem *self)
|
|||
|
||||
if (!cancel) {
|
||||
addUser(ds_win);
|
||||
restorescr(save);
|
||||
return DITEM_SUCCESS;
|
||||
ret = DITEM_SUCCESS;
|
||||
}
|
||||
else
|
||||
ret = DITEM_FAILURE;
|
||||
restorescr(save);
|
||||
return DITEM_FAILURE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,18 +6,13 @@
|
|||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* $Id: wizard.c,v 1.7 1995/12/07 10:34:25 peter Exp $
|
||||
* $Id: wizard.c,v 1.8 1996/04/28 20:54:11 jkh Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
#include <sys/types.h>
|
||||
#include "sysinstall.h"
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
|
||||
u_char mbr[] = {
|
||||
250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1,
|
||||
|
|
|
|||
Loading…
Reference in a new issue