mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
vt: add vt_to_slave()
This commit is contained in:
parent
8bf0befe42
commit
2f6b8d232f
2 changed files with 22 additions and 0 deletions
21
vt.c
21
vt.c
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define LOG_MODULE "vt"
|
||||
|
|
@ -973,3 +974,23 @@ vt_from_slave(struct terminal *term, const uint8_t *data, size_t len)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
vt_to_slave(struct terminal *term, const void *_data, size_t len)
|
||||
{
|
||||
const uint8_t *data = _data;
|
||||
size_t left = len;
|
||||
|
||||
while (left > 0) {
|
||||
ssize_t ret = write(term->ptmx, data, left);
|
||||
if (ret < 0) {
|
||||
LOG_ERRNO("failed to write to client");
|
||||
return false;
|
||||
}
|
||||
|
||||
data += ret;
|
||||
left -= ret;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue