83 lines
3.6 KiB
HTML
83 lines
3.6 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>Rationale</title>
|
|
</head>
|
|
<body>
|
|
|
|
<basefont size="3">
|
|
|
|
<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</font></center>
|
|
|
|
<hr size="2" noshade>
|
|
<h3><a name="tag_01_05"></a>File Format Notation</h3>
|
|
|
|
<p>The notation for spaces allows some flexibility for application output. Note that an empty character position in <i>format</i>
|
|
represents one or more <blank>s on the output (not <i>white space</i>, which can include <newline>s). Therefore,
|
|
another utility that reads that output as its input must be prepared to parse the data using <a href=
|
|
"../functions/scanf.html"><i>scanf</i>()</a>, <a href="../utilities/awk.html"><i>awk</i></a>, and so on. The <tt>'<img src=
|
|
"../images/delta.gif" border="0">'</tt> character is used when exactly one <space> is output.</p>
|
|
|
|
<p>The treatment of integers and spaces is different from the <a href="../functions/printf.html"><i>printf</i>()</a> function in
|
|
that they can be surrounded with <blank>s. This was done so that, given a format such as:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>"%d\n",<</tt><i>foo</i><tt>>
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>the implementation could use a <a href="../functions/printf.html"><i>printf</i>()</a> call such as:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>printf("%6d\n", foo);
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>and still conform. This notation is thus somewhat like <a href="../functions/scanf.html"><i>scanf</i>()</a> in addition to <a
|
|
href="../functions/printf.html"><i>printf</i>()</a>.</p>
|
|
|
|
<p>The <a href="../functions/printf.html"><i>printf</i>()</a> function was chosen as a model because most of the standard
|
|
developers were familiar with it. One difference from the C function <a href="../functions/printf.html"><i>printf</i>()</a> is that
|
|
the <tt>l</tt> and <tt>h</tt> conversion specifier characters are not used. As expressed by the Shell and Utilities volume of
|
|
IEEE Std 1003.1-2001, there is no differentiation between decimal values for type <b>int</b>, type <b>long</b>, or type
|
|
<b>short</b>. The conversion specifications <tt>%d</tt> or <tt>%i</tt> should be interpreted as an arbitrary length sequence of
|
|
digits. Also, no distinction is made between single precision and double precision numbers ( <b>float</b> or <b>double</b> in C).
|
|
These are simply referred to as floating-point numbers.</p>
|
|
|
|
<p>Many of the output descriptions in the Shell and Utilities volume of IEEE Std 1003.1-2001 use the term ``line'', such
|
|
as:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>"%s", <input line>
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>Since the definition of <i>line</i> includes the trailing <newline> already, there is no need to include a <tt>'\n'</tt>
|
|
in the format; a double <newline> would otherwise result.</p>
|
|
|
|
<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>
|
|
|