Annotation of researchv9/libc/stdio/fgets.c, revision 1.1.1.1

1.1       root        1: /* @(#)fgets.c 4.1 (Berkeley) 12/21/80 */
                      2: #include       <stdio.h>
                      3: 
                      4: char *
                      5: fgets(s, n, iop)
                      6: char *s;
                      7: register FILE *iop;
                      8: {
                      9:        register c;
                     10:        register char *cs;
                     11: 
                     12:        cs = s;
                     13:        while (--n>0 && (c = getc(iop))>=0) {
                     14:                *cs++ = c;
                     15:                if (c=='\n')
                     16:                        break;
                     17:        }
                     18:        if (c<0 && cs==s)
                     19:                return(NULL);
                     20:        *cs++ = '\0';
                     21:        return(s);
                     22: }

unix.superglobalmegacorp.com

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