summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-03-12 21:23:54 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-03-12 21:23:54 -0700
commit7a708f025b241d8aca62014ebe7279fc605b1a46 (patch)
tree808df85765d6296d59ffa0bf36dbda5b9aaeb6d7
parent1db28c0e4281f93445d3ded6ed518edefadd2803 (diff)
downloadsyslinux-7a708f025b241d8aca62014ebe7279fc605b1a46.tar.gz
cmd.c32: use strpcpy() instead of sprintf()syslinux-3.74-pre4
Make the cmd.c32 module a lot smaller (and avoid a warning) by using strpcpy() instead of sprintf().
-rw-r--r--com32/modules/cmd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/com32/modules/cmd.c b/com32/modules/cmd.c
index f0b0a968..e1d646b5 100644
--- a/com32/modules/cmd.c
+++ b/com32/modules/cmd.c
@@ -18,7 +18,6 @@
#include <string.h>
#include <alloca.h>
-#include <console.h>
#include <com32.h>
int main(int argc, const char *argv[])
@@ -28,15 +27,17 @@ int main(int argc, const char *argv[])
char *tmp;
int i;
- openconsole(&dev_stdcon_r, &dev_stdcon_w);
-
for (i = 1; i < argc; i++)
len += strlen(argv[i]) + 1;
tmp = cmd = alloca(len);
- for (i = 1; i < argc; i++)
- tmp += sprintf(tmp, "%s%s", argv[i], (i == argc-1) ? "" : " ");
+ for (i = 1; i < argc; i++) {
+ tmp = strpcpy(tmp, argv[i]);
+ if (i != argc-1)
+ *tmp++ = ' ';
+ }
+ *tmp = '\0';
syslinux_run_command(cmd);
}