summaryrefslogtreecommitdiff
path: root/menu
diff options
context:
space:
mode:
Diffstat (limited to 'menu')
-rw-r--r--menu/complex.c18
-rw-r--r--menu/main.c6
-rw-r--r--menu/menu.h2
-rw-r--r--menu/simple.c7
-rw-r--r--menu/startup.S1617
5 files changed, 32 insertions, 18 deletions
diff --git a/menu/complex.c b/menu/complex.c
index c0bb30bd..47cf3734 100644
--- a/menu/complex.c
+++ b/menu/complex.c
@@ -110,12 +110,14 @@ void checkbox_handler(t_menusystem *ms, t_menuitem *mi)
if (strcmp(mi->data,"dhcp") == 0) flags.dhcp = (mi->itemdata.checked ? 1 : 0);
}
-int menumain(void)
+int menumain(char *cmdline)
{
t_menuitem * curr;
- char cmdline[160];
+ char cmd[160];
char ip[30];
+ (void)cmdline; /* Not used */
+
// Choose the default title and setup default values for all attributes....
init_menusystem(NULL);
@@ -172,21 +174,21 @@ int menumain(void)
if (curr->action == OPT_EXIT) return 0;
if (curr->action == OPT_RUN)
{
- strcpy(cmdline,curr->data);
+ strcpy(cmd,curr->data);
if (curr == runprep)
{
- strcat(cmdline,infoline);
+ strcat(cmd,infoline);
if (flags.network && !flags.dhcp) // We want static
{
csprint("Enter IP address (last two octets only): ");
getstring(ip, sizeof ip);
- strcat(cmdline,"ipaddr=128.135.");
- strcat(cmdline,ip);
+ strcat(cmd,"ipaddr=128.135.");
+ strcat(cmd,ip);
}
}
if (syslinux)
- runcommand(cmdline);
- else csprint(cmdline);
+ runcommand(cmd);
+ else csprint(cmd);
return 1;
}
}
diff --git a/menu/main.c b/menu/main.c
index 63765c0c..e6d7d269 100644
--- a/menu/main.c
+++ b/menu/main.c
@@ -21,16 +21,14 @@
int syslinux;
-int main(void)
+int _cstart(char *cmdline)
{
int rv;
- int origpage;
- char r,c;
syslinux = issyslinux(); /* Find if syslinux is running */
if (syslinux) gototxtmode(); /* (else assume we are running in DOS) */
- rv = menumain(); /* Run the actual menu system */
+ rv = menumain(cmdline); /* Run the actual menu system */
return rv;
}
diff --git a/menu/menu.h b/menu/menu.h
index ff9a701d..cf41173a 100644
--- a/menu/menu.h
+++ b/menu/menu.h
@@ -190,6 +190,6 @@ int add_menu(const char *title);
t_menuitem * add_item(const char *item, const char *status, t_action action, const char *data, char itemdata);
// Main function for the user's config file
-int menumain(void);
+int menumain(char *cmdline);
#endif
diff --git a/menu/simple.c b/menu/simple.c
index 7870a94e..2d26af86 100644
--- a/menu/simple.c
+++ b/menu/simple.c
@@ -19,12 +19,13 @@
#include "string.h"
#include "syslinux.h"
-char TESTING,RESCUE,MAIN,PREP;
-
-int menumain(void)
+int menumain(char *cmdline)
{
t_menuitem * curr;
+ char TESTING,RESCUE,MAIN; /* The menus we're going to declare */
+ (void)cmdline; /* Not used */
+
// Choose the default title and setup default values for all attributes....
init_menusystem(NULL);
diff --git a/menu/startup.S16 b/menu/startup.S16
index 6ca7ced0..63f31c00 100644
--- a/menu/startup.S16
+++ b/menu/startup.S16
@@ -14,8 +14,21 @@ _start:
cld
rep ; stosl
- /* Invoke main() */
- calll main
+ /* Normalize the command line. At startup 0x80 = length and
+ the command line starts at 0x81, but with whitespace */
+ movl $0x81,%esi
+ movzbl (0x80),%ebx
+ movb $0,(%bx,%si) /* Null-terminate the string */
+1:
+ lodsb
+ dec %al /* Stop on null */
+ cmp $31,%al /* Whitespace? */
+ jbe 1
+ dec %si /* Unskip first character */
+
+ /* Invoke _cstart */
+ pushl %esi /* Pointer to command line */
+ calll _cstart
/* Terminate program (with error code in %al) */
movb $0x4c,%ah