opnsense-src/lib/libutil++/freebsd__stringf.3
John Baldwin 1595031258 libutil++: Rename manpage source files to avoid colons
To permit checking the sources out on systems such as Windows with
more restrictive file name requirements, rename the manpage source
files to replace colons with underscrores.  Use MANSRC.foo to point
<bsd.man.mk> at the new source file names.

Reviewed by:	ivy
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D51794
2025-08-26 16:44:38 -04:00

48 lines
1.2 KiB
Groff

.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2025 Chelsio Communications, Inc.
.\" Written by: John Baldwin <jhb@FreeBSD.org>
.\"
.Dd July 31, 2025
.Dt FREEBSD::STRINGF 3
.Os
.Sh NAME
.Nm freebsd::stringf
.Nd build a std::string using stdio formatting
.Sh LIBRARY
.Lb libutil++
.Sh SYNOPSIS
.In libutil++.hh
.Ft std::string
.Fn freebsd::stringf "const char *fmt" "..."
.Ft std::string
.Fn freebsd::stringf "const char *fmt" "va_list ap"
.Sh DESCRIPTION
These functions construct a
.Vt std::string
object containing a formatted string.
The output of the string is dictated by the
.Fa fmt
argument and additional arguments using the same conventions documented in
.Xr printf 3 .
The first form provides functionality similar to
.Xr asprintf 3
and the second form is similar to
.Xr vasprintf 3 .
.Sh RETURN VALUES
These functions return a std::string object.
.Sh EXCEPTIONS
These functions may throw one of the following exceptions:
.Bl -tag -width Er
.It Bq Er std::bad_alloc
Failed to allocate memory.
.It Bq Er std::length_error
The result would exceeed the maximum possible string size.
.El
.Sh EXAMPLES
.Bd -literal -offset indent
std::string s = freebsd::stringf("hello %s", "world");
.Ed
.Sh SEE ALSO
.Xr asprintf 3