summaryrefslogtreecommitdiff
path: root/apps/include/readline.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/include/readline.h')
-rw-r--r--apps/include/readline.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/apps/include/readline.h b/apps/include/readline.h
index 6da6f3fd7..463643534 100644
--- a/apps/include/readline.h
+++ b/apps/include/readline.h
@@ -41,6 +41,7 @@
****************************************************************************/
#include <nuttx/config.h>
+#include <stdio.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -90,7 +91,41 @@ extern "C" {
*
**************************************************************************/
-EXTERN ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream);
+#if CONFIG_NFILE_STREAMS > 0
+ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream);
+#endif
+
+/****************************************************************************
+ * Name: std_readline
+ *
+ * std_readline is requivalent to readline except that it uses only stdin
+ * and stdout.
+ *
+ * This version of realine assumes that we are reading and writing to
+ * a VT100 console. This will not work well if 'instream' or 'outstream'
+ * corresponds to a raw byte steam.
+ *
+ * This function is inspired by the GNU readline but is an entirely
+ * different creature.
+ *
+ * Input Parameters:
+ * buf - The user allocated buffer to be filled.
+ * buflen - the size of the buffer.
+ * instream - The stream to read characters from
+ * outstream - The stream to each characters to.
+ *
+ * Returned values:
+ * On success, the (positive) number of bytes transferred is returned.
+ * EOF is returned to indicate either an end of file condition or a
+ * failure.
+ *
+ **************************************************************************/
+
+#if CONFIG_NFILE_STREAMS > 0
+# define std_readline(b,s) readline(b,s,stdin,stdout)
+#else
+ssize_t std_readline(FAR char *buf, int buflen);
+#endif
#undef EXTERN
#ifdef __cplusplus