xref: /netbsd-src/external/gpl3/gdb/dist/readline/readline/examples/rlbasic.c (revision 4724848cf0da353df257f730694b7882798e5daf)
1 #include <stdlib.h>
2 #include <unistd.h>
3 #include <stdio.h>
4 #include <string.h>
5 
6 #if defined (READLINE_LIBRARY)
7 #  include "readline.h"
8 #  include "history.h"
9 #else
10 #  include <readline/readline.h>
11 #  include <readline/history.h>
12 #endif
13 
14 int
15 main (int c, char **v)
16 {
17 	char *input;
18 
19 	for (;;) {
20 		input = readline ((char *)NULL);
21 		if (input == 0)
22 			break;
23 		printf ("%s\n", input);
24 		if (strcmp (input, "exit") == 0)
25 			break;
26 		free (input);
27 	}
28 	exit (0);
29 }
30