Pack parameters of nsh_execute() as struct nsh_exec_param_s

1. Input redirect flags currently is hardcode, passing by arguments maybe better.
2. Only support redirect to path_name, redirect to fd is needed for pipeline.

Test
  1. Redirect in
    cat < /etc/init.d/rc.sysinit

  2. Redirect with FIFO
    mkfifo /dev/testfifo
    cat /dev/testfifo &
    ls > /dev/testfifo

  3. NSH Params
    set name `uname`
    echo $name

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3
2024-10-14 23:27:14 +08:00
committed by Xiang Xiao
parent 27b5021e0d
commit 3da204c23e
8 changed files with 183 additions and 135 deletions

View File

@@ -39,6 +39,7 @@
#endif
#include <nuttx/usb/usbdev_trace.h>
#include <nshlib/nshlib.h>
/****************************************************************************
* Pre-processor Definitions
@@ -858,14 +859,12 @@ int nsh_command(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char *argv[]);
#ifdef CONFIG_NSH_BUILTIN_APPS
int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
FAR char **argv, FAR const char *redirfile_in,
FAR const char *redirfile_out, int oflags);
FAR char **argv, FAR const struct nsh_param_s *param);
#endif
#ifdef CONFIG_NSH_FILE_APPS
int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
FAR char **argv, FAR const char *redirfile_in,
FAR const char *redirfile_out, int oflags);
FAR char **argv, FAR const struct nsh_param_s *param);
#endif
#ifndef CONFIG_DISABLE_ENVIRON