From 0f65243d6338308c7571d066ac08ad2ff0cc9f18 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Tue, 11 May 2021 12:14:05 +0800 Subject: [PATCH] [ot-ctl] support no separator -- (#6606) With this change, both the following command should work: ot-ctl -I wpan0 pskc -p 123456 ot-ctl -I wpan0 -- pskc -p 123456 --- script/check-posix-pty | 3 +++ src/posix/client.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/script/check-posix-pty b/script/check-posix-pty index 94aa1782e..8cfcc6b54 100755 --- a/script/check-posix-pty +++ b/script/check-posix-pty @@ -124,6 +124,9 @@ do_check() OT_CTL="$PWD/build/posix/src/posix/ot-ctl" sudo "${OT_CTL}" -I "${NETIF_NAME}" panid 0xface | grep 'Done' || die 'failed to set panid with ot-ctl' + # verify supports options in OpenThread commands without separator -- + sudo "${OT_CTL}" -I "${NETIF_NAME}" pskc -p 123456 | grep 'Done' || die 'unable to set pskc' + # verify this reset and factoryreset end immediately sudo "${OT_CTL}" -I "${NETIF_NAME}" reset # sleep a while for daemon ready diff --git a/src/posix/client.cpp b/src/posix/client.cpp index a80a5f4b4..2a3940fdf 100644 --- a/src/posix/client.cpp +++ b/src/posix/client.cpp @@ -208,7 +208,7 @@ Config ParseArg(int &aArgCount, char **&aArgVector) optind = 1; - for (int index, option; (option = getopt_long(aArgCount, aArgVector, "I:h", kOptions, &index)) != -1;) + for (int index, option; (option = getopt_long(aArgCount, aArgVector, "+I:h", kOptions, &index)) != -1;) { switch (option) {