Allow Mac linebreaks in shell

QEMU uses Mac style newlines in its UART implementation.
This change allows Unix ("\n"), DOS ("\r\n") and Mac ("\r") style linebreaks.

(The rationale for the little change in line 162  is that the negation does not convey the meaning of the condition.)