diff options
author | wollman <wollman@FreeBSD.org> | 1995-05-09 19:02:06 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-05-09 19:02:06 +0000 |
commit | 715c2b0756e915aec3e15087ab41a14e903bd7f1 (patch) | |
tree | 3824a53da4fe2907a82c2e56c64ecc75e069be0b /usr.bin/find/function.c | |
parent | bf8c6b4473f2382b18fd53796f80b17d6ae323e3 (diff) | |
download | FreeBSD-src-715c2b0756e915aec3e15087ab41a14e903bd7f1.zip FreeBSD-src-715c2b0756e915aec3e15087ab41a14e903bd7f1.tar.gz |
Add GNU-style `-print0' primary. This exists so that one can safely
do `find some-nasty-expression -print0 | perl -n0e unlink' and have all
the files actuallly get deleted. (Using `xargs' and `rm' is not safe.)
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r-- | usr.bin/find/function.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index f537676..52e0f43 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -794,6 +794,30 @@ c_print() } /* + * -print0 functions -- + * + * Always true, causes the current pathame to be written to + * standard output followed by a NUL character + */ +int +f_print0(plan, entry) + PLAN *plan; + FTSENT *entry; +{ + fputs(entry->fts_path, stdout); + fputc('\0', stdout); + return (1); +} + +PLAN * +c_print0() +{ + isoutput = 1; + + return (palloc(N_PRINT0, f_print0)); +} + +/* * -prune functions -- * * Prune a portion of the hierarchy. |