Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!sdcsvax!ucsdhub!hp-sdd!hplabs!sdcrdcf!eggert From: eggert@sdcrdcf.UUCP (Paul Eggert) Newsgroups: comp.sources.bugs Subject: Re: Declaration errors in less + Fix Message-ID: <4790@sdcrdcf.UUCP> Date: Fri, 11-Sep-87 16:01:14 EDT Article-I.D.: sdcrdcf.4790 Posted: Fri Sep 11 16:01:14 1987 Date-Received: Sat, 12-Sep-87 20:30:15 EDT References: <237@rhesus.primate.wisc.edu> Reply-To: eggert@sm.unisys.com (Paul Eggert) Organization: Unisys Santa Monica Lines: 19 In article <237@rhesus.primate.wisc.edu> dubois@rhesus.primate.wisc.edu (Paul DuBois) correctly notes a bug in 'less': less.h attempts to #define EOF 0. Luckily for 'less' customers, the bug that this fixes is rare: it happens only when a filename pattern expander subshell outputs no newline. However, DuBois's suggested fix is not portable because 'less' often stores EOF in char[] buffers; this may not work on machines that have unsigned chars, because EOF is -1. Here's a portable fix: change EOF to EOI uniformly everywhere except in os.c, and make the following change to less.h. The change to the definition of NULL suppresses an unneeded warning about redefining NULL, at least on a Sun. 27,28c27,29 < #define EOF (0) < #define NULL (0) --- > #define EOI 0 /* End of input */ > /* NULL ought to be 0; this ensures a warning if it's not. */ > #define NULL 0