usage_compressed 749 B

1234567891011121314151617181920212223242526272829303132333435
  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. test "$DD" || DD=dd
  9. sz=`"$loc/usage" | wc -c` || exit 1
  10. exec >"$target"
  11. echo 'static const char packed_usage[] ALIGN1 = {'
  12. ## Breaks on big-endian systems!
  13. ## # Extra effort to avoid using "od -t x1": -t is not available
  14. ## # in non-CONFIG_DESKTOPed busybox od
  15. ##
  16. ## "$loc/usage" | bzip2 -1 | od -v -x \
  17. ## | $SED -e 's/^[^ ]*//' \
  18. ## -e 's/ //g' \
  19. ## -e '/^$/d' \
  20. ## -e 's/\(..\)\(..\)/0x\2,0x\1,/g'
  21. "$loc/usage" | bzip2 -1 | $DD bs=2 skip=1 2>/dev/null | od -v -t x1 \
  22. | $SED -e 's/^[^ ]*//' \
  23. -e 's/ //g' \
  24. -e '/^$/d' \
  25. -e 's/\(..\)/0x\1,/g'
  26. echo '};'
  27. echo '#define SIZEOF_usage_messages' `expr 0 + $sz`