This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new b480d00  rexec: support send command with arguments
b480d00 is described below

commit b480d00323c85f452c0eb1e8ee2588349c8132cb
Author: Jiuzhu Dong <[email protected]>
AuthorDate: Wed Oct 20 16:00:58 2021 +0800

    rexec: support send command with arguments
    
    Signed-off-by: Jiuzhu Dong <[email protected]>
---
 netutils/rexec/rexec.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/netutils/rexec/rexec.c b/netutils/rexec/rexec.c
index 209517f..dde0651 100644
--- a/netutils/rexec/rexec.c
+++ b/netutils/rexec/rexec.c
@@ -114,8 +114,10 @@ static int do_rexec(FAR struct rexec_arg_s *arg)
 
 int main(int argc, FAR char **argv)
 {
+  char cmd[CONFIG_NSH_LINELEN];
   struct rexec_arg_s arg;
   int option;
+  int i;
 
   memset(&arg, 0, sizeof(arg));
 
@@ -159,6 +161,13 @@ int main(int argc, FAR char **argv)
       usage(argv[0]);
     }
 
-  arg.command = argv[optind];
+  cmd[0] = '\0';
+  for (i = optind; i < argc; i++)
+    {
+      strcat(cmd, argv[i]);
+      strcat(cmd, " ");
+    }
+
+  arg.command = cmd;
   return do_rexec(&arg);
 }

Reply via email to