diff options
author | Josh Blum <josh@joshknows.com> | 2011-04-30 17:11:46 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-04-30 17:11:46 -0700 |
commit | 493ed897f24fff5265b766ee634916b002cadf94 (patch) | |
tree | 09082fa8be0c71b92ca668083dd1519a452b679d /firmware/zpu | |
parent | 7b509d6fe4ac4cfcafc63f11f5b298d3e0237acd (diff) | |
parent | 1e57d1c0496ca6263652cd84c9eeacafde833915 (diff) | |
download | uhd-493ed897f24fff5265b766ee634916b002cadf94.tar.gz uhd-493ed897f24fff5265b766ee634916b002cadf94.tar.bz2 uhd-493ed897f24fff5265b766ee634916b002cadf94.zip |
Merge branch 'master' into next
Conflicts:
host/lib/usrp/usrp2/usrp2_regs.cpp
Diffstat (limited to 'firmware/zpu')
-rw-r--r-- | firmware/zpu/lib/hal_io.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/zpu/lib/hal_io.c b/firmware/zpu/lib/hal_io.c index 1d137943c..4ed694b9d 100644 --- a/firmware/zpu/lib/hal_io.c +++ b/firmware/zpu/lib/hal_io.c @@ -255,12 +255,14 @@ fngets(hal_uart_name_t u, char * const s, int len) int fngets_noblock(hal_uart_name_t u, char * const s, int len) { - char *x = s; - - while(((*x=(char)hal_uart_getc_noblock(u)) != '\n') && (*x != 255) && ((x-s) < len)) x++; - *x = 0; - //printf("Returning from fngets() with string %d of length %d\n", s[0], x-s); - return (x-s); + int i; + for(i=0; i < len; i++) { + s[i] = (char) hal_uart_getc_noblock(u); + if((s[i] == 255) || (s[i] == '\n')) break; + } + s[i] = 0; + + return i; } char * |