1 /* **************************************************************** */
5 /* **************************************************************** */
7 /* Copyright (C) 1987-2009 Free Software Foundation, Inc.
9 This file is part of the GNU Readline Library (Readline), a library for
10 reading lines of text with interactive input and history editing.
12 Readline is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
17 Readline is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with Readline. If not, see <http://www.gnu.org/licenses/>.
26 #if defined (HAVE_CONFIG_H)
31 #include <sys/types.h>
39 #ifdef READLINE_LIBRARY
40 # include "readline.h"
43 # include <readline/readline.h>
44 # include <readline/history.h>
47 extern HIST_ENTRY
**history_list ();
56 prompt
= "readline$ ";
61 temp
= readline (prompt
);
67 /* If there is anything on the line, print it and remember it. */
70 fprintf (stderr
, "%s\r\n", temp
);
74 /* Check for `command' that we handle. */
75 if (strcmp (temp
, "quit") == 0)
78 if (strcmp (temp
, "list") == 0)
83 list
= history_list ();
86 for (i
= 0; list
[i
]; i
++)
87 fprintf (stderr
, "%d: %s\r\n", i
, list
[i
]->line
);