+
+void opt_show_bool(char buf[OPT_SHOW_LEN], const bool *b)
+{
+ strncpy(buf, *b ? "true" : "false", OPT_SHOW_LEN);
+}
+
+void opt_show_invbool(char buf[OPT_SHOW_LEN], const bool *b)
+{
+ strncpy(buf, *b ? "false" : "true", OPT_SHOW_LEN);
+}
+
+void opt_show_charp(char buf[OPT_SHOW_LEN], char *const *p)
+{
+ size_t len = strlen(*p);
+ buf[0] = '"';
+ if (len > OPT_SHOW_LEN - 2)
+ len = OPT_SHOW_LEN - 2;
+ strncpy(buf+1, *p, len);
+ buf[1+len] = '"';
+ if (len < OPT_SHOW_LEN - 2)
+ buf[2+len] = '\0';
+}
+
+/* Set an integer value, various forms. Sets to 1 on arg == NULL. */
+void opt_show_intval(char buf[OPT_SHOW_LEN], const int *i)
+{
+ snprintf(buf, OPT_SHOW_LEN, "%i", *i);
+}
+
+void opt_show_uintval(char buf[OPT_SHOW_LEN], const unsigned int *ui)
+{
+ snprintf(buf, OPT_SHOW_LEN, "%u", *ui);
+}
+
+void opt_show_longval(char buf[OPT_SHOW_LEN], const long *l)
+{
+ snprintf(buf, OPT_SHOW_LEN, "%li", *l);
+}
+
+void opt_show_ulongval(char buf[OPT_SHOW_LEN], const unsigned long *ul)
+{
+ snprintf(buf, OPT_SHOW_LEN, "%lu", *ul);
+}