Annotation of xinu/sys/LSI/lfputc.c, revision 1.1

1.1     ! root        1: /* lfputc.c - lfputc */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <proc.h>
        !             6: #include <disk.h>
        !             7: #include <lfile.h>
        !             8: #include <dir.h>
        !             9: 
        !            10: /*------------------------------------------------------------------------
        !            11:  *  lfputc  --  put a character onto a (buffered) disk file
        !            12:  *------------------------------------------------------------------------
        !            13:  */
        !            14: lfputc(devptr, ch)
        !            15: struct devsw   *devptr;
        !            16: char   ch;
        !            17: {
        !            18:        struct  flblk   *flptr;
        !            19:        char    ps;
        !            20: 
        !            21:        disable(ps);
        !            22:        flptr = (struct flblk *) devptr->dvioblk;
        !            23:        if (flptr->fl_pid != currpid || !(flptr->fl_mode&FLWRITE)) {
        !            24:                restore(ps);
        !            25:                return(SYSERR);
        !            26:        }
        !            27:        if (flptr->fl_bptr >= &flptr->fl_buff[DBUFSIZ]) {
        !            28:                if (flptr->fl_dch)
        !            29:                        lfsflush(flptr);
        !            30:                lfsetup(flptr->fl_dev, flptr);
        !            31:        }
        !            32:        if (flptr->fl_pos >= (flptr->fl_dent)->fdlen)
        !            33:                (flptr->fl_dent)->fdlen++;
        !            34:        flptr->fl_pos++;
        !            35:        *(flptr->fl_bptr)++ = ch;
        !            36:        flptr->fl_dch = TRUE;
        !            37:        restore(ps);
        !            38:        return(OK);
        !            39: }

unix.superglobalmegacorp.com

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