summaryrefslogtreecommitdiffstats
path: root/carg_parser.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 11:37:40 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-06 11:37:40 +0000
commitc33e1de813af248d4249725ac859dd3a26393704 (patch)
tree2a277fd093d46566d11b96d68ee4b9ba950e96be /carg_parser.c
parentAdding upstream version 1.4. (diff)
downloadclzip-c33e1de813af248d4249725ac859dd3a26393704.tar.xz
clzip-c33e1de813af248d4249725ac859dd3a26393704.zip
Adding upstream version 1.5~pre1.upstream/1.5_pre1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'carg_parser.c')
-rw-r--r--carg_parser.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/carg_parser.c b/carg_parser.c
index 973bb7e..a86f76f 100644
--- a/carg_parser.c
+++ b/carg_parser.c
@@ -1,5 +1,5 @@
/* Arg_parser - POSIX/GNU command line argument parser. (C version)
- Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
Antonio Diaz Diaz.
This library is free software: you can redistribute it and/or modify
@@ -89,15 +89,14 @@ static char parse_long_option( struct Arg_parser * const ap,
int * const argindp )
{
unsigned len;
- int index = -1;
- int i;
+ int index = -1, i;
char exact = 0, ambig = 0;
for( len = 0; opt[len+2] && opt[len+2] != '='; ++len ) ;
/* Test all long options for either exact match or abbreviated matches. */
for( i = 0; options[i].code != 0; ++i )
- if( options[i].name && !strncmp( options[i].name, &opt[2], len ) )
+ if( options[i].name && strncmp( options[i].name, &opt[2], len ) == 0 )
{
if( strlen( options[i].name ) == len ) /* Exact match found */
{ index = i; exact = 1; break; }
@@ -165,8 +164,7 @@ static char parse_short_option( struct Arg_parser * const ap,
while( cind > 0 )
{
- int index = -1;
- int i;
+ int index = -1, i;
const unsigned char code = opt[cind];
char code_str[2];
code_str[0] = code; code_str[1] = 0;