Handle input line-by-line instead of as a single stream

In case we receive several \n separated commands at once, we want to be
able to interpret them all, not just the first one. Now we split the
input on \n and loop through the result, looking for a command in each,
instead of just once.