Skip to content

Commit f5c6e29

Browse files
aclipaulfd
authored andcommitted
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
1 parent c52e2d6 commit f5c6e29

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clients/jack_client.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,14 @@ std::vector<std::string> stringTokenize(const std::string& str)
221221

222222
void cliThreadProc()
223223
{
224+
const std::string whitespace = " \t";
224225
while (!shouldClose) {
225226
std::cout << "\n> ";
226227

227228
std::string command;
228229
std::getline(std::cin, command);
229-
std::size_t start = command.length()? command.find_first_not_of(" "): 0;
230-
std::size_t pos = command.find(" ", start);
230+
std::size_t start = command.length()? command.find_first_not_of(whitespace): 0;
231+
std::size_t pos = command.find_first_of(whitespace, start);
231232
std::string kw = command.substr(start, pos - start);
232233
std::string args = command.substr(pos + 1);
233234
std::vector<std::string> tokens = stringTokenize(args);

0 commit comments

Comments
 (0)