+int CLIParamStrToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen) {
+ *datalen = 0;
+ if (!argstr->count)
+ return 0;
+
+ uint8_t buf[256] = {0};
+ int ibuf = 0;
+
+ for (int i = 0; i < argstr->count; i++) {
+ int len = strlen(argstr->sval[i]);
+ memcpy(&buf[ibuf], argstr->sval[i], len);
+ ibuf += len;
+ }
+ buf[ibuf] = 0;
+
+ if (!ibuf)
+ return 0;
+
+ if (ibuf > maxdatalen)
+ return 2;
+
+ memcpy(data, buf, ibuf);
+ *datalen = ibuf;
+
+ return 0;
+}