{"id":5272,"date":"2022-12-20T18:37:15","date_gmt":"2022-12-20T21:37:15","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/fmtmsg-man3p\/"},"modified":"2022-12-20T18:37:15","modified_gmt":"2022-12-20T21:37:15","slug":"fmtmsg-man3p","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/fmtmsg-man3p\/","title":{"rendered":"FMTMSG (man3p)"},"content":{"rendered":"<h1 align=\"center\">FMTMSG<\/h1>\n<p> <a href=\"#PROLOG\">PROLOG<\/a><br \/> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#ERRORS\">ERRORS<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#APPLICATION USAGE\">APPLICATION USAGE<\/a><br \/> <a href=\"#RATIONALE\">RATIONALE<\/a><br \/> <a href=\"#FUTURE DIRECTIONS\">FUTURE DIRECTIONS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a> <\/p>\n<hr>\n<h2>PROLOG <a name=\"PROLOG\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This manual page is part of the POSIX Programmer\u2019s Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">fmtmsg \u2014 display a message in the specified format on standard error and\/or a system console<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">#include <fmtmsg.h><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">int fmtmsg(long <i>classification<\/i>, const char *<i>label<\/i>, int <i>severity<\/i>, <br \/> const char *<i>text<\/i>, const char *<i>action<\/i>, const char *<i>tag<\/i>);<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>fmtmsg<\/i>() function shall display messages in a specified format instead of the traditional <i>printf<\/i>() function.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Based on a message\u2019s classification component, <i>fmtmsg<\/i>() shall write a formatted message either to standard error, to the console, or to both.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">A formatted message consists of up to five components as defined below. The component <i>classification<\/i> is not part of a message displayed to the user, but defines the source of the message and directs the display of the formatted message. <i><br \/> classification<\/i><\/p>\n<p style=\"margin-left:29%;\">Contains the sum of identifying values constructed from the constants defined below. Any one identifier from a subclass may be used in combination with a single identifier from a different subclass. Two or more identifiers from the same subclass should not be used together, with the exception of identifiers from the display subclass. (Both display subclass identifiers may be used so that messages can be displayed to both standard error and the system console.) <b><br \/> Major Classifications<\/b><\/p>\n<p style=\"margin-left:38%;\">Identifies the source of the condition. Identifiers are: MM_HARD (hardware), MM_SOFT (software), and MM_FIRM (firmware).<\/p>\n<p style=\"margin-left:29%;\"><b>Message Source Subclassifications<\/b><\/p>\n<p style=\"margin-left:38%;\">Identifies the type of software in which the problem is detected. Identifiers are: MM_APPL (application), MM_UTIL (utility), and MM_OPSYS (operating system).<\/p>\n<p style=\"margin-left:29%;\"><b>Display Subclassifications<\/b><\/p>\n<p style=\"margin-left:38%;\">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.<\/p>\n<p style=\"margin-left:29%;\"><b>Status Subclassifications<\/b><\/p>\n<p style=\"margin-left:38%;\">Indicates whether the application can recover from the condition. Identifiers are: MM_RECOVER (recoverable) and MM_NRECOV (non-recoverable).<\/p>\n<p style=\"margin-left:29%; margin-top: 1em\">An additional identifier, MM_NULLMC, indicates that no classification component is supplied for the message.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p><i>label<\/i><\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"71%\">\n<p>Identifies the source of the message. The format is two fields separated by a <colon>. The first field is up to 10 bytes, the second is up to 14 bytes.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p><i>severity<\/i><\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"71%\">\n<p>Indicates the seriousness of the condition. Identifiers for the levels of <i>severity<\/i> are:<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:29%;\">MM_HALT<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\"><\/td>\n<td width=\"3%\"><\/td>\n<td width=\"52%\">\n<p style=\"margin-top: 1em\">Indicates that the application has encountered a severe fault and is halting. Produces the string <b>&#8220;HALT&#8221;<\/b>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\">\n<p>MM_ERROR<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"52%\">\n<p>Indicates that the application has detected a fault. Produces the string <b>&#8220;ERROR&#8221;<\/b>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\">\n<p>MM_WARNING<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"52%\">\n<p>Indicates a condition that is out of the ordinary, that might be a problem, and should be watched. Produces the string <b>&#8220;WARNING&#8221;<\/b>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\">\n<p>MM_INFO<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"52%\">\n<p>Provides information about a condition that is not in error. Produces the string <b>&#8220;INFO&#8221;<\/b>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\">\n<p>MM_NOSEV<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"52%\">\n<p>Indicates that no severity level is supplied for the message.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\">\n<p><i>text<\/i><\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"52%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:29%; margin-top: 1em\">Describes the error condition that produced the message. The character string is not limited to a specific size. If the character string is empty, then the text produced is unspecified.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p style=\"margin-top: 1em\"><i>action<\/i><\/p>\n<\/td>\n<td width=\"9%\"><\/td>\n<td width=\"71%\">\n<p style=\"margin-top: 1em\">Describes the first step to be taken in the error-recovery process. The <i>fmtmsg<\/i>() function precedes the action string with the prefix: <b>&#8220;TO<\/b>FIX:&#8221;<b>.<\/b> The <i>action<\/i> string is not limited to a specific size.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><i>tag<\/i><\/p>\n<\/td>\n<td width=\"9%\"><\/td>\n<td width=\"71%\">\n<p>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 <b>&#8220;XSI:cat:146&#8221;<\/b>.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>MSGVERB<\/i> environment variable (for message verbosity) shall determine for <i>fmtmsg<\/i>() which message components it is to select when writing messages to standard error. The value of <i>MSGVERB<\/i> shall be a <colon>-separated list of optional keywords. Valid keywords are: <i>label<\/i>, <i>severity<\/i>, <i>text<\/i>, <i>action<\/i>, and <i>tag<\/i>. If <i>MSGVERB<\/i> contains a keyword for a component and the component\u2019s value is not the component\u2019s null value, <i>fmtmsg<\/i>() shall include that component in 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 not defined, if its value is the null string, if its value is not of the correct format, or if it contains keywords other than the valid ones listed above, <i>fmtmsg<\/i>() shall select all components.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>MSGVERB<\/i> shall determine which components are selected for display to standard error. All message components shall be included in console messages.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>fmtmsg<\/i>() function shall return one of the following values:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p style=\"margin-top: 1em\">MM_OK<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"71%\">\n<p style=\"margin-top: 1em\">The function succeeded.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p>MM_NOTOK<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"71%\">\n<p>The function failed completely.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p>MM_NOMSG<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"71%\">\n<p>The function was unable to generate a message on standard error, but otherwise succeeded.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p>MM_NOCON<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"71%\">\n<p>The function was unable to generate a console message, but otherwise succeeded.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>ERRORS <a name=\"ERRORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>The following sections are informative.<\/i><\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\">1.<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"52%\">\n<p style=\"margin-top: 1em\">The following example of <i>fmtmsg<\/i>():<\/p>\n<\/td>\n<td width=\"31%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:23%; margin-top: 1em\">fmtmsg(MM_PRINT, &#8220;XSI:cat&#8221;, MM_ERROR, &#8220;illegal option&#8221;, <br \/> &#8220;refer to cat in user&#8217;s reference manual&#8221;, &#8220;XSI:cat:001&#8221;)<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">produces a complete message in the specified message format:<\/p>\n<p style=\"margin-left:23%; margin-top: 1em\">XSI:cat: ERROR: illegal option <br \/> TO FIX: refer to cat in user&#8217;s reference manual XSI:cat:001<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\">2.<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">When the environment variable <i>MSGVERB<\/i> is set as follows:<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:23%; margin-top: 1em\">MSGVERB=severity:text:action<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">and Example 1 is used, <i>fmtmsg<\/i>() produces:<\/p>\n<p style=\"margin-left:23%; margin-top: 1em\">ERROR: illegal option <br \/> TO FIX: refer to cat in user&#8217;s reference manual<\/p>\n<h2>APPLICATION USAGE <a name=\"APPLICATION USAGE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">One or more message components may be systematically omitted from messages generated by an application by using the null value of the argument for that component.<\/p>\n<h2>RATIONALE <a name=\"RATIONALE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>FUTURE DIRECTIONS <a name=\"FUTURE DIRECTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>fprintf<\/i>()<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The Base Definitions volume of POSIX.1-2017, <b><fmtmsg.h><\/b><\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology &#8212; Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http:\/\/www.opengroup.org\/unix\/online.html .<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https:\/\/www.kernel.org\/doc\/man-pages\/reporting_bugs.html .<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  fmtmsg \u2014 display a message in the specified format on standard error and\/or a system console <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3779,1],"tags":[2161,1594],"class_list":["post-5272","post","type-post","status-publish","format-standard","hentry","category-3pm-perl-llamadas-de-bibliotecas","category-sin-categoria","tag-fmtmsg","tag-man3p"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/5272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=5272"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/5272\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=5272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=5272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=5272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}