aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-08-27 22:59:10 +0200
committerMattias Andrée <maandree@operamail.com>2013-08-27 22:59:10 +0200
commitace390c5f03c2b87fff617e66ddec3ad75f6a93d (patch)
treed6439bee857c9d0d959222927e28ac861eccb766
parentderp (diff)
downloadargparser-ace390c5f03c2b87fff617e66ddec3ad75f6a93d.tar.gz
argparser-ace390c5f03c2b87fff617e66ddec3ad75f6a93d.tar.bz2
argparser-ace390c5f03c2b87fff617e66ddec3ad75f6a93d.tar.xz
c fix
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/argparser.c4
-rw-r--r--src/test.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/argparser.c b/src/argparser.c
index f274fd3..aa9650a 100644
--- a/src/argparser.c
+++ b/src/argparser.c
@@ -242,7 +242,7 @@ char* args_standard_abbreviations(char* argument, char** options, long count)
for (i = 0; i < count; i++)
{
long match = 0;
- char* opt = *options;
+ char* opt = *(options + i);
while (*(argument + match) && (*(opt + match) == *(argument + match)))
match++;
if (*(argument + match) == 0)
@@ -1461,7 +1461,7 @@ long args_parse(int argc, char** argv)
}
else
{
- if ((injection = args__abbreviations(arg)) == null)
+ if ((injection = args__abbreviations(arg_opt)) == null)
{
if (++args_unrecognised_count <= 5)
fprintf(args_out, "%s: warning: unrecognised option %s\n", args_program, arg_opt);
diff --git a/src/test.c b/src/test.c
index 9d65b2e..59c5d9c 100644
--- a/src/test.c
+++ b/src/test.c
@@ -69,14 +69,14 @@ int main(int argc, char** argv)
i = 0;
arr = args_opts_get("--line");
for (n = args_opts_get_count("--line"); i < n; i++)
- printf("%s\n", *(arr + i));
+ printf("%s\n", *(arr + i) ? *(arr + i) : "(null)");
}
if (args_opts_used("-L"))
{
i = 0;
arr = args_opts_get("--Line");
for (n = args_opts_get_count("--Line"); i < n; i++)
- printf("%s\n", *(arr + i));
+ printf("%s\n", *(arr + i) ? *(arr + i) : "(null)");
}
if (args_opts_used("--lines"))
{