rename fgetline() and sharpen axe for bostic...

This commit is contained in:
cgd 1994-01-04 05:16:44 +00:00
parent 7cf02fbc34
commit 02254e0c37
6 changed files with 17 additions and 17 deletions

View File

@ -42,7 +42,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)quiz.c 5.1 (Berkeley) 11/10/91";*/
static char rcsid[] = "$Id: quiz.c,v 1.4 1993/12/22 07:23:27 cgd Exp $";
static char rcsid[] = "$Id: quiz.c,v 1.5 1994/01/04 05:23:56 cgd Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -129,7 +129,7 @@ get_file(file)
*/
qp = &qlist;
qsize = 0;
while ((lp = fgetline(fp, &len)) != NULL) {
while ((lp = fgetln(fp, &len)) != NULL) {
if (qp->q_text && qp->q_text[strlen(qp->q_text) - 1] == '\\')
qp->q_text = appdstr(qp->q_text, lp);
else {
@ -262,7 +262,7 @@ quiz()
qp->q_asked = TRUE;
(void)printf("%s?\n", question);
for (;; ++guesses) {
if ((answer = fgetline(stdin, &len)) == NULL) {
if ((answer = fgetln(stdin, &len)) == NULL) {
score(rights, wrongs, guesses);
exit(0);
}

View File

@ -1,11 +1,11 @@
# from: @(#)Makefile.inc 5.7 (Berkeley) 6/27/91
# $Id: Makefile.inc,v 1.4 1993/10/18 20:24:34 cgd Exp $
# $Id: Makefile.inc,v 1.5 1994/01/04 05:16:44 cgd Exp $
# stdio sources
.PATH: ${.CURDIR}/stdio
SRCS+= clrerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c \
fgetline.c fgetpos.c fgets.c fileno.c findfp.c flags.c fopen.c \
fgetln.c fgetpos.c fgets.c fileno.c findfp.c flags.c fopen.c \
fprintf.c fpurge.c fputc.c fputs.c fread.c freopen.c fscanf.c \
fseek.c fsetpos.c ftell.c funopen.c fvwrite.c fwalk.c fwrite.c \
getc.c getchar.c gets.c getw.c makebuf.c perror.c printf.c putc.c \
@ -15,7 +15,7 @@ SRCS+= clrerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c \
vfscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c \
wbuf.c wsetup.c
MAN3+= fclose.0 ferror.0 fflush.0 fgetline.0 fgets.0 fopen.0 fputs.0 \
MAN3+= fclose.0 ferror.0 fflush.0 fgetln.0 fgets.0 fopen.0 fputs.0 \
fread.0 fseek.0 funopen.0 getc.0 mktemp.0 perror.0 printf.0 putc.0 \
remove.0 scanf.0 setbuf.0 stdio.0 tmpnam.0 ungetc.0

View File

@ -27,11 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Header: /cvsroot/src/usr.bin/asa/asa.c,v 1.3 1993/12/23 20:13:15 jtc Exp $
* $Header: /cvsroot/src/usr.bin/asa/asa.c,v 1.4 1994/01/04 05:23:34 cgd Exp $
*/
#ifndef lint
static char *rcsid = "$Id: asa.c,v 1.3 1993/12/23 20:13:15 jtc Exp $";
static char *rcsid = "$Id: asa.c,v 1.4 1994/01/04 05:23:34 cgd Exp $";
#endif
#include <stdio.h>
@ -72,7 +72,7 @@ asa(f)
char *buf;
int len;
if ((buf = fgetline (f, &len)) != NULL) {
if ((buf = fgetln (f, &len)) != NULL) {
buf[len - 1] = '\0';
/* special case the first line */
switch (buf[0]) {
@ -88,7 +88,7 @@ asa(f)
fputs (&buf[1], stdout);
}
while ((buf = fgetline(f, &len)) != NULL) {
while ((buf = fgetln(f, &len)) != NULL) {
buf[len - 1] = '\0';
switch (buf[0]) {
default:

View File

@ -43,7 +43,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)join.c 5.1 (Berkeley) 11/18/91";*/
static char rcsid[] = "$Id: join.c,v 1.5 1993/12/22 07:24:18 cgd Exp $";
static char rcsid[] = "$Id: join.c,v 1.6 1994/01/04 05:24:34 cgd Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -308,7 +308,7 @@ slurp(F)
F->pushback = -1;
continue;
}
if ((bp = fgetline(F->fp, &len)) == NULL)
if ((bp = fgetln(F->fp, &len)) == NULL)
return;
if (lp->linealloc <= len + 1) {
if (lp->linealloc == 0)

View File

@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)rev.c 5.2 (Berkeley) 3/21/92";*/
static char rcsid[] = "$Id: rev.c,v 1.3 1993/12/22 07:10:50 cgd Exp $";
static char rcsid[] = "$Id: rev.c,v 1.4 1994/01/04 05:24:10 cgd Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -84,7 +84,7 @@ main(argc, argv)
}
filename = *argv++;
}
while (p = fgetline(fp, &len)) {
while (p = fgetln(fp, &len)) {
if (p[len-1] == '\n')
--len;
t = p + len - 1;

View File

@ -43,7 +43,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)main.c 5.6 (Berkeley) 8/30/92";*/
static char rcsid[] = "$Id: main.c,v 1.3 1993/12/22 07:38:51 cgd Exp $";
static char rcsid[] = "$Id: main.c,v 1.4 1994/01/04 05:23:03 cgd Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -287,11 +287,11 @@ mf_fgets(sp, spflag)
}
/*
* Use fgetline so that we can handle essentially infinite input
* Use fgetln so that we can handle essentially infinite input
* data. Can't use the pointer into the stdio buffer as the process
* space because the ungetc() can cause it to move.
*/
p = fgetline(f, &len);
p = fgetln(f, &len);
if (ferror(f))
err(FATAL, "%s: %s", fname, strerror(errno ? errno : EIO));
if (p[len-1] == '\n')