diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-08 10:59:47 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-08 10:59:47 +0000 |
commit | 2182933986afd7e17cf9072d8f2e3333fa110cd4 (patch) | |
tree | a278558fa48c6948ba07c1d61338dd2bc560631f /src/core | |
parent | 4cad4a27677b0490d3ba0018bc3404961f925ed5 (diff) |
docking, join menu
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(); } |