sys/shell: rephrase/reformat some comments

This commit is contained in:
Hendrik van Essen 2020-02-07 12:50:49 +01:00 committed by Francisco Molina
parent 2810637306
commit 3860355380
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8

View File

@ -175,7 +175,7 @@ static void handle_input_line(const shell_command_t *command_list, char *line)
++argc;
}
/* zero out the current position (space or quotation mark) and advance */
/* zero out current position (space or quotation mark) and advance */
if (*pos > 0) {
*pos = 0;
++pos;
@ -269,10 +269,11 @@ static int readline(char *buf, size_t size)
return EOF;
}
/* We allow Unix linebreaks (\n), DOS linebreaks (\r\n), and Mac linebreaks (\r). */
/* QEMU transmits only a single '\r' == 13 on hitting enter ("-serial stdio"). */
/* DOS newlines are handled like hitting enter twice, but empty lines are ignored. */
/* Ctrl-C cancels the current line. */
/* We allow Unix linebreaks (\n), DOS linebreaks (\r\n), and Mac
* linebreaks (\r). QEMU transmits only a single '\r' == 13 on hitting
* enter ("-serial stdio"). DOS newlines are handled like hitting enter
* twice, but empty lines are ignored. Ctrl-C cancels the current line.
*/
if (c == '\r' || c == '\n' || c == ETX) {
if (c == ETX) {
curr_pos = 0;
@ -288,10 +289,12 @@ static int readline(char *buf, size_t size)
return (length_exceeded) ? -ENOBUFS : curr_pos;
}
/* QEMU uses 0x7f (DEL) as backspace, while 0x08 (BS) is for most terminals */
/* check for backspace:
* 0x7f (DEL) when using QEMU
* 0x08 (BS) for most terminals */
if (c == 0x08 || c == 0x7f) {
if (curr_pos == 0) {
/* The line is empty. */
/* ignore empty line */
continue;
}