1.\"	$OpenBSD: BIO_printf.3,v 1.3 2018/03/22 17:11:04 schwarze Exp $
2.\"	OpenSSL 2ca2e917 Mon Mar 20 16:25:22 2017 -0400
3.\"
4.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: March 22 2018 $
19.Dt BIO_PRINTF 3
20.Os
21.Sh NAME
22.Nm BIO_printf ,
23.Nm BIO_vprintf ,
24.Nm BIO_snprintf ,
25.Nm BIO_vsnprintf
26.Nd formatted output to a BIO
27.Sh SYNOPSIS
28.In openssl/bio.h
29.Ft int
30.Fo BIO_printf
31.Fa "BIO *bio"
32.Fa "const char *format"
33.Fa ...
34.Fc
35.Ft int
36.Fo BIO_vprintf
37.Fa "BIO *bio"
38.Fa "const char *format"
39.Fa "va_list args"
40.Fc
41.Ft int
42.Fo BIO_snprintf
43.Fa "char *buf"
44.Fa "size_t n"
45.Fa "const char *format"
46.Fa ...
47.Fc
48.Ft int
49.Fo BIO_vsnprintf
50.Fa "char *buf"
51.Fa "size_t n"
52.Fa "const char *format"
53.Fa "va_list args"
54.Fc
55.Sh DESCRIPTION
56.Fn BIO_vprintf
57is a wrapper around
58.Xr vfprintf 3 ,
59sending the output to the specified
60.Fa bio .
61.Pp
62.Fn BIO_printf
63is a wrapper around
64.Fn BIO_vprintf .
65.Pp
66.Fn BIO_snprintf
67and
68.Fn BIO_vsnprintf
69are wrappers around
70.Xr vsnprintf 3 .
71.Sh RETURN VALUES
72These functions return the number of bytes written,
73or -1 if an error occurs.
74.Pp
75In contrast to
76.Xr snprintf 3
77and
78.Xr vsnprintf 3 ,
79.Fn BIO_snprintf
80and
81.Fn BIO_vsnprintf
82also return -1 if
83.Fa n
84is too small to hold the complete output.
85.Sh SEE ALSO
86.Xr BIO_new 3
87.Sh HISTORY
88.Fn BIO_printf
89first appeared in SSLeay 0.6.5 and has been available since
90.Ox 2.4 .
91.Pp
92.Fn BIO_vprintf ,
93.Fn BIO_snprintf ,
94and
95.Fn BIO_vsnprintf
96first appeared in OpenSSL 0.9.6 and have been available since
97.Ox 2.9 .
98