From 6ef4627412ed554f3a3c0d7c2e1b9132b3a624d0 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Sat, 25 Jul 2009 15:28:07 -0400 Subject: [PATCH] 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 --- src/cmd/cmd.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.39.5