From: Lennart Poettering Date: Thu, 14 May 2026 15:56:56 +0000 (+0200) Subject: shared/options: introduce OPTION_ERROR X-Git-Tag: v261-rc1~157^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2289ac82d4150174212e716b696b7bddb4f240d7;p=thirdparty%2Fsystemd.git shared/options: introduce OPTION_ERROR [zjs: this was originally proposed in https://github.com/systemd/systemd/commit/930fc9d6980f27b278527b0d6117f97296fcaf6a. I'm rescuing one chunk from that patch.] --- diff --git a/src/shared/options.h b/src/shared/options.h index d60c9afe81b..a6c55e0bdc5 100644 --- a/src/shared/options.h +++ b/src/shared/options.h @@ -80,6 +80,10 @@ typedef struct Option { #define OPTION_POSITIONAL OPTION_FULL(OPTION_POSITIONAL_ENTRY, /* sc= */ 0, "(positional)", /* mv= */ NULL, /* h= */ NULL) #define OPTION_HELP_VERBATIM(lc, h) OPTION_FULL(OPTION_HELP_ENTRY_VERBATIM, /* sc= */ 0, lc, /* mv= */ NULL, h) +/* This can be used when custom error handling is needed. */ +#define OPTION_ERROR \ + case INT_MIN ... -1 + #define OPTION_COMMON_HELP \ OPTION('h', "help", NULL, "Show this help")