891 lines
36 KiB
HTML
891 lines
36 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>od</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="od"></a> <a name="tag_04_96"></a><!-- od -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_04_96_01"></a>NAME</h4>
|
|
|
|
<blockquote>od - dump files in various formats</blockquote>
|
|
|
|
<h4><a name="tag_04_96_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>od</tt> <b>[</b><tt>-v</tt><b>][</b><tt>-A</tt> <i>address_base</i><b>][</b><tt>-j</tt> <i>skip</i><b>][</b><tt>-N</tt>
|
|
<i>count</i><b>][</b><tt>-t</tt> <i>type_string</i><b>]</b><tt>...<br>
|
|
</tt> <b>[</b><i>file</i><tt>...</tt><b>]</b><tt><br>
|
|
<br>
|
|
</tt></code></p>
|
|
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> od</tt> <b>[</b><tt>-bcdosx</tt><b>][</b><i>file</i><b>]
|
|
[[</b><tt>+</tt><b>]</b><i>offset</i><b>[</b><tt>.</tt><b>][</b><tt>b</tt><b>]]</b><tt><img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_04_96_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>od</i> utility shall write the contents of its input files to standard output in a user-specified format.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>od</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>, except that the order of presentation of the
|
|
<b>-t</b> options <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> and the <b>-bcdosx</b> options <img src="../images/opt-end.gif" alt="[Option End]" border="0">
|
|
is significant.</p>
|
|
|
|
<p>The following options shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-A </b> <i>address_base</i></dt>
|
|
|
|
<dd><br>
|
|
Specify the input offset base. See the EXTENDED DESCRIPTION section. The application shall ensure that the <i>address_base</i>
|
|
option-argument is a character. The characters <tt>'d'</tt> , <tt>'o'</tt> , and <tt>'x'</tt> specify that the offset base shall be
|
|
written in decimal, octal, or hexadecimal, respectively. The character <tt>'n'</tt> specifies that the offset shall not be
|
|
written.</dd>
|
|
|
|
<dt><b>-b</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Interpret bytes in octal. This shall be equivalent to <b>-t o1</b>. <img src="../images/opt-end.gif" alt="[Option End]"
|
|
border="0"></dd>
|
|
|
|
<dt><b>-c</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Interpret bytes as characters specified by the current setting of the <i>LC_CTYPE</i> category. Certain non-graphic characters
|
|
appear as C escapes: <tt>"NUL=\0"</tt> , <tt>"BS=\b"</tt> , <tt>"FF=\f"</tt> , <tt>"NL=\n"</tt> , <tt>"CR=\r"</tt> ,
|
|
<tt>"HT=\t"</tt> ; others appear as 3-digit octal numbers. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-d</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Interpret <i>word</i>s (two-byte units) in unsigned decimal. This shall be equivalent to <b>-t u2</b>. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-j </b> <i>skip</i></dt>
|
|
|
|
<dd>Jump over <i>skip</i> bytes from the beginning of the input. The <i>od</i> utility shall read or seek past the first
|
|
<i>skip</i> bytes in the concatenated input files. If the combined input is not at least <i>skip</i> bytes long, the <i>od</i>
|
|
utility shall write a diagnostic message to standard error and exit with a non-zero exit status.
|
|
|
|
<p>By default, the <i>skip</i> option-argument shall be interpreted as a decimal number. With a leading 0x or 0X, the offset shall
|
|
be interpreted as a hexadecimal number; otherwise, with a leading <tt>'0'</tt> , the offset shall be interpreted as an octal
|
|
number. Appending the character <tt>'b'</tt> , <tt>'k'</tt> , or <tt>'m'</tt> to offset shall cause it to be interpreted as a
|
|
multiple of 512, 1024, or 1048576 bytes, respectively. If the <i>skip</i> number is hexadecimal, any appended <tt>'b'</tt> shall be
|
|
considered to be the final hexadecimal digit.</p>
|
|
</dd>
|
|
|
|
<dt><b>-N </b> <i>count</i></dt>
|
|
|
|
<dd>Format no more than <i>count</i> bytes of input. By default, <i>count</i> shall be interpreted as a decimal number. With a
|
|
leading 0x or 0X, <i>count</i> shall be interpreted as a hexadecimal number; otherwise, with a leading <tt>'0'</tt> , it shall be
|
|
interpreted as an octal number. If <i>count</i> bytes of input (after successfully skipping, if <b>-j</b> <i>skip</i> is specified)
|
|
are not available, it shall not be considered an error; the <i>od</i> utility shall format the input that is available.</dd>
|
|
|
|
<dt><b>-o</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Interpret <i>word</i>s (two-byte units) in octal. This shall be equivalent to <b>-t o2</b>. <img src="../images/opt-end.gif"
|
|
alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-s</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Interpret <i>word</i>s (two-byte units) in signed decimal. This shall be equivalent to <b>-t d2</b>. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><b>-t </b> <i>type_string</i></dt>
|
|
|
|
<dd><br>
|
|
Specify one or more output types. See the EXTENDED DESCRIPTION section. The application shall ensure that the <i>type_string</i>
|
|
option-argument is a string specifying the types to be used when writing the input data. The string shall consist of the type
|
|
specification characters <tt>a</tt> , <tt>c</tt> , <tt>d</tt> , <tt>f</tt> , <tt>o</tt> , <tt>u</tt> , and <tt>x</tt> , specifying
|
|
named character, character, signed decimal, floating point, octal, unsigned decimal, and hexadecimal, respectively. The type
|
|
specification characters <tt>d</tt> , <tt>f</tt> , <tt>o</tt> , <tt>u</tt> , and <tt>x</tt> can be followed by an optional unsigned
|
|
decimal integer that specifies the number of bytes to be transformed by each instance of the output type. The type specification
|
|
character <tt>f</tt> can be followed by an optional <tt>F</tt> , <tt>D</tt> , or <tt>L</tt> indicating that the conversion should
|
|
be applied to an item of type <b>float</b>, <b>double</b>, or <b>long double</b>, respectively. The type specification characters
|
|
<tt>d</tt> , <tt>o</tt> , <tt>u</tt> , and <tt>x</tt> can be followed by an optional <tt>C</tt> , <tt>S</tt> , <tt>I</tt> , or
|
|
<tt>L</tt> indicating that the conversion should be applied to an item of type <b>char</b>, <b>short</b>, <b>int</b>, or
|
|
<b>long</b>, respectively. Multiple types can be concatenated within the same <i>type_string</i> and multiple <b>-t</b> options can
|
|
be specified. Output lines shall be written for each type specified in the order in which the type specification characters are
|
|
specified.</dd>
|
|
|
|
<dt><b>-v</b></dt>
|
|
|
|
<dd>Write all input data. Without the <b>-v</b> option, any number of groups of output lines, which would be identical to the
|
|
immediately preceding group of output lines (except for the byte offsets), shall be replaced with a line containing only an
|
|
asterisk ( <tt>'*'</tt> ).</dd>
|
|
|
|
<dt><b>-x</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Interpret <i>word</i>s (two-byte units) in hexadecimal. This shall be equivalent to <b>-t x2</b>. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
</dl>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Multiple types can be specified by using multiple <b>-bcdostx</b> options. Output lines are written for each type specified in the
|
|
order in which the types are specified. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following operands shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>file</i></dt>
|
|
|
|
<dd>A pathname of a file to be read. If no <i>file</i> operands are specified, the standard input shall be used.
|
|
|
|
<p>If there are no more than two operands, none of the <b>-A</b>, <b>-j</b>, <b>-N</b>, or <b>-t</b> options is specified, and
|
|
either of the following is true: the first character of the last operand is a plus sign ( <tt>'+'</tt> ), or there are two operands
|
|
and the first character of the last operand is numeric; <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
|
|
"../images/opt-start.gif" alt="[Option Start]" border="0"> the last operand shall be interpreted as an offset operand on
|
|
XSI-conformant systems. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> Under these conditions, the results are
|
|
unspecified on systems that are not XSI-conformant systems.</p>
|
|
</dd>
|
|
|
|
<dt><b>[+]</b><i>offset</i><b>[.][b]</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The <i>offset</i> operand specifies the offset in the file where dumping is to commence. This operand is normally interpreted as
|
|
octal bytes. If <tt>'.'</tt> is appended, the offset shall be interpreted in decimal. If <tt>'b'</tt> is appended, the offset shall
|
|
be interpreted in units of 512 bytes. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard input shall be used only if no <i>file</i> operands are specified. See the INPUT FILES section.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>The input files can be any file type.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>od</i>:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>LANG</i></dt>
|
|
|
|
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
|
|
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
|
|
|
|
<dt><i>LC_ALL</i></dt>
|
|
|
|
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
|
|
|
|
<dt><i>LC_CTYPE</i></dt>
|
|
|
|
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
|
|
opposed to multi-byte characters in arguments and input files).</dd>
|
|
|
|
<dt><i>LC_MESSAGES</i></dt>
|
|
|
|
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard
|
|
error.</dd>
|
|
|
|
<dt><i>LC_NUMERIC</i></dt>
|
|
|
|
<dd><br>
|
|
Determine the locale for selecting the radix character used when writing floating-point formatted output.</dd>
|
|
|
|
<dt><i>NLSPATH</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>See the EXTENDED DESCRIPTION section.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard error shall be used only for diagnostic messages.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>od</i> utility shall copy sequentially each input file to standard output, transforming the input data according to the
|
|
output types specified by the <b>-t</b> option <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
|
|
"../images/opt-start.gif" alt="[Option Start]" border="0"> or the <b>-bcdosx</b> options. <img src="../images/opt-end.gif"
|
|
alt="[Option End]" border="0"> If no output type is specified, the default output shall be as if <b>-t oS</b> had been
|
|
specified.</p>
|
|
|
|
<p>The number of bytes transformed by the output type specifier <tt>c</tt> may be variable depending on the <i>LC_CTYPE</i>
|
|
category.</p>
|
|
|
|
<p>The default number of bytes transformed by output type specifiers <tt>d</tt> , <tt>f</tt> , <tt>o</tt> , <tt>u</tt> , and
|
|
<tt>x</tt> corresponds to the various C-language types as follows. If the <a href="../utilities/c99.html"><i>c99</i></a> compiler
|
|
is present on the system, these specifiers shall correspond to the sizes used by default in that compiler. Otherwise, these sizes
|
|
may vary among systems that conform to IEEE Std 1003.1-2001.</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>For the type specifier characters <tt>d</tt> , <tt>o</tt> , <tt>u</tt> , and <tt>x</tt> , the default number of bytes shall
|
|
correspond to the size of the underlying implementation's basic integer type. For these specifier characters, the implementation
|
|
shall support values of the optional number of bytes to be converted corresponding to the number of bytes in the C-language types
|
|
<b>char</b>, <b>short</b>, <b>int</b>, and <b>long</b>. These numbers can also be specified by an application as the characters
|
|
<tt>'C'</tt> , <tt>'S'</tt> , <tt>'I'</tt> , and <tt>'L'</tt> , respectively. The implementation shall also support the values 1,
|
|
2, 4, and 8, even if it provides no C-Language types of those sizes. The implementation shall support the decimal value
|
|
corresponding to the C-language type <b>long long</b>. The byte order used when interpreting numeric values is
|
|
implementation-defined, but shall correspond to the order in which a constant of the corresponding type is stored in memory on the
|
|
system.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>For the type specifier character <tt>f</tt> , the default number of bytes shall correspond to the number of bytes in the
|
|
underlying implementation's basic double precision floating-point data type. The implementation shall support values of the
|
|
optional number of bytes to be converted corresponding to the number of bytes in the C-language types <b>float,</b> <b>double</b>,
|
|
and <b>long double</b>. These numbers can also be specified by an application as the characters <tt>'F'</tt> , <tt>'D'</tt> , and
|
|
<tt>'L'</tt> , respectively.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The type specifier character <tt>a</tt> specifies that bytes shall be interpreted as named characters from the International
|
|
Reference Version (IRV) of the ISO/IEC 646:1991 standard. Only the least significant seven bits of each byte shall be used for
|
|
this type specification. Bytes with the values listed in the following table shall be written using the corresponding names for
|
|
those characters.<br>
|
|
</p>
|
|
|
|
<center><b>Table: Named Characters in <i>od</i></b></center>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Value</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Value</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Value</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Value</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Name</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\000</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>nul</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\001</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>soh</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\002</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>stx</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\003</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>etx</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\004</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>eot</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\005</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>enq</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\006</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>ack</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\007</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>bel</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\010</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>bs</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\011</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>ht</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\012</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>lf or nl<sup><small>*</small></sup></b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\013</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>vt</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\014</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>ff</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\015</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>cr</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\016</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>so</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\017</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>si</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\020</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>dle</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\021</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>dc1</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\022</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>dc2</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\023</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>dc3</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\024</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>dc4</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\025</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>nak</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\026</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>syn</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\027</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>etb</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\030</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>can</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\031</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>em</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\032</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>sub</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\033</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>esc</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\034</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>fs</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\035</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>gs</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\036</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>rs</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\037</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>us</b></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">\040</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>sp</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">\177</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b>del</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b> </b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><b> </b></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<basefont size="2">
|
|
|
|
<dl>
|
|
<dt><b>Note:</b></dt>
|
|
|
|
<dd>The <tt>"\012"</tt> value may be written either as <b>lf</b> or <b>nl</b>.</dd>
|
|
</dl>
|
|
|
|
<basefont size="3">
|
|
|
|
<p>The type specifier character <tt>c</tt> specifies that bytes shall be interpreted as characters specified by the current setting
|
|
of the <i>LC_CTYPE</i> locale category. Characters listed in the table in the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap05.html">Chapter 5, File Format Notation</a> ( <tt>'\\'</tt> ,
|
|
<tt>'\a'</tt> , <tt>'\b'</tt> , <tt>'\f'</tt> , <tt>'\n'</tt> , <tt>'\r'</tt> , <tt>'\t'</tt> , <tt>'\v'</tt> ) shall be written as
|
|
the corresponding escape sequences, except that backslash shall be written as a single backslash and a NUL shall be written as
|
|
<tt>'\0'</tt> . Other non-printable characters shall be written as one three-digit octal number for each byte in the character. If
|
|
the size of a byte on the system is greater than nine bits, the format used for non-printable characters is implementation-defined.
|
|
Printable multi-byte characters shall be written in the area corresponding to the first byte of the character; the two-character
|
|
sequence <tt>"**"</tt> shall be written in the area corresponding to each remaining byte in the character, as an indication that
|
|
the character is continued. When either the <b>-j</b> <i>skip</i> or <b>-N</b> <i>count</i> option is specified along with the
|
|
<tt>c</tt> type specifier, and this results in an attempt to start or finish in the middle of a multi-byte character, the result is
|
|
implementation-defined.</p>
|
|
|
|
<p>The input data shall be manipulated in blocks, where a block is defined as a multiple of the least common multiple of the number
|
|
of bytes transformed by the specified output types. If the least common multiple is greater than 16, the results are unspecified.
|
|
Each input block shall be written as transformed by each output type, one per written line, in the order that the output types were
|
|
specified. If the input block size is larger than the number of bytes transformed by the output type, the output type shall
|
|
sequentially transform the parts of the input block, and the output from each of the transformations shall be separated by one or
|
|
more <blank>s.</p>
|
|
|
|
<p>If, as a result of the specification of the <b>-N</b> option or end-of-file being reached on the last input file, input data
|
|
only partially satisfies an output type, the input shall be extended sufficiently with null bytes to write the last byte of the
|
|
input.</p>
|
|
|
|
<p>Unless <b>-A n</b> is specified, the first output line produced for each input block shall be preceded by the input offset,
|
|
cumulative across input files, of the next byte to be written. The format of the input offset is unspecified; however, it shall not
|
|
contain any <blank>s, shall start at the first character of the output line, and shall be followed by one or more
|
|
<blank>s. In addition, the offset of the byte following the last byte written shall be written after all the input data has
|
|
been processed, but shall not be followed by any <blank>s.</p>
|
|
|
|
<p>If no <b>-A</b> option is specified, the input offset base is unspecified.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following exit values shall be returned:</p>
|
|
|
|
<dl compact>
|
|
<dt> 0</dt>
|
|
|
|
<dd>All input files were processed successfully.</dd>
|
|
|
|
<dt>>0</dt>
|
|
|
|
<dd>An error occurred.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_96_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>XSI-conformant applications are warned not to use filenames starting with <tt>'+'</tt> or a first operand starting with a
|
|
numeric character so that the old functionality can be maintained by implementations, unless they specify one of the <b>-A</b>,
|
|
<b>-j</b>, or <b>-N</b> options. To guarantee that one of these filenames is always interpreted as a filename, an application could
|
|
always specify the address base format with the <b>-A</b> option.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>If a file containing 128 bytes with decimal values zero to 127, in increasing order, is supplied as standard input to the
|
|
command:</p>
|
|
|
|
<pre>
|
|
<tt>od -A d -t a
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>on an implementation using an input block size of 16 bytes, the standard output, independent of the current locale setting,
|
|
would be similar to:</p>
|
|
|
|
<pre>
|
|
<tt>0000000 nul soh stx etx eot enq ack bel bs ht nl vt ff cr so si
|
|
0000016 dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us
|
|
0000032 sp ! " # $ % & ' ( ) * + , - . /
|
|
0000048 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
|
|
0000064 @ A B C D E F G H I J K L M N O
|
|
0000080 P Q R S T U V W X Y Z [ \ ] ^ _
|
|
0000096 ` a b c d e f g h i j k l m n o
|
|
0000112 p q r s t u v w x y z { | } ˜ del
|
|
0000128
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Note that this volume of IEEE Std 1003.1-2001 allows <b>nl</b> or <b>lf</b> to be used as the name for the
|
|
ISO/IEC 646:1991 standard IRV character with decimal value 10. The IRV names this character <b>lf</b> (line feed), but
|
|
traditional implementations have referred to this character as newline ( <b>nl</b>) and the POSIX locale character set symbolic
|
|
name for the corresponding character is a <newline>.</p>
|
|
|
|
<p>The command:</p>
|
|
|
|
<pre>
|
|
<tt>od -A o -t o2x2x -n 18
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>on a system with 32-bit words and an implementation using an input block size of 16 bytes could write 18 bytes in approximately
|
|
the following format:</p>
|
|
|
|
<pre>
|
|
<tt>0000000 032056 031440 041123 042040 052516 044530 020043 031464
|
|
342e 3320 4253 4420 554e 4958 2023 3334
|
|
342e3320 42534420 554e4958 20233334
|
|
0000020 032472
|
|
353a
|
|
353a0000
|
|
0000022
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The command:</p>
|
|
|
|
<pre>
|
|
<tt>od -A d -t f -t o4 -t x4 -n 24 -j 0x15
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>on a system with 64-bit doubles (for example, IEEE Std 754-1985 double precision floating-point format) would skip 21
|
|
bytes of input data and then write 24 bytes in approximately the following format:</p>
|
|
|
|
<pre>
|
|
<tt>0000000 1.00000000000000e+00 1.57350000000000e+01
|
|
07774000000 00000000000 10013674121 35341217270
|
|
3ff00000 00000000 402f3851 eb851eb8
|
|
0000016 1.40668230000000e+02
|
|
10030312542 04370303230
|
|
40619562 23e18698
|
|
0000024
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>od</i> utility went through several names in early proposals, including <i>hd</i>, <i>xd</i>, and most recently
|
|
<i>hexdump</i>. There were several objections to all of these based on the following reasons:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The <i>hd</i> and <i>xd</i> names conflicted with historical utilities that behaved differently.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The <i>hexdump</i> description was much more complex than needed for a simple dump utility.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The <i>od</i> utility has been available on all historical implementations and there was no need to create a new name for a
|
|
utility so similar to the historical <i>od</i> utility.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The original reasons for not standardizing historical <i>od</i> were also fairly widespread. Those reasons are given below along
|
|
with rationale explaining why the standard developers believe that this version does not suffer from the indicated problem:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The BSD and System V versions of <i>od</i> have diverged, and the intersection of features provided by both does not meet the
|
|
needs of the user community. In fact, the System V version only provides a mechanism for dumping octal bytes and <b>short</b>s,
|
|
signed and unsigned decimal <b>short</b>s, hexadecimal <b>short</b>s, and ASCII characters. BSD added the ability to dump
|
|
<b>float</b>s, <b>double</b>s, named ASCII characters, and octal, signed decimal, unsigned decimal, and hexadecimal <b>long</b>s.
|
|
The version presented here provides more normalized forms for dumping bytes, <b>short</b>s, <b>int</b>s, and <b>long</b>s in octal,
|
|
signed decimal, unsigned decimal, and hexadecimal; <b>float</b>, <b>double</b>, and <b>long double</b>; and named ASCII as well as
|
|
current locale characters.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>It would not be possible to come up with a compatible superset of the BSD and System V flags that met the requirements of the
|
|
standard developers. The historical default <i>od</i> output is the specified default output of this utility. None of the option
|
|
letters chosen for this version of <i>od</i> conflict with any of the options to historical versions of <i>od</i>.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>On systems with different sizes for <b>short</b>, <b>int</b>, and <b>long</b>, there was no way to ask for dumps of <b>int</b>s,
|
|
even in the BSD version. Because of the way options are named, the name space could not be extended to solve these problems. This
|
|
is why the <b>-t</b> option was added (with type specifiers more closely matched to the <a href=
|
|
"../functions/printf.html"><i>printf</i>()</a> formats used in the rest of this volume of IEEE Std 1003.1-2001) and the
|
|
optional field sizes were added to the <tt>d</tt> , <tt>f</tt> , <tt>o</tt> , <tt>u</tt> , and <tt>x</tt> type specifiers. It is
|
|
also one of the reasons why the historical practice was not mandated as a required obsolescent form of <i>od</i>. (Although the old
|
|
versions of <i>od</i> are not listed as an obsolescent form, implementations are urged to continue to recognize the older forms for
|
|
several more years.) The <tt>a</tt> , <tt>c</tt> , <tt>f</tt> , <tt>o</tt> , and <tt>x</tt> types match the meaning of the
|
|
corresponding format characters in the historical implementations of <i>od</i> except for the default sizes of the fields
|
|
converted. The <tt>d</tt> format is signed in this volume of IEEE Std 1003.1-2001 to match the <a href=
|
|
"../functions/printf.html"><i>printf</i>()</a> notation. (Historical versions of <i>od</i> used <tt>d</tt> as a synonym for
|
|
<tt>u</tt> in this version. The System V implementation uses <tt>s</tt> for signed decimal; BSD uses <tt>i</tt> for signed decimal
|
|
and <tt>s</tt> for null-terminated strings.) Other than <tt>d</tt> and <tt>u</tt> , all of the type specifiers match format
|
|
characters in the historical BSD version of <b>od</b>.</p>
|
|
|
|
<p>The sizes of the C-language types <b>char</b>, <b>short</b>, <b>int</b>, <b>long</b>, <b>float</b>, <b>double</b>, and <b>long
|
|
double</b> are used even though it is recognized that there may be zero or more than one compiler for the C language on an
|
|
implementation and that they may use different sizes for some of these types. (For example, one compiler might use 2 bytes
|
|
<b>short</b>s, 2 bytes <b>int</b>s, and 4 bytes <b>long</b>s, while another compiler (or an option to the same compiler) uses 2
|
|
bytes <b>short</b>s, 4 bytes <b>int</b>s, and 4 bytes <b>long</b>s.) Nonetheless, there has to be a basic size known by the
|
|
implementation for these types, corresponding to the values reported by invocations of the <a href=
|
|
"../utilities/getconf.html"><i>getconf</i></a> utility when called with <i>system_var</i> operands {UCHAR_MAX}, {USHORT_MAX},
|
|
{UINT_MAX}, and {ULONG_MAX} for the types <b>char</b>, <b>short</b>, <b>int</b>, and <b>long</b>, respectively. There are similar
|
|
constants required by the ISO C standard, but not required by the System Interfaces volume of IEEE Std 1003.1-2001
|
|
or this volume of IEEE Std 1003.1-2001. They are {FLT_MANT_DIG}, {DBL_MANT_DIG}, and {LDBL_MANT_DIG} for the types
|
|
<b>float</b>, <b>double</b>, and <b>long double</b>, respectively. If the optional <a href="../utilities/c99.html"><i>c99</i></a>
|
|
utility is provided by the implementation and used as specified by this volume of IEEE Std 1003.1-2001, these are the
|
|
sizes that would be provided. If an option is used that specifies different sizes for these types, there is no guarantee that the
|
|
<i>od</i> utility is able to interpret binary data output by such a program correctly.</p>
|
|
|
|
<p>This volume of IEEE Std 1003.1-2001 requires that the numeric values of these lengths be recognized by the <i>od</i>
|
|
utility and that symbolic forms also be recognized. Thus, a conforming application can always look at an array of <b>unsigned
|
|
long</b> data elements using <i>od</i> <b>-t</b> <i>uL</i>.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The method of specifying the format for the address field based on specifying a starting offset in a file unnecessarily tied the
|
|
two together. The <b>-A</b> option now specifies the address base and the <b>-S</b> option specifies a starting offset.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>It would be difficult to break the dependence on U.S. ASCII to achieve an internationalized utility. It does not seem to be any
|
|
harder for <i>od</i> to dump characters in the current locale than it is for the <a href="../utilities/ed.html"><i>ed</i></a> or <a
|
|
href="../utilities/sed.html"><i>sed</i></a> <b>l</b> commands. The <tt>c</tt> type specifier does this without difficulty and is
|
|
completely compatible with the historical implementations of the <b>c</b> format character when the current locale uses a superset
|
|
of the ISO/IEC 646:1991 standard as a codeset. The <tt>a</tt> type specifier (from the BSD <b>a</b> format character) was left
|
|
as a portable means to dump ASCII (or more correctly ISO/IEC 646:1991 standard (IRV)) so that headers produced by <a href=
|
|
"../utilities/pax.html"><i>pax</i></a> could be deciphered even on systems that do not use the ISO/IEC 646:1991 standard as a
|
|
subset of their base codeset.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The use of <tt>"**"</tt> as an indication of continuation of a multi-byte character in <tt>c</tt> specifier output was chosen
|
|
based on seeing an implementation that uses this method. The continuation bytes have to be marked in a way that is not ambiguous
|
|
with another single-byte or multi-byte character.</p>
|
|
|
|
<p>An early proposal used <b>-S</b> and <b>-n</b>, respectively, for the <b>-j</b> and <b>-N</b> options eventually selected. These
|
|
were changed to avoid conflicts with historical implementations.</p>
|
|
|
|
<p>The original standard specified <b>-t o2</b> as the default when no output type was given. This was changed to <b>-t oS</b> (the
|
|
length of a <b>short</b>) to accommodate a supercomputer implementation that historically used 64 bits as its default (and that
|
|
defined shorts as 64 bits). This change should not affect conforming applications. The requirement to support lengths of 1, 2, and
|
|
4 was added at the same time to address an historical implementation that had no two-byte data types in its C compiler.</p>
|
|
|
|
<p>The use of a basic integer data type is intended to allow the implementation to choose a word size commonly used by applications
|
|
on that architecture.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>All option and operand interfaces marked as extensions may be withdrawn in a future version.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="c99.html"><i>c99</i></a> , <a href="sed.html"><i>sed</i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_22"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>In the description of the <b>-c</b> option, the phrase "This is equivalent to <b>-t c</b>." is deleted.</p>
|
|
|
|
<p>The FUTURE DIRECTIONS section is modified.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_96_23"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>od</i> utility is changed to remove the assumption that <b>short</b> was a two-byte entity, as per the revisions in the
|
|
IEEE P1003.2b draft standard.</p>
|
|
|
|
<p>The normative text is reworded to avoid use of the term "must" for application requirements.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|