Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

addseverity(3C)

fmtmsg(3C)

fmtmsg(1)                                                         fmtmsg(1)

NAME
     fmtmsg - display formatted messages

SYNOPSIS
     fmtmsg [option ...] messagetext

DESCRIPTION
     fmtmsg writes formatted messages to standard error (stderr) or to the
     system console.

     A formatted message consists of up to five standard components. The
     classification and subclass components are not displayed as part of
     the standard message, but they define the cause and source of the mes-
     sage and direct the output of the formatted message.

OPTIONS
     No option specified:
          fmtmsg prints a list of valid options.

     -c class
          Describes the source of the message. class can be any of the fol-
          lowing keywords:

          hard    The source of the condition is hardware.

          soft    The source of the condition is software.

          firm    The source of the condition is firmware.

     -u subclass
          subclass is a list of keywords that further define the message
          and direct the output of the message. The individual keywords
          must be delimited by commas.

          Valid keywords for subclass are:

          appl    The condition originated in an application. Not to be
                  used in combination with util or opsys.

          util    The condition originated in a utility. Not to be used in
                  combination with appl or opsys.

          opsys   The message originated in the kernel. Not to be used in
                  combination with appl or util.

          recov   The application will recover from the condition. Not to
                  be used in combination with nrecov.

          nrecov  The application will not recover from the condition. Not
                  to be used in combination with recov.

          print   Write the message to standard error.



Page 1                       Reliant UNIX 5.44                Printed 11/98

fmtmsg(1)                                                         fmtmsg(1)

          console Write the message to the system console.

          print and console may also be specified together.

     -l label
          (label) Identifies the source of the message.

     -s severity
          Indicates the seriousness of the error. The keywords and defini-
          tions of the standard severity levels are:

          halt    The application has encountered a severe error and is
                  halting.

          error   The application has detected an error.

          warn    The application has detected a condition that is out of
                  the ordinary and might be a problem.

          info    The application is providing information about a condi-
                  tion that is not an error.

     -t tag
          A string containing an identifier for the message.

     -a action
          A string describing the first step in the error recovery process.
          This string must be written so that the entire action argument is
          interpreted as a single argument. fmtmsg precedes each action
          string with the TO FIX: prefix.

     messagetext
          The text of the message. This must be written so that the entire
          argument is interpreted as a single argument.

ENVIRONMENT VARIABLES
     MSGVERB
          MSGVERB is set by the system administrator in the /etc/profile
          for the system. Users can override the set value by assigning a
          new value to MSGVERB in their own .profile files.

          MSGVERB tells fmtmsg which message components to select when
          writing to stderr. The value of MSGVERB is a colon-separated list
          of optional keywords. MSGVERB can be set as follows:

          MSGVERB=[keyword[:keyword[:...]]]

          export MSGVERB






Page 2                       Reliant UNIX 5.44                Printed 11/98

fmtmsg(1)                                                         fmtmsg(1)

          The valid keywords are: label, severity, text, action, and tag.
          The keywords may appear in any order. If MSGVERB contains a key-
          word for a component and if the argument specified for the com-
          ponent in the fmtmsg call is not a null string, fmtmsg will
          include that component in the message when writing the message to
          stderr. If MSGVERB does not contain a keyword for a message com-
          ponent, that component will not appear in the displayed message.

          If MSGVERB is not defined, if its value is the null string, if
          its value is not of the correct format, or if it contains illegal
          keywords, fmtmsg selects all components.

          MSGVERB is only evaluated for messages that are to be written to
          stderr. All message components are included in console messages.

     SEVLEVEL
          This variable can be used in shell scripts.

          SEVLEVEL defines additional severity levels for use by fmtmsg.
          The standard severity levels shown below cannot be modified. The
          predefined levels are:

          0  (no severity is used)

          1  HALT

          2  ERROR

          3  WARNING

          4  INFO

          SEVLEVEL is set as follows:

          SEVLEVEL=[description[:description[:...]]]

          export SEVLEVEL

          description is a comma-separated list containing three fields:

          description=severitykeyword,level,printstring

          severitykeyword can be used with the -s option. level is a
          string that evaluates to a positive integer which is passed on to
          fmtmsg if severitykeyword is used. The values 0, 1, 2, 3 and 4
          are reserved for the standard severity levels and cannot be used.

          printstring is the character string printed by fmtmsg whenever
          the severity value level is used.





Page 3                       Reliant UNIX 5.44                Printed 11/98

fmtmsg(1)                                                         fmtmsg(1)

          If SEVLEVEL is not defined, or if its value is null, no severity
          levels other than the defaults are available. If the colon-
          separated list defining the variable contains syntax errors, the
          invalid part is ignored.

EXIT STATUS
     0   All functions were executed successfully.

     1   The command contains a syntax error, an invalid option, or an
         invalid argument to an option.

     2   The function executed with partial success, but the message was
         not displayed on standard error.

     4   The function executed with partial success, but the message was
         not displayed on the system console.

     32  None of the requested functions were executed successfully.

LOCALE
     The LCMESSAGES environment variable governs the language in which
     message texts are displayed. If LCMESSAGES is undefined or is defined
     as the null string, it defaults to the value of LANG. If LANG is like-
     wise undefined or null, the system acts as if it were not internation-
     alized.

     The LCALL environment variable governs the entire locale. LCALL
     takes precedence over all the other environment variables which affect
     internationalization.

EXAMPLES
     The purpose of the following shell script is to make the command ls -l
     available under the abbreviated name ll. In this case, however,
     instead of using the standard error messages of the ls command, these
     messages are intercepted by the addition of 2>/dev/null. Errors that
     occur are detected from the return code $? of the command, and a
     user-defined error message is generated with fmtmsg when required.

     $ cat ll
     ls -l $* 2>/dev/null
     case $? in
          0) echo "That was a listing of directory `pwd`/$*";;
          *) fmtmsg -u print -l "ll" -s error -t "(DIR may be invalid)" -a \
          "Try using another directory" "An error has occurred!"
     esac

     $ ll junkmail
     ll: ERROR: An error has occurred!
        TO FIX: Try using another directory  (directory may be invalid)





Page 4                       Reliant UNIX 5.44                Printed 11/98

fmtmsg(1)                                                         fmtmsg(1)

     $ ll junk
     total 4
     -rw-------   1 cmd      cmdag        690 Mar 18 14:00 file.Z
     -rw-r--r--   1 cmd      cmdag         63 Mar 13 09:29 initvalues
     That was a listing of directory /home/cmds/john/junk

SEE ALSO
     addseverity(3C), fmtmsg(3C).














































Page 5                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026