X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fopt%2Fusage.c;fp=ccan%2Fopt%2Fusage.c;h=e96298382c3d018f16b55281115ceace40164939;hp=4ed279197fe808ac391d39a93df1dbb9e8b14126;hb=995d2aff223e70ef5c60ac0416645b27ac84d5ff;hpb=4bfa8587c9b7c8450320232837c6481d07ce77f6 diff --git a/ccan/opt/usage.c b/ccan/opt/usage.c index 4ed27919..e9629838 100644 --- a/ccan/opt/usage.c +++ b/ccan/opt/usage.c @@ -20,6 +20,9 @@ const char opt_hidden[1]; #define MIN_DESC_WIDTH 40 #define MIN_TOTAL_WIDTH 50 +/* Maximum length of arg to show in opt_usage */ +#define OPT_SHOW_LEN 80 + static unsigned int get_columns(void) { int ws_col = 0; @@ -148,7 +151,7 @@ static char *add_desc(char *base, size_t *len, size_t *max, if (opt->show) { char buf[OPT_SHOW_LEN + sizeof("...")]; strcpy(buf + OPT_SHOW_LEN, "..."); - opt->show(buf, opt->u.arg); + opt->show(buf, OPT_SHOW_LEN, opt->u.arg); /* If it doesn't fit on this line, indent. */ if (off + strlen(" (default: ") + strlen(buf) + strlen(")")