terminal_echo: Add line feed end carriage return

Issue #1329
This commit is contained in:
Sebastian Sumpf 2014-12-17 16:12:01 +01:00 committed by Christian Helmuth
parent 0c2bdf9edd
commit 3fd561aab6

View File

@ -32,7 +32,7 @@ int main(int, char **)
terminal.read_avail_sigh(sig_rec.manage(&sig_ctx)); terminal.read_avail_sigh(sig_rec.manage(&sig_ctx));
static const char *intro_text = static const char *intro_text =
"--- Terminal echo test started - now you can type characters to be echoed. ---\n"; "--- Terminal echo test started - now you can type characters to be echoed. ---\r\n";
terminal.write(intro_text, strlen(intro_text) + 1); terminal.write(intro_text, strlen(intro_text) + 1);
for (;;) { for (;;) {
@ -44,8 +44,13 @@ int main(int, char **)
if (verbose && (num_bytes > 0)) if (verbose && (num_bytes > 0))
PDBG("got %d bytes", num_bytes); PDBG("got %d bytes", num_bytes);
for (int i = 0; i < num_bytes; i++) for (int i = 0; i < num_bytes; i++) {
if (read_buffer[i] == '\r') {
terminal.write("\n", 1);
}
terminal.write(&read_buffer[i], 1); terminal.write(&read_buffer[i], 1);
}
} }
return 0; return 0;