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@yrdsb.edu.on.ca>
/* 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])
/* 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])