File: rlbasic.c

package info (click to toggle)
readline 8.3-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 9,764 kB
  • sloc: ansic: 30,409; sh: 6,600; perl: 4,105; makefile: 1,856
file content (37 lines) | stat: -rw-r--r-- 565 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

#ifdef HAVE_LOCALE_H
#  include <locale.h>
#endif

#if defined (READLINE_LIBRARY)
#  include "readline.h"
#  include "history.h"
#else
#  include <readline/readline.h>
#  include <readline/history.h>
#endif

int
main (int c, char **v)
{
	char *input;

#ifdef HAVE_SETLOCALE
	setlocale (LC_ALL, "");
#endif

	for (;;) {
		input = readline ((char *)NULL);
		if (input == 0)
			break;
		printf ("%s\n", input);
		if (strcmp (input, "exit") == 0)
			break;
		free (input);
	}
	exit (0);
}