# 2.11BSD#431 - /usr/ingres/source/gutil/fgetline.c

##### Functions

    fgetline          X

       1: # include   <stdio.h>
       2:
       3: /*
       4: **  FGETLINE -- get line from file
       5: **
       6: **	This routine reads a single newline-terminated line from
       7: **	a file.
       8: **
       9: **	Parameters:
      10: **		buf -- the buffer in which to place the result.
      11: **		maxch -- the maximum number of characters the
      12: **			buffer can hold.
      13: **		iop -- the file from which to read the characters.
      14: **
      15: **	Returns:
      16: **		NULL -- end-of-file or error.
      17: **		else -- 'buf'.
      18: **
      19: **	Side Effects:
      20: **		File activity on 'iop'.
      21: **
      22: **	Requires:
      23: **		getc -- to get the characters.
      24: **
      25: **	Called By:
      26: **		USER
      27: **
      28: **	Compilation Flags:
      29: **		none
      30: **
      31: **	Trace Flags:
      32: **		none
      33: **
      34: **	Diagnostics:
      35: **		none
      36: **
      37: **	Syserrs:
      38: **		none
      39: **
      40: **	History:
      41: **		8/2/78 (eric) -- written
      42: */
      43:
      44: char *fgetline(buf, maxch, iop)
      45: char    *buf;
      46: int maxch;
      47: FILE    *iop;
      48: {
      49:     register char   *p;
      50:     register int    n;
      51:     register int    c;
      52:
      53:     p = buf;
      54:
      55:     for (n = maxch; n > 0; n--)
      56:     {
      57:         c = getc(iop);
      58:
      59:         /* test for end-of-file or error */
      60:         if (c == EOF)
      61:         {
      62:             *p = 0;
      63:             return (NULL);
      64:         }
      65:
      66:         /* test for newline */
      67:         if (c == '\n')
      68:             break;
      69:
      70:         /* insert character into buffer */
      71:         *p++ = c;
      72:     }
      73:
      74:     /* null-terminate the string */
      75:     *p = 0;
      76:     return (buf);
      77: }

#### Defined functions

fgetline defined in line 44; used 7 times

- in /usr/ingres/source/iutil/getuser.c line 54
- in /usr/ingres/source/iutil/initucode.c line 261, 395, 749
- in /usr/ingres/source/support/subs.c line 270
- in /usr/ingres/source/support/usersetup.c line 46, 83

Last modified: 1995-02-09 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 474 |