home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixlib36d
/
src
/
stdio
/
c
/
fgets
< prev
next >
Wrap
Text File
|
1994-03-08
|
393b
|
23 lines
static char sccs_id[] = "@(#) fgets.c 1.1 " __DATE__ " HJR";
/* fgets.c (c) Copyright 1990 H.Rogers */
#include <stdio.h>
__STDIOLIB__
char *
fgets (register char *_s, register int n, register FILE * f)
{
register char *s = _s;
register int c = 0;
while (--n > 0 && (c = getc (f)) >= 0)
if ((*s++ = c) == '\n')
break;
*s = 0;
return ((c < 0 && s == _s) ? 0 : _s);
}