#
# A script to extract binary files from uudecoded files. Ignores all headers
# and irrelevant stuff. Has shortfalls like all such scripts/programs but works
# (almost) 100% of the time. We tested it against many such tools available
# at many ftp sites and found it having higher success rate. There are
# a few c-programs out there and it is slower as compared to them but it
# works even in those cases when they fail to work.
# The only time it will not work is that if uuencoded source file is cut up
# in many pieces and LAST part contains LESS THAN 3 SOURCE lines in it and
# we know that such cases (almost) never arise....guarenteed....:)
#
# Written by Tahir Zia Khawaja   and
#            Nasir Ahmed Noor
#umnoor@ccu.umanitoba.ca
#umkhawaj@ccu.umanitoba.ca
#
awk '$0 ~ /^begin / {print $0; exit}' $1 > $$gifile
egrep "^M[^a-z]" $1 >> $$gifile
awk 'NR > 2 {sl=lr; lr=pr; pr=$0} $1 ~ /^end/ {print sl; print lr; print pr; exit}' $1 >> $$gifile
uudecode $$gifile
rm $$gifile
