⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utilconv.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>Utility Conventions</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><blockquote><center><h2><a name = "tag_009">&nbsp;</a>Utility Conventions</h2></center><xref type="1" name="utilconv"></xref><h3><a name = "tag_009_001">&nbsp;</a>Utility Argument Syntax</h3><xref type="2" name="utilarg"></xref>This section describes the argument syntax of the standard utilitiesand introduces terminology used throughout this specification set fordescribing the arguments processed by the utilities.<p>Within this specification set, a special notation is used for describingthe syntax of a utility's arguments.Unless otherwise noted, all utility descriptions use this notation,which is illustrated by this example(see the <b>XCU</b> specification, <a href="../xcu/chap2.html#tag_001_009_001"><b>Simple Commands</b>&nbsp;</a>):<code><pre>utility_name<b>[</b>-a<b>][</b>-b<b>][</b>-c<i>option_argument</i><b>][</b>-d|-e<b>][</b>-f<i>option_argument</i><b>][</b><i>operand</i>...<b>]</b></code></pre><p>The notation used for the<b>SYNOPSIS</b>sections imposes requirements on the implementorsof the standard utilities and provides a simplereference for the application developer or system user.<ol><p><li>The utility in the example is named<i>utility_name</i>.It is followed by<i>options</i> , <i>option-arguments</i>and<i>operands</i> .The argumentsthat consist of hyphens and single letters or digits, such as<b>-a</b>,are known as<i>options</i>(or, historically,<i>flags</i>).Certain options are followed by an<i>option-argument</i>,as shown with<b>[-c</b>&nbsp;<i>option_argument</i><b>]</b>.The arguments following the last optionsand option-arguments are named<i>operands</i>.<p><li>Option-arguments are sometimes shown separatedfrom their options byblank characters,sometimes directly adjacent.This reflects the situation thatin some cases an option-argument is included withinthe same argument string as the option; in most cases it is the next argument.The Utility Syntax Guidelines in<xref href=usg><a href="#tag_009_002">Utility Syntax Guidelines</a></xref>require that the option be a separate argumentfrom its option-argument, but there are some exceptionsin this specification set to ensure continued operation of historical applications:<ol type = a><p><li>If the<b>SYNOPSIS</b>of a standard utility shows aspace characterbetween an option and option-argument(as with<b>[-c</b>&nbsp;<i>option_argument</i><b>]</b>in the example),a portable application must use separate argumentsfor that option and its option-argument.<p><li>If aspace characteris not shown(as with<b>[-f</b><i>option_argument</i><b>]</b>in the example),a portable application must place anoption and its option-argument directly adjacentin the same argument string,without interveningblank characters.<p><li>Notwithstanding the preceding requirements on portable applications, systems permit, but do not require,an application to specify options andoption-arguments as separate arguments whether or not aspace characteris shown on the synopsis line,except in those cases (marked with the <small>EX</small> portability warning)where an option-argument is optional and no separation can be used.<p><li>A standard utility may also be implemented tooperate correctly when the required separationinto multiple argumentsis violated by a non-portable application.<p></ol><p>In summary, the following table shows allowable combinations:<p><p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center>&nbsp;<th colspan=3 align=center><b>SYNOPSIS Shows:</b><tr valign=top><th align=center>&nbsp;<th align=center>-a <i>arg</i><th align=center>-b<i>arg</i><th align=center>-c<b>[</b><i>arg</i><b>]</b><tr valign=top><td align=right>Portable application must use:<td align=center>-a <i>arg</i><td align=center>-b<i>arg</i><td align=center>n/a<tr valign=top><td align=right>System will support:<td align=center>-a <i>arg</i><td align=center>-b<i>arg</i><td align=center>-c<i>arg</i> or -c<tr valign=top><td align=right>System may support:<td align=center>-a<i>arg</i><td align=center>-b <i>arg</i><td align=center>&nbsp;</table><p><li>Options are usually listed in alphabetical order unlessthis would make the utility description more confusing.There are no implied relationships between the optionsbased upon the order in which they appear, unless otherwisestated in the<b>OPTIONS</b>section,or unless the exception in<xref href=usg><a href="#tag_009_002">Utility Syntax Guidelines</a></xref>guideline 11 applies.If an option that does not have option-arguments is repeated,the results are undefined, unless otherwise stated.<p><li>Frequently, names of parameters that require substitutionby actual values are shown with embedded underscores.Alternatively, parameters are shown as follows:<dl compact><dt> <dd>&lt;<i>parameter name</i>&gt;</dl></pre><p>The angle brackets are used for the symbolic grouping ofa phrase representing a single parameterand must never be included in data submitted to the utility.<p><li>When a utility has only a few permissible options,they are sometimes shown individually, as in the example.Utilities with many flags generally show all of theindividual flags (that do not take option-arguments) grouped, as in:<pre><code>utility_name <b>[</b>-abcDxyz<b>][</b>-p <i>arg</i><b>][</b><i>operand</i><b>]</b></code></pre>Utilities with very complex arguments may be shown as follows:<pre><code>utility_name <b>[</b>options<b>][</b><i>operands</i><b>]</b></code></pre><p><li>Unless otherwise specified, whenever an operand oroption-argument is, or contains, a numeric value:<ul><p><li>The number is interpreted as a decimal integer.<p><li>Numerals in the range0 to 2147483647are syntactically recognised as numeric values.<p><li>When the utility description states that it acceptsnegative numbers as operands or option-arguments,numerals in the range-2147483647 to 2147483647are syntactically recognised as numeric values.<p><li>Ranges greater than those listed here are allowed.<p></ul><p>This does not mean that all numbers within the allowable rangeare necessarily semantically correct.A standard utility that accepts an option-argumentor operand that is to be interpreted as a number, and for whicha range of values smaller than that shown above is permitted bythe <b>XCU</b> specification, describes that smaller range along with the description of theoption-argument or operand.If an error is generated, the utility's diagnostic messagewill indicate that the value is out of thesupported range, not that it is syntactically incorrect.<p>For example, the specification of<i><a href="../xcu/dd.html">dd</a></i>obs=3000000000would yield undefined behaviour for the application and could bea syntax error because the number 3000000000 is outside ofthe range -2147483647 to +2147483647.On the other hand,<i><a href="../xcu/dd.html">dd</a></i>obs=2000000000may cause some error, such as &quot;blocksize too large&quot;,rather than a syntax error.<p><li>Arguments or option-arguments enclosed in the<b>[</b>and<b>]</b>notation are optional and can be omitted.The<b>[</b>and<b>]</b>symbols must never be included in data submitted to the utility.<p><li>Arguments separated by the<b>|</b>vertical bar notation are mutually exclusive.The<b>|</b>symbols must never be included in data submitted to the utility.Alternatively, mutually exclusive options and operands may belisted with multiplesynopsislines.For example:<pre><code>utility_name -d<b>[</b>-a<b>][</b>-c <i>option_argument</i><b>][</b><i>operand</i>...<b>]</b>utility_name<b>[</b>-a<b>][</b>-b<b>][</b><i>operand</i>...<b>]</b></code></pre><p>When multiple synopsis lines are given for a utility, it is anindication that the utility has mutually exclusive arguments.These mutually exclusive arguments alter the functionality of theutility so that only certain other arguments are valid incombination with one of the mutually exclusive arguments.Only one of the mutually exclusive arguments is allowed for invocationof the utility.Unless otherwisestated in an accompanying<b>OPTIONS</b>section, the relationships between

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -