Annotation of 43BSD/contrib/X/xterm/buf.c, revision 1.1

1.1     ! root        1: #include <X/mit-copyright.h>
        !             2: 
        !             3: /* Copyright    Massachusetts Institute of Technology    1984, 1985    */
        !             4: 
        !             5: /* buf.c */
        !             6: 
        !             7: #ifndef lint
        !             8: static char *rcsid_buf_c = "$Header: buf.c,v 10.8 86/02/01 16:05:37 tony Rel $";
        !             9: #endif lint
        !            10: 
        !            11: #include <stdio.h>
        !            12: #include <errno.h>
        !            13: #include <X/Xlib.h>
        !            14: #include "ptyx.h"
        !            15: #include <ctype.h>
        !            16: 
        !            17: extern int errno;
        !            18: extern int am_slave;
        !            19: 
        !            20: /*
        !            21:  * If no input available, returns -1. Else, reads characters from
        !            22:  * trmbuf->fildes and puts them in the buffer, then returns first
        !            23:  * character read.
        !            24:  */
        !            25: fill(trmbuf)
        !            26: register Buffer *trmbuf;
        !            27: {
        !            28: #ifdef JUMPSCROLL
        !            29:        extern Terminal term;
        !            30:        register Screen *screen = &term.screen;
        !            31: 
        !            32:        if (screen->scroll_amt)
        !            33:                FlushScroll(screen);
        !            34: #endif JUMPSCROLL
        !            35:        trmbuf->ptr = &trmbuf->buf[0];
        !            36:        trmbuf->cnt = read(trmbuf->fildes, trmbuf->ptr, BUF_SIZE);
        !            37: 
        !            38:        if (trmbuf->cnt == -1) {
        !            39:                if (errno != EWOULDBLOCK) {
        !            40:                        if (errno == EIO && am_slave) exit(0);  /* pty closed */
        !            41:                        else Panic("fill: read returned unexpected error (%d)\n",
        !            42:                                errno);
        !            43:                }
        !            44:                return(-1);
        !            45:        }
        !            46:        
        !            47:        if (--trmbuf->cnt < 0)
        !            48:                Panic("fill: read returned %d\n", trmbuf->cnt+1);
        !            49:        return(*trmbuf->ptr++ & 0177);
        !            50: }

unix.superglobalmegacorp.com

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