about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--gzprintf.356
2 files changed, 57 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index dd0e2a9..92f2e6d 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,7 @@ MAN += gzbuffer.3
 MAN += gzfread.3
 MAN += gzfwrite.3
 MAN += gzopen.3
+MAN += gzprintf.3
 MAN += gzread.3
 MAN += gzsetparams.3
 MAN += gzwrite.3
diff --git a/gzprintf.3 b/gzprintf.3
new file mode 100644
index 0000000..3435a53
--- /dev/null
+++ b/gzprintf.3
@@ -0,0 +1,56 @@
+.Dd November 13, 2018
+.Dt GZPRINTF 3
+.Os
+.
+.Sh NAME
+.Nm gzprintf
+.Nd format output to compressed file
+.
+.Sh LIBRARY
+.Lb libz
+.
+.Sh SYNOPSIS
+.In zlib.h
+.Ft int
+.Fn gzprintf "gzFile file" "const char *format" "..."
+.
+.Sh DESCRIPTION
+Converts, formats, and writes the arguments
+to the compressed file
+under control of the format string,
+as in
+.Xr fprintf 3 .
+.
+.Sh RETURN VALUES
+.Fn gzprintf
+returns the number of
+uncompressed bytes actually written,
+or a negative zlib error code
+in case of error.
+The number of uncompressed bytes written
+is limited to 8191,
+or one less than the buffer size given to
+.Xr gzbuffer 3 .
+The caller should assure that
+this limit is not exceeded.
+If it is exceeded,
+then
+.Fn gzprintf
+will return an error (0)
+with nothing written.
+In this case,
+there may also be a buffer overflow
+with unpredictable consequences,
+which is possibly only if zlib
+was compiled with the insecure functions
+.Xr sprintf 3
+or
+.Xr vsprintf 3
+because the secure
+.Xr snprintf 3
+or
+.Xr vsnprintf 3
+functions
+were not available.
+This can be determined using
+.Xr zlibCompileFlags 3 .