mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-18 08:52:01 +08:00
nsh: Decouple with CONFIG_FILE_STREAM
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>
This commit is contained in:
@@ -687,9 +687,7 @@ struct nsh_parser_s
|
||||
#ifndef CONFIG_NSH_DISABLEBG
|
||||
bool np_bg; /* true: The last command executed in background */
|
||||
#endif
|
||||
#ifdef CONFIG_FILE_STREAM
|
||||
bool np_redirect; /* true: Output from the last command was re-directed */
|
||||
#endif
|
||||
bool np_fail; /* true: The last command failed */
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
uint8_t np_flags; /* See nsh_npflags_e above */
|
||||
@@ -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 */
|
||||
#ifndef CONFIG_NSH_DISABLE_LOOPS
|
||||
long np_foffs; /* File offset to the beginning of a line */
|
||||
#ifndef NSH_DISABLE_SEMICOLON
|
||||
@@ -801,7 +799,7 @@ int nsh_usbconsole(void);
|
||||
# define nsh_usbconsole() (-ENOSYS)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
|
||||
#ifndef CONFIG_NSH_DISABLESCRIPT
|
||||
int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
FAR const char *path, bool log);
|
||||
#ifdef CONFIG_NSH_ROMFSETC
|
||||
|
Reference in New Issue
Block a user