xref: /freebsd/crypto/openssl/doc/man3/BIO_printf.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimBIO_printf, BIO_vprintf, BIO_snprintf, BIO_vsnprintf
6e71b7053SJung-uk Kim- formatted output to a BIO
7e71b7053SJung-uk Kim
8e71b7053SJung-uk Kim=head1 SYNOPSIS
9e71b7053SJung-uk Kim
10e71b7053SJung-uk Kim #include <openssl/bio.h>
11e71b7053SJung-uk Kim
12*b077aed3SPierre Pronchery int BIO_printf(BIO *bio, const char *format, ...);
13*b077aed3SPierre Pronchery int BIO_vprintf(BIO *bio, const char *format, va_list args);
14e71b7053SJung-uk Kim
15*b077aed3SPierre Pronchery int BIO_snprintf(char *buf, size_t n, const char *format, ...);
16*b077aed3SPierre Pronchery int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
17e71b7053SJung-uk Kim
18e71b7053SJung-uk Kim=head1 DESCRIPTION
19e71b7053SJung-uk Kim
20e71b7053SJung-uk KimBIO_printf() is similar to the standard C printf() function, except that
21*b077aed3SPierre Proncherythe output is sent to the specified BIO, I<bio>, rather than standard
22e71b7053SJung-uk Kimoutput.  All common format specifiers are supported.
23e71b7053SJung-uk Kim
24e71b7053SJung-uk KimBIO_vprintf() is similar to the vprintf() function found on many platforms,
25*b077aed3SPierre Proncherythe output is sent to the specified BIO, I<bio>, rather than standard
26e71b7053SJung-uk Kimoutput.  All common format specifiers are supported. The argument
27*b077aed3SPierre Proncherylist I<args> is a stdarg argument list.
28e71b7053SJung-uk Kim
29e71b7053SJung-uk KimBIO_snprintf() is for platforms that do not have the common snprintf()
30*b077aed3SPierre Proncheryfunction. It is like sprintf() except that the size parameter, I<n>,
31e71b7053SJung-uk Kimspecifies the size of the output buffer.
32e71b7053SJung-uk Kim
33e71b7053SJung-uk KimBIO_vsnprintf() is to BIO_snprintf() as BIO_vprintf() is to BIO_printf().
34e71b7053SJung-uk Kim
35e71b7053SJung-uk Kim=head1 RETURN VALUES
36e71b7053SJung-uk Kim
37e71b7053SJung-uk KimAll functions return the number of bytes written, or -1 on error.
38e71b7053SJung-uk KimFor BIO_snprintf() and BIO_vsnprintf() this includes when the output
39e71b7053SJung-uk Kimbuffer is too small.
40e71b7053SJung-uk Kim
41*b077aed3SPierre Pronchery=head1 NOTES
42*b077aed3SPierre Pronchery
43*b077aed3SPierre ProncheryExcept when I<n> is 0, both BIO_snprintf() and BIO_vsnprintf() always
44*b077aed3SPierre Proncheryterminate their output with C<'\0'>.  This includes cases where -1 is
45*b077aed3SPierre Proncheryreturned, such as when there is insufficient space to output the whole
46*b077aed3SPierre Proncherystring.
47*b077aed3SPierre Pronchery
48e71b7053SJung-uk Kim=head1 COPYRIGHT
49e71b7053SJung-uk Kim
50*b077aed3SPierre ProncheryCopyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
51e71b7053SJung-uk Kim
52*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
53e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
54e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
55e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
56e71b7053SJung-uk Kim
57e71b7053SJung-uk Kim=cut
58