Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > P

pfmt(3C)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

pfmt(), 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);

DESCRIPTION

The 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.

Output Format
MM_NOSTD

Do not use the standard format. Treat fmt as a printf() format string. In this mode, only flags related to catalog access can be set.

MM_STD

Format using the standard format (MM_STD is the default).

Catalog Access
MM_NOGET

Do not access the localized message catalog. Use the def_str (a field in fmt) as the format string.

MM_GET

Access the localized message catalog (MM_GET is the default).

Severity
MM_HALT

Display a localized HALT string.

MM_ERROR

Display a localized ERROR string (MM_ERROR is the default).

MM_WARNING

Display a localized WARNING string.

MM_INFO

Display a localized INFO string.

Besides these reserved severities, additional severity strings may be defined by the user (see addsev(3C)). To specify a user defined severity, flags should be a logical-or of the numeric value of the user defined severity and flags from other control groups.

Action
MM_ACTION

This flag generates the localized string of TO FIX: in the severity field of the standard format message. If this flag and flags from the severity control group are set, this flag has precedence and the TO FIX: string will be displayed.

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:

  • No message catalog is specified in fmt and no catalog is defined via setcat(3C).

  • msg_number is not positive.

  • No message could be retrieved and def_str is not specified.

RETURN VALUE

If successful, pfmt() and vpfmt() return the number of bytes written. Otherwise, they return a negative value.

EXAMPLES

Example 1

setlabel("UX:my_appl"); pfmt(stderr, MM_INFO,"MY_cat:1:file is writable");

generates the message:

UX:my_appl: INFO: file is writable

Example 2

setlabel(""); setcat("MY_cat"); pfmt(stderr, MM_ERROR,":1:%s is writable", "my_file");

generates the message:

ERROR: my_file is writable

Example 3

setlabel(""); setcat("MY_cat"); pfmt(stderr, MM_NOSTD,":1:%s is writable", "my_file");

generates the message:

my_file is writable

Example 4

#define MM_USER 10 setlabel(""); addsev(MM_USER, "MY_NOTE"); pfmt(stderr, MM_USER|MM_GET,"MY_cat:1:%s is writable", "my_file");

generates the message:

MY_NOTE: my_file is writable

STANDARDS CONFORMANCE

pfmt(): SVID3

vpfmt(): SVID3

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.