Tomato 1.25
[tomato.git] / release / src / router / busybox / applets / usage_compressed
blobc30bcfa29b2a710a7e594eb23130f40b37b3dca0
1 #!/bin/sh
3 target="$1"
4 loc="$2"
6 test "$target" || exit 1
7 test "$loc" || loc=.
8 test -x "$loc/usage" || exit 1
9 test "$SED" || SED=sed
11 sz=`"$loc/usage" | wc -c` || exit 1
13 exec >"$target"
15 echo 'static const char packed_usage[] ALIGN1 = {'
17 ## Breaks on big-endian systems!
18 ## # Extra effort to avoid using "od -t x1": -t is not available
19 ## # in non-CONFIG_DESKTOPed busybox od
21 ## "$loc/usage" | bzip2 -1 | od -v -x \
22 ## | $SED -e 's/^[^ ]*//' \
23 ## | $SED -e 's/ //g' \
24 ## | grep -v '^$' \
25 ## | $SED -e 's/\(..\)\(..\)/0x\2,0x\1,/g'
27 "$loc/usage" | bzip2 -1 | od -v -t x1 \
28 | $SED -e 's/^[^ ]*//' \
29 | $SED -e 's/ //g' \
30 | grep -v '^$' \
31 | $SED -e 's/\(..\)/0x\1,/g'
33 echo '};'
34 echo '#define SIZEOF_usage_messages' `expr 0 + $sz`