Add flags to the getauditlog command.

This commit is contained in:
Werner Koch 2009-12-01 11:21:47 +00:00
parent dce41d1ffa
commit c2ee84a87a
2 changed files with 18 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2009-12-01 Werner Koch <wk@g10code.com> 2009-12-01 Werner Koch <wk@g10code.com>
* gpgme-tool.c (cmd_getauditlog): Add flag --html.
(hlp_getauditlog): New.
* gpgme-tool.c (GT_GCC_A_SENTINEL, GT_GCC_A_PRINTF): New. * gpgme-tool.c (GT_GCC_A_SENTINEL, GT_GCC_A_PRINTF): New.
(gt_write_status): Use sentinel. (gt_write_status): Use sentinel.
(argp_error, log_error): Use printf attribute. (argp_error, log_error): Use printf attribute.

View File

@ -565,8 +565,8 @@ _gt_gpgme_new (gpgme_tool_t gt, gpgme_ctx_t *ctx)
err = gpgme_new (ctx); err = gpgme_new (ctx);
if (err) if (err)
return err; return err;
gpgme_set_progress_cb (*ctx, _gt_progress_cb, gt); gpgme_set_progress_cb (*ctx, _gt_progress_cb, gt);
return 0; return 0;
} }
@ -1897,6 +1897,11 @@ cmd_keylist (assuan_context_t ctx, char *line)
} }
static const char hlp_getauditlog[] =
"GETAUDITLOG [--html] [--with-help]\n"
"\n"
"Call the function gpgme_op_getauditlog with the given flags. Write\n"
"the output to the object set by the last OUTPUT command.";
static gpg_error_t static gpg_error_t
cmd_getauditlog (assuan_context_t ctx, char *line) cmd_getauditlog (assuan_context_t ctx, char *line)
{ {
@ -1904,6 +1909,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
gpg_error_t err; gpg_error_t err;
assuan_fd_t out_fd; assuan_fd_t out_fd;
gpgme_data_t out_data; gpgme_data_t out_data;
unsigned int flags = 0;
out_fd = assuan_get_output_fd (ctx); out_fd = assuan_get_output_fd (ctx);
if (out_fd == ASSUAN_INVALID_FD) if (out_fd == ASSUAN_INVALID_FD)
@ -1912,7 +1918,12 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
if (err) if (err)
return err; return err;
err = gt_getauditlog (server->gt, out_data, 0); if (strstr (line, "--html"))
flags |= GPGME_AUDITLOG_HTML;
if (strstr (line, "--with-help"))
flags |= GPGME_AUDITLOG_WITH_HELP;
err = gt_getauditlog (server->gt, out_data, flags);
gpgme_data_release (out_data); gpgme_data_release (out_data);
server_reset_fds (server); server_reset_fds (server);
@ -2054,7 +2065,7 @@ register_commands (assuan_context_t ctx)
{ "KEYLIST", cmd_keylist }, { "KEYLIST", cmd_keylist },
{ "LISTKEYS", cmd_keylist }, { "LISTKEYS", cmd_keylist },
// TODO: TRUSTLIST, TRUSTLIST_EXT // TODO: TRUSTLIST, TRUSTLIST_EXT
{ "GETAUDITLOG", cmd_getauditlog }, { "GETAUDITLOG", cmd_getauditlog, hlp_getauditlog },
// TODO: ASSUAN // TODO: ASSUAN
{ "VFS_MOUNT", cmd_vfs_mount }, { "VFS_MOUNT", cmd_vfs_mount },
{ "MOUNT", cmd_vfs_mount }, { "MOUNT", cmd_vfs_mount },