source: bootcd/isolinux/syslinux-6.03/com32/modules/cat.c @ dd1be7c

Last change on this file since dd1be7c was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 524 bytes
RevLine 
[e16e8f2]1#include <stdio.h>
2#include <stdlib.h>
3#include <console.h>
4
5int main(int argc, char *argv[])
6{
7    FILE *f;
8    int i;
9    int len;
10    char buf[4096];
11
12    if (argc < 2) {
13        fprintf(stderr, "Usage: %s filename...\n", argv[0]);
14        return 1;
15    }
16
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;
22        }
23
24        while ((len = fread(buf, 1, sizeof buf, f)) > 0)
25            fwrite(buf, 1, len, stdout);
26       
27        fclose(f);
28    }
29
30    return 0;
31}
Note: See TracBrowser for help on using the repository browser.