Exit after reading EOF

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2221 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-11-04 15:12:42 +00:00
parent 200a91f822
commit 0c04d9093d

View File

@ -237,6 +237,11 @@ int main(int argc, char **argv, char **envp)
close(fd);
return 2;
}
else if (nbytes == 0)
{
printf("main: End-of-file encountereDs\n");
break;
}
g_iobuffer[nbytes] = '\0';
printf("main: Received %d bytes:\n", nbytes);
@ -282,8 +287,6 @@ int main(int argc, char **argv, char **envp)
#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */
}
/* Won't get here, but if we did this what we would have to do */
close(fd);
return 0;
}