summaryrefslogtreecommitdiff
path: root/apps/examples/usbterm
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-10 00:46:27 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-10 00:46:27 +0000
commitf0fef8e21fd0459b75b3e5faf318634e5befbdaf (patch)
treed9451e3904a1b2e84bce6b183ccaca719b78ff51 /apps/examples/usbterm
parent9768bf44e8f274eecc92f4eefbf0496f32649196 (diff)
downloadnuttx-f0fef8e21fd0459b75b3e5faf318634e5befbdaf.tar.gz
nuttx-f0fef8e21fd0459b75b3e5faf318634e5befbdaf.tar.bz2
nuttx-f0fef8e21fd0459b75b3e5faf318634e5befbdaf.zip
Fix a readline bug. If a NUL is received, it would return end-of-file
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5633 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/usbterm')
-rw-r--r--apps/examples/usbterm/usbterm_main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/examples/usbterm/usbterm_main.c b/apps/examples/usbterm/usbterm_main.c
index 69301dfcd..747a52978 100644
--- a/apps/examples/usbterm/usbterm_main.c
+++ b/apps/examples/usbterm/usbterm_main.c
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/usbterm/usbterm_main.c
*
- * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -325,12 +325,11 @@ int usbterm_main(int argc, char *argv[])
ret = readline(g_usbterm.outbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, stdin, stdout);
/* Readline normally returns the number of characters read,
- * but will return 0 on end of file or a negative value
- * if an error occurs. Either will cause the session to
- * terminate.
+ * but will return EOF on end of file or if an error occurs. Either
+ * will cause the session to terminate.
*/
- if (ret <= 0)
+ if (ret == EOF)
{
printf("ERROR: readline failed: %d\n", ret);
return 1;