Previously, if the read bytes were less than the requested, the
file was closed immediately. This behavior, however, does not
consider the fact that the read operation may be blocking when
no bytes are available at the moment. That is true for a named pipe
(FIFO), for instance. Thus, reading it again lets to the underlying
file system the decision of 1) blocking until bytes become
available or 2) return 0 immediately (the case for actual files) or
3) read available bytes.
If the code only change c_oflag, c_iflag and c_lflag, not c_cflag in termios.
Follow up the change from kernel: https://github.com/apache/nuttx/pull/8843
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Fix https://github.com/apache/nuttx/issues/8731, don't rely on the vt100 to report
the cursor position.
This avoid the implicit input (response of get cursor command) during the user inputs.
Notice: This assume that the nsh prompt is always shown at line start.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Since termcurse will control whole echo and vt100 command itself.
This fix the dupped character in VI's command mode and some display issue in editor mode, like:
```
~
~
~
~
:qq!!
```
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Let's echo character by serial driver,
this will imporve the experience of telnetd,
which will display input command and newline twice.
And also enhance the compatiblity with some third party
linux readline based application (like WAMR repl).
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Replace all fwrite/fread/fgets/... to write/read/...
Before:
```
text data bss dec hex filename
109827 601 6608 117036 1c92c nuttx/nuttx
```
After:
```
text data bss dec hex filename
108053 601 6608 115262 1c23e nuttx/nuttx
```
After with CONFIG_FILE_STREAM disabled:
```
text data bss dec hex filename
105667 601 6608 112876 1b8ec nuttx/nuttx
```
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
| In file included from libuv/src/uv-common.h:42,
| from libuv/src/uv-common.c:23:
| libuv/src/uv-common.c: In function 'uv_walk':
| libuv/src/queue.h:68:19: warning: storing the address of local variable 'queue' in '((void * (**)[2])MEM[(void *[2] * *)loop_13(D) + 8B])[1]' [-Wdangling-pointer=]
| 68 | QUEUE_PREV(q) = (n); \
| | ^
| libuv/src/queue.h:78:7: note: in expansion of macro 'QUEUE_SPLIT'
| 78 | QUEUE_SPLIT(h, q, n); \
| | ^~~~~~~~~~~
Signed-off-by: chao an <anchao@xiaomi.com>
The old flagging was insufficient, only '\r' was accepted as a line terminator
if CONFIG_EOL_IS_EITHER_CRLF was set.
I noticed this regression after:
https://github.com/apache/nuttx/pull/8454
nxplayer_main.c:
code checker warning:
level_percent = (uint8_t) atoi(parg);
'atoi' used to convert a string to an integer value, but function will not report conversion errors; consider using 'strtol' instead.
nxlooper_main.c:
code checker warning:
percent = (uint16_t)(atof(parg) * 10.0);
'atof' used to convert a string to a floating-point value, but function will not report conversion errors; consider using 'strtod' instead
Signed-off-by: liubojun1 <liubojun1@xiaomi.com>