From: Michael Meffie Date: Sat, 25 Jul 2009 19:28:07 +0000 (-0400) Subject: Allow gnu-style long options X-Git-Tag: openafs-devel-1_5_66~110 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=6ef4627412ed554f3a3c0d7c2e1b9132b3a624d0;p=packages%2Fo%2Fopenafs.git Allow gnu-style long options New users are surprised when OpenAFS command options cannot be prefixed with two dashes, as is common with most modern tools. Permit an extra dash for common commands when more than one character is given. For example vos listvol --server foo.bar.com is equivalent to vos listvol -server foo.bar.com, but vos listvol --s foo.bar.com is an error. Reviewed-on: http://gerrit.openafs.org/216 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/cmd/cmd.c b/src/cmd/cmd.c index 9aae393bf..66b4ef4a6 100644 --- a/src/cmd/cmd.c +++ b/src/cmd/cmd.c @@ -76,6 +76,11 @@ FindType(register struct cmd_syndesc *as, register char *aname) int ambig; int best; + /* Allow --long-style options. */ + if (aname[0] == '-' && aname[1] == '-' && aname[2] && aname[3]) { + aname++; + } + cmdlen = strlen(aname); ambig = 0; best = -1;