]> git.saurik.com Git - redis.git/blob - deps/linenoise/example.c
Import linenoise as dependency for redis-cli
[redis.git] / deps / linenoise / example.c
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 }