X-Git-Url: http://git.draconx.ca/gitweb/dxcommon.git/blobdiff_plain/c3f53b697f5dd5ecd5a5f74e94ec0fd55b0f2764..f7845ef1698291a23975052a100c12bf38a0664d:/src/help.c diff --git a/src/help.c b/src/help.c index 4b77b2c..3aa0830 100644 --- a/src/help.c +++ b/src/help.c @@ -202,17 +202,11 @@ void help_print_desc(const struct option *opt, const char *s, int i, int w) if (opt) s = pgettext_expr(opt->name, s); - if (i && s[0] == '\0') - putchar('\n'); - - for (; *s; w = 0) { - const char *nl = strchr(s, '\n'); - int n = (nl ? nl-s : -1); + do { + size_t n = strcspn(s, "\n"); - printf("%*s%.*s\n", i-w, "", n, s); - if (!nl) - break; - - s = nl+1; - } + printf("%*s%.*s\n", n ? i-w : 0, "", (int)n, s); + s += n + (s[n] != '\0'); + w = 0; + } while (*s); }