595 lines
26 KiB
HTML
595 lines
26 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>dd</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="dd"></a> <a name="tag_04_34"></a><!-- dd -->
|
|
<!--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_34_01"></a>NAME</h4>
|
|
|
|
<blockquote>dd - convert and copy a file</blockquote>
|
|
|
|
<h4><a name="tag_04_34_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>dd</tt> <b>[</b><i>operand</i> <tt>...</tt><b>]</b></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>dd</i> utility shall copy the specified input file to the specified output file with possible conversions using specific
|
|
input and output block sizes. It shall read the input one block at a time, using the specified input block size; it shall then
|
|
process the block of data actually returned, which could be smaller than the requested block size. It shall apply any conversions
|
|
that have been specified and write the resulting data to the output in blocks of the specified output block size. If the <b>bs</b>=
|
|
<i>expr</i> operand is specified and no conversions other than <b>sync</b>, <b>noerror</b>, or <b>notrunc</b> are requested, the
|
|
data returned from each input block shall be written as a separate output block; if the read returns less than a full block and the
|
|
<b>sync</b> conversion is not specified, the resulting output block shall be the same size as the input block. If the <b>bs</b>=
|
|
<i>expr</i> operand is not specified, or a conversion other than <b>sync</b>, <b>noerror</b>, or <b>notrunc</b> is requested, the
|
|
input shall be processed and collected into full-sized output blocks until the end of the input is reached.</p>
|
|
|
|
<p>The processing order shall be as follows:</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<p>An input block is read.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If the input block is shorter than the specified input block size and the <b>sync</b> conversion is specified, null bytes shall
|
|
be appended to the input data up to the specified size. (If either <b>block</b> or <b>unblock</b> is also specified, <space>s
|
|
shall be appended instead of null bytes.) The remaining conversions and output shall include the pad characters as if they had been
|
|
read from the input.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If the <b>bs</b>= <i>expr</i> operand is specified and no conversion other than <b>sync</b> or <b>noerror</b> is requested, the
|
|
resulting data shall be written to the output as a single block, and the remaining steps are omitted.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If the <b>swab</b> conversion is specified, each pair of input data bytes shall be swapped. If there is an odd number of bytes
|
|
in the input block, the last byte in the input record shall not be swapped.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Any remaining conversions ( <b>block</b>, <b>unblock</b>, <b>lcase</b>, and <b>ucase</b>) shall be performed. These conversions
|
|
shall operate on the input data independently of the input blocking; an input or output fixed-length record may span block
|
|
boundaries.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The data resulting from input or conversion or both shall be aggregated into output blocks of the specified size. After the end
|
|
of input is reached, any remaining output shall be written as a block without padding if <b>conv</b>= <b>sync</b> is not specified;
|
|
thus, the final output block may be shorter than the output block size.</p>
|
|
</li>
|
|
</ol>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>All of the operands shall be processed before any input is read. The following operands shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>if</b>=<i>file</i></dt>
|
|
|
|
<dd>Specify the input pathname; the default is standard input.</dd>
|
|
|
|
<dt><b>of</b>=<i>file</i></dt>
|
|
|
|
<dd>Specify the output pathname; the default is standard output. If the <b>seek</b>= <i>expr</i> conversion is not also specified,
|
|
the output file shall be truncated before the copy begins if an explicit <b>of</b>= <i>file</i> operand is specified, unless
|
|
<b>conv</b>= <b>notrunc</b> is specified. If <b>seek</b>= <i>expr</i> is specified, but <b>conv</b>= <b>notrunc</b> is not, the
|
|
effect of the copy shall be to preserve the blocks in the output file over which <i>dd</i> seeks, but no other portion of the
|
|
output file shall be preserved. (If the size of the seek plus the size of the input file is less than the previous size of the
|
|
output file, the output file shall be shortened by the copy.)</dd>
|
|
|
|
<dt><b>ibs</b>=<i>expr</i></dt>
|
|
|
|
<dd>Specify the input block size, in bytes, by <i>expr</i> (default is 512).</dd>
|
|
|
|
<dt><b>obs</b>=<i>expr</i></dt>
|
|
|
|
<dd>Specify the output block size, in bytes, by <i>expr</i> (default is 512).</dd>
|
|
|
|
<dt><b>bs</b>=<i>expr</i></dt>
|
|
|
|
<dd>Set both input and output block sizes to <i>expr</i> bytes, superseding <b>ibs</b>= and <b>obs</b>=. If no conversion other
|
|
than <b>sync</b>, <b>noerror</b>, and <b>notrunc</b> is specified, each input block shall be copied to the output as a single block
|
|
without aggregating short blocks.</dd>
|
|
|
|
<dt><b>cbs</b>=<i>expr</i></dt>
|
|
|
|
<dd>Specify the conversion block size for <b>block</b> and <b>unblock</b> in bytes by <i>expr</i> (default is zero). If <b>cbs</b>=
|
|
is omitted or given a value of zero, using <b>block</b> or <b>unblock</b> produces unspecified results.
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The application shall ensure that this operand is also specified if the <b>conv</b>= operand is specified with a value of
|
|
<b>ascii</b>, <b>ebcdic</b>, or <b>ibm</b>. For a <b>conv</b>= operand with an <b>ascii</b> value, the input is handled as
|
|
described for the <b>unblock</b> value, except that characters are converted to ASCII before any trailing <space>s are
|
|
deleted. For <b>conv</b>= operands with <b>ebcdic</b> or <b>ibm</b> values, the input is handled as described for the <b>block</b>
|
|
value except that the characters are converted to EBCDIC or IBM EBCDIC, respectively, after any trailing <space>s are added.
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</dd>
|
|
|
|
<dt><b>skip</b>=<i>n</i></dt>
|
|
|
|
<dd>Skip <i>n</i> input blocks (using the specified input block size) before starting to copy. On seekable files, the
|
|
implementation shall read the blocks or seek past them; on non-seekable files, the blocks shall be read and the data shall be
|
|
discarded.</dd>
|
|
|
|
<dt><b>seek</b>=<i>n</i></dt>
|
|
|
|
<dd>Skip <i>n</i> blocks (using the specified output block size) from the beginning of the output file before copying. On
|
|
non-seekable files, existing blocks shall be read and space from the current end-of-file to the specified offset, if any, filled
|
|
with null bytes; on seekable files, the implementation shall seek to the specified offset or read the blocks as described for
|
|
non-seekable files.</dd>
|
|
|
|
<dt><b>count</b>=<i>n</i></dt>
|
|
|
|
<dd>Copy only <i>n</i> input blocks.</dd>
|
|
|
|
<dt><b>conv</b>=<i>value</i><b>[</b>,<i>value</i> ...<b>]</b></dt>
|
|
|
|
<dd><br>
|
|
Where <i>value</i>s are comma-separated symbols from the following list:
|
|
|
|
<dl compact>
|
|
<dt><b>ascii</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Convert EBCDIC to ASCII; see <a href="#tagtcjh_12">ASCII to EBCDIC Conversion</a> . <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
|
|
<dt><b>ebcdic</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Convert ASCII to EBCDIC; see <a href="#tagtcjh_12">ASCII to EBCDIC Conversion</a> . <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
|
|
<dt><b>ibm</b></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Convert ASCII to a different EBCDIC set; see <a href="#tagtcjh_13">ASCII to IBM EBCDIC Conversion</a> .</dd>
|
|
</dl>
|
|
|
|
<p>The <b>ascii</b>, <b>ebcdic</b>, and <b>ibm</b> values are mutually-exclusive. <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></p>
|
|
|
|
<dl compact>
|
|
<dt><b>block</b></dt>
|
|
|
|
<dd>Treat the input as a sequence of <newline>-terminated or end-of-file-terminated variable-length records independent of
|
|
the input block boundaries. Each record shall be converted to a record with a fixed length specified by the conversion block size.
|
|
Any <newline> shall be removed from the input line; <space>s shall be appended to lines that are shorter than their
|
|
conversion block size to fill the block. Lines that are longer than the conversion block size shall be truncated to the largest
|
|
number of characters that fit into that size; the number of truncated lines shall be reported (see the STDERR section).
|
|
|
|
<p>The <b>block</b> and <b>unblock</b> values are mutually-exclusive.</p>
|
|
</dd>
|
|
|
|
<dt><b>unblock</b></dt>
|
|
|
|
<dd>Convert fixed-length records to variable length. Read a number of bytes equal to the conversion block size (or the number of
|
|
bytes remaining in the input, if less than the conversion block size), delete all trailing <space>s, and append a
|
|
<newline>.</dd>
|
|
|
|
<dt><b>lcase</b></dt>
|
|
|
|
<dd>Map uppercase characters specified by the <i>LC_CTYPE</i> keyword <b>tolower</b> to the corresponding lowercase character.
|
|
Characters for which no mapping is specified shall not be modified by this conversion.
|
|
|
|
<p>The <b>lcase</b> and <b>ucase</b> symbols are mutually-exclusive.</p>
|
|
</dd>
|
|
|
|
<dt><b>ucase</b></dt>
|
|
|
|
<dd>Map lowercase characters specified by the <i>LC_CTYPE</i> keyword <b>toupper</b> to the corresponding uppercase character.
|
|
Characters for which no mapping is specified shall not be modified by this conversion.</dd>
|
|
|
|
<dt><b>swab</b></dt>
|
|
|
|
<dd>Swap every pair of input bytes.</dd>
|
|
|
|
<dt><b>noerror</b></dt>
|
|
|
|
<dd>Do not stop processing on an input error. When an input error occurs, a diagnostic message shall be written on standard error,
|
|
followed by the current input and output block counts in the same format as used at completion (see the STDERR section). If the
|
|
<b>sync</b> conversion is specified, the missing input shall be replaced with null bytes and processed normally; otherwise, the
|
|
input block shall be omitted from the output.</dd>
|
|
|
|
<dt><b>notrunc</b></dt>
|
|
|
|
<dd>Do not truncate the output file. Preserve blocks in the output file not explicitly written by this invocation of the <i>dd</i>
|
|
utility. (See also the preceding <b>of</b>= <i>file</i> operand.)</dd>
|
|
|
|
<dt><b>sync</b></dt>
|
|
|
|
<dd>Pad every input block to the size of the <b>ibs</b>= buffer, appending null bytes. (If either <b>block</b> or <b>unblock</b> is
|
|
also specified, append <space>s, rather than null bytes.)</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>The behavior is unspecified if operands other than <b>conv</b>= are specified more than once.</p>
|
|
|
|
<p>For the <b>bs</b>=, <b>cbs</b>=, <b>ibs</b>=, and <b>obs</b>= operands, the application shall supply an expression specifying a
|
|
size in bytes. The expression, <i>expr</i>, can be:</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<p>A positive decimal number</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>A positive decimal number followed by <i>k</i>, specifying multiplication by 1024</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>A positive decimal number followed by <i>b</i>, specifying multiplication by 512</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Two or more positive decimal numbers (with or without <i>k</i> or <i>b</i>) separated by <i>x</i>, specifying the product of the
|
|
indicated values</p>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>All of the operands are processed before any input is read.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The following two tables display the octal number character values used for the <b>ascii</b> and <b>ebcdic</b> conversions (first
|
|
table) and for the <b>ibm</b> conversion (second table). In both tables, the ASCII values are the row and column headers and the
|
|
EBCDIC values are found at their intersections. For example, ASCII 0012 (LF) is the second row, third column, yielding 0045 in
|
|
EBCDIC. The inverted tables (for EBCDIC to ASCII conversion) are not shown, but are in one-to-one correspondence with these tables.
|
|
The differences between the two tables are highlighted by small boxes drawn around five entries. <img src="../images/opt-end.gif"
|
|
alt="[Option End]" border="0"><br>
|
|
</p>
|
|
|
|
<center><b><a name="tagtcjh_12"></a> Table: ASCII to EBCDIC Conversion</b></center>
|
|
|
|
<img src=".././Figures/ascebc.gif"><br>
|
|
<center><b><a name="tagtcjh_13"></a> Table: ASCII to IBM EBCDIC Conversion</b></center>
|
|
|
|
<img src=".././Figures/ascibm.gif"></blockquote>
|
|
|
|
<h4><a name="tag_04_34_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>If no <b>if</b>= operand is specified, the standard input shall be used. See the INPUT FILES section.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>The input file can be any file type.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>dd</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), the classification of characters as uppercase or lowercase, and the
|
|
mapping of characters from one case to the other.</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 and
|
|
informative messages written to standard 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_34_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>For SIGINT, the <i>dd</i> utility shall interrupt its current processing, write status information to standard error, and exit
|
|
as though terminated by SIGINT. It shall take the standard action for all other signals; see the ASYNCHRONOUS EVENTS section in <a
|
|
href="xcu_chap01.html#tag_01_11"><i>Utility Description Defaults</i></a> .</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>If no <b>of</b>= operand is specified, the standard output shall be used. The nature of the output depends on the operands
|
|
selected.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>On completion, <i>dd</i> shall write the number of input and output blocks to standard error. In the POSIX locale the following
|
|
formats shall be used:</p>
|
|
|
|
<pre>
|
|
<tt>"%u+%u records in\n", <</tt><i>number of whole input blocks</i><tt>>,
|
|
<</tt><i>number of partial input blocks</i><tt>>
|
|
<br>
|
|
"%u+%u records out\n", <</tt><i>number of whole output blocks</i><tt>>,
|
|
<</tt><i>number of partial output blocks</i><tt>>
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>A partial input block is one for which <a href="../functions/read.html"><i>read</i>()</a> returned less than the input block
|
|
size. A partial output block is one that was written with fewer bytes than specified by the output block size.</p>
|
|
|
|
<p>In addition, when there is at least one truncated block, the number of truncated blocks shall be written to standard error. In
|
|
the POSIX locale, the format shall be:</p>
|
|
|
|
<pre>
|
|
<tt>"%u truncated %s\n", <</tt><i>number of truncated blocks</i><tt>>, "record" (if
|
|
<</tt><i>number of truncated blocks</i><tt>> is one) "records" (otherwise)
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>Diagnostic messages may also be written to standard error.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>If the <b>of</b>= operand is used, the output shall be the same as described in the STDOUT section.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following exit values shall be returned:</p>
|
|
|
|
<dl compact>
|
|
<dt> 0</dt>
|
|
|
|
<dd>The input file was copied successfully.</dd>
|
|
|
|
<dt>>0</dt>
|
|
|
|
<dd>An error occurred.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>If an input error is detected and the <b>noerror</b> conversion has not been specified, any partial output block shall be
|
|
written to the output file, a diagnostic message shall be written, and the copy operation shall be discontinued. If some other
|
|
error is detected, a diagnostic message shall be written and the copy operation shall be discontinued.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_34_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>The input and output block size can be specified to take advantage of raw physical I/O.</p>
|
|
|
|
<p>There are many different versions of the EBCDIC codesets. The ASCII and EBCDIC conversions specified for the <i>dd</i> utility
|
|
perform conversions for the version specified by the tables.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following command:</p>
|
|
|
|
<pre>
|
|
<tt>dd if=/dev/rmt0h of=/dev/rmt1h
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>copies from tape drive 0 to tape drive 1, using a common historical device naming convention.</p>
|
|
|
|
<p>The following command:</p>
|
|
|
|
<pre>
|
|
<tt>dd ibs=10 skip=1
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>strips the first 10 bytes from standard input.</p>
|
|
|
|
<p>This example reads an EBCDIC tape blocked ten 80-byte EBCDIC card images per block into the ASCII file <b>x</b>:</p>
|
|
|
|
<pre>
|
|
<tt>dd if=/dev/tape of=x ibs=800 cbs=80 conv=ascii,lcase
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>The OPTIONS section is listed as "None" because there are no options recognized by historical <i>dd</i> utilities. Certainly,
|
|
many of the operands could have been designed to use the Utility Syntax Guidelines, which would have resulted in the classic
|
|
hyphenated option letters. In this version of this volume of IEEE Std 1003.1-2001, <i>dd</i> retains its curious JCL-like
|
|
syntax due to the large number of applications that depend on the historical implementation.</p>
|
|
|
|
<p>A suggested implementation technique for <b>conv</b>= <b>noerror</b>, <b>sync</b> is to zero (or <space>-fill, if
|
|
<b>block</b>ing or <b>unblock</b>ing) the input buffer before each read and to write the contents of the input buffer to the output
|
|
even after an error. In this manner, any data transferred to the input buffer before the error was detected is preserved. Another
|
|
point is that a failed read on a regular file or a disk generally does not increment the file offset, and <i>dd</i> must then seek
|
|
past the block on which the error occurred; otherwise, the input error occurs repetitively. When the input is a magnetic tape,
|
|
however, the tape normally has passed the block containing the error when the error is reported, and thus no seek is necessary.</p>
|
|
|
|
<p>The default <b>ibs</b>= and <b>obs</b>= sizes are specified as 512 bytes because there are historical (largely portable) scripts
|
|
that assume these values. If they were left unspecified, unusual results could occur if an implementation chose an odd block
|
|
size.</p>
|
|
|
|
<p>Historical implementations of <i>dd</i> used <a href="../functions/creat.html"><i>creat</i>()</a> when processing <b>of</b>=
|
|
<i>file</i>. This makes the <b>seek</b>= operand unusable except on special files. The <b>conv</b>= <b>notrunc</b> feature was
|
|
added because more recent BSD-based implementations use <a href="../functions/open.html"><i>open</i>()</a> (without O_TRUNC)
|
|
instead of <a href="../functions/creat.html"><i>creat</i>()</a>, but they fail to delete output file contents after the data
|
|
copied.</p>
|
|
|
|
<p>The <i>w</i> multiplier (historically meaning <i>word</i>), is used in System V to mean 2 and in 4.2 BSD to mean 4. Since
|
|
<i>word</i> is inherently non-portable, its use is not supported by this volume of IEEE Std 1003.1-2001.</p>
|
|
|
|
<p>Standard EBCDIC does not have the characters <tt>'['</tt> and <tt>']'</tt> . The values used in the table are taken from a
|
|
common print train that does contain them. Other than those characters, the print train values are not filled in, but appear to
|
|
provide some of the motivation for the historical choice of translations reflected here.</p>
|
|
|
|
<p>The Standard EBCDIC table provides a 1:1 translation for all 256 bytes.</p>
|
|
|
|
<p>The IBM EBCDIC table does not provide such a translation. The marked cells in the tables differ in such a way that:</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<p>EBCDIC 0112 ( <tt>'¢'</tt> ) and 0152 (broken pipe) do not appear in the table.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>EBCDIC 0137 ( <tt>'¬'</tt> ) translates to/from ASCII 0236 ( <tt>'^'</tt> ). In the standard table, EBCDIC 0232 (no graphic)
|
|
is used.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>EBCDIC 0241 ( <tt>'˜'</tt> ) translates to/from ASCII 0176 ( <tt>'˜'</tt> ). In the standard table, EBCDIC 0137 (
|
|
<tt>'¬'</tt> ) is used.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>0255 ( <tt>'['</tt> ) and 0275 ( <tt>']'</tt> ) appear twice, once in the same place as for the standard table and once in place
|
|
of 0112 ( <tt>'¢'</tt> ) and 0241 ( <tt>'˜'</tt> ).</p>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>In net result:</p>
|
|
|
|
<blockquote>EBCDIC 0275 ( <tt>']'</tt> ) displaced EBCDIC 0241 ( <tt>'˜'</tt> ) in cell 0345.
|
|
|
|
<p> That displaced EBCDIC 0137 ( <tt>'¬'</tt> ) in cell 0176.</p>
|
|
|
|
<p> That displaced EBCDIC 0232 (no graphic) in cell 0136.</p>
|
|
|
|
<p> That replaced EBCDIC 0152 (broken pipe) in cell 0313.</p>
|
|
|
|
<p>EBCDIC 0255 ( <tt>'['</tt> ) replaced EBCDIC 0112 ( <tt>'¢'</tt> ).</p>
|
|
</blockquote>
|
|
|
|
<p>This translation, however, reflects historical practice that (ASCII) <tt>'˜'</tt> and <tt>'¬'</tt> were often mapped to
|
|
each other, as were <tt>'['</tt> and <tt>'¢'</tt> ; and <tt>']'</tt> and (EBCDIC) <tt>'˜'</tt> .</p>
|
|
|
|
<p>The <b>cbs</b> operand is required if any of the <b>ascii</b>, <b>ebcdic</b>, or <b>ibm</b> operands are specified. For the
|
|
<b>ascii</b> operand, the input is handled as described for the <b>unblock</b> operand except that characters are converted to
|
|
ASCII before the trailing <space>s are deleted. For the <b>ebcdic</b> and <b>ibm</b> operands, the input is handled as
|
|
described for the <b>block</b> operand except that the characters are converted to EBCDIC or IBM EBCDIC after the trailing
|
|
<space>s are added.</p>
|
|
|
|
<p>The <b>block</b> and <b>unblock</b> keywords are from historical BSD practice.</p>
|
|
|
|
<p>The consistent use of the word <b>record</b> in standard error messages matches most historical practice. An earlier version of
|
|
System V used <b>block</b>, but this has been updated in more recent releases.</p>
|
|
|
|
<p>Early proposals only allowed two numbers separated by <b>x</b> to be used in a product when specifying <b>bs</b>=, <b>cbs</b>=,
|
|
<b>ibs</b>=, and <b>obs</b>= sizes. This was changed to reflect the historical practice of allowing multiple numbers in the product
|
|
as provided by Version 7 and all releases of System V and BSD.</p>
|
|
|
|
<p>A change to the <b>swab</b> conversion is required to match historical practice and is the result of IEEE PASC Interpretations
|
|
1003.2 #03 and #04, submitted for the ISO POSIX-2:1993 standard.</p>
|
|
|
|
<p>A change to the handling of SIGINT is required to match historical practice and is the result of IEEE PASC Interpretation 1003.2
|
|
#06 submitted for the ISO POSIX-2:1993 standard.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="xcu_chap01.html#tag_01_11"><i>Utility Description Defaults</i></a> , <a href="sed.html"><i>sed</i></a> , <a href=
|
|
"tr.html"><i>tr</i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_22"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>The second paragraph of the <b>cbs</b>= description is reworded and marked EX.</p>
|
|
|
|
<p>The FUTURE DIRECTIONS section is added.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_34_23"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>Changes are made to <b>swab</b> conversion and SIGINT handling to align with the IEEE P1003.2b draft standard.</p>
|
|
|
|
<p>The normative text is reworded to avoid use of the term "must" for application requirements.</p>
|
|
|
|
<p>IEEE PASC Interpretation 1003.2 #209 is applied, clarifying the interaction between <i>dd</i> <b>of</b>= <i>file</i> and
|
|
<b>conv</b>= <b>notrunc</b>.</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>
|
|
|