]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/options: introduce OPTION_ERROR
authorLennart Poettering <lennart@poettering.net>
Thu, 14 May 2026 15:56:56 +0000 (17:56 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 14 May 2026 17:59:21 +0000 (19:59 +0200)
[zjs: this was originally proposed in
https://github.com/systemd/systemd/commit/930fc9d6980f27b278527b0d6117f97296fcaf6a.
I'm rescuing one chunk from that patch.]

src/shared/options.h

index d60c9afe81bfe57363ed71f1872cc8ef8db88a8c..a6c55e0bdc51a4547ff11128d613ca36064691b5 100644 (file)
@@ -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")