[syslinux:pathbased] ifcpuXX: Support multiple parameters with labels
syslinux-bot for Shao Miller
sha0 at zytor.com
Thu Jun 17 11:48:03 PDT 2010
Commit-ID: cc70d0fa55e35fabf250f4dccbaed2fa44f56da7
Gitweb: http://syslinux.zytor.com/commit/cc70d0fa55e35fabf250f4dccbaed2fa44f56da7
Author: Shao Miller <sha0 at terminus.zytor.com>
AuthorDate: Sat, 12 Jun 2010 08:03:28 -0700
Committer: Shao Miller <sha0 at terminus.zytor.com>
CommitDate: Sat, 12 Jun 2010 08:03:28 -0700
ifcpuXX: Support multiple parameters with labels
The ifcpu.c32 and ifcpu64.c32 modules take arguments including
the form <true_label> -- <false_label>. It is convenient to
allow these labels to be not just a single word, but to include
parameters. This is useful for <TAB>-editing and modifying the
command-line to include parameters you'd like to pass.
Not-yet-tested: Shao Miller <shao.miller at yrdsb.edu.on.ca>
---
com32/modules/ifcpu.c | 9 ++++++---
com32/modules/ifcpu64.c | 9 ++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/com32/modules/ifcpu.c b/com32/modules/ifcpu.c
index 8a9a5f4..1e57f08 100644
--- a/com32/modules/ifcpu.c
+++ b/com32/modules/ifcpu.c
@@ -71,20 +71,23 @@ static unsigned char sleep(unsigned int msec)
/* XXX: this really should be librarized */
static void boot_args(char **args)
{
- int len = 0;
+ int len = 0, a = 0;
char **pp;
const char *p;
char c, *q, *str;
for (pp = args; *pp; pp++)
- len += strlen(*pp);
+ len += strlen(*pp) + 1;
- q = str = alloca(len + 1);
+ q = str = alloca(len);
for (pp = args; *pp; pp++) {
p = *pp;
while ((c = *p++))
*q++ = c;
+ *q++ = ' ';
+ a = 1;
}
+ q -= a;
*q = '\0';
if (!str[0])
diff --git a/com32/modules/ifcpu64.c b/com32/modules/ifcpu64.c
index 6d566a2..e123922 100644
--- a/com32/modules/ifcpu64.c
+++ b/com32/modules/ifcpu64.c
@@ -73,20 +73,23 @@ static bool __constfunc cpu_has_feature(int x)
/* XXX: this really should be librarized */
static void boot_args(char **args)
{
- int len = 0;
+ int len = 0, a = 0;
char **pp;
const char *p;
char c, *q, *str;
for (pp = args; *pp; pp++)
- len += strlen(*pp);
+ len += strlen(*pp) + 1;
- q = str = alloca(len + 1);
+ q = str = alloca(len);
for (pp = args; *pp; pp++) {
p = *pp;
while ((c = *p++))
*q++ = c;
+ *q++ = ' ';
+ a = 1;
}
+ q -= a;
*q = '\0';
if (!str[0])
More information about the Syslinux-commits
mailing list