blob: 559d06f55536321e14bcff68dbd7f96b467961e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
.TH LIBABORT_SAPRINTF 3 LIBABORT
.SH NAME
libabort_saprintf \- Format a string with bounds checking
.SH SYNOPSIS
.nf
#include <libabort.h>
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)
|