summaryrefslogtreecommitdiff
path: root/apps/nshlib
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-02-27 11:13:21 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-02-27 11:13:21 -0600
commitbbf818f7f9f6663cd9fba941167a59c7bd5eee0b (patch)
tree42a128151c101c88c82f9d3c1a5491fa5ffd7dcb /apps/nshlib
parent7e99ec812a9a62742d799e12ef487a07bc008dfb (diff)
downloadnuttx-bbf818f7f9f6663cd9fba941167a59c7bd5eee0b.tar.gz
nuttx-bbf818f7f9f6663cd9fba941167a59c7bd5eee0b.tar.bz2
nuttx-bbf818f7f9f6663cd9fba941167a59c7bd5eee0b.zip
NSH cat command now adds to newline at the end of the file so that the NSH prompt is always on a newline
Diffstat (limited to 'apps/nshlib')
-rw-r--r--apps/nshlib/nsh_fscmds.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/nshlib/nsh_fscmds.c b/apps/nshlib/nsh_fscmds.c
index 778d2d584..9202badef 100644
--- a/apps/nshlib/nsh_fscmds.c
+++ b/apps/nshlib/nsh_fscmds.c
@@ -502,6 +502,17 @@ static int cat_common(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
}
}
+ /* Make sure that the following NSH prompt appears on a new line. If the
+ * file ends in a newline, then this will print an extra blank line
+ * before the prompt, but that is preferable to the case where there is
+ * no newline and the NSH prompt appears on the same line as the cat'ed
+ * file.
+ */
+
+ nsh_output(vtbl, "\n");
+
+ /* Close the input file and return the result */
+
(void)close(fd);
return ret;
}