Annotation of researchv9/jerq/src/lib/mj/put.c, revision 1.1

1.1     ! root        1: #include <jerq.h>
        !             2: #include <jerqio.h>
        !             3: #define _SYSWRITE      3
        !             4: 
        !             5: putchar(c)
        !             6: {
        !             7:        putc(c,stdout);
        !             8: }
        !             9: 
        !            10: putc(c,f)
        !            11: register FILE *f;
        !            12: {
        !            13:        register i = 0;
        !            14: 
        !            15:        if (f->base == NULL)
        !            16:        {
        !            17:                f->cp = f->base = alloc(BUFSIZ);
        !            18:                if (f->base == NULL)
        !            19:                        return(-1);
        !            20:                f->count = BUFSIZ;
        !            21:        }
        !            22:        *f->cp++ = c;
        !            23:        if (--f->count == 0 || ((c == '\n') && isatty(f)))
        !            24:                i = fflush(f);
        !            25:        return(i);
        !            26: }
        !            27: 
        !            28: fflush(f)
        !            29: register FILE *f;
        !            30: {
        !            31:        register int n, r;
        !            32: 
        !            33:        if ((f->flag & _IOWRT) && ((n = f->cp - f->base) > 0))
        !            34:                r = _write(fileno(f),f->base,n);
        !            35:        f->cp = f->base;
        !            36:        f->count = BUFSIZ;
        !            37:        return((r == n) - 1);
        !            38: }
        !            39: 
        !            40: puts(s)
        !            41: register char *s;
        !            42: {
        !            43:        fputs(s,stdout);
        !            44: }
        !            45: 
        !            46: fputs(s,f)
        !            47: register char *s;
        !            48: register FILE *f;
        !            49: {
        !            50:        register int c;
        !            51:        while (c = *s++)
        !            52:                putc(c,f);
        !            53: }
        !            54: 
        !            55: _write(fd,buf,n)
        !            56: char *buf;
        !            57: {
        !            58:        tag(_SYSWRITE);
        !            59:        jputshort(fd);
        !            60:        jputbuf(buf,n);
        !            61:        return(jgetshort());
        !            62: }
        !            63: 

unix.superglobalmegacorp.com

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