[Toybox] Numeric values in dd operands

Rob Landley rob at landley.net
Tue Feb 20 09:57:28 PST 2018


On 02/20/2018 11:32 AM, enh wrote:
> On Tue, Feb 20, 2018 at 9:28 AM, Rob Landley <rob at landley.net> wrote:
>> A real user piped up and said their existing script doesn't work with my tool.
>> That feedback is of interest to me.
> 
> and as the person who set us down the strtol path
> (https://github.com/landley/toybox/commit/d5088a059649daf34e729995bb3daa3eb64fa432#diff-ce001a87e82f850a38fd93183e12b417),
> the original request i had was just for hex. like you say, no-one's
> used octal (on purpose) for anything other than mode for decades now.

I'm tempted to have atolx() skip leading zeroes, and then base 16 if the first
character is an x and base 10 otherwise. Except supporting the - basically means
open coding the sucker...

Anyway, my _real_ question is, if I'm yanking octal from dd= should I yank it
from everywhere? I still think it's useful for "printf %d 0123" to be able to
cope with it (especially since "printf %o 668" prints 1234). And maybe $((0123))
needs it too?

No clue where to draw the line on this one. Hmmm...

Rob



More information about the Toybox mailing list