summaryrefslogtreecommitdiffstats
path: root/dos/argv.c
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-18 23:28:30 +0000
committerhpa <hpa>2004-12-18 23:28:30 +0000
commitfc50ce2dd9f4de675605169495a980426fb97181 (patch)
tree78a725f7edb3d332167873ae8c2d06537a15a79b /dos/argv.c
parentc854c3a8224da9dfa30d583edef6bc1b92b17aeb (diff)
downloadsyslinux-fc50ce2dd9f4de675605169495a980426fb97181.tar.gz
syslinux-fc50ce2dd9f4de675605169495a980426fb97181.tar.xz
syslinux-fc50ce2dd9f4de675605169495a980426fb97181.zip
Make the DOS-based installer actually work; mark debugging statements
as "dprintf"
Diffstat (limited to 'dos/argv.c')
-rw-r--r--dos/argv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/dos/argv.c b/dos/argv.c
index 62c3b048..5535331a 100644
--- a/dos/argv.c
+++ b/dos/argv.c
@@ -35,6 +35,7 @@
#include <inttypes.h>
#include <stddef.h>
+#include <stdio.h>
#define ALIGN_UP(p,t) ((t *)(((uintptr_t)(p) + (sizeof(t)-1)) & ~(sizeof(t)-1)))
@@ -67,19 +68,22 @@ int __parse_argv(char ***argv, const char *str)
}
/* This test is AFTER we have processed the null byte;
- we treat it as a whitespace character */
+ we treat it as a whitespace character so it terminates
+ the last argument */
if ( ! *p )
break;
}
q--; /* Point to final null */
/* Now create argv */
- *argv = arg = ALIGN_UP(q,char *);
+ arg = ALIGN_UP(q,char *);
+ *argv = arg;
*arg++ = mem; /* argv[0] */
for ( r = mem ; r < q ; r++ ) {
- if ( *r == '\0' )
+ if ( *r == '\0' ) {
*arg++ = r+1;
+ }
}
*arg++ = NULL; /* Null pointer at the end */