[syslinux:master] hdt: Fixing automatic mode parsing

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Mon Apr 25 15:29:14 PDT 2011


Commit-ID:  dddbf87e6937b39ffc0986561298db7edfe5bd56
Gitweb:     http://syslinux.zytor.com/commit/dddbf87e6937b39ffc0986561298db7edfe5bd56
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Mon, 18 Apr 2011 22:37:15 +0200
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Mon, 18 Apr 2011 23:06:02 +0200

hdt: Fixing automatic mode parsing

Parsing of the auto='' mode was weak an non functionnal in many
configuration like

auto='dump'

This is now fixed.


---
 com32/hdt/hdt-common.c |   22 ++++++++--------------
 com32/hdt/hdt-common.h |    2 +-
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index f475399..aac50eb 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -121,25 +121,19 @@ void detect_parameters(const int argc, const char *argv[],
 	     */
 
 	    automode=true;
+	    char *argument = (char*)argv[i]+6;
 	    /* Extracting the first parameter */
-	    strcpy(hardware->auto_label, argv[i] + 6);
-	    strcat(hardware->auto_label, " ");
-	    char *pos;
-	    i++;
+	    strcpy(hardware->auto_label, argument);
 
 	    /* While we can't find the other AUTO_DELIMITER, let's process the argv[] */
-	    while (((pos = strstr(argv[i], AUTO_DELIMITER)) == NULL)
-		   && (i < argc)) {
-		strcat(hardware->auto_label, argv[i]);
-		strcat(hardware->auto_label, " ");
+	    while ((strchr(argument, AUTO_DELIMITER) == NULL) && (i+1<argc)) {
 		i++;
-	    }
+	    	argument = (char *)argv[i];
+		strcat(hardware->auto_label, " ");
+		strcat(hardware->auto_label, argument);
+	    } 
 
-	    /* If we didn't reach the end of the line, let's grab the last item */
-	    if (i < argc) {
-		strcat(hardware->auto_label, argv[i]);
-		hardware->auto_label[strlen(hardware->auto_label) - 1] = 0;
-	    }
+	     hardware->auto_label[strlen(hardware->auto_label) - 1] = 0;
 	}
     }
 }
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 3b63877..d37fcc8 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -73,7 +73,7 @@
 /* The char that separate two commands */
 #define AUTO_SEPARATOR ";"
 /* The char that surround the list of commands */
-#define AUTO_DELIMITER "'"
+#define AUTO_DELIMITER '\'' 
 
 /* Graphic to load in background when using the vesa mode */
 #define CLI_DEFAULT_BACKGROUND "backgnd.png"



More information about the Syslinux-commits mailing list