Replace all CONFIG_NFILE_STREAMS with CONFIG_FILE_STREAM

follow up the kernel side change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic27ad65d7cc2ea570921e0c17098dcb6bfe1893a
This commit is contained in:
Xiang Xiao 2020-08-13 22:17:42 +08:00 committed by liuguo09
parent 3edfb4a3ac
commit ecae66fe59
16 changed files with 45 additions and 45 deletions

View File

@ -66,7 +66,7 @@
* see the output in context.
*/
#if CONFIG_NFILE_STREAMS > 0 && CONFIG_STDIO_BUFFER_SIZE > 0 && \
#if defined(CONFIG_FILE_STREAM) && CONFIG_STDIO_BUFFER_SIZE > 0 && \
!defined(CONFIG_STDIO_LINEBUFFER)
# define FFLUSH() fflush(stdout)
#else

View File

@ -186,7 +186,7 @@ FAR const struct extmatch_vtable_s *
*
****************************************************************************/
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
ssize_t readline(FAR char *buf, int buflen, FILE *instream, FILE *outstream);
#endif

View File

@ -41,16 +41,16 @@ CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_script.c nsh_system.c
CSRCS += nsh_command.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c
CSRCS += nsh_timcmds.c nsh_envcmds.c nsh_syscmds.c nsh_dbgcmds.c
ifeq ($(CONFIG_NFILE_STREAMS),0)
CSRCS += nsh_stdsession.c
ifeq ($(CONFIG_NSH_CONSOLE_LOGIN),y)
CSRCS += nsh_stdlogin.c
endif
else
ifeq ($(CONFIG_FILE_STREAM),y)
CSRCS += nsh_session.c
ifeq ($(CONFIG_NSH_CONSOLE_LOGIN),y)
CSRCS += nsh_login.c
endif
else
CSRCS += nsh_stdsession.c
ifeq ($(CONFIG_NSH_CONSOLE_LOGIN),y)
CSRCS += nsh_stdlogin.c
endif
endif
CSRCS += nsh_fsutils.c

View File

@ -1599,7 +1599,7 @@ rptun | `CONFIG_RPTUN`
set | `CONFIG_NSH_VARS` || !`CONFIG_DISABLE_ENVIRON`
shutdown | `CONFIG_BOARDCTL_POWEROFF` || `CONFIG_BOARDCTL_RESET`
sleep | -
source | `CONFIG_NFILE_STREAMS` > 0 && !`CONFIG_NSH_DISABLESCRIPT`
source | `CONFIG_FILE_STREAM` && !`CONFIG_NSH_DISABLESCRIPT`
test | !`CONFIG_NSH_DISABLESCRIPT`
telnetd | `CONFIG_NSH_TELNET` && !`CONFIG_NSH_DISABLE_TELNETD`
time | -

View File

@ -55,7 +55,7 @@
# endif
#endif
#if CONFIG_NFILE_STREAMS == 0
#ifndef CONFIG_FILE_STREAM
# undef CONFIG_NSH_TELNET
# undef CONFIG_NSH_FILE_APPS
# undef CONFIG_NSH_TELNET
@ -709,7 +709,7 @@ struct nsh_parser_s
#ifndef CONFIG_NSH_DISABLEBG
bool np_bg; /* true: The last command executed in background */
#endif
#if CONFIG_NFILE_STREAMS > 0
#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 */
@ -818,7 +818,7 @@ int nsh_usbconsole(void);
# define nsh_usbconsole() (-ENOSYS)
#endif
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
FAR const char *path);
#ifdef CONFIG_NSH_ROMFSETC
@ -998,11 +998,11 @@ int cmd_irqinfo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SOURCE
int cmd_source(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
#endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */
#endif /* CONFIG_FILE_STREAM && !CONFIG_NSH_DISABLESCRIPT */
#ifdef NSH_HAVE_DIROPTS
# ifndef CONFIG_NSH_DISABLE_MKDIR

View File

@ -85,7 +85,7 @@ static int cmd_unrecognized(FAR struct nsh_vtbl_s *vtbl, int argc,
static const struct cmdmap_s g_cmdmap[] =
{
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SOURCE
{ ".", cmd_source, 2, 2, "<script-path>" },
# endif
@ -496,7 +496,7 @@ static const struct cmdmap_s g_cmdmap[] =
{ "sleep", cmd_sleep, 2, 2, "<sec>" },
#endif
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SOURCE
{ "source", cmd_source, 2, 2, "<script-path>" },
# endif

View File

@ -58,7 +58,7 @@
* Private Types
****************************************************************************/
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
struct serialsave_s
{
int cn_errfd; /* Re-directed error output file descriptor */
@ -131,7 +131,7 @@ static int nsh_openifnotopen(struct console_stdio_s *pstate)
*
****************************************************************************/
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
static void nsh_closeifnotclosed(struct console_stdio_s *pstate)
{
if (pstate->cn_outstream == OUTSTREAM(pstate))
@ -477,7 +477,7 @@ FAR struct console_stdio_s *nsh_newconsole(void)
pstate->cn_vtbl.np.np_flags = NSH_NP_SET_OPTIONS_INIT;
#endif
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
pstate->cn_vtbl.redirect = nsh_consoleredirect;
pstate->cn_vtbl.undirect = nsh_consoleundirect;

View File

@ -79,7 +79,7 @@
/* Are we using the NuttX console for I/O? Or some other character device? */
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
# ifdef CONFIG_NSH_ALTCONDEV
# if !defined(CONFIG_NSH_ALTSTDIN) && !defined(CONFIG_NSH_ALTSTDOUT) && \
@ -157,7 +157,7 @@ struct console_stdio_s
/* NSH input/output streams */
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
#ifdef CONFIG_NSH_ALTCONDEV
int cn_confd; /* Console I/O file descriptor */
#endif

View File

@ -1692,7 +1692,7 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_source
****************************************************************************/
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
#ifndef CONFIG_NSH_DISABLE_SOURCE
int cmd_source(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{

View File

@ -335,7 +335,7 @@ static void nsh_releaseargs(struct cmdarg_s *arg)
FAR struct nsh_vtbl_s *vtbl = arg->vtbl;
int i;
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
/* If the output was redirected, then file descriptor should
* be closed. The created task has its one, independent copy of
* the file descriptor
@ -484,7 +484,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
int argc, FAR char *argv[],
FAR const char *redirfile, int oflags)
{
#if CONFIG_NFILE_STREAMS > 0 || !defined(CONFIG_NSH_DISABLEBG)
#if defined(CONFIG_FILE_STREAM) || !defined(CONFIG_NSH_DISABLEBG)
int fd = -1;
#endif
int ret;
@ -524,7 +524,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
*/
#ifdef CONFIG_NSH_BUILTIN_APPS
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
ret = nsh_builtin(vtbl, argv[0], argv, redirfile, oflags);
#else
ret = nsh_builtin(vtbl, argv[0], argv, NULL, 0);
@ -584,7 +584,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
#endif
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
/* Redirected output? */
if (vtbl->np.np_redirect)
@ -638,7 +638,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
goto errout_with_redirect;
}
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
/* Handle redirection of output via a file descriptor */
if (vtbl->np.np_redirect)
@ -720,7 +720,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
else
#endif
{
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
uint8_t save[SAVE_SIZE];
/* Handle redirection of output via a file descriptor */
@ -740,7 +740,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
ret = nsh_command(vtbl, argc, argv);
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
/* Restore the original output. Undirect will close the redirection
* file descriptor.
*/
@ -769,7 +769,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
#ifndef CONFIG_NSH_DISABLEBG
errout_with_redirect:
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
if (vtbl->np.np_redirect)
{
close(fd);
@ -2374,7 +2374,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline)
int oflags = 0;
int argc;
int ret;
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
bool redirect_save = false;
#endif
@ -2387,7 +2387,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline)
vtbl->np.np_bg = false;
#endif
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
vtbl->np.np_redirect = false;
#endif
@ -2537,7 +2537,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline)
}
#endif
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
/* Check if the output was re-directed using > or >> */
if (argc > 2)
@ -2579,7 +2579,7 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline)
/* Free any allocated resources */
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
/* Free the redirected output file path */
if (redirfile)

View File

@ -42,7 +42,7 @@
#include "nsh.h"
#include "nsh_console.h"
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
/****************************************************************************
* Public Functions
@ -218,4 +218,4 @@ int nsh_loginscript(FAR struct nsh_vtbl_s *vtbl)
#endif
#endif /* CONFIG_NSH_ROMFSETC */
#endif /* CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT */
#endif /* CONFIG_FILE_STREAM && !CONFIG_NSH_DISABLESCRIPT */

View File

@ -199,7 +199,7 @@ int nsh_session(FAR struct console_stdio_s *pstate,
}
else if (strcmp(argv[1], "-c") != 0)
{
#if defined(CONFIG_NFILE_STREAMS) && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
/* Execute the shell script */
ret = nsh_script(vtbl, argv[0], argv[1]);
@ -210,7 +210,7 @@ int nsh_session(FAR struct console_stdio_s *pstate,
/* Parse process the command */
ret = nsh_parse(vtbl, argv[2]);
#ifdef CONFIG_NFILE_STREAMS
#ifdef CONFIG_FILE_STREAM
fflush(pstate->cn_outstream);
#endif
}

View File

@ -180,7 +180,7 @@ int nsh_session(FAR struct console_stdio_s *pstate,
}
else if (strcmp(argv[1], "-c") != 0)
{
#if defined(CONFIG_NFILE_STREAMS) && !defined(CONFIG_NSH_DISABLESCRIPT)
#if defined(CONFIG_FILE_STREAM) && !defined(CONFIG_NSH_DISABLESCRIPT)
/* Execute the shell script */
ret = nsh_script(vtbl, argv[0], argv[1]);
@ -191,7 +191,7 @@ int nsh_session(FAR struct console_stdio_s *pstate,
/* Parse process the command */
ret = nsh_parse(vtbl, argv[2]);
#ifdef CONFIG_NFILE_STREAMS
#ifdef CONFIG_FILE_STREAM
fflush(pstate->cn_outstream);
#endif
}

View File

@ -299,7 +299,7 @@ int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLEBG
bool bgsave;
#endif
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
bool redirsave;
#endif
int ret;
@ -318,7 +318,7 @@ int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLEBG
bgsave = vtbl->np.np_bg;
#endif
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
redirsave = vtbl->np.np_redirect;
#endif
@ -359,7 +359,7 @@ int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#ifndef CONFIG_NSH_DISABLEBG
vtbl->np.np_bg = bgsave;
#endif
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
vtbl->np.np_redirect = redirsave;
#endif

View File

@ -89,7 +89,7 @@
# define CONFIG_STDIO_BUFFER_SIZE 0
#endif
#if CONFIG_NFILE_STREAMS > 0 && CONFIG_STDIO_BUFFER_SIZE > 0 && \
#if defined(CONFIG_FILE_STREAM) && CONFIG_STDIO_BUFFER_SIZE > 0 && \
!defined(CONFIG_STDIO_LINEBUFFER)
# define FFLUSH() fflush(stdout)
#else

View File

@ -563,7 +563,7 @@ static void stdio_test(void)
printf("stdio_test: Standard I/O Check: printf\n");
write(2, write_data2, sizeof(write_data2)-1);
#if CONFIG_NFILE_STREAMS > 0
#ifdef CONFIG_FILE_STREAM
fprintf(stderr, "stdio_test: Standard I/O Check: fprintf to stderr\n");
#endif
}