From f5c6e29f23b8057867c08e88f5f6ac6738baa30b Mon Sep 17 00:00:00 2001 From: Ambrose Li Date: Wed, 29 May 2024 15:19:28 -0400 Subject: [PATCH] skip over spaces and tabs to find a command fed to it, and find the end of the command by looking for both spaces and tabs --- clients/jack_client.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clients/jack_client.cpp b/clients/jack_client.cpp index 3c5487ee..6ccfc7d6 100644 --- a/clients/jack_client.cpp +++ b/clients/jack_client.cpp @@ -221,13 +221,14 @@ std::vector stringTokenize(const std::string& str) void cliThreadProc() { + const std::string whitespace = " \t"; while (!shouldClose) { std::cout << "\n> "; std::string command; std::getline(std::cin, command); - std::size_t start = command.length()? command.find_first_not_of(" "): 0; - std::size_t pos = command.find(" ", start); + std::size_t start = command.length()? command.find_first_not_of(whitespace): 0; + std::size_t pos = command.find_first_of(whitespace, start); std::string kw = command.substr(start, pos - start); std::string args = command.substr(pos + 1); std::vector tokens = stringTokenize(args);