| 1 |
/* readline.h --- Simple implementation of readline. |
| 2 |
Copyright (C) 2005, 2009-2026 Free Software Foundation, Inc. |
| 3 |
Written by Simon Josefsson |
| 4 |
|
| 5 |
This program is free software: you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU General Public License as published by |
| 7 |
the Free Software Foundation, either version 3 of the License, or |
| 8 |
(at your option) any later version. |
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 17 |
|
| 18 |
#ifndef GL_READLINE_H |
| 19 |
#define GL_READLINE_H |
| 20 |
|
| 21 |
/* This file uses _GL_ATTRIBUTE_MALLOC, HAVE_READLINE_READLINE_H. */ |
| 22 |
#if !_GL_CONFIG_H_INCLUDED |
| 23 |
#error "Please include config.h first." |
| 24 |
#endif |
| 25 |
|
| 26 |
#if HAVE_READLINE_READLINE_H |
| 27 |
/* <readline/readline.h> makes use of the FILE type without including |
| 28 |
<stdio.h> itself. */ |
| 29 |
# include <stdio.h> |
| 30 |
# include <readline/readline.h> |
| 31 |
#else |
| 32 |
# include <stdlib.h> |
| 33 |
|
| 34 |
# ifdef __cplusplus |
| 35 |
extern "C" { |
| 36 |
# endif |
| 37 |
|
| 38 |
/* Prints a prompt PROMPT and then reads and returns a single line of |
| 39 |
text from the user. If PROMPT is NULL or the empty string, no |
| 40 |
prompt is displayed. The returned line is allocated with malloc; |
| 41 |
the caller should free the line when it has finished with it. */ |
| 42 |
extern char *readline (const char *prompt) |
| 43 |
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE; |
| 44 |
|
| 45 |
# ifdef __cplusplus |
| 46 |
} |
| 47 |
# endif |
| 48 |
|
| 49 |
#endif |
| 50 |
|
| 51 |
#endif /* GL_READLINE_H */ |