diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-03-28 20:13:01 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-03-28 20:13:01 +0100 |
commit | 1101d2fa0eb14baab50cc5c6cf63078930c06290 (patch) | |
tree | e1469273c2f14b99e1cb20fe8f369b52260a9d26 | |
parent | 42b215a865c2645dcbffc641e9cac1505a1b4cee (diff) | |
download | blogc-1101d2fa0eb14baab50cc5c6cf63078930c06290.tar.gz blogc-1101d2fa0eb14baab50cc5c6cf63078930c06290.tar.bz2 blogc-1101d2fa0eb14baab50cc5c6cf63078930c06290.zip |
blogc: -p should return special code when variable not found
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | 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 <sys/stat.h> #endif /* HAVE_SYS_STAT_H */ +#ifdef HAVE_SYSEXITS_H +#include <sysexits.h> +#else +#define EX_CONFIG 78 +#endif /* HAVE_SYSEXITS_H */ + #include <errno.h> #include <locale.h> #include <stdbool.h> @@ -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); |