From: Karel Zak Date: Mon, 13 Jun 2022 10:01:51 +0000 (+0200) Subject: include/c: add print_version_with_features() X-Git-Tag: v2.39-rc1~615 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=beafda1869e0f80d6adc55377c5d6e0427110087;p=thirdparty%2Futil-linux.git include/c: add print_version_with_features() Signed-off-by: Karel Zak --- diff --git a/include/c.h b/include/c.h index db0c58b509..bb6c436cd1 100644 --- a/include/c.h +++ b/include/c.h @@ -438,6 +438,27 @@ static inline int xusleep(useconds_t usec) exit(eval); \ }) +static inline void print_features(const char **features) +{ + if (features && *features) { + const char **p = features; + while (p && *p) { + fputs(p == features ? " (" : ", ", stdout); + fputs(*p++, stdout); + } + fputc(')', stdout); + } +} + +#define UTIL_LINUX_VERSION_NOBREAK _("%s from %s"), program_invocation_short_name, PACKAGE_STRING + +#define print_version_with_features(eval, features) __extension__ ({ \ + printf(UTIL_LINUX_VERSION_NOBREAK); \ + print_features(features); \ + fputc('\n', stdout); \ + exit(eval); \ +}) + /* * seek stuff */