aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-21 22:32:12 +0000
committerhpa <hpa>2004-12-21 22:32:12 +0000
commit6eb3c5e7ade4e74c5446d1a0776c0f49c7072d07 (patch)
tree88813297cb9dbee080fa9a10943f44e123a52d55 /com32
parent525bbe0393f388e065447044b421b84b2e187c8c (diff)
downloadsyslinux-elf-6eb3c5e7ade4e74c5446d1a0776c0f49c7072d07.tar.gz
syslinux-elf-6eb3c5e7ade4e74c5446d1a0776c0f49c7072d07.tar.xz
syslinux-elf-6eb3c5e7ade4e74c5446d1a0776c0f49c7072d07.zip
extlinux: Document need for MBR, and usage on a RAID system.
Add cat.c32 as one of the sample programs.
Diffstat (limited to 'com32')
-rw-r--r--com32/samples/Makefile4
-rw-r--r--com32/samples/cat.c31
2 files changed, 33 insertions, 2 deletions
diff --git a/com32/samples/Makefile b/com32/samples/Makefile
index ddcdaa26..07d8156b 100644
--- a/com32/samples/Makefile
+++ b/com32/samples/Makefile
@@ -39,9 +39,9 @@ LNXLIBS = ../libutil/libutil_lnx.a
.SUFFIXES: .lss .c .o .elf .c32 .lnx
-all: hello.c32 \
+all: hello.c32 cat.c32 \
fancyhello.c32 fancyhello.lnx \
- keytest.c32 keytest.lnx
+ keytest.c32 keytest.lnx \
.PRECIOUS: %.o
%.o: %.S
diff --git a/com32/samples/cat.c b/com32/samples/cat.c
new file mode 100644
index 00000000..277427ff
--- /dev/null
+++ b/com32/samples/cat.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <console.h>
+
+int main(int argc, char *argv[])
+{
+ FILE *f;
+ int ch;
+ int i;
+
+ openconsole(&dev_stdcon_r, &dev_stdcon_w);
+
+ printf("argv = %p\n", argv);
+ for ( i = 0 ; i <= argc ; i++ )
+ printf("argv[%d] = %p = \"%s\"\n", i, argv[i], argv[i]);
+
+ if ( argc < 2 ) {
+ fprintf(stderr, "Missing file name!\n");
+ exit(1);
+ }
+
+ printf("File = %s\n", argv[1]);
+
+ f = fopen(argv[1], "r");
+ while ( (ch = getc(f)) != EOF )
+ putchar(ch);
+
+ fclose(f);
+
+ return 0;
+}