From 6a13437e9b409624604d242ffd9ee25ad6044bf2 Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Wed, 21 Feb 2007 03:53:33 +0000 Subject: - Pass full buffer size to fgets. - No need to initialize buffer. - Spacing. Based on diff from Charles Longeau long ago. OK moritz@. --- games/hack/hack.pager.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'games/hack') 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; -- cgit v1.2.3