#include <readline/able_readline.h>
Go to the source code of this file.
Defines | |
#define | _ABLE_CLIB_READLINE_H 1 |
Functions | |
char * | readline (const char *prompt) |
Readline obtains input from a user. |
#define _ABLE_CLIB_READLINE_H 1 |
char* readline | ( | const char * | prompt | ) |
Readline obtains input from a user.
This implementation uses the ABLE able_readline function to do its work.
Readline prints a prompt and then reads and returns a single line of text from the user. If prompt is NULL or the empty string, no prompt is displayed. The line returned is allocated with malloc the caller should free the line when it has finished with it.
If readline encounters an EOF while reading the line, and the line is empty at that point, then (char *)NULL is returned. Otherwise, the line is ended just as if a newline had been typed.
If you want the user to have access to the line later, (with C-p for example), you must call add_history to save the line away in a history list of such lines.
prompt | A string which will be used as the prompt or NULL if no prompt is required. |