]>
Commit | Line | Data |
---|---|---|
1 | /* linenoise.h -- guerrilla line editing library against the idea that a | |
2 | * line editing lib needs to be 20,000 lines of C code. | |
3 | * | |
4 | * See linenoise.c for more information. | |
5 | * | |
6 | * Copyright (c) 2010, Salvatore Sanfilippo <antirez at gmail dot com> | |
7 | * Copyright (c) 2010, Pieter Noordhuis <pcnoordhuis at gmail dot com> | |
8 | * | |
9 | * All rights reserved. | |
10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions are met: | |
13 | * | |
14 | * * Redistributions of source code must retain the above copyright notice, | |
15 | * this list of conditions and the following disclaimer. | |
16 | * * Redistributions in binary form must reproduce the above copyright | |
17 | * notice, this list of conditions and the following disclaimer in the | |
18 | * documentation and/or other materials provided with the distribution. | |
19 | * * Neither the name of Redis nor the names of its contributors may be used | |
20 | * to endorse or promote products derived from this software without | |
21 | * specific prior written permission. | |
22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
27 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
33 | * POSSIBILITY OF SUCH DAMAGE. | |
34 | */ | |
35 | ||
36 | #ifndef __LINENOISE_H | |
37 | #define __LINENOISE_H | |
38 | ||
39 | typedef struct linenoiseCompletions { | |
40 | size_t len; | |
41 | char **cvec; | |
42 | } linenoiseCompletions; | |
43 | ||
44 | typedef void(linenoiseCompletionCallback)(const char *, linenoiseCompletions *); | |
45 | void linenoiseSetCompletionCallback(linenoiseCompletionCallback *); | |
46 | void linenoiseAddCompletion(linenoiseCompletions *, char *); | |
47 | ||
48 | char *linenoise(const char *prompt); | |
49 | int linenoiseHistoryAdd(const char *line); | |
50 | int linenoiseHistorySetMaxLen(int len); | |
51 | int linenoiseHistorySave(char *filename); | |
52 | int linenoiseHistoryLoad(char *filename); | |
53 | void linenoiseClearScreen(void); | |
54 | ||
55 | #endif /* __LINENOISE_H */ |