raw
mpi-genesis             1 /* ttyio.h
mpi-genesis 2 * Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
mpi-genesis 3 *
mpi-genesis 4 * This file is part of GNUPG.
mpi-genesis 5 *
mpi-genesis 6 * GNUPG is free software; you can redistribute it and/or modify
mpi-genesis 7 * it under the terms of the GNU General Public License as published by
mpi-genesis 8 * the Free Software Foundation; either version 3 of the License, or
mpi-genesis 9 * (at your option) any later version.
mpi-genesis 10 *
mpi-genesis 11 * GNUPG is distributed in the hope that it will be useful,
mpi-genesis 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
mpi-genesis 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
mpi-genesis 14 * GNU General Public License for more details.
mpi-genesis 15 *
mpi-genesis 16 * You should have received a copy of the GNU General Public License
mpi-genesis 17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
mpi-genesis 18 */
mpi-genesis 19 #ifndef G10_TTYIO_H
mpi-genesis 20 #define G10_TTYIO_H
mpi-genesis 21
mpi-genesis 22 #ifdef HAVE_LIBREADLINE
mpi-genesis 23 #include <stdio.h>
mpi-genesis 24 #include <readline/readline.h>
mpi-genesis 25 #endif
mpi-genesis 26
mpi-genesis 27 const char *tty_get_ttyname (void);
mpi-genesis 28 int tty_batchmode( int onoff );
mpi-genesis 29 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
mpi-genesis 30 void tty_printf (const char *fmt, ... ) __attribute__ ((format (printf,1,2)));
mpi-genesis 31 void tty_fprintf (FILE *fp, const char *fmt, ... )
mpi-genesis 32 __attribute__ ((format (printf,2,3)));
mpi-genesis 33 #else
mpi-genesis 34 void tty_printf (const char *fmt, ... );
mpi-genesis 35 void tty_fprintf (FILE *fp, const char *fmt, ... );
mpi-genesis 36 #endif
mpi-genesis 37 void tty_print_string( const byte *p, size_t n );
mpi-genesis 38 void tty_print_utf8_string( const byte *p, size_t n );
mpi-genesis 39 void tty_print_utf8_string2( const byte *p, size_t n, size_t max_n );
mpi-genesis 40 char *tty_get( const char *prompt );
mpi-genesis 41 char *tty_get_hidden( const char *prompt );
mpi-genesis 42 void tty_kill_prompt(void);
mpi-genesis 43 int tty_get_answer_is_yes( const char *prompt );
mpi-genesis 44 int tty_no_terminal(int onoff);
mpi-genesis 45
mpi-genesis 46 #ifdef HAVE_LIBREADLINE
mpi-genesis 47 void tty_enable_completion(rl_completion_func_t *completer);
mpi-genesis 48 void tty_disable_completion(void);
mpi-genesis 49 #else
mpi-genesis 50 /* Use a macro to stub out these functions since a macro has no need
mpi-genesis 51 to typedef a "rl_completion_func_t" which would be undefined
mpi-genesis 52 without readline. */
mpi-genesis 53 #define tty_enable_completion(x)
mpi-genesis 54 #define tty_disable_completion()
mpi-genesis 55 #endif
mpi-genesis 56 void tty_cleanup_after_signal (void);
mpi-genesis 57
mpi-genesis 58 #endif /*G10_TTYIO_H*/