summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_console.h
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-09-30 11:34:04 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-09-30 11:34:04 -0600
commit9f2b12c2529e0fbe02693c35a82bd35168637c23 (patch)
tree45b4abb98431d8a20f1b77a56aee77cbc9929dc8 /apps/nshlib/nsh_console.h
parentf30cf5dcb7a09c5facd0329b21640005c19b541f (diff)
downloadpx4-nuttx-9f2b12c2529e0fbe02693c35a82bd35168637c23.tar.gz
px4-nuttx-9f2b12c2529e0fbe02693c35a82bd35168637c23.tar.bz2
px4-nuttx-9f2b12c2529e0fbe02693c35a82bd35168637c23.zip
Changes to NSH and readline to permit NSH to work on a platform with no file system
Diffstat (limited to 'apps/nshlib/nsh_console.h')
-rw-r--r--apps/nshlib/nsh_console.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/apps/nshlib/nsh_console.h b/apps/nshlib/nsh_console.h
index 4dc2938cb..73bab493b 100644
--- a/apps/nshlib/nsh_console.h
+++ b/apps/nshlib/nsh_console.h
@@ -1,7 +1,7 @@
/****************************************************************************
* apps/nshlib/nsh_console.h
*
- * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -74,16 +74,18 @@
/* Are we using the NuttX console for I/O? Or some other character device? */
-#ifdef CONFIG_NSH_CONDEV
-# define INFD(p) ((p)->cn_confd)
-# define INSTREAM(p) ((p)->cn_constream)
-# define OUTFD(p) ((p)->cn_confd)
-# define OUTSTREAM(p) ((p)->cn_constream)
-#else
-# define INFD(p) 0
-# define INSTREAM(p) stdin
-# define OUTFD(p) 1
-# define OUTSTREAM(p) stdout
+#if CONFIG_NFILE_STREAMS > 0
+# ifdef CONFIG_NSH_CONDEV
+# define INFD(p) ((p)->cn_confd)
+# define INSTREAM(p) ((p)->cn_constream)
+# define OUTFD(p) ((p)->cn_confd)
+# define OUTSTREAM(p) ((p)->cn_constream)
+# else
+# define INFD(p) 0
+# define INSTREAM(p) stdin
+# define OUTFD(p) 1
+# define OUTSTREAM(p) stdout
+# endif
#endif
/****************************************************************************
@@ -107,8 +109,10 @@ struct nsh_vtbl_s
ssize_t (*write)(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer, size_t nbytes);
int (*output)(FAR struct nsh_vtbl_s *vtbl, const char *fmt, ...);
FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl);
+#if CONFIG_NFILE_DESCRIPTORS > 0
void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
void (*undirect)(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save);
+#endif
void (*exit)(FAR struct nsh_vtbl_s *vtbl, int exitstatus) noreturn_function;
/* Parser state data */
@@ -128,6 +132,7 @@ struct console_stdio_s
/* NSH input/output streams */
+#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_NSH_CONDEV
int cn_confd; /* Console I/O file descriptor */
#endif
@@ -136,6 +141,7 @@ struct console_stdio_s
FILE *cn_constream; /* Console I/O stream (possibly redirected) */
#endif
FILE *cn_outstream; /* Output stream */
+#endif
/* Line input buffer */