[Toybox] [PATCH] find: support -printf \0 octal escapes and \c.

Rob Landley rob at landley.net
Sun Sep 1 18:18:53 PDT 2019


On 8/31/19 11:31 PM, enh via Toybox wrote:
> I think when I wrote this I tested the named escapes like \n and hex
> escapes, and when I found \x wasn't supported I didn't even think of
> octal. And I only learned about \c when I was looking at echo and printf
> to compare their escape implementations a few weeks back.

I was fixing this by implementing octal escapes, I just haven't gotten back to
that tab yet. :)

> Add the missing escapes and corresponding tests.

I'm kinda frustrated that we've already implemented \c support twice elsewhere,
and it's not sharing code. :(

$ grep "'c'" toys/*/{echo,printf}.c
toys/posix/echo.c:        else if (slash=='c') return;
toys/posix/printf.c:  if (*ptr == 'c') xexit();
toys/posix/printf.c:        } else if (c == 'c') printf(toybuf, wp[0], wp[1], *aa);

I should take a look at that...

Yay tests,

Rob



More information about the Toybox mailing list