about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-11-15 22:58:46 -0500
committerJune McEnroe <june@causal.agency>2018-11-15 22:58:46 -0500
commitf78ce59ff78f4dc9fc7f1ae533b03d7aed6ef98b (patch)
treefcd18761fe8fa119e5f0ff2e76a104e21bc29554
parentAdd gzdirect.3 (diff)
downloadzlib-man-pages-f78ce59ff78f4dc9fc7f1ae533b03d7aed6ef98b.tar.gz
zlib-man-pages-f78ce59ff78f4dc9fc7f1ae533b03d7aed6ef98b.zip
Add gzclose.3
-rw-r--r--Makefile3
-rw-r--r--gzclose.382
2 files changed, 85 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index f98e393..0275b90 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@ MAN += deflateSetDictionary.3
 MAN += deflateSetHeader.3
 MAN += deflateTune.3
 MAN += gzbuffer.3
+MAN += gzclose.3
 MAN += gzdirect.3
 MAN += gzeof.3
 MAN += gzflush.3
@@ -58,6 +59,8 @@ MAN += zlibVersion.3
 MLINKS += adler32.3 adler32_z.3
 MLINKS += compress.3 compress2.3
 MLINKS += crc32.3 crc32_z.3
+MLINKS += gzclose.3 gzclose_r.3
+MLINKS += gzclose.3 gzclose_w.3
 MLINKS += gzopen.3 gzdopen.3
 MLINKS += gzseek.3 gzrewind.3
 MLINKS += gzseek.3 gztell.3
diff --git a/gzclose.3 b/gzclose.3
new file mode 100644
index 0000000..a8ee351
--- /dev/null
+++ b/gzclose.3
@@ -0,0 +1,82 @@
+.Dd November 15, 2018
+.Dt GZCLOSE 3
+.Os
+.
+.Sh NAME
+.Nm gzclose
+.Nd close compressed file
+.
+.Sh LIBRARY
+.Lb libz
+.
+.Sh SYNOPSIS
+.In zlib.h
+.Ft int
+.Fn gzclose "gzFile file"
+.Ft int
+.Fn gzclose_r "gzFile file"
+.Ft int
+.Fn gzclose_w "gzFile file"
+.
+.Sh DESCRIPTION
+Flushes all pending output if necessary,
+closes the compressed file
+and deallocates the (de)compression state.
+Note that once
+.Fa file
+is closed,
+you cannot call
+.Xr gzerror 3
+with
+.Fa file ,
+since its structures
+have been deallocated.
+.Fn gzclose
+must not be called more than once
+on the same file,
+just as
+.Xr free 3
+must not be called more than once
+on the same allocation.
+.
+.Pp
+.Fn gzclose_r
+and
+.Fn gzclose_w
+are the same as
+.Fn gzclose ,
+but
+.Fn gzclose_r
+is only for use when reading,
+and
+.Fn gzclose_w
+is only for use when writing or appending.
+The advantage to using these instead of
+.Fn gzclose
+is that they avoid linking in
+zlib compression or decompression code
+that is not used when only reading
+or only writing respectively.
+If
+.Fn gzclose
+is used,
+then both compression and decompression code
+will be included in the application
+when linking to a static zlib library.
+.
+.Sh RETURN VALUES
+.Fn gzclose
+will return
+.Dv Z_STREAM_ERROR
+if
+.Fa file
+is not valid,
+.Dv Z_ERRNO
+on a file operator error,
+.Dv Z_MEM_ERROR
+if out of memory,
+.Dv Z_BUF_ERROR
+if the last read ended in the middle of a gzip stream,
+or
+.Dv Z_OK
+on success.