mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
mac-parts: better management of comma.
from "PowerPC Microprocessor CHRP binding", "11.1.2. Open Method Algorithm": "If the argument string contains a comma, or if the argument string begins with a decimal digit, the partition component is deemed to be present." Signed-off-by: Laurent Vivier <Laurent@vivier.eu> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@588 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -54,14 +54,20 @@ macparts_open( macparts_info_t *di )
|
|||||||
DPRINTF("partition %s\n", str);
|
DPRINTF("partition %s\n", str);
|
||||||
if( str ) {
|
if( str ) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
char *comma = strchr(str, ',');
|
||||||
parnum = atol(str);
|
parnum = atol(str);
|
||||||
if( *str == 0 || *str == ',' )
|
if( *str == 0 || *str == ',' )
|
||||||
parnum = -1;
|
parnum = -1;
|
||||||
tmp = str;
|
if (comma) {
|
||||||
while (*tmp && *tmp != ',')
|
tmp = comma + 1;
|
||||||
tmp++;
|
} else {
|
||||||
if (*tmp == ',')
|
if (*str >= '0' && *str <= '9') {
|
||||||
tmp++;
|
tmp = (char*)"";
|
||||||
|
} else {
|
||||||
|
tmp = str;
|
||||||
|
parnum = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (strcmp(tmp, "%BOOT") == 0)
|
if (strcmp(tmp, "%BOOT") == 0)
|
||||||
want_bootcode = 1;
|
want_bootcode = 1;
|
||||||
free(str);
|
free(str);
|
||||||
|
|||||||
Reference in New Issue
Block a user