Re: RFC: Port of NetBSD cat(1)'s -f option.

Mike Makonnen <[email protected]>
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
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 [email protected]
with "unsubscribe freebsd-audit" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.