* g10.c (main): Give a deprecated option warning for --show-keyring,
authorDavid Shaw <dshaw@jabberwocky.com>
Fri, 10 Oct 2003 03:05:05 +0000 (03:05 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Fri, 10 Oct 2003 03:05:05 +0000 (03:05 +0000)
--show-photos, --show-policy-url, --show-notation, and their respective
no- forms.

* options.skel: Remove show-photos and replace with list/verify-options
show-photos.  Remove no-mangle-dos-filenames.

* misc.c (parse_options): Allow for incomplete (but unambiguous) options.

g10/ChangeLog
g10/g10.c
g10/misc.c
g10/options.skel

index 324b96e..9cfc794 100644 (file)
@@ -1,3 +1,15 @@
+2003-10-09  David Shaw  <dshaw@jabberwocky.com>
+
+       * g10.c (main): Give a deprecated option warning for
+       --show-keyring, --show-photos, --show-policy-url, --show-notation,
+       and their respective no- forms.
+
+       * options.skel: Remove show-photos and replace with
+       list/verify-options show-photos.  Remove no-mangle-dos-filenames.
+
+       * misc.c (parse_options): Allow for incomplete (but unambiguous)
+       options.
+
 2003-10-09  Werner Koch  <wk@gnupg.org>
 
        * ccid-driver.c (ccid_transceive): Add T=1 chaining for sending.
index d925c36..db8e7d2 100644 (file)
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -1464,7 +1464,11 @@ main( int argc, char **argv )
            sl=append_to_strlist( &nrings, pargs.r.ret_str);
            sl->flags=2;
            break;
-         case oShowKeyring: opt.list_options|=LIST_SHOW_KEYRING; break;
+         case oShowKeyring:
+           deprecated_warning(configname,configlineno,"--show-keyring",
+                              "--list-options ","show-keyring");
+           opt.list_options|=LIST_SHOW_KEYRING;
+           break;
          case oDebug: opt.debug |= pargs.r.ret_ulong; break;
          case oDebugAll: opt.debug = ~0; break;
          case oStatusFD:
@@ -1637,10 +1641,18 @@ main( int argc, char **argv )
          case oSigPolicyURL: add_policy_url(pargs.r.ret_str,0); break;
          case oCertPolicyURL: add_policy_url(pargs.r.ret_str,1); break;
           case oShowPolicyURL:
+           deprecated_warning(configname,configlineno,"--show-policy-url",
+                              "--list-options ","show-policy-url");
+           deprecated_warning(configname,configlineno,"--show-policy-url",
+                              "--verify-options ","show-policy-url");
            opt.list_options|=LIST_SHOW_POLICY;
            opt.verify_options|=VERIFY_SHOW_POLICY;
            break;
          case oNoShowPolicyURL:
+           deprecated_warning(configname,configlineno,"--no-show-policy-url",
+                              "--list-options ","no-show-policy-url");
+           deprecated_warning(configname,configlineno,"--no-show-policy-url",
+                              "--verify-options ","no-show-policy-url");
            opt.list_options&=~LIST_SHOW_POLICY;
            opt.verify_options&=~VERIFY_SHOW_POLICY;
            break;
@@ -1657,11 +1669,19 @@ main( int argc, char **argv )
            break;
          case oThrowKeyid: opt.throw_keyid = 1; break;
          case oNoThrowKeyid: opt.throw_keyid = 0; break;
-         case oShowPhotos: 
+         case oShowPhotos:
+           deprecated_warning(configname,configlineno,"--show-photos",
+                              "--list-options ","show-photos");
+           deprecated_warning(configname,configlineno,"--show-photos",
+                              "--verify-options ","show-photos");
            opt.list_options|=LIST_SHOW_PHOTOS;
            opt.verify_options|=VERIFY_SHOW_PHOTOS;
            break;
          case oNoShowPhotos:
+           deprecated_warning(configname,configlineno,"--no-show-photos",
+                              "--list-options ","no-show-photos");
+           deprecated_warning(configname,configlineno,"--no-show-photos",
+                              "--verify-options ","no-show-photos");
            opt.list_options&=~LIST_SHOW_PHOTOS;
            opt.verify_options&=~VERIFY_SHOW_PHOTOS;
            break;
@@ -1865,10 +1885,18 @@ main( int argc, char **argv )
          case oSigNotation: add_notation_data( pargs.r.ret_str, 0 ); break;
          case oCertNotation: add_notation_data( pargs.r.ret_str, 1 ); break;
          case oShowNotation:
+           deprecated_warning(configname,configlineno,"--show-notation",
+                              "--list-options ","show-notation");
+           deprecated_warning(configname,configlineno,"--show-notation",
+                              "--verify-options ","show-notation");
            opt.list_options|=LIST_SHOW_NOTATION;
            opt.verify_options|=VERIFY_SHOW_NOTATION;
            break;
          case oNoShowNotation:
+           deprecated_warning(configname,configlineno,"--no-show-notation",
+                              "--list-options ","no-show-notation");
+           deprecated_warning(configname,configlineno,"--no-show-notation",
+                              "--verify-options ","no-show-notation");
            opt.list_options&=~LIST_SHOW_NOTATION;
            opt.verify_options&=~VERIFY_SHOW_NOTATION;
            break;
index c98c975..01a38a4 100644 (file)
@@ -672,6 +672,7 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts)
   while((tok=strsep(&str," ,")))
     {
       int i,rev=0;
+      char *otok=tok;
 
       if(tok[0]=='\0')
        continue;
@@ -684,8 +685,25 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts)
 
       for(i=0;opts[i].name;i++)
        {
-         if(ascii_strcasecmp(opts[i].name,tok)==0)
+         size_t toklen=strlen(tok);
+
+         if(ascii_strncasecmp(opts[i].name,tok,toklen)==0)
            {
+             /* We have a match, but it might be incomplete */
+             if(toklen!=strlen(opts[i].name))
+               {
+                 int j;
+
+                 for(j=i+1;opts[j].name;j++)
+                   {
+                     if(ascii_strncasecmp(opts[j].name,tok,toklen)==0)
+                       {
+                         log_info(_("ambiguous option `%s'\n"),otok);
+                         return 0;
+                       }
+                   }
+               }
+
              if(rev)
                *options&=~opts[i].bit;
              else
@@ -695,7 +713,10 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts)
        }
 
       if(!opts[i].name)
-       return 0;
+       {
+         log_info(_("unknown option `%s'\n"),otok);
+         return 0;
+       }
     }
 
   return 1;
index 3d15f81..17dc060 100644 (file)
 
 #group mynames = paige 0x12345678 joe patti
 
-# Some old Windows platforms require 8.3 filenames.  If your system
-# can handle long filenames, uncomment this.
-
-#no-mangle-dos-filenames
-
 # Lock the file only once for the lifetime of a process.  If you do
 # not define this, the lock will be obtained and released every time
-# it is needed - normally this is not needed.
+# it is needed, which is usually preferable.
 
 #lock-once
 
@@ -155,10 +150,14 @@ keyserver hkp://subkeys.pgp.net
 
 #keyserver-options auto-key-retrieve
 
-# Uncomment this line to display photo user IDs in key listings and
-# when a signature from a key with a photo is verified.
+# Display photo user IDs in key listings
+
+# list-options show-photos
+
+# Display photo user IDs when a signature from a key with a photo is
+# verified
 
-#show-photos
+# verify-options show-photos
 
 # Use this program to display photo user IDs
 #