From: Sebastian Harl Date: Fri, 10 Jan 2014 08:17:05 +0000 (+0100) Subject: sysdb: Only strip newlines from the command buffer. X-Git-Tag: sysdb-0.1.0~243 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=f2d160c71a5458ae9789861f772853afb471dbe8 sysdb: Only strip newlines from the command buffer. Keep whitespace in order to keep the users formatting and keep semicolons to ensure correct parsing (avoid possible future ambiquity). --- diff --git a/src/tools/sysdb/command.c b/src/tools/sysdb/command.c index 3b64def..b568aae 100644 --- a/src/tools/sysdb/command.c +++ b/src/tools/sysdb/command.c @@ -53,13 +53,12 @@ sdb_command_exec(sdb_input_t *input) assert(input->query_len <= input->tokenizer_pos); - /* removing leading and trailing whitespace */ - while (isspace((int)*query) && query_len) { + /* removing leading and trailing newlines */ + while (query_len && (*query == '\n')) { ++query; --query_len; } - while (query_len && (isspace((int)query[query_len - 1]) - || (query[query_len - 1] == ';'))) + while (query_len && (query[query_len - 1]) == '\n') --query_len; if (query_len) {