# HG changeset patch # User Pascal Bellard # Date 1249740273 -7200 # Node ID 03b14f7eba36c3d9d374779224db1902009ad0d8 # Parent 4076c5e6d6d92e2b7a154e4c9bc95bb024c2184c syslinux/ifmem: add extra arguments in cmdline diff -r 4076c5e6d6d9 -r 03b14f7eba36 syslinux/stuff/extra/ifmem.c --- a/syslinux/stuff/extra/ifmem.c Sat Aug 08 10:22:34 2009 +0200 +++ b/syslinux/stuff/extra/ifmem.c Sat Aug 08 16:04:33 2009 +0200 @@ -39,7 +39,7 @@ #include #include -static long memory_size(void) +static unsigned long memory_size(void) { com32sys_t ireg, oreg; @@ -64,14 +64,32 @@ return 1; } + # find target according to ram size for (i = 1; i + 2 < argc; ) { i++; // size if (memory_size() >= strtoul(s, NULL, 0)) break; s = argv[++i]; } - if (argv[i]) - syslinux_run_command(argv[i]); - else - syslinux_run_default(); + + # find and copy extra parameters to command line + # assume last parameter is "noram" + for (s = argv[i]; i < argc; i++) { + if (!strcmp(argv[i],"noram") && ++i < argc) { +#define SZ 512 + static char cmdline[SZ]; + char *p = cmdline, *q = s; + int j; + for (j = i; j <= argc; j++) { + while (*q && p < cmdline + SZ -1) *p++ = *q++; + if (p < cmdline + SZ -1) *p++ = ' '; + q = argv[j]; + } + *p++ = 0; + s = cmdline; + } + } + + if (s) syslinux_run_command(s); + else syslinux_run_default(); return -1; }