summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-04-18 22:37:15 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2011-04-18 23:06:02 +0200
commitdddbf87e6937b39ffc0986561298db7edfe5bd56 (patch)
tree2003b1dae7467c1d934ac40b267eef74f93d61f1
parente152c1806905b77e878965ff589671db8c7d34dd (diff)
downloadsyslinux-dddbf87e6937b39ffc0986561298db7edfe5bd56.tar.gz
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.
-rw-r--r--com32/hdt/hdt-common.c22
-rw-r--r--com32/hdt/hdt-common.h2
2 files changed, 9 insertions, 15 deletions
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index f475399c..aac50eb9 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 3b638776..d37fcc8a 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"