Skip to content

Commit 601bf8b

Browse files
committed
subsys: ctr_config: Ensure strings are always enclosed in quotes in show output
Signed-off-by: Karel Blavka <[email protected]>
1 parent af00360 commit 601bf8b

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

subsys/ctr_config/ctr_config.c

+3-16
Original file line numberDiff line numberDiff line change
@@ -181,25 +181,12 @@ int ctr_config_show_item(const struct shell *shell, const struct ctr_config_item
181181
int32_t val = 0;
182182
memcpy(&val, item->variable, item->size);
183183

184-
shell_print(shell, "%s config %s %s", mod, item->name, item->enums[val]);
184+
shell_print(shell, "%s config %s \"%s\"", mod, item->name, item->enums[val]);
185185
break;
186186
}
187187
case CTR_CONFIG_TYPE_STRING: {
188-
size_t len = strlen((char *)item->variable);
189-
bool contains_space = false;
190-
for (size_t i = 0; i < len; i++) {
191-
if (isspace(((char *)item->variable)[i])) {
192-
contains_space = true;
193-
break;
194-
}
195-
}
196-
if (contains_space) {
197-
shell_print(shell, "%s config %s \"%s\"", mod, item->name,
198-
(char *)item->variable);
199-
} else {
200-
shell_print(shell, "%s config %s %s", mod, item->name,
201-
(char *)item->variable);
202-
}
188+
189+
shell_print(shell, "%s config %s \"%s\"", mod, item->name, (char *)item->variable);
203190
break;
204191
}
205192
case CTR_CONFIG_TYPE_HEX:

0 commit comments

Comments
 (0)