pfmt(1) pfmt(1)
NAME
pfmt - display error message in standard format
SYNOPSIS
pfmt [-l label] [-s severity] [-g catalog:msgid] format [args]
DESCRIPTION
pfmt uses format for printf style formatting of args. If the -g option
is specified, pfmt retrieves a localized version of the format string
from a locale-specific message database. The output is displayed on
standard error (stderr).
pfmt encapsulates the output in the standard error message format. The
-l label option specifies the label string to be displayed with the
message (e.g. "UX:cat").
label is a character string no more than 25 characters in length; it
will be automatically suffixed with a colon (:). When unspecified, no
label is displayed as part of the message.
The environment variable LCALLLABELS is used to determine if labels
will be added to the text of the messages. The value of LCALLLABELS
is consulted during the formation of the first message. Labels will be
added (or not added) to all subsequent messages in the same way.
Changing or setting LCALLLABELS after the first message will have no
effect message formation within the same execution.
If LCALLLABELS is set to the value 1, the label string will be
included with the message. If LCALLLABELS does not exist, or is
empty, or is set to 0, only the text of the message is displayed. Any
other values of LCALLLABELS will produce undefined results.
For example, consider the following message produced when
LCALLLABELS is set to 1:
UX:cat: ERROR: Cannot open door: No such file or directory
If LCALLLABELS had not existed, or was empty, or had been set to 0,
the above message would have been:
cat: Cannot open door: No such file or directory
The -s severity option specifies the severity string to be displayed
with the message. Acceptable strings include the standard severities
in either their print string (i.e. HALT, ERROR, INFO, WARNING, and "TO
FIX") or keyword (i.e. halt, error, info, warn, and action) forms, or
any other user-defined string. A user-defined string will be assigned
the integer severity value of 5. The severity will be suffixed with a
colon (:). The ERROR severity will be used if no severity is speci-
fied.
Page 1 Reliant UNIX 5.44 Printed 11/98
pfmt(1) pfmt(1)
The -g catalog:msgnum option specifies that a localized version of the
format should be retrieved from a message database.
catalog is used to indicate the message database that contains the
localized version of the format string. catalog must be limited to 14
characters. These characters must be selected from a set of all char-
acters values, excluding \0 (null) and the ASCII codes for / (slash)
and : (colon).
msgnum is a positive number that indicates the index of the string in
the message database.
If the catalog does not exist in the current locale (identified by the
LCMESSAGES or LANG environment variables), or if the message number
is out of bounds, pfmt will attempt to retrieve the message from the C
locale. If this second retrieval fails, pfmt uses the format string as
passed on the command line.
pfmt will output Message not found!!\n as the format string if catalog
is not a valid catalog name, or if msgnum is not a valid number.
STANDARD ERROR MESSAGE FORMAT
pfmt displays error messages in the following format:
label: severity: text
If no label is defined using the -l label option, the message is
displayed in the format:
severity: text
If pfmt is called twice to display an error message and a helpful
action or recovery message, the output can look like:
label: severity: text
label: TO FIX: text
EXIT STATUS
Upon success, pfmt exits with code 0. Upon failure, pfmt exits with
the following codes:
1 write error.
3 syntax error.
Page 2 Reliant UNIX 5.44 Printed 11/98
pfmt(1) pfmt(1)
EXAMPLE
pfmt -l UX:test -s error "Syntax error\n"
displays the message:
UX:test: ERROR: Syntax error
SEE ALSO
fmtmsg(1), gettxt(1), lfmt(1), printf(1), environ(5).
Page 3 Reliant UNIX 5.44 Printed 11/98