cifs.upcall: switch to getopt_long
authorJeff Layton <jlayton@redhat.com>
Wed, 14 Oct 2009 14:58:48 +0000 (10:58 -0400)
committerKarolin Seeger <kseeger@samba.org>
Fri, 16 Oct 2009 13:02:52 +0000 (15:02 +0200)
...to allow long option names.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
source3/client/cifs.upcall.c

index f433e495c6879f910586657ffc83fa37d441b0b9..1a35854cb5d70722e93f1b69a53d93b87c7541f1 100644 (file)
@@ -27,6 +27,7 @@ create dns_resolver * * /usr/local/sbin/cifs.upcall %k
 
 #include "includes.h"
 #include <keyutils.h>
+#include <getopt.h>
 
 #include "cifs_spnego.h"
 
@@ -357,6 +358,11 @@ usage(void)
        fprintf(stderr, "Usage: %s [-v] key_serial\n", prog);
 }
 
+const struct option long_options[] = {
+       { "version",    0, NULL, 'v' },
+       { NULL,         0, NULL, 0 }
+};
+
 int main(const int argc, char *const argv[])
 {
        struct cifs_spnego_msg *keydata = NULL;
@@ -374,7 +380,7 @@ int main(const int argc, char *const argv[])
 
        openlog(prog, 0, LOG_DAEMON);
 
-       while ((c = getopt(argc, argv, "cv")) != -1) {
+       while ((c = getopt_long(argc, argv, "cv", long_options, NULL)) != -1) {
                switch (c) {
                case 'c':
                        /* legacy option -- skip it */