The Open Group Base Specifications Issue 7
IEEE Std 1003.1-2008
Copyright © 2001-2008 The IEEE and The Open Group

A.5 File Format Notation

The notation for spaces allows some flexibility for application output. Note that an empty character position in format represents one or more <blank> characters on the output (not white space, which can include <newline> characters). Therefore, another utility that reads that output as its input must be prepared to parse the data using scanf(), awk, and so on. The '' character is used when exactly one <space> is output.

The treatment of integers and spaces is different from the printf() function in that they can be surrounded with <blank> characters. This was done so that, given a format such as:

"%d\n",<foo>

the implementation could use a printf() call such as:

printf("%6d\n", foo);

and still conform. This notation is thus somewhat like scanf() in addition to printf().

The printf() function was chosen as a model because most of the standard developers were familiar with it. One difference from the C function printf() is that the l and h conversion specifier characters are not used. As expressed by the Shell and Utilities volume of POSIX.1-2008, there is no differentiation between decimal values for type int, type long, or type short. The conversion specifications %d or %i should be interpreted as an arbitrary length sequence of digits. Also, no distinction is made between single precision and double precision numbers ( float or double in C). These are simply referred to as floating-point numbers.

Many of the output descriptions in the Shell and Utilities volume of POSIX.1-2008 use the term ``line'', such as:

"%s", <input line>

Since the definition of line includes the trailing <newline> already, there is no need to include a '\n' in the format; a double <newline> would otherwise result.

 

return to top of page

UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
Copyright © 2001-2008 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]