[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    setlabel(3C) manual page Table of Contents

Name

setlabel - define the label for pfmt() and lfmt().

MT-Level

MT-safe

Synopsis


#include <pfmt.h>

int setlabel(const char *label);

Description

The routine setlabel() defines the label for messages produced in standard format by subsequent calls to pfmt() and lfmt().

label is a character string no more than 25 characters in length.

No label is defined before setlabel() is called. A NULL pointer or an empty string passed as argument will reset the definition of the label.

Return Value

setlabel() returns 0 in case of success, non-zero otherwise.

Example

The following code (without previous call to setlabel()):
    pfmt(stderr, MM_ERROR, "test:2:Cannot open file\n");
    setlabel("UX:test");
    pfmt(stderr, MM_ERROR, "test:2:Cannot open file\n");

will produce the following output:

    ERROR: Cannot open file
    UX:test: ERROR: Cannot open file

Usage

The label should be set once at the beginning of a utility and remain constant.

See Also

getopt(3C) , lfmt(3C) , pfmt(3C)


Table of Contents