diff options
author | Werner Koch <wk@gnupg.org> | 1999-06-15 14:31:07 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1999-06-15 14:31:07 +0200 |
commit | 9da1694e19fda1559c35c654430b78d26ce0b272 (patch) | |
tree | 61b4a7432d03cb6f2123cb295600beb57e3d2271 /util/ttyio.c | |
parent | See ChangeLog: Thu Jun 10 14:18:23 CEST 1999 Werner Koch (diff) | |
download | gnupg2-9da1694e19fda1559c35c654430b78d26ce0b272.tar.xz gnupg2-9da1694e19fda1559c35c654430b78d26ce0b272.zip |
See ChangeLog: Tue Jun 15 14:23:10 CEST 1999 Werner Koch
Diffstat (limited to '')
-rw-r--r-- | util/ttyio.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/util/ttyio.c b/util/ttyio.c index 0f0f144ef..3f5eb7900 100644 --- a/util/ttyio.c +++ b/util/ttyio.c @@ -58,6 +58,7 @@ static FILE *ttyfp = NULL; static int initialized; static int last_prompt_len; static int batchmode; +static int no_terminal; #ifdef HAVE_TCGETATTR static struct termios termsave; @@ -130,11 +131,22 @@ tty_batchmode( int onoff ) return old; } +int +tty_no_terminal(int onoff) +{ + int old = no_terminal; + no_terminal = onoff ? 1 : 0; + return old; +} + void tty_printf( const char *fmt, ... ) { va_list arg_ptr; + if (no_terminal) + return; + if( !initialized ) init_ttyfp(); @@ -188,6 +200,9 @@ tty_printf( const char *fmt, ... ) void tty_print_string( byte *p, size_t n ) { + if (no_terminal) + return; + if( !initialized ) init_ttyfp(); @@ -236,6 +251,11 @@ do_get( const char *prompt, int hidden ) exit(2); } + if (no_terminal) { + log_error("Sorry, no terminal at all requested - can't get input\n"); + exit(2); + } + if( !initialized ) init_ttyfp(); @@ -349,9 +369,12 @@ tty_get_hidden( const char *prompt ) void tty_kill_prompt() { + if ( no_terminal ) + return; if( !initialized ) init_ttyfp(); + if( batchmode ) last_prompt_len = 0; if( !last_prompt_len ) |