diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-05-31 01:44:15 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-05-31 01:44:15 +0200 |
commit | 6d4c96445d97552ce6e621a4d17f7f64fd08fcd4 (patch) | |
tree | 4bd8b947041b8cabb72df3edafcb8b37062bbb15 | |
parent | b35b14f7514ab94fdab66ff2681c265b99c0b72e (diff) |
zlibVersion.3: Add pagezlib
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man3/zlibVersion.3 | 66 |
1 files changed, 66 insertions, 0 deletions
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 <alx@nginx.com> +. +.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 <zlib.h> +.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 <err.h> +#include <stdio.h> +#include <stdlib.h> +\& +#include <zlib.h> +\& +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 . |