basepak v1.1 - (c)1997 Toby Reed <toby@eskimo.com>
Freely distributable under the terms of the GNU General Public License.
(see COPYING for details)
-----------------------------------------------------------------------

Basepak is a suite of short shell script routines that let you convert
between all combinations of hex, decimal, octal and binary. It is used
similar to netpbm, where a single program does different things when
called by different names. You can use copies, hard links or (preferably)
symlinks to use the different names.

Usage: bin2dec|bin2hex|bin2oct|dec2bin|dec2hex|dec2oct|hex2bin|hex2dec|
       hex2oct|oct2bin|oct2dec|oct2hex [number]

       basepak xxx2xxx [number]

Numbers fed to basepak are in the format of xxxxxxxx (binary), [xx]x
(decimal), xx (hex) and [xx]x (octal). They do NOT need to be prefixed
with 0x, 0X or 0. The xxx2xxx is one of the names listed above, such as
bin2dec.

You can use the routines included in basepak source code in your own
programs. Though a note saying you did so and a pointer to obtaining
the original basepak package would be appreciated, it is not necessary.

Examples:
	$ dec2bin 65			# Convert decimal 65 to binary
	01000001
	$ oct2hex 40			# Convert octal 40 to hexadecimal
	20
	$ basepak hex2bin FE		# Convert hexadecimal FE to binary
	11111110

Bugs:
	Some functions using binary do not support higher-than-8-bit
numbers. For example, hex2bin 2FACED returns 255 in binary (11111111), but
hex2dec 2FACED returns the correct answer 3124461.

Other junk:

Writing this in bash was only an exercise and anyone sane would
write it in C in a jiffy. In the next release I'll include a 100%
compatible C version with the 8-bit bug fixed and it will be much faster.
This will also allow me to make a dos version of basepak, which will be
useful for when I am using a hex editor on dos stuff and want to do a
quick conversion on the command line.

I tried to make basepak as small and compact as possible, rather than
readable. ;) You can't have everything. But man, the oct/bin routines in
the old.zip file were a puppy to implement. Glad I'm done with that. If
only I'd discovered the printf(1) command before! ;) Oh well, I learned a
lot in the process.

I thought the "basepak xxx2xxx" feature might be useful for people who
hate symbolic links, or are on rescue disks and that kind of thing where
lots of files are a hassle, or just to ensure that basepak is doing the
conversion, and not some other program called "hex2dec". Not that it would
matter or anything... ;)

The file old.zip contains old versions of basepak programs that were never
released, but programmed seperately (into different scripts instead of the
symlink method). These might be useful because they don't use the printf
hack...they are very slow, but they use only bash internal functions,
which might be useful if you can't even fit printf or awk on your rescue
disk or something like that.

Enjoy!

