diff options
author | px4dev <px4@purgatory.org> | 2012-08-14 09:07:59 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-08-14 09:07:59 -0700 |
commit | 74980af6c94372e49619b905e9b1b4565930e68a (patch) | |
tree | d902ff890bb38f20c01ecd0cf0428e05d4f3ca2a /apps | |
parent | 34118c72ef88d33d0074914c9bf0cda0232e4940 (diff) | |
parent | 3cc812dbad530e36360a992da9bc4533c016d98d (diff) | |
download | px4-firmware-74980af6c94372e49619b905e9b1b4565930e68a.tar.gz px4-firmware-74980af6c94372e49619b905e9b1b4565930e68a.tar.bz2 px4-firmware-74980af6c94372e49619b905e9b1b4565930e68a.zip |
Merge branch 'NuttX/master' from git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5027 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/ChangeLog.txt | 4 | ||||
-rw-r--r-- | apps/interpreters/Make.defs | 4 | ||||
-rw-r--r-- | apps/namedapp/Make.defs | 2 | ||||
-rw-r--r-- | apps/nshlib/Make.defs | 2 | ||||
-rw-r--r-- | apps/system/Make.defs | 8 | ||||
-rw-r--r-- | apps/system/readline/readline.c | 50 |
6 files changed, 57 insertions, 13 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 1bb2a08b5..01ef090a0 100755 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -274,3 +274,7 @@ no arguments outputs a short list of commands. With -v lists all command line details. And command name can be added to just get help on one command. + * system/readline.c: If character input/output is interrupted by a + signal, then readline() will try the read/write again. + * apps/*/Make.defs: Numerous fixes needed to use the automated + configuration (from Richard Cochran). diff --git a/apps/interpreters/Make.defs b/apps/interpreters/Make.defs index 36ee7004d..2fc4b26d4 100644 --- a/apps/interpreters/Make.defs +++ b/apps/interpreters/Make.defs @@ -34,10 +34,10 @@ # ############################################################################ -if ($(CONFIG_PCODE),y) +ifeq ($(CONFIG_PCODE),y) CONFIGURED_APPS += interpreters/pcode endif -if ($(CONFIG_FICL),y) +ifeq ($(CONFIG_FICL),y) CONFIGURED_APPS += interpreters/ficl endif diff --git a/apps/namedapp/Make.defs b/apps/namedapp/Make.defs index a07b3b3c2..399fefee8 100644 --- a/apps/namedapp/Make.defs +++ b/apps/namedapp/Make.defs @@ -34,7 +34,7 @@ # ############################################################################ -if ($(CONFIG_NAMEDAPP),y) +ifeq ($(CONFIG_NAMEDAPP),y) CONFIGURED_APPS += namedapp endif diff --git a/apps/nshlib/Make.defs b/apps/nshlib/Make.defs index c72c09bce..2bacb5b79 100644 --- a/apps/nshlib/Make.defs +++ b/apps/nshlib/Make.defs @@ -34,7 +34,7 @@ # ############################################################################ -if ($(CONFIG_NSH_LIBRARY),y) +ifeq ($(CONFIG_NSH_LIBRARY),y) CONFIGURED_APPS += nshlib endif diff --git a/apps/system/Make.defs b/apps/system/Make.defs index 1ddabd337..e72f56ef5 100644 --- a/apps/system/Make.defs +++ b/apps/system/Make.defs @@ -34,18 +34,18 @@ # ############################################################################ -if ($(CONFIG_VSN_POWEROFF),y) +ifeq ($(CONFIG_VSN_POWEROFF),y) CONFIGURED_APPS += vsn/poweroff endif -if ($(CONFIG_VSN_RAMTRON),y) +ifeq ($(CONFIG_VSN_RAMTRON),y) CONFIGURED_APPS += vsn/ramtron endif -if ($(CONFIG_VSN_SDCARD),y) +ifeq ($(CONFIG_VSN_SDCARD),y) CONFIGURED_APPS += vsn/sdcard endif -if ($(CONFIG_VSN_SYSINFO),y) +ifeq ($(CONFIG_VSN_SYSINFO),y) CONFIGURED_APPS += vsn/sysinfo endif diff --git a/apps/system/readline/readline.c b/apps/system/readline/readline.c index f7fa6a635..bdd39e67b 100644 --- a/apps/system/readline/readline.c +++ b/apps/system/readline/readline.c @@ -103,13 +103,34 @@ static inline int readline_rawgetc(int infd) char buffer; ssize_t nread; - nread = read(infd, &buffer, 1); - if (nread < 1) + /* Loop until we successfully read a character (or until an unexpected + * error occurs). + */ + + do { - /* Return EOF if the end of file (0) or error (-1) occurs */ + /* Read one character from the incoming stream */ + + nread = read(infd, &buffer, 1); + + /* Return EOF if the end of file (0) or error (-1) occurs. */ + + if (nread < 1) + { + /* EINTR is not really an error; it simply means that a signal we + * received while watiing for intput. + */ - return EOF; + if (nread == 0 || errno != EINTR) + { + return EOF; + } + } } + while (nread < 1); + + /* On success, returnt he character that was read */ + return (int)buffer; } @@ -121,7 +142,26 @@ static inline int readline_rawgetc(int infd) static inline void readline_consoleputc(int ch, int outfd) { char buffer = ch; - (void)write(outfd, &buffer, 1); + ssize_t nwritten; + + /* Loop until we successfully write a character (or until an unexpected + * error occurs). + */ + + do + { + /* Write the character to the outgoing stream */ + + nwritten = write(outfd, &buffer, 1); + + /* Check for irrecoverable write errors. */ + + if (nwritten < 0 && errno != EINTR) + { + break; + } + } + while (nwritten < 1); } #endif |