From owner-freebsd-audit Wed May 15 12:26:35 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mta6.snfc21.pbi.net (mta6.snfc21.pbi.net [206.13.28.240]) by hub.freebsd.org (Postfix) with ESMTP id B38BB37B401; Wed, 15 May 2002 12:26:16 -0700 (PDT) Received: from kokeb.ambesa.net ([64.166.86.104]) by mta6.snfc21.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GW600K0E3BS5M@mta6.snfc21.pbi.net>; Wed, 15 May 2002 12:26:16 -0700 (PDT) Received: from kokeb.ambesa.net (localhost [127.0.0.1]) by kokeb.ambesa.net (8.12.3/8.12.3) with ESMTP id g4FJVe0Q059151; Wed, 15 May 2002 12:31:40 -0700 (PDT envelope-from makonnen@pacbell.net) Received: (from mikem@localhost) by kokeb.ambesa.net (8.12.3/8.12.3/Submit) id g4FJVd8T059150; Wed, 15 May 2002 12:31:39 -0700 (PDT) Date: Wed, 15 May 2002 13:31:03 -0600 From: Mike Makonnen Subject: Re: RFC: Port of NetBSD cat(1)'s -f option. In-reply-to: <20020515061827.GA47688@hades.hell.gr> To: Giorgos Keramidas Cc: freebsd-audit@FreeBSD.ORG Message-id: <1021491063.45509.645.camel@kokeb.ambesa.net> MIME-version: 1.0 X-Mailer: Evolution/1.0.2 Content-type: text/plain Content-transfer-encoding: 7BIT References: <20020515061827.GA47688@hades.hell.gr> X-Authentication-warning: kokeb.ambesa.net: mikem set sender to makonnen@pacbell.net using -f Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 2002-05-15 at 00:18, Giorgos Keramidas wrote: > Here's a patch that adds to our cat(1) the same functionality as > NetBSD cat(1) when passed -f on the command line. The original > commit log from NetBSD's CVS tree is: [snip] > @@ -138,7 +141,15 @@ > filename = "stdin"; > fd = STDIN_FILENO; > } else { > + struct stat st; > + > filename = path; > + if (stat(path, &st) < 0 || > + S_ISREG(st.st_mode) == 0) { > + i++; /* Skip to next file. */ > + continue; > + } > + just a minor nit, You might want to show a warning, since stat(2) can fail for any number of reasons not related to the type of file. Cheers, Mike Makonnen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message