mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* main.h, mainproc.c (check_sig_and_print), keylist.c
(list_keyblock_print), pkclist.c (do_edit_ownertrust), keyedit.c (menu_showphoto), photoid.c (generate_photo_id, show_photos), misc.c (pct_expando): Add %v and %V expandos so that displaying photo IDs can show the attribute validity tag (%v) and string (%V). Originally by Daniel Gillmor.
This commit is contained in:
parent
a9c280865a
commit
0042cda87c
9 changed files with 74 additions and 34 deletions
52
g10/misc.c
52
g10/misc.c
|
@ -1,6 +1,6 @@
|
|||
/* misc.c - miscellaneous functions
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
* 2005 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
* 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
|
@ -503,8 +503,6 @@ pct_expando(const char *string,struct expando_args *args)
|
|||
|
||||
while(*ch!='\0')
|
||||
{
|
||||
char *str=NULL;
|
||||
|
||||
if(!done)
|
||||
{
|
||||
/* 8192 is way bigger than we'll need here */
|
||||
|
@ -613,22 +611,46 @@ pct_expando(const char *string,struct expando_args *args)
|
|||
}
|
||||
break;
|
||||
|
||||
case 't': /* e.g. "jpg" */
|
||||
str=image_type_to_string(args->imagetype,0);
|
||||
/* fall through */
|
||||
|
||||
case 'T': /* e.g. "image/jpeg" */
|
||||
if(str==NULL)
|
||||
str=image_type_to_string(args->imagetype,2);
|
||||
|
||||
if(idx+strlen(str)<maxlen)
|
||||
case 'v': /* validity letters */
|
||||
if(args->validity_info && idx+1<maxlen)
|
||||
{
|
||||
strcpy(&ret[idx],str);
|
||||
idx+=strlen(str);
|
||||
ret[idx++]=args->validity_info;
|
||||
ret[idx]='\0';
|
||||
done=1;
|
||||
}
|
||||
break;
|
||||
|
||||
/* The text string types */
|
||||
case 't':
|
||||
case 'T':
|
||||
case 'V':
|
||||
{
|
||||
const char *str=NULL;
|
||||
|
||||
switch(*(ch+1))
|
||||
{
|
||||
case 't': /* e.g. "jpg" */
|
||||
str=image_type_to_string(args->imagetype,0);
|
||||
break;
|
||||
|
||||
case 'T': /* e.g. "image/jpeg" */
|
||||
str=image_type_to_string(args->imagetype,2);
|
||||
break;
|
||||
|
||||
case 'V': /* e.g. "full", "expired", etc. */
|
||||
str=args->validity_string;
|
||||
break;
|
||||
}
|
||||
|
||||
if(str && idx+strlen(str)<maxlen)
|
||||
{
|
||||
strcpy(&ret[idx],str);
|
||||
idx+=strlen(str);
|
||||
done=1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case '%':
|
||||
if(idx+1<maxlen)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue