home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
TELECOM
/
UUCPbb_2_1_src.lzh
/
UUCPBB21
/
mfgets.c
< prev
next >
Wrap
Text File
|
1994-09-25
|
786b
|
37 lines
/*
* mfgets (modified fgets)
*
* Same as fgets() only this version looks for either a linefeed
* or a carriage return as the end-of-line character. It returns
* the line without the EOL character.
*
* Returns a NULL if EOF was encountered.
*
* From Mark Griffith's OS-9 UUCP software. Thanks to Mark for his general
* okey-dokey to use it. -- Bob Billson [REB]
*/
#include <stdio.h>
char *mfgets (s, n, iop)
char *s;
int n;
FILE *iop;
{
register int c;
char *cs;
cs = s;
while (--n > 0 && (c = getc (iop)) != EOF)
if (c == 0x0d || c == 0x0a)
{
*cs = '\0';
break;
}
else
*cs++ = c;
return ((c == EOF && cs == s) ? NULL : s);
}