You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "xiaoxiang781216 (via GitHub)" <gi...@apache.org> on 2023/02/10 20:34:02 UTC
[GitHub] [nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1559: nsh: Decouple with CONFIG_FILE_STREAM
xiaoxiang781216 commented on code in PR #1559:
URL: https://github.com/apache/nuttx-apps/pull/1559#discussion_r1103211731
##########
nshlib/nsh.h:
##########
@@ -699,7 +697,7 @@ struct nsh_parser_s
#endif
#ifndef CONFIG_NSH_DISABLESCRIPT
- FILE *np_stream; /* Stream of current script */
+ int np_fd; /* Stream of current script */
Review Comment:
```suggestion
int np_fd; /* Stream of current script */
```
##########
nshlib/nsh_altconsole.c:
##########
@@ -100,23 +100,11 @@ static int nsh_clone_console(FAR struct console_stdio_s *pstate)
/* Setup the stderr */
- pstate->cn_errfd = 2;
- pstate->cn_errstream = fdopen(pstate->cn_errfd, "a");
- if (!pstate->cn_errstream)
- {
- free(pstate);
- return -EIO;
- }
+ ERRFD(pstate) = 2;
/* Setup the stdout */
- pstate->cn_outfd = 1;
- pstate->cn_outstream = fdopen(pstate->cn_outfd, "a");
- if (!pstate->cn_outstream)
- {
- free(pstate);
- return -EIO;
- }
+ OUTFD(pstate) = 1;
Review Comment:
```suggestion
OUTFD(pstate) = 1;
```
##########
nshlib/nsh_altconsole.c:
##########
@@ -100,23 +100,11 @@ static int nsh_clone_console(FAR struct console_stdio_s *pstate)
/* Setup the stderr */
- pstate->cn_errfd = 2;
- pstate->cn_errstream = fdopen(pstate->cn_errfd, "a");
- if (!pstate->cn_errstream)
- {
- free(pstate);
- return -EIO;
- }
+ ERRFD(pstate) = 2;
Review Comment:
```suggestion
ERRFD(pstate) = 2;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org