* g10.c (main): Deprecate --default-comment in favor of --no-comments.

* options.h, g10.c (main), armor.c (armor_filter): Allow using --comment
multiple times to get multiple Comment: header lines. --no-comments resets
list.
This commit is contained in:
David Shaw 2003-09-23 03:52:55 +00:00
parent 046493fce9
commit b224756fbe
4 changed files with 33 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2003-09-22 David Shaw <dshaw@jabberwocky.com>
* g10.c (main): Deprecate --default-comment in favor of
--no-comments.
* options.h, g10.c (main), armor.c (armor_filter): Allow using
--comment multiple times to get multiple Comment: header lines.
--no-comments resets list.
2003-09-11 David Shaw <dshaw@jabberwocky.com> 2003-09-11 David Shaw <dshaw@jabberwocky.com>
* g10.c (main): Trim --help to commonly used options. Remove -f. * g10.c (main): Trim --help to commonly used options. Remove -f.

View File

@ -925,6 +925,7 @@ armor_filter( void *opaque, int control,
else if( control == IOBUFCTRL_FLUSH && !afx->cancel ) { else if( control == IOBUFCTRL_FLUSH && !afx->cancel ) {
if( !afx->status ) { /* write the header line */ if( !afx->status ) { /* write the header line */
const char *s; const char *s;
STRLIST comment=opt.comments;
if( afx->what >= DIM(head_strings) ) if( afx->what >= DIM(head_strings) )
log_bug("afx->what=%d", afx->what); log_bug("afx->what=%d", afx->what);
@ -935,22 +936,23 @@ armor_filter( void *opaque, int control,
iobuf_writestr(a, "Version: GnuPG v" VERSION " (" iobuf_writestr(a, "Version: GnuPG v" VERSION " ("
PRINTABLE_OS_NAME ")" LF ); PRINTABLE_OS_NAME ")" LF );
/* write the comment string or a default one */ /* write the comment strings */
s = opt.comment_string; for(s=comment->d;comment;comment=comment->next,s=comment->d)
if( s && *s ) { {
iobuf_writestr(a, "Comment: " ); iobuf_writestr(a, "Comment: " );
for( ; *s; s++ ) { for( ; *s; s++ )
{
if( *s == '\n' ) if( *s == '\n' )
iobuf_writestr(a, "\\n" ); iobuf_writestr(a, "\\n" );
else if( *s == '\r' ) else if( *s == '\r' )
iobuf_writestr(a, "\\r" ); iobuf_writestr(a, "\\r" );
else if( *s == '\v' ) else if( *s == '\v' )
iobuf_writestr(a, "\\v" ); iobuf_writestr(a, "\\v" );
else else
iobuf_put(a, *s ); iobuf_put(a, *s );
} }
iobuf_writestr(a, LF ); iobuf_writestr(a, LF );
} }
if ( afx->hdrlines ) { if ( afx->hdrlines ) {
for ( s = afx->hdrlines; *s; s++ ) { for ( s = afx->hdrlines; *s; s++ ) {

View File

@ -224,6 +224,7 @@ enum cmd_and_opt_values { aNull = 0,
oUseEmbeddedFilename, oUseEmbeddedFilename,
oComment, oComment,
oDefaultComment, oDefaultComment,
oNoComments,
oThrowKeyid, oThrowKeyid,
oNoThrowKeyid, oNoThrowKeyid,
oShowPhotos, oShowPhotos,
@ -448,7 +449,6 @@ static ARGPARSE_OPTS opts[] = {
#ifdef __riscos__ #ifdef __riscos__
{ oAttributeFile, "attribute-file" ,2, "@" }, { oAttributeFile, "attribute-file" ,2, "@" },
#endif /* __riscos__ */ #endif /* __riscos__ */
{ oNoSKComments, "no-comment", 0, "@"},
{ oNoSKComments, "no-sk-comments", 0, "@"}, { oNoSKComments, "no-sk-comments", 0, "@"},
{ oSKComments, "sk-comments", 0, "@"}, { oSKComments, "sk-comments", 0, "@"},
{ oCompletesNeeded, "completes-needed", 1, "@"}, { oCompletesNeeded, "completes-needed", 1, "@"},
@ -554,6 +554,7 @@ static ARGPARSE_OPTS opts[] = {
{ oNoShowNotation, "no-show-notation", 0, "@" }, { oNoShowNotation, "no-show-notation", 0, "@" },
{ oComment, "comment", 2, "@" }, { oComment, "comment", 2, "@" },
{ oDefaultComment, "default-comment", 0, "@" }, { oDefaultComment, "default-comment", 0, "@" },
{ oNoComments, "no-comments", 0, "@" },
{ oEmitVersion, "emit-version", 0, "@"}, { oEmitVersion, "emit-version", 0, "@"},
{ oNoEmitVersion, "no-emit-version", 0, "@"}, { oNoEmitVersion, "no-emit-version", 0, "@"},
{ oNoEmitVersion, "no-version", 0, "@"}, /* alias */ { oNoEmitVersion, "no-version", 0, "@"}, /* alias */
@ -1601,8 +1602,15 @@ main( int argc, char **argv )
break; break;
case oSigKeyserverURL: add_keyserver_url(pargs.r.ret_str,0); break; case oSigKeyserverURL: add_keyserver_url(pargs.r.ret_str,0); break;
case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break; case oUseEmbeddedFilename: opt.use_embedded_filename = 1; break;
case oComment: opt.comment_string = pargs.r.ret_str; break; case oComment: add_to_strlist(&opt.comments,pargs.r.ret_str); break;
case oDefaultComment: opt.comment_string = NULL; break; case oDefaultComment:
deprecated_warning(configname,configlineno,
"--default-comment","--no-comments","");
/* fall through */
case oNoComments:
free_strlist(opt.comments);
opt.comments=NULL;
break;
case oThrowKeyid: opt.throw_keyid = 1; break; case oThrowKeyid: opt.throw_keyid = 1; break;
case oNoThrowKeyid: opt.throw_keyid = 0; break; case oNoThrowKeyid: opt.throw_keyid = 0; break;
case oShowPhotos: case oShowPhotos:

View File

@ -101,7 +101,7 @@ struct {
unsigned int emulate_bugs; /* bug emulation flags EMUBUG_xxxx */ unsigned int emulate_bugs; /* bug emulation flags EMUBUG_xxxx */
int shm_coprocess; int shm_coprocess;
const char *set_filename; const char *set_filename;
const char *comment_string; STRLIST comments;
int throw_keyid; int throw_keyid;
const char *photo_viewer; const char *photo_viewer;
int s2k_mode; int s2k_mode;