return node;
}
+
+// Cloudwalk FIXME: The entire design of this thing is overly complicated.
+// We could very much safely have one input node per line whether or not
+// the command was terminated. We don't need to split up input nodes per command
+// executed.
static size_t Cmd_ParseInput (cmd_input_t **output, char **input)
{
size_t pos, cmdsize = 0, start = 0;
if(!*output)
*output = Cmd_AllocInputNode();
+ // Append, since this input line hasn't closed yet.
if((*output)->pending)
offset = (*output)->length;
}
strlcpy(&(*output)->text[offset], &(*input)[start], cmdsize + 1);
+
+ /*
+ * If we were still looking ahead by the time we broke from the loop, the command input
+ * hasn't terminated yet and we're still expecting more, so keep this node open for appending later.
+ */
(*output)->pending = !lookahead;
}
// Slide the pointer down until we reach the end
while(*in)
{
+ // Check if the current node is still accepting input (input line hasn't terminated)
current = Cbuf_LinkGet(cbuf, existing);
newsize = Cmd_ParseInput(¤t, &in);
// Valid command
if(newsize)
{
+ // current will match existing if the input line hasn't terminated yet
if(current != existing)
{
current->source = cmd;