From 8604a82ebbba9a90bc123f91ecbeb2499fef7d2f Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 28 Jan 2024 22:22:45 +0100 Subject: Add a warnx() wrapper and die/warn with rv 3 --- src/grab.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/grab.c b/src/grab.c index 97c77ef..68968f3 100644 --- a/src/grab.c +++ b/src/grab.c @@ -34,12 +34,17 @@ #define lengthof(a) (sizeof(a) / sizeof(*(a))) -#define die(...) err(EXIT_FAILURE, __VA_ARGS__) -#define diex(...) errx(EXIT_FAILURE, __VA_ARGS__) +#define die(...) err(3, __VA_ARGS__) +#define diex(...) errx(3, __VA_ARGS__) #define warn(...) \ do { \ warn(__VA_ARGS__); \ - rv = EXIT_FAILURE; \ + rv = 3; \ + } while (0) +#define warnx(...) \ + do { \ + warnx(__VA_ARGS__); \ + rv = 3; \ } while (0) #define streq(a, b) (!strcmp(a, b)) @@ -636,7 +641,6 @@ putm(struct sv sv, struct matches *ms, const char *filename) break; default: warnx("invalid color value -- '%s'", val); - rv = EXIT_FAILURE; } } } -- cgit v1.2.3