opt: allowe space on both sides of the plus sign when parse mod key

This commit is contained in:
DreamMaoMao 2026-03-17 19:44:25 +08:00
parent 028cf6e49e
commit 17434d6262

View file

@ -634,9 +634,14 @@ uint32_t parse_mod(const char *mod_str) {
// 分割处理每个部分 // 分割处理每个部分
token = strtok_r(input_copy, "+", &saveptr); token = strtok_r(input_copy, "+", &saveptr);
while (token != NULL) { while (token != NULL) {
// 去除空白 // 去除前后空白
while (*token == ' ' || *token == '\t') trim_whitespace(token);
token++;
// 如果 token 变成空字符串则跳过
if (*token == '\0') {
token = strtok_r(NULL, "+", &saveptr);
continue;
}
if (strncmp(token, "code:", 5) == 0) { if (strncmp(token, "code:", 5) == 0) {
// 处理 code: 形式 // 处理 code: 形式