From owner-freebsd-hackers Tue Jul 27 6:14:44 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dragon.ham.muohio.edu (dragon.ham.muohio.edu [134.53.141.33]) by hub.freebsd.org (Postfix) with ESMTP id E8EFC14D72 for ; Tue, 27 Jul 1999 06:14:37 -0700 (PDT) (envelope-from howardjp@wam.umd.edu) Received: from localhost (howardjp@localhost) by dragon.ham.muohio.edu (8.9.3/8.9.3) with ESMTP id IAA01466; Tue, 27 Jul 1999 08:17:58 -0400 X-Authentication-Warning: dragon.ham.muohio.edu: howardjp owned process doing -bs Date: Tue, 27 Jul 1999 08:17:58 -0400 (EDT) From: Jamie Howard X-Sender: howardjp@dragon.ham.muohio.edu To: "Nickolay N. Dudorov" Cc: hackers@FreeBSD.ORG Subject: Re: replacing grep(1) In-Reply-To: <199907271239.TAA36462@news.itfs.nsk.su> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 27 Jul 1999, Nickolay N. Dudorov wrote: > After making it on the CURRENT system I can only > see: > > grep: filename: Undefined error: 0 > > for every filename. Every file? > > This caused by very "unusual" return values for > 'grep_open' (and other '..._open') function which is declared > as 'int' (and return int result) and compared with NULL ;-( > > I prefer not to include the patch for this because > I am uncompatible with such trics as: > > return ((f = fopen(path, mode)) != NULL) - 1; This was done this way because the gzopen and fopen both return pointers of different types. Maybe the best thing would be to have grep_open() return a void pointer since procfile() doesn't keep track of what files are open and not. This is ugly and not very reusable, but then again how many programs need transparent access to both gzip'd and plaintext files? Jamie To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message