aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-05-24 16:01:47 -0700
committerRob Landley <rob@landley.net>2019-05-25 21:28:57 -0500
commit1dbd86ec825ba92be12e4aafad49804faaa86ec6 (patch)
tree49d8e3be0b1a50fb42d7f571a97ce16d268df986 /lib/lib.c
parent2f9d9096aac148a26254801014feaff057b64fa0 (diff)
downloadtoybox-1dbd86ec825ba92be12e4aafad49804faaa86ec6.tar.gz
find: add -printf support.
This only implements the format specifiers that I've seen used in the wild (which is actually a significant fraction of the total supported by findutils' find). The most obvious gap is in the time support. I'm happy to add more, but didn't want to add stuff "just because". I'd say %A@, %C@, and -- for SELinux users -- %Z are probably the most plausibly useful formats still missing. I don't think the human-readable date formatting is particularly useful unless someone's seen it actually used in the wild. The %T+ "full ISO" format being the most likely exception to that. Anyway, this is enough for me get started building AOSP with toybox find.
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index fe15c990..b5825fd2 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -1046,7 +1046,7 @@ char *getdirname(char *name)
{
char *s = xstrdup(name), *ss = strrchr(s, '/');
- while (*ss && *ss == '/' && s != ss) *ss-- = 0;
+ while (ss && *ss && *ss == '/' && s != ss) *ss-- = 0;
return s;
}