logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

fmtmsg.3p (7683B)


  1. '\" et
  2. .TH FMTMSG "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. fmtmsg
  12. \(em display a message in the specified format on standard
  13. error and/or a system console
  14. .SH SYNOPSIS
  15. .LP
  16. .nf
  17. #include <fmtmsg.h>
  18. .P
  19. int fmtmsg(long \fIclassification\fP, const char *\fIlabel\fP, int \fIseverity\fP,
  20. const char *\fItext\fP, const char *\fIaction\fP, const char *\fItag\fP);
  21. .fi
  22. .SH DESCRIPTION
  23. The
  24. \fIfmtmsg\fR()
  25. function shall display messages in a specified format instead
  26. of the traditional
  27. \fIprintf\fR()
  28. function.
  29. .P
  30. Based on a message's classification component,
  31. \fIfmtmsg\fR()
  32. shall write a formatted message either to standard error, to the
  33. console, or to both.
  34. .P
  35. A formatted message consists of up to five components as defined
  36. below. The component \fIclassification\fR is not part of a message
  37. displayed to the user, but defines the source of the message and
  38. directs the display of the formatted message.
  39. .IP "\fIclassification\fP" 12
  40. Contains the sum of identifying values constructed from the constants
  41. defined below. Any one identifier from a subclass may be used in
  42. combination with a single identifier from a different subclass. Two or
  43. more identifiers from the same subclass should not be used together,
  44. with the exception of identifiers from the display subclass. (Both
  45. display subclass identifiers may be used so that messages can be
  46. displayed to both standard error and the system console.)
  47. .RS 12
  48. .IP "\fBMajor Classifications\fP" 6
  49. .br
  50. Identifies the source of the condition. Identifiers are: MM_HARD
  51. (hardware), MM_SOFT (software), and MM_FIRM (firmware).
  52. .IP "\fBMessage Source Subclassifications\fP" 6
  53. .br
  54. Identifies the type of software in which the problem is detected.
  55. Identifiers are: MM_APPL (application), MM_UTIL (utility), and MM_OPSYS
  56. (operating system).
  57. .IP "\fBDisplay Subclassifications\fP" 6
  58. .br
  59. Indicates where the message is to be displayed. Identifiers are:
  60. MM_PRINT to display the message on the standard error stream,
  61. MM_CONSOLE to display the message on the system console. One or both
  62. identifiers may be used.
  63. .IP "\fBStatus Subclassifications\fP" 6
  64. .br
  65. Indicates whether the application can recover from the condition.
  66. Identifiers are: MM_RECOVER (recoverable) and MM_NRECOV
  67. (non-recoverable).
  68. .P
  69. An additional identifier, MM_NULLMC, indicates that no classification
  70. component is supplied for the message.
  71. .RE
  72. .IP "\fIlabel\fP" 12
  73. Identifies the source of the message. The format is two fields
  74. separated by a
  75. <colon>.
  76. The first field is up to 10 bytes, the second is up to 14 bytes.
  77. .IP "\fIseverity\fP" 12
  78. Indicates the seriousness of the condition. Identifiers for the levels
  79. of \fIseverity\fR are:
  80. .RS 12
  81. .IP MM_HALT 12
  82. Indicates that the application has encountered a severe fault and is
  83. halting. Produces the string
  84. .BR \(dqHALT\(dq .
  85. .IP MM_ERROR 12
  86. Indicates that the application has detected a fault. Produces the
  87. string
  88. .BR \(dqERROR\(dq .
  89. .IP MM_WARNING 12
  90. Indicates a condition that is out of the ordinary, that might be a
  91. problem, and should be watched. Produces the string
  92. .BR \(dqWARNING\(dq .
  93. .IP MM_INFO 12
  94. Provides information about a condition that is not in error. Produces
  95. the string
  96. .BR \(dqINFO\(dq .
  97. .IP MM_NOSEV 12
  98. Indicates that no severity level is supplied for the message.
  99. .RE
  100. .IP "\fItext\fP" 12
  101. Describes the error condition that produced the message. The character
  102. string is not limited to a specific size. If the character string is
  103. empty, then the text produced is unspecified.
  104. .IP "\fIaction\fP" 12
  105. Describes the first step to be taken in the error-recovery process.
  106. The
  107. \fIfmtmsg\fR()
  108. function precedes the action string with the prefix:
  109. .BR \(dqTO FIX:\(dq .
  110. The \fIaction\fR string is not limited to a specific size.
  111. .IP "\fItag\fP" 12
  112. An identifier that references on-line documentation for the message.
  113. Suggested usage is that \fItag\fR includes the \fIlabel\fR and a unique
  114. identifying number. A sample \fItag\fR is
  115. .BR \(dqXSI:cat:146\(dq .
  116. .P
  117. The
  118. .IR MSGVERB
  119. environment variable (for message verbosity) shall determine for
  120. \fIfmtmsg\fR()
  121. which message components it is to select when writing messages to
  122. standard error. The value of
  123. .IR MSGVERB
  124. shall be a
  125. <colon>-separated
  126. list of optional keywords. Valid keywords are: \fIlabel\fR,
  127. \fIseverity\fR, \fItext\fR, \fIaction\fR, and \fItag\fR. If
  128. .IR MSGVERB
  129. contains a keyword for a component and the component's value is not the
  130. component's null value,
  131. \fIfmtmsg\fR()
  132. shall include that component in the message when writing the message to
  133. standard error. If
  134. .IR MSGVERB
  135. does not include a keyword for a message component, that component
  136. shall not be included in the display of the message. The keywords may
  137. appear in any order. If
  138. .IR MSGVERB
  139. is not defined, if its value is the null string, if its value is not of
  140. the correct format, or if it contains keywords other than the valid
  141. ones listed above,
  142. \fIfmtmsg\fR()
  143. shall select all components.
  144. .P
  145. .IR MSGVERB
  146. shall determine which components are selected for display to standard
  147. error. All message components shall be included in console messages.
  148. .SH "RETURN VALUE"
  149. The
  150. \fIfmtmsg\fR()
  151. function shall return one of the following values:
  152. .IP MM_OK 12
  153. The function succeeded.
  154. .IP MM_NOTOK 12
  155. The function failed completely.
  156. .IP MM_NOMSG 12
  157. The function was unable to generate a message on standard error,
  158. but otherwise succeeded.
  159. .IP MM_NOCON 12
  160. The function was unable to generate a console message, but otherwise
  161. succeeded.
  162. .SH ERRORS
  163. None.
  164. .LP
  165. .IR "The following sections are informative."
  166. .SH EXAMPLES
  167. .IP " 1." 4
  168. The following example of
  169. \fIfmtmsg\fR():
  170. .RS 4
  171. .sp
  172. .RS 4
  173. .nf
  174. fmtmsg(MM_PRINT, "XSI:cat", MM_ERROR, "illegal option",
  175. "refer to cat in user\(aqs reference manual", "XSI:cat:001")
  176. .fi
  177. .P
  178. .RE
  179. .P
  180. produces a complete message in the specified message format:
  181. .sp
  182. .RS 4
  183. .nf
  184. XSI:cat: ERROR: illegal option
  185. TO FIX: refer to cat in user\(aqs reference manual XSI:cat:001
  186. .fi
  187. .P
  188. .RE
  189. .RE
  190. .IP " 2." 4
  191. When the environment variable
  192. .IR MSGVERB
  193. is set as follows:
  194. .RS 4
  195. .sp
  196. .RS 4
  197. .nf
  198. MSGVERB=severity:text:action
  199. .fi
  200. .P
  201. .RE
  202. .P
  203. and Example 1 is used,
  204. \fIfmtmsg\fR()
  205. produces:
  206. .sp
  207. .RS 4
  208. .nf
  209. ERROR: illegal option
  210. TO FIX: refer to cat in user\(aqs reference manual
  211. .fi
  212. .P
  213. .RE
  214. .RE
  215. .SH "APPLICATION USAGE"
  216. One or more message components may be systematically omitted from
  217. messages generated by an application by using the null value of the
  218. argument for that component.
  219. .SH RATIONALE
  220. None.
  221. .SH "FUTURE DIRECTIONS"
  222. None.
  223. .SH "SEE ALSO"
  224. .IR "\fIfprintf\fR\^(\|)"
  225. .P
  226. The Base Definitions volume of POSIX.1\(hy2017,
  227. .IR "\fB<fmtmsg.h>\fP"
  228. .\"
  229. .SH COPYRIGHT
  230. Portions of this text are reprinted and reproduced in electronic form
  231. from IEEE Std 1003.1-2017, Standard for Information Technology
  232. -- Portable Operating System Interface (POSIX), The Open Group Base
  233. Specifications Issue 7, 2018 Edition,
  234. Copyright (C) 2018 by the Institute of
  235. Electrical and Electronics Engineers, Inc and The Open Group.
  236. In the event of any discrepancy between this version and the original IEEE and
  237. The Open Group Standard, the original IEEE and The Open Group Standard
  238. is the referee document. The original Standard can be obtained online at
  239. http://www.opengroup.org/unix/online.html .
  240. .PP
  241. Any typographical or formatting errors that appear
  242. in this page are most likely
  243. to have been introduced during the conversion of the source files to
  244. man page format. To report such errors, see
  245. https://www.kernel.org/doc/man-pages/reporting_bugs.html .