summaryrefslogtreecommitdiff
path: root/static/netbsd/man3/sqlite3_mprintf.3
diff options
context:
space:
mode:
Diffstat (limited to 'static/netbsd/man3/sqlite3_mprintf.3')
-rw-r--r--static/netbsd/man3/sqlite3_mprintf.386
1 files changed, 86 insertions, 0 deletions
diff --git a/static/netbsd/man3/sqlite3_mprintf.3 b/static/netbsd/man3/sqlite3_mprintf.3
new file mode 100644
index 00000000..48ff3a70
--- /dev/null
+++ b/static/netbsd/man3/sqlite3_mprintf.3
@@ -0,0 +1,86 @@
+.Dd January 24, 2024
+.Dt SQLITE3_MPRINTF 3
+.Os
+.Sh NAME
+.Nm sqlite3_mprintf ,
+.Nm sqlite3_vmprintf ,
+.Nm sqlite3_snprintf ,
+.Nm sqlite3_vsnprintf
+.Nd formatted string printing functions
+.Sh SYNOPSIS
+.In sqlite3.h
+.Ft char *
+.Fo sqlite3_mprintf
+.Fa "const char*"
+.Fa "..."
+.Fc
+.Ft char *
+.Fo sqlite3_vmprintf
+.Fa "const char*"
+.Fa "va_list"
+.Fc
+.Ft char *
+.Fo sqlite3_snprintf
+.Fa "int"
+.Fa "char*"
+.Fa "const char*"
+.Fa "..."
+.Fc
+.Ft char *
+.Fo sqlite3_vsnprintf
+.Fa "int"
+.Fa "char*"
+.Fa "const char*"
+.Fa "va_list"
+.Fc
+.Sh DESCRIPTION
+These routines are work-alikes of the "printf()" family of functions
+from the standard C library.
+These routines understand most of the common formatting options from
+the standard library printf() plus some additional non-standard formats
+(%q, %Q, %w, and %z).
+See the
+.Fn built-in printf
+documentation for details.
+.Pp
+The sqlite3_mprintf() and sqlite3_vmprintf() routines write their results
+into memory obtained from
+.Fn sqlite3_malloc64 .
+The strings returned by these two routines should be released by
+.Fn sqlite3_free .
+Both routines return a NULL pointer if
+.Fn sqlite3_malloc64
+is unable to allocate enough memory to hold the resulting string.
+.Pp
+The sqlite3_snprintf() routine is similar to "snprintf()" from the
+standard C library.
+The result is written into the buffer supplied as the second parameter
+whose size is given by the first parameter.
+Note that the order of the first two parameters is reversed from snprintf().
+This is an historical accident that cannot be fixed without breaking
+backwards compatibility.
+Note also that sqlite3_snprintf() returns a pointer to its buffer instead
+of the number of characters actually written into the buffer.
+We admit that the number of characters written would be a more useful
+return value but we cannot change the implementation of sqlite3_snprintf()
+now without breaking compatibility.
+.Pp
+As long as the buffer size is greater than zero, sqlite3_snprintf()
+guarantees that the buffer is always zero-terminated.
+The first parameter "n" is the total size of the buffer, including
+space for the zero terminator.
+So the longest string that can be completely written will be n-1 characters.
+.Pp
+The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
+.Pp
+.Sh IMPLEMENTATION NOTES
+These declarations were extracted from the
+interface documentation at line 2948.
+.Bd -literal
+SQLITE_API char *sqlite3_mprintf(const char*,...);
+SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
+SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
+SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
+.Ed
+.Sh SEE ALSO
+.Xr sqlite3_malloc 3