1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #!/bin/sh
- target="$1"
- loc="$2"
- test "$target" || exit 1
- test "$loc" || loc=.
- test -x "$loc/usage" || exit 1
- test "$SED" || SED=sed
- test "$DD" || DD=dd
- od -v -b </dev/null >/dev/null
- if test $? != 0; then
- echo 'od tool is not installed or cannot accept "-v -b" options'
- exit 1
- fi
- exec >"$target.$$"
- echo '#define UNPACKED_USAGE "" \'
- "$loc/usage" | od -v -b \
- | grep -v '^ ' \
- | $SED -e 's/^[^ ]*//' \
- -e 's/ //g' \
- -e '/^$/d' \
- -e 's/\(...\)/\\\1/g' \
- -e 's/^/"/' \
- -e 's/$/" \\/'
- echo ''
- echo "#define UNPACKED_USAGE_LENGTH `$loc/usage | wc -c`"
- echo
- echo '#define PACKED_USAGE \'
- "$loc/usage" | bzip2 -1 | $DD bs=2 skip=1 2>/dev/null | od -v -b \
- | grep -v '^ ' \
- | $SED -e 's/^[^ ]*//' \
- -e 's/ //g' \
- -e '/^$/d' \
- -e 's/\(...\)/0\1,/g' \
- -e 's/$/ \\/'
- echo ''
- mv -- "$target.$$" "$target"
|