On Friday 08 February 2008 15:23, Bernhard Fischer wrote:
> Denis,
>
> Can you have a look if the hunk below would work with our small od(1)
> implementation?
> TIA,
>
> On Sun, Feb 03, 2008 at 07:26:28PM +0100, Bernhard Fischer wrote:
> >On Sun, Feb 03, 2008 at 04:37:10PM +0100, Thomas Lundquist wrote:
> >>Hi.
> >>
> >>I'm trying to build busybox within buildroot and then busybox provides
> >>od but applets/usage_compressed uses od -t which busybox does not have.
> >>
> >>Turning off CONFIG_FEATURE_COMPRESS_USAGE does not help either.
> >>
> >>Anyone with plan? I guess we should/could either try to add -t or fix
> >
> >We should fix the usage_compressed scripts, yes.
> >
> >Perhaps you want to experiment with just using "-x", something like
> >echo 'static const char packed_usage[] ALIGN1 = ' | bzip2 -1 \
> >| ./busybox od -v -x \
> >| sed -e 's/^[^ ]*//' \
> > -e 's/ *\(..\)\(..\)/\\x\2\\x\1/g' \
> > -e 's/\\x[ ][ ]*\\x[ ]*$//' \
> > -e 's/^\(.*\)$/"\1"/'
> >where the brackets contain a space and ^vi (i.e. a tab).
od -v -x produces ambiguous output:
# echo -en "\n\0" | od -v -x
0000000 000a
0000002
# echo | od -v -x
0000000 000a
0000001
Trying to analyze last offset and account for the case when it is odd
(in second example it's 00000001 -> we have to remove extra '00' from dump)
can be a pain in various body parts.
Apart from that, I'm happy with this change. I applied attached patch
to svn.
--
vda
diff -d -urpN busybox.8/applets/usage_compressed busybox.9/applets/usage_compressed
--- busybox.8/applets/usage_compressed 2008-02-07 13:29:45.000000000 +0000
+++ busybox.9/applets/usage_compressed 2008-02-09 09:24:45.000000000 +0000
@@ -12,8 +12,16 @@ sz=`"$loc/usage" | wc -c` || exit 1
exec >"$target"
-echo 'static const char packed_usage[] ALIGN1 = '
-"$loc/usage" | bzip2 -1 | od -v -t x1 \
-| $SED -e 's/^[^ ]*//' -e 's/ *\(..\)/\\x\1/g' -e 's/^\(.*\)$/"\1"/'
-echo ';'
+echo 'static const char packed_usage[] ALIGN1 = {'
+
+# Extra effort to avoid using "od -t x1": -t is not available
+# in non-CONFIG_DESKTOPed busybox od
+
+"$loc/usage" | bzip2 -1 | od -v -x \
+| $SED -e 's/^[^ ]*//' \
+| $SED -e 's/ //g' \
+| grep -v '^$' \
+| $SED -e 's/\(..\)\(..\)/0x\2,0x\1,/g'
+
+echo '};'
echo '#define SIZEOF_usage_messages' `expr 0 + $sz`
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox