fix short option always eat next argument

This commit is contained in:
Hideyuki Tanaka 2009-10-23 15:02:46 +09:00
parent a27c759a73
commit b177d663d0
2 changed files with 7 additions and 7 deletions

View File

@ -287,13 +287,13 @@ public:
continue;
}
if (i+1>=argc || strncmp(argv[i+1], "-", 1)==0 ||
!options[lookup[last]]->has_value()){
set_option(lookup[last]);
continue;
if (i+1<argc && options[lookup[last]]->has_value()){
set_option(lookup[last], argv[i+1]);
i++;
}
else{
set_option(lookup[last]);
}
set_option(lookup[last], argv[i+1]);
i++;
}
else{
others.push_back(argv[i]);

View File

@ -39,7 +39,7 @@ int main(int argc, char *argv[])
a.footer("ファイル名 ...");
if (argc==1){
cerr<<a.usage()<<endl;
cerr<<a.usage();
return 0;
}