Annotation of coherent/d/usr/src/examples/getc.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: 
        !             3: void error();
        !             4: 
        !             5: main(argc, argv)
        !             6: int argc; char *argv[];
        !             7: {
        !             8:        int foo;
        !             9:        FILE *source, *dest;
        !            10: 
        !            11:        if (argc != 3)
        !            12:                error("Usage: getc source destination");
        !            13: 
        !            14:        if ((source = fopen(argv[1], "r")) == NULL)
        !            15:                error("Cannot open source file");
        !            16:        if ((dest = fopen(argv[2], "w")) == NULL)
        !            17:                error("Cannot open destination file");
        !            18: 
        !            19:        while ((foo = getc(source)) != EOF)
        !            20:                putc(foo, dest);
        !            21:        exit(0);
        !            22: }
        !            23: 
        !            24: void error(string)
        !            25: char *string;
        !            26: {
        !            27:        printf("%s\n", string);
        !            28:        exit (1);
        !            29: }
        !            30: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.