shell: add more versatility

The current shell implementation allocates the line buffer on the stack,
which is a bad idea. A REPL session cannot be quit.

This PR adds a parameter where to find the statically allocated line buffer.
It adds the command "quit" to exit the current shell session, which e.g.
enables the use of nested shells. Error results of `shell->readchar()`
end the session as well, and aren't ignored anymore.

~~(This PR is rebased on #1037)~~