DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

setlabel(S-osr5)


setlabel -- define the label for pfmt

Syntax

cc ...-lc

#include <pfmt.h>

int setlabel(const char *label);

Description

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

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

Standards conformance

setlabel(S-osr5) is not part of any currently supported standard; it was developed by UNIX System Laboratories, Inc. and is maintained by The SCO Group.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005