diff options
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/find.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c index 3317448a..64270c00 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -569,7 +569,15 @@ static int do_find(struct dirtree *new) if (check) for (fmt = ss[1]; *fmt; fmt++) { // Print the parts that aren't escapes if (*fmt == '\\') { - if (!(ch = unescape(*++fmt))) error_exit("bad \\%c", *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); } else if (*fmt != '%') putchar(*fmt); else if (*++fmt == '%') putchar('%'); |