📄 ar.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-2003 The Open Group, All Rights Reserved --><title>ar</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="ar"></a> <a name="tag_04_03"></a><!-- ar --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_03_01"></a>NAME</h4><blockquote>ar - create and maintain library archives</blockquote><h4><a name="tag_04_03_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('SD')">SD</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> ar -d</tt><b>[</b><tt>-v</tt><b>]</b> <i>archive file</i> <tt>... <img src="../images/opt-end.gif"alt="[Option End]" border="0"></tt></code></div><tt><br><br></tt><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"> ar -m</tt> <b>[</b><tt>-v</tt><b>]</b> <i>archive file</i> <tt>...<br><br> ar -m -a</tt><b>[</b><tt>-v</tt><b>]</b> <i>posname archive file</i> <tt>...<br><br> ar -m -b</tt><b>[</b><tt>-v</tt><b>]</b> <i>posname archive file</i> <tt>...<br><br> ar -m -i</tt><b>[</b><tt>-v</tt><b>]</b> <i>posname archive file</i> <tt>... <img src="../images/opt-end.gif" alt="[Option End]"border="0"></tt></code></div><tt><br><br> <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> ar -p</tt><b>[</b><tt>-v</tt><b>]<img src="../images/opt-start.gif"border="0">[</b><tt>-s</tt><b>]<img src="../images/opt-end.gif" border="0"></b><i>archive</i> <b>[</b><i>file</i><tt>...</tt><b>]</b><tt><br><br></tt><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"> ar -q</tt><b>[</b><tt>-cv</tt><b>]</b> <i>archive file</i> <tt>... <img src="../images/opt-end.gif"alt="[Option End]" border="0"></tt></code></div><tt><br><br> ar -r</tt><b>[</b><tt>-cuv</tt><b>]</b> <i>archive file</i> <tt>...<br><br></tt><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"> ar -r -a</tt><b>[</b><tt>-cuv</tt><b>]</b> <i>posname archive file</i> <tt>...<br><br> ar -r -b</tt><b>[</b><tt>-cuv</tt><b>]</b> <i>posname archive file</i> <tt>...<br><br> ar -r -i</tt><b>[</b><tt>-cuv</tt><b>]</b> <i>posname archive file</i> <tt>... <img src="../images/opt-end.gif" alt="[Option End]"border="0"></tt></code></div><tt><br><br> <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> ar -t</tt><b>[</b><tt>-v</tt><b>]<img src="../images/opt-start.gif"border="0">[</b><tt>-s</tt><b>]<img src="../images/opt-end.gif" border="0"></b><i>archive</i> <b>[</b><i>file</i><tt>...</tt><b>]</b><tt><br><br><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> ar -x</tt><b>[</b><tt>-v</tt><b>]<img src="../images/opt-start.gif"border="0">[</b><tt>-sCT</tt><b>]<img src="../images/opt-end.gif" border="0"></b><i>archive</i> <b>[</b><i>file</i><tt>...</tt><b>]</b><tt><br></tt></blockquote><h4><a name="tag_04_03_03"></a>DESCRIPTION</h4><blockquote><p>The <i>ar</i> utility is part of the Software Development Utilities option.</p><p>The <i>ar</i> utility can be used to create and maintain groups of files combined into an archive. Once an archive has beencreated, new files can be added, and existing files in an archive can be extracted, deleted, or replaced. When an archive consistsentirely of valid object files, the implementation shall format the archive so that it is usable as a library for link editing (see<a href="../utilities/c99.html"><i>c99</i></a> and <a href="../utilities/fort77.html"><i>fort77</i></a>). When some of the archivedfiles are not valid object files, the suitability of the archive for library use is undefined. <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> If anarchive consists entirely of printable files, the entire archive shall be printable.</p><p>When <i>ar</i> creates an archive, it creates administrative information indicating whether a symbol table is present in thearchive. When there is at least one object file that <i>ar</i> recognizes as such in the archive, an archive symbol table shall becreated in the archive and maintained by <i>ar</i>; it is used by the link editor to search the archive. Whenever the <i>ar</i>utility is used to create or update the contents of such an archive, the symbol table shall be rebuilt. The <b>-s</b> option shallforce the symbol table to be rebuilt. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>All <i>file</i> operands can be pathnames. However, files within archives shall be named by a filename, which is the lastcomponent of the pathname used when the file was entered into the archive. The comparison of <i>file</i> operands to the names offiles in archives shall be performed by comparing the last component of the operand to the name of the file in the archive.</p><p>It is unspecified whether multiple files in the archive may be identically named. In the case of such files, however, each<i>file</i> <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> and <i>posname</i> <img src="../images/opt-end.gif" alt="[Option End]" border="0"> operand shall match only thefirst file in the archive having a name that is the same as the last component of the operand.</p></blockquote><h4><a name="tag_04_03_04"></a>OPTIONS</h4><blockquote><p>The <i>ar</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>-a</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Position new files in the archive after the file named by the <i>posname</i> operand. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></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">Position new files in the archive before the file named by the <i>posname</i> operand. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-c</b></dt><dd>Suppress the diagnostic message that is written to standard error by default when the archive <i>archive</i> is created.</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">Prevent extracted files from replacing like-named files in the file system. This option is useful when <b>-T</b> is also used, toprevent truncated filenames from replacing files with the same prefix. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-d</b></dt><dd>Delete one or more <i>file</i>s from <i>archive</i>.</dd><dt><b>-i</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Position new files in the archive before the file in the archive named by the <i>posname</i> operand (equivalent to <b>-b</b>).<img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-m</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Move the named files in the archive. The <b>-a</b>, <b>-b</b>, or <b>-i</b> options with the <i>posname</i> operand indicate theposition; otherwise, move the names files in the archive to the end of the archive. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-p</b></dt><dd>Write the contents of the <i>file</i>s in the archive named by <i>file</i> operands from <i>archive</i> to the standard output.If no <i>file</i> operands are specified, the contents of all files in the archive shall be written in the order of thearchive.</dd><dt><b>-q</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Append the named files to the end of the archive. In this case <i>ar</i> does not check whether the added files are already in thearchive. This is useful to bypass the searching otherwise done when creating a large archive piece by piece. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-r</b></dt><dd>Replace or add <i>file</i>s to <i>archive</i>. If the archive named by <i>archive</i> does not exist, a new archive shall becreated and a diagnostic message shall be written to standard error (unless the <b>-c</b> option is specified). If no <i>file</i>sare specified and the <i>archive</i> exists, the results are undefined. Files that replace existing files in the archive shall notchange the order of the archive. Files that do not replace existing files in the archive shall be appended to the archive <sup>[<ahref="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> unlessa <b>-a</b>, <b>-b</b>, or <b>-i</b> option specifies another position. <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">Force the regeneration of the archive symbol table even if <i>ar</i> is not invoked with an option that modifies the archivecontents. This option is useful to restore the archive symbol table after it has been stripped; see <a href="../utilities/strip.html"><i>strip</i></a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-t</b></dt><dd>Write a table of contents of <i>archive</i> to the standard output. The files specified by the <i>file</i> operands shall beincluded in the written list. If no <i>file</i> operands are specified, all files in <i>archive</i> shall be included in the orderof the archive.</dd><dt><b>-T</b></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Allow filename truncation of extracted files whose archive names are longer than the file system can support. By default,extracting a file with a name that is too long shall be an error; a diagnostic message shall be written and the file shall not beextracted. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt><b>-u</b></dt><dd>Update older files in the archive. When used with the <b>-r</b> option, files in the archive shall be replaced only if thecorresponding <i>file</i> has a modification time that is at least as new as the modification time of the file in the archive.</dd><dt><b>-v</b></dt><dd>Give verbose output. When used with the option characters <b>-d</b>, <b>-r</b>, or <b>-x</b>, write a detailed file-by-filedescription of the archive creation and maintenance activity, as described in the STDOUT section. <p>When used with <b>-p</b>, write the name of the file in the archive to the standard output before writing the file in thearchive itself to the standard output, as described in the STDOUT section.</p><p>When used with <b>-t</b>, include a long listing of information about the files in the archive, as described in the STDOUTsection.</p></dd><dt><b>-x</b></dt><dd>Extract the files in the archive named by the <i>file</i> operands from <i>archive</i>. The contents of the archive shall notbe changed. If no <i>file</i> operands are given, all files in the archive shall be extracted. The modification time of each fileextracted shall be set to the time the file is extracted from the archive.</dd></dl></blockquote><h4><a name="tag_04_03_05"></a>OPERANDS</h4><blockquote><p>The following operands shall be supported:</p><dl compact><dt><i>archive</i></dt><dd>A pathname of the archive.</dd><dt><i>file</i></dt><dd>A pathname. Only the last component shall be used when comparing against the names of files in the archive. If two or more<i>file</i> operands have the same last pathname component (basename), the results are unspecified. The implementation's archiveformat shall not truncate valid filenames of files added to or replaced in the archive.</dd><dt><i>posname</i></dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The name of a file in the archive, used for relative positioning; see options <b>-m</b> and <b>-r</b>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl></blockquote><h4><a name="tag_04_03_06"></a>STDIN</h4><blockquote><p>Not used.</p></blockquote><h4><a name="tag_04_03_07"></a>INPUT FILES</h4><blockquote><p>The archive named by <i>archive</i> shall be a file in the format created by <i>ar</i> <b>-r</b>.</p></blockquote><h4><a name="tag_04_03_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>ar</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 ofIEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe 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 asopposed 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 standarderror.</dd><dt><i>LC_TIME</i></dt><dd>Determine the format and content for date and time strings written by <i>ar</i> <b>-tv</b>.</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>TMPDIR</i></dt><dd>Determine the pathname that overrides the default directory for temporary files, if any.</dd><dt><i>TZ</i></dt><dd>Determine the timezone used to calculate date and time strings written by <i>ar</i> <b>-tv</b>. If <i>TZ</i> is unset or null,an unspecified default timezone shall be used.</dd></dl></blockquote><h4><a name="tag_04_03_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_03_10"></a>STDOUT</h4><blockquote><p>If the <b>-d</b> option is used with the <b>-v</b> option, the standard output format shall be:</p><pre><tt>"d - %s\n", <</tt><i>file</i><tt>></tt>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -