Annotation of researchv9/jerq/src/lib/j/get.c, revision 1.1

1.1     ! root        1: #include <jerq.h>
        !             2: #include <jerqio.h>
        !             3: #define _SYSREAD       5
        !             4: 
        !             5: getchar()
        !             6: {
        !             7:        return(getc(stdin));
        !             8: }
        !             9: 
        !            10: getc(f)
        !            11: register FILE *f;
        !            12: {
        !            13:        register int c;
        !            14: 
        !            15:        if (f->base == NULL)
        !            16:                f->cp = f->base = alloc(BUFSIZ);
        !            17:        if (f->count == 0) {
        !            18:                f->count = _read(fileno(f),f->base,BUFSIZ);
        !            19:                if (f->count == 0)
        !            20:                        return(EOF);
        !            21:                f->cp = f->base;
        !            22:        }
        !            23:        f->count--;
        !            24:        c = *f->cp++;
        !            25:        c &= 0xff;
        !            26:        return(c);
        !            27: }
        !            28: 
        !            29: _read(i,buf,n)
        !            30: char *buf;
        !            31: {
        !            32:        tag(_SYSREAD);
        !            33:        jputshort(i);
        !            34:        jflush();
        !            35:        return(jgetbuf(buf,n));
        !            36: }

unix.superglobalmegacorp.com

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