Annotation of 43BSD/contrib/notes/src/pageout.c, revision 1.1

1.1     ! root        1: #include "parms.h"
        !             2: #include "structs.h"
        !             3: 
        !             4: #ifdef RCSIDENT
        !             5: static char rcsid[] = "$Header: pageout.c,v 1.7 85/01/18 15:33:54 notes Rel $";
        !             6: #endif RCSIDENT
        !             7: 
        !             8: /*
        !             9:  *     pageout(where,zfile)
        !            10:  *     FILE *zfile; struct daddr_f *where;
        !            11:  *
        !            12:  *     Dumps the page to the file. Returns the characters dumped.
        !            13:  *
        !            14:  *     Original Coding:        Ray Essick      Long agao
        !            15:  *             moved out of gtext.c and mult.c and others   4/5/82
        !            16:  *     Converted for infinite size notes       RBE 5/8/82
        !            17:  *
        !            18:  */
        !            19: 
        !            20: pageout (io, where, zfile)
        !            21: struct io_f *io;
        !            22: struct daddr_f *where;
        !            23: FILE * zfile;
        !            24: {
        !            25:     int     i,
        !            26:             j,
        !            27:             lines;
        !            28:     long    count;
        !            29:     struct txtbuf_f buf;                               /* hold text */
        !            30: 
        !            31:     lines = 0;
        !            32: 
        !            33:     if (where -> addr == 0)                            /* no text */
        !            34:        where -> textlen = 0;                           /* fix this */
        !            35:     x (lseek (io -> fidtxt, where -> addr, 0) != where -> addr, "pageout: seek");
        !            36:     for (j = i = count = 0; count < where -> textlen; count++)
        !            37:     {
        !            38:        if (i == j)                                     /* another buffer */
        !            39:        {
        !            40:            x ((j = read (io -> fidtxt, buf.txtbuf, BUFSIZE)) < 0, "pageout: read");
        !            41:            i = 0;
        !            42:        }
        !            43:        putc (buf.txtbuf[i], zfile);
        !            44:        if (buf.txtbuf[i++] == '\n')
        !            45:            lines++;                                    /* count lines */
        !            46:     }
        !            47:     return lines;
        !            48: }

unix.superglobalmegacorp.com

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