1
/* @(#)fgetline.c 1.5 00/12/03 Copyright 1986 J. Schilling */
3
* Copyright (c) 1986 J. Schilling
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; see the file COPYING. If not, write to
18
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
* XXX should we check if HAVE_USG_STDIO is defined and
25
* XXX use something line memccpy to speed things up ???
34
register int c = '\0';
35
register char *bp = buf;
36
register int nl = '\n';
38
down2(f, _IOREAD, _IORW);
49
* Read up to end of line
51
while ((c = getc(f)) >= 0 && c != nl)
58
* If buffer is empty and we hit EOF, return EOF
60
if(c < 0 && bp == buf)
71
return (fgetline(stdin, buf, len));