]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/c.h: add errtryhelp()
authorKarel Zak <kzak@redhat.com>
Mon, 19 Dec 2016 10:33:40 +0000 (11:33 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 19 Dec 2016 10:33:40 +0000 (11:33 +0100)
Add code to print:

Try '<progname> --help' for more information.

and exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
include/c.h

index 08dab934a0b55b9b712ff052d362a95c86bba7e7..bf11d61acbef80ae0476357e3d069d74910b53c4 100644 (file)
@@ -204,6 +204,15 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
 #endif /* !HAVE_ERR_H */
 
 
+/* Don't use inline function to avoid '#include "nls.h"' in c.h
+ */
+#define errtryhelp(eval) __extension__ ({ \
+       fprintf(stderr, _("Try '%s --help' for more information.\n"), \
+                       program_invocation_short_name); \
+       exit(eval); \
+})
+
+
 static inline __attribute__((const)) int is_power_of_2(unsigned long num)
 {
        return (num != 0 && ((num & (num - 1)) == 0));