aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-11-25 17:25:48 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-11-25 17:25:48 +1300
commit7021f36c94bc65a6164b559f97d9e8438bdccfd9 (patch)
tree06140233b7ca684d439c94de591e5ca681205208 /man
parentMerge branches 'freebsd' and 'openbsd' (diff)
downloaddotfiles-7021f36c94bc65a6164b559f97d9e8438bdccfd9.tar.gz
dotfiles-7021f36c94bc65a6164b559f97d9e8438bdccfd9.zip
Simplify cf(1df) and cfr(1df)
It turns out `-exec foo {} +` is in fact POSIX behaviour (since SUSv3 as far as I can tell).
Diffstat (limited to 'man')
-rw-r--r--man/man1/cf.1df6
-rw-r--r--man/man1/cfr.1df15
2 files changed, 0 insertions, 21 deletions
diff --git a/man/man1/cf.1df b/man/man1/cf.1df
index 9ced3c20..8434265b 100644
--- a/man/man1/cf.1df
+++ b/man/man1/cf.1df
@@ -10,17 +10,11 @@
.br
.B cf
dir1 dir2
-.br
-.B cf
--o dir1 dir2
.SH DESCRIPTION
.B cf
counts all the entries in the given directories using glob expansion and prints
the count. It defaults to the current directory.
.P
-Giving the -o option omits printing the directory name (i.e., prints only the
-count); this is intended for use in scripts such as cfr(1df).
-.P
It uses globs to do the counting, so it will give you unexpected results if
you're counting a directory that has more than ARG_MAX entries in it. You'll
have to resort to find(1) loops in that case.
diff --git a/man/man1/cfr.1df b/man/man1/cfr.1df
index 37dac2ad..8c3fc563 100644
--- a/man/man1/cfr.1df
+++ b/man/man1/cfr.1df
@@ -16,21 +16,6 @@ counts all the entries in the directory trees rooted at the given arguments,
and prints the total. It defaults to the current directory. It should correctly
handle corner cases like filenames with newlines in them. It will count but
will not follow symbolic links.
-.SH NOTES
-You might think this would be better; it's certainly faster:
-.P
- $ find . -mindepth 1 -print | wc -l
-.P
-However, it's subtly wrong; it will double-count anything with a path that
-contains a newline! You could use -print0 and count null characters instead,
-but then you've broken POSIX already.
-.P
-cfr(1df) and cf(1df) are POSIX-fearing as far as I can tell (please correct
-me), but there are faster but less compatible ways to do this, while still
-remaining accurate. Here's a method using GNU find(1) adapted from an extremely
-clever suggestion from geirha on Freenode; it's much, much faster:
-.P
- $ find . -mindepth 1 -printf %.sx | wc -c
.SH SEE ALSO
cf(1df), tot(1df)
.SH AUTHOR