Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

HACK HACK HACK :3

Name: Person 2007-08-15 23:34 ID:5we9RRfW

Hack this *NON* personal army

www.myspace.com/xxplaydead457


Fuck it up.

Name: Anonymous 2008-05-01 19:14

>>14
/* POSIX cat implementation */
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv){
    int uflag = 0, retval = 0;
    if(*argv && *++argv)    {
        if(! strcmp(*argv, "-u"))
        {
            uflag = 1;
            setvbuf(stdout, NULL, _IONBF, 0);
            argv++;
        }
    }
    do
    {
        FILE* input;
        int c;
        if(! *argv || ! strcmp(*argv, "-"))        {
            input = stdin;
        }
        else
        {
            input = fopen(*argv, "rb");
            if(! input)
            {
                fprintf(stderr, "Unable to open %s: ", *argv);
                perror(NULL);
                retval = 1;
                continue;
            }
        }
        if(uflag)
            setvbuf(input, NULL, _IONBF, 0);
        while((c = fgetc(input)) != EOF)
        {
            if(putchar(c) == EOF)
            {
                perror("Output failure");
                return 1;
            }
        }
    } while (*argv && *++argv);
    return retval;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List