summaryrefslogtreecommitdiff
path: root/man/man3/pmprintf.3
blob: 6e707f4524ba7a8baa4bed7e406a1956ed990f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
'\"macro stdmacro
.\"
.\" Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
.\" 
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\" 
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\" 
.\"
.TH PMPRINTF 3 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmprintf\f1,
\f3pmflush\f1 \- print formatted output in a window or to standard error
.SH "C SYNOPSIS"
.ft 3
#include <pcp/pmapi.h>
.sp
int pmprintf(const char *\fIfmt\fP, ... /*\fIargs\fP*/);
.br
int pmflush(void);
.sp
cc ... \-lpcp
.ft 1
.SH DESCRIPTION
The combination of
.B pmprintf
and
.B pmflush
produces output in either an
.BR xconfirm (1)
window, on the standard error stream, or to a file in a manner similar to
.BR fprintf (3).
The \f2fmt\f1 argument is used to control the conversion, formatting, and
printing of the variable length \f2args\f1 list.
The output technique is controlled via an environment variable.
.PP
.B pmprintf
appends the formatted message string to an internal buffer shared by the
two routines, without actually producing any output.
.PP
.B pmflush
causes the internal buffer to be either displayed in a window, printed
on standard error, or flushed to a file and the internal buffer to be cleared.
.PP
.SH ENVIRONMENT
The environment variable
.BR PCP_STDERR
controls the output technique used by \f3pmflush\f1:
.RS +4n
.PP
If
.B PCP_STDERR
is unset, the text is written onto the
.I stderr
stream of the caller.
.PP
If 
.B PCP_STDERR
is set to the literal reserved word
.B DISPLAY
then the text will be displayed as a GUI dialog using
.BR xconfirm (1).
.PP
If 
.B PCP_STDERR
is set to any other value then \f3pmflush\f1
interprets the value as a file name and 
appends the text to that file.  The file is created if it doesn't already
exist, and in this case if the file creation fails, then
.I stderr
is used instead).
.RE
.SH FILES
.B pmprintf
uses the
.BR mkstemp (3)
function to create a temporary file.
This temporary file is deleted when
.B pmflush
is called.
.SH DIAGNOSTICS
On successful completion, \f3pmprintf\f1 returns the number of characters
transmitted, while
.B pmflush
returns a value of zero on successful completion.
.PP
For either routine, a negative value is returned if an error was encountered,
and this can be passed to
.BR pmErrStr (3)
to obtain the associated error message.
.PP
.SH SEE ALSO
.BR pmdbg (1),
.BR fprintf (3),
.BR mkstemp (3),
.BR pmErrStr (3)
and
.BR PMAPI (3).