Cliparser fix

Fix CLIGetStrwithRetrun
Allows casting and requires the buffer length to be passed in.
Existing uses of the function have been updated.
This commit is contained in:
mwalker33 authored and Philippe Teuwen committed 2020-10-17 00:27:14 +02:00
1 parent 8aa70b37e3
commit bb59250eca
6 files changed
+16 -7

No files matched your search

+2 -2
View File
@@ -203,11 +203,11 @@ CLIGetHexWithReturn(\<context\>, \<opt index\>, \<store variable\>, \<ptr to sto
quick test : seems res_keylen == 0 when ok so not key len ???
**string option return**
CLIGetStrWithReturn(\<context\>,\<opt index\>, \<unsigned char \*\>, \<int \*\>);
CLIGetStrWithReturn(\<context\>,\<opt index\>, \<uint8_t \*\>, \<int \*\>);
If failed to retrieve string, it will exit fct
uint8_t buffer[100];
int slen = 0;
int slen = sizeof(buffer); // <- slen MUST be the maximum number of characters that you want returned. e.g. Buffer Size
CLIGetStrWithReturn(ctx, 1, buffer, &slen);
**string option**