fe
terminal file explorer and picker
git clone https://9o.is/git/fe.git
commit 81fb92d0c864b29bc5f67ab3fa8324e6bc53a598 parent 3bc4effb1e38de091baccdb45268a92b08c87d94 Author: Jul <jul@9o.is> Date: Mon, 19 Jan 2026 04:29:32 -0500 do not -include config.h Diffstat:
| M | Makefile | | | 7 | +++++-- |
| M | actions.c | | | 1 | + |
| M | configure | | | 22 | ++++++++++++---------- |
| M | entries.c | | | 1 | + |
| M | options.c | | | 1 | + |
| M | tty_interface.c | | | 1 | + |
6 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile @@ -9,7 +9,7 @@ INSTALL = install INSTALL_PROGRAM = $(INSTALL) -m 0755 CFLAGS = -MD -Wall -Wextra -g -std=c99 -O3 -pedantic -Werror=vla -CPPFLAGS = -include config.h \ +CPPFLAGS = \ -include compats.h \ -DVERSION=\"${VERSION}\" \ -D_POSIX_C_SOURCE=200809L @@ -24,9 +24,12 @@ OBJS = fe.o \ all: fe -fe: $(OBJS) +fe: config.h $(OBJS) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(OBJS) +config.h: config.def.h + cp config.def.h config.h + install: fe mkdir -p $(DESTDIR)$(BINDIR) $(INSTALL_PROGRAM) fe $(DESTDIR)$(BINDIR) diff --git a/actions.c b/actions.c @@ -6,6 +6,7 @@ #include <unistd.h> #include <stdio.h> #include <string.h> +#include "config.h" #define EXEC_REPLACE 1 #define EXEC_SHELL 2 diff --git a/configure b/configure @@ -1,25 +1,27 @@ #!/usr/bin/env sh -if [ ! -e config.h ]; then - cp config.def.h config.h -fi - -printf "/* Generated by configure */\n\n" > compats.h +h=compats.h +printf "/* Generated by configure */\n\n" > $h probe_func() { def=$1 ret=$2 fun=$3 arg="$4" + shift 4; + inc="$*" if printf "int main() { void *p = (void *)%s; return 0; }" "$fun" | \ cc -x c -o /dev/null - >/dev/null 2>&1; then - printf "#define %s 1\n" "$def" >> compats.h + printf '#define %s 1\n' "$def" >> $h else - printf "#define %s 0\n" "$def" >> compats.h - printf "extern %s %s%s\n\n" "$ret" "$fun" "$arg" >> compats.h + printf '#define %s 0\n' "$def" >> $h + for i in $inc; do + printf '#include %s\n' "$i" >> $h + done + printf 'extern %s %s%s\n\n' "$ret" "$fun" "$arg" >> $h fi } -probe_func HAVE_STRLCPY size_t strlcpy '(char *, const char *, size_t);' -probe_func HAVE_STRLCAT size_t strlcat '(char *, const char *, size_t);' +probe_func HAVE_STRLCPY size_t strlcpy '(char *, const char *, size_t);' '<stddef.h>' +probe_func HAVE_STRLCAT size_t strlcat '(char *, const char *, size_t);' '<stddef.h>' diff --git a/entries.c b/entries.c @@ -16,6 +16,7 @@ #include <strings.h> #include <unistd.h> #include "entries.h" +#include "config.h" static int sort_dir; static int sort_icase; diff --git a/options.c b/options.c @@ -4,6 +4,7 @@ #include <string.h> #include <limits.h> #include "options.h" +#include "config.h" static const char *usage_str = "" diff --git a/tty_interface.c b/tty_interface.c @@ -1,4 +1,5 @@ #include <string.h> +#include "config.h" void clear(tty_interface_t *state) { tty_t *tty = state->tty;