Subject: CVS commit: src/usr.bin/find
To: None <source-changes@NetBSD.org>
From: Jeremy C. Reed <reed@netbsd.org>
List: source-changes
Date: 10/12/2005 20:03:59
Module Name:	src
Committed By:	reed
Date:		Wed Oct 12 20:03:59 UTC 2005

Modified Files:
	src/usr.bin/find: extern.h find.1 find.c find.h function.c option.c

Log Message:
This adds -fprint function. The primary name "-fprint" (but not the
code) comes from findutils; it behaves the same.

From my manpage addition:

 -fprint filename
	This primary always evaluates to true.  This creates filename or
	overwrites the file if it already exists.  The file is created at
	startup.  It writes the pathname of the current file to this
	file, followed by a newline character.  The file will be empty if
	no files are matched.

Here is an example usage:

find /etc \( -name "*pass*" -fprint file1 \) -o \( -group operator -fprint file2 \) -o -name "w*"

Note that this example will NOT include entry in file2 if it is
matched in first expression. (This also is same behaviour as
findutils, and I have implemented a -false primary to handle that.
I will commit it later.)

This creates the file as command line argument parsing time.
If there is an error somewhere on that line, such as missing values
or mismatched parenthesis, then a file may still be created.
(Even if a later -fprint filename is unwritable.) This is similar
behaviour to findutils. (It has been suggested that this find could
be code to create the files in an extra stage after the command-line
argument parsing and before the actual function processing.)

I will add -fprintx and -fprint0 soon.

This was discussed on tech-userlevel.


To generate a diff of this commit:
cvs rdiff -r1.20 -r1.21 src/usr.bin/find/extern.h src/usr.bin/find/option.c
cvs rdiff -r1.52 -r1.53 src/usr.bin/find/find.1
cvs rdiff -r1.19 -r1.20 src/usr.bin/find/find.c
cvs rdiff -r1.18 -r1.19 src/usr.bin/find/find.h
cvs rdiff -r1.50 -r1.51 src/usr.bin/find/function.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.