summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-06 13:35:15 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-06 13:35:15 -0600
commite7a549ea4ab0c3a8d69ca6cec992c28334c3632e (patch)
tree7ad936acbaff16dfdb7935acf16098dd3288710a /apps
parent9a97d4d6459252f84a0c3a8b6833ba58ae92a175 (diff)
downloadnuttx-e7a549ea4ab0c3a8d69ca6cec992c28334c3632e.tar.gz
nuttx-e7a549ea4ab0c3a8d69ca6cec992c28334c3632e.tar.bz2
nuttx-e7a549ea4ab0c3a8d69ca6cec992c28334c3632e.zip
Recovering from GIT chaos
Diffstat (limited to 'apps')
-rw-r--r--apps/interpreters/bas/fs.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/apps/interpreters/bas/fs.c b/apps/interpreters/bas/fs.c
index 790774543..cea05db56 100644
--- a/apps/interpreters/bas/fs.c
+++ b/apps/interpreters/bas/fs.c
@@ -285,24 +285,43 @@ static int edit(int chn, int onl)
#else
if ((f->inCapacity + 1) < sizeof(f->inBuf))
{
- if (ch != '\n')
+ /* Ignore carriage returns that may accompany a CRLF sequence.
+ * REVISIT: Some environments may have other line termination rules
+ */
+
+ if (ch != '\r')
{
- if (ch >= '\0' && ch < ' ')
+ /* Is this a new line character */
+
+ if (ch != '\n')
{
- FS_putChar(chn, '^');
- FS_putChar(chn, ch ? (ch + 'a' - 1) : '@');
+ /* No.. escape control characters other than newline and
+ * carriage return
+ */
+
+ if (ch >= '\0' && ch < ' ')
+ {
+ FS_putChar(chn, '^');
+ FS_putChar(chn, ch ? (ch + 'a' - 1) : '@');
+ }
+
+ /* Output normal, printable characters */
+
+ else
+ {
+ FS_putChar(chn, ch);
+ }
}
- else
+
+ /* Echo the newline (or not) */
+
+ else if (onl)
{
- FS_putChar(chn, ch);
+ FS_putChar(chn, '\n');
}
- }
- else if (onl)
- {
- FS_putChar(chn, '\n');
- }
- f->inBuf[f->inCapacity++] = ch;
+ f->inBuf[f->inCapacity++] = ch;
+ }
}
#endif
}
@@ -1669,12 +1688,6 @@ int FS_appendToString(int chn, struct String *s, int onl)
f->inSize = f->inCapacity = 0;
}
- if (s->length >= 2 && s->character[s->length - 2] == '\r')
- {
- s->character[s->length - 2] = '\n';
- --s->length;
- }
-
return 0;
}
}