#!/bin/sh

echo "Bastard disassembler test script #1"
echo "       Disassemble .text"
echo "Enter name of target:"
read name
echo "Assuming ELF i386..."
./bastard -q >/dev/null<<-EOF 
LoadTarget( "$name" );
SetTargetFormat( "ELF" );
SetTargetArch( "i386" );
SetTargetLang( "C" );
SetTargetAsm( "intel" );
ApplyFileFormat();
DisassembleSection( ".text" );
SaveAsASM( "./.tmp.asm" );
q
EOF
if [ -f ./.tmp.asm ]
then
	cat ./.tmp.asm
	rm ./.tmp.asm
else
   echo "Something went wrong! Run the bastard manually..."
fi
