[comp.binaries.ibm.pc.d] ABE ascii-to-binary encoder

woolleyj@lafcol.UUCP (James Woolley) (08/12/89)

In posting Brad Templeton's ABE (ascii-to-binary encoder) in
comp.binaries.ibm.pc, Rahul Dhesi expressed his enthusiasm for
this uuencode-like encoder that sets out to be much more more
reliable than uuencoding, much less subject to the vicissitudes
of network transmission (Vol. 4:051-052, 19 July 1989).

From preliminary trials I agree that ABE and DABE (the decoder)
are most promising. However, the present release has some
pitfalls for unwary MS-DOS users. They may not expect Unix's
habit, when creating a file, of overwriting any current file with
the same name, without warning.

ABE's p option specifies a "prefix" p for the output
filenames(s), which will consequently be p00, p01, etc. If a file
named p01 should already exist in the current directory, it will
be overwritten without warning. If p is seven characters long, p0
will result as the output filename. If p is eight characters
long, plain p will be the output filename. If p is 7 or more
characters long and more than one outputfile results, the second
(which would have been named p01 if p had been shorter) appears
to overwrite the first, and so on, as successive files named p
are created.

A good stopgap solution, Brad has suggested to me, is to enter p
with a period following but with no extension, so that output
filenames are always in the form p.00, p.01, etc.

Decoding an ABE'd file with DABE yields a file with the same name
as the original. If there was already a file with that name in
the current directory. DABE overwrites it without warning. The
safest course for the novice might be to decode into an otherwise
empty subdirectory or diskette.

I might also mention that if the ABEing produced more than one
file, each of these must be listed on the DABE command line,
contrary to what users of Richard Marks's uudecode 3.07 are
accustomed to.

If others find the ABE/DABE combination promising (as I certainly
do), no doubt Brad Templeton will somehow make available
safeguards, allowing the seasoned user the option of skipping the
warnings.  Meanwhile, I am posting below a couple of crude .bat
files that attempt to save the hapless novice from making some of
the mistakes I've made :-). These .bat files can be renamed if
desired. For syntax, enter the .bat filename without parameters.

James Woolley, Lafayette College
BITNET: woolleyj@lafayett   UUCP: ..!rutgers!lafcol!woolleyj



----------------------------------------------------------
ENCODE.BAT

echo off
echo:
echo ABE encoder
echo:
if %2x==x goto syntax
if exist %2.* goto error
:begin
echo The specified output filename, "%2,"
echo should have not more than 8 characters
echo and should have no extension (or trailing period).
echo If it does, Ctrl-C to stop; or, to continue,
pause
echo:
abe p=%2. +r +e %1
goto end
:error
echo ABE will attempt to name the output file(s) %2.00, %2.01,
echo etc. Current files with such names will be overwritten.
echo Your current directory shows:
dir %2.*
echo:
echo Ctrl-C to abort encoding. To continue,
pause
echo:
goto begin
:syntax
echo Syntax: %0 inputfilename outputfilename
echo where outputfilename has not more than 8 characters
echo and no extension or trailing period.
echo:
echo More than one outputfile may result; names will take the
echo form outputfile.00, outputfile.01, etc.
:The outputfile(s) echo will be suitable for transmission through
:EBCDIC machines.
echo:
:end


-------------------------------------------------------------
DECODE.BAT

echo off
echo:
echo DABE decoder
echo:
if %1x==x goto syntax
echo If the current directory contains a file
echo with the same name as that of the encoded original,
echo the present file WILL BE OVERWRITTEN. Ctrl-C to stop, or
pause
dabe %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:syntax
echo Syntax:
echo %0 filename [inputfile] [inputfile] ... [inputfile]
echo:
echo If there are several ABE input files (typically
echo file.00, file.01, file.02, etc.), each must be listed.
echo If there are more than 9 input files, the DABE command line
echo must be entered manually. The wildcards ? and * cannot be
echo used in the input filenames.
echo:
echo The decoding yields a file with the same name as the
echo file had before being encoded. If the current directory
echo already has a file with that same name, the existing file
echo will be overwritten and permanently lost. Suggestion:
echo either do the decoding in an empty temporary directory,
echo or turn on the read-only attribute for each file in the
echo current directory.
echo:
:end