And more.

This commit is contained in:
Nicholas Marriott 2007-07-09 19:39:47 +00:00
parent 039b7ecbef
commit 40ece59195

41
local.c
View File

@ -1,4 +1,4 @@
/* $Id: local.c,v 1.2 2007-07-09 19:34:55 nicm Exp $ */ /* $Id: local.c,v 1.3 2007-07-09 19:39:47 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -236,8 +236,9 @@ local_init(struct buffer **in, struct buffer **out)
if (tcsetattr(local_fd, TCSANOW, &tio) != 0) if (tcsetattr(local_fd, TCSANOW, &tio) != 0)
log_fatal("tcsetattr"); log_fatal("tcsetattr");
if (enter_ca_mode) if (enter_ca_mode != NULL)
local_putp(enter_ca_mode); local_putp(enter_ca_mode);
if (keypad_xmit != NULL)
local_putp(keypad_xmit); local_putp(keypad_xmit);
local_putp(clear_screen); local_putp(clear_screen);
@ -283,11 +284,14 @@ local_done(void)
log_fatal("tcsetattr"); log_fatal("tcsetattr");
close(local_fd); close(local_fd);
if (keypad_local != NULL)
putp(keypad_local); /* not local_putp */ putp(keypad_local); /* not local_putp */
if (exit_ca_mode) if (exit_ca_mode != NULL)
putp(exit_ca_mode); putp(exit_ca_mode);
putp(clear_screen); putp(clear_screen);
if (cursor_normal != NULL)
putp(cursor_normal); putp(cursor_normal);
if (exit_attribute_mode != NULL)
putp(exit_attribute_mode); putp(exit_attribute_mode);
} }
@ -370,21 +374,21 @@ local_output(struct buffer *b, size_t size)
if (ch != '\e') { if (ch != '\e') {
switch (ch) { switch (ch) {
case '\n': /* LF */ case '\n': /* LF */
if (cursor_down) { if (cursor_down != NULL) {
local_putp(cursor_down); local_putp(cursor_down);
break; break;
} }
log_warnx("cursor_down not supported"); log_warnx("cursor_down not supported");
break; break;
case '\r': /* CR */ case '\r': /* CR */
if (carriage_return) { if (carriage_return != NULL) {
local_putp(carriage_return); local_putp(carriage_return);
break; break;
} }
log_warnx("carriage_return not supported"); log_warnx("carriage_return not supported");
break; break;
case '\010': /* BS */ case '\010': /* BS */
if (cursor_left) { if (cursor_left != NULL) {
local_putp(cursor_left); local_putp(cursor_left);
break; break;
} }
@ -454,7 +458,7 @@ local_output(struct buffer *b, size_t size)
size -= 4; size -= 4;
ua = input_extract16(b); ua = input_extract16(b);
ub = input_extract16(b); ub = input_extract16(b);
if (cursor_address) { if (cursor_address == NULL) {
log_warnx("cursor_address not supported"); log_warnx("cursor_address not supported");
break; break;
} }
@ -489,8 +493,10 @@ local_output(struct buffer *b, size_t size)
local_putp(clr_bol); local_putp(clr_bol);
break; break;
case CODE_CLEARLINE: case CODE_CLEARLINE:
if (clr_eol == NULL) if (clr_eol == NULL) {
log_fatalx("local_output: clr_eol"); log_warnx("clr_eol not suppported");
break;
}
local_putp(clr_eol); /* XXX */ local_putp(clr_eol); /* XXX */
break; break;
case CODE_INSERTLINE: case CODE_INSERTLINE:
@ -546,7 +552,7 @@ local_output(struct buffer *b, size_t size)
break; break;
case CODE_CURSOROFF: case CODE_CURSOROFF:
if (cursor_invisible == NULL) { if (cursor_invisible == NULL) {
log_warnx("cursor_invisible"); log_warnx("cursor_invisible not supported");
break; break;
} }
local_putp(cursor_invisible); local_putp(cursor_invisible);
@ -645,7 +651,6 @@ local_output(struct buffer *b, size_t size)
break; break;
} }
if (ua == 0) { if (ua == 0) {
if (exit_attribute_mode)
local_putp(exit_attribute_mode); local_putp(exit_attribute_mode);
break; break;
} }
@ -714,12 +719,11 @@ local_output(struct buffer *b, size_t size)
case 39: case 39:
if (set_a_foreground == NULL) if (set_a_foreground == NULL)
break; break;
if (tigetflag("AX") == TRUE) if (tigetflag("AX") == TRUE) {
local_putp("\e[39m"); local_putp("\e[39m");
else { break;
local_putp(
tparm(set_a_foreground, 7));
} }
local_putp(tparm(set_a_foreground, 7));
break; break;
case 40: case 40:
case 41: case 41:
@ -737,12 +741,11 @@ local_output(struct buffer *b, size_t size)
case 49: case 49:
if (set_a_background == NULL) if (set_a_background == NULL)
break; break;
if (tigetflag("AX") == TRUE) if (tigetflag("AX") == TRUE) {
local_putp("\e[49m"); local_putp("\e[49m");
else { break;
local_putp(
tparm(set_a_background, 0));
} }
local_putp(tparm(set_a_background, 0));
break; break;
} }
} }