Annotation of 43BSDReno/lib/libc/stdio/fgets.c, revision 1.1

1.1     ! root        1: #if defined(LIBC_SCCS) && !defined(lint)
        !             2: static char sccsid[] = "@(#)fgets.c    5.2 (Berkeley) 3/9/86";
        !             3: #endif LIBC_SCCS and not lint
        !             4: 
        !             5: #include       <stdio.h>
        !             6: 
        !             7: char *
        !             8: fgets(s, n, iop)
        !             9: char *s;
        !            10: register FILE *iop;
        !            11: {
        !            12:        register c;
        !            13:        register char *cs;
        !            14: 
        !            15:        cs = s;
        !            16:        while (--n>0 && (c = getc(iop)) != EOF) {
        !            17:                *cs++ = c;
        !            18:                if (c=='\n')
        !            19:                        break;
        !            20:        }
        !            21:        if (c == EOF && cs==s)
        !            22:                return(NULL);
        !            23:        *cs++ = '\0';
        !            24:        return(s);
        !            25: }

unix.superglobalmegacorp.com

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