From 1101d2fa0eb14baab50cc5c6cf63078930c06290 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 28 Mar 2019 20:13:01 +0100 Subject: blogc: -p should return special code when variable not found --- configure.ac | 2 +- src/blogc/main.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ff89236..880acf4 100644 --- a/configure.ac +++ b/configure.ac @@ -219,7 +219,7 @@ AM_CONDITIONAL([USE_BGR_DEPS], [test "x$have_bgr_deps" = "xyes"]) BASH="$ac_cv_path_bash" AC_SUBST(BASH) -AC_CHECK_HEADERS([sys/resource.h sys/stat.h sys/time.h sys/wait.h time.h unistd.h]) +AC_CHECK_HEADERS([sys/resource.h sys/stat.h sys/time.h sys/wait.h time.h unistd.h sysexits.h]) AC_CHECK_FUNCS([gethostname]) AM_CONDITIONAL([HAVE_TIME_H], [test "x$ac_cv_header_time_h" = "xyes"]) diff --git a/src/blogc/main.c b/src/blogc/main.c index 7416994..bae3c80 100644 --- a/src/blogc/main.c +++ b/src/blogc/main.c @@ -14,6 +14,12 @@ #include #endif /* HAVE_SYS_STAT_H */ +#ifdef HAVE_SYSEXITS_H +#include +#else +#define EX_CONFIG 78 +#endif /* HAVE_SYSEXITS_H */ + #include #include #include @@ -301,7 +307,7 @@ main(int argc, char **argv) if (val == NULL) { fprintf(stderr, "blogc: error: variable not found: %s\n", print); - rv = 1; + rv = EX_CONFIG; } else { printf("%s\n", val); -- cgit v1.2.3-18-g5258