From 9db029e318cbbdce4a077274a6ca5cac52bba5bf Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 11 Feb 2019 13:10:10 -0600 Subject: [PATCH] The file system can no longer be disabled. Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS==0 --- examples/README.txt | 3 +- examples/bastest/bastest_main.c | 5 +- examples/elf/elf_main.c | 4 - examples/ftpc/ftpc.h | 4 +- examples/hidkbd/hidkbd_main.c | 4 - examples/module/module_main.c | 4 - examples/nxflat/nxflat_main.c | 4 - examples/posix_spawn/spawn_main.c | 4 - examples/thttpd/thttpd_main.c | 4 - examples/webserver/webserver_main.c | 2 - examples/xbc_test/xbc_test_main.c | 4 - fsutils/mksmartfs/mksmartfs.c | 24 ++- include/netutils/tftp.h | 4 - netutils/tftpc/Makefile | 2 - netutils/tftpc/tftpc_get.c | 3 +- netutils/tftpc/tftpc_packets.c | 13 +- netutils/tftpc/tftpc_put.c | 3 +- nshlib/Makefile | 2 - nshlib/README.txt | 60 +++--- nshlib/nsh.h | 286 +++++++++++++--------------- nshlib/nsh_command.c | 79 ++++---- nshlib/nsh_console.c | 74 +------ nshlib/nsh_console.h | 2 - nshlib/nsh_dbgcmds.c | 7 +- nshlib/nsh_ddcmd.c | 4 +- nshlib/nsh_envcmds.c | 14 +- nshlib/nsh_fscmds.c | 101 ++++------ nshlib/nsh_mntcmds.c | 16 +- nshlib/nsh_netcmds.c | 16 +- nshlib/nsh_passwdcmds.c | 9 +- nshlib/nsh_script.c | 5 +- system/nsh/nsh_main.c | 5 - testing/ostest/dev_null.c | 3 - testing/ostest/ostest.h | 4 +- testing/ostest/ostest_main.c | 8 - 35 files changed, 297 insertions(+), 489 deletions(-) diff --git a/examples/README.txt b/examples/README.txt index 4b0910d1b..425f729eb 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1254,7 +1254,6 @@ examples/poll stdin, and a TCP/IP socket. In order to build this test, you must the following selected in your NuttX configuration file: - CONFIG_NFILE_DESCRIPTORS - Defined to be greater than 0 CONFIG_DISABLE_POLL - NOT defined In order to use the TCP/IP select test, you have also the following @@ -1863,7 +1862,7 @@ examples/unionfs nuttx/fs/unionfs/README.txt. Dependencies: CONFIG_DISABLE_MOUNTPOINT - Mountpoint support must not be disabled - CONFIG_NFILE_DESCRIPTORS < 4 - Some file descriptors must be allocated + CONFIG_NFILE_DESCRIPTORS > 4 - Some file descriptors must be allocated CONFIG_FS_ROMFS - ROMFS support is required CONFIG_FS_UNIONFS - Union File System support is required diff --git a/examples/bastest/bastest_main.c b/examples/bastest/bastest_main.c index 5d1c1647c..aba023758 100644 --- a/examples/bastest/bastest_main.c +++ b/examples/bastest/bastest_main.c @@ -50,14 +50,11 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Check configuration. This is not all of the configuration settings that * are required -- only the more obvious. */ -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - #ifndef CONFIG_FS_ROMFS # error "You must select CONFIG_FS_ROMFS in your configuration file" #endif diff --git a/examples/elf/elf_main.c b/examples/elf/elf_main.c index 9dfd6e1b8..9e258f281 100644 --- a/examples/elf/elf_main.c +++ b/examples/elf/elf_main.c @@ -75,10 +75,6 @@ * are required -- only the more obvious. */ -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - #ifdef CONFIG_BINFMT_DISABLE # error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" #endif diff --git a/examples/ftpc/ftpc.h b/examples/ftpc/ftpc.h index dbc328860..e034d6cc4 100644 --- a/examples/ftpc/ftpc.h +++ b/examples/ftpc/ftpc.h @@ -66,8 +66,8 @@ * see the output in context. */ -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \ - CONFIG_STDIO_BUFFER_SIZE > 0 && !defined(CONFIG_STDIO_LINEBUFFER) +#if CONFIG_NFILE_STREAMS > 0 && CONFIG_STDIO_BUFFER_SIZE > 0 && \ + !defined(CONFIG_STDIO_LINEBUFFER) # define FFLUSH() fflush(stdout) #else # define FFLUSH() diff --git a/examples/hidkbd/hidkbd_main.c b/examples/hidkbd/hidkbd_main.c index a8fa992cd..663a621ef 100644 --- a/examples/hidkbd/hidkbd_main.c +++ b/examples/hidkbd/hidkbd_main.c @@ -66,10 +66,6 @@ # error "Interrupt endpoints are disabled (CONFIG_USBHOST_INT_DISABLE)" #endif -#ifndef CONFIG_NFILE_DESCRIPTORS -# error "CONFIG_NFILE_DESCRIPTORS > 0 needed" -#endif - /* Provide some default values for other configuration settings */ #ifndef CONFIG_EXAMPLES_HIDKBD_DEVNAME diff --git a/examples/module/module_main.c b/examples/module/module_main.c index fdf745816..2d198b925 100644 --- a/examples/module/module_main.c +++ b/examples/module/module_main.c @@ -71,10 +71,6 @@ * are required -- only the more obvious. */ -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - #ifndef CONFIG_MODULE # error "You must select CONFIG_MODULE in your configuration file" #endif diff --git a/examples/nxflat/nxflat_main.c b/examples/nxflat/nxflat_main.c index 8845f348e..8cbc56ebf 100644 --- a/examples/nxflat/nxflat_main.c +++ b/examples/nxflat/nxflat_main.c @@ -65,10 +65,6 @@ * are required -- only the more obvious. */ -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - #ifdef CONFIG_BINFMT_DISABLE # error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" #endif diff --git a/examples/posix_spawn/spawn_main.c b/examples/posix_spawn/spawn_main.c index f59fd9ec2..abbb8cff8 100644 --- a/examples/posix_spawn/spawn_main.c +++ b/examples/posix_spawn/spawn_main.c @@ -65,10 +65,6 @@ * are required -- only the more obvious. */ -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - #ifdef CONFIG_BINFMT_DISABLE # error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" #endif diff --git a/examples/thttpd/thttpd_main.c b/examples/thttpd/thttpd_main.c index aa29c5364..3e1fddaf0 100644 --- a/examples/thttpd/thttpd_main.c +++ b/examples/thttpd/thttpd_main.c @@ -81,10 +81,6 @@ * are required -- only the more obvious. */ -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - #ifdef CONFIG_BINFMT_DISABLE # error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" #endif diff --git a/examples/webserver/webserver_main.c b/examples/webserver/webserver_main.c index 36f02b434..ac8dd1bc6 100644 --- a/examples/webserver/webserver_main.c +++ b/examples/webserver/webserver_main.c @@ -197,9 +197,7 @@ int webserver_main(int argc, char *argv[]) { sleep(3); printf("webserver_main: Still running\n"); -#if CONFIG_NFILE_DESCRIPTORS > 0 fflush(stdout); -#endif } return 0; diff --git a/examples/xbc_test/xbc_test_main.c b/examples/xbc_test/xbc_test_main.c index f33ad39b9..bef656cb8 100644 --- a/examples/xbc_test/xbc_test_main.c +++ b/examples/xbc_test/xbc_test_main.c @@ -65,10 +65,6 @@ # error "Interrupt endpoints are disabled (CONFIG_USBHOST_INT_DISABLE)" #endif -#ifndef CONFIG_NFILE_DESCRIPTORS -# error "CONFIG_NFILE_DESCRIPTORS > 0 needed" -#endif - /* Provide some default values for other configuration settings */ #ifndef CONFIG_EXAMPLES_XBC_DEVNAME diff --git a/fsutils/mksmartfs/mksmartfs.c b/fsutils/mksmartfs/mksmartfs.c index d5f8276ed..1d385b850 100644 --- a/fsutils/mksmartfs/mksmartfs.c +++ b/fsutils/mksmartfs/mksmartfs.c @@ -36,23 +36,21 @@ * Included Files ****************************************************************************/ -# include +#include -#if CONFIG_NFILE_DESCRIPTORS > 0 -# include -# include -# include +#include +#include +#include #include -# if !defined(CONFIG_DISABLE_MOUNTPOINT) -# ifdef CONFIG_FS_SMARTFS -# include "fsutils/mksmartfs.h" -# include -# include -# endif -#endif +#if !defined(CONFIG_DISABLE_MOUNTPOINT) +# ifdef CONFIG_FS_SMARTFS +# include "fsutils/mksmartfs.h" +# include +# include +# endif #endif -# include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/include/netutils/tftp.h b/include/netutils/tftp.h index 640bb583d..026053c1e 100644 --- a/include/netutils/tftp.h +++ b/include/netutils/tftp.h @@ -88,16 +88,12 @@ extern "C" int tftpget_cb(FAR const char *remote, in_addr_t addr, bool binary, tftp_callback_t cb, FAR void *ctx); - int tftpput_cb(FAR const char *remote, in_addr_t addr, bool binary, tftp_callback_t cb, FAR void *ctx); - -#if CONFIG_NFILE_DESCRIPTORS > 0 int tftpget(FAR const char *remote, FAR const char *local, in_addr_t addr, bool binary); int tftpput(FAR const char *local, FAR const char *remote, in_addr_t addr, bool binary); -#endif #undef EXTERN #ifdef __cplusplus diff --git a/netutils/tftpc/Makefile b/netutils/tftpc/Makefile index d792e8f77..6f2d65403 100644 --- a/netutils/tftpc/Makefile +++ b/netutils/tftpc/Makefile @@ -38,9 +38,7 @@ # TFTP Client Library ifeq ($(CONFIG_NET_UDP),y) -ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) CSRCS += tftpc_get.c tftpc_put.c tftpc_packets.c endif -endif include $(APPDIR)/Application.mk diff --git a/netutils/tftpc/tftpc_get.c b/netutils/tftpc/tftpc_get.c index 1747e5da0..848478ccb 100644 --- a/netutils/tftpc/tftpc_get.c +++ b/netutils/tftpc/tftpc_get.c @@ -297,7 +297,6 @@ errout: return result; } -#if CONFIG_NFILE_DESCRIPTORS > 0 /**************************************************************************** * Name: tftp_write ****************************************************************************/ @@ -375,4 +374,4 @@ errout: } #endif -#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 */ +#endif /* CONFIG_NET && CONFIG_NET_UDP */ diff --git a/netutils/tftpc/tftpc_packets.c b/netutils/tftpc/tftpc_packets.c index 2bcb60f61..0dc6b3b79 100644 --- a/netutils/tftpc/tftpc_packets.c +++ b/netutils/tftpc/tftpc_packets.c @@ -57,15 +57,7 @@ #include "tftpc_internal.h" -#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ +#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP) /**************************************************************************** * Private Functions @@ -328,4 +320,5 @@ ssize_t tftp_sendto(int sd, const void *buf, size_t len, struct sockaddr_in *to) } } -#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS */ +#endif /* CONFIG_NET && CONFIG_NET_UDP */ + diff --git a/netutils/tftpc/tftpc_put.c b/netutils/tftpc/tftpc_put.c index 73eb2f098..198f97526 100644 --- a/netutils/tftpc/tftpc_put.c +++ b/netutils/tftpc/tftpc_put.c @@ -424,7 +424,6 @@ errout: return result; } -#if CONFIG_NFILE_DESCRIPTORS > 0 /**************************************************************************** * Name: tftp_read ****************************************************************************/ @@ -522,4 +521,4 @@ errout: } #endif -#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 */ +#endif /* CONFIG_NET && CONFIG_NET_UDP */ diff --git a/nshlib/Makefile b/nshlib/Makefile index d010ee8cc..18c7760fe 100644 --- a/nshlib/Makefile +++ b/nshlib/Makefile @@ -53,9 +53,7 @@ CSRCS += nsh_login.c endif endif -ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) CSRCS += nsh_fsutils.c -endif ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) CSRCS += nsh_builtin.c diff --git a/nshlib/README.txt b/nshlib/README.txt index b03008c48..833c33019 100644 --- a/nshlib/README.txt +++ b/nshlib/README.txt @@ -1420,72 +1420,72 @@ Command Dependencies on Configuration Settings base64enc CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64 basename -- break !CONFIG_NSH_DISABLESCRIPT && !CONFIG_NSH_DISABLE_LOOPS - cat CONFIG_NFILE_DESCRIPTORS > 0 - cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0 - cp CONFIG_NFILE_DESCRIPTORS > 0 - dd CONFIG_NFILE_DESCRIPTORS > 0 + cat -- + cd !CONFIG_DISABLE_ENVIRON + cp -- + dd -- delroute CONFIG_NET && CONFIG_NET_ROUTE - df !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3) + df !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_READABLE (see note 3) dirname -- echo -- - env -- CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_PROCFS && !CONFIG_DISABLE_ENVIRON && !CONFIG_PROCFS_EXCLUDE_ENVIRON + env -- CONFIG_FS_PROCFS && !CONFIG_DISABLE_ENVIRON && !CONFIG_PROCFS_EXCLUDE_ENVIRON exec -- exit -- export CONFIG_NSH_VARS && !CONFIG_DISABLE_ENVIRON free -- - get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && MTU >= 558 (see note 1) + get CONFIG_NET && CONFIG_NET_UDP && MTU >= 558 (see note 1) help -- - hexdump CONFIG_NFILE_DESCRIPTORS > 0 + hexdump -- ifconfig CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET ifdown CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET ifup CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET insmod CONFIG_MODULE irqinfo CONFIG_FS_PROCFS && CONFIG_SCHED_IRQMONITOR kill !CONFIG_DISABLE_SIGNALS - losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_DEV_LOOP - ln CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_PSEUDOFS_SOFTLINK - ls CONFIG_NFILE_DESCRIPTORS > 0 + losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_DEV_LOOP + ln CONFIG_PSEUDOFS_SOFTLINK + ls -- lsmod CONFIG_MODULE && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_MODULE md5 CONFIG_NETUTILS_CODECS && CONFIG_CODECS_HASH_MD5 mb,mh,mw --- - mkdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0) - mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FSUTILS_MKFATFS - mkfifo CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_PIPES && CONFIG_DEV_FIFO_SIZE > 0 - mkrd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4) - mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3) - mv (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0) (see note 4) - nfsmount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET && CONFIG_NFS + mkdir (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS + mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FSUTILS_MKFATFS + mkfifo CONFIG_PIPES && CONFIG_DEV_FIFO_SIZE > 0 + mkrd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE (see note 4) + mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_READABLE (see note 3) + mv (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS (see note 4) + nfsmount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NET && CONFIG_NFS nslookup CONFIG_LIBC_NETDB && CONFIG_NETDB_DNSCLIENT - password !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD + password !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD poweroff CONFIG_BOARDCTL_POWEROFF ps CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_PROC - put CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && MTU >= 558 (see note 1,2) - pwd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0 - readlink CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_PSEUDOFS_SOFTLINK + put CONFIG_NET && CONFIG_NET_UDP && MTU >= 558 (see note 1,2) + pwd !CONFIG_DISABLE_ENVIRON + readlink CONFIG_PSEUDOFS_SOFTLINK reboot CONFIG_BOARDCTL_RESET - rm (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0) - rmdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0) + rm (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS + rmdir (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS rmmod CONFIG_MODULE route CONFIG_FS_PROCFS && CONFIG_FS_PROCFS_EXCLUDE_NET && !CONFIG_FS_PROCFS_EXCLUDE_ROUTE && CONFIG_NET_ROUTE && !CONFIG_NSH_DISABLE_ROUTE && (CONFIG_NET_IPv4 || CONFIG_NET_IPv6) set CONFIG_NSH_VARS || !CONFIG_DISABLE_ENVIRON - sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT + sh CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT shutdown CONFIG_BOARDCTL_POWEROFF || CONFIG_BOARDCTL_RESET sleep !CONFIG_DISABLE_SIGNALS test !CONFIG_NSH_DISABLESCRIPT telnetd CONFIG_NSH_TELNET && !CONFIG_NSH_DISABLE_TELNETD time --- - truncate !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 - umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE + truncate !CONFIG_DISABLE_MOUNTPOINT + umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_READABLE uname !CONFIG_NSH_DISABLE_UNAME unset CONFIG_NSH_VARS || !CONFIG_DISABLE_ENVIRON urldecode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE urlencode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE - useradd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD - userdel !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD + useradd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD + userdel !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD usleep !CONFIG_DISABLE_SIGNALS - get CONFIG_NET && CONFIG_NET_TCP && CONFIG_NFILE_DESCRIPTORS > 0 + get CONFIG_NET && CONFIG_NET_TCP xd --- * NOTES: diff --git a/nshlib/nsh.h b/nshlib/nsh.h index 8ec86ef4c..32a6bc787 100644 --- a/nshlib/nsh.h +++ b/nshlib/nsh.h @@ -557,7 +557,7 @@ /* Stubs used when working directory is not supported */ -#if CONFIG_NFILE_DESCRIPTORS <= 0 || defined(CONFIG_DISABLE_ENVIRON) +#ifdef CONFIG_DISABLE_ENVIRON # define nsh_getfullpath(v,p) ((FAR char*)(p)) # define nsh_freefullpath(p) #endif @@ -569,10 +569,6 @@ #define NSH_HAVE_IOBUFFER 1 -#if CONFIG_NFILE_DESCRIPTORS <= 0 -# undef NSH_HAVE_IOBUFFER -#endif - /* The I/O buffer is needed for the ls, cp, and ps commands. It is also * needed if the platform supplied MOTD is configured. */ @@ -681,13 +677,6 @@ #define NSH_HAVE_TRIMDIR 1 #define NSH_HAVE_TRIMSPACES 1 -#if CONFIG_NFILE_DESCRIPTORS <= 0 -# undef NSH_HAVE_CATFILE -# undef NSH_HAVE_READFILE -# undef NSH_HAVE_FOREACH_DIRENTRY -# undef NSH_HAVE_TRIMDIR -#endif - #if !defined(CONFIG_FS_PROCFS) || defined(CONFIG_DISABLE_ENVIRON) || \ defined(CONFIG_FS_PROCFS_EXCLUDE_ENVIRON) || !defined(NSH_HAVE_CATFILE) # undef CONFIG_NSH_DISABLE_ENV @@ -936,7 +925,7 @@ int nsh_usbconsole(void); # define nsh_usbconsole() (-ENOSYS) #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) +#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path); #ifdef CONFIG_NSH_ROMFSETC int nsh_initscript(FAR struct nsh_vtbl_s *vtbl); @@ -969,11 +958,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline); ****************************************************************************/ #ifdef CONFIG_NSH_CONSOLE_LOGIN -# if CONFIG_NFILE_DESCRIPTORS > 0 int nsh_login(FAR struct console_stdio_s *pstate); -# else -int nsh_stdlogin(FAR struct console_stdio_s *pstate); -# endif #endif #ifdef CONFIG_NSH_TELNET_LOGIN @@ -994,7 +979,7 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, FAR char **argv, FAR const char *redirfile, int oflags); #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON /* Working directory support */ FAR const char *nsh_getcwd(void); @@ -1041,7 +1026,7 @@ void nsh_usbtrace(void); int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #ifndef CONFIG_NSH_DISABLE_EXPORT - int cmd_export(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_export(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #ifndef CONFIG_NSH_DISABLE_MB int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); @@ -1086,235 +1071,234 @@ int cmd_irqinfo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); int cmd_date(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 -# ifndef CONFIG_NSH_DISABLE_CAT - int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#ifndef CONFIG_NSH_DISABLE_CAT + int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#ifndef CONFIG_NSH_DISABLE_CP + int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#ifndef CONFIG_NSH_DISABLE_CMP + int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#ifndef CONFIG_NSH_DISABLE_DD + int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#ifndef CONFIG_NSH_DISABLE_HEXDUMP + int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS) + int cmd_ln(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#ifndef CONFIG_NSH_DISABLE_LS + int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) + int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif +#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) +# ifndef CONFIG_NSH_DISABLE_SH + int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# ifndef CONFIG_NSH_DISABLE_CP - int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_CMP - int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_DD - int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_HEXDUMP - int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS) - int cmd_ln(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_LS - int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) - int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# 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) -# ifndef CONFIG_NSH_DISABLE_SH - int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */ +#endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */ -# ifdef NSH_HAVE_DIROPTS +#ifdef NSH_HAVE_DIROPTS # ifndef CONFIG_NSH_DISABLE_MKDIR - int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_MV - int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_RM - int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_RMDIR - int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# endif /* CONFIG_NFILE_STREAMS && NSH_HAVE_DIROPTS */ +# endif /* NSH_HAVE_DIROPTS */ -# ifndef CONFIG_DISABLE_MOUNTPOINT -# if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP) - int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART) - int cmd_losmart(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \ +#ifndef CONFIG_DISABLE_MOUNTPOINT +# if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP) + int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART) + int cmd_losmart(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \ !defined(CONFIG_NSH_DISABLE_MKFIFO) - int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# ifdef CONFIG_FS_READABLE +# ifdef NSH_HAVE_CATFILE +# ifndef CONFIG_NSH_DISABLE_DF + int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# ifndef CONFIG_NSH_DISABLE_MOUNT + int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# endif +# ifndef CONFIG_NSH_DISABLE_UMOUNT + int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# ifdef CONFIG_FS_WRITABLE +# ifndef CONFIG_NSH_DISABLE_MKRD + int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# endif /* CONFIG_FS_WRITABLE */ +# endif /* CONFIG_FS_READABLE */ +# ifdef CONFIG_FSUTILS_MKFATFS +# ifndef CONFIG_NSH_DISABLE_MKFATFS + int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# ifdef CONFIG_FS_READABLE -# ifdef NSH_HAVE_CATFILE -# ifndef CONFIG_NSH_DISABLE_DF - int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_MOUNT - int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif -# ifndef CONFIG_NSH_DISABLE_UMOUNT - int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifdef CONFIG_FS_WRITABLE -# ifndef CONFIG_NSH_DISABLE_MKRD - int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif /* CONFIG_FS_WRITABLE */ -# endif /* CONFIG_FS_READABLE */ -# ifdef CONFIG_FSUTILS_MKFATFS -# ifndef CONFIG_NSH_DISABLE_MKFATFS - int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif /* CONFIG_FSUTILS_MKFATFS */ -# if defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS) -# ifndef CONFIG_NSH_DISABLE_MKSMARTFS - int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif /* CONFIG_FS_SMARTFS */ -# ifndef CONFIG_NSH_DISABLE_TRUNCATE - int cmd_truncate(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# if defined(CONFIG_NSH_LOGIN_PASSWD) && defined(CONFIG_FS_WRITABLE) && \ +# endif /* CONFIG_FSUTILS_MKFATFS */ +# if defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS) +# ifndef CONFIG_NSH_DISABLE_MKSMARTFS + int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# endif /* CONFIG_FS_SMARTFS */ +# ifndef CONFIG_NSH_DISABLE_TRUNCATE + int cmd_truncate(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# if defined(CONFIG_NSH_LOGIN_PASSWD) && defined(CONFIG_FS_WRITABLE) && \ !defined(CONFIG_FSUTILS_PASSWD_READONLY) -# ifndef CONFIG_NSH_DISABLE_USERADD - int cmd_useradd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_USERDEL - int cmd_userdel(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_PASSWD - int cmd_passwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif -# endif /* !CONFIG_DISABLE_MOUNTPOINT */ -# if !defined(CONFIG_DISABLE_ENVIRON) -# ifndef CONFIG_NSH_DISABLE_CD - int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# ifndef CONFIG_NSH_DISABLE_PWD - int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif /* !CONFIG_DISABLE_MOUNTPOINT */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ +# ifndef CONFIG_NSH_DISABLE_USERADD + int cmd_useradd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# ifndef CONFIG_NSH_DISABLE_USERDEL + int cmd_userdel(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# ifndef CONFIG_NSH_DISABLE_PASSWD + int cmd_passwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# endif +#endif /* !CONFIG_DISABLE_MOUNTPOINT */ + +#if !defined(CONFIG_DISABLE_ENVIRON) +# ifndef CONFIG_NSH_DISABLE_CD + int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +# ifndef CONFIG_NSH_DISABLE_PWD + int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif +#endif /* !CONFIG_DISABLE_MOUNTPOINT */ #ifndef CONFIG_NSH_DISABLE_ENV -int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #if defined(CONFIG_NET) # if defined(CONFIG_NET_ARP) && !defined(CONFIG_NSH_DISABLE_ARP) - int cmd_arp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_arp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # if defined(CONFIG_NET_ROUTE) && !defined(CONFIG_NSH_DISABLE_ADDROUTE) - int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # if defined(CONFIG_NET_ROUTE) && !defined(CONFIG_NSH_DISABLE_DELROUTE) - int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +# ifdef CONFIG_NET_UDP # ifndef CONFIG_NSH_DISABLE_GET - int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # endif # ifndef CONFIG_NSH_DISABLE_IFCONFIG - int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_IFUPDOWN - int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); - int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif -# if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FS_READABLE) && defined(CONFIG_NFS) +# if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \ + defined(CONFIG_NFS) # ifndef CONFIG_NSH_DISABLE_NFSMOUNT - int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # endif -# if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +# ifdef CONFIG_NET_UDP # ifndef CONFIG_NSH_DISABLE_PUT - int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # endif -# if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0 +# ifdef CONFIG_NET_TCP # ifndef CONFIG_NSH_DISABLE_WGET - int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # endif # ifndef CONFIG_NSH_DISABLE_ROUTE - int cmd_route(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_route(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # if defined(CONFIG_NSH_TELNET) # ifndef CONFIG_NSH_DISABLE_TELNETD - int cmd_telnetd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_telnetd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # endif #endif /* CONFIG_NET */ #if defined(CONFIG_LIBC_NETDB) && defined(CONFIG_NETDB_DNSCLIENT) && \ !defined(CONFIG_NSH_DISABLE_NSLOOKUP) - int cmd_nslookup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_nslookup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #if defined(CONFIG_BOARDCTL_POWEROFF) && !defined(CONFIG_NSH_DISABLE_POWEROFF) - int cmd_poweroff(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_poweroff(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #if defined(CONFIG_BOARDCTL_RESET) && !defined(CONFIG_NSH_DISABLE_REBOOT) - int cmd_reboot(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_reboot(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #if (defined(CONFIG_BOARDCTL_POWEROFF) || defined(CONFIG_BOARDCTL_RESET)) && \ !defined(CONFIG_NSH_DISABLE_SHUTDOWN) - int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #ifndef CONFIG_NSH_DISABLE_UNAME - int cmd_uname(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_uname(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #ifndef CONFIG_NSH_DISABLE_SET - int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #ifndef CONFIG_NSH_DISABLE_UNSET - int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif #ifndef CONFIG_DISABLE_SIGNALS # ifndef CONFIG_NSH_DISABLE_KILL - int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_SLEEP - int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_USLEEP - int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif #endif /* CONFIG_DISABLE_SIGNALS */ #if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_BASE64) # ifndef CONFIG_NSH_DISABLE_BASE64DEC - int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_BASE64ENC - int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif #endif #if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_HASH_MD5) # ifndef CONFIG_NSH_DISABLE_MD5 - int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif #endif #if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_URLCODE) # ifndef CONFIG_NSH_DISABLE_URLDECODE - int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif # ifndef CONFIG_NSH_DISABLE_URLENCODE - int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif #endif diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index 76bd762d6..6cd602f18 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -133,21 +133,22 @@ static const struct cmdmap_s g_cmdmap[] = { "break", cmd_break, 1, 1, NULL }, #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 -# ifndef CONFIG_NSH_DISABLE_CAT +#ifndef CONFIG_NSH_DISABLE_CAT { "cat", cmd_cat, 2, CONFIG_NSH_MAXARGUMENTS, " [ [ ...]]" }, -# endif +#endif + #ifndef CONFIG_DISABLE_ENVIRON # ifndef CONFIG_NSH_DISABLE_CD { "cd", cmd_cd, 1, 2, "[|-|~|..]" }, # endif #endif -# ifndef CONFIG_NSH_DISABLE_CP + +#ifndef CONFIG_NSH_DISABLE_CP { "cp", cmd_cp, 3, 3, " " }, -# endif -# ifndef CONFIG_NSH_DISABLE_CMP +#endif + +#ifndef CONFIG_NSH_DISABLE_CMP { "cmp", cmd_cmp, 3, 3, " " }, -# endif #endif #ifndef CONFIG_NSH_DISABLE_DIRNAME @@ -158,7 +159,7 @@ static const struct cmdmap_s g_cmdmap[] = { "date", cmd_date, 1, 3, "[-s \"MMM DD HH:MM:SS YYYY\"]" }, #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_DD) +#ifndef CONFIG_NSH_DISABLE_DD { "dd", cmd_dd, 3, 6, "if= of= [bs=] [count=] [skip=]" }, # endif @@ -166,8 +167,8 @@ static const struct cmdmap_s g_cmdmap[] = { "delroute", cmd_delroute, 2, 3, " []" }, #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ - defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_DF) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \ + !defined(CONFIG_NSH_DISABLE_DF) #ifdef NSH_HAVE_CATFILE #if defined(HAVE_DF_HUMANREADBLE) && defined(HAVE_DF_BLOCKOUTPUT) { "df", cmd_df, 1, 2, "[-h]" }, @@ -177,8 +178,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_RAMLOG_SYSLOG) && \ - !defined(CONFIG_NSH_DISABLE_DMESG) +#if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) { "dmesg", cmd_dmesg, 1, 1, NULL }, #endif @@ -214,7 +214,7 @@ static const struct cmdmap_s g_cmdmap[] = { "free", cmd_free, 1, 1, NULL }, #endif -#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_UDP # ifndef CONFIG_NSH_DISABLE_GET { "get", cmd_get, 4, 7, "[-b|-n] [-f ] -h " }, # endif @@ -228,7 +228,6 @@ static const struct cmdmap_s g_cmdmap[] = # endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 #ifndef CONFIG_NSH_DISABLE_HEXDUMP #ifndef CONFIG_NSH_CMDOPT_HEXDUMP { "hexdump", cmd_hexdump, 2, 2, "" }, @@ -236,7 +235,6 @@ static const struct cmdmap_s g_cmdmap[] = { "hexdump", cmd_hexdump, 2, 4, " [skip=] [count=]" }, #endif #endif -#endif #ifdef CONFIG_NET # ifndef CONFIG_NSH_DISABLE_IFCONFIG @@ -262,28 +260,24 @@ static const struct cmdmap_s g_cmdmap[] = # endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) +#ifndef CONFIG_DISABLE_MOUNTPOINT # if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP) { "losetup", cmd_losetup, 3, 6, "[-d ] | [[-o ] [-r] ]" }, # endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) +#ifndef CONFIG_DISABLE_MOUNTPOINT # if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART) { "losmart", cmd_losmart, 2, 11, "[-d ] | [[-m ] [-o ] [-e ] [-s ] [-r] ]" }, # endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 -# if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS) +#if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS) { "ln", cmd_ln, 3, 4, "[-s] " }, -# endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 -# ifndef CONFIG_NSH_DISABLE_LS +#ifndef CONFIG_NSH_DISABLE_LS { "ls", cmd_ls, 1, 5, "[-lRs] " }, -# endif #endif #if defined(CONFIG_MODULE) && !defined(CONFIG_NSH_DISABLE_MODCMDS) @@ -308,14 +302,13 @@ static const struct cmdmap_s g_cmdmap[] = # endif #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FSUTILS_MKFATFS) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FSUTILS_MKFATFS) # ifndef CONFIG_NSH_DISABLE_MKFATFS { "mkfatfs", cmd_mkfatfs, 2, 6, "[-F ] [-r ] " }, # endif #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifndef CONFIG_DISABLE_MOUNTPOINT # if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \ !defined(CONFIG_NSH_DISABLE_MKFIFO) { "mkfifo", cmd_mkfifo, 2, 2, "" }, @@ -328,8 +321,8 @@ static const struct cmdmap_s g_cmdmap[] = # endif #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_SMARTFS) && \ + defined(CONFIG_FSUTILS_MKSMARTFS) # ifndef CONFIG_NSH_DISABLE_MKSMARTFS # ifdef CONFIG_SMARTFS_MULTI_ROOT_DIRS { "mksmartfs", cmd_mksmartfs, 2, 6, "[-s ] [-f] []" }, @@ -343,7 +336,7 @@ static const struct cmdmap_s g_cmdmap[] = { "mh", cmd_mh, 2, 3, "[=][ ]" }, #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) #ifndef CONFIG_NSH_DISABLE_MOUNT #if defined(NSH_HAVE_CATFILE) && defined(HAVE_MOUNT_LIST) { "mount", cmd_mount, 1, 7, "[-t [-o ] [] ]" }, @@ -363,8 +356,8 @@ static const struct cmdmap_s g_cmdmap[] = { "mw", cmd_mw, 2, 3, "[=][ ]" }, #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_NET) && defined(CONFIG_NFS) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_NET) && \ + defined(CONFIG_NFS) # ifndef CONFIG_NSH_DISABLE_NFSMOUNT { "nfsmount", cmd_nfsmount, 4, 4, " " }, # endif @@ -375,8 +368,8 @@ static const struct cmdmap_s g_cmdmap[] = { "nslookup", cmd_nslookup, 2, 2, "" }, #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FS_WRITABLE) && defined(CONFIG_NSH_LOGIN_PASSWD) && \ +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \ + defined(CONFIG_NSH_LOGIN_PASSWD) && \ !defined(CONFIG_FSUTILS_PASSWD_READONLY) # ifndef CONFIG_NSH_DISABLE_PASSWD { "passwd", cmd_passwd, 3, 3, " " }, @@ -399,22 +392,20 @@ static const struct cmdmap_s g_cmdmap[] = { "ps", cmd_ps, 1, 1, NULL }, #endif -#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_UDP # ifndef CONFIG_NSH_DISABLE_PUT { "put", cmd_put, 4, 7, "[-b|-n] [-f ] -h " }, # endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON # ifndef CONFIG_NSH_DISABLE_PWD { "pwd", cmd_pwd, 1, 1, NULL }, # endif #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 -# if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS) +#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS) { "readlink", cmd_readlink, 2, 2, "" }, -# endif #endif #if defined(CONFIG_BOARDCTL_RESET) && !defined(CONFIG_NSH_DISABLE_REBOOT) @@ -467,7 +458,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #endif /* CONFIG_NSH_DISABLE_SET */ -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) +#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) # ifndef CONFIG_NSH_DISABLE_SH { "sh", cmd_sh, 2, 2, "" }, # endif @@ -509,7 +500,7 @@ static const struct cmdmap_s g_cmdmap[] = { "true", cmd_true, 1, 1, NULL }, #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifndef CONFIG_DISABLE_MOUNTPOINT # ifndef CONFIG_NSH_DISABLE_TRUNCATE { "truncate", cmd_truncate, 4, 4, "-s " }, # endif @@ -523,7 +514,7 @@ static const struct cmdmap_s g_cmdmap[] = #endif #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) # ifndef CONFIG_NSH_DISABLE_UMOUNT { "umount", cmd_umount, 2, 2, "" }, # endif @@ -542,8 +533,8 @@ static const struct cmdmap_s g_cmdmap[] = # endif #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FS_WRITABLE) && defined(CONFIG_NSH_LOGIN_PASSWD) && \ +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \ + defined(CONFIG_NSH_LOGIN_PASSWD) && \ !defined(CONFIG_FSUTILS_PASSWD_READONLY) # ifndef CONFIG_NSH_DISABLE_USERADD { "useradd", cmd_useradd, 3, 3, " " }, @@ -559,7 +550,7 @@ static const struct cmdmap_s g_cmdmap[] = # endif #endif -#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_TCP # ifndef CONFIG_NSH_DISABLE_WGET { "wget", cmd_wget, 2, 4, "[-o ] " }, # endif diff --git a/nshlib/nsh_console.c b/nshlib/nsh_console.c index 2d54502ba..0c24d4c0e 100644 --- a/nshlib/nsh_console.c +++ b/nshlib/nsh_console.c @@ -82,14 +82,10 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl, static int nsh_erroroutput(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...); static FAR char *nsh_consolelinebuffer(FAR struct nsh_vtbl_s *vtbl); - -#if CONFIG_NFILE_DESCRIPTORS > 0 static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save); static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save); -#endif - static void nsh_consoleexit(FAR struct nsh_vtbl_s *vtbl, int exitstatus) noreturn_function; @@ -101,7 +97,6 @@ static void nsh_consoleexit(FAR struct nsh_vtbl_s *vtbl, int exitstatus) * Name: nsh_openifnotopen ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 static int nsh_openifnotopen(struct console_stdio_s *pstate) { /* The stream is open in a lazy fashion. This is done because the file @@ -126,7 +121,6 @@ static int nsh_openifnotopen(struct console_stdio_s *pstate) return 0; } -#endif /**************************************************************************** * Name: nsh_closeifnotclosed @@ -177,7 +171,6 @@ static void nsh_closeifnotclosed(struct console_stdio_s *pstate) static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer, size_t nbytes) { -#if CONFIG_NFILE_DESCRIPTORS > 0 FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl; ssize_t ret; @@ -205,12 +198,6 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl, fflush(pstate->cn_outstream); return ret; -#else - /* REVISIT: buffer may not be NUL-terminated */ - - printf("%s", buffer); - return nbytes; -#endif } /**************************************************************************** @@ -224,7 +211,6 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl, static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...) { -#if CONFIG_NFILE_DESCRIPTORS > 0 FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl; va_list ap; int ret; @@ -244,31 +230,6 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl, va_end(ap); return ret; -#else - va_list ap; - char *str; - - /* Use vasprintf() to allocate a buffer and fill it with the formatted - * data - */ - - va_start(ap, fmt); - str = NULL; - (void)vasprintf(&str, fmt, ap); - - /* Was a string allocated? */ - - if (str) - { - /* Yes.. Print then free the allocated string */ - - printf("%s", str); - free(str); - } - - va_end(ap); - return 0; -#endif } /**************************************************************************** @@ -282,7 +243,6 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl, static int nsh_erroroutput(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...) { -#if CONFIG_NFILE_DESCRIPTORS > 0 FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl; va_list ap; int ret; @@ -302,31 +262,6 @@ static int nsh_erroroutput(FAR struct nsh_vtbl_s *vtbl, va_end(ap); return ret; -#else - va_list ap; - char *str; - - /* Use vasprintf() to allocate a buffer and fill it with the formatted - * data - */ - - va_start(ap, fmt); - str = NULL; - (void)vasprintf(&str, fmt, ap); - - /* Was a string allocated? */ - - if (str) - { - /* Yes.. Print then free the allocated string */ - - printf("%s", str); - free(str); - } - - va_end(ap); - return 0; -#endif } /**************************************************************************** @@ -371,7 +306,6 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl) { FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl; -#if CONFIG_NFILE_DESCRIPTORS > 0 /* Close the output stream */ nsh_closeifnotclosed(pstate); @@ -381,7 +315,6 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl) #ifdef CONFIG_NSH_ALTCONDEV (void)fclose(pstate->cn_constream); #endif -#endif #ifdef CONFIG_NSH_VARS /* Free any NSH variables */ @@ -427,7 +360,6 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl) * ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save) { @@ -473,7 +405,6 @@ static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, pstate->cn_outfd = fd; pstate->cn_outstream = NULL; } -#endif /**************************************************************************** * Name: nsh_consoleundirect @@ -483,8 +414,8 @@ static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd, * ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 -static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save) +static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, + FAR uint8_t *save) { FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl; FAR struct serialsave_s *ssave = (FAR struct serialsave_s *)save; @@ -495,7 +426,6 @@ static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save) pstate->cn_errstream = ssave->cn_errstream; pstate->cn_outstream = ssave->cn_outstream; } -#endif /**************************************************************************** * Name: nsh_consoleexit diff --git a/nshlib/nsh_console.h b/nshlib/nsh_console.h index 5e080eeaa..0d12b4b51 100644 --- a/nshlib/nsh_console.h +++ b/nshlib/nsh_console.h @@ -127,10 +127,8 @@ struct nsh_vtbl_s int (*error)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...); int (*output)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...); FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl); -#if CONFIG_NFILE_DESCRIPTORS > 0 void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save); void (*undirect)(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save); -#endif void (*exit)(FAR struct nsh_vtbl_s *vtbl, int exitstatus) noreturn_function; #ifdef NSH_HAVE_IOBUFFER diff --git a/nshlib/nsh_dbgcmds.c b/nshlib/nsh_dbgcmds.c index bb0bae21e..17817a66c 100644 --- a/nshlib/nsh_dbgcmds.c +++ b/nshlib/nsh_dbgcmds.c @@ -46,10 +46,7 @@ #include #include #include - -#if CONFIG_NFILE_DESCRIPTORS > 0 -# include -#endif +#include #include "nsh.h" #include "nsh_console.h" @@ -368,7 +365,6 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) * Name: cmd_hexdump, hex dump of files ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 #ifndef CONFIG_NSH_DISABLE_HEXDUMP int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) { @@ -500,7 +496,6 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) return ret; } #endif -#endif /**************************************************************************** * Name: cmd_irqinfo diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c index cfe92265e..b255e5b7f 100644 --- a/nshlib/nsh_ddcmd.c +++ b/nshlib/nsh_ddcmd.c @@ -55,7 +55,7 @@ #include "nsh.h" #include "nsh_console.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_DD) +#ifndef CONFIG_NSH_DISABLE_DD /**************************************************************************** * Pre-processor Definitions @@ -404,4 +404,4 @@ errout_with_paths: return ret; } -#endif /* CONFIG_NFILE_DESCRIPTORS && !CONFIG_NSH_DISABLE_DD */ +#endif /* !CONFIG_NSH_DISABLE_DD */ diff --git a/nshlib/nsh_envcmds.c b/nshlib/nsh_envcmds.c index 42e620f69..80dd63ea3 100644 --- a/nshlib/nsh_envcmds.c +++ b/nshlib/nsh_envcmds.c @@ -54,7 +54,7 @@ * Private Data ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON static const char g_pwd[] = "PWD"; #ifndef CONFIG_NSH_DISABLE_CD static const char g_oldpwd[] = "OLDPWD"; @@ -70,7 +70,7 @@ static const char g_home[] = CONFIG_LIB_HOMEDIR; * Name: nsh_getwd ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON static inline FAR const char *nsh_getwd(const char *wd) { const char *val; @@ -147,7 +147,7 @@ static int nsh_dumpvar(FAR struct nsh_vtbl_s *vtbl, FAR void *arg, * Name: nsh_getwd ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON FAR const char *nsh_getcwd(void) { return nsh_getwd(g_pwd); @@ -158,7 +158,7 @@ FAR const char *nsh_getcwd(void) * Name: nsh_getfullpath ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON FAR char *nsh_getfullpath(FAR struct nsh_vtbl_s *vtbl, FAR const char *relpath) { @@ -198,7 +198,7 @@ FAR char *nsh_getfullpath(FAR struct nsh_vtbl_s *vtbl, * Name: nsh_freefullpath ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON void nsh_freefullpath(FAR char *fullpath) { if (fullpath) @@ -212,7 +212,7 @@ void nsh_freefullpath(FAR char *fullpath) * Name: cmd_cd ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON #ifndef CONFIG_NSH_DISABLE_CD int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -323,7 +323,7 @@ int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_pwd ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) +#ifndef CONFIG_DISABLE_ENVIRON #ifndef CONFIG_NSH_DISABLE_PWD int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c index 8c5e7d626..728a8fee8 100644 --- a/nshlib/nsh_fscmds.c +++ b/nshlib/nsh_fscmds.c @@ -44,34 +44,32 @@ #include #include -#if CONFIG_NFILE_DESCRIPTORS > 0 -# include -# include -# if !defined(CONFIG_DISABLE_MOUNTPOINT) -# ifdef CONFIG_FS_READABLE /* Need at least one filesytem in configuration */ -# include -# include -# endif -# ifdef CONFIG_DEV_LOOP -# include -# include -# endif -# ifdef CONFIG_FS_SMARTFS -# include "fsutils/mksmartfs.h" -# endif -# ifdef CONFIG_SMART_DEV_LOOP -# include -# include -# endif -# ifdef CONFIG_NFS -# include -# include -# include -# endif -# ifdef CONFIG_RAMLOG_SYSLOG -# include -# endif -#endif +#include +#include +#if !defined(CONFIG_DISABLE_MOUNTPOINT) +# ifdef CONFIG_FS_READABLE /* Need at least one filesytem in configuration */ +# include +# include +# endif +# ifdef CONFIG_DEV_LOOP +# include +# include +# endif +# ifdef CONFIG_FS_SMARTFS +# include "fsutils/mksmartfs.h" +# endif +# ifdef CONFIG_SMART_DEV_LOOP +# include +# include +# endif +# ifdef CONFIG_NFS +# include +# include +# include +# endif +# ifdef CONFIG_RAMLOG_SYSLOG +# include +# endif #endif #include @@ -107,8 +105,7 @@ * Name: nsh_getdirpath ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && \ - (!defined(CONFIG_NSH_DISABLE_LS) || !defined(CONFIG_NSH_DISABLE_CP)) +#if !defined(CONFIG_NSH_DISABLE_LS) || !defined(CONFIG_NSH_DISABLE_CP) static char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl, FAR const char *path, FAR const char *file) { @@ -143,7 +140,7 @@ static inline int ls_specialdir(const char *dir) * Name: ls_handler ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_LS) +#if !defined(CONFIG_NSH_DISABLE_LS) static int ls_handler(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, FAR struct dirent *entryp, FAR void *pvarg) { @@ -353,7 +350,7 @@ static int ls_handler(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath, * Name: ls_recursive ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_LS) +#if !defined(CONFIG_NSH_DISABLE_LS) static int ls_recursive(FAR struct nsh_vtbl_s *vtbl, const char *dirpath, struct dirent *entryp, void *pvarg) { @@ -388,7 +385,7 @@ static int ls_recursive(FAR struct nsh_vtbl_s *vtbl, const char *dirpath, return ret; } -#endif /* CONFIG_NFILE_DESCRIPTORS > 0 && !CONFIG_NSH_DISABLE_LS */ +#endif /* !CONFIG_NSH_DISABLE_LS */ /**************************************************************************** * Public Functions @@ -458,7 +455,6 @@ int cmd_dirname(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_cat ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 #ifndef CONFIG_NSH_DISABLE_CAT int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -493,14 +489,12 @@ int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ret; } #endif -#endif /**************************************************************************** * Name: cmd_dmesg ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_RAMLOG_SYSLOG) && \ - !defined(CONFIG_NSH_DISABLE_DMESG) +#if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG) int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { return nsh_catfile(vtbl, argv[0], CONFIG_SYSLOG_DEVPATH); @@ -511,7 +505,6 @@ int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_cp ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 #ifndef CONFIG_NSH_DISABLE_CP int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -689,13 +682,12 @@ errout: return ret; } #endif -#endif /**************************************************************************** * Name: cmd_losetup ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) +#ifndef CONFIG_DISABLE_MOUNTPOINT # if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP) int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -849,7 +841,7 @@ errout_with_paths: * Name: cmd_losmart ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) +#ifndef CONFIG_DISABLE_MOUNTPOINT # if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART) int cmd_losmart(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1016,8 +1008,7 @@ errout_with_paths: * Name: cmd_ln ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 -# if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS) +#if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS) int cmd_ln(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { FAR char *linkpath; @@ -1076,13 +1067,11 @@ errout_with_nomemory: return ERROR; } #endif -#endif /**************************************************************************** * Name: cmd_ls ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 #ifndef CONFIG_NSH_DISABLE_LS int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1203,7 +1192,6 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ret; } #endif -#endif /**************************************************************************** * Name: cmd_mkdir @@ -1236,8 +1224,7 @@ int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_mkfatfs ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FSUTILS_MKFATFS) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FSUTILS_MKFATFS) #ifndef CONFIG_NSH_DISABLE_MKFATFS int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1333,8 +1320,7 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_mkfifo ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 -# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \ +#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \ !defined(CONFIG_NSH_DISABLE_MKFIFO) int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1355,7 +1341,6 @@ int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ret; } #endif /* CONFIG_PIPES && CONFIG_DEV_FIFO_SIZE > 0 && !CONFIG_NSH_DISABLE_MKFIFO */ -#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */ /**************************************************************************** * Name: cmd_mkrd @@ -1473,8 +1458,8 @@ errout_with_fmt: * Name: cmd_mksmartfs ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_SMARTFS) && \ + defined(CONFIG_FSUTILS_MKSMARTFS) #ifndef CONFIG_NSH_DISABLE_MKSMARTFS int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1612,8 +1597,7 @@ errout_with_oldpath: * Name: cmd_readlink ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 -# if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS) +#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS) int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { FAR char *fullpath; @@ -1642,7 +1626,6 @@ int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return OK; } #endif -#endif /**************************************************************************** * Name: cmd_rm @@ -1702,7 +1685,7 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_sh ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) +#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) #ifndef CONFIG_NSH_DISABLE_SH int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1715,7 +1698,6 @@ int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_cmp ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 #ifndef CONFIG_NSH_DISABLE_CMP int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1821,13 +1803,12 @@ errout: return ret; } #endif -#endif /**************************************************************************** * Name: cmd_truncate ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifndef CONFIG_DISABLE_MOUNTPOINT #ifndef CONFIG_NSH_DISABLE_TRUNCATE int cmd_truncate(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { diff --git a/nshlib/nsh_mntcmds.c b/nshlib/nsh_mntcmds.c index de4636c5a..4c893fde1 100644 --- a/nshlib/nsh_mntcmds.c +++ b/nshlib/nsh_mntcmds.c @@ -66,8 +66,8 @@ * Name: cmd_df ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ - defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_DF) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \ + !defined(CONFIG_NSH_DISABLE_DF) #ifdef NSH_HAVE_CATFILE int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -97,8 +97,8 @@ int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_mount ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ - defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \ + !defined(CONFIG_NSH_DISABLE_MOUNT) int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { FAR const char *source; @@ -249,8 +249,8 @@ errout: * Name: cmd_nfsmount ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ - defined(CONFIG_NET) && defined(CONFIG_NFS) && !defined(CONFIG_NSH_DISABLE_NFSMOUNT) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_NET) && \ + defined(CONFIG_NFS) && !defined(CONFIG_NSH_DISABLE_NFSMOUNT) int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { struct nfs_args data; @@ -354,8 +354,8 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_umount ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ - defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_UMOUNT) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \ + !defined(CONFIG_NSH_DISABLE_UMOUNT) int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { char *fullpath = nsh_getfullpath(vtbl, argv[1]); diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c index a32506f83..f197d74bb 100644 --- a/nshlib/nsh_netcmds.c +++ b/nshlib/nsh_netcmds.c @@ -89,14 +89,14 @@ # include "netutils/netlib.h" #endif -#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_UDP # include "netutils/netlib.h" # if !defined(CONFIG_NSH_DISABLE_GET) || !defined(CONFIG_NSH_DISABLE_PUT) # include "netutils/tftp.h" # endif #endif -#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifidef CONFIG_NET_TCP # ifndef CONFIG_NSH_DISABLE_WGET # include "netutils/webclient.h" # endif @@ -151,7 +151,7 @@ typedef struct pktradio_addr_s mac_addr_t; #endif #endif -#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_UDP struct tftpc_args_s { bool binary; /* true:binary ("octet") false:text ("netascii") */ @@ -212,7 +212,7 @@ static int ifconfig_callback(FAR struct nsh_vtbl_s *vtbl, FAR char *devname) * Name: tftpc_parseargs ****************************************************************************/ -#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_UDP int tftpc_parseargs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv, struct tftpc_args_s *args) { @@ -349,7 +349,7 @@ errout: * Name: wget_callback ****************************************************************************/ -#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_TCP #ifndef CONFIG_NSH_DISABLE_WGET static void wget_callback(FAR char **buffer, int offset, int datend, FAR int *buflen, FAR void *arg) @@ -457,7 +457,7 @@ static inline void nsh_sethwaddr(FAR const char *ifname, FAR mac_addr_t *macaddr * Name: cmd_get ****************************************************************************/ -#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_UDP #ifndef CONFIG_NSH_DISABLE_GET int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1159,7 +1159,7 @@ errout_invalid: * Name: cmd_put ****************************************************************************/ -#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_UDP #ifndef CONFIG_NSH_DISABLE_PUT int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { @@ -1201,7 +1201,7 @@ int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_wget ****************************************************************************/ -#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_NET_TCP #ifndef CONFIG_NSH_DISABLE_WGET int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { diff --git a/nshlib/nsh_passwdcmds.c b/nshlib/nsh_passwdcmds.c index 84b015593..693713cd6 100644 --- a/nshlib/nsh_passwdcmds.c +++ b/nshlib/nsh_passwdcmds.c @@ -44,8 +44,8 @@ #include "nsh.h" #include "nsh_console.h" -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ - defined(CONFIG_FS_WRITABLE) && defined(CONFIG_NSH_LOGIN_PASSWD) && \ +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \ + defined(CONFIG_NSH_LOGIN_PASSWD) && \ !defined(CONFIG_FSUTILS_PASSWD_READONLY) /**************************************************************************** @@ -115,6 +115,5 @@ int cmd_passwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } #endif /* !CONFIG_NSH_DISABLE_USERADD */ -#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && - * CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD && - * !CONFIG_FSUTILS_PASSWD_READONLY */ +#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE && + * CONFIG_NSH_LOGIN_PASSWD && !CONFIG_FSUTILS_PASSWD_READONLY */ diff --git a/nshlib/nsh_script.c b/nshlib/nsh_script.c index 1cc159ea3..a29994ebf 100644 --- a/nshlib/nsh_script.c +++ b/nshlib/nsh_script.c @@ -42,8 +42,7 @@ #include "nsh.h" #include "nsh_console.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \ - !defined(CONFIG_NSH_DISABLESCRIPT) +#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) /**************************************************************************** * Public Functions @@ -213,4 +212,4 @@ int nsh_loginscript(FAR struct nsh_vtbl_s *vtbl) #endif #endif /* CONFIG_NSH_ROMFSETC */ -#endif /* CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT */ +#endif /* CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT */ diff --git a/system/nsh/nsh_main.c b/system/nsh/nsh_main.c index 5e609cbd4..dc2cf25cf 100644 --- a/system/nsh/nsh_main.c +++ b/system/nsh/nsh_main.c @@ -244,12 +244,7 @@ static int nsh_task(void) * is wrong. */ -#if CONFIG_NFILE_DESCRIPTORS > 0 fprintf(stderr, "ERROR: nsh_consolemain() returned: %d\n", ret); -#else - printf("ERROR: nsh_consolemain() returned: %d\n", ret); -#endif - exitval = 1; #endif diff --git a/testing/ostest/dev_null.c b/testing/ostest/dev_null.c index 799a2f8b1..a4d59facd 100644 --- a/testing/ostest/dev_null.c +++ b/testing/ostest/dev_null.c @@ -47,8 +47,6 @@ * Private Data ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - static FAR char buffer[1024]; /**************************************************************************** @@ -91,4 +89,3 @@ int dev_null(void) return 0; } -#endif /*CONFIG_NFILE_DESCRIPTORS */ diff --git a/testing/ostest/ostest.h b/testing/ostest/ostest.h index 3bb716961..6af2e91a9 100644 --- a/testing/ostest/ostest.h +++ b/testing/ostest/ostest.h @@ -97,8 +97,8 @@ # define CONFIG_STDIO_BUFFER_SIZE 0 #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \ - CONFIG_STDIO_BUFFER_SIZE > 0 && !defined(CONFIG_STDIO_LINEBUFFER) +#if CONFIG_NFILE_STREAMS > 0 && CONFIG_STDIO_BUFFER_SIZE > 0 && \ + !defined(CONFIG_STDIO_LINEBUFFER) # define FFLUSH() fflush(stdout) #else # define FFLUSH() diff --git a/testing/ostest/ostest_main.c b/testing/ostest/ostest_main.c index 808c5e174..1f23dc37d 100644 --- a/testing/ostest/ostest_main.c +++ b/testing/ostest/ostest_main.c @@ -75,10 +75,8 @@ static const char arg2[] = "Arg2"; static const char arg3[] = "Arg3"; static const char arg4[] = "Arg4"; -#if CONFIG_NFILE_DESCRIPTORS > 0 static const char write_data1[] = "stdio_test: write fd=1\n"; static const char write_data2[] = "stdio_test: write fd=2\n"; -#endif #ifdef SDCC /* I am not yet certain why SDCC does not like the following @@ -323,13 +321,11 @@ static int user_main(int argc, char *argv[]) check_test_memory_usage(); #endif -#if CONFIG_NFILE_DESCRIPTORS > 0 /* Checkout /dev/null */ printf("\nuser_main: /dev/null test\n"); dev_null(); check_test_memory_usage(); -#endif #ifdef CONFIG_TESTING_OSTEST_AIO /* Check asynchronous I/O */ @@ -577,14 +573,10 @@ static void stdio_test(void) { /* Verify that we can communicate */ -#if CONFIG_NFILE_DESCRIPTORS > 0 write(1, write_data1, sizeof(write_data1)-1); -#endif printf("stdio_test: Standard I/O Check: printf\n"); -#if CONFIG_NFILE_DESCRIPTORS > 1 write(2, write_data2, sizeof(write_data2)-1); -#endif #if CONFIG_NFILE_STREAMS > 0 fprintf(stderr, "stdio_test: Standard I/O Check: fprintf to stderr\n"); #endif