sys/shell: rephrase/reformat some comments
This commit is contained in:
parent
2810637306
commit
3860355380
@ -175,7 +175,7 @@ static void handle_input_line(const shell_command_t *command_list, char *line)
|
|||||||
++argc;
|
++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) {
|
if (*pos > 0) {
|
||||||
*pos = 0;
|
*pos = 0;
|
||||||
++pos;
|
++pos;
|
||||||
@ -269,10 +269,11 @@ static int readline(char *buf, size_t size)
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We allow Unix linebreaks (\n), DOS linebreaks (\r\n), and Mac linebreaks (\r). */
|
/* We allow Unix linebreaks (\n), DOS linebreaks (\r\n), and Mac
|
||||||
/* QEMU transmits only a single '\r' == 13 on hitting enter ("-serial stdio"). */
|
* linebreaks (\r). QEMU transmits only a single '\r' == 13 on hitting
|
||||||
/* DOS newlines are handled like hitting enter twice, but empty lines are ignored. */
|
* enter ("-serial stdio"). DOS newlines are handled like hitting enter
|
||||||
/* Ctrl-C cancels the current line. */
|
* twice, but empty lines are ignored. Ctrl-C cancels the current line.
|
||||||
|
*/
|
||||||
if (c == '\r' || c == '\n' || c == ETX) {
|
if (c == '\r' || c == '\n' || c == ETX) {
|
||||||
if (c == ETX) {
|
if (c == ETX) {
|
||||||
curr_pos = 0;
|
curr_pos = 0;
|
||||||
@ -288,10 +289,12 @@ static int readline(char *buf, size_t size)
|
|||||||
return (length_exceeded) ? -ENOBUFS : curr_pos;
|
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 (c == 0x08 || c == 0x7f) {
|
||||||
if (curr_pos == 0) {
|
if (curr_pos == 0) {
|
||||||
/* The line is empty. */
|
/* ignore empty line */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user