From 5fcd316db3cfec96b23920e1363ef316e8167641 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 15 Nov 2018 23:09:22 -0500 Subject: Add gzerror.3 --- Makefile | 2 ++ gzerror.3 | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 gzerror.3 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. -- cgit 1.4.1