summaryrefslogtreecommitdiff
path: root/apps/system/hex2bin
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-06-15 14:06:46 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-06-15 14:06:46 -0600
commit03b41638779fc9e76ca37d3637194ae470a526be (patch)
tree0657d08798b2a83dafb34fd6ed48df414ebac514 /apps/system/hex2bin
parent47670d9c2a85c767e675498bed522d4586aeefa1 (diff)
downloadpx4-nuttx-03b41638779fc9e76ca37d3637194ae470a526be.tar.gz
px4-nuttx-03b41638779fc9e76ca37d3637194ae470a526be.tar.bz2
px4-nuttx-03b41638779fc9e76ca37d3637194ae470a526be.zip
hex2dump: Needs to read new character at end of the loop
Diffstat (limited to 'apps/system/hex2bin')
-rw-r--r--apps/system/hex2bin/hex2bin.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/system/hex2bin/hex2bin.c b/apps/system/hex2bin/hex2bin.c
index 463de27e6..e92879a34 100644
--- a/apps/system/hex2bin/hex2bin.c
+++ b/apps/system/hex2bin/hex2bin.c
@@ -249,17 +249,18 @@ int data2bin(FAR uint8_t* dest, FAR const uint8_t *src, int nbytes)
static int readstream(FAR struct lib_instream_s *instream,
FAR uint8_t *line, unsigned int lineno)
{
- int ch = instream->get(instream);
int nbytes = 0;
+ int ch;
/* Skip until the beginning of line start code is encountered */
+ ch = instream->get(instream);
while (ch != RECORD_STARTCODE && ch != EOF)
{
ch = instream->get(instream);
}
- /* Skip over the start code */
+ /* Skip over the startcode */
if (ch != EOF)
{
@@ -313,6 +314,10 @@ static int readstream(FAR struct lib_instream_s *instream,
lineno, isprint(ch) ? ch : '.', ch);
break;
}
+
+ /* Read the next character from the input stream */
+
+ ch = instream->get(instream);
}
/* Some error occurred: Unexpected EOF, line too long, or bad character in