From f78ce59ff78f4dc9fc7f1ae533b03d7aed6ef98b Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 15 Nov 2018 22:58:46 -0500 Subject: Add gzclose.3 --- Makefile | 3 +++ gzclose.3 | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 gzclose.3 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. -- cgit 1.4.1