'\" t .\" Title: vsnprintf .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: March 2016 .\" Manual: Basic C Library Functions .\" Source: Kernel Hackers Manual 3.2.78 .\" Language: English .\" .TH "VSNPRINTF" "9" "March 2016" "Kernel Hackers Manual 3\&.2\&." "Basic C Library Functions" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" vsnprintf \- Format a string and place it in a buffer .SH "SYNOPSIS" .HP \w'int\ vsnprintf('u .BI "int vsnprintf(char\ *\ " "buf" ", size_t\ " "size" ", const\ char\ *\ " "fmt" ", va_list\ " "args" ");" .SH "ARGUMENTS" .PP \fIbuf\fR .RS 4 The buffer to place the result into .RE .PP \fIsize\fR .RS 4 The size of the buffer, including the trailing null space .RE .PP \fIfmt\fR .RS 4 The format string to use .RE .PP \fIargs\fR .RS 4 Arguments for the format string .RE .SH "DESCRIPTION" .PP This function follows C99 vsnprintf, but has some extensions: \fBpS\fR output the name of a text symbol with offset \fBps\fR output the name of a text symbol without offset \fBpF\fR output the name of a function pointer with its offset \fBpf\fR output the name of a function pointer without its offset \fBpB\fR output the name of a backtrace symbol with its offset \fBpR\fR output the address range in a struct resource with decoded flags \fBpr\fR output the address range in a struct resource with raw flags \fBpM\fR output a 6\-byte MAC address with colons \fBpm\fR output a 6\-byte MAC address without colons \fBpI4\fR print an IPv4 address without leading zeros \fBpi4\fR print an IPv4 address with leading zeros \fBpI6\fR print an IPv6 address with colons \fBpi6\fR print an IPv6 address without colons \fBpI6c\fR print an IPv6 address as specified by RFC 5952 \fBpU\fR[bBlL] print a UUID/GUID in big or little endian using lower or upper case\&. \fBn\fR is ignored .PP The return value is the number of characters which would be generated for the given input, excluding the trailing \*(Aq\e0\*(Aq, as per ISO C99\&. If you want to have the exact number of characters written into \fIbuf\fR as return value (not including the trailing \*(Aq\e0\*(Aq), use \fBvscnprintf\fR\&. If the return is greater than or equal to \fIsize\fR, the resulting string is truncated\&. .PP If you\*(Aqre not already dealing with a va_list consider using \fBsnprintf\fR\&. .SH "COPYRIGHT" .br