[OpenBIOS] r588 - trunk/openbios-devel/modules

svn at openbios.org svn at openbios.org
Tue Sep 22 01:00:42 CEST 2009


Author: laurent
Date: 2009-09-22 01:00:42 +0200 (Tue, 22 Sep 2009)
New Revision: 588

Modified:
   trunk/openbios-devel/modules/mac-parts.c
Log:
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 at vivier.eu>



Modified: trunk/openbios-devel/modules/mac-parts.c
===================================================================
--- trunk/openbios-devel/modules/mac-parts.c	2009-09-21 22:44:21 UTC (rev 587)
+++ trunk/openbios-devel/modules/mac-parts.c	2009-09-21 23:00:42 UTC (rev 588)
@@ -54,14 +54,20 @@
 	DPRINTF("partition %s\n", str);
 	if( str ) {
 		char *tmp;
+		char *comma = strchr(str, ',');
 		parnum = atol(str);
 		if( *str == 0 || *str == ',' )
 			parnum = -1;
-		tmp = str;
-		while (*tmp && *tmp != ',')
-			tmp++;
-		if (*tmp == ',')
-			tmp++;
+		if (comma) {
+			tmp = comma + 1;
+		} else {
+			if (*str >= '0' && *str <= '9') {
+				tmp = (char*)"";
+			} else {
+				tmp = str;
+				parnum = -1;
+			}
+		}
 		if (strcmp(tmp, "%BOOT") == 0)
 			want_bootcode = 1;
 		free(str);




More information about the OpenBIOS mailing list