diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-01 22:59:08 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-01 22:59:08 +1200 |
commit | cd63bce2f6f511078eb8fcf7a1c0e86eabb689d3 (patch) | |
tree | b44887d54ec00d1f84716c390480fa7ebea33e0f | |
parent | Move HISTSIZE and MAILCHECK to shrc (diff) | |
download | dotfiles-cd63bce2f6f511078eb8fcf7a1c0e86eabb689d3.tar.gz dotfiles-cd63bce2f6f511078eb8fcf7a1c0e86eabb689d3.zip |
Fix POSIX non-compliance in cfr(1)
Which slows it down a *lot*; add an issue.
-rw-r--r-- | ISSUES.markdown | 3 | ||||
-rwxr-xr-x | bin/cfr | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ISSUES.markdown b/ISSUES.markdown index 2715bfbb..27e28a0d 100644 --- a/ISSUES.markdown +++ b/ISSUES.markdown @@ -30,3 +30,6 @@ Known issues * sxhkd(1) might be nicer than xbindkeys; it's in Debian Testing now * Maybe I should port some of the prompt functions to POSIX sh so I don't have to maintain parallel versions for bash, pdksh, and zsh +* find(1) -printf isn't POSIX, and isn't even in OpenBSD's version. Is there + a nicer way to do cfr(1df) efficiently while still handling edge cases like + files with newlines? -exec printf . works, but it's sloooow ... @@ -1,4 +1,6 @@ #!/bin/sh # Count files recursively with find(1); this includes the given directories -# themselves and their subdirectories as entries -find "${@:-"$PWD"}" -printf . | wc -c +# themselves and their subdirectories as entries, and correctly handles files +# with newlines in their names. It's also all POSIX ... but on big directories, +# it's *slow*. +find "${@:-.}" -exec printf %.sx {} \; | wc -c |