mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Tue Jun 15 14:23:10 CEST 1999 Werner Koch
This commit is contained in:
parent
b5f36dd0dd
commit
9da1694e19
21 changed files with 187 additions and 34 deletions
23
util/ttyio.c
23
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 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue