aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-08-21 22:04:43 +0200
committerMattias Andrée <maandree@operamail.com>2013-08-21 22:04:43 +0200
commit142f038ca9fe999022e0617a83e1951edca493fd (patch)
treee5b1be402380a34b5b948c876f87ccd02537c7b7
parentmissed to close file (diff)
downloadargparser-142f038ca9fe999022e0617a83e1951edca493fd.tar.gz
argparser-142f038ca9fe999022e0617a83e1951edca493fd.tar.bz2
argparser-142f038ca9fe999022e0617a83e1951edca493fd.tar.xz
derp
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/argparser.c9
1 files changed, 3 insertions, 6 deletions
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')