# 2.11BSD#431 - /usr/src/lib/libc/stdio/fgets.c

##### Functions

    fgets             X

       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: }

#### Defined functions

fgets defined in line 7; never used

#### Defined variables

sccsid defined in line 2; never used

Last modified: 1986-03-10 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 262 |