aboutsummaryrefslogtreecommitdiffstats
path: root/src/argparser.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-08-27 23:15:41 +0200
committerMattias Andrée <maandree@operamail.com>2013-08-27 23:15:41 +0200
commitf5665923655e8743376969b27ddd8feee47eb84a (patch)
treec03ee02e9773e5a8a07c62b8fac795373c960341 /src/argparser.c
parentc fix (diff)
downloadargparser-f5665923655e8743376969b27ddd8feee47eb84a.tar.gz
argparser-f5665923655e8743376969b27ddd8feee47eb84a.tar.bz2
argparser-f5665923655e8743376969b27ddd8feee47eb84a.tar.xz
version common bugs
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/argparser.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/argparser.c b/src/argparser.c
index aa9650a..7bbcb26 100644
--- a/src/argparser.c
+++ b/src/argparser.c
@@ -1382,7 +1382,7 @@ long args_parse(int argc, char** argv)
argqueue = (char**)malloc(queuesize * sizeof(char*));
optqueue = (char**)malloc(queuesize * sizeof(char*));
- args_freequeue = (void**)malloc(queuesize * sizeof(void*));
+ args_freequeue = (void**)malloc(queuesize * sizeof(void*) * 2);
while ((argv != argend) || injection)
{
@@ -1461,7 +1461,23 @@ long args_parse(int argc, char** argv)
}
else
{
- if ((injection = args__abbreviations(arg_opt)) == null)
+ if ((injection = args__abbreviations(arg_opt)))
+ {
+ long n = 1, i, j = 0;
+ char* _injection;
+ for (i = 0; *(injection + i); i++)
+ n++;
+ for (i = eq + 1; *(arg + i); i++)
+ n++;
+ *(args_freequeue + args_freeptr++) = _injection = (char*)malloc((n + 1) * sizeof(char));
+ for (i = 0; *(injection + i); i++)
+ *(_injection + j++) = *(injection + i);
+ *((injection = _injection) + j++) = '=';
+ for (i = eq + 1; *(arg + i); i++)
+ *(injection + j++) = *(arg + i);
+ *(injection + j) = 0;
+ }
+ else
{
if (++args_unrecognised_count <= 5)
fprintf(args_out, "%s: warning: unrecognised option %s\n", args_program, arg_opt);