mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-28 03:06:20 -04:00
[version] Show runtime version of decompression libraries
This commit is contained in:
parent
d3f9bd5a4b
commit
571d275759
@ -175,6 +175,23 @@ brotli_close(struct stream_encoded *stream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
get_brotli_version(void)
|
||||||
|
{
|
||||||
|
static char version[16];
|
||||||
|
|
||||||
|
if (!version[0]) {
|
||||||
|
int v = BrotliDecoderVersion();
|
||||||
|
int major = v >> 24;
|
||||||
|
int minor = (v >> 12) & 0xFFF;
|
||||||
|
int patch = v & 0xFFF;
|
||||||
|
|
||||||
|
snprintf(version, 15, "%d.%d.%d", major, minor, patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *const brotli_extensions[] = { ".br", NULL };
|
static const char *const brotli_extensions[] = { ".br", NULL };
|
||||||
|
|
||||||
const struct decoding_backend brotli_decoding_backend = {
|
const struct decoding_backend brotli_decoding_backend = {
|
||||||
|
@ -9,6 +9,8 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef CONFIG_BROTLI
|
#ifdef CONFIG_BROTLI
|
||||||
extern const struct decoding_backend brotli_decoding_backend;
|
extern const struct decoding_backend brotli_decoding_backend;
|
||||||
|
const char *get_brotli_version(void);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define brotli_decoding_backend dummy_decoding_backend
|
#define brotli_decoding_backend dummy_decoding_backend
|
||||||
#endif
|
#endif
|
||||||
|
@ -212,6 +212,22 @@ bzip2_close(struct stream_encoded *stream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
get_bzip2_version(void)
|
||||||
|
{
|
||||||
|
static char version[16];
|
||||||
|
|
||||||
|
if (!version[0]) {
|
||||||
|
strncpy(version, BZ2_bzlibVersion(), 15);
|
||||||
|
|
||||||
|
size_t ok = strspn(version, "0123456789.");
|
||||||
|
|
||||||
|
version[ok] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *const bzip2_extensions[] = { ".bz2", ".tbz", NULL };
|
static const char *const bzip2_extensions[] = { ".bz2", ".tbz", NULL };
|
||||||
|
|
||||||
const struct decoding_backend bzip2_decoding_backend = {
|
const struct decoding_backend bzip2_decoding_backend = {
|
||||||
|
@ -9,6 +9,7 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
extern const struct decoding_backend bzip2_decoding_backend;
|
extern const struct decoding_backend bzip2_decoding_backend;
|
||||||
|
const char *get_bzip2_version(void);
|
||||||
#else
|
#else
|
||||||
#define bzip2_decoding_backend dummy_decoding_backend
|
#define bzip2_decoding_backend dummy_decoding_backend
|
||||||
#endif
|
#endif
|
||||||
|
@ -250,6 +250,12 @@ deflate_close(struct stream_encoded *stream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
get_gzip_version(void)
|
||||||
|
{
|
||||||
|
return zlibVersion();
|
||||||
|
}
|
||||||
|
|
||||||
static const char *const gzip_extensions[] = { ".gz", ".tgz", NULL };
|
static const char *const gzip_extensions[] = { ".gz", ".tgz", NULL };
|
||||||
|
|
||||||
const struct decoding_backend gzip_decoding_backend = {
|
const struct decoding_backend gzip_decoding_backend = {
|
||||||
|
@ -9,6 +9,7 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef CONFIG_GZIP
|
#ifdef CONFIG_GZIP
|
||||||
extern const struct decoding_backend gzip_decoding_backend;
|
extern const struct decoding_backend gzip_decoding_backend;
|
||||||
|
const char *get_gzip_version(void);
|
||||||
#else
|
#else
|
||||||
#define gzip_decoding_backend dummy_decoding_backend
|
#define gzip_decoding_backend dummy_decoding_backend
|
||||||
#endif
|
#endif
|
||||||
|
@ -176,6 +176,12 @@ lzma_close(struct stream_encoded *stream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
get_lzma_version(void)
|
||||||
|
{
|
||||||
|
return lzma_version_string();
|
||||||
|
}
|
||||||
|
|
||||||
static const char *const lzma_extensions[] = { ".lzma", ".xz", NULL };
|
static const char *const lzma_extensions[] = { ".lzma", ".xz", NULL };
|
||||||
|
|
||||||
const struct decoding_backend lzma_decoding_backend = {
|
const struct decoding_backend lzma_decoding_backend = {
|
||||||
|
@ -9,6 +9,7 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef CONFIG_LZMA
|
#ifdef CONFIG_LZMA
|
||||||
extern const struct decoding_backend lzma_decoding_backend;
|
extern const struct decoding_backend lzma_decoding_backend;
|
||||||
|
const char *get_lzma_version(void);
|
||||||
#else
|
#else
|
||||||
#define lzma_decoding_backend dummy_decoding_backend
|
#define lzma_decoding_backend dummy_decoding_backend
|
||||||
#endif
|
#endif
|
||||||
|
@ -170,6 +170,12 @@ zstd_close(struct stream_encoded *stream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
get_zstd_version(void)
|
||||||
|
{
|
||||||
|
return ZSTD_versionString();
|
||||||
|
}
|
||||||
|
|
||||||
static const char *const zstd_extensions[] = { ".zst", NULL };
|
static const char *const zstd_extensions[] = { ".zst", NULL };
|
||||||
|
|
||||||
const struct decoding_backend zstd_decoding_backend = {
|
const struct decoding_backend zstd_decoding_backend = {
|
||||||
|
@ -9,6 +9,7 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef CONFIG_ZSTD
|
#ifdef CONFIG_ZSTD
|
||||||
extern const struct decoding_backend zstd_decoding_backend;
|
extern const struct decoding_backend zstd_decoding_backend;
|
||||||
|
const char *get_zstd_version(void);
|
||||||
#else
|
#else
|
||||||
#define zstd_decoding_backend dummy_decoding_backend
|
#define zstd_decoding_backend dummy_decoding_backend
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,22 @@
|
|||||||
|
|
||||||
#include "elinks.h"
|
#include "elinks.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_BROTLI
|
||||||
|
#include "encoding/brotli.h"
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_GZIP
|
||||||
|
#include "encoding/gzip.h"
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_BZIP2
|
||||||
|
#include "encoding/bzip2.h"
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_LZMA
|
||||||
|
#include "encoding/lzma.h"
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_ZSTD
|
||||||
|
#include "encoding/zstd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "intl/libintl.h"
|
#include "intl/libintl.h"
|
||||||
#include "main/module.h"
|
#include "main/module.h"
|
||||||
#include "main/version.h"
|
#include "main/version.h"
|
||||||
@ -132,19 +148,19 @@ get_dyn_full_version(struct terminal *term, int more)
|
|||||||
comma, "IPv6",
|
comma, "IPv6",
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_BROTLI
|
#ifdef CONFIG_BROTLI
|
||||||
comma, "brotli",
|
comma, "brotli(", get_brotli_version(),")",
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_GZIP
|
#ifdef CONFIG_GZIP
|
||||||
comma, "gzip",
|
comma, "gzip(", get_gzip_version(),")",
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
comma, "bzip2",
|
comma, "bzip2(", get_bzip2_version(), ")",
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_LZMA
|
#ifdef CONFIG_LZMA
|
||||||
comma, "lzma",
|
comma, "lzma(", get_lzma_version(), ")",
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_ZSTD
|
#ifdef CONFIG_ZSTD
|
||||||
comma, "zstd",
|
comma, "zstd(", get_zstd_version(), ")",
|
||||||
#endif
|
#endif
|
||||||
#ifndef CONFIG_MOUSE
|
#ifndef CONFIG_MOUSE
|
||||||
comma, _("No mouse", term),
|
comma, _("No mouse", term),
|
||||||
|
Loading…
Reference in New Issue
Block a user