#!/bin/sh
# Simple script to convert bkread output files to ".bin"
# files acceptable by some BK0010 emulators.
#
# copyright: (C) 2002 by Alexander "las" Lunev
# email: imbecyle@mail.ru
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

PATH=/bin:/usr/bin

if [ $# -le 0 ]; then
    echo "usage: $0 file ..."
    exit 1
fi

while [ $# -gt 0 ]; do
    if [ -r "$1" ]; then
	if touch "$1.bin"; then
	    dd bs=1 if="$1" of="$1.bin" count=4 >/dev/null 2>&1
	    dd bs=1 if="$1" skip=20 >> "$1.bin" 2>/dev/null
	fi
    else
	echo "Can not read file $1"
    fi
    shift
done