From 6d4c96445d97552ce6e621a4d17f7f64fd08fcd4 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 31 May 2023 01:44:15 +0200 Subject: zlibVersion.3: Add page Signed-off-by: Alejandro Colomar --- man3/zlibVersion.3 | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 man3/zlibVersion.3 diff --git a/man3/zlibVersion.3 b/man3/zlibVersion.3 new file mode 100644 index 000000000..abb7067fc --- /dev/null +++ b/man3/zlibVersion.3 @@ -0,0 +1,66 @@ +.\" Copyright 2023, F5, Inc. +.\" Author: Alejandro Colomar +. +.TH zlibVersion 3 (date) "zlib (unreleased)" +. +.SH Name +zlibVersion +\- +get version of the zlib runtime library +. +.SH Library +zlib compression library +.RI ( zlib ", " \-lz ) +. +.SH Synopsis +.nf +.B #include +.PP +.B const char *zlibVersion(void); +.PP +.BR "#define ZLIB_VERSION" " /* ... */" +.fi +. +.SH Description +.MR zlibVersion 3 +can be called by the application to +compare the version of the runtime library +with the version of the header file used at compilation +.RB \%( ZLIB_VERSION ). +If the major version (the first character) differs, +the runtime library is not compatible with the header file. +This check is performed automatically by +.MR deflateInit 3 +and +.MR inflateInit 3 . +. +.SH Return value +A static string similar to +.IR \[dq]1.2.13.1-motley\[dq] . +. +.SH Errors +None. +. +.SH Examples +.EX +#include +#include +#include +\& +#include +\& +int +main(void) +{ + printf("zlib header version: %s\en", ZLIB_VERSION); + printf("zlib runtime version: %s\en", zlibVersion()); +\& + if (ZLIB_VERSION[0] != zlibVersion()[0]) + errx(EXIT_FAILURE, "incompatible zlib runtime version"); +\& + exit(EXIT_SUCCESS); +} +.EE +. +.SH See also +.MR zlib 3 . -- cgit v1.2.3