wcmd: Modify option parser to allow compound options.

This commit is contained in:
Thomas Kho 2006-06-30 21:02:31 -05:00 committed by Alexandre Julliard
parent 343597b336
commit 543716e114
1 changed files with 19 additions and 10 deletions

View File

@ -61,21 +61,30 @@ int main (int argc, char *argv[])
opt_c=opt_k=opt_q=0; opt_c=opt_k=opt_q=0;
while (*argv!=NULL) while (*argv!=NULL)
{ {
if (lstrcmpi(*argv,"/c")==0) { char c;
if ((*argv)[0]!='/' || (*argv)[1]=='\0') {
argv++;
continue;
}
c=(*argv)[1];
if (tolower(c)=='c') {
opt_c=1; opt_c=1;
argv++; } else if (tolower(c)=='q') {
break;
} else if (lstrcmpi(*argv,"/q")==0) {
opt_q=1; opt_q=1;
} else if (lstrcmpi(*argv,"/k")==0) { } else if (tolower(c)=='k') {
opt_k=1; opt_k=1;
argv++; } else if (tolower(c)=='t' || tolower(c)=='x' || tolower(c)=='y') {
break;
} else if (lstrcmpi(*argv,"/t")==0 || lstrcmpi(*argv,"/x")==0 ||
lstrcmpi(*argv,"/y")==0) {
/* Ignored for compatibility with Windows */ /* Ignored for compatibility with Windows */
} }
if ((*argv)[2]==0)
argv++; argv++;
else /* handle `cmd /cnotepad.exe` and `cmd /x/c ...` */
*argv+=2;
if (opt_c || opt_k) /* break out of parsing immediately after c or k */
break;
} }
if (opt_q) { if (opt_q) {