# HG changeset patch # User Pascal Bellard # Date 1254476270 -7200 # Node ID e2bb5ccdcbeb7be104d03bc1ee7ea1cd0b92f84b # Parent a677ef914cf61a0efb136ee6efcbc3df26afb028 syslinux: ifmem.c32 accepts unit K, M, G diff -r a677ef914cf6 -r e2bb5ccdcbeb syslinux/stuff/extra/ifmem.c --- a/syslinux/stuff/extra/ifmem.c Thu Oct 01 22:03:57 2009 +0200 +++ b/syslinux/stuff/extra/ifmem.c Fri Oct 02 11:37:50 2009 +0200 @@ -108,8 +108,17 @@ ram_size = memory_size(); printf("Total memory found %luK.\n",ram_size); for (i = 1; i + 2 < argc; ) { + char *p = s; + unsigned long scale = 1; + + if (*p) while (p[1]) p++; + switch (*p | 0x20) { + case 'g': scale = 1024*1024; *p = 0; break; + case 'm': scale = 1024; + case 'k': *p = 0; break; + } j = i++; // size - if (ram_size >= strtoul(s, NULL, 0)) break; + if (ram_size >= scale * strtoul(s, NULL, 0)) break; s = argv[++i]; } @@ -119,7 +128,7 @@ char c = *argv[i]; if (c >= '0' && c <= '9') j = i; if (i - j > 2 && i < argc) { -#define SZ 512 +#define SZ 4096 static char cmdline[SZ]; char *p = cmdline, *q = s; int j;