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