2002-08-01 Marcus Brinkmann <marcus@g10code.de>

* gpg/t-edit.c: Also add a test for the expire command (testing
	the passphrase callback).
This commit is contained in:
Marcus Brinkmann 2002-08-01 16:02:19 +00:00
parent b94497bf1f
commit 9285922de0
2 changed files with 36 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2002-08-01 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-edit.c: Also add a test for the expire command (testing
the passphrase callback).
2002-07-28 Marcus Brinkmann <marcus@g10code.de> 2002-07-28 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-edit.c: New file. * gpg/t-edit.c: New file.

View File

@ -78,7 +78,6 @@ GpgmeError
edit_fnc (void *opaque, GpgmeStatusCode status, const char *args, const char **result) edit_fnc (void *opaque, GpgmeStatusCode status, const char *args, const char **result)
{ {
GpgmeData out = (GpgmeData) opaque; GpgmeData out = (GpgmeData) opaque;
static int step = 0;
fputs ("[-- Response --]\n", stdout); fputs ("[-- Response --]\n", stdout);
flush_data (out); flush_data (out);
@ -87,17 +86,34 @@ edit_fnc (void *opaque, GpgmeStatusCode status, const char *args, const char **r
if (result) if (result)
{ {
if (!strcmp (args, "keyedit.prompt"))
{
static int step = 0;
switch (step) switch (step)
{ {
case 0: case 0:
*result = "fpr"; *result = "fpr";
break; break;
case 1: case 1:
*result = "expire";
break;
default:
*result = "quit"; *result = "quit";
break; break;
} }
step++; step++;
} }
else if (!strcmp (args, "keyedit.save.okay"))
{
*result = "Y";
}
else if (!strcmp (args, "keygen.valid"))
{
*result = "0";
}
}
return 0; return 0;
} }
@ -110,7 +126,7 @@ main (int argc, char **argv)
GpgmeData out = NULL; GpgmeData out = NULL;
GpgmeKey key = NULL; GpgmeKey key = NULL;
struct passphrase_cb_info_s info; struct passphrase_cb_info_s info;
const char *pattern = "Whisky"; const char *pattern = "Alpha";
char *p; char *p;
do do