diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-06-02 06:21:14 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-06-02 06:21:14 +0200 |
commit | 24d02b8a32757e8c86f2a4fbca82dac4506a94d1 (patch) | |
tree | a5ceda82d08af828704c8a03c9ea3d92cad626e8 /tools/gpg-connect-agent.c | |
parent | scd:nks: Don't flag the ESIGN keypair EF as encryption capable. (diff) | |
download | gnupg2-24d02b8a32757e8c86f2a4fbca82dac4506a94d1.tar.xz gnupg2-24d02b8a32757e8c86f2a4fbca82dac4506a94d1.zip |
tools: Add --unbuffered option to gpg-connect-agent.
* tools/gpg-connect-agent.c (cmd_and_opt_values): Add oUnBuffered.
(opts, opt): Likewise.
(main): When unbuffered, set gpgrt_stdin/stdout accordingly.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'tools/gpg-connect-agent.c')
-rw-r--r-- | tools/gpg-connect-agent.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index cecebf676..2ae1374fc 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -73,6 +73,7 @@ enum cmd_and_opt_values oNoHistory, oNoAutostart, oChUid, + oUnBuffered = 'u', oNoop }; @@ -110,6 +111,7 @@ static gpgrt_opt_t opts[] = { ARGPARSE_s_s (oDirmngrProgram, "dirmngr-program", "@"), ARGPARSE_s_s (oKeyboxdProgram, "keyboxd-program", "@"), ARGPARSE_s_s (oChUid, "chuid", "@"), + ARGPARSE_s_n (oUnBuffered, "unbuffered", N_("Set stdin/out unbuffered")), ARGPARSE_end () }; @@ -137,6 +139,7 @@ struct int enable_varsubst; /* Set if variable substitution is enabled. */ int trim_leading_spaces; int no_history; + int unbuffered; /* Set if unbuffered mode for stdin/out is preferred. */ } opt; @@ -1242,6 +1245,7 @@ main (int argc, char **argv) opt.trim_leading_spaces = 1; break; case oChUid: changeuser = pargs.r.ret_str; break; + case oUnBuffered: opt.unbuffered = 1; break; default: pargs.err = 2; break; } @@ -1402,6 +1406,11 @@ main (int argc, char **argv) log_info (_("receiving line failed: %s\n"), gpg_strerror (rc) ); } + if (!script_fp && opt.unbuffered) + { + gpgrt_setvbuf (gpgrt_stdin, NULL, _IONBF, 0); + setvbuf (stdout, NULL, _IONBF, 0); + } for (loopidx=0; loopidx < DIM (loopstack); loopidx++) loopstack[loopidx].collecting = 0; |