From 8b928d357fbe89dfb33abe5d922843ac0b897ca4 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 12 Jun 2022 13:36:41 +0200 Subject: feh(1), --version: Document libmagic compile flag --- config.mk | 3 +++ man/Makefile | 1 + man/feh.pre | 21 ++++++++++++--------- src/options.c | 4 ++++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/config.mk b/config.mk index 6c85e05..5cad703 100644 --- a/config.mk +++ b/config.mk @@ -72,6 +72,9 @@ endif ifeq (${magic},1) CFLAGS += -DHAVE_LIBMAGIC LDLIBS += -lmagic + MAN_MAGIC = enabled +else + MAN_MAGIC = disabled endif ifeq (${verscmp},1) diff --git a/man/Makefile b/man/Makefile index 3be07e3..8fe2cbd 100644 --- a/man/Makefile +++ b/man/Makefile @@ -13,6 +13,7 @@ all: ${TARGETS} -e 's/\$$MAN_DEBUG\$$/${MAN_DEBUG}/' \ -e 's/\$$MAN_EXIF\$$/${MAN_EXIF}/' \ -e 's/\$$MAN_INOTIFY\$$/${MAN_INOTIFY}/' \ + -e 's/\$$MAN_MAGIC\$$/${MAN_MAGIC}/' \ -e 's/\$$MAN_XINERAMA\$$/${MAN_XINERAMA}/' \ < ${@:.1=.pre} > $@ diff --git a/man/feh.pre b/man/feh.pre index 340d6cd..1899800 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -41,6 +41,9 @@ libexif builtin EXIF reader $MAN_EXIF$ .It inotify-based auto-reload of changed files $MAN_INOTIFY$ . +.It +libmagic $MAN_MAGIC$ +. .El . $MAN_DEBUG$ @@ -165,20 +168,20 @@ with a non-negative value to enable support for these formats. . .Pp . -As Imlib2 may take several seconds to determine whether it can load a file or -not -.Pq e.g. when attempting to open a large video , +.Pq optional feature, $MAN_MAGIC$ in this build +.Nm +can use libmagic to only pass image files to Imlib2. +This feature is $MAN_MAGIC$ in this build. +When using .Nm -checks each file's header before loading it. -If it looks like an image, it is passed on to Imlib2, otherwise, it is -assumed to be unloadable. -This greatly improves performance when working in directories with mixed files -.Pq i.e., directories which do not exclusively contain image files . +with lots of non-image files +.Pq especially with Imlib2 version 1.6.x or 1.7.0 , +this can speed up the detection of non-image files significantly. If you think that Imlib2 can load a file which .Nm has determined to be likely not an image, set the environment variable .Qq FEH_SKIP_MAGIC -to pass all files directly to Imlib2, bypassing the header check. +to pass all files directly to Imlib2, bypassing this check. The environment variable's value does not matter, it just needs to be set. . .Sh OPTIONS diff --git a/src/options.c b/src/options.c index 71c65e2..d3524f7 100644 --- a/src/options.c +++ b/src/options.c @@ -976,6 +976,10 @@ static void show_version(void) "help " #endif +#ifdef HAVE_LIBMAGIC + "magic " +#endif + #if _FILE_OFFSET_BITS == 64 "stat64 " #endif -- cgit v1.2.3