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);
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;
}
}
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;
}
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
#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);
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