Add memtest support.
[syslinux-debian/hramrach.git] / com32 / modules / cat.c
blob2a7683f2708b075bc03b8055fc2b7b1151d72770
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <console.h>
5 int main(int argc, char *argv[])
7 FILE *f;
8 int i;
9 int len;
10 char buf[4096];
12 if (argc < 2) {
13 fprintf(stderr, "Usage: %s filename...\n", argv[0]);
14 return 1;
17 for (i = 1; i < argc; i++) {
18 f = fopen(argv[i], "r");
19 if (!f) {
20 fprintf(stderr, "%s: %s: file not found\n", argv[0], argv[i]);
21 return 1;
24 while ((len = fread(buf, 1, sizeof buf, f)) > 0)
25 fwrite(buf, 1, len, stdout);
27 fclose(f);
30 return 0;