DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

setlabel(S)


setlabel -- define the label for pfmt

Syntax

cc ...-lc

#include <pfmt.h>

int setlabel(const char *label);

Description

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

label is a character string up to 25 characters long.

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

Set the label at the beginning of a utility and leave it constant.

getopt(S) has been modified to report errors using the standard message format. If setlabel( ) is called before getopt( ), getopt( ) uses the label. Otherwise, getopt( ) uses the name of the utility.

Return values

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

Diagnostics

This function does not set errno.

Examples

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

See also

getopt(S), pfmt(S)

Standards conformance

setlabel(S) is not part of any currently supported standard; it was developed by UNIX System Laboratories, Inc. and is maintained by The SCO Group.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003