isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

strings.html (12576B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>strings</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/split.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/strip.html" accesskey="N">Next
     19 &gt;&gt;&gt;</a></td>
     20 </tr>
     21 </table>
     22 <hr align="left" width="100%"></div>
     23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     24 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     25 IEEE Std 1003.1-2024<br>
     26 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     27 <hr size="2" noshade>
     28 <a name="top" id="top"></a> <a name="strings" id="strings"></a> <a name="tag_20_114" id="tag_20_114"></a><!-- strings -->
     29 <h4 class="mansect"><a name="tag_20_114_01" id="tag_20_114_01"></a>NAME</h4>
     30 <blockquote>strings — find printable strings in files</blockquote>
     31 <h4 class="mansect"><a name="tag_20_114_02" id="tag_20_114_02"></a>SYNOPSIS</h4>
     32 <blockquote class="synopsis">
     33 <p><code><tt>strings</tt> <b>[</b><tt>-a</tt><b>] [</b><tt>-t</tt> <i>format</i><b>] [</b><tt>-n</tt> <i>number</i><b>]
     34 [</b><i>file</i><tt>...</tt><b>]</b></code></p>
     35 </blockquote>
     36 <h4 class="mansect"><a name="tag_20_114_03" id="tag_20_114_03"></a>DESCRIPTION</h4>
     37 <blockquote>
     38 <p>The <i>strings</i> utility shall look for printable strings in regular files and shall write those strings to standard output. A
     39 printable string is any sequence of four (by default) or more printable characters terminated by a &lt;newline&gt; or NUL
     40 character. Additional implementation-defined strings may be written; see <a href=
     41 "../utilities/localedef.html"><i>localedef</i></a>.</p>
     42 <p>If any argument is <tt>'-'</tt>, the results are unspecified.</p>
     43 </blockquote>
     44 <h4 class="mansect"><a name="tag_20_114_04" id="tag_20_114_04"></a>OPTIONS</h4>
     45 <blockquote>
     46 <p>The <i>strings</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     47 Guidelines</i></a> , except for the unspecified usage of <tt>'-'</tt>.</p>
     48 <p>The following options shall be supported:</p>
     49 <dl compact>
     50 <dd></dd>
     51 <dt><b>-a</b></dt>
     52 <dd>Scan files in their entirety. If <b>-a</b> is not specified, it is implementation-defined what portion of each file is scanned
     53 for strings.</dd>
     54 <dt><b>-n&nbsp;</b><i>number</i></dt>
     55 <dd>Specify the minimum string length, where the <i>number</i> argument is a positive decimal integer. The default shall be 4.</dd>
     56 <dt><b>-t&nbsp;</b><i>format</i></dt>
     57 <dd>Write each string preceded by its byte offset from the start of the file. The format shall be dependent on the single character
     58 used as the <i>format</i> option-argument:
     59 <dl compact>
     60 <dd></dd>
     61 <dt><tt>d</tt></dt>
     62 <dd>The offset shall be written in decimal.</dd>
     63 <dt><tt>o</tt></dt>
     64 <dd>The offset shall be written in octal.</dd>
     65 <dt><tt>x</tt></dt>
     66 <dd>The offset shall be written in hexadecimal.</dd>
     67 </dl>
     68 </dd>
     69 </dl>
     70 </blockquote>
     71 <h4 class="mansect"><a name="tag_20_114_05" id="tag_20_114_05"></a>OPERANDS</h4>
     72 <blockquote>
     73 <p>The following operand shall be supported:</p>
     74 <dl compact>
     75 <dd></dd>
     76 <dt><i>file</i></dt>
     77 <dd>A pathname of a regular file to be used as input. If no <i>file</i> operand is specified, the <i>strings</i> utility shall read
     78 from the standard input.</dd>
     79 </dl>
     80 </blockquote>
     81 <h4 class="mansect"><a name="tag_20_114_06" id="tag_20_114_06"></a>STDIN</h4>
     82 <blockquote>
     83 <p>See the INPUT FILES section.</p>
     84 </blockquote>
     85 <h4 class="mansect"><a name="tag_20_114_07" id="tag_20_114_07"></a>INPUT FILES</h4>
     86 <blockquote>
     87 <p>The input files named by the utility arguments or the standard input shall be regular files of any format.</p>
     88 </blockquote>
     89 <h4 class="mansect"><a name="tag_20_114_08" id="tag_20_114_08"></a>ENVIRONMENT VARIABLES</h4>
     90 <blockquote>
     91 <p>The following environment variables shall affect the execution of <i>strings</i>:</p>
     92 <dl compact>
     93 <dd></dd>
     94 <dt><i>LANG</i></dt>
     95 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
     96 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
     97 variables used to determine the values of locale categories.)</dd>
     98 <dt><i>LC_ALL</i></dt>
     99 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    100 <dt><i>LC_CTYPE</i></dt>
    101 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    102 opposed to multi-byte characters in arguments and input files) and to identify printable strings.</dd>
    103 <dt><i>LC_MESSAGES</i></dt>
    104 <dd><br>
    105 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
    106 <dt><i>NLSPATH</i></dt>
    107 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    108 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    109 "0"></dd>
    110 </dl>
    111 </blockquote>
    112 <h4 class="mansect"><a name="tag_20_114_09" id="tag_20_114_09"></a>ASYNCHRONOUS EVENTS</h4>
    113 <blockquote>
    114 <p>Default.</p>
    115 </blockquote>
    116 <h4 class="mansect"><a name="tag_20_114_10" id="tag_20_114_10"></a>STDOUT</h4>
    117 <blockquote>
    118 <p>Strings found shall be written to the standard output, one per line.</p>
    119 <p>When the <b>-t</b> option is not specified, the format of the output shall be:</p>
    120 <pre>
    121 <tt>"%s", &lt;</tt><i>string</i><tt>&gt;
    122 </tt></pre>
    123 <p>With the <b>-t&nbsp;o</b> option, the format of the output shall be:</p>
    124 <pre>
    125 <tt>"%o %s", &lt;</tt><i>byte offset</i><tt>&gt;, &lt;</tt><i>string</i><tt>&gt;
    126 </tt></pre>
    127 <p>With the <b>-t&nbsp;x</b> option, the format of the output shall be:</p>
    128 <pre>
    129 <tt>"%x %s", &lt;</tt><i>byte offset</i><tt>&gt;, &lt;</tt><i>string</i><tt>&gt;
    130 </tt></pre>
    131 <p>With the <b>-t&nbsp;d</b> option, the format of the output shall be:</p>
    132 <pre>
    133 <tt>"%d %s", &lt;</tt><i>byte offset</i><tt>&gt;, &lt;</tt><i>string</i><tt>&gt;
    134 </tt></pre></blockquote>
    135 <h4 class="mansect"><a name="tag_20_114_11" id="tag_20_114_11"></a>STDERR</h4>
    136 <blockquote>
    137 <p>The standard error shall be used only for diagnostic messages.</p>
    138 </blockquote>
    139 <h4 class="mansect"><a name="tag_20_114_12" id="tag_20_114_12"></a>OUTPUT FILES</h4>
    140 <blockquote>
    141 <p>None.</p>
    142 </blockquote>
    143 <h4 class="mansect"><a name="tag_20_114_13" id="tag_20_114_13"></a>EXTENDED DESCRIPTION</h4>
    144 <blockquote>
    145 <p>None.</p>
    146 </blockquote>
    147 <h4 class="mansect"><a name="tag_20_114_14" id="tag_20_114_14"></a>EXIT STATUS</h4>
    148 <blockquote>
    149 <p>The following exit values shall be returned:</p>
    150 <dl compact>
    151 <dd></dd>
    152 <dt>&nbsp;0</dt>
    153 <dd>Successful completion.</dd>
    154 <dt>&gt;0</dt>
    155 <dd>An error occurred.</dd>
    156 </dl>
    157 </blockquote>
    158 <h4 class="mansect"><a name="tag_20_114_15" id="tag_20_114_15"></a>CONSEQUENCES OF ERRORS</h4>
    159 <blockquote>
    160 <p>Default.</p>
    161 </blockquote>
    162 <hr>
    163 <div class="box"><em>The following sections are informative.</em></div>
    164 <h4 class="mansect"><a name="tag_20_114_16" id="tag_20_114_16"></a>APPLICATION USAGE</h4>
    165 <blockquote>
    166 <p>By default the data area (as opposed to the text, &quot;bss&quot;, or header areas) of a binary executable file is scanned.
    167 Implementations document which areas are scanned.</p>
    168 <p>Some historical implementations do not require NUL or &lt;newline&gt; terminators for strings to permit those languages that do
    169 not use NUL as a string terminator to have their strings written.</p>
    170 </blockquote>
    171 <h4 class="mansect"><a name="tag_20_114_17" id="tag_20_114_17"></a>EXAMPLES</h4>
    172 <blockquote>
    173 <p>None.</p>
    174 </blockquote>
    175 <h4 class="mansect"><a name="tag_20_114_18" id="tag_20_114_18"></a>RATIONALE</h4>
    176 <blockquote>
    177 <p>Apart from rationalizing the option syntax and slight difficulties with object and executable binary files, <i>strings</i> is
    178 specified to match historical practice closely. The <b>-a</b> and <b>-n</b> options were introduced to replace the non-conforming
    179 <b>-</b> and <b>-</b><i>number</i> options. These options are no longer specified by POSIX.1-2024 but may be present in some
    180 implementations.</p>
    181 <p>The <b>-o</b> option historically means different things on different implementations. Some use it to mean &quot;<i>offset</i> in
    182 decimal&quot;, while others use it as &quot;<i>offset</i> in octal&quot;. Instead of trying to decide which way would be least objectionable,
    183 the <b>-t</b> option was added. It was originally named <b>-O</b> to mean &quot;offset&quot;, but was changed to <b>-t</b> to be consistent
    184 with <a href="../utilities/od.html"><i>od</i></a>.</p>
    185 <p>The ISO&nbsp;C standard function <a href="../functions/isprint.html"><i>isprint</i>()</a> is restricted to a domain of
    186 <b>unsigned char</b>. This volume of POSIX.1-2024 requires implementations to write strings as defined by the current locale.</p>
    187 </blockquote>
    188 <h4 class="mansect"><a name="tag_20_114_19" id="tag_20_114_19"></a>FUTURE DIRECTIONS</h4>
    189 <blockquote>
    190 <p>None.</p>
    191 </blockquote>
    192 <h4 class="mansect"><a name="tag_20_114_20" id="tag_20_114_20"></a>SEE ALSO</h4>
    193 <blockquote>
    194 <p><a href="../utilities/localedef.html#"><i>localedef</i></a> , <a href="../utilities/nm.html#"><i>nm</i></a></p>
    195 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
    196 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p>
    197 </blockquote>
    198 <h4 class="mansect"><a name="tag_20_114_21" id="tag_20_114_21"></a>CHANGE HISTORY</h4>
    199 <blockquote>
    200 <p>First released in Issue 4.</p>
    201 </blockquote>
    202 <h4 class="mansect"><a name="tag_20_114_22" id="tag_20_114_22"></a>Issue 6</h4>
    203 <blockquote>
    204 <p>This utility is marked as part of the User Portability Utilities option.</p>
    205 <p>The obsolescent SYNOPSIS is removed.</p>
    206 <p>The normative text is reworded to avoid use of the term &quot;must&quot; for application requirements.</p>
    207 </blockquote>
    208 <h4 class="mansect"><a name="tag_20_114_23" id="tag_20_114_23"></a>Issue 7</h4>
    209 <blockquote>
    210 <p>Austin Group Interpretation 1003.1-2001 #027 is applied, clarifying the behavior if the first argument is <tt>'-'</tt>.</p>
    211 <p>The <i>strings</i> utility is moved from the User Portability Utilities option to the Base. User Portability Utilities is now an
    212 option for interactive utilities.</p>
    213 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
    214 </blockquote>
    215 <h4 class="mansect"><a name="tag_20_114_24" id="tag_20_114_24"></a>Issue 8</h4>
    216 <blockquote>
    217 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p>
    218 <p>Austin Group Defect 1599 is applied, making the behavior unspecified when any argument is <tt>'-'</tt>.</p>
    219 </blockquote>
    220 <div class="box"><em>End of informative text.</em></div>
    221 <hr>
    222 <p>&nbsp;</p>
    223 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
    224 <hr size="2" noshade>
    225 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
    226 POSIX™ is a Trademark of The IEEE.<br>
    227 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
    228 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
    229 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
    230 ]</font></center>
    231 <hr size="2" noshade>
    232 <div class="NAVHEADER">
    233 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
    234 <tr class="nav">
    235 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/split.html" accesskey="P">&lt;&lt;&lt;
    236 Previous</a></td>
    237 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
    238 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/strip.html" accesskey="N">Next
    239 &gt;&gt;&gt;</a></td>
    240 </tr>
    241 </table>
    242 <hr align="left" width="100%"></div>
    243 </body>
    244 </html>