]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Allow gnu-style long options
authorMichael Meffie <mmeffie@sinenomine.net>
Sat, 25 Jul 2009 19:28:07 +0000 (15:28 -0400)
committerDerrick Brashear <shadow|account-1000005@unknown>
Wed, 7 Oct 2009 21:42:21 +0000 (14:42 -0700)
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 <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/cmd/cmd.c

index 9aae393bfc23cb1e2cc8d0078dcb88b8bba42c69..66b4ef4a6149df2563dae85bf4da0b896c255fea 100644 (file)
@@ -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;