wok-current annotate dev86/stuff/com2exe @ rev 15742
Up: tazdev and tazwikiss (match slitaz-dev-tools Hg tag)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Jan 02 14:50:15 2014 +0100 (2014-01-02) |
parents | a13a6c5b176e |
children | 12326fc2d995 |
rev | line source |
---|---|
pascal@13117 | 1 #!/bin/sh |
pascal@13117 | 2 |
pascal@13225 | 3 [ ! -s "$1" ] && echo "Usage: $0 file.com [extra_ss]> file.exe" && exit 1 |
pascal@13225 | 4 S=$((32+$(stat -c %s $1))) |
pascal@13117 | 5 P=$((($S+511)/512)) |
pascal@13117 | 6 E=$((4096-(32*$P))) |
pascal@13225 | 7 for i in 0x5A4D $(($S%512)) $P 0 2 $E $E $((${2:-0}-16)) -2 0 256 -16 28 0 0 0 |
pascal@13117 | 8 do printf '\\\\x%02X\\\\x%02X' $(($i&255)) $((($i>>8)&255)) | xargs echo -en |
pascal@13117 | 9 done |
pascal@13117 | 10 cat $1 |