From: Ahreum Jeong Date: Wed, 28 Jun 2017 00:47:16 +0000 (+0900) Subject: Add conditionals of CONFIG_DISABLE_ENVIRON to functions which have dependency on it X-Git-Tag: 1.1_Public_Release~461^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2447a3d3b617daa976b14c6af5d86ed153cf4e4c;p=rtos%2Ftinyara.git Add conditionals of CONFIG_DISABLE_ENVIRON to functions which have dependency on it --- diff --git a/apps/shell/Makefile b/apps/shell/Makefile index 823f621..cf0e204 100644 --- a/apps/shell/Makefile +++ b/apps/shell/Makefile @@ -26,7 +26,9 @@ STACKSIZE = 2048 ASRCS = CSRCS = tash_command.c tash_init.c +ifneq ($(CONFIG_DISABLE_ENVIRON),y) CSRCS += tash_script.c +endif ifneq ($(CONFIG_DISABLE_SIGNALS),y) CSRCS += tash_sleep.c endif diff --git a/apps/shell/tash_command.c b/apps/shell/tash_command.c index 41fdedf..b74ccfc 100644 --- a/apps/shell/tash_command.c +++ b/apps/shell/tash_command.c @@ -95,7 +95,9 @@ static struct tash_cmd_info_s tash_cmds_info = {PTHREAD_MUTEX_INITIALIZER}; const static tash_cmdlist_t tash_basic_cmds[] = { {"exit", tash_exit, TASH_EXECMD_SYNC}, {"help", tash_help, TASH_EXECMD_SYNC}, +#ifndef CONFIG_DISABLE_ENVIRON {"sh", tash_script, TASH_EXECMD_SYNC}, +#endif #ifndef CONFIG_DISABLE_SIGNALS {"sleep", tash_sleep, TASH_EXECMD_SYNC}, #endif diff --git a/apps/shell/tash_internal.h b/apps/shell/tash_internal.h index 6d334b1..cd5779f 100644 --- a/apps/shell/tash_internal.h +++ b/apps/shell/tash_internal.h @@ -57,7 +57,9 @@ extern void tash_register_basic_cmds(void); extern int tash_execute_cmdline(char *buff); extern int tash_execute_cmd(char **args, int argc); extern int tash_init(void); +#ifndef CONFIG_DISABLE_ENVIRON extern int tash_script(int argc, char **args); +#endif #ifndef CONFIG_DISABLE_SIGNALS extern int tash_sleep(int argc, char **args); #endif diff --git a/apps/system/utils/Makefile b/apps/system/utils/Makefile index 54439e9..cb3760f 100644 --- a/apps/system/utils/Makefile +++ b/apps/system/utils/Makefile @@ -64,11 +64,13 @@ INCDIROPT = -w endif ASRCS = -ifeq ($(CONFIG_FS_CMDS),y) -CSRCS = fs_getpath.c -endif +CSRCS = MAINSRC = +ifneq ($(CONFIG_DISABLE_ENVIRON),y) +CSRCS += fs_getpath.c +endif + ifeq ($(CONFIG_TASH),y) CSRCS += kernelcmd.c diff --git a/apps/system/utils/fscmd.c b/apps/system/utils/fscmd.c index 2a55fa0..350cca4 100644 --- a/apps/system/utils/fscmd.c +++ b/apps/system/utils/fscmd.c @@ -127,14 +127,13 @@ typedef struct fscmd_redirection redirection_t; /**************************************************************************** * Private Functions ****************************************************************************/ - static void fscmd_free(FAR char *path) { if (path) { free(path); } } - +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: tash_cat * @@ -295,7 +294,8 @@ error: return 0; } - +#endif +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: tash_cd * @@ -333,7 +333,8 @@ static int tash_cd(int argc, char **args) return ret; } - +#endif +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: foreach_direntry * @@ -626,7 +627,8 @@ static int tash_ls(int argc, char **args) return ret; } - +#endif +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: tash_mkdir * @@ -652,7 +654,7 @@ static int tash_mkdir(int argc, char **args) return ret; } - +#endif #ifndef CONFIG_DISABLE_MOUNTPOINT #ifdef CONFIG_RAMDISK /**************************************************************************** @@ -813,6 +815,7 @@ static int tash_mksmartfs(int argc, char **args) } #endif /* END OF CONFIG FS_SMARTFS */ +#ifndef CONFIG_DISABLE_ENVIRON static int mount_handler(FAR const char *mountpoint, FAR struct statfs *statbuf, FAR void *arg) { char *fstype; @@ -940,7 +943,8 @@ errout: return ret; } - +#endif +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: tash_umount * @@ -965,8 +969,10 @@ static int tash_umount(int argc, char **args) return ret; } +#endif #endif /* END OF CONFIG_DISABLE_MOUNTPOINT */ +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: tash_pwd * @@ -982,7 +988,8 @@ static int tash_pwd(int argc, char **args) return 0; } - +#endif +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: tash_rm * @@ -1008,7 +1015,8 @@ static int tash_rm(int argc, char **args) return ret; } - +#endif +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: tash_rmdir * @@ -1034,14 +1042,13 @@ static int tash_rmdir(int argc, char **args) return ret; } - +#endif static int df_handler(FAR const char *mountpoint, FAR struct statfs *statbuf, FAR void *arg) { printf("%6ld %8ld %8ld %8ld %s\n", statbuf->f_bsize, statbuf->f_blocks, statbuf->f_blocks - statbuf->f_bavail, statbuf->f_bavail, mountpoint); return OK; } - static const char *get_fstype(FAR struct statfs *statbuf) { FAR const char *fstype; @@ -1186,10 +1193,18 @@ static int tash_df(int argc, char **args) } const static tash_cmdlist_t fs_utilcmds[] = { +#ifndef CONFIG_DISABLE_ENVIRON {"cat", tash_cat, TASH_EXECMD_SYNC}, +#endif +#ifndef CONFIG_DISABLE_ENVIRON {"cd", tash_cd, TASH_EXECMD_SYNC}, +#endif +#ifndef CONFIG_DISABLE_ENVIRON {"ls", tash_ls, TASH_EXECMD_SYNC}, +#endif +#ifndef CONFIG_DISABLE_ENVIRON {"mkdir", tash_mkdir, TASH_EXECMD_SYNC}, +#endif #ifndef CONFIG_DISABLE_MOUNTPOINT #ifdef CONFIG_RAMDISK {"mkrd", tash_mkrd, TASH_EXECMD_SYNC}, @@ -1197,12 +1212,22 @@ const static tash_cmdlist_t fs_utilcmds[] = { #ifdef CONFIG_FS_SMARTFS {"mksmartfs", tash_mksmartfs, TASH_EXECMD_SYNC}, #endif +#ifndef CONFIG_DISABLE_ENVIRON {"mount", tash_mount, TASH_EXECMD_SYNC}, +#endif +#ifndef CONFIG_DISABLE_ENVIRON {"umount", tash_umount, TASH_EXECMD_SYNC}, #endif +#endif +#ifndef CONFIG_DISABLE_ENVIRON {"pwd", tash_pwd, TASH_EXECMD_SYNC}, +#endif +#ifndef CONFIG_DISABLE_ENVIRON {"rm", tash_rm, TASH_EXECMD_SYNC}, +#endif +#ifndef CONFIG_DISABLE_ENVIRON {"rmdir", tash_rmdir, TASH_EXECMD_SYNC}, +#endif {"df", tash_df, TASH_EXECMD_SYNC}, {NULL, NULL, 0} }; diff --git a/apps/system/utils/netcmd.c b/apps/system/utils/netcmd.c index 0d3be96..1e774f0 100644 --- a/apps/system/utils/netcmd.c +++ b/apps/system/utils/netcmd.c @@ -271,7 +271,7 @@ errout: } #endif -#if defined(CONFIG_NETUTILS_TFTPC) +#if defined(CONFIG_NETUTILS_TFTPC) && !defined(CONFIG_DISABLE_ENVIRON) int cmd_get(int argc, char **argv) { struct tftpc_args_s args; @@ -565,7 +565,7 @@ int cmd_ifconfig(int argc, char **argv) const static tash_cmdlist_t net_utilcmds[] = { -#ifdef CONFIG_NETUTILS_TFTPC +#if defined(CONFIG_NETUTILS_TFTPC) && !defined(CONFIG_DISABLE_ENVIRON) {"ftp_get", cmd_get, TASH_EXECMD_SYNC}, #endif {"ifconfig", cmd_ifconfig, TASH_EXECMD_SYNC}, diff --git a/os/include/tinyara/fs/fs_utils.h b/os/include/tinyara/fs/fs_utils.h index 9acf24f..7c45171 100644 --- a/os/include/tinyara/fs/fs_utils.h +++ b/os/include/tinyara/fs/fs_utils.h @@ -85,6 +85,7 @@ extern "C" { #define EXTERN extern #endif +#ifndef CONFIG_DISABLE_ENVIRON /**************************************************************************** * Name: getwd * @@ -104,7 +105,7 @@ FAR const char *getwd(const char *wd); ****************************************************************************/ FAR char *get_fullpath(FAR const char *relpath); char *get_dirpath(const char *dirpath, const char *relpath); - +#endif #undef EXTERN #if defined(__cplusplus) }