diff --git a/examples/ftpc/ftpc.h b/examples/ftpc/ftpc.h index e034d6cc4..b13dc6d51 100644 --- a/examples/ftpc/ftpc.h +++ b/examples/ftpc/ftpc.h @@ -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 diff --git a/include/system/readline.h b/include/system/readline.h index 5651cd2e1..6a2584f7c 100644 --- a/include/system/readline.h +++ b/include/system/readline.h @@ -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 diff --git a/nshlib/Makefile b/nshlib/Makefile index 9dcaf4f41..fa90c04bb 100644 --- a/nshlib/Makefile +++ b/nshlib/Makefile @@ -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 diff --git a/nshlib/README.md b/nshlib/README.md index c711e16c4..8725bbdcf 100644 --- a/nshlib/README.md +++ b/nshlib/README.md @@ -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 | - diff --git a/nshlib/nsh.h b/nshlib/nsh.h index 8ebdbab15..bedb5c1d6 100644 --- a/nshlib/nsh.h +++ b/nshlib/nsh.h @@ -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 diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index 8fb27681a..6783f7960 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -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, "" }, # endif @@ -496,7 +496,7 @@ static const struct cmdmap_s g_cmdmap[] = { "sleep", cmd_sleep, 2, 2, "" }, #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, "" }, # endif diff --git a/nshlib/nsh_console.c b/nshlib/nsh_console.c index 7cd0a4d56..89f95e8f3 100644 --- a/nshlib/nsh_console.c +++ b/nshlib/nsh_console.c @@ -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; diff --git a/nshlib/nsh_console.h b/nshlib/nsh_console.h index c71d14533..510e26f0b 100644 --- a/nshlib/nsh_console.h +++ b/nshlib/nsh_console.h @@ -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 diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c index afc079424..4b571d85b 100644 --- a/nshlib/nsh_fscmds.c +++ b/nshlib/nsh_fscmds.c @@ -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) { diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c index b0354553a..8b51181c5 100644 --- a/nshlib/nsh_parse.c +++ b/nshlib/nsh_parse.c @@ -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) diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c index 740e0daec..5110143c5 100644 --- a/nshlib/nsh_script.c +++ b/nshlib/nsh_script.c @@ -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 */ diff --git a/nshlib/nsh_session.c b/nshlib/nsh_session.c index fc4382224..2f28412e9 100644 --- a/nshlib/nsh_session.c +++ b/nshlib/nsh_session.c @@ -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 } diff --git a/nshlib/nsh_stdsession.c b/nshlib/nsh_stdsession.c index a9da4e5e3..4f1252b05 100644 --- a/nshlib/nsh_stdsession.c +++ b/nshlib/nsh_stdsession.c @@ -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 } diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c index 940c343a8..f0d1b1947 100644 --- a/nshlib/nsh_timcmds.c +++ b/nshlib/nsh_timcmds.c @@ -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 diff --git a/testing/ostest/ostest.h b/testing/ostest/ostest.h index 133c577dd..16d992be6 100644 --- a/testing/ostest/ostest.h +++ b/testing/ostest/ostest.h @@ -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 diff --git a/testing/ostest/ostest_main.c b/testing/ostest/ostest_main.c index f10184119..6e0837338 100644 --- a/testing/ostest/ostest_main.c +++ b/testing/ostest/ostest_main.c @@ -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 }