summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/dmenu.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-04-27 18:03:55 +0000
committerjkh <jkh@FreeBSD.org>1995-04-27 18:03:55 +0000
commit3fd1641f11772fa003260441629578d82c3569cd (patch)
tree867adcb48be8fd39044c4d0c1b61f915686e07fa /usr.sbin/sysinstall/dmenu.c
parent97b0148311aee2dffdad3f759f11688750e783d1 (diff)
downloadFreeBSD-src-3fd1641f11772fa003260441629578d82c3569cd.zip
FreeBSD-src-3fd1641f11772fa003260441629578d82c3569cd.tar.gz
Latest raft of changes.
Added another couple of menu item types. Reshuffled the menus and added a few more. Sure wish I could figure out how to initialize a menu with _one_ initializer rather than two! :(
Diffstat (limited to 'usr.sbin/sysinstall/dmenu.c')
-rw-r--r--usr.sbin/sysinstall/dmenu.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c
index cb8508d..b792f49 100644
--- a/usr.sbin/sysinstall/dmenu.c
+++ b/usr.sbin/sysinstall/dmenu.c
@@ -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$
+ * $Id: dmenu.c,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -96,6 +96,8 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
return;
}
switch (tmp->type) {
+
+ /* User whapped ESC twice and wants a sub-shell */
case MENU_SHELL_ESCAPE:
if (file_executable("/bin/sh"))
sh = "/bin/sh";
@@ -123,6 +125,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
DialogActive = TRUE;
break;
+ /* We want to simply display a file */
case MENU_DISPLAY_FILE: {
char buf[FILENAME_MAX], *cp, *fname = NULL;
@@ -151,6 +154,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
}
break;
+ /* It's a sub-menu; recurse on it */
case MENU_SUBMENU: {
int choice, scroll, curr, max;
@@ -159,14 +163,27 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
break;
}
+ /* Execute it as a system command */
case MENU_SYSTEM_COMMAND:
(void)systemExecute((char *)tmp->ptr);
break;
+ /* Same as above, but execute it in a prgbox */
+ case MENU_SYSTEM_COMMAND_BOX:
+ dialog_prgbox(tmp->title, (char *)tmp->ptr, 22, 76, 1, 1);
+ break;
+
case MENU_CALL:
- ((void (*)())tmp->ptr)();
+ if (((int (*)())tmp->ptr)()) {
+ items_free(nitems, curr, max);
+ return;
+ }
break;
+ case MENU_CANCEL:
+ items_free(nitems, curr, max);
+ return;
+
case MENU_SET_VARIABLE: {
Variable *newvar;
@@ -179,6 +196,7 @@ dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max)
strncpy(newvar->value, tmp->ptr, 1024);
newvar->next = VarHead;
VarHead = newvar;
+ msgInfo("Set variable %s", newvar->value);
}
break;
OpenPOWER on IntegriCloud