United States-English |
|
|
HP-UX Reference > Ppfmt(3C)HP-UX 11i Version 3: February 2007 |
|
NAMEpfmt(), vpfmt() — display message in standard format SYNOPSIS#include <pfmt.h> int pfmt(FILE *stream, long flags, char *fmt, /* [arg, ] */ ...); #include <stdarg.h> #include <pfmt.h> int vpfmt(FILE *stream, long flags, char *fmt, va_list ap); DESCRIPTIONThe pfmt() system call can be used to write a message in standard format to stream. It can also be used to write a localized string to stream. The arguments to pfmt() are formatted using printf() style formatting. vpfmt() is similar to pfmt() except that the arguments are passed in an argument list (see stdarg(5)). The standard format displayed on stream has the following fields: label:severity:text The label string is defined through setlabel(3C). If no label is defined, this field is not used. The severity string is controlled by the severity group of flags. The text string is the formatted user string. The flags control how formatting is done. The control information is separated into several different groups. Only one flag from each group should be set.
The fmt string has the following fields: catalog:msg_number:def_str The catalog is the message catalog created by mkmsgs(1) where the localized message is to be retrieved. The msg_number is a positive index number identifying the string to be retrieved from the message catalog (begins at 1). The def_str is the default string to use if pfmt() fails to retrieve the message from catalog from either the current locale or the default locale. The failure may occur if the message catalog does not exist or if the msg_number is out of bound. If catalog is not specified, pfmt() uses the message catalog defined by setcat(3C). If MM_NOGET is set in flags, only def_str must be specified. The pfmt() system call displays Message not found!! under the following conditions:
RETURN VALUEIf successful, pfmt() and vpfmt() return the number of bytes written. Otherwise, they return a negative value. EXAMPLESExample 1setlabel("UX:my_appl"); pfmt(stderr, MM_INFO,"MY_cat:1:file is writable"); generates the message: UX:my_appl: INFO: file is writable Example 2setlabel(""); setcat("MY_cat"); pfmt(stderr, MM_ERROR,":1:%s is writable", "my_file"); generates the message: ERROR: my_file is writable SEE ALSOmkmsgs(1), addsev(3C), gettxt(3C), printf(3S), setcat(3C), setlabel(3C), setlocale(3C), stdarg(5), thread_safety(5). |
Printable version | ||
|