Index of /xd/
Name Last modified Size Description
Parent Directory 15-Aug-96 13:58 -
xd.doc 06-Jul-95 14:00 5K
xd.shar.gz 06-Jul-95 13:59 5K
XD
Hexadecimal dump and load
by John Walker
Revision 3 -- July 6th, 1995
This program was created out of exasperation with the Unix "od"
program which, notwithstanding its acronym of "octal dump" will
happily make hexadecimal dumps of files but, in tribute to the past,
refuses to display file addresses as anything other than octal.
XD is a hexadecimal file dump program without pretensions of grandeur.
It dumps files as hex bytes, optionally showing the same bytes as ISO
characters, with non-printing characters (defined according to ISO
8859/1 Latin-1) rendered as periods. File addresses are shown as hex
numbers without leading zeroes.
XD has a few more little tricks up its sleeve. If you specify the
"-l" option, XD will *read* a dump file in the same format it writes
and create a binary file from the hex data. This allows you to dump a
binary file with XD, edit it with your favourite text editor, then
make a new binary file containing whatever changes you made. When
creating a binary file, XD normally assumes you've only changed data
in place (neither expanding nor contracting the file) and verifies
file addresses to guarantee this. However, if you set the "-s"
(stream) option, file addresses are ignored and you're free to insert
or delete bytes at will. These options effectively turn your existing
text editor into a binary file editor without requiring you to learn
any new commands.
Finally, the "-d" option reads a binary file and emits a C language
data declaration which contains the data from the file. This is handy
when you wish to embed binary data within programs.
XD is written to be as portable as possible. It does assume that file
I/O is not subjected to end of line translation; if you're porting it
to a system such as MS-DOS which requires binary files to be
explicitly declared, you'll have to add code appropriate to your
compiler.
AUTHOR
John Walker
kelvin@fourmilab.ch
WWW home page: http://www.fourmilab.ch/
This program is in the public domain: "Do what thou wilt shall be the
whole of the law". I'd appreciate receiving any bug fixes and/or
enhancements, which I'll incorporate in future versions of the
program. Please leave the original attribution information intact so
that credit and blame may be properly apportioned.