Annotation of coherent/d/lib/libc/stdio/_stropen.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Standard I/O Library Internals
                      3:  * open string for getc, putc
                      4:  */
                      5: 
                      6: #include <stdio.h>
                      7: #include <sys/mdata.h>
                      8: 
                      9: FILE *
                     10: _stropen(string, length, fp)
                     11: char   *string;
                     12: int    length;
                     13: register FILE  *fp;
                     14: {
                     15: #if !RSX
                     16:        int     _fgeteof(),
                     17:                _fputeos(),
                     18:                _fputexs();
                     19: 
                     20:        fp->_bp = fp->_cp = string;
                     21:        fp->_gt = &_fgeteof;
                     22:        fp->_cc = -length;
                     23:        if (fp->_cc < -MAXINT) {        /* most negative int means unlimited */
                     24:                fp->_cc = MAXINT;
                     25:                fp->_pt = &_fputexs;
                     26:        } else
                     27:                fp->_pt = &_fputeos;
                     28: #else
                     29:        fp->v_flag = VF_FIL;
                     30:        fp->v_r0 = -length;
                     31:        fp->v_r1 = string;
                     32:        fp->v_rblk = 1L;        /* seek block > eof block */
                     33:        fp->v_efbk = 0L;        /* => eof at end of string */
                     34:        fp->v_uget = -1;
                     35: #endif
                     36:        return (fp);
                     37: }
                     38: 
                     39: #if !RSX
                     40: static
                     41: int
                     42: _fputeos(c, fp)
                     43: unsigned char  c;
                     44: register FILE  *fp;
                     45: {
                     46:        fp->_cc = 0;
                     47:        return (EOF);
                     48: }
                     49: 
                     50: static
                     51: int
                     52: _fputexs(c, fp)
                     53: unsigned char  c;
                     54: register FILE  *fp;
                     55: {
                     56:        fp->_cc = MAXINT;
                     57:        return (*fp->_cp++ = c);
                     58: }
                     59: #endif

unix.superglobalmegacorp.com

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