summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/cmndline.cc
diff options
context:
space:
mode:
authorMichael Vogt <egon@debian-devbox>2012-06-11 14:56:11 +0200
committerMichael Vogt <egon@debian-devbox>2012-06-11 14:56:11 +0200
commitcb6a5776bfb5f74d94f32db55f2de148c27a5d10 (patch)
tree3c8f8bcaeefb9e51bff8476b262de18b4b39b11b /apt-pkg/contrib/cmndline.cc
parent563fd891d80feedefd812aad83844e2189870e2c (diff)
parent249a02f55a2b311fc130efe3b3a99995b6a71360 (diff)
merged from donkult
Diffstat (limited to 'apt-pkg/contrib/cmndline.cc')
-rw-r--r--apt-pkg/contrib/cmndline.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc
index 159f330a1..75d02cad4 100644
--- a/apt-pkg/contrib/cmndline.cc
+++ b/apt-pkg/contrib/cmndline.cc
@@ -92,8 +92,9 @@ bool CommandLine::Parse(int argc,const char **argv)
// Match up to a = against the list
Args *A;
const char *OptEnd = strchrnul(Opt, '=');
- for (A = ArgList; A->end() == false &&
- stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++);
+ for (A = ArgList; A->end() == false &&
+ (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0);
+ ++A);
// Failed, look for a word after the first - (no-foo)
bool PreceedMatch = false;
@@ -105,7 +106,8 @@ bool CommandLine::Parse(int argc,const char **argv)
Opt++;
for (A = ArgList; A->end() == false &&
- stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++);
+ (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0);
+ ++A);
// Failed again..
if (A->end() == true && OptEnd - Opt != 1)