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

📄 fmtmsg.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 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>fmtmsg</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="fmtmsg"></a> <a name="tag_03_174"></a><!-- fmtmsg --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_174_01"></a>NAME</h4><blockquote>fmtmsg - display a message in the specified format on standard error and/or a system console</blockquote><h4><a name="tag_03_174_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><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"> #include &lt;<a href="../basedefs/fmtmsg.h.html">fmtmsg.h</a>&gt;<br><br> int fmtmsg(long</tt> <i>classification</i><tt>, const char *</tt><i>label</i><tt>, int</tt> <i>severity</i><tt>,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const char *</tt><i>text</i><tt>, const char *</tt><i>action</i><tt>, const char*</tt><i>tag</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_174_03"></a>DESCRIPTION</h4><blockquote><p>The <i>fmtmsg</i>() function shall display messages in a specified format instead of the traditional <a href="../functions/printf.html"><i>printf</i>()</a> function.</p><p>Based on a message's classification component, <i>fmtmsg</i>() shall write a formatted message either to standard error, to theconsole, or to both.</p><p>A formatted message consists of up to five components as defined below. The component <i>classification</i> is not part of amessage displayed to the user, but defines the source of the message and directs the display of the formatted message.</p><dl compact><dt><i>classification</i></dt><dd>Contains the sum of identifying values constructed from the constants defined below. Any one identifier from a subclass may beused in combination with a single identifier from a different subclass. Two or more identifiers from the same subclass should notbe used together, with the exception of identifiers from the display subclass. (Both display subclass identifiers may be used sothat messages can be displayed to both standard error and the system console.) <dl compact><dt><b>Major Classifications</b></dt><dd><br>Identifies the source of the condition. Identifiers are: MM_HARD (hardware), MM_SOFT (software), and MM_FIRM (firmware).</dd><dt><b>Message Source Subclassifications</b></dt><dd><br>Identifies the type of software in which the problem is detected. Identifiers are: MM_APPL (application), MM_UTIL (utility), andMM_OPSYS (operating system).</dd><dt><b>Display Subclassifications</b></dt><dd><br>Indicates where the message is to be displayed. Identifiers are: MM_PRINT to display the message on the standard error stream,MM_CONSOLE to display the message on the system console. One or both identifiers may be used.</dd><dt><b>Status Subclassifications</b></dt><dd><br>Indicates whether the application can recover from the condition. Identifiers are: MM_RECOVER (recoverable) and MM_NRECOV(non-recoverable).</dd></dl><p>An additional identifier, MM_NULLMC, indicates that no classification component is supplied for the message.</p></dd><dt><i>label</i></dt><dd>Identifies the source of the message. The format is two fields separated by a colon. The first field is up to 10 bytes, thesecond is up to 14 bytes.</dd><dt><i>severity</i></dt><dd>Indicates the seriousness of the condition. Identifiers for the levels of <i>severity</i> are: <dl compact><dt>MM_HALT</dt><dd>Indicates that the application has encountered a severe fault and is halting. Produces the string <tt>"HALT"</tt> .</dd><dt>MM_ERROR</dt><dd>Indicates that the application has detected a fault. Produces the string <tt>"ERROR"</tt> .</dd><dt>MM_WARNING</dt><dd>Indicates a condition that is out of the ordinary, that might be a problem, and should be watched. Produces the string<tt>"WARNING"</tt> .</dd><dt>MM_INFO</dt><dd>Provides information about a condition that is not in error. Produces the string <tt>"INFO"</tt> .</dd><dt>MM_NOSEV</dt><dd>Indicates that no severity level is supplied for the message.</dd></dl></dd><dt><i>text</i></dt><dd>Describes the error condition that produced the message. The character string is not limited to a specific size. If thecharacter string is empty, then the text produced is unspecified.</dd><dt><i>action</i></dt><dd>Describes the first step to be taken in the error-recovery process. The <i>fmtmsg</i>() function precedes the action stringwith the prefix: <tt>"TO FIX:"</tt> . The <i>action</i> string is not limited to a specific size.</dd><dt><i>tag</i></dt><dd>An identifier that references on-line documentation for the message. Suggested usage is that <i>tag</i> includes the<i>label</i> and a unique identifying number. A sample <i>tag</i> is <tt>"XSI:cat:146"</tt> .</dd></dl><p>The <i>MSGVERB</i> environment variable (for message verbosity) shall determine for <i>fmtmsg</i>() which message components itis to select when writing messages to standard error. The value of <i>MSGVERB</i> shall be a colon-separated list of optionalkeywords. Valid keywords are: <i>label</i>, <i>severity</i>, <i>text</i>, <i>action</i>, and <i>tag</i>. If <i>MSGVERB</i> containsa keyword for a component and the component's value is not the component's null value, <i>fmtmsg</i>() shall include that componentin the message when writing the message to standard error. If <i>MSGVERB</i> does not include a keyword for a message component,that component shall not be included in the display of the message. The keywords may appear in any order. If <i>MSGVERB</i> is notdefined, if its value is the null string, if its value is not of the correct format, or if it contains keywords other than thevalid ones listed above, <i>fmtmsg</i>() shall select all components.</p><p><i>MSGVERB</i> shall determine which components are selected for display to standard error. All message components shall beincluded in console messages.</p></blockquote><h4><a name="tag_03_174_04"></a>RETURN VALUE</h4><blockquote><p>The <i>fmtmsg</i>() function shall return one of the following values:</p><dl compact><dt>MM_OK</dt><dd>The function succeeded.</dd><dt>MM_NOTOK</dt><dd>The function failed completely.</dd><dt>MM_NOMSG</dt><dd>The function was unable to generate a message on standard error, but otherwise succeeded.</dd><dt>MM_NOCON</dt><dd>The function was unable to generate a console message, but otherwise succeeded.</dd></dl></blockquote><h4><a name="tag_03_174_05"></a>ERRORS</h4><blockquote><p>None.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_174_06"></a>EXAMPLES</h4><blockquote><ol><li><p>The following example of <i>fmtmsg</i>():</p><pre><tt>fmtmsg(MM_PRINT, "XSI:cat", MM_ERROR, "illegal option","refer to cat in user's reference manual", "XSI:cat:001")</tt></pre><p>produces a complete message in the specified message format:</p><pre><tt>XSI:cat: ERROR: illegal optionTO FIX: refer to cat in user's reference manual XSI:cat:001</tt></pre></li><li><p>When the environment variable <i>MSGVERB</i> is set as follows:</p><pre><tt>MSGVERB=severity:text:action</tt></pre><p>and Example 1 is used, <i>fmtmsg</i>() produces:</p><pre><tt>ERROR: illegal optionTO FIX: refer to cat in user's reference manual</tt></pre></li></ol></blockquote><h4><a name="tag_03_174_07"></a>APPLICATION USAGE</h4><blockquote><p>One or more message components may be systematically omitted from messages generated by an application by using the null valueof the argument for that component.</p></blockquote><h4><a name="tag_03_174_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_174_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_174_10"></a>SEE ALSO</h4><blockquote><p><a href="printf.html"><i>printf</i>()</a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/fmtmsg.h.html"><i>&lt;fmtmsg.h&gt;</i></a></p></blockquote><h4><a name="tag_03_174_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4, Version 2.</p></blockquote><h4><a name="tag_03_174_12"></a>Issue 5</h4><blockquote><p>Moved from X/OPEN UNIX extension to BASE.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; 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>

⌨️ 快捷键说明

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