home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / libfake / fgetline.c < prev    next >
C/C++ Source or Header  |  1994-01-02  |  387b  |  23 lines

  1. /*
  2.  * simulate 4.4BSD fgetline using the more general fgetfln primitives
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include <sys/types.h>
  7. #include <fgetfln.h>
  8.  
  9. char *
  10. fgetline(fp, lenp)
  11. FILE *fp;
  12. register size_t *lenp;
  13. {
  14.     int len;
  15.     register char *line = fgetfln(fp, -1, &len);
  16.  
  17.     if (line != NULL)
  18.         (void) dogets(line, &len);    /* stomp innocent newline */
  19.     if (lenp != NULL)
  20.         *lenp = len;
  21.     return line;
  22. }
  23.