xref: /titanic_44/usr/src/man/man3c/setlabel.3c (revision b8afd3a780ce850ff107bb3be330465bf47f84bd)
te
Copyright 1989 AT&T Copyright (c) 1998, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
setlabel 3C "29 Dec 1996" "SunOS 5.11" "Standard C Library Functions"
NAME
setlabel - define the label for pfmt() and lfmt()
SYNOPSIS

#include <pfmt..h>

int setlabel(const char *label);
DESCRIPTION

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

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

No label is defined before setlabel() is called. The label should be set once at the beginning of a utility and remain constant. A null pointer or an empty string passed as argument will reset the definition of the label.

RETURN VALUE

Upon successful completion, setlabel() returns 0; otherwise, it returns a non-zero value.

EXAMPLES

The following code (without previous call to setlabel()):

pfmt(stderr, MM_ERROR, "test:2:Cannot open file\en");
setlabel("UX:test");
pfmt(stderr, MM_ERROR, "test:2:Cannot open file\en");

will produce the following output:

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

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe
SEE ALSO

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