about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--gzerror.360
2 files changed, 62 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 0275b90..46b6181 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,7 @@ MAN += gzbuffer.3
 MAN += gzclose.3
 MAN += gzdirect.3
 MAN += gzeof.3
+MAN += gzerror.3
 MAN += gzflush.3
 MAN += gzfread.3
 MAN += gzfwrite.3
@@ -61,6 +62,7 @@ MLINKS += compress.3 compress2.3
 MLINKS += crc32.3 crc32_z.3
 MLINKS += gzclose.3 gzclose_r.3
 MLINKS += gzclose.3 gzclose_w.3
+MLINKS += gzerror.3 gzclearerr.3
 MLINKS += gzopen.3 gzdopen.3
 MLINKS += gzseek.3 gzrewind.3
 MLINKS += gzseek.3 gztell.3
diff --git a/gzerror.3 b/gzerror.3
new file mode 100644
index 0000000..f965d2a
--- /dev/null
+++ b/gzerror.3
@@ -0,0 +1,60 @@
+.Dd November 15, 2018
+.Dt GZERROR 3
+.Os
+.
+.Sh NAME
+.Nm gzerror ,
+.Nm gzclearerr
+.Nd check and reset compressed file error
+.
+.Sh LIBRARY
+.Lb libz
+.
+.Sh SYNOPSIS
+.In zlib.h
+.Ft const char *
+.Fn gzerror "gzFile file" "int *errnum"
+.Ft void
+.Fn gzclearerr "gzFile file"
+.
+.Sh DESCRIPTION
+.Fn gzerror
+returns the error message for the last error
+which occured on the given compressed file.
+.Fa errnum
+is set to the zlib error number.
+If an error occurred in the file system
+and not in the compression library,
+.Fa errnum
+is set to
+.Dv Z_ERRNO
+and the application may consult
+.Va errno
+to get the exact error code.
+.
+.Pp
+The application must not modify the returned string.
+Future calls to this function
+may invalidate the previously returned string.
+If
+.Fa file
+is closed,
+then the string previously returned by
+.Fn gzerror
+will no longer be available.
+.
+.Pp
+.Fn gzerror
+should be used to distinguish errors from end-of-file
+for those functions that do not distinguish those cases
+in their return values.
+.
+.Pp
+.Fn gzclearerr
+clears the error and end-of-file for
+.Fa file .
+This is analogous to the
+.Xr clearerr 3
+function in stdio.
+This is useful for continuing to read a gzip file
+that is being written concurrently.