wok-6.x annotate dev86/stuff/com2exe @ rev 13117
dev86: add com2exe
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Jul 01 13:52:12 2012 +0200 (2012-07-01) |
parents | |
children | a13a6c5b176e |
rev | line source |
---|---|
pascal@13117 | 1 #!/bin/sh |
pascal@13117 | 2 |
pascal@13117 | 3 [ ! -s "$1" ] && echo "Usage: $0 file.com > file.exe" && exit 1 |
pascal@13117 | 4 S=$(stat -c %s $1) |
pascal@13117 | 5 P=$((($S+511)/512)) |
pascal@13117 | 6 E=$((4096-(32*$P))) |
pascal@13117 | 7 for i in 0x5A4D $(($S%512)) $P 0 2 $E $E -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 |