Current File : //usr/man/man3c/setlabel.3c
'\" te
.\" Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
.\" Copyright 1989 AT&T
.TH setlabel 3C "29 Dec 1996" "SunOS 5.11" "Standard C Library Functions"
.SH NAME
setlabel \- define the label for \fBpfmt()\fR and \fBlfmt()\fR
.SH SYNOPSIS
.LP
.nf
#include <pfmt.h>

\fBint\fR \fBsetlabel\fR(\fBconst char *\fR\fIlabel\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBsetlabel()\fR function defines the label for messages produced in standard format by subsequent calls to \fBlfmt\fR(3C) and \fBpfmt\fR(3C).
.sp
.LP
The \fIlabel\fR argument is a character string no more than 25 characters in length.
.sp
.LP
No label is defined before \fBsetlabel()\fR 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.
.SH RETURN VALUE
.sp
.LP
Upon successful completion, \fBsetlabel()\fR returns \fB0\fR; otherwise, it returns a non-zero value.
.SH EXAMPLES
.sp
.LP
The following code (without previous call to \fBsetlabel()\fR):
.sp
.in +2
.nf
pfmt(stderr, MM_ERROR, "test:2:Cannot open file\en");
setlabel("UX:test");
pfmt(stderr, MM_ERROR, "test:2:Cannot open file\en");
.fi
.in -2

.sp
.LP
will produce the following output:
.sp
.in +2
.nf
ERROR: Cannot open file
UX:test: ERROR: Cannot open file
.fi
.in -2

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
MT-LevelMT-Safe
.TE

.SH SEE ALSO
.sp
.LP
\fBgetopt\fR(3C), \fBlfmt\fR(3C), \fBpfmt\fR(3C), \fBattributes\fR(5)