Subject: CVS commit: [netbsd-2] src/usr.bin/find
To: None <source-changes@NetBSD.org>
From: Jeremy C. Reed <reed@netbsd.org>
List: source-changes
Date: 10/11/2005 22:56:27
Module Name:	src
Committed By:	reed
Date:		Tue Oct 11 22:56:27 UTC 2005

Modified Files:
	src/usr.bin/find [netbsd-2]: 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*"

This was discussed on tech-userlevel.

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.


To generate a diff of this commit:
cvs rdiff -r1.20 -r1.20.4.1 src/usr.bin/find/extern.h \
    src/usr.bin/find/option.c
cvs rdiff -r1.47.2.1 -r1.47.2.1.2.1 src/usr.bin/find/find.1
cvs rdiff -r1.18.2.1 -r1.18.2.1.2.1 src/usr.bin/find/find.c
cvs rdiff -r1.18 -r1.18.4.1 src/usr.bin/find/find.h
cvs rdiff -r1.46 -r1.46.4.1 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.