xd/index.html

238 lines
8.5 KiB
HTML
Raw Permalink Normal View History

2023-07-30 11:24:54 +03:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>xd: Extended Dump and Load Utility</title>
<meta name="keywords" content="xd, dump, hexadecimal, octal, decimal, ASCII, ISO" />
<meta name="description" content="xd: Extended Dump and Load Utility" />
<meta name="author" content="John Walker" />
<meta name="robots" content="index" />
<link rel="stylesheet" href="https://www.fourmilab.ch/documents/styles/standard_screen.css"
type="text/css" />
<style type="text/css">
blockquote.rights {
text-align: justify;
font-size: smaller;
font-family: sans-serif;
}
dl.options :first-child {
margin-top: 0px;
}
dl.options dd {
text-align: justify;
}
dl.options dt {
margin-top: 1ex;
padding-bottom: 0px;
}
h3.subtitle {
color: #0000FF;
font-style: italic;
margin-top: 0px;
text-align: center;
}
p {
text-align: justify;
}
</style>
</head>
<body class="standard">
<h1 class="c" style="margin-bottom: 0px;"><img src="images/xd.png"
width="257" height="123" alt="XD" /></h1>
<h3 class="subtitle">Extended Dump and Load Utility</h3>
<hr />
<p>
This page describes, in Unix manual page style,
<b>xd</b>, a utility which dumps files in hexadecimal,
decimal, or octal, with file addresses shown in any of
those formats. <b>xd</b> can read files in any of the
formats it writes, recreating binary files, including
modifications made by editing the dump with any text
editor. In addition, <b>xd</b> can transform a binary
file into a C data declaration which permits embedding
its contents into a program. <b>xd</b> is available as
C source code compatible with most Unix systems.
</p>
<h3>NAME</h3>
<p>
<b>xd</b> &ndash; extended dump and load utility
</p>
<h3>SYNOPSIS</h3>
<p>
<b>xd</b> [ <b>&minus;a</b><i>addrfmt</i> <b>&minus;c</b>
<b>&minus;d</b><i>label</i> <b>&minus;l</b> <b>&minus;n</b><i>datafmt</i>
<b>&minus;s</b> ] [ <i>infile</i> [ <i>outfile</i> ] ]
</p>
<h3>DESCRIPTION</h3>
<p>
<b>xd</b> dumps files in hexadecimal, decimal, or octal, optionally with
ISO characters side by side. File addresses can likewise be
displayed in hex, decimal, or octal notation.
</p>
<p>
<b>xd</b> can <em>read</em> dump files in the same formats it writes and create
binary files from the data therein. This allows you to dump a
binary file with <b>xd</b>, edit it with your favourite text editor,
then make a new binary file containing whatever changes you've
made. When creating a binary file, <b>xd</b> normally assumes you've
only modified data in place (neither expanding nor contracting
the file) and verifies file addresses to guarantee this.
However, a "stream" option is available which ignores file
addresses so you're free to insert and delete bytes at will. <b>xd</b>
thus turns your existing text editor into a binary file editor
without requiring you to learn any new commands.
</p>
<p>
Finally, <b>xd</b> can read a binary file and emit a C language data
declaration which contains the data from the file. This is handy
when you wish to embed binary data within C programs.
</p>
<h3>OPTIONS</h3>
<dl class="options">
<dt><b>&minus;a</b><i>addrfmt</i></dt>
<dd>Displays addresses in the dumped file as specified by
<i>addrfmt</i>: <b>d</b> for decimal, <b>h</b> or
<b>x</b> for hexadecimal, and <b>o</b> for octal. By
default, addresses are shown in hexadecimal.</dd>
<dt><b>&minus;c</b></dt>
<dd>Display ISO characters alongside the numeric
dump. Non-printing characters (according to ISO
8859/1) are shown as periods. The ISO characters are
separated from the dump by vertical bar characters,
which <b>xd</b> treats as comment delimiters when loading a
file.</dd>
<dt><b>&minus;d</b><i>label</i></dt>
<dd>Dumps the file as a C language declaration of an array
of <tt>unsigned char</tt> which, when compiled, will
contain the same data as the binary input file. The C
array declaration is given the variable name
<i>label</i>, or <tt>xd_data</tt> if no label
specification is given. Data are declared as individual
bytes to guarantee portability across architectures with
different byte ordering conventions, and are expressed
as decimal numbers in lines of less than 80 characters
for maximum portability among compilers. The C operator
<tt>sizeof</tt> may be applied to the array <i>label</i>
to obtain its length in bytes.</dd>
<dt><b>&minus;l</b></dt>
<dd>Load file from dump. <b>xd</b> reads a file in the same
format it writes, creating a binary output file. Each
line is assumed to begin with a file address terminated
by a colon. Data bytes are separated by white space,
and any characters after a vertical bar are ignored
(thus discarding any ISO characters included in the dump
with the <b>&minus;c</b> option). If the
<b>&minus;s</b> option is not specified, each file
address is checked against the number of bytes written
so far to guarantee that no bytes have been added or
deleted. Files must be loaded with the <b>&minus;a</b>
and <b>&minus;n</b> options set the same as when the
file was dumped.</dd>
<dt><b>&minus;n</b><i>datafmt</i></dt>
<dd>Edits bytes in the dumped file as specified by
<i>datafmt</i>: <b>d</b> for decimal, <b>h</b> or
<b>x</b> for hexadecimal, and <b>o</b> for octal. By
default, bytes are shown in hexadecimal.</dd>
<dt><b>&minus;s</b></dt>
<dd>Stream input when loading file. If this option is
specified in conjunction with the <b>&minus;l</b> option, file
addresses are not verified when loading a file and, in
fact, need not be specified at all. The input file is
treated as a stream of byte values separated by white
space. This option allows you to create a dump with
<b>xd</b>, edit it as you wish with any text editor,
inserting and deleting bytes in the file wherever you
like, then create a binary file from the modified dump
with the command <b>xd &minus;l &minus;s</b> <i>dumpfile
outfile</i>.</dd>
<dt><b>&minus;u</b></dt>
<dd>Print how-to-call information.</dd>
</dl>
<h3>FILES</h3>
<p>
If no <i>infile</i> is specified, <b>xd</b> obtains its
input from standard input; if no <i>outfile</i> is given,
output is sent to standard output. The input and output are
processed in a strictly serial manner regardless of
options; consequently <b>xd</b> may be used in pipelines
without restrictions.
</p>
<h3>BUGS</h3>
<p>
Input error checking in load mode might be improved. Note
that each byte in load mode must be specified as a number
in the same format selected by the <b>&minus;n</b> option
when the file was dumped, separated by white space, and
that the <b>&minus;a</b> and <b>&minus;n</b> options must
be set the same when loading a file as when it was dumped.
</p>
<h3>SEE ALSO</h3>
<p>
<b>cc</b>(1), <b>od</b>(1), <b>iso_8859_1</b>(7)
</p>
<h2><a href="xd-1.4.tar.gz"><img src="https://www.fourmilab.ch/images/icons/file.png"
alt="[download]" class="button" width="40" height="40" /></a>
<a href="xd-1.4.tar.gz">Download xd-1.4.tar.gz</a> (Gzipped TAR archive)</h2>
<p>
The release archive contains source code, a <tt>Makefile</tt>
for building the program, and documentation in manual page and
HTML form.
</p>
<h3>COPYING</h3>
<blockquote class="rights">
<p>
This software is in the public domain. Permission to use,
copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby
granted, without any conditions or restrictions. This
software is provided &ldquo;as is&rdquo; without express or
implied warranty.
</p>
</blockquote>
<h3 class="nav"><a href="http://www.fourmilab.ch/?topic=unix">Other
Unix Utilities at Fourmilab</a></h3>
<h3 class="nav"><a href="http://www.fourmilab.ch/">Fourmilab Home Page</a></h3>
<p />
<hr />
<address>
by <a href="http://www.fourmilab.ch/">John Walker</a><br />
Version 1.4<br />
October, 2017
</address>
</body>
</html>