readline.h revision 1.2 1 1.2 christos /* $NetBSD: readline.h,v 1.2 2002/03/18 16:01:03 christos Exp $ */
2 1.1 jdolecek
3 1.1 jdolecek /*-
4 1.1 jdolecek * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 1.1 jdolecek * All rights reserved.
6 1.1 jdolecek *
7 1.1 jdolecek * This code is derived from software contributed to The NetBSD Foundation
8 1.1 jdolecek * by Jaromir Dolecek.
9 1.1 jdolecek *
10 1.1 jdolecek * Redistribution and use in source and binary forms, with or without
11 1.1 jdolecek * modification, are permitted provided that the following conditions
12 1.1 jdolecek * are met:
13 1.1 jdolecek * 1. Redistributions of source code must retain the above copyright
14 1.1 jdolecek * notice, this list of conditions and the following disclaimer.
15 1.1 jdolecek * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 jdolecek * notice, this list of conditions and the following disclaimer in the
17 1.1 jdolecek * documentation and/or other materials provided with the distribution.
18 1.1 jdolecek * 3. All advertising materials mentioning features or use of this software
19 1.1 jdolecek * must display the following acknowledgement:
20 1.1 jdolecek * This product includes software developed by the NetBSD
21 1.1 jdolecek * Foundation, Inc. and its contributors.
22 1.1 jdolecek * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 jdolecek * contributors may be used to endorse or promote products derived
24 1.1 jdolecek * from this software without specific prior written permission.
25 1.1 jdolecek *
26 1.1 jdolecek * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 jdolecek * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 jdolecek * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 jdolecek * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 jdolecek * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 jdolecek * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 jdolecek * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 jdolecek * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 jdolecek * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 jdolecek * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 jdolecek * POSSIBILITY OF SUCH DAMAGE.
37 1.1 jdolecek */
38 1.1 jdolecek #ifndef _READLINE_H_
39 1.1 jdolecek #define _READLINE_H_
40 1.1 jdolecek
41 1.1 jdolecek #include <sys/types.h>
42 1.1 jdolecek
43 1.1 jdolecek /* list of readline stuff supported by editline library's readline wrapper */
44 1.1 jdolecek
45 1.1 jdolecek /* typedefs */
46 1.1 jdolecek typedef int Function(const char *, int);
47 1.1 jdolecek typedef void VFunction(void);
48 1.1 jdolecek typedef char *CPFunction(const char *, int);
49 1.1 jdolecek typedef char **CPPFunction(const char *, int, int);
50 1.1 jdolecek
51 1.1 jdolecek typedef struct _hist_entry {
52 1.1 jdolecek const char *line;
53 1.1 jdolecek const char *data;
54 1.1 jdolecek } HIST_ENTRY;
55 1.1 jdolecek
56 1.1 jdolecek /* global variables used by readline enabled applications */
57 1.2 christos #ifdef __cplusplus
58 1.2 christos extern "C" {
59 1.2 christos #endif
60 1.1 jdolecek extern const char *rl_library_version;
61 1.1 jdolecek extern char *rl_readline_name;
62 1.1 jdolecek extern FILE *rl_instream;
63 1.1 jdolecek extern FILE *rl_outstream;
64 1.1 jdolecek extern char *rl_line_buffer;
65 1.1 jdolecek extern int rl_point, rl_end;
66 1.1 jdolecek extern int history_base, history_length;
67 1.1 jdolecek extern int max_input_history;
68 1.1 jdolecek extern char *rl_basic_word_break_characters;
69 1.1 jdolecek extern char *rl_completer_word_break_characters;
70 1.1 jdolecek extern char *rl_completer_quote_characters;
71 1.1 jdolecek extern CPFunction *rl_completion_entry_function;
72 1.1 jdolecek extern CPPFunction *rl_attempted_completion_function;
73 1.1 jdolecek extern int rl_completion_type;
74 1.1 jdolecek extern int rl_completion_query_items;
75 1.1 jdolecek extern char *rl_special_prefixes;
76 1.1 jdolecek extern int rl_completion_append_character;
77 1.1 jdolecek
78 1.1 jdolecek /* supported functions */
79 1.1 jdolecek char *readline(const char *);
80 1.1 jdolecek int rl_initialize(void);
81 1.1 jdolecek
82 1.1 jdolecek void using_history(void);
83 1.1 jdolecek int add_history(const char *);
84 1.1 jdolecek void clear_history(void);
85 1.1 jdolecek void stifle_history(int);
86 1.1 jdolecek int unstifle_history(void);
87 1.1 jdolecek int history_is_stifled(void);
88 1.1 jdolecek int where_history(void);
89 1.1 jdolecek HIST_ENTRY *current_history(void);
90 1.1 jdolecek HIST_ENTRY *history_get(int);
91 1.1 jdolecek int history_total_bytes(void);
92 1.1 jdolecek int history_set_pos(int);
93 1.1 jdolecek HIST_ENTRY *previous_history(void);
94 1.1 jdolecek HIST_ENTRY *next_history(void);
95 1.1 jdolecek int history_search(const char *, int);
96 1.1 jdolecek int history_search_prefix(const char *, int);
97 1.1 jdolecek int history_search_pos(const char *, int, int);
98 1.1 jdolecek int read_history(const char *);
99 1.1 jdolecek int write_history(const char *);
100 1.1 jdolecek int history_expand(char *, char **);
101 1.1 jdolecek char **history_tokenize(const char *);
102 1.1 jdolecek
103 1.1 jdolecek char *tilde_expand(char *);
104 1.1 jdolecek char *filename_completion_function(const char *, int);
105 1.1 jdolecek char *username_completion_function(const char *, int);
106 1.1 jdolecek int rl_complete(int, int);
107 1.1 jdolecek int rl_read_key(void);
108 1.1 jdolecek char **completion_matches(const char *, CPFunction *);
109 1.1 jdolecek void rl_display_match_list(char **, int, int);
110 1.1 jdolecek
111 1.1 jdolecek int rl_insert(int, int);
112 1.1 jdolecek void rl_reset_terminal(const char *);
113 1.1 jdolecek int rl_bind_key(int, int (*)(int, int));
114 1.2 christos #ifdef __cplusplus
115 1.2 christos }
116 1.2 christos #endif
117 1.1 jdolecek
118 1.1 jdolecek #endif /* _READLINE_H_ */
119