diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/commandbuffer.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc index 71ad37f..4addd10 100644 --- a/src/core/commandbuffer.cc +++ b/src/core/commandbuffer.cc @@ -307,11 +307,26 @@ void CommandBuffer::exec() if (cmdbuf.eof()) return; - char line[MAXCMDSIZE]; - - while (core::cmd().getline(line, MAXCMDSIZE-1)) { - exec(std::string(line)); + std::string line; + char c; + bool quote = false; + + while ( core::cmd().read(&c , 1) && c) { + if ( c =='\n') { + exec(line); + line.clear(); + } else if (c == '"') { + quote = !quote; + } else if ((c == ';') && !quote) { + exec(line); + line.clear(); + } else { + line +=c; + } } + + if (line.size()) + exec(line); cmdbuf.clear(); } |