opt: add integer helpers that accept k, M, G, T, P, E suffixes
[ccan] / ccan / opt / usage.c
index 60e1586861adc0981a5bf0eaf00bc63bcff450a4..f321ed2949a8bfb7cd5cdbce5955780dba1cd233 100644 (file)
@@ -1,3 +1,4 @@
+/* Licensed under GPLv3+ - see LICENSE file for details */
 #include <ccan/opt/opt.h>
 #include <string.h>
 #include <stdlib.h>
@@ -32,8 +33,8 @@ char *opt_usage(const char *argv0, const char *extra)
                extra = "";
                for (i = 0; i < opt_count; i++) {
                        if (opt_table[i].cb == (void *)opt_usage_and_exit
-                           && opt_table[i].arg) {
-                               extra = opt_table[i].arg;
+                           && opt_table[i].u.carg) {
+                               extra = opt_table[i].u.carg;
                                break;
                        }
                }
@@ -100,7 +101,7 @@ char *opt_usage(const char *argv0, const char *extra)
                if (opt_table[i].show) {
                        char buf[OPT_SHOW_LEN + sizeof("...")];
                        strcpy(buf + OPT_SHOW_LEN, "...");
-                       opt_table[i].show(buf, opt_table[i].arg);
+                       opt_table[i].show(buf, opt_table[i].u.arg);
                        len += sprintf(p + len, " (default: %s)", buf);
                }
                p += len;