455 lines
19 KiB
HTML
455 lines
19 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>lp</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="lp"></a> <a name="tag_04_80"></a><!-- lp -->
|
|
<!--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_80_01"></a>NAME</h4>
|
|
|
|
<blockquote>lp - send files to a printer</blockquote>
|
|
|
|
<h4><a name="tag_04_80_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>lp</tt> <b>[</b><tt>-c</tt><b>][</b><tt>-d</tt> <i>dest</i><b>][</b><tt>-n</tt>
|
|
<i>copies</i><b>][</b><tt>-msw</tt><b>][</b><tt>-o</tt> <i>option</i><b>]</b><tt>...</tt> <b>[</b><tt>-t</tt>
|
|
<i>title</i><b>][</b><i>file</i><tt>...</tt><b>]</b></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>lp</i> utility shall copy the input files to an output destination in an unspecified manner. The default output
|
|
destination should be to a hardcopy device, such as a printer or microfilm recorder, that produces non-volatile, human-readable
|
|
documents. If such a device is not available to the application, or if the system provides no such device, the <i>lp</i> utility
|
|
shall exit with a non-zero exit status.</p>
|
|
|
|
<p>The actual writing to the output device may occur some time after the <i>lp</i> utility successfully exits. During the portion
|
|
of the writing that corresponds to each input file, the implementation shall guarantee exclusive access to the device.</p>
|
|
|
|
<p>The <i>lp</i> utility shall associate a unique <i>request ID</i> with each request.</p>
|
|
|
|
<p>Normally, a banner page is produced to separate and identify each print job. This page may be suppressed by
|
|
implementation-defined conditions, such as an operator command or one of the <b>-o</b> <i>option</i> values.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>lp</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>.</p>
|
|
|
|
<p>The following options shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-c</b></dt>
|
|
|
|
<dd>Exit only after further access to any of the input files is no longer required. The application can then safely delete or
|
|
modify the files without affecting the output operation. Normally, files are not copied, but are linked whenever possible. If the
|
|
<b>-c</b> option is not given, then the user should be careful not to remove any of the files before the request has been printed
|
|
in its entirety. It should also be noted that in the absence of the <b>-c</b> option, any changes made to the named files after the
|
|
request is made but before it is printed may be reflected in the printed output. On some implementations, <b>-c</b> may be on by
|
|
default.</dd>
|
|
|
|
<dt><b>-d </b> <i>dest</i></dt>
|
|
|
|
<dd>Specify a string that names the destination ( <i>dest</i>). If <i>dest</i> is a printer, the request shall be printed only on
|
|
that specific printer. If <i>dest</i> is a class of printers, the request shall be printed on the first available printer that is a
|
|
member of the class. Under certain conditions (printer unavailability, file space limitation, and so on), requests for specific
|
|
destinations need not be accepted. Destination names vary between systems.
|
|
|
|
<p>If <b>-d</b> is not specified, and neither the <i>LPDEST</i> nor <i>PRINTER</i> environment variable is set, an unspecified
|
|
destination is used. The <b>-d</b> <i>dest</i> option shall take precedence over <i>LPDEST ,</i> which in turn shall take
|
|
precedence over <i>PRINTER .</i> Results are undefined when <i>dest</i> contains a value that is not a valid destination name.</p>
|
|
</dd>
|
|
|
|
<dt><b>-m</b></dt>
|
|
|
|
<dd>Send mail (see <a href="mailx.html"><i>mailx</i></a> ) after the files have been printed. By default, no mail is sent upon
|
|
normal completion of the print request.</dd>
|
|
|
|
<dt><b>-n </b> <i>copies</i></dt>
|
|
|
|
<dd>Write <i>copies</i> number of copies of the files, where <i>copies</i> is a positive decimal integer. The methods for producing
|
|
multiple copies and for arranging the multiple copies when multiple <i>file</i> operands are used are unspecified, except that each
|
|
file shall be output as an integral whole, not interleaved with portions of other files.</dd>
|
|
|
|
<dt><b>-o </b> <i>option</i></dt>
|
|
|
|
<dd>Specify printer-dependent or class-dependent <i>option</i>s. Several such <i>option</i>s may be collected by specifying the
|
|
<b>-o</b> option more than once.</dd>
|
|
|
|
<dt><b>-s</b></dt>
|
|
|
|
<dd>Suppress messages from <i>lp</i>.</dd>
|
|
|
|
<dt><b>-t </b> <i>title</i></dt>
|
|
|
|
<dd>Write <i>title</i> on the banner page of the output.</dd>
|
|
|
|
<dt><b>-w</b></dt>
|
|
|
|
<dd>Write a message on the user's terminal after the files have been printed. If the user is not logged in, then mail shall be sent
|
|
instead.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following operand shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>file</i></dt>
|
|
|
|
<dd>A pathname of a file to be output. If no <i>file</i> operands are specified, or if a <i>file</i> operand is <tt>'-'</tt> , the
|
|
standard input shall be used. If a <i>file</i> operand is used, but the <b>-c</b> option is not specified, the process performing
|
|
the writing to the output device may have user and group permissions that differ from that of the process invoking <i>lp</i>.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard input shall be used only if no <i>file</i> operands are specified, or if a <i>file</i> operand is <tt>'-'</tt> .
|
|
See the INPUT FILES section.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>The input files shall be text files.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>lp</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 and
|
|
informative messages written to standard output.</dd>
|
|
|
|
<dt><i>LC_TIME</i></dt>
|
|
|
|
<dd>Determine the format and contents of date and time strings displayed in the <i>lp</i> banner page, if any.</dd>
|
|
|
|
<dt><i>LPDEST</i></dt>
|
|
|
|
<dd>Determine the destination. If the <i>LPDEST</i> environment variable is not set, the <i>PRINTER</i> environment variable shall
|
|
be used. The <b>-d</b> <i>dest</i> option takes precedence over <i>LPDEST .</i> Results are undefined when <b>-d</b> is not
|
|
specified and <i>LPDEST</i> contains a value that is not a valid destination name.</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>
|
|
|
|
<dt><i>PRINTER</i></dt>
|
|
|
|
<dd>Determine the output device or destination. If the <i>LPDEST</i> and <i>PRINTER</i> environment variables are not set, an
|
|
unspecified output device is used. The <b>-d</b> <i>dest</i> option and the <i>LPDEST</i> environment variable shall take
|
|
precedence over <i>PRINTER .</i> Results are undefined when <b>-d</b> is not specified, <i>LPDEST</i> is unset, and <i>PRINTER</i>
|
|
contains a value that is not a valid device or destination name.</dd>
|
|
|
|
<dt><i>TZ</i></dt>
|
|
|
|
<dd>Determine the timezone used to calculate date and time strings displayed in the <i>lp</i> banner page, if any. If <i>TZ</i> is
|
|
unset or null, an unspecified default timezone shall be used.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>lp</i> utility shall write a <i>request ID</i> to the standard output, unless <b>-s</b> is specified. The format of the
|
|
message is unspecified. The request ID can be used on systems supporting the historical <i>cancel</i> and <i>lpstat</i>
|
|
utilities.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard error shall be used only for diagnostic messages.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_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>No output device was available, or an error occurred.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_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_80_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>The <a href="../utilities/pr.html"><i>pr</i></a> and <a href="../utilities/fold.html"><i>fold</i></a> utilities can be used to
|
|
achieve reasonable formatting for the implementation's default page size.</p>
|
|
|
|
<p>A conforming application can use one of the <i>file</i> operands only with the <b>-c</b> option or if the file is publicly
|
|
readable and guaranteed to be available at the time of printing. This is because IEEE Std 1003.1-2001 gives the
|
|
implementation the freedom to queue up the request for printing at some later time by a different process that might not be able to
|
|
access the file.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<ol>
|
|
<li>
|
|
<p>To print file <i>file</i>:</p>
|
|
|
|
<pre>
|
|
<tt>lp -c</tt> <i>file</i>
|
|
</pre>
|
|
</li>
|
|
|
|
<li>
|
|
<p>To print multiple files with headers:</p>
|
|
|
|
<pre>
|
|
<tt>pr</tt> <i>file1 file2</i> <tt>| lp
|
|
</tt>
|
|
</pre>
|
|
</li>
|
|
</ol>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>lp</i> utility was designed to be a basic version of a utility that is already available in many historical
|
|
implementations. The standard developers considered that it should be implementable simply as:</p>
|
|
|
|
<pre>
|
|
<tt>cat "$@" > /dev/lp
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>after appropriate processing of options, if that is how the implementation chose to do it and if exclusive access could be
|
|
granted (so that two users did not write to the device simultaneously). Although in the future the standard developers may add
|
|
other options to this utility, it should always be able to execute with no options or operands and send the standard input to an
|
|
unspecified output device.</p>
|
|
|
|
<p>This volume of IEEE Std 1003.1-2001 makes no representations concerning the format of the printed output, except that
|
|
it must be "human-readable" and "non-volatile". Thus, writing by default to a disk or tape drive or a display terminal would
|
|
not qualify. (Such destinations are not prohibited when <b>-d</b> <i>dest</i>, <i>LPDEST ,</i> or <i>PRINTER</i> are used,
|
|
however.)</p>
|
|
|
|
<p>This volume of IEEE Std 1003.1-2001 is worded such that a "print job" consisting of multiple input files, possibly
|
|
in multiple copies, is guaranteed to print so that any one file is not intermixed with another, but there is no statement that all
|
|
the files or copies have to print out together.</p>
|
|
|
|
<p>The <b>-c</b> option may imply a spooling operation, but this is not required. The utility can be implemented to wait until the
|
|
printer is ready and then wait until it is finished. Because of that, there is no attempt to define a queuing mechanism
|
|
(priorities, classes of output, and so on).</p>
|
|
|
|
<p>On some historical systems, the request ID reported on the STDOUT can be used to later cancel or find the status of a request
|
|
using utilities not defined in this volume of IEEE Std 1003.1-2001.</p>
|
|
|
|
<p>Although the historical System V <i>lp</i> and BSD <i>lpr</i> utilities have provided similar functionality, they used different
|
|
names for the environment variable specifying the destination printer. Since the name of the utility here is <i>lp</i>,
|
|
<i>LPDEST</i> (used by the System V <i>lp</i> utility) was given precedence over <i>PRINTER</i> (used by the BSD <i>lpr</i>
|
|
utility). Since environments of users frequently contain one or the other environment variable, the <i>lp</i> utility is required
|
|
to recognize both. If this was not done, many applications would send output to unexpected output devices when users moved from
|
|
system to system.</p>
|
|
|
|
<p>Some have commented that <i>lp</i> has far too little functionality to make it worthwhile. Requests have proposed additional
|
|
options or operands or both that added functionality. The requests included:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>Wording <i>requiring</i> the output to be "hardcopy"</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>A requirement for multiple printers</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Options for supporting various page-description languages</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>Given that a compliant system is not required to even have a printer, placing further restrictions upon the behavior of the
|
|
printer is not useful. Since hardcopy format is so application-dependent, it is difficult, if not impossible, to select a
|
|
reasonable subset of functionality that should be required on all compliant systems.</p>
|
|
|
|
<p>The term <i>unspecified</i> is used in this section in lieu of <i>implementation-defined</i> as most known implementations would
|
|
not be able to make definitive statements in their conformance documents; the existence and usage of printers is very dependent on
|
|
how the system administrator configures each individual system.</p>
|
|
|
|
<p>Since the default destination, device type, queuing mechanisms, and acceptable forms of input are all unspecified, usage
|
|
guidelines for what a conforming application can do are as follows:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>Use the command in a pipeline, or with <b>-c</b>, so that there are no permission problems and the files can be safely deleted
|
|
or modified.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Limit output to text files of reasonable line lengths and printable characters and include no device-specific formatting
|
|
information, such as a page description language. The meaning of "reasonable" in this context can only be answered as a
|
|
quality-of-implementation issue, but it should be apparent from historical usage patterns in the industry and the locale. The <a
|
|
href="../utilities/pr.html"><i>pr</i></a> and <a href="../utilities/fold.html"><i>fold</i></a> utilities can be used to achieve
|
|
reasonable formatting for the default page size of the implementation.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>Alternatively, the application can arrange its installation in such a way that it requires the system administrator or operator
|
|
to provide the appropriate information on <i>lp</i> options and environment variable values.</p>
|
|
|
|
<p>At a minimum, having this utility in this volume of IEEE Std 1003.1-2001 tells the industry that conforming
|
|
applications require a means to print output and provides at least a command name and <i>LPDEST</i> routing mechanism that can be
|
|
used for discussions between vendors, application writers, and users. The use of "should" in the DESCRIPTION of <i>lp</i> clearly
|
|
shows the intent of the standard developers, even if they cannot mandate that all systems (such as laptops) have printers.</p>
|
|
|
|
<p>This volume of IEEE Std 1003.1-2001 does not specify what the ownership of the process performing the writing to the
|
|
output device may be. If <b>-c</b> is not used, it is unspecified whether the process performing the writing to the output device
|
|
has permission to read <i>file</i> if there are any restrictions in place on who may read <i>file</i> until after it is printed.
|
|
Also, if <b>-c</b> is not used, the results of deleting <i>file</i> before it is printed are unspecified.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="mailx.html"><i>mailx</i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_80_22"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>In the DESCRIPTION, the requirement to associate a unique request ID, and the normal generation of a banner page is added.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>In the OPTIONS section:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The <b>-d</b> <i>dest</i> description is expanded, but references to <i>lpstat</i> are removed.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The <b>-m</b>, <b>-o</b>, <b>-s</b>, <b>-t</b>, and <b>-w</b> options are added.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li>
|
|
<p>In the ENVIRONMENT VARIABLES section, <i>LC_TIME</i> may now affect the execution.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The STDOUT section is added.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The normative text is reworded to avoid use of the term "must" for application requirements.</p>
|
|
|
|
<p>The <i>TZ</i> entry is added to the ENVIRONMENT VARIABLES section.</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>
|
|
|