diff options
Diffstat (limited to 'toys/posix/find.c')
-rw-r--r-- | toys/posix/find.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c index 3fb97b1c..9b688d46 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -585,16 +585,12 @@ static int do_find(struct dirtree *new) if (check) for (fmt = ss[1]; *fmt; fmt++) { // Print the parts that aren't escapes if (*fmt == '\\') { - int slash = *++fmt, n = unescape(slash); - - if (n) ch = n; - else if (slash=='c') break; - else if (slash=='0') { - ch = 0; - while (*fmt>='0' && *fmt<='7' && n++<3) ch=(ch*8)+*(fmt++)-'0'; - --fmt; - } else error_exit("bad \\%c", *fmt); - putchar(ch); + unsigned u; + + if (fmt[1] == 'c') break; + if ((u = unescape2(&fmt, 0))<128) putchar(u); + else printf("%.*s", (int)wcrtomb(buf, u, 0), buf); + fmt--; } else if (*fmt != '%') putchar(*fmt); else if (*++fmt == '%') putchar('%'); else { |