diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2007-02-21 03:53:33 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2007-02-21 03:53:33 +0000 |
commit | 6a13437e9b409624604d242ffd9ee25ad6044bf2 (patch) | |
tree | f9d1d211df387878d22b0d5ea075cab0511cada4 /games/hack | |
parent | 65e3861d22f0095c30e36c5cf96c217b97366f1d (diff) |
- Pass full buffer size to fgets.
- No need to initialize buffer.
- Spacing.
Based on diff from Charles Longeau <chl at tuxfamily dot org> long ago.
OK moritz@.
Diffstat (limited to 'games/hack')
-rw-r--r-- | games/hack/hack.pager.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c index 9210f410edb..74ce3e2d0ec 100644 --- a/games/hack/hack.pager.c +++ b/games/hack/hack.pager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.pager.c,v 1.11 2005/05/01 02:43:12 djm Exp $ */ +/* $OpenBSD: hack.pager.c,v 1.12 2007/02/21 03:53:32 ray Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -62,7 +62,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: hack.pager.c,v 1.11 2005/05/01 02:43:12 djm Exp $"; +static const char rcsid[] = "$OpenBSD: hack.pager.c,v 1.12 2007/02/21 03:53:32 ray Exp $"; #endif /* not lint */ /* This file contains the command routine dowhatis() and a pager. */ @@ -142,8 +142,8 @@ page_more(FILE *fp, int strip) set_pager(0); bufr = (char *) alloc((unsigned) CO); - bufr[CO-1] = 0; - while(fgets(bufr,CO-1,fp) && (!strip || *bufr == '\t') && !got_intrup){ + while (fgets(bufr, CO, fp) && (!strip || *bufr == '\t') && + !got_intrup) { ep = strchr(bufr, '\n'); if(ep) *ep = 0; |