diff --git a/src/core/wee-string.c b/src/core/wee-string.c index eb65084ee..af50fb2fd 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -2118,7 +2118,7 @@ string_split_command (const char *command, char separator) while(*ptr != '\0') { type = 0; - if (*ptr == ';') + if (*ptr == separator) { if (ptr == command) type = 1; diff --git a/tests/unit/core/test-string.cpp b/tests/unit/core/test-string.cpp index 67e578d45..46314eb2b 100644 --- a/tests/unit/core/test-string.cpp +++ b/tests/unit/core/test-string.cpp @@ -942,6 +942,16 @@ TEST(String, SplitCommand) string_free_split_command (argv); + /* separator other than ';' */ + argv = string_split_command ("abc,de,fghi", ','); + CHECK(argv); + STRCMP_EQUAL("abc", argv[0]); + STRCMP_EQUAL("de", argv[1]); + STRCMP_EQUAL("fghi", argv[2]); + POINTERS_EQUAL(NULL, argv[3]); + + string_free_split_command (argv); + /* free split with NULL */ string_free_split_command (NULL); }