]> git.draconx.ca Git - dxcommon.git/blobdiff - src/help.c
xtra: Avoid undefined ## usage.
[dxcommon.git] / src / help.c
index b09833a4a1cbd3e0a48e2a436cb087876128dcd7..43bb266d4df4dc8c5dc17ed7519abd49d1bdb088 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2021 Nick Bowler
+ * Copyright © 2021-2022 Nick Bowler
  *
  * Helper functions for formatting --help program output.
  *
@@ -28,6 +28,7 @@
 #endif
 
 #if ENABLE_NLS
+#      include <locale.h>
 #      include <gettext.h>
 #      include <mbswidth.h>
 #else
  */
 static int option_type(const struct option *opt)
 {
-       return ((opt->val <= CHAR_MAX) << 2) | (opt->has_arg & 3);
+       int ret = opt->has_arg & 3;
+
+       if (!opt->flag)
+               ret |= (opt->val <= CHAR_MAX) << 2;
+
+       return ret;
 }
 
 enum {