1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-10 13:04:23 +01:00

* 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.
This commit is contained in:
David Shaw 2003-12-28 03:46:43 +00:00
parent 7847eae02c
commit 392e6da660
7 changed files with 35 additions and 20 deletions

View File

@ -1,3 +1,12 @@
2003-12-27 David Shaw <dshaw@jabberwocky.com>
* 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 <dshaw@localhost.localdomain> 2003-12-17 David Shaw <dshaw@localhost.localdomain>
* build-packet.c (write_fake_data, do_secret_key), seckey-cert.c * build-packet.c (write_fake_data, do_secret_key), seckey-cert.c

View File

@ -1,5 +1,6 @@
/* export.c /* 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. * This file is part of GnuPG.
* *
@ -40,7 +41,7 @@ static int do_export_stream( IOBUF out, STRLIST users, int secret,
int *any ); int *any );
int int
parse_export_options(char *str,unsigned int *options) parse_export_options(char *str,unsigned int *options,int noisy)
{ {
struct parse_options export_opts[]= struct parse_options export_opts[]=
{ {
@ -52,7 +53,7 @@ parse_export_options(char *str,unsigned int *options)
/* add tags for include revoked and disabled? */ /* add tags for include revoked and disabled? */
}; };
return parse_options(str,options,export_opts); return parse_options(str,options,export_opts,noisy);
} }
/**************** /****************

View File

@ -1873,7 +1873,7 @@ main( int argc, char **argv )
parse_keyserver_options(pargs.r.ret_str); parse_keyserver_options(pargs.r.ret_str);
break; break;
case oImportOptions: 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) if(configname)
log_error(_("%s:%d: invalid import options\n"), log_error(_("%s:%d: invalid import options\n"),
@ -1883,7 +1883,7 @@ main( int argc, char **argv )
} }
break; break;
case oExportOptions: 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) if(configname)
log_error(_("%s:%d: invalid export options\n"), log_error(_("%s:%d: invalid export options\n"),
@ -1908,7 +1908,7 @@ main( int argc, char **argv )
{NULL,0} {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) if(configname)
log_error(_("%s:%d: invalid list options\n"), log_error(_("%s:%d: invalid list options\n"),
@ -1932,7 +1932,7 @@ main( int argc, char **argv )
{NULL,0} {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) if(configname)
log_error(_("%s:%d: invalid verify options\n"), log_error(_("%s:%d: invalid verify options\n"),

View File

@ -1,6 +1,6 @@
/* import.c /* import.c
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 * Copyright (C) 1998, 1999, 2000, 2001, 2002,
* Free Software Foundation, Inc. * 2003 Free Software Foundation, Inc.
* *
* This file is part of GnuPG. * 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 ); const char *fname, u32 *keyid );
int int
parse_import_options(char *str,unsigned int *options) parse_import_options(char *str,unsigned int *options,int noisy)
{ {
struct parse_options import_opts[]= struct parse_options import_opts[]=
{ {
@ -96,7 +96,7 @@ parse_import_options(char *str,unsigned int *options)
{NULL,0} {NULL,0}
}; };
return parse_options(str,options,import_opts); return parse_options(str,options,import_opts,noisy);
} }
void * void *

View File

@ -1,5 +1,5 @@
/* keyserver.c - generic keyserver code /* 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. * This file is part of GnuPG.
* *
@ -123,9 +123,10 @@ parse_keyserver_options(char *options)
#endif #endif
else else
if(!parse_import_options(tok, if(!parse_import_options(tok,
&opt.keyserver_options.import_options) && &opt.keyserver_options.import_options,0)
&&
!parse_export_options(tok, !parse_export_options(tok,
&opt.keyserver_options.export_options)) &opt.keyserver_options.export_options,0))
add_to_strlist(&opt.keyserver_options.other,tok); add_to_strlist(&opt.keyserver_options.other,tok);
} }
} }

View File

@ -108,7 +108,8 @@ struct parse_options
unsigned int bit; 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 --*/ /*-- helptext.c --*/
void display_online_help( const char *keyword ); 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 ); KBNODE make_mpi_comment_node( const char *s, MPI a );
/*-- import.c --*/ /*-- 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 import_keys( char **fnames, int nnames,
void *stats_hd, unsigned int options ); void *stats_hd, unsigned int options );
int import_keys_stream( IOBUF inp, int import_keys_stream( IOBUF inp,
@ -189,7 +190,7 @@ void import_print_stats (void *hd);
int collapse_uids( KBNODE *keyblock ); int collapse_uids( KBNODE *keyblock );
/*-- export.c --*/ /*-- 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( STRLIST users, unsigned int options );
int export_pubkeys_stream( IOBUF out, STRLIST users, int export_pubkeys_stream( IOBUF out, STRLIST users,
KBNODE *keyblock_out, unsigned int options ); KBNODE *keyblock_out, unsigned int options );

View File

@ -689,7 +689,8 @@ compliance_failure(void)
} }
int 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; char *tok;
@ -722,6 +723,7 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts)
{ {
if(ascii_strncasecmp(opts[j].name,tok,toklen)==0) if(ascii_strncasecmp(opts[j].name,tok,toklen)==0)
{ {
if(noisy)
log_info(_("ambiguous option `%s'\n"),otok); log_info(_("ambiguous option `%s'\n"),otok);
return 0; return 0;
} }
@ -738,6 +740,7 @@ parse_options(char *str,unsigned int *options,struct parse_options *opts)
if(!opts[i].name) if(!opts[i].name)
{ {
if(noisy)
log_info(_("unknown option `%s'\n"),otok); log_info(_("unknown option `%s'\n"),otok);
return 0; return 0;
} }