]>
Commit | Line | Data |
---|---|---|
e902b579 PN |
1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | #include "linenoise.h" | |
4 | ||
5 | int main(void) { | |
6 | char *line; | |
7 | ||
8 | linenoiseHistoryLoad("history.txt"); /* Load the history at startup */ | |
9 | while((line = linenoise("hello> ")) != NULL) { | |
10 | if (line[0] != '\0') { | |
11 | printf("echo: '%s'\n", line); | |
12 | linenoiseHistoryAdd(line); | |
13 | linenoiseHistorySave("history.txt"); /* Save every new entry */ | |
14 | } | |
15 | free(line); | |
16 | } | |
17 | return 0; | |
18 | } |