From 7c545b4b9c31dbfb2e8430aded030654a92e967a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 28 Feb 2026 19:17:45 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libabort_saprintf.3 | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 libabort_saprintf.3 (limited to 'libabort_saprintf.3') diff --git a/libabort_saprintf.3 b/libabort_saprintf.3 new file mode 100644 index 0000000..559d06f --- /dev/null +++ b/libabort_saprintf.3 @@ -0,0 +1,58 @@ +.TH LIBABORT_SAPRINTF 3 LIBABORT +.SH NAME +libabort_saprintf \- Format a string with bounds checking + +.SH SYNOPSIS +.nf +#include + +int \fBlibabort_saprintf\fP(char *\fIbuf\fP, size_t \fIsize\fP, const char *\fIfmt\fP, ...); + +#if !defined(LIBABORT_NO_SHORTHANDS) && !defined(saprintf) +# define \fBsaprintf\fP libabort_saprintf +#endif +.fi +.PP +Link with +.IR -labort . + +.SH DESCRIPTION +The +.BR libabort_saprintf () +function formats a string according to +.I fmt +into the buffer +.IR buf , +which is assumed to be +.I size +bytes long. +.PP +If the formatted output does not fit in the destination buffer +(including the terminating NUL byte), or if +.I size +is zero, the +.BR libabort_saprintf () +function calls +.BR abort (3). + +.SH RETURN VALUE +The +.BR libabort_saprintf () +function returns the number of bytes written to +.IR buf , +excluding the terminating NUL byte. + +.SH ERRORS +The +.BR libabort_saprintf () +function cannot fail. + +.SH HISTORY +The +.BR libabort_saprintf () +function added in version 1.0 of +.BR libabort . + +.SH SEE ALSO +.BR libabort (7), +.BR libabort_vsaprintf (3) -- cgit v1.2.3-70-g09d2