diff options
author | Werner Koch <wk@gnupg.org> | 2007-06-21 20:44:48 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2007-06-21 20:44:48 +0200 |
commit | 0b66f30d66fadbfd1a949edbe765043b06c5931b (patch) | |
tree | e2e33a51151de2deac0d4e43cd7bc38429fe2965 /common/ttyio.c | |
parent | [w32] gpg-agent is now started automagically by gpgsm. (diff) | |
download | gnupg2-0b66f30d66fadbfd1a949edbe765043b06c5931b.tar.xz gnupg2-0b66f30d66fadbfd1a949edbe765043b06c5931b.zip |
Implemented the --gen-key command as we can't use the gpgsm-gencert.sh under Windows.
Diffstat (limited to 'common/ttyio.c')
-rw-r--r-- | common/ttyio.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/common/ttyio.c b/common/ttyio.c index 831ad9048..98a4614fe 100644 --- a/common/ttyio.c +++ b/common/ttyio.c @@ -50,6 +50,7 @@ #include "util.h" #include "ttyio.h" +#include "estream-printf.h" #include "common-defs.h" #define CONTROL_D ('D' - 'A' + 1) @@ -243,7 +244,7 @@ tty_printf( const char *fmt, ... ) } -/* Same as tty_printf but if FP is not NULL, behave like a regualr +/* Same as tty_printf but if FP is not NULL, behave like a regular fprintf. */ void tty_fprintf (FILE *fp, const char *fmt, ... ) @@ -563,6 +564,26 @@ tty_get( const char *prompt ) return do_get ( prompt, 0 ); } +/* Variable argument version of tty_get. The prompt is is actually a + format string with arguments. */ +char * +tty_getf (const char *promptfmt, ... ) +{ + va_list arg_ptr; + char *prompt; + char *answer; + + va_start (arg_ptr, promptfmt); + if (estream_vasprintf (&prompt, promptfmt, arg_ptr) < 0) + log_fatal ("estream_vasprintf failed: %s\n", strerror (errno)); + va_end (arg_ptr); + answer = tty_get (prompt); + xfree (prompt); + return answer; +} + + + char * tty_get_hidden( const char *prompt ) { |