Updating built in Io code to use += instead of x = x + y
[io/quag.git] / tools / editlib_test / editlib_test.c
blobaa4ed597f1be39735747eb95e4d2694ffa95baa5
1 /*
2 Copyright Jonathan Wright 2007
3 License: BSD revised
4 */
6 #include <stdio.h>
7 #include <histedit.h>
9 char prompt[] = "test> ";
11 char *promptCallback(EditLine *e)
13 return prompt;
16 int main()
18 History *h = history_init();
19 EditLine *e = el_init("edittest", stdin, stdout, stderr);
20 el_set(e, EL_PROMPT, promptCallback);
21 el_set(e, EL_HIST, history, h);
22 el_set(e, EL_SIGNAL, 1);
23 el_set(e, EL_EDITOR, "emacs");
26 HistEvent ev;
27 history(h, &ev, H_SETSIZE, 1024);
30 for (;;)
32 int count = 0;
33 const char *str = el_gets(e, &count);
35 if (!str || count <= 0)
36 break;
38 puts(str);
41 HistEvent ev;
42 history(h, &ev, H_ENTER, str);
46 el_end(e);
47 history_end(h);
48 return 0;