Adding upstream version 3.86+dfsg.
[syslinux-debian/hramrach.git] / com32 / samples / cat.c
blob16380b0eced204116b47b98fa37b8f7e624a197e
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <console.h>
5 int main(int argc, char *argv[])
7 FILE *f;
8 int ch;
9 int i;
11 openconsole(&dev_stdcon_r, &dev_stdcon_w);
13 printf("argv = %p\n", argv);
14 for (i = 0; i <= argc; i++)
15 printf("argv[%d] = %p = \"%s\"\n", i, argv[i], argv[i]);
17 if (argc < 2) {
18 fprintf(stderr, "Missing file name!\n");
19 exit(1);
22 printf("File = %s\n", argv[1]);
24 f = fopen(argv[1], "r");
25 while ((ch = getc(f)) != EOF)
26 putchar(ch);
28 fclose(f);
30 return 0;