Sat Jun 8 11:41:37 2002 Michael Jennings (mej)

Escreen update with Twin support from Azundris <scream@azundris.com>.


SVN revision: 6307
This commit is contained in:
Michael Jennings 2002-06-08 15:44:08 +00:00
parent ed14ba8dde
commit 92937f46a7
26 changed files with 1417 additions and 566 deletions

View File

@ -4687,3 +4687,7 @@ Sun Jun 2 20:25:55 2002 Michael Jennings (mej)
Oops, missed these.
----------------------------------------------------------------------
Sat Jun 8 11:41:37 2002 Michael Jennings (mej)
Escreen update with Twin support from Azundris <scream@azundris.com>.
----------------------------------------------------------------------

View File

@ -11,121 +11,122 @@
# CONTROL VARIETY ############################################################
# ctrl-left -> previous display, ctrl-right -> next display
bind ctrl Left to echo ^Ap
bind ctrl Right to echo ^An
bind ctrl Left to script es_display(prvs)
bind ctrl Right to script es_display(next)
# ctl-pg_up -> previous display, ctl-pg_dn -> next display (Galeon-like)
bind ctrl Prior to echo ^Ap
bind ctrl Next to echo ^An
# ctl-pg_up -> previous display, ctl-pg_dn -> next display((Galeon-like)
bind ctrl Prior to script es_display(prvs)
bind ctrl Next to script es_display(next)
# no ctrl-up/down; we shouldn't steal that from the app.
# ctl-space -> toggle between last two displays
bind ctrl space to echo ^A^A
bind ctrl space to script es_display(toggle)
# ctrl-1..ctrl-0 -> display_0..display_9
bind ctrl 0x31 to echo ^A0
bind ctrl 0x32 to echo ^A1
bind ctrl 0x33 to echo ^A2
bind ctrl 0x34 to echo ^A3
bind ctrl 0x35 to echo ^A4
bind ctrl 0x36 to echo ^A5
bind ctrl 0x37 to echo ^A6
bind ctrl 0x38 to echo ^A7
bind ctrl 0x39 to echo ^A8
bind ctrl 0x30 to echo ^A9
# ctrl-1..ctrl-0 -> display0..display9
bind ctrl 0x31 to script es_display(goto,0)
bind ctrl 0x32 to script es_display(goto,1)
bind ctrl 0x33 to script es_display(goto,2)
bind ctrl 0x34 to script es_display(goto,3)
bind ctrl 0x35 to script es_display(goto,4)
bind ctrl 0x36 to script es_display(goto,5)
bind ctrl 0x37 to script es_display(goto,6)
bind ctrl 0x38 to script es_display(goto,7)
bind ctrl 0x39 to script es_display(goto,8)
bind ctrl 0x30 to script es_display(goto,9)
# ALT VARIETY ################################################################
# alt-left -> previous display, alt-right -> next display
bind alt Left to echo ^Ap
bind alt Right to echo ^An
bind alt Left to script es_display(prvs)
bind alt Right to script es_display(next)
# alt-up -> previous region, alt-down -> next region
bind alt Down to echo ^A\t
# alt-up -> previous region, alt-down -> next region (^A\t)
bind alt Up to script es_region(prvs)
bind alt Down to script es_region(next)
# alt-pg_up -> previous display, alt-pg_dn -> next display
bind alt Prior to echo ^Ap
bind alt Next to echo ^An
bind alt Prior to script es_display(prvs)
bind alt Next to script es_ display(next)
# alt-space -> toggle between last two displays
bind alt space to echo ^A^A
bind alt space to script es_display(toggle
# alt-1..alt-0 -> display_0..display_9
bind alt 0x31 to echo ^A0
bind alt 0x32 to echo ^A1
bind alt 0x33 to echo ^A2
bind alt 0x34 to echo ^A3
bind alt 0x35 to echo ^A4
bind alt 0x36 to echo ^A5
bind alt 0x37 to echo ^A6
bind alt 0x38 to echo ^A7
bind alt 0x39 to echo ^A8
bind alt 0x30 to echo ^A9
# alt-1..alt-0 -> display(0..display(9
bind alt 0x31 to script es_display(goto,0)
bind alt 0x32 to script es_display(goto,1)
bind alt 0x33 to script es_display(goto,2)
bind alt 0x34 to script es_display(goto,3)
bind alt 0x35 to script es_display(goto,4)
bind alt 0x36 to script es_display(goto,5)
bind alt 0x37 to script es_display(goto,6)
bind alt 0x38 to script es_display(goto,7)
bind alt 0x39 to script es_display(goto,8)
bind alt 0x30 to script es_display(goto,9)
# FUNCTION KEYS ##############################################################
# F1..F10 -> display_0..display_9
bind F1 to echo ^A0
bind F2 to echo ^A1
bind F3 to echo ^A2
bind F4 to echo ^A3
bind F5 to echo ^A4
bind F6 to echo ^A5
bind F7 to echo ^A6
bind F8 to echo ^A7
bind F9 to echo ^A8
bind F10 to echo ^A9
# F1..F10 -> display0..display9
bind F1 to script es_display(goto,0)
bind F2 to script es_display(goto,1)
bind F3 to script es_display(goto,2)
bind F4 to script es_display(goto,3)
bind F5 to script es_display(goto,4)
bind F6 to script es_display(goto,5)
bind F7 to script es_display(goto,6)
bind F8 to script es_display(goto,7)
bind F9 to script es_display(goto,8)
bind F10 to script es_display(goto,9)
# alt F4 -> close display
bind alt F4 to echo ^Ak
# alt F4 -> close display (ask for confirmation)
bind alt F4 to script es_display(kill,ask)
# MISC STUFF #################################################################
# DISPLAY
# alt-n -> new display
bind alt n to echo ^Ac
bind alt n to script es_display(new)
# alt-r -> rename display
bind alt r to echo ^AA
bind alt r to script es_display(title)
# alt-c -> close display
bind alt c to echo ^Ak
bind alt c to script es_display(kill,ask)
# alt-m -> monitor display
bind alt m to echo ^AM
bind alt m to script es_display(monitor)
# alt-b -> backlog
bind alt b to echo ^A^[
# alt-b -> backlog (^A^[)
bind alt b to script es_display(back)
# REGION
# alt-s -> split
bind alt s to echo ^AS
# alt-s -> split (^AS)
bind alt s to script es_region(new)
# alt-u -> unsplit
bind alt u to echo ^AQ
# alt-u -> unsplit (^AQ)
bind alt u to script es_region(full)
# alt-o -> other region
bind alt o to echo ^A^I
# alt-o -> other region (^A^I)
bind alt o to script es_region(next)
# alt-k -> kill region
bind alt k to echo ^AX
# alt-k -> kill region (^AX)
bind alt k to script es_region(kill,ask)
# ^Tab -> next region
bind ctrl Tab to echo ^A^I
# ^Tab -> next region (^A^I)
bind ctrl Tab to script es_region(next)
# OTHER
# alt-S -> statement
bind alt shift S to echo ^A:
# alt-S -> statement (^A:)
bind alt shift S to script es_statement
# alt-R -> reset
bind alt shift R to echo ^AZ
# alt-R -> reset (^AZ)
bind alt shift R to script es_reset

View File

@ -825,7 +825,7 @@ button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Ti
case ACTION_ECHO:
if (!press) {
#ifdef ESCREEN
if (TermWin.screen && TermWin.screen->backend) { /* translate escapes */
if (TermWin.screen && TermWin.screen->backend) { /* translate escapes */
button_t *b = bbar->buttons;
_ns_disp *d2 = TermWin.screen->dsps;
int n = (button->action.string)[1] - '0';
@ -855,7 +855,7 @@ button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Ti
if (prvs == 2) {
/* middle button -- kill */
(void) ns_rem_disp(TermWin.screen, n);
(void) ns_rem_disp(TermWin.screen, n, TRUE);
} else {
/* right button -- rename */
(void) ns_ren_disp(TermWin.screen, n, NULL);
@ -1164,7 +1164,7 @@ buttonbar_t *bbar_insert_button(buttonbar_t *bbar, button_t *button, int after,
}
}
} else { /* add to buttons */
if (!bbar->buttons || after < 0) { /* first button */
if (!bbar->buttons || after < 0) { /* first button */
button->next = bbar->buttons;
bbar->buttons = button;
} else {

View File

@ -131,7 +131,11 @@ static const char cvs_ident[] = "$Id$";
#include "menus.h"
#ifdef ESCREEN
# include "screamcfg.h"
# include "screamcfg.h"
# ifdef NS_HAVE_TWIN
# include <Tw/Tw.h>
TW_DECL_MAGIC(libscream_magic);
# endif
#endif
static RETSIGTYPE handle_child_signal(int);
@ -141,7 +145,7 @@ static RETSIGTYPE handle_crash(int);
/* local variables */
int my_ruid, my_euid, my_rgid, my_egid;
char initial_dir[PATH_MAX + 1];
static char *ptydev = NULL, *ttydev = NULL; /* pty/tty name */
static char *ptydev = NULL, *ttydev = NULL; /* pty/tty name */
int cmd_fd = -1; /* file descriptor connected to the command */
int pipe_fd = -1;
pid_t cmd_pid = -1; /* process id if child */
@ -955,10 +959,10 @@ const char *
get_ctrl_char_name(char c)
{
const char *lookup[] = {
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */
"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */
"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */
};
return ((c < ' ') ? (lookup[(int) c]) : (""));
@ -1134,8 +1138,7 @@ clean_exit(void)
font_cache_clear();
eterm_font_list_clear();
# ifdef PIXMAP_SUPPORT
FOREACH_IMAGE(free_eterm_image(&(images[idx]));
);
FOREACH_IMAGE(free_eterm_image(&(images[idx])););
# endif
for (i = 0; i < NRS_COLORS; i++) {
if (rs_color[i]) {
@ -1419,7 +1422,7 @@ get_tty(void)
privileges(INVOKE);
# ifndef __CYGWIN32__
fchown(fd, my_ruid, gid); /* fail silently */
fchown(fd, my_ruid, gid); /* fail silently */
fchmod(fd, mode);
# endif
privileges(REVERT);
@ -1676,28 +1679,28 @@ get_ttymode(ttymode_t *tio)
/* get parameters -- gtty */
if (ioctl(0, TIOCGETP, &(tio->sg)) < 0) {
tio->sg.sg_erase = CERASE; /* ^H */
tio->sg.sg_kill = CKILL; /* ^U */
tio->sg.sg_erase = CERASE; /* ^H */
tio->sg.sg_kill = CKILL; /* ^U */
}
tio->sg.sg_flags = (CRMOD | ECHO | EVENP | ODDP);
/* get special characters */
if (ioctl(0, TIOCGETC, &(tio->tc)) < 0) {
tio->tc.t_intrc = CINTR; /* ^C */
tio->tc.t_quitc = CQUIT; /* ^\ */
tio->tc.t_startc = CSTART; /* ^Q */
tio->tc.t_stopc = CSTOP; /* ^S */
tio->tc.t_intrc = CINTR; /* ^C */
tio->tc.t_quitc = CQUIT; /* ^\ */
tio->tc.t_startc = CSTART; /* ^Q */
tio->tc.t_stopc = CSTOP; /* ^S */
tio->tc.t_eofc = CEOF; /* ^D */
tio->tc.t_brkc = -1;
}
/* get local special chars */
if (ioctl(0, TIOCGLTC, &(tio->lc)) < 0) {
tio->lc.t_suspc = CSUSP; /* ^Z */
tio->lc.t_dsuspc = CDSUSP; /* ^Y */
tio->lc.t_rprntc = CRPRNT; /* ^R */
tio->lc.t_flushc = CFLUSH; /* ^O */
tio->lc.t_werasc = CWERASE; /* ^W */
tio->lc.t_lnextc = CLNEXT; /* ^V */
tio->lc.t_suspc = CSUSP; /* ^Z */
tio->lc.t_dsuspc = CDSUSP; /* ^Y */
tio->lc.t_rprntc = CRPRNT; /* ^R */
tio->lc.t_flushc = CFLUSH; /* ^O */
tio->lc.t_werasc = CWERASE; /* ^W */
tio->lc.t_lnextc = CLNEXT; /* ^V */
}
/* get line discipline */
ioctl(0, TIOCGETD, &(tio->line));
@ -2715,7 +2718,7 @@ matrix(int n)
break;
default:
t[x] = random() & 0xff; /* hold */
t[x] = random() & 0xff; /* hold */
}
}
}
@ -2759,7 +2762,97 @@ waitstate(void *xd, int ms)
return 0;
}
#undef CLEAR
int
make_escreen_menu(void)
{
button_t *button;
menu_t *m;
menuitem_t *i;
if ((m = menu_create(NS_MENU_TITLE))) {
char *sc[] = {
/* display functions */
"New", "display(new)", /* \x01:screen\r */
"New ...", "display(new,ask)",
"Rename ...", "display(name,ask)",
"Backlog ...", "display(backlog)",
"Monitor", "display(monitor)",
"Close", "display(close)",
"-", "",
/* region functions */
"Split", "region(new)",
"Unsplit", "region(full)",
"Prvs region", "region(prvs)", /* NS_SCREEN_PRVS_REG */
"Next region", "region(next)",
"Kill region", "region(kill)",
"-", "",
/* screen functions */
"Reset", "reset",
"Statement", "statement",
"-", ""
};
int n, nsc = sizeof(sc) / sizeof(char *);
if (menu_list) {
for (n = 0; n < menu_list->nummenus; n++) { /* blend in w/ l&f */
if (menu_list->menus[n]->font) {
m->font = menu_list->menus[n]->font;
m->fwidth = menu_list->menus[n]->fwidth;
m->fheight = menu_list->menus[n]->fheight;
#ifdef MULTI_CHARSET
m->fontset = menu_list->menus[n]->fontset;
#endif
break;
}
}
}
for (n = 0; n < (nsc - 1); n += 2) {
if (!strcmp(sc[n], "-")) { /* separator */
if ((i = menuitem_create(NULL))) {
menu_add_item(m, i);
menuitem_set_action(i, MENUITEM_SEP, NULL);
}
} /* menu entry */
else if ((i = menuitem_create(sc[n]))) {
menuitem_set_action(i, MENUITEM_SCRIPT, sc[n + 1]);
menu_add_item(m, i);
}
}
if ((i = menuitem_create("About..."))) {
menuitem_set_action(i, MENUITEM_ALERT, "Screen/Twin compatibility layer by Azundris <scream@azundris.com>");
menu_add_item(m, i);
}
if ((button = button_create(NS_MENU_TITLE))) {
if (!(buttonbar = bbar_insert_button(buttonbar, button, -1, TRUE))) {
m->font = NULL;
#ifdef MULTI_CHARSET
m->fontset = NULL;
#endif
menu_delete(m);
button_set_action(button, ACTION_STRING, NS_MENU_TITLE);
button_free(button);
} else {
int j, k = menu_list ? menu_list->nummenus : 0;
menu_list = menulist_add_menu(menu_list, m);
for (j = k; j < menu_list->nummenus; j++) {
event_data_add_mywin(&menu_event_data, menu_list->menus[j]->win);
}
if (!k) {
menu_init();
}
button_set_action(button, ACTION_MENU, NS_MENU_TITLE);
return 1; /* success! */
}
}
}
return 0;
}
/* Set everything up for escreen mode */
int
@ -2795,92 +2888,10 @@ escreen_init(char **argv)
if (!TermWin.screen_mode) {
return run_command(argv);
} else if ((TermWin.screen = ns_attach_by_URL(rs_url, rs_hop, &efuns, &ns_err, (void *) &buttonbar))) {
button_t *button;
menu_t *m;
menuitem_t *i;
if (rs_delay >= 0) {
TermWin.screen->delay = rs_delay; /* more flexible ways later */
}
if ((m = menu_create(NS_MENU_TITLE))) {
char *sc[] = {
/* display functions */
"New", "\x01:screen\r",
"New ...", "\x01\x03\x01\x41",
"Backlog ...", "\x01\x1b",
"Monitor", "\x01M",
"Close", "\x01k",
"-", "",
/* region functions */
"Split", "\x01S",
"Unsplit", "\x01Q",
"Prvs region", NS_SCREEN_PRVS_REG,
"Next region", "\x01\t",
"Kill region", "\x01X",
"-", "",
/* screen functions */
"Reset", NS_SCREEN_INIT,
"Statement", "\x01:",
"-", ""
};
int n, nsc = sizeof(sc) / sizeof(char *);
if (menu_list) {
for (n = 0; n < menu_list->nummenus; n++) { /* blend in w/ l&f */
if (menu_list->menus[n]->font) {
m->font = menu_list->menus[n]->font;
m->fwidth = menu_list->menus[n]->fwidth;
m->fheight = menu_list->menus[n]->fheight;
#ifdef MULTI_CHARSET
m->fontset = menu_list->menus[n]->fontset;
#endif
break;
}
}
}
for (n = 0; n < (nsc - 1); n += 2) {
if (!strcmp(sc[n], "-")) {
/* separator */
if ((i = menuitem_create(NULL))) {
menu_add_item(m, i);
menuitem_set_action(i, MENUITEM_SEP, NULL);
}
} else if ((i = menuitem_create(sc[n]))) {
/* menu entry */
menuitem_set_action(i, n && strcmp(sc[n + 1], NS_SCREEN_INIT)
&& strcmp(sc[n + 1], NS_SCREEN_PRVS_REG) ? MENUITEM_ECHO : MENUITEM_LITERAL, sc[n + 1]);
menu_add_item(m, i);
}
}
if ((i = menuitem_create("About..."))) {
menuitem_set_action(i, MENUITEM_ALERT, "Screen compatibility layer by Azundris <scream@azundris.com>");
menu_add_item(m, i);
}
if ((button = button_create(NS_MENU_TITLE))) {
if (!(buttonbar = bbar_insert_button(buttonbar, button, -1, TRUE))) {
m->font = NULL;
#ifdef MULTI_CHARSET
m->fontset = NULL;
#endif
menu_delete(m);
button_set_action(button, ACTION_STRING, NS_MENU_TITLE);
button_free(button);
} else {
int j, k = menu_list ? menu_list->nummenus : 0;
menu_list = menulist_add_menu(menu_list, m);
for (j = k; j < menu_list->nummenus; j++) {
event_data_add_mywin(&menu_event_data, menu_list->menus[j]->win);
}
if (!k)
menu_init();
button_set_action(button, ACTION_MENU, NS_MENU_TITLE);
}
}
TermWin.screen->delay = rs_delay; /* more flexible ways later */
}
make_escreen_menu();
/* add_screen_ctl_button(&buttonbar,"New",'c'); */
return TermWin.screen->fd;
}
@ -2976,13 +2987,13 @@ cmd_write(const unsigned char *str, unsigned int count)
/* try and get more space from the end */
unsigned char *src, *dst;
dst = (cmdbuf_base + sizeof(cmdbuf_base) - 1); /* max pointer */
dst = (cmdbuf_base + sizeof(cmdbuf_base) - 1); /* max pointer */
if ((cmdbuf_ptr + n) > dst)
n = (dst - cmdbuf_ptr); /* max # chars to insert */
n = (dst - cmdbuf_ptr); /* max # chars to insert */
if ((cmdbuf_endp + n) > dst)
cmdbuf_endp = (dst - n); /* truncate end if needed */
cmdbuf_endp = (dst - n); /* truncate end if needed */
/* equiv: memmove ((cmdbuf_ptr+n), cmdbuf_ptr, n); */
src = cmdbuf_endp;
@ -3100,11 +3111,27 @@ cmd_getc(void)
# ifdef NS_HAVE_SCREAM
case NS_MODE_SCREAM:
break;
# endif
# ifdef NS_HAVE_TWIN
case NS_MODE_TWIN:
if (!TermWin.screen->twin) {
if (!Tw_CheckMagic(libscream_magic)) {
D_ESCREEN(("ns_attach_by_sess: Tw_CheckMagic failed\n"));
TermWin.screen->backend = TermWin.screen_mode = NS_MODE_NONE;
} else {
if (!(TermWin.screen->twin = Tw_Open(TermWin.screen->twin_str))) {
D_ESCREEN(("ns_attach_by_sess: Tw_Open(%s) failed\n", TermWin.screen->twin_str));
TermWin.screen->backend = TermWin.screen_mode = NS_MODE_NONE;
} else {
D_ESCREEN(("ns_attach_by_sess: Tw_Open(%s) succeeded\n", TermWin.screen->twin_str));
}
}
}
break;
# endif
default:
D_ESCREEN(("mode %d not supported...\n", TermWin.screen->backend));
TermWin.screen->backend = NS_MODE_NONE;
TermWin.screen_mode = NS_MODE_NONE;
TermWin.screen->backend = TermWin.screen_mode = NS_MODE_NONE;
}
}
#endif
@ -3116,7 +3143,7 @@ cmd_getc(void)
for (;;) {
v_doPending();
while (XPending(Xdisplay)) { /* process pending X events */
while (XPending(Xdisplay)) { /* process pending X events */
XEvent ev;
@ -3188,8 +3215,10 @@ cmd_getc(void)
if (retval < 0) {
if (cmd_fd >= 0 && FD_ISSET(cmd_fd, &readfds)) {
print_error("Error reading from tty -- %s\n", strerror(errno));
cmd_fd = -1;
if (errno != EINTR) { /* may have rcvd SIGCHLD or so */
print_error(" (%ld) Error reading from tty -- %s\n", getpid(), strerror(errno));
cmd_fd = -1;
}
}
if (pipe_fd >= 0 && FD_ISSET(pipe_fd, &readfds)) {
print_error("Error reading from pipe -- %s\n", strerror(errno));
@ -3323,7 +3352,7 @@ main_loop(void)
#endif
do {
while ((ch = cmd_getc()) == 0); /* wait for something */
while ((ch = cmd_getc()) == 0); /* wait for something */
if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') {
/* Read a text string from the input buffer */
int nlines = 0;
@ -3437,7 +3466,7 @@ v_writeBig(int f, char *d, int len)
*/
if (len > 0) {
if (v_bufend < v_bufptr + len) { /* we've run out of room */
if (v_bufend < v_bufptr + len) { /* we've run out of room */
if (v_bufstr != v_buffer) {
/* there is unused space, move everything down */
/* possibly overlapping bcopy here */
@ -3450,7 +3479,7 @@ v_writeBig(int f, char *d, int len)
if (v_bufend < v_bufptr + len) {
/* still won't fit: get more space */
/* Don't use XtRealloc because an error is not fatal. */
int size = v_bufptr - v_buffer; /* save across realloc */
int size = v_bufptr - v_buffer; /* save across realloc */
v_buffer = REALLOC(v_buffer, size + len);
if (v_buffer) {
@ -3460,13 +3489,13 @@ v_writeBig(int f, char *d, int len)
} else {
/* no memory: ignore entire write request */
print_error("cannot allocate buffer space\n");
v_buffer = v_bufstr; /* restore clobbered pointer */
v_buffer = v_bufstr; /* restore clobbered pointer */
c = 0;
}
}
}
if (v_bufend >= v_bufptr + len) { /* new stuff will fit */
memcpy(v_bufptr, d, len); /* bcopy(d, v_bufptr, len); */
if (v_bufend >= v_bufptr + len) { /* new stuff will fit */
memcpy(v_bufptr, d, len); /* bcopy(d, v_bufptr, len); */
v_bufptr += len;
}
}
@ -3492,13 +3521,13 @@ v_writeBig(int f, char *d, int len)
}
D_TTY(("Wrote %d characters\n", written));
v_bufstr += written;
if (v_bufstr >= v_bufptr) /* we wrote it all */
if (v_bufstr >= v_bufptr) /* we wrote it all */
v_bufstr = v_bufptr = v_buffer;
}
/*
* If we have lots of unused memory allocated, return it
*/
if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */
if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */
/* save pointers across realloc */
int start = v_bufstr - v_buffer;
int size = v_bufptr - v_buffer;
@ -3511,7 +3540,7 @@ v_writeBig(int f, char *d, int len)
v_bufend = v_buffer + allocsize;
} else {
/* should we print a warning if couldn't return memory? */
v_buffer = v_bufstr - start; /* restore clobbered pointer */
v_buffer = v_bufstr - start; /* restore clobbered pointer */
}
}
}

View File

@ -182,7 +182,7 @@ eterm_default_font_locale(char ***fonts, char ***mfonts, char **mencoding, int *
if ((locale = getenv("LC_ALL")) == NULL)
if ((locale = getenv("LC_CTYPE")) == NULL)
if ((locale = getenv("LANG")) == NULL)
locale = "C"; /* failsafe */
locale = "C"; /* failsafe */
/* Obtain a "normalized" name of current encoding.
* The current encoding is available via nl_langinfo().

View File

@ -144,7 +144,7 @@ bevel_pixmap(Pixmap p, int w, int h, Imlib_Border * bord, unsigned char up)
unsigned int r, g, b;
int real_depth = 0, depth_factor;
register int br, bg, bb; /* Bitshifts */
register unsigned int mr, mg, mb; /* Bitmasks */
register unsigned int mr, mg, mb; /* Bitmasks */
GC gc;
if (!bord)

View File

@ -144,7 +144,7 @@ enl_ipc_send(char *str)
}
}
len = strlen(str);
for (; XCheckTypedWindowEvent(Xdisplay, my_ipc_win, ClientMessage, &ev);); /* Discard any out-of-sync messages */
for (; XCheckTypedWindowEvent(Xdisplay, my_ipc_win, ClientMessage, &ev);); /* Discard any out-of-sync messages */
ev.xclient.type = ClientMessage;
ev.xclient.serial = 0;
ev.xclient.send_event = True;

View File

@ -237,7 +237,7 @@ font_cache_del(const void *info)
current->next = current->next->next;
XFreeFont(Xdisplay, (XFontStruct *) info);
if (cur_font == tmp) {
cur_font = current; /* If we're nuking the last entry in the cache, point cur_font to the *new* last entry. */
cur_font = current; /* If we're nuking the last entry in the cache, point cur_font to the *new* last entry. */
}
FREE(tmp->name);
FREE(tmp);
@ -632,7 +632,7 @@ change_font(int init, const char *fontname)
fw = boldFont->min_bounds.width;
fh = boldFont->ascent + boldFont->descent + rs_line_space;
if (TermWin.fprop == 0) { /* bold font must also be monospaced */
if (TermWin.fprop == 0) { /* bold font must also be monospaced */
if (fw != boldFont->max_bounds.width)
fw = -1;
} else {

View File

@ -53,9 +53,9 @@ static const char cvs_ident[] = "$Id$";
# include <string.h>
/* --- Macros, Types --------- */
# define MAX_STATES 4 /* max # states for the FSM */
# define MAX_SWITCHER 2U /* per state */
# define MAX_VAL 256 /* for temp allocation */
# define MAX_STATES 4 /* max # states for the FSM */
# define MAX_SWITCHER 2U /* per state */
# define MAX_VAL 256 /* for temp allocation */
typedef unsigned char u_char;
typedef unsigned int u_int;
@ -77,7 +77,7 @@ typedef struct s_state {
u_int num_xlat; /* number of translations */
K_XLAT *xlat; /* State translations ((dynamic - realloc'ed) */
u_int num_switcher; /* number of switcher keys */
K_SWITCH switcher[MAX_SWITCHER]; /* switcher keys to other states */
K_SWITCH switcher[MAX_SWITCHER]; /* switcher keys to other states */
u_char life; /* 0 = until switched by key */
u_char prev_state; /* filled when jumped to a new state */
} K_STATE;
@ -111,7 +111,7 @@ static char elot_xlat_plain[] =
/* c and s give copyright and section sign */
static char elot_xlat_acc[] = "65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226,"
/*248 */ "169,228,221,246,227,222,223,238,234,235,236,237,252,240,113,241," /*243 */ "167,244,232,254,242,247,253,230";
static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */
static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */
static char elot_xlat_uml[] =
"65-122:193,194,216,196,197,214,195,199,218,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,219,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,250,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,251,230";
static char elot_xlat_umacc[] =
@ -122,7 +122,7 @@ static char i437_xlat_plain[] =
"65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,160,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,172,157";
static char i437_xlat_acc[] =
"65-122:234,129,150,131,235,148,130,236,237,141,137,138,139,140,238,143,81,144,145,146,135,240,87,149,239,133,91,92,93,94,95,96,225,153,175,155,226,173,154,227,229,165,161,162,163,164,230,167,113,168,169,171,159,233,170,174,231,157";
static char i437_xlat_acc_xtra[] = "46-46:250"; /* anw teleia */
static char i437_xlat_acc_xtra[] = "46-46:250"; /* anw teleia */
static char i437_xlat_uml[] =
"65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,228,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,232,157";
static char i437_xlat_umacc[] =
@ -195,7 +195,7 @@ kstate_init_all(int greek_mode)
kstate_setcurr(i);
kstate_init();
}
if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */
if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */
greek_mode = GREEK_ELOT928;
xlat_now = &xlat_type[greek_mode];
kstate_setcurr(0);
@ -309,7 +309,7 @@ kstate_cxlat(unsigned int c)
/* check for ascii switcher */
for (i = 0; i < pStateNow->num_switcher; i++)
if (pStateNow->switcher[i].type == 'A' && /* only ascii here */
if (pStateNow->switcher[i].type == 'A' && /* only ascii here */
c == pStateNow->switcher[i].code) {
kstate_setcurr(pStateNow->switcher[i].nextstate);
pStateNow->switcher[i].on = 1;

File diff suppressed because it is too large Load Diff

View File

@ -309,7 +309,7 @@ menu_handle_button_release(event_t *ev)
menu_reset_all(menu_list);
current_menu = NULL;
} else {
current_menu->state &= ~MENU_STATE_IS_DRAGGING; /* Click, brief drag, release == single click */
current_menu->state &= ~MENU_STATE_IS_DRAGGING; /* Click, brief drag, release == single click */
}
} else {
@ -1304,7 +1304,7 @@ menu_tab(void *xd, char *sc[], int nsc, char *b, size_t l, size_t m)
for (n = n2; n < nsc; n++) {
if (!strncasecmp(b, sc[n], l)) {
if (strcmp(b, sc[n])) {
if (strlen(sc[n]) >= m) /* buffer would overflow => fail */
if (strlen(sc[n]) >= m) /* buffer would overflow => fail */
return -1;
strcpy(b, sc[n]);
return 0;
@ -1360,8 +1360,8 @@ menu_dialog(void *xd, char *prompt, int maxlen, char **retstr, int (*inp_tab) (v
}
if ((m = menu_create(prompt))) {
for (l = 0; l < menu_list->nummenus; l++) { /* copycat font entry to */
if (menu_list->menus[l]->font) { /* blend in with l&f */
for (l = 0; l < menu_list->nummenus; l++) { /* copycat font entry to */
if (menu_list->menus[l]->font) { /* blend in with l&f */
m->font = menu_list->menus[l]->font;
m->fwidth = menu_list->menus[l]->fwidth;
m->fheight = menu_list->menus[l]->fheight;

View File

@ -78,7 +78,7 @@ network_display(const char *display)
if (display[0] != ':' && strncmp(display, "unix:", 5))
return display; /* nothing to do */
ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */
ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */
ifc.ifc_buf = buffer;
if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {

View File

@ -173,11 +173,6 @@ static const struct {
OPT_STR('t', "theme", "select a theme", &rs_theme),
OPT_STR('X', "config-file", "choose an alternate config file", &rs_config_file), OPT_STR('d', "display", "X server to connect to", &display_name),
#ifdef ESCREEN
OPT_STR('U', "URL", "an URL pointing at a screen-session to pick up", &rs_url),
OPT_STR('Z', "[lclport:]fw[:fwport]", "the destination machine -U can only be seen by the firewall fw. tunnel.", &rs_hop),
OPT_INT('z', "delay", "initial delay in seconds", &rs_delay),
#endif
#if DEBUG <= 0
OPT_ILONG("debug", "level of debugging information to show (support not compiled in)", &DEBUG_LEVEL),
#elif DEBUG == 1
@ -329,7 +324,13 @@ static const struct {
OPT_LONG("term-name", "value to use for setting $TERM", &rs_term_name),
OPT_LONG("pipe-name", "filename of console pipe to emulate -C", &rs_pipe_name),
OPT_STR('a', "attribute", "parse an attribute in the specified context", NULL),
OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console), OPT_ARGS('e', "exec", "execute a command rather than a shell", &rs_exec_args)
OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console),
#ifdef ESCREEN
OPT_STR('U', "URL", "an URL pointing at a screen-session to pick up", &rs_url),
OPT_STR('Z', "[lclport:]fw[:fwport]", "the destination machine -U can only be seen by the firewall fw. tunnel.", &rs_hop),
OPT_INT('z', "delay", "initial delay in seconds", &rs_delay),
#endif
OPT_ARGS('e', "exec", "execute a command rather than a shell", &rs_exec_args)
};
/* Print usage information */
@ -891,7 +892,7 @@ get_options(int argc, char *argv[])
} else if (!strcasecmp(opt, "attribute")) {
conf_parse_line(NULL, val_ptr);
} else { /* It's not --exec */
if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */
if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */
D_OPTIONS(("Boolean option detected\n"));
if (val_ptr) {
if (BOOL_OPT_ISTRUE(val_ptr)) {
@ -914,7 +915,7 @@ get_options(int argc, char *argv[])
*(optList[j].maskvar) |= optList[j].mask;
}
}
} else if (optList[j].flag & OPT_INTEGER) { /* Integer value */
} else if (optList[j].flag & OPT_INTEGER) { /* Integer value */
D_OPTIONS(("Integer option detected\n"));
*((int *) optList[j].pval) = strtol(val_ptr, (char **) NULL, 0);
} else { /* String value */
@ -962,13 +963,13 @@ get_options(int argc, char *argv[])
if ((val_ptr == NULL) || ((*val_ptr == '-') && (optList[j].short_opt != 'F') && (optList[j].short_opt != 'g'))) {
print_error("option -%c requires a%s value\n", opt[pos], (optList[j].flag & OPT_INTEGER ? "n integer" : " string"));
CHECK_BAD();
if (val_ptr) { /* If the "arg" was actually an option, don't skip it */
if (val_ptr) { /* If the "arg" was actually an option, don't skip it */
i--;
}
continue;
}
}
if (opt[pos] == 'e') { /* It's an exec */
if (opt[pos] == 'e') { /* It's an exec */
register unsigned short k, len;
@ -1003,12 +1004,12 @@ get_options(int argc, char *argv[])
} else if (opt[pos] == 'a') {
conf_parse_line(NULL, val_ptr);
} else {
if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */
if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */
D_OPTIONS(("Boolean option detected\n"));
if (optList[j].maskvar) {
*(optList[j].maskvar) |= optList[j].mask;
}
} else if (optList[j].flag & OPT_INTEGER) { /* Integer value */
} else if (optList[j].flag & OPT_INTEGER) { /* Integer value */
D_OPTIONS(("Integer option detected\n"));
*((int *) optList[j].pval) = strtol(val_ptr, (char **) NULL, 0);
D_OPTIONS(("Got value %d\n", *((int *) optList[j].pval)));
@ -1137,7 +1138,7 @@ get_initial_options(int argc, char *argv[])
D_OPTIONS(("val_ptr == %s done == %d\n", val_ptr, done));
if ((val_ptr == NULL) || (*val_ptr == '-')) {
print_error("option -%c requires a string value\n", opt[pos]);
if (val_ptr) { /* If the "arg" was actually an option, don't skip it */
if (val_ptr) { /* If the "arg" was actually an option, don't skip it */
i--;
}
continue;
@ -1556,12 +1557,10 @@ parse_toggles(char *buff, void *state)
} else if (!BEG_STRCASECMP(buff, "buttonbar")) {
if (bool_val) {
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1);
);
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1););
rs_buttonbars = 1; /* Reset for future use. */
} else {
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0);
);
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0););
rs_buttonbars = 1; /* Reset for future use. */
}
@ -2162,7 +2161,7 @@ parse_image(char *buff, void *state)
if ((images[idx].current->iml->border->left == 0) && (images[idx].current->iml->border->right == 0)
&& (images[idx].current->iml->border->top == 0) && (images[idx].current->iml->border->bottom == 0)) {
FREE(images[idx].current->iml->border);
images[idx].current->iml->border = (Imlib_Border *) NULL; /* No sense in wasting CPU time and memory if there are no borders */
images[idx].current->iml->border = (Imlib_Border *) NULL; /* No sense in wasting CPU time and memory if there are no borders */
}
} else if (!BEG_STRCASECMP(buff, "bevel ")) {
if (!CHECK_VALID_INDEX(idx)) {
@ -2477,9 +2476,9 @@ parse_bbar(char *buff, void *state)
print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter\n", file_peek_path(), file_peek_line());
} else if (!BEG_STRCASECMP(where, "top")) {
bbar_set_docked(bbar, BBAR_DOCKED_TOP);
} else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */
} else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */
bbar_set_docked(bbar, BBAR_DOCKED_BOTTOM);
} else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */
} else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */
bbar_set_docked(bbar, BBAR_UNDOCKED);
} else {
print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock\n", file_peek_path(), file_peek_line(), where);
@ -2888,7 +2887,7 @@ post_parse(void)
if (rs_pixmaps[i]) {
reset_simage(images[i].norm, RESET_ALL_SIMG);
load_image(rs_pixmaps[i], images[i].norm);
FREE(rs_pixmaps[i]); /* These are created by STRDUP() */
FREE(rs_pixmaps[i]); /* These are created by STRDUP() */
}
#else
/* Right now, solid mode is the only thing we can do without pixmap support. */
@ -2997,11 +2996,9 @@ post_parse(void)
specified. If specified, it will either become 3 (on) or 0 (off). */
if (rs_buttonbars != 1) {
if (rs_buttonbars) {
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1);
);
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 1););
} else {
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0);
);
FOREACH_BUTTONBAR(bbar_set_visible(bbar, 0););
}
rs_buttonbars = 1; /* Reset for future use. */
}
@ -3168,11 +3165,11 @@ post_parse(void)
unsigned long w, h;
int count;
count = num_words(rs_anim_pixmap_list) - 1; /* -1 for the delay */
count = num_words(rs_anim_pixmap_list) - 1; /* -1 for the delay */
rs_anim_pixmaps = (char **) MALLOC(sizeof(char *) * (count + 1));
for (i = 0; i < count; i++) {
temp = get_word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */
temp = get_word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */
if (temp == NULL)
break;
if (num_words(temp) != 3) {

View File

@ -1005,7 +1005,7 @@ render_simage(simage_t *simg, Window win, unsigned short width, unsigned short h
return;
gcvalue.foreground = gcvalue.background = PixColors[bgColor];
gc = LIBAST_X_CREATE_GC(GCForeground | GCBackground, &gcvalue);
pixmap = simg->pmap->pixmap; /* Save this for later */
pixmap = simg->pmap->pixmap; /* Save this for later */
if ((which == image_bg) && (buffer_pixmap != None)) {
LIBAST_X_FREE_PIXMAP(buffer_pixmap);
buffer_pixmap = None;
@ -1992,7 +1992,7 @@ get_desktop_pixmap(void)
D_PIXMAP(("Current desktop pixmap is 0x%08x\n", (unsigned int) desktop_pixmap));
if (desktop_pixmap == None) {
orig_desktop_pixmap = None; /* Forced re-read. */
orig_desktop_pixmap = None; /* Forced re-read. */
}
if (desktop_window == None) {
D_PIXMAP(("No desktop window. Aborting.\n"));

View File

@ -7,6 +7,16 @@
#include "screamcfg.h"
#ifdef NS_HAVE_TWIN
# include <Tw/Tw.h>
#endif
#define NS_TWIN_PROTO "twin://"
#define NS_SCREEN_PROTO "screen://"
#define NS_SCREAM_PROTO "scream://"
#define NS_DK 0
#define NS_SSH 1
#define NS_LCL 2
@ -16,6 +26,9 @@
#define NS_MODE_NONE 0
#define NS_MODE_SCREEN 1
#define NS_MODE_SCREAM 2
#define NS_MODE_TWIN 3
#define NS_MAGIC_LINE(a) (((a)==NS_MODE_SCREEN)||((a)==NS_MODE_NEGOTIATE))
#define NS_SUCC (-1)
#define NS_FAIL 0
@ -102,6 +115,10 @@ typedef struct __ns_sess { /* a whole screen-session with many clients */
struct __ns_disp *curr; /* current display (NULL for none) */
struct __ns_sess *prvs; /* previous session in session list */
struct __ns_sess *next; /* next session in session list */
#ifdef NS_HAVE_TWIN
tdisplay twin;
char *twin_str;
#endif
} _ns_sess;
@ -164,6 +181,9 @@ _ns_efuns *ns_new_efuns(void);
_ns_efuns *ns_dst_efuns(_ns_efuns **);
_ns_efuns *ns_get_efuns(_ns_sess *,_ns_disp *);
/* get session anchor (for iterations) */
_ns_sess *ns_1st_sess(void);
/* transparent attach/detach */
_ns_sess *ns_attach_by_sess(_ns_sess **,int *);
_ns_sess *ns_attach_by_URL(char *,char *,_ns_efuns **,int *,void *);
@ -172,8 +192,10 @@ int ns_detach(_ns_sess **);
/* convenience */
int ns_run(_ns_efuns *, char *);
int ns_get_ssh_port(void);
int disp_get_real_by_screen(_ns_sess *,int);
int disp_get_screen_by_real(_ns_sess *,int);
int ns_magic_disp(_ns_sess **,_ns_disp **);
/* send command to screen */
int ns_screen_command(_ns_sess *, char *);
@ -204,17 +226,37 @@ int ns_parse_screen(_ns_sess *,int,int,char *);
/* backend abstraction */
/* things the term might ask screen/scream to do ***************************/
int ns_scroll2x(_ns_sess *,int);
int ns_scroll2y(_ns_sess *,int);
int ns_tog_disp(_ns_sess *);
int ns_go2_disp(_ns_sess *,int);
int ns_rel_disp(_ns_sess *,int);
int ns_add_disp(_ns_sess *,int,char *);
int ns_mov_disp(_ns_sess * s,int,int);
int ns_mov_disp(_ns_sess *,int,int);
int ns_rsz_disp(_ns_sess *,int,int,int);
int ns_rem_disp(_ns_sess *,int);
int ns_rem_disp(_ns_sess *,int,int);
int ns_ren_disp(_ns_sess *,int,char *);
int ns_log_disp(_ns_sess *,int,char *);
int ns_mon_disp(_ns_sess *,int);
int ns_sbb_disp(_ns_sess *,int);
int ns_tog_region(_ns_sess *,_ns_disp *);
int ns_go2_region(_ns_sess *,_ns_disp *,int);
int ns_rel_region(_ns_sess *,_ns_disp *,int);
int ns_add_region(_ns_sess *,_ns_disp *,int,char *);
int ns_mov_region(_ns_sess *,_ns_disp *,int,int);
int ns_rsz_region(_ns_sess *,_ns_disp *,int,int,int);
int ns_rem_region(_ns_sess *,_ns_disp *,int,int);
int ns_ren_region(_ns_sess *,_ns_disp *,int,char *);
int ns_log_region(_ns_sess *,_ns_disp *,int,char *);
int ns_mon_region(_ns_sess *,_ns_disp *,int);
int ns_sbb_region(_ns_sess *,_ns_disp *,int);
int ns_one_region(_ns_sess *,_ns_disp *,int);
int ns_upd_stat(_ns_sess *);
int ns_scroll2x(_ns_sess *,int);
int ns_scroll2y(_ns_sess *,int);
int ns_inp_dial(_ns_sess *,char *,int,char **,int (*)(void *,char *,size_t,size_t));
int ns_statement(_ns_sess *,char *);
int ns_reset(_ns_sess *,int);
char *ns_get_url(_ns_sess *,int);

View File

@ -18,6 +18,11 @@
/* compile in support for the GNU "screen" program as a backend */
#define NS_HAVE_SCREEN 1
/* compile in support for the "twin" program as a backend */
#undef NS_HAVE_TWIN
#define NS_MAXCMD 512
#define NS_SSH_CALL "ssh"
@ -31,6 +36,8 @@
#define NS_SCREEM_CALL "%s 2>/dev/null || %s"
#define NS_WRAP_CALL "export TERM=vt100; screen -wipe; %s"
#define NS_SCREEN_RC ".screenrc"
#define NS_TWIN_CALL "export TERM=xterm; twin %s"
#define NS_TWIN_OPTS "-hw=tty"
/* this should never change. the escape-char for an out-of-the-box "screen".
don't change this just because you set something else in your .screenrc */
@ -47,7 +54,7 @@
#define NS_SCREEN_UPDATE "\x01w"
#define NS_SCREEN_VERSION "\x01v"
#define NS_SCREEN_SESSION "\x01:sessionname\r"
#define NS_SCREEN_INIT "\x01:msgminwait 0\r\x01:msgwait 1\r\x01:hardstatus lastline\r\x01:defhstatus \"\\005w\"\r\x01:hstatus \"\\005w\"\r\x01:nethack off\r\x0c" NS_SCREEN_UPDATE NS_SCREEN_VERSION NS_SCREEN_SESSION
#define NS_SCREEN_INIT "\x01:hardstatus lastline \"\\005w\"\r\x01:hstatus \"\\005w\"\r\x01:defhstatus \"\\005w\"\r\x01:msgminwait 0\r\x01:msgwait 1\r\x01:nethack off\r\x0c" NS_SCREEN_UPDATE NS_SCREEN_VERSION NS_SCREEN_SESSION
#define NS_SCREEN_PRVS_REG "\x01:focus up\r"
#define NS_DFLT_SSH_PORT 22

View File

@ -727,13 +727,13 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
c = str[i++];
#ifdef MULTI_CHARSET
if ((encoding_method != LATIN1) && (chstat == WBYTE)) {
rstyle |= RS_multiMask; /* multibyte 2nd byte */
rstyle |= RS_multiMask; /* multibyte 2nd byte */
chstat = SBYTE;
if (encoding_method == EUCJ) {
c |= 0x80; /* maybe overkill, but makes it selectable */
}
} else if (chstat == SBYTE) {
if ((encoding_method != LATIN1) && (multi_byte || (c & 0x80))) { /* multibyte 1st byte */
if ((encoding_method != LATIN1) && (multi_byte || (c & 0x80))) { /* multibyte 1st byte */
rstyle &= ~RS_multiMask;
rstyle |= RS_multi1;
chstat = WBYTE;
@ -759,8 +759,8 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
screen.row++;
row = screen.row + TermWin.saveLines;
}
stp = screen.text[row]; /* _must_ refresh */
srp = screen.rend[row]; /* _must_ refresh */
stp = screen.text[row]; /* _must_ refresh */
srp = screen.rend[row]; /* _must_ refresh */
continue;
case '\r':
LOWER_BOUND(stp[last_col], screen.col);
@ -788,8 +788,8 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
screen.row++;
row = screen.row + TermWin.saveLines;
}
stp = screen.text[row]; /* _must_ refresh */
srp = screen.rend[row]; /* _must_ refresh */
stp = screen.text[row]; /* _must_ refresh */
srp = screen.rend[row]; /* _must_ refresh */
screen.col = 0;
screen.flags &= ~Screen_WrapNext;
}
@ -822,8 +822,8 @@ scr_add_lines(const unsigned char *str, int nlines, int len)
selection_reset();
#ifdef ESCREEN
if (TermWin.screen_mode) {
if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */
if (NS_MAGIC_LINE(TermWin.screen_mode)) {
if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */
TermWin.screen_pending |= 1;
}
}
@ -911,17 +911,17 @@ scr_gotorc(int row, int col, int relative)
screen.row += row;
}
} else {
if (screen.flags & Screen_Relative) { /* relative origin mode */
if (screen.flags & Screen_Relative) { /* relative origin mode */
screen.row = row + screen.tscroll;
UPPER_BOUND(screen.row, screen.bscroll);
} else
screen.row = row;
}
#ifdef ESCREEN
if (TermWin.screen_mode) {
if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */
if (NS_MAGIC_LINE(TermWin.screen_mode)) {
if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */
TermWin.screen_pending |= 1;
} else if (TermWin.screen_pending) { /* left last -> upd-finis */
} else if (TermWin.screen_pending) { /* left last -> upd-finis */
TermWin.screen_pending |= 2;
}
}
@ -1051,7 +1051,7 @@ scr_erase_screen(int mode)
default:
return;
}
if (row >= 0 && row <= TermWin.nrow) { /* check OOB */
if (row >= 0 && row <= TermWin.nrow) { /* check OOB */
UPPER_BOUND(num, (TermWin.nrow - row));
if (rstyle & RS_RVid || rstyle & RS_Uline)
ren = -1;
@ -1639,8 +1639,9 @@ scr_refresh(int type)
PROF_INIT(scr_refresh);
#ifdef ESCREEN
if (TermWin.screen_mode)
if (NS_MAGIC_LINE(TermWin.screen_mode)) {
nrows--;
}
#endif
switch (type) {
@ -1719,9 +1720,9 @@ scr_refresh(int type)
/* compare new text with old - if exactly the same then continue */
rt1 = srp[col];
rt2 = drp[col];
if ((stp[col] == dtp[col]) /* must match characters to skip */
&&((rt1 == rt2) /* either rendition the same or */
||((stp[col] == ' ') /* space w/ no bg change */
if ((stp[col] == dtp[col]) /* must match characters to skip */
&&((rt1 == rt2) /* either rendition the same or */
||((stp[col] == ' ') /* space w/ no bg change */
&&(GET_BGATTR(rt1) == GET_BGATTR(rt2))))) {
#ifdef MULTI_CHARSET
/* if first byte is multibyte then compare second bytes */
@ -1789,8 +1790,8 @@ scr_refresh(int type)
/* XXX : maybe do the same thing for RS_multi2 */
/* corrupt character - you're outta there */
rend &= ~RS_multiMask;
drp[col] = rend; /* TODO check: may also want */
dtp[col] = ' '; /* to poke into stp/srp */
drp[col] = rend; /* TODO check: may also want */
dtp[col] = ' '; /* to poke into stp/srp */
buffer[0] = ' ';
}
if (wbyte) {
@ -1832,10 +1833,10 @@ scr_refresh(int type)
rvid = !rvid;
if (rend & RS_Cursor) {
if (focus) {
is_cursor = 2; /* normal cursor */
is_cursor = 2; /* normal cursor */
rvid = !rvid;
} else {
is_cursor = 1; /* outline cursor */
is_cursor = 1; /* outline cursor */
rend &= ~RS_Cursor;
}
srp[col] &= ~RS_Cursor;
@ -2844,7 +2845,7 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
}
if (!(Options & Opt_xterm_select)) {
if (beg_col == col && beg_col > 0) {
if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */
if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */
break;
#ifdef MULTI_CHARSET
srp = &(screen.rend[beg_row + row_offset][beg_col - 1]);
@ -2907,7 +2908,7 @@ selection_delimit_word(int col, int row, row_col_t *beg, row_col_t *end)
}
if (!(Options & Opt_xterm_select)) {
if (end_col == col && end_col < last_col) {
if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */
if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */
break;
#ifdef MULTI_CHARSET
srp = &(screen.rend[end_row + row_offset][end_col + 1]);
@ -3283,7 +3284,7 @@ mouse_drag_report(XButtonEvent * ev)
switch (ev->button) {
case AnyButton: /* Button release */
button_number = pb + Button1; /* yeah, yeah */
button_number = pb + Button1; /* yeah, yeah */
break;
case Button1: /* Button press */
case Button2:

View File

@ -56,6 +56,18 @@ static eterm_script_handler_t script_handlers[] = {
{"search", script_handler_search},
{"spawn", script_handler_spawn},
{"string", script_handler_string},
{"dialog", script_handler_dialog},
#ifdef ESCREEN
{"es_display", script_handler_display},
{"es_disp", script_handler_display},
{"es_region", script_handler_region},
{"es_reg", script_handler_region},
{"es_win", script_handler_region},
{"es_window", script_handler_region},
{"es_statement", script_handler_statement},
{"es_reset", script_handler_reset},
{"es_rst", script_handler_reset},
#endif
{"nop", script_handler_nop}
};
@ -421,6 +433,182 @@ script_handler_nop(char **params)
USE_VAR(params);
}
void
script_handler_dialog(char **params)
{
char *tmp;
if (params && *params) {
tmp = join(" ", params);
menu_dialog(NULL, tmp, 1, NULL, NULL);
system_no_wait(tmp);
FREE(tmp);
} else {
menu_dialog(NULL, "Press any key to continue...", 1, NULL, NULL);
}
}
#ifdef ESCREEN
void
script_handler_display(char **params)
{
_ns_sess *sess = TermWin.screen;
char *p, *a;
int inx = 1;
int no = -1; /* which display? */
if (!params || !*params || !sess) {
return;
}
p = downcase_str(*params);
a = params[inx++];
if (a && isdigit(*a)) {
no = atoi(a);
a = params[inx++];
D_SCRIPT(("disp #%d\n", no));
}
if (!strcmp(p, "goto") || !strcmp(p, "go") || !strcmp(p, "focus") || !strcmp(p, "raise")) {
ns_go2_disp(sess, no);
} else if (!strcmp(p, "prvs") || !strcmp(p, "prev") || !strcmp(p, "previous")) {
ns_rel_disp(sess, -1);
} else if (!strcmp(p, "next")) {
ns_rel_disp(sess, 1);
} else if (!strcmp(p, "toggle")) {
ns_tog_disp(sess);
} else if (!strcmp(p, "new")) {
if (!a || !*a || !strcasecmp(a, "ask")) {
D_SCRIPT(("disp new ask\n"));
ns_add_disp(sess, no, NULL);
} else {
D_SCRIPT(("disp new \"%s\"\n", a));
ns_ren_disp(sess, no, a);
}
} else if (!strcmp(p, "title") || !strcmp(p, "name") || !strcmp(p, "rename")) {
if (!a || !*a || !strcasecmp(a, "ask")) {
D_SCRIPT(("disp name ask\n"));
ns_ren_disp(sess, no, NULL);
} else {
D_SCRIPT(("disp name \"%s\"\n", a));
ns_ren_disp(sess, no, a);
}
} else if (!strcmp(p, "kill") || !strcmp(p, "close")) {
if (!a || !*a || !strcasecmp(a, "ask")) {
D_SCRIPT(("disp kill ask\n"));
ns_rem_disp(sess, no, TRUE);
} else {
D_SCRIPT(("disp kill \"%s\"\n", a));
ns_rem_disp(sess, no, FALSE);
}
} else if (!strcmp(p, "watch") || !strcmp(p, "monitor")) {
ns_mon_disp(sess, no);
} else if (!strcmp(p, "back") || !strcmp(p, "backlog") || !strcmp(p, "scrollback")) {
ns_sbb_disp(sess, no);
} else {
print_error("Error in script: \"%s\" has no sub-function \"%s\".\n", "display", p);
}
}
void
script_handler_region(char **params)
{
_ns_sess *sess = TermWin.screen;
_ns_disp *disp;
char *p, *a;
int inx = 1;
int no = -1;
if (!params || !*params || !sess) {
return;
}
if (!TermWin.screen->curr) {
TermWin.screen->curr = TermWin.screen->dsps;
}
if (!(disp = TermWin.screen->curr)) {
return;
}
p = downcase_str(*params);
a = params[inx++];
if (a && isdigit(*a)) {
no = atoi(a);
a = params[inx++];
D_SCRIPT(("region #%d\n", no));
}
if (!strcmp(p, "goto") || !strcmp(p, "go") || !strcmp(p, "focus") || !strcmp(p, "raise")) {
ns_go2_region(sess, disp, no);
} else if (!strcmp(p, "prvs") || !strcmp(p, "prev") || !strcmp(p, "previous")) {
ns_rel_region(sess, disp, -1);
} else if (!strcmp(p, "next")) {
ns_rel_region(sess, disp, 1);
} else if (!strcmp(p, "toggle")) {
ns_tog_region(sess, disp);
} else if (!strcmp(p, "new") || !strcmp(p, "split")) {
if (!a || !*a || !strcasecmp(a, "ask")) {
D_SCRIPT(("region new ask\n"));
ns_add_region(sess, disp, no, NULL);
} else {
D_SCRIPT(("region new \"%s\"\n", a));
ns_add_region(sess, disp, no, a);
}
} else if (!strcmp(p, "title") || !strcmp(p, "name") || !strcmp(p, "rename")) {
if (!a || !*a || !strcasecmp(a, "ask")) {
D_SCRIPT(("region name ask\n"));
ns_ren_region(sess, disp, no, NULL);
} else {
D_SCRIPT(("region name \"%s\"\n", a));
ns_ren_region(sess, disp, no, a);
}
} else if (!strcmp(p, "kill") || !strcmp(p, "close")) {
if (!a || !*a || !strcasecmp(a, "ask")) {
D_SCRIPT(("region kill ask\n"));
ns_rem_region(sess, disp, no, TRUE);
} else {
D_SCRIPT(("disp kill \"%s\"\n", a));
ns_rem_region(sess, disp, no, FALSE);
}
} else if (!strcmp(p, "only") || !strcmp(p, "unsplit") || !strcmp(p, "full") || !strcmp(p, "fullscreen")) {
ns_one_region(sess, disp, no);
} else if (!strcmp(p, "watch") || !strcmp(p, "monitor")) {
ns_mon_region(sess, disp, no);
} else if (!strcmp(p, "back") || !strcmp(p, "backlog") || !strcmp(p, "scrollback")) {
ns_sbb_region(sess, disp, no);
} else {
print_error("Error in script: \"%s\" has no sub-function \"%s\".\n", "region", p);
}
}
void
script_handler_statement(char **params)
{
char *tmp;
if (params && *params) {
tmp = join(" ", params);
ns_statement(TermWin.screen, tmp);
FREE(tmp);
} else {
ns_statement(TermWin.screen, NULL);
}
}
void
script_handler_reset(char **params)
{
USE_VAR(params);
ns_reset(TermWin.screen, 0);
}
#endif
/********* ENGINE *********/
eterm_script_handler_t *script_find_handler(const char *name)
{

View File

@ -55,6 +55,14 @@ extern void script_handler_search(char **);
extern void script_handler_spawn(char **);
extern void script_handler_string(char **);
extern void script_handler_nop(char **);
extern void script_handler_dialog(char **);
#ifdef ESCREEN
extern void script_handler_display(char **);
extern void script_handler_region(char **);
extern void script_handler_statement(char **);
extern void script_handler_reset(char **);
#endif
/* Engine */
extern eterm_script_handler_t *script_find_handler(const char *);

View File

@ -63,7 +63,7 @@ static short last_top = 0, last_bot = 0;
#ifdef XTERM_SCROLLBAR
static GC gc_stipple, gc_border;
static unsigned char xterm_sb_bits[] = { 0xaa, 0x0a, 0x55, 0x05 }; /* 12x2 bitmap */
static unsigned char xterm_sb_bits[] = { 0xaa, 0x0a, 0x55, 0x05 }; /* 12x2 bitmap */
#endif
#if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR)
static GC gc_top, gc_bottom;
@ -243,7 +243,7 @@ sb_handle_button_press(event_t *ev)
}
switch (ev->xbutton.button) {
case Button2:
button_state.mouse_offset = scrollbar_anchor_height() / 2; /* Align to center */
button_state.mouse_offset = scrollbar_anchor_height() / 2; /* Align to center */
if (!scrollbar_win_is_anchor(ev->xany.window)) {
scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height());
} else if (scrollbar.type == SCROLLBAR_XTERM) {

View File

@ -76,7 +76,7 @@ eterm_bootstrap(int argc, char *argv[])
int i;
char *val;
static char windowid_string[20], *display_string, *term_string; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */
static char windowid_string[20], *display_string, *term_string; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */
orig_argv0 = argv[0];
@ -172,7 +172,7 @@ eterm_bootstrap(int argc, char *argv[])
len = strlen(initial_dir);
if (rs_path) {
len += strlen(rs_path) + 1; /* +1 for the colon */
len += strlen(rs_path) + 1; /* +1 for the colon */
}
if (theme_dir) {
len += strlen(theme_dir) + 1;
@ -202,8 +202,19 @@ eterm_bootstrap(int argc, char *argv[])
# define ESCREEN_PREFIX "Escreen"
# define ETERM_PREFIX "Eterm"
p = p ? (p + 1) : orig_argv0;
if (rs_url || !strncasecmp(ESCREEN_PREFIX, p, strlen(ESCREEN_PREFIX)))
if (rs_url) {
if (!strncmp(rs_url, NS_TWIN_PROTO, strlen(NS_TWIN_PROTO))) {
TermWin.screen_mode = NS_MODE_TWIN;
} else if (!strncmp(rs_url, NS_SCREEN_PROTO, strlen(NS_SCREEN_PROTO))) {
TermWin.screen_mode = NS_MODE_SCREEN;
} else if (!strncmp(rs_url, NS_SCREAM_PROTO, strlen(NS_SCREAM_PROTO))) {
TermWin.screen_mode = NS_MODE_SCREAM;
} else {
TermWin.screen_mode = NS_MODE_NEGOTIATE;
}
} else if (!strncasecmp(ESCREEN_PREFIX, p, strlen(ESCREEN_PREFIX))) {
TermWin.screen_mode = NS_MODE_SCREEN;
}
}
#endif
@ -230,8 +241,9 @@ eterm_bootstrap(int argc, char *argv[])
Create_Windows(argc, argv);
#ifdef ESCREEN
if (TermWin.screen_mode)
if (NS_MAGIC_LINE(TermWin.screen_mode)) {
TermWin.nrow++;
}
#endif
scr_reset(); /* initialize screen */

View File

@ -56,7 +56,7 @@ wait_for_chld(int system_pid)
/* If the child that exited is the command we spawned, or if the
child exited before fork() returned in the parent, it must be
our immediate child that exited. We exit gracefully. */
if ((pid == -1) && (errno == ECHILD)) { /* No children exist. Punt. */
if ((pid == -1) && (errno == ECHILD)) { /* No children exist. Punt. */
errno = save_errno;
break;
}

View File

@ -58,7 +58,7 @@ unsigned char meta_char = 033; /* Alt-key prefix */
unsigned long PrivateModes = PrivMode_Default;
unsigned long SavedModes = PrivMode_Default;
char *def_colorName[] = {
"rgb:aa/aa/aa", "rgb:0/0/0", /* fg/bg */
"rgb:aa/aa/aa", "rgb:0/0/0", /* fg/bg */
"rgb:0/0/0", /* 0: black (#000000) */
#ifndef NO_BRIGHTCOLOR
/* low-intensity colors */
@ -339,31 +339,31 @@ lookup_key(XEvent * ev)
shft = 0;
} else if (!ctrl && !meta && (PrivateModes & PrivMode_ShiftKeys)) {
switch (keysym) {
case XK_Prior: /* Shift-PgUp scrolls up a page */
case XK_Prior: /* Shift-PgUp scrolls up a page */
if (TermWin.saveLines) {
scr_page(UP, (TermWin.nrow - CONTEXT_LINES));
LK_RET();
}
break;
case XK_Next: /* Shift-PgDn scrolls down a page */
case XK_Next: /* Shift-PgDn scrolls down a page */
if (TermWin.saveLines) {
scr_page(DN, (TermWin.nrow - CONTEXT_LINES));
LK_RET();
}
break;
case XK_Insert: /* Shift-Ins pastes the current selection. */
case XK_Insert: /* Shift-Ins pastes the current selection. */
selection_paste(XA_PRIMARY);
LK_RET();
break;
case XK_KP_Add: /* Shift-Plus on the keypad increases the font size */
case XK_KP_Add: /* Shift-Plus on the keypad increases the font size */
change_font(0, BIGGER_FONT);
LK_RET();
break;
case XK_KP_Subtract: /* Shift-Minus on the keypad decreases the font size */
case XK_KP_Subtract: /* Shift-Minus on the keypad decreases the font size */
change_font(0, SMALLER_FONT);
LK_RET();
break;
@ -496,13 +496,13 @@ lookup_key(XEvent * ev)
break;
#ifdef XK_KP_Left
case XK_KP_Left: /* \033Ot or standard cursor key */
case XK_KP_Up: /* \033Ox or standard cursor key */
case XK_KP_Right: /* \033Ov or standard cursor key */
case XK_KP_Down: /* \033Or or standard cursor key */
case XK_KP_Left: /* \033Ot or standard cursor key */
case XK_KP_Up: /* \033Ox or standard cursor key */
case XK_KP_Right: /* \033Ov or standard cursor key */
case XK_KP_Down: /* \033Or or standard cursor key */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
strcpy(kbuf, "\033OZ"); /* The Z is replaced by t, x, v, or r */
strcpy(kbuf, "\033OZ"); /* The Z is replaced by t, x, v, or r */
kbuf[2] = ("txvr"[keysym - XK_KP_Left]);
break;
} else {
@ -510,16 +510,16 @@ lookup_key(XEvent * ev)
}
/* Continue on with the normal cursor keys... */
#endif
case XK_Left: /* "\033[D" */
case XK_Left: /* "\033[D" */
case XK_Up: /* "\033[A" */
case XK_Right: /* "\033[C" */
case XK_Down: /* "\033[B" */
case XK_Right: /* "\033[C" */
case XK_Down: /* "\033[B" */
len = 3;
strcpy(kbuf, "\033[@");
kbuf[2] = ("DACB"[keysym - XK_Left]);
if (PrivateModes & PrivMode_aplCUR) {
kbuf[1] = 'O';
} else if (shft) { /* do Shift first */
} else if (shft) { /* do Shift first */
kbuf[2] = ("dacb"[keysym - XK_Left]);
} else if (ctrl) {
kbuf[1] = 'O';
@ -659,31 +659,31 @@ lookup_key(XEvent * ev)
break;
#endif /* XK_KP_Begin */
case XK_KP_F1: /* "\033OP" */
case XK_KP_F2: /* "\033OQ" */
case XK_KP_F3: /* "\033OR" */
case XK_KP_F4: /* "\033OS" */
case XK_KP_F1: /* "\033OP" */
case XK_KP_F2: /* "\033OQ" */
case XK_KP_F3: /* "\033OR" */
case XK_KP_F4: /* "\033OS" */
len = 3;
strcpy(kbuf, "\033OP");
kbuf[2] += (keysym - XK_KP_F1);
break;
case XK_KP_Multiply: /* "\033Oj" : "*" */
case XK_KP_Add: /* "\033Ok" : "+" */
case XK_KP_Separator: /* "\033Ol" : "," */
case XK_KP_Subtract: /* "\033Om" : "-" */
case XK_KP_Decimal: /* "\033On" : "." */
case XK_KP_Divide: /* "\033Oo" : "/" */
case XK_KP_0: /* "\033Op" : "0" */
case XK_KP_1: /* "\033Oq" : "1" */
case XK_KP_2: /* "\033Or" : "2" */
case XK_KP_3: /* "\033Os" : "3" */
case XK_KP_4: /* "\033Ot" : "4" */
case XK_KP_5: /* "\033Ou" : "5" */
case XK_KP_6: /* "\033Ov" : "6" */
case XK_KP_7: /* "\033Ow" : "7" */
case XK_KP_8: /* "\033Ox" : "8" */
case XK_KP_9: /* "\033Oy" : "9" */
case XK_KP_Multiply: /* "\033Oj" : "*" */
case XK_KP_Add: /* "\033Ok" : "+" */
case XK_KP_Separator: /* "\033Ol" : "," */
case XK_KP_Subtract: /* "\033Om" : "-" */
case XK_KP_Decimal: /* "\033On" : "." */
case XK_KP_Divide: /* "\033Oo" : "/" */
case XK_KP_0: /* "\033Op" : "0" */
case XK_KP_1: /* "\033Oq" : "1" */
case XK_KP_2: /* "\033Or" : "2" */
case XK_KP_3: /* "\033Os" : "3" */
case XK_KP_4: /* "\033Ot" : "4" */
case XK_KP_5: /* "\033Ou" : "5" */
case XK_KP_6: /* "\033Ov" : "6" */
case XK_KP_7: /* "\033Ow" : "7" */
case XK_KP_8: /* "\033Ox" : "8" */
case XK_KP_9: /* "\033Oy" : "9" */
/* allow shift to override */
if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) {
len = 3;
@ -923,8 +923,8 @@ process_escape_seq(void)
scr_add_lines((unsigned char *) "\n\r", 1, 2);
break;
case 'G':
if ((ch = cmd_getc()) == 'Q') { /* query graphics */
tt_printf((unsigned char *) "\033G0\n"); /* no graphics */
if ((ch = cmd_getc()) == 'Q') { /* query graphics */
tt_printf((unsigned char *) "\033G0\n"); /* no graphics */
} else {
do {
ch = cmd_getc();
@ -992,7 +992,7 @@ process_csi_seq(void)
cmd_ungetc(); /* New escape sequence starting in the middle of one. Punt. */
return;
} else if (ch < ' ') {
scr_add_lines(&ch, 0, 1); /* Insert verbatim non-printable character (NPC) */
scr_add_lines(&ch, 0, 1); /* Insert verbatim non-printable character (NPC) */
return;
}
if (ch == '-') /* HACK: Ignore this sequence, but finish reading */
@ -1113,10 +1113,10 @@ process_csi_seq(void)
case 'i':
switch (arg[0]) {
case 0:
scr_printscreen(0); /* Print screen "\e[0i" */
scr_printscreen(0); /* Print screen "\e[0i" */
break;
case 5:
process_print_pipe(); /* Start printing to print pipe "\e[5i" */
process_print_pipe(); /* Start printing to print pipe "\e[5i" */
break;
}
break;
@ -1949,7 +1949,7 @@ xterm_seq(int op, const char *str)
free_desktop_pixmap();
} else if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) {
LIBAST_X_FREE_PIXMAP(viewport_pixmap);
viewport_pixmap = None; /* Force the re-read */
viewport_pixmap = None; /* Force the re-read */
}
# endif
changed = 1;
@ -1965,7 +1965,7 @@ xterm_seq(int op, const char *str)
free_desktop_pixmap();
} else if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) {
LIBAST_X_FREE_PIXMAP(viewport_pixmap);
viewport_pixmap = None; /* Force the re-read */
viewport_pixmap = None; /* Force the re-read */
}
# endif
if (!strcasecmp(color, "image")) {

View File

@ -110,12 +110,12 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
if (!strncmp(pty, "/dev/", 5))
pty += 5; /* skip /dev/ prefix */
if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3))
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
else {
int n;
if (sscanf(pty, "pts/%d", &n) == 1)
sprintf(ut_id, "vt%02x", n); /* sysv naming */
sprintf(ut_id, "vt%02x", n); /* sysv naming */
else {
print_error("can't parse tty name \"%s\"\n", pty);
ut_id[0] = '\0'; /* entry not made */
@ -341,7 +341,7 @@ add_utmp_entry(const char *pty, const char *hostname, int fd)
if (!strncmp(pty, "/dev/", 5))
pty += 5; /* skip /dev/ prefix */
if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3))
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */
else {
print_error("can't parse tty name \"%s\"\n", pty);
ut_id[0] = '\0'; /* entry not made */

View File

@ -292,7 +292,7 @@ process_colors(void)
break;
#endif
default:
pixel = PixColors[fgColor]; /* None */
pixel = PixColors[fgColor]; /* None */
break;
}
}
@ -614,7 +614,7 @@ handle_resize(unsigned int width, unsigned int height)
if (first_time || (new_ncol != TermWin.ncol) || (new_nrow != TermWin.nrow)) {
TermWin.ncol = new_ncol;
#ifdef ESCREEN
TermWin.nrow = new_nrow + (TermWin.screen_mode ? 1 : 0);
TermWin.nrow = new_nrow + (NS_MAGIC_LINE(TermWin.screen_mode) ? 1 : 0);
#else
TermWin.nrow = new_nrow;
#endif
@ -675,7 +675,7 @@ set_window_color(int idx, const char *color)
/* handle color aliases */
if (isdigit(*color)) {
i = atoi(color);
if (i >= 8 && i <= 15) { /* bright colors */
if (i >= 8 && i <= 15) { /* bright colors */
i -= 8;
# ifndef NO_BRIGHTCOLOR
PixColors[idx] = PixColors[minBright + i];

View File

@ -27,10 +27,10 @@ static const char cvs_ident[] = "$Id$";
#include <stdio.h>
const char *lookup[] = {
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */
"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */
"BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */
"CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */
};
int