This enables us to also ignore end-of-line comments. Completion is a bit
grumpy when done in comments but I doubt anyone would care.
line = strndup(line, len);
if (line[len - 1] == '\n') {
line[len - 1] = '\0';
- if (line[0] != '#')
- parse_and_exec(conn, fmt, line);
+ parse_and_exec(conn, fmt, line);
}
free(line);
}
char input[2*strlen(line) + 3]; /* 3 = 2 for '\n ' and 1 for \0 */
memset(input, 0, 2*strlen(line) + 3);
for (int pos = 0; line[pos]; pos++) {
+ if (line[pos] == '#' && !escaped && !quote)
+ break;
if (!escaped && strchr(escapes, line[pos]))
escaped = 1;
else if (!escaped && strchr(quotes, line[pos]) && !quote) {