1
/* gpgrlhelp.c - A readline wrapper.
2
* Copyright (C) 2006 Free Software Foundation, Inc.
4
* This file is part of GnuPG.
6
* GnuPG is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* GnuPG is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22
/* This module may by used by applications to initializes readline
23
support. It is required so that we can have hooks in other parts
24
of libcommon without actually requing to link against
25
libreadline. It works along ttyio.c which a proper part of
32
#ifdef HAVE_LIBREADLINE
33
#define GNUPG_LIBREADLINE_H_INCLUDED
35
#include <readline/readline.h>
36
#include <readline/history.h>
40
#include "common-defs.h"
43
#ifdef HAVE_LIBREADLINE
45
set_completer (rl_completion_func_t *completer)
47
rl_attempted_completion_function = completer;
48
rl_inhibit_completion = 0;
52
inhibit_completion (int value)
54
rl_inhibit_completion = value;
58
cleanup_after_signal (void)
60
rl_free_line_state ();
61
rl_cleanup_after_signal ();
65
init_stream (FILE *fp)
68
rl_instream = rl_outstream = fp;
69
rl_inhibit_completion = 1;
72
#endif /*HAVE_LIBREADLINE*/
75
/* Initialize our readline code. This should be called as early as
76
possible as it is actually a constructur. */
78
gnupg_rl_initialize (void)
80
#ifdef HAVE_LIBREADLINE
81
tty_private_set_rl_hooks (init_stream,
87
rl_readline_name = "GnuPG";