From 142f038ca9fe999022e0617a83e1951edca493fd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 21 Aug 2013 22:04:43 +0200 Subject: derp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/argparser.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/argparser.c b/src/argparser.c index ae77833..7e9fff5 100644 --- a/src/argparser.c +++ b/src/argparser.c @@ -1081,7 +1081,7 @@ void args_help(long use_colours) while (*(arg + m)) m++; l = maxfirstlen + 6 + n + m; - *(lines + count) = line = (char*)malloc((1 + 17 + 16 + 8 + maxfirstlen + n) * sizeof(char)); + *(lines + count) = line = (char*)malloc((9 + maxfirstlen + 7 + 15 + n + 9 + 6 + m + 5 + 1) * sizeof(char)); for (j = 0; *((use_colours ? " \033[02m" : " ") + j); j++) *line++ = *((use_colours ? " \033[02m" : " ") + j); for (j = 0; *(first + j); j++) @@ -1146,7 +1146,7 @@ void args_help(long use_colours) *(empty + col) = 0; for (i = 0; i < copts; i++) { - long first = true, j = 0, jptr = 0; + long first = true, j = 0, jptr = 1; char* colour = (index & 1) == 0 ? "36" : "34"; char* help = args_options_get_help(i); char* line; @@ -1155,10 +1155,7 @@ void args_help(long use_colours) char c; if (help == null) continue; - fprintf(args_out, "%s", line = *(lines + index)); - while (*line++) - ; - fprintf(args_out, "%s%s", line, empty + *(lens + index)); + fprintf(args_out, "%s%s", line = *(lines + index), empty + *(lens + index)); free(*(lines + index++)); while ((c = *(help + j++))) if (c == '\n') -- cgit v1.2.3-70-g09d2