From c52e2d6f3391f3f19786bc78b78f53439b0a7f8c Mon Sep 17 00:00:00 2001 From: Ambrose Li Date: Wed, 29 May 2024 01:06:13 -0400 Subject: [PATCH] skip over leading spaces of any command. Fixes the problem where leading spaces would confuse the interpreter --- 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 ffe207ef..3c5487ee 100644 --- a/clients/jack_client.cpp +++ b/clients/jack_client.cpp @@ -226,8 +226,9 @@ void cliThreadProc() std::string command; std::getline(std::cin, command); - std::size_t pos = command.find(" "); - std::string kw = command.substr(0, pos); + std::size_t start = command.length()? command.find_first_not_of(" "): 0; + std::size_t pos = command.find(" ", start); + std::string kw = command.substr(start, pos - start); std::string args = command.substr(pos + 1); std::vector tokens = stringTokenize(args);