usage_compressed 543 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. target="$1"
  3. loc="$2"
  4. test "$target" || exit 1
  5. test "$loc" || loc=.
  6. test -x "$loc/usage" || exit 1
  7. test "$SED" || SED=sed
  8. sz=`"$loc/usage" | wc -c` || exit 1
  9. exec >"$target"
  10. echo 'static const char packed_usage[] ALIGN1 = {'
  11. # Extra effort to avoid using "od -t x1": -t is not available
  12. # in non-CONFIG_DESKTOPed busybox od
  13. "$loc/usage" | bzip2 -1 | od -v -x \
  14. | $SED -e 's/^[^ ]*//' \
  15. | $SED -e 's/ //g' \
  16. | grep -v '^$' \
  17. | $SED -e 's/\(..\)\(..\)/0x\2,0x\1,/g'
  18. echo '};'
  19. echo '#define SIZEOF_usage_messages' `expr 0 + $sz`