diff options
author | Werner Koch <[email protected]> | 2016-08-13 10:49:54 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-08-13 11:49:41 +0000 |
commit | b57f55321295846d47144bd6b39fbbcac0127421 (patch) | |
tree | 4469af47dd36b04c9e1a4309f127d02194b1ff54 /g13/g13.c | |
parent | Avoid leading ": " in the log output when there are no prefixes. (diff) | |
download | gnupg-b57f55321295846d47144bd6b39fbbcac0127421.tar.gz gnupg-b57f55321295846d47144bd6b39fbbcac0127421.zip |
g13: New command --find-device.
* common/status.h (STATUS_BLOCKDEV: New.
* g13/call-syshelp.c: Include "call-syshelp.h".
(finddevice_status_cb, call_syshelp_find_device): New.
* g13/g13.c (aFindDevice): New.
(opts): Add "--find-device".
(main): Implement --find-device.
* g13/sh-cmd.c (cmd_finddevice): New.
(register_commands): Register new command.
--
This might be useful for scripting.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g13/g13.c')
-rw-r--r-- | g13/g13.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -62,6 +62,7 @@ enum cmd_and_opt_values { aSuspend, aResume, aServer, + aFindDevice, oOptions, oDebug, @@ -115,6 +116,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_c (aSuspend, "suspend", N_("Suspend a file system container") ), ARGPARSE_c (aResume, "resume", N_("Resume a file system container") ), ARGPARSE_c (aServer, "server", N_("Run in server mode")), + ARGPARSE_c (aFindDevice, "find-device", "@"), ARGPARSE_c (aGPGConfList, "gpgconf-list", "@"), ARGPARSE_c (aGPGConfTest, "gpgconf-test", "@"), @@ -491,6 +493,7 @@ main ( int argc, char **argv) case aSuspend: case aResume: case aCreate: + case aFindDevice: set_cmd (&cmd, pargs.r_opt); break; @@ -744,6 +747,22 @@ main ( int argc, char **argv) } break; + case aFindDevice: + { + char *blockdev; + + if (argc != 1) + wrong_args ("--find-device name"); + + err = call_syshelp_find_device (&ctrl, argv[0], &blockdev); + if (err) + log_error ("error finding device '%s': %s <%s>\n", + argv[0], gpg_strerror (err), gpg_strsource (err)); + else + puts (blockdev); + } + break; + case aCreate: /* Create a new container. */ { if (argc != 1) |