diff --git a/g10/ChangeLog b/g10/ChangeLog index db17bdbd2..a506df8f7 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,12 @@ +2003-12-27 David Shaw + + * main.h, misc.c (parse_options): Add a "noisy" flag to enable and + disable the messages about which option didn't match or matched + ambiguously. Change all callers (g10.c, keyserver.c). + + * main.h, import.c (import_options), export.c (export_options): + Pass the noisy flag through. + 2003-12-17 David Shaw * build-packet.c (write_fake_data, do_secret_key), seckey-cert.c diff --git a/g10/export.c b/g10/export.c index d98257144..c8a2be8ed 100644 --- a/g10/export.c +++ b/g10/export.c @@ -1,5 +1,6 @@ /* export.c - * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002 + * 2003 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -40,7 +41,7 @@ static int do_export_stream( IOBUF out, STRLIST users, int secret, int *any ); int -parse_export_options(char *str,unsigned int *options) +parse_export_options(char *str,unsigned int *options,int noisy) { struct parse_options export_opts[]= { @@ -52,7 +53,7 @@ parse_export_options(char *str,unsigned int *options) /* add tags for include revoked and disabled? */ }; - return parse_options(str,options,export_opts); + return parse_options(str,options,export_opts,noisy); } /**************** diff --git a/g10/g10.c b/g10/g10.c index 435d833ac..2486af3db 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -1873,7 +1873,7 @@ main( int argc, char **argv ) parse_keyserver_options(pargs.r.ret_str); break; case oImportOptions: - if(!parse_import_options(pargs.r.ret_str,&opt.import_options)) + if(!parse_import_options(pargs.r.ret_str,&opt.import_options,1)) { if(configname) log_error(_("%s:%d: invalid import options\n"), @@ -1883,7 +1883,7 @@ main( int argc, char **argv ) } break; case oExportOptions: - if(!parse_export_options(pargs.r.ret_str,&opt.export_options)) + if(!parse_export_options(pargs.r.ret_str,&opt.export_options,1)) { if(configname) log_error(_("%s:%d: invalid export options\n"), @@ -1908,7 +1908,7 @@ main( int argc, char **argv ) {NULL,0} }; - if(!parse_options(pargs.r.ret_str,&opt.list_options,lopts)) + if(!parse_options(pargs.r.ret_str,&opt.list_options,lopts,1)) { if(configname) log_error(_("%s:%d: invalid list options\n"), @@ -1932,7 +1932,7 @@ main( int argc, char **argv ) {NULL,0} }; - if(!parse_options(pargs.r.ret_str,&opt.verify_options,vopts)) + if(!parse_options(pargs.r.ret_str,&opt.verify_options,vopts,1)) { if(configname) log_error(_("%s:%d: invalid verify options\n"), diff --git a/g10/import.c b/g10/import.c index d13357b6a..b06e52f20 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1,6 +1,6 @@ /* import.c - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 - * Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, + * 2003 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -84,7 +84,7 @@ static int merge_keysigs( KBNODE dst, KBNODE src, int *n_sigs, const char *fname, u32 *keyid ); int -parse_import_options(char *str,unsigned int *options) +parse_import_options(char *str,unsigned int *options,int noisy) { struct parse_options import_opts[]= { @@ -96,7 +96,7 @@ parse_import_options(char *str,unsigned int *options) {NULL,0} }; - return parse_options(str,options,import_opts); + return parse_options(str,options,import_opts,noisy); } void * diff --git a/g10/keyserver.c b/g10/keyserver.c index 7ec744c66..279a4e37e 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -1,5 +1,5 @@ /* keyserver.c - generic keyserver code - * Copyright (C) 2001, 2002 Free Software Foundation, Inc. + * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -123,9 +123,10 @@ parse_keyserver_options(char *options) #endif else if(!parse_import_options(tok, - &opt.keyserver_options.import_options) && + &opt.keyserver_options.import_options,0) + && !parse_export_options(tok, - &opt.keyserver_options.export_options)) + &opt.keyserver_options.export_options,0)) add_to_strlist(&opt.keyserver_options.other,tok); } } diff --git a/g10/main.h b/g10/main.h index b3504907f..da627ba32 100644 --- a/g10/main.h +++ b/g10/main.h @@ -108,7 +108,8 @@ struct parse_options unsigned int bit; }; -int parse_options(char *str,unsigned int *options,struct parse_options *opts); +int parse_options(char *str,unsigned int *options, + struct parse_options *opts,int noisy); /*-- helptext.c --*/ void display_online_help( const char *keyword ); @@ -177,7 +178,7 @@ KBNODE make_comment_node( const char *s ); KBNODE make_mpi_comment_node( const char *s, MPI a ); /*-- import.c --*/ -int parse_import_options(char *str,unsigned int *options); +int parse_import_options(char *str,unsigned int *options,int noisy); void import_keys( char **fnames, int nnames, void *stats_hd, unsigned int options ); int import_keys_stream( IOBUF inp, @@ -189,7 +190,7 @@ void import_print_stats (void *hd); int collapse_uids( KBNODE *keyblock ); /*-- export.c --*/ -int parse_export_options(char *str,unsigned int *options); +int parse_export_options(char *str,unsigned int *options,int noisy); int export_pubkeys( STRLIST users, unsigned int options ); int export_pubkeys_stream( IOBUF out, STRLIST users, KBNODE *keyblock_out, unsigned int options ); diff --git a/g10/misc.c b/g10/misc.c index 7ee6d2d67..229436cf5 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -689,7 +689,8 @@ compliance_failure(void) } int -parse_options(char *str,unsigned int *options,struct parse_options *opts) +parse_options(char *str,unsigned int *options, + struct parse_options *opts,int noisy) { char *tok; @@ -722,7 +723,8 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts) { if(ascii_strncasecmp(opts[j].name,tok,toklen)==0) { - log_info(_("ambiguous option `%s'\n"),otok); + if(noisy) + log_info(_("ambiguous option `%s'\n"),otok); return 0; } } @@ -738,7 +740,8 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts) if(!opts[i].name) { - log_info(_("unknown option `%s'\n"),otok); + if(noisy) + log_info(_("unknown option `%s'\n"),otok); return 0; } }