Implement ^D
This commit is contained in:
parent
54cd6e4547
commit
53aee7dc38
@ -116,6 +116,16 @@ static void input_process(pty_t * pty, uint8_t c) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (c == pty->tios.c_cc[VEOF]) {
|
||||||
|
if (pty->tios.c_lflag & ECHO) {
|
||||||
|
output_process(pty, '^');
|
||||||
|
output_process(pty, '@' + c);
|
||||||
|
output_process(pty, '\n');
|
||||||
|
}
|
||||||
|
clear_input_buffer(pty);
|
||||||
|
ring_buffer_interrupt(pty->in);
|
||||||
|
return;
|
||||||
|
}
|
||||||
pty->canon_buffer[pty->canon_buflen] = c;
|
pty->canon_buffer[pty->canon_buflen] = c;
|
||||||
if (pty->tios.c_lflag & ECHO) {
|
if (pty->tios.c_lflag & ECHO) {
|
||||||
output_process(pty, c);
|
output_process(pty, c);
|
||||||
@ -123,10 +133,12 @@ static void input_process(pty_t * pty, uint8_t c) {
|
|||||||
if (pty->canon_buffer[pty->canon_buflen] == '\n') {
|
if (pty->canon_buffer[pty->canon_buflen] == '\n') {
|
||||||
pty->canon_buflen++;
|
pty->canon_buflen++;
|
||||||
dump_input_buffer(pty);
|
dump_input_buffer(pty);
|
||||||
|
ring_buffer_interrupt(pty->in);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pty->canon_buflen == pty->canon_bufsize) {
|
if (pty->canon_buflen == pty->canon_bufsize) {
|
||||||
dump_input_buffer(pty);
|
dump_input_buffer(pty);
|
||||||
|
ring_buffer_interrupt(pty->in);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pty->canon_buflen++;
|
pty->canon_buflen++;
|
||||||
|
@ -32,6 +32,9 @@ static uint32_t read_unixpipe(fs_node_t * node, uint32_t offset, uint32_t size,
|
|||||||
return read;
|
return read;
|
||||||
}
|
}
|
||||||
size_t r = ring_buffer_read(self->buffer, 1, buffer+read);
|
size_t r = ring_buffer_read(self->buffer, 1, buffer+read);
|
||||||
|
if (r && *((char *)(buffer + read)) == '\n') {
|
||||||
|
return read+r;
|
||||||
|
}
|
||||||
read += r;
|
read += r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user