projects
/
apps
/
madtty.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
many rewrites, let rote_vt_write be a more simple wrapper around write
[apps/madtty.git]
/
madtty
/
inject.c
diff --git
a/madtty/inject.c
b/madtty/inject.c
index
14bde65
..
29755fb
100644
(file)
--- a/
madtty/inject.c
+++ b/
madtty/inject.c
@@
-71,7
+71,7
@@
static void cursor_line_down(RoteTerm *rt)
/* clear last row of the scrolling region */
for (i = 0; i < rt->cols; i++) {
/* clear last row of the scrolling region */
for (i = 0; i < rt->cols; i++) {
- rt->cells[rt->pd->scrollbottom][i].ch = 0x20;
+ rt->cells[rt->pd->scrollbottom][i].ch
= 0x20;
rt->cells[rt->pd->scrollbottom][i].attr = 0x70;
}
}
rt->cells[rt->pd->scrollbottom][i].attr = 0x70;
}
}
@@
-113,11
+113,12
@@
static inline void put_normal_char(RoteTerm *rt, int c)
if (rt->insert) {
int i;
if (rt->insert) {
int i;
- for(i = rt->cols - 1; i >= rt->ccol+1; i--)
+ for(i = rt->cols - 1; i >= rt->ccol+1; i--)
{
rt->cells[rt->crow][i] = rt->cells[rt->crow][i-1];
rt->cells[rt->crow][i] = rt->cells[rt->crow][i-1];
+ }
}
}
- rt->cells[rt->crow][rt->ccol].ch = c;
+ rt->cells[rt->crow][rt->ccol].ch
= c;
rt->cells[rt->crow][rt->ccol].attr = rt->curattr;
rt->ccol++;
rt->cells[rt->crow][rt->ccol].attr = rt->curattr;
rt->ccol++;
@@
-253,15
+254,10
@@
static void try_interpret_escape_seq(RoteTerm *rt)
cancel_escape_sequence(rt);
}
cancel_escape_sequence(rt);
}
-
void
rote_vt_inject(RoteTerm *rt, const char *data, int len)
+
int
rote_vt_inject(RoteTerm *rt, const char *data, int len)
{
{
- int i;
-
- for (i = 0; i < len; i++, data++) {
- if (*data == 0)
- continue; /* completely ignore NUL */
-
- if (*data >= 1 && *data <= 31) {
+ for (; len-- > 0; data++) {
+ if ((unsigned char)*data <= 31) {
handle_control_char(rt, *data);
continue;
}
handle_control_char(rt, *data);
continue;
}
@@
-279,6
+275,8
@@
void rote_vt_inject(RoteTerm *rt, const char *data, int len)
put_normal_char(rt, *data);
}
}
put_normal_char(rt, *data);
}
}
+
+ return 0;
}
/****************************************************************************/
}
/****************************************************************************/
@@
-381,7
+379,7
@@
static void interpret_csi_ED(RoteTerm *rt, int param[], int pcount)
c <= (r == end_row ? end_col : rt->cols - 1);
c++)
{
c <= (r == end_row ? end_col : rt->cols - 1);
c++)
{
- rt->cells[r][c].ch = 0x20;
+ rt->cells[r][c].ch
= 0x20;
rt->cells[r][c].attr = rt->curattr;
}
}
rt->cells[r][c].attr = rt->curattr;
}
}
@@
-441,7
+439,7
@@
static void interpret_csi_EL(RoteTerm *rt, int param[], int pcount)
}
for (i = erase_start; i <= erase_end; i++) {
}
for (i = erase_start; i <= erase_end; i++) {
- rt->cells[rt->crow][i].ch = 0x20;
+ rt->cells[rt->crow][i].ch
= 0x20;
rt->cells[rt->crow][i].attr = rt->curattr;
}
rt->cells[rt->crow][i].attr = rt->curattr;
}
@@
-459,7
+457,7
@@
static void interpret_csi_ICH(RoteTerm *rt, int param[], int pcount)
}
for (i = rt->ccol; i < rt->ccol + n; i++) {
}
for (i = rt->ccol; i < rt->ccol + n; i++) {
- rt->cells[rt->crow][i].ch = 0x20;
+ rt->cells[rt->crow][i].ch
= 0x20;
rt->cells[rt->crow][i].attr = rt->curattr;
}
rt->cells[rt->crow][i].attr = rt->curattr;
}
@@
-476,7
+474,7
@@
static void interpret_csi_DCH(RoteTerm *rt, int param[], int pcount)
if (i + n < rt->cols) {
rt->cells[rt->crow][i] = rt->cells[rt->crow][i + n];
} else {
if (i + n < rt->cols) {
rt->cells[rt->crow][i] = rt->cells[rt->crow][i + n];
} else {
- rt->cells[rt->crow][i].ch = 0x20;
+ rt->cells[rt->crow][i].ch
= 0x20;
rt->cells[rt->crow][i].attr = rt->curattr;
}
}
rt->cells[rt->crow][i].attr = rt->curattr;
}
}
@@
-497,7
+495,8
@@
static void interpret_csi_IL(RoteTerm *rt, int param[], int pcount)
for (i = rt->crow; i < rt->crow + n && i <= rt->pd->scrollbottom; i++) {
rt->line_dirty[i] = true;
for (j = 0; j < rt->cols; j++) {
for (i = rt->crow; i < rt->crow + n && i <= rt->pd->scrollbottom; i++) {
rt->line_dirty[i] = true;
for (j = 0; j < rt->cols; j++) {
- rt->cells[i][j].ch = 0x20, rt->cells[i][j].attr = rt->curattr;
+ rt->cells[i][j].ch = 0x20;
+ rt->cells[i][j].attr = rt->curattr;
}
}
}
}
@@
-515,7
+514,8
@@
static void interpret_csi_DL(RoteTerm *rt, int param[], int pcount)
memcpy(rt->cells[i], rt->cells[i+n], sizeof(RoteCell) * rt->cols);
} else {
for (j = 0; j < rt->cols; j++) {
memcpy(rt->cells[i], rt->cells[i+n], sizeof(RoteCell) * rt->cols);
} else {
for (j = 0; j < rt->cols; j++) {
- rt->cells[i][j].ch = 0x20, rt->cells[i][j].attr = rt->curattr;
+ rt->cells[i][j].ch = 0x20;
+ rt->cells[i][j].attr = rt->curattr;
}
}
}
}
}
}
@@
-528,7
+528,7
@@
static void interpret_csi_ECH(RoteTerm *rt, int param[], int pcount)
int i;
for (i = rt->ccol; i < rt->ccol + n && i < rt->cols; i++) {
int i;
for (i = rt->ccol; i < rt->ccol + n && i < rt->cols; i++) {
- rt->cells[rt->crow][i].ch = 0x20;
+ rt->cells[rt->crow][i].ch
= 0x20;
rt->cells[rt->crow][i].attr = rt->curattr;
}
rt->cells[rt->crow][i].attr = rt->curattr;
}
@@
-568,13
+568,19
@@
static void interpret_csi_DECSTBM(RoteTerm *rt, int param[], int pcount)
rt->pd->scrollbottom = newbottom;
}
rt->pd->scrollbottom = newbottom;
}
-static void interpret_csi_SAVECUR(RoteTerm *rt, int param[], int pcount)
+static void
+interpret_csi_SAVECUR(RoteTerm *rt,
+ int param[] __attribute__((unused)),
+ int pcount __attribute__((unused)))
{
rt->pd->saved_x = rt->ccol;
rt->pd->saved_y = rt->crow;
}
{
rt->pd->saved_x = rt->ccol;
rt->pd->saved_y = rt->crow;
}
-static void interpret_csi_RESTORECUR(RoteTerm *rt, int param[], int pcount)
+static void
+interpret_csi_RESTORECUR(RoteTerm *rt,
+ int param[] __attribute__((unused)),
+ int pcount __attribute__((unused)))
{
rt->ccol = rt->pd->saved_x;
rt->crow = rt->pd->saved_y;
{
rt->ccol = rt->pd->saved_x;
rt->crow = rt->pd->saved_y;