Add MQTT origin handling and string utility function

Implemented a new function to strip surrounding quotes from strings in TxtDataHelpers, enhancing string manipulation capabilities. Updated CommonCLI to handle MQTT origin configuration, allowing for both setting and clearing of the mqtt.origin preference. This change improves the flexibility of MQTT origin management in the CLI.
This commit is contained in:
agessaman committed 2026-05-09 18:06:18 -07:00
1 parent 303cf8c2bd
commit b9f478c989
4 files changed
+24 -21

No files matched your search

+14
View File
@@ -1,4 +1,18 @@
#include "TxtDataHelpers.h"
#include <string.h>
void StrHelper::stripSurroundingQuotes(char* str, size_t buf_sz) {
if (!str || buf_sz == 0) return;
size_t len = strlen(str);
if (len == 0) return;
if (str[0] == '"' || str[0] == '\'') {
memmove(str, str + 1, len);
len--;
}
if (len > 0 && (str[len - 1] == '"' || str[len - 1] == '\'')) {
str[len - 1] = '\0';
}
}
void StrHelper::strncpy(char* dest, const char* src, size_t buf_sz) {
while (buf_sz > 1 && *src) {