summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-15 22:50:29 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-15 22:54:22 -0800
commit8404cd587d44f412819ce09adfb5f62b9b5e05e7 (patch)
tree5de5a463ccc7adeb5f1acb29452eff834d7fb1d5
parentdefcbbc6527cd20bd45e42fab53d7e185156df48 (diff)
downloadsyslinux-8404cd587d44f412819ce09adfb5f62b9b5e05e7.tar.gz
hello.c: print arguments, no input section
Make "Hello, World!" a little bit more plain, but do print out its arguments, if any. Useful for testing.
-rw-r--r--com32/samples/hello.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/com32/samples/hello.c b/com32/samples/hello.c
index 4b29901d..27fd7d53 100644
--- a/com32/samples/hello.c
+++ b/com32/samples/hello.c
@@ -20,21 +20,16 @@
#include <stdio.h>
#include <console.h>
-int main(void)
+int main(int argc, char *argv[])
{
- char buffer[1024];
+ int i;
openconsole(&dev_stdcon_r, &dev_stdcon_w);
printf("Hello, World!\n");
- for (;;) {
- printf("> ");
- fgets(buffer, sizeof buffer, stdin);
- if ( !strncmp(buffer, "exit", 4) )
- break;
- printf(": %s", buffer);
- }
+ for (i = 1; i < argc; i++)
+ printf("%s%c", argv[i], (i == argc-1) ? '\n' : ' ');
return 0;
}