[Toybox] echo command vs octal and hexadecimal formatting.

Elie De Brauwer eliedebrauwer at gmail.com
Sat Feb 11 06:12:07 PST 2012


Hello all,

In attachment a patch which addresses several points:
  - echo -e has support for octal in the code but the help does not show 
this.
  - since octal gives me headaches (i know, it's an acquired taste) and 
my cksum unittest (see previous e-mail) made use of echo \x I've added 
support for hexadecimal characters in echo (if the cksum ever use the 
supplied echo command this would expose itself). Even though the 
opengroup page doesn't explicitly list support for \x (but man echo on 
my box does).
  - the \0 parsing code shows a bug, if you would in the current code do 
echo -e "\01160000" the output should be "N0000" but in the current code 
the conversion would eat up all the 0's and cause overflows and funky 
things in the final result.
  - I added a small test, testing several corner cases of the hex and 
octal formatting.

my 2 cents
E.

-- 
Elie De Brauwer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: echo_octal_and_hexadecimal_input_fix_plus_testing.patch
Type: text/x-patch
Size: 2474 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20120211/64886a56/attachment-0006.bin>


More information about the Toybox mailing list