From 1dbd86ec825ba92be12e4aafad49804faaa86ec6 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 24 May 2019 16:01:47 -0700 Subject: 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. --- lib/lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lib.c') 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; } -- cgit v1.2.3