screen-4.2.1/0000755000175000017500000000000012327301755011702 5ustar amadeamadescreen-4.2.1/mark.h0000644000175000017500000000455512326710533013013 0ustar amadeamade/* Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** * $Id$ GNU */ struct markdata { struct win *md_window;/* pointer to window we are working on */ struct acluser *md_user; /* The user who brought us up */ int cx, cy; /* cursor Position in WIN coords*/ int x1, y1; /* first mark in WIN coords */ int second; /* first mark dropped flag */ int left_mar, right_mar, nonl; int rep_cnt; /* number of repeats */ int append_mode; /* shall we overwrite or append to copybuffer */ int write_buffer; /* shall we do a KEY_WRITE_EXCHANGE right away? */ int hist_offset; /* how many lines are on top of the screen */ char isstr[100]; /* string we are searching for */ int isstrl; char isistr[200]; /* string of chars user has typed */ int isistrl; int isdir; /* current search direction */ int isstartpos; /* position where isearch was started */ int isstartdir; /* direction when isearch was started */ struct { /* bookkeeping for fFtT;, commands */ int flag, target, direction; } f_cmd; }; #define W2D(y) ((y) - markdata->hist_offset) #define D2W(y) ((y) + markdata->hist_offset) screen-4.2.1/list_window.c0000644000175000017500000004116712326710533014416 0ustar amadeamade/* Copyright (c) 2010 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ /* Deals with the list of windows */ /* NOTE: A 'struct win *' is used as the 'data' for each row. It might make more sense * to use 'struct win* ->w_number' as the 'data', instead, because that way, we can * verify that the window does exist (by looking at wtab[]). */ #include "config.h" #include "screen.h" #include "layer.h" #include "extern.h" #include "list_generic.h" extern struct layer *flayer; extern struct display *display, *displays; extern char *wlisttit; extern char *wliststr; extern struct mchar mchar_blank, mchar_so; extern int renditions[]; extern struct win **wtab, *windows, *fore; extern int maxwin; extern char *noargs[]; static char ListID[] = "window"; struct gl_Window_Data { struct win *group; /* Set only for a W_TYPE_GROUP window */ int order; /* MRU? NUM? */ int onblank; int nested; struct win *fore; /* The foreground window we had. */ }; /* Is this wdata for a group window? */ #define WLIST_FOR_GROUP(wdate) ((wdata)->group && !(wdata)->onblank && Layer2Window(flayer) && Layer2Window(flayer)->w_type == W_TYPE_GROUP) /* This macro should not be used if 'fn' is expected to update the window list */ #define FOR_EACH_WINDOW(_wdata, _w, fn) do { \ if ((_wdata)->order == WLIST_MRU) \ { \ struct win *_ww; \ for (_ww = windows; _ww; _ww = _ww->w_next) \ { \ _w = _ww; \ fn \ } \ } \ else \ { \ struct win **_ww, *_witer; \ for (_ww = wtab, _witer = windows; _witer && _ww - wtab < maxwin; _ww++) \ { \ if (!(_w = *_ww)) continue; \ fn \ _witer = _witer->w_next; \ } \ } \ } while (0) /* Is 'a' an ancestor of 'd'? */ static int window_ancestor(struct win *a, struct win *d) { if (!a) return 1; /* Every window is a descendant of the 'null' group */ for (; d; d = d->w_group) if (d->w_group == a) return 1; return 0; } static void window_kill_confirm(char *buf, int len, char *data) { struct win *w = windows; struct action act; if (len || (*buf != 'y' && *buf != 'Y')) { *buf = 0; return; } /* Loop over the windows to make sure that the window actually still exists. */ for (; w; w = w->w_next) if (w == (struct win *)data) break; if (!w) return; /* Pretend the selected window is the foreground window. Then trigger a non-interactive 'kill' */ fore = w; act.nr = RC_KILL; act.args = noargs; act.argl = 0; act.quiet = 0; DoAction(&act, -1); } static struct ListRow * gl_Window_add_group(struct ListData *ldata, struct ListRow *row) { /* Right now, 'row' doesn't have any child. */ struct gl_Window_Data *wdata = ldata->data; struct win *group = row->data, *w; struct ListRow *cur = row; ASSERT(wdata->nested); FOR_EACH_WINDOW(wdata, w, if (w->w_group != group) continue; cur = glist_add_row(ldata, w, cur); if (w == wdata->fore) ldata->selected = cur; if (w->w_type == W_TYPE_GROUP) cur = gl_Window_add_group(ldata, cur); ); return cur; } static void gl_Window_rebuild(struct ListData *ldata) { struct ListRow *row = NULL; struct gl_Window_Data *wdata = ldata->data; struct win *w; FOR_EACH_WINDOW(wdata, w, if (w->w_group != wdata->group) continue; row = glist_add_row(ldata, w, row); if (w == wdata->fore) ldata->selected = row; if (w->w_type == W_TYPE_GROUP && wdata->nested) row = gl_Window_add_group(ldata, row); ); glist_display_all(ldata); } static struct ListRow * gl_Window_findrow(struct ListData *ldata, struct win *p) { struct ListRow *row = ldata->root; for (; row; row = row->next) { if (row->data == p) break; } return row; } static int gl_Window_remove(struct ListData *ldata, struct win *p) { struct ListRow *row = gl_Window_findrow(ldata, p); if (!row) return 0; /* Remove 'row'. Update 'selected', 'top', 'root' if necessary. */ if (row->next) row->next->prev = row->prev; if (row->prev) row->prev->next = row->next; if (ldata->selected == row) ldata->selected = row->prev ? row->prev : row->next; if (ldata->top == row) ldata->top = row->prev ? row->prev : row->next; if (ldata->root == row) ldata->root = row->next; ldata->list_fn->gl_freerow(ldata, row); free(row); return 1; } static int gl_Window_header(struct ListData *ldata) { char *str; struct gl_Window_Data *wdata = ldata->data; int g; if ((g = (wdata->group != NULL))) { LPutWinMsg(flayer, "Group: ", 7, &mchar_blank, 0, 0); LPutWinMsg(flayer, wdata->group->w_title, strlen(wdata->group->w_title), &mchar_blank, 7, 0); } display = 0; str = MakeWinMsgEv(wlisttit, (struct win *)0, '%', flayer->l_width, (struct event *)0, 0); LPutWinMsg(flayer, str, strlen(str), &mchar_blank, 0, g); return 2 + g; } static int gl_Window_footer(struct ListData *ldata) { return 0; } static int gl_Window_row(struct ListData *ldata, struct ListRow *lrow) { char *str; struct win *w, *g; int xoff; struct mchar *mchar; struct mchar mchar_rend = mchar_blank; struct gl_Window_Data *wdata = ldata->data; w = lrow->data; /* First, make sure we want to display this window in the list. * If we are showing a list for a group, and not on blank, then we must * only show the windows directly belonging to that group. * Otherwise, do some more checks. */ for (xoff = 0, g = w->w_group; g != wdata->group; g = g->w_group) xoff += 2; display = Layer2Window(flayer) ? 0 : flayer->l_cvlist ? flayer->l_cvlist->c_display : 0; str = MakeWinMsgEv(wliststr, w, '%', flayer->l_width - xoff, NULL, 0); if (ldata->selected == lrow) mchar = &mchar_so; else if (w->w_monitor == MON_DONE && renditions[REND_MONITOR] != -1) { mchar = &mchar_rend; ApplyAttrColor(renditions[REND_MONITOR], mchar); } else if ((w->w_bell == BELL_DONE || w->w_bell == BELL_FOUND) && renditions[REND_BELL] != -1) { mchar = &mchar_rend; ApplyAttrColor(renditions[REND_BELL], mchar); } else if ((w->w_silence == SILENCE_FOUND || w->w_silence == SILENCE_DONE) && renditions[REND_SILENCE] != -1) { mchar = &mchar_rend; ApplyAttrColor(renditions[REND_SILENCE], mchar); } else mchar = &mchar_blank; LPutWinMsg(flayer, str, flayer->l_width, mchar, xoff, lrow->y); if (xoff) LPutWinMsg(flayer, "", xoff, mchar, 0, lrow->y); return 1; } static int gl_Window_input(struct ListData *ldata, char **inp, int *len) { struct win *win; unsigned char ch; struct display *cd = display; struct gl_Window_Data *wdata = ldata->data; if (!ldata->selected) return 0; ch = (unsigned char) **inp; ++*inp; --*len; win = ldata->selected->data; switch (ch) { case ' ': case '\n': case '\r': if (!win) break; #ifdef MULTIUSER if (display && AclCheckPermWin(D_user, ACL_READ, win)) return 0; /* Not allowed to switch to this window. */ #endif if (WLIST_FOR_GROUP(wdata)) SwitchWindow(win->w_number); else { /* Abort list only when not in a group window. */ glist_abort(); display = cd; if (D_fore != win) SwitchWindow(win->w_number); } *len = 0; break; case 'm': /* Toggle MRU-ness */ wdata->order = wdata->order == WLIST_MRU ? WLIST_NUM : WLIST_MRU; glist_remove_rows(ldata); gl_Window_rebuild(ldata); break; case 'g': /* Toggle nestedness */ wdata->nested = !wdata->nested; glist_remove_rows(ldata); gl_Window_rebuild(ldata); break; case 'a': /* All-window view */ if (wdata->group) { int order = wdata->order | (wdata->nested ? WLIST_NESTED : 0); glist_abort(); display = cd; display_windows(1, order, NULL); *len = 0; } else if (!wdata->nested) { wdata->nested = 1; glist_remove_rows(ldata); gl_Window_rebuild(ldata); } break; case 010: /* ^H */ case 0177: /* Backspace */ if (!wdata->group) break; if (wdata->group->w_group) { /* The parent is another group window. So switch to that window. */ struct win *g = wdata->group->w_group; glist_abort(); display = cd; SetForeWindow(g); *len = 0; } else { /* We were in a group view. Now we are moving to an all-window view. * So treat it as 'windowlist on blank'. */ int order = wdata->order | (wdata->nested ? WLIST_NESTED : 0); glist_abort(); display = cd; display_windows(1, order, NULL); *len = 0; } break; case ',': /* Switch numbers with the previous window. */ if (wdata->order == WLIST_NUM && ldata->selected->prev) { struct win *pw = ldata->selected->prev->data; if (win->w_group != pw->w_group) break; /* Do not allow switching with the parent group */ /* When a windows's number is successfully changed, it triggers a WListUpdatecv * with NULL window. So that causes a redraw of the entire list. So reset the * 'selected' after that. */ wdata->fore = win; WindowChangeNumber(win, pw->w_number); } break; case '.': /* Switch numbers with the next window. */ if (wdata->order == WLIST_NUM && ldata->selected->next) { struct win *nw = ldata->selected->next->data; if (win->w_group != nw->w_group) break; /* Do not allow switching with the parent group */ wdata->fore = win; WindowChangeNumber(win, nw->w_number); } break; case 'K': /* Kill a window */ { char str[MAXSTR]; snprintf(str, sizeof(str) - 1, "Really kill window %d (%s) [y/n]", win->w_number, win->w_title); Input(str, 1, INP_RAW, window_kill_confirm, (char *)win, 0); } break; case 033: /* escape */ case 007: /* ^G */ if (!WLIST_FOR_GROUP(wdata)) { int fnumber = wdata->onblank ? wdata->fore->w_number : -1; glist_abort(); display = cd; if (fnumber >= 0) SwitchWindow(fnumber); *len = 0; } break; default: if (ch >= '0' && ch <= '9') { struct ListRow *row = ldata->root; for (; row; row = row->next) { struct win *w = row->data; if (w->w_number == ch - '0') { struct ListRow *old = ldata->selected; if (old == row) break; ldata->selected = row; if (ldata->selected->y == -1) { /* We need to list all the rows, since we are scrolling down. But first, * find the top of the visible list. */ ldata->top = row; glist_display_all(ldata); } else { /* just redisplay the two lines. */ ldata->list_fn->gl_printrow(ldata, old); ldata->list_fn->gl_printrow(ldata, ldata->selected); flayer->l_y = ldata->selected->y; LaySetCursor(); } break; } } break; } --*inp; ++*len; return 0; } return 1; } static int gl_Window_freerow(struct ListData *ldata, struct ListRow *row) { return 0; } static int gl_Window_free(struct ListData *ldata) { Free(ldata->data); return 0; } static int gl_Window_match(struct ListData *ldata, struct ListRow *row, const char *needle) { struct win *w = row->data; if (InStr(w->w_title, needle)) return 1; return 0; } static struct GenericList gl_Window = { gl_Window_header, gl_Window_footer, gl_Window_row, gl_Window_input, gl_Window_freerow, gl_Window_free, gl_Window_match }; void display_windows(int onblank, int order, struct win *group) { struct win *p; struct ListData *ldata; struct gl_Window_Data *wdata; if (flayer->l_width < 10 || flayer->l_height < 6) { LMsg(0, "Window size too small for window list page"); return; } if (group) onblank = 0; /* When drawing a group window, ignore 'onblank' */ if (onblank) { debug3("flayer %x %d %x\n", flayer, flayer->l_width, flayer->l_height); if (!display) { LMsg(0, "windowlist -b: display required"); return; } p = D_fore; if (p) { SetForeWindow((struct win *)0); if (p->w_group) { D_fore = p->w_group; flayer->l_data = (char *)p->w_group; } Activate(0); } if (flayer->l_width < 10 || flayer->l_height < 6) { LMsg(0, "Window size too small for window list page"); return; } } else p = Layer2Window(flayer); if (!group && p) group = p->w_group; ldata = glist_display(&gl_Window, ListID); if (!ldata) { if (onblank && p) { /* Could not display the list. So restore the window. */ SetForeWindow(p); Activate(1); } return; } wdata = calloc(1, sizeof(struct gl_Window_Data)); wdata->group = group; wdata->order = (order & ~WLIST_NESTED); wdata->nested = !!(order & WLIST_NESTED); wdata->onblank = onblank; /* Set the most recent window as selected. */ wdata->fore = windows; while (wdata->fore && wdata->fore->w_group != group) wdata->fore = wdata->fore->w_next; ldata->data = wdata; gl_Window_rebuild(ldata); } static void WListUpdate(struct win *p, struct ListData *ldata) { struct gl_Window_Data *wdata = ldata->data; struct ListRow *row, *rbefore; struct win *before; int d = 0, sel = 0; if (!p) { if (ldata->selected) wdata->fore = ldata->selected->data; /* Try to retain the current selection */ glist_remove_rows(ldata); gl_Window_rebuild(ldata); return; } /* First decide if this window should be displayed at all. */ d = 1; if (wdata->order == WLIST_NUM || wdata->order == WLIST_MRU) { if (p->w_group != wdata->group) { if (!wdata->nested) d = 0; else d = window_ancestor(wdata->group, p); } } if (!d) { if (gl_Window_remove(ldata, p)) glist_display_all(ldata); return; } /* OK, so we keep the window in the list. Update the ordering. * First, find the row where this window should go to. Then, either create * a new row for that window, or move the exising row for the window to the * correct place. */ before = NULL; if (wdata->order == WLIST_MRU) { if (windows != p) for (before = windows; before; before = before->w_next) if (before->w_next == p) break; } else if (wdata->order == WLIST_NUM) { if (p->w_number != 0) { struct win **w = wtab + p->w_number - 1; for (; w >= wtab; w--) { if (*w && (*w)->w_group == wdata->group) { before = *w; break; } } } } /* Now, find the row belonging to 'before' */ if (before) rbefore = gl_Window_findrow(ldata, before); else if (wdata->nested && p->w_group) /* There's no 'before'. So find the group window */ rbefore = gl_Window_findrow(ldata, p->w_group); else rbefore = NULL; /* For now, just remove the row containing 'p' if it is not already in the right place . */ row = gl_Window_findrow(ldata, p); if (row) { if (row->prev != rbefore) { sel = ldata->selected->data == p; gl_Window_remove(ldata, p); } else p = NULL; /* the window is in the correct place */ } if (p) { row = glist_add_row(ldata, p, rbefore); if (sel) ldata->selected = row; } glist_display_all(ldata); } void WListUpdatecv(cv, p) struct canvas *cv; struct win *p; { struct ListData *ldata; struct gl_Window_Data *wdata; if (cv->c_layer->l_layfn != &ListLf) return; ldata = cv->c_layer->l_data; if (ldata->name != ListID) return; wdata = ldata->data; CV_CALL(cv, WListUpdate(p, ldata)); } void WListLinkChanged() { struct display *olddisplay = display; struct canvas *cv; struct ListData *ldata; struct gl_Window_Data *wdata; for (display = displays; display; display = display->d_next) for (cv = D_cvlist; cv; cv = cv->c_next) { if (!cv->c_layer || cv->c_layer->l_layfn != &ListLf) continue; ldata = cv->c_layer->l_data; if (ldata->name != ListID) continue; wdata = ldata->data; if (!(wdata->order & WLIST_MRU)) continue; CV_CALL(cv, WListUpdate(0, ldata)); } display = olddisplay; } screen-4.2.1/terminfo/0000755000175000017500000000000012326710533013522 5ustar amadeamadescreen-4.2.1/terminfo/tetris.c0000644000175000017500000000267412326531270015210 0ustar amadeamadelong h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K =0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1, 12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12, 1,12,11,-12,-1,1,2,-12,-1,12,13,-12,12,13,14,-11,-1,1,4,-13,-12,12,16,-11,-12, 12,17,-13,1,-1,5,-12,12,11,6,-12,12,24};u(){for(i=11;++i<264;)if((k=q[i])-Q[i] ){Q[i]=k;if(i-++I||i%12<1)printf("\033[%d;%dH",(I=i)/12,i%12*2+28);printf( "\033[%dm "+(K-k?0:5),k);K=k;}Q[263]=c=getchar();}G(b){for(i=4;i--;)if(q[i?b+ n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V,a)char* *V,*a;{h[3]=1000000/(l=C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i< 25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigvec(14,v, 0);t();puts("\033[H\033[J");for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c<0){if(G(x+ 12))x+=12;else{g(7);++w;for(j=0;j<252;j=12*(j/12+1))for(;q[++j];)if(j%12==10){ for(;j%12;q[j--]=0);u();for(;--j;q[j+12]=q[j]);u();}n=f+rand()%7*4;G(x=17)||(c =a[5]);}}if(c==*a)G(--x)||++x;if(c==a[1])n=f+4**(m=n),G(x)||(n=m);if(c==a[2])G (++x)||--x;if(c==a[3])for(;G(x+12);++w)x+=12;if(c==a[4]||c==a[5]){s=sigblock( 8192);printf("\033[H\033[J\033[0m%d\n",w);if(c==a[5])break;for(j=264;j--;Q[j]= 0);while(getchar()-a[4]);puts("\033[H\033[J\033[7m");sigsetmask(s);}}d=popen( "stty -cbreak echo stop \023;sort -mnr -o HI - HI;cat HI","w");fprintf(d, "%4d from level %1d by %s\n",w,l,getlogin());pclose(d);} screen-4.2.1/terminfo/screeninfo.src0000644000175000017500000000764412326710533016401 0ustar amadeamadescreen|VT 100/ANSI X3.64 virtual terminal, am, km, mir, msgr, xenl, cols#80, it#8, lines#24, colors#8, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=\t, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, is2=\E)0, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m, smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, smacs=^N, rmacs=^O, flash=\Eg, civis=\E[?25l, cnorm=\E[34h\E[?25h, cvvis=\E[34l, op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00, screen-bce|VT 100/ANSI X3.64 virtual terminal with bce, am, bce, km, mir, msgr, xenl, cols#80, it#8, lines#24, colors#8, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=\t, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, is2=\E)0, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m, smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, smacs=^N, rmacs=^O, flash=\Eg, civis=\E[?25l, cnorm=\E[34h\E[?25h, cvvis=\E[34l, op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00, screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line, am, bce, hs, km, mir, msgr, xenl, cols#80, it#8, lines#24, colors#8, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=\t, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, is2=\E)0, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m, smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, smacs=^N, rmacs=^O, flash=\Eg, tsl=\E_, fsl=\E\\, dsl=\E_\E\\, civis=\E[?25l, cnorm=\E[34h\E[?25h, cvvis=\E[34l, op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00, screen-256color|VT 100/ANSI X3.64 virtual terminal, ccc, colors#256, pairs#32767, initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, setb=\E[48;5;%p1%dm, setf=\E[38;5;%p1%dm, use=screen, screen-4.2.1/terminfo/8bits0000644000175000017500000000132012326531270014471 0ustar amadeamade We test some umlauts and other characters coded in the ISO 8859-1 (Latin 1) standard: umlaut A Ä umlaut a ä umlaut O Ö umlaut o ö umlaut U Ü umlaut u ü sharp s ß paragraph § e + / é e + \ è e + ^ ê a + \ à u + \ ù degree ° log. not ¬ + over - ± << « >> » fraction 1/2 ½ fraction 1/4 ¼ power of 2 ² middle dot · --- screen-4.2.1/terminfo/README0000644000175000017500000000110212326531270014373 0ustar amadeamade This directory contains various file for termcap/terminfo installation and testing: screencap Termcap entry for screen. Add it to /etc/termcap. On NetBSD, you should run /usr/bin/cap_mkdb afterwards. screeninfo.src Terminfo entry. Use 'tic screeninfo.src' to install (Sun: /usr/5bin/tic). checktc.c Termcap/info test program. Checks margin handling and other things. 8bits Some chars from the ISO 8859-1 charset. test.txt Test file for alternate charset. tetris.c The popular game, by John Tromp. This is one of the winners of the 1989 IOCCC contest. screen-4.2.1/terminfo/checktc.c0000644000175000017500000001055212326531270015274 0ustar amadeamade#include char *CL, *CM, *CS, *SR; int CO, LI, AM, XN; char *tgetstr(), *getenv(); void PutStr(), CPutStr(), CCPutStr(), GotoPos(), RETURN(); main() { char *term, *s; char tcbuf[1024]; char tcstr[1024], *tp; if ((term = getenv("TERM")) == 0) { fprintf(stderr, "No $TERM set\n"); exit(1); } switch (tgetent(tcbuf, term)) { case -1: fprintf(stderr, "Could not open termcap file\n"); exit(1); case 0: fprintf(stderr, "I don't know what a '%s' terminal is.\n", term); exit(1); } tp = tcstr; if ((CL = tgetstr("cl", &tp)) == 0) { fprintf(stderr, "cl capability required\n"); exit(1); } if ((CM = tgetstr("cm", &tp)) == 0) { fprintf(stderr, "cm capability required\n"); exit(1); } if ((s = getenv("COLUMNS"))) CO = atoi(s); if ((s = getenv("LINES"))) LI = atoi(s); if (CO == 0) CO = tgetnum("co"); if (LI == 0) LI = tgetnum("li"); if (CO == 0) CO = 80; if (LI == 0) LI = 24; GotoPos(5, 1); printf("******* cl capability does not work !!! *******"); GotoPos(5, 2); PutStr(CL); printf("******* cl capability does not home cursor *******"); GotoPos(0, 0); printf(" "); GotoPos(5, 4); printf("******* cm capability does not work !!! *******"); GotoPos(5, 4); printf(" "); GotoPos(CO/2-12, LI/2); printf("Your terminal size is"); GotoPos(CO/2-3, LI/2+1); printf("%dx%d", CO, LI); GotoPos(CO/2-2, 0); printf("top"); GotoPos(CO/2-3, LI-1); printf("bottom"); GotoPos(0, LI/2-2);printf("l"); GotoPos(0, LI/2-1);printf("e"); GotoPos(0, LI/2+0);printf("f"); GotoPos(0, LI/2+1);printf("t"); GotoPos(CO-1, LI/2-2);printf("r"); GotoPos(CO-1, LI/2-1);printf("i"); GotoPos(CO-1, LI/2+0);printf("g"); GotoPos(CO-1, LI/2+1);printf("h"); GotoPos(CO-1, LI/2+2);printf("t"); GotoPos(CO/2-15, LI/2+3); RETURN(); AM = tgetflag("am"); printf("Termcap: terminal does %sauto-wrap", AM ? "" : "not "); GotoPos(0, 5); if (AM) { printf(" am capability set, but terminal does not wrap"); GotoPos(CO-1, 3); } else { printf(" am capability not set, but terminal does wrap"); GotoPos(CO-1, 4); } printf(" \n "); GotoPos(0, 10); RETURN(); if (AM) { XN = tgetflag("xn"); printf("Termcap: terminal has %smagic margins", XN ? "" : "no "); GotoPos(0, 5); if ((XN = tgetflag("xn"))) { printf(" xn capability set, but terminal has no magic-margins"); GotoPos(CO-1, 4); } else { printf(" xn capability not set, but terminal has magic-margins"); GotoPos(CO-1, 3); } printf(" \n"); printf(" "); GotoPos(0, 10); RETURN(); if (XN) { GotoPos(0, 6); printf(" last col in last row is not usable"); GotoPos(CO-1, LI-1); printf(" "); GotoPos(0, 6); printf(" "); GotoPos(0, 0); printf("testing magic margins in last row"); GotoPos(0, 10); RETURN(); } } if ((CS = tgetstr("cs", &tp))) { printf("Termcap: terminal has scrollregions"); GotoPos(0, 5); printf(" cs capability set, but doesn't work"); CCPutStr(CS, 4, 5); GotoPos(0, 5); printf("\n\n"); CCPutStr(CS, 0, LI-1); GotoPos(0, 10); RETURN(); } if ((SR = tgetstr("sr", &tp))) { GotoPos(0, 5); printf(" sr capability set, but doesn't work"); GotoPos(0, 0); PutStr(SR); GotoPos(0, 6); printf(" "); GotoPos(0, 0); printf("Termcap: terminal can scroll backwards"); GotoPos(0, 10); RETURN(); } } void putcha(c) char c; { putchar(c); } void PutStr(s) char *s; { tputs(s, 1, putcha); fflush(stdout); } void CPutStr(s, c) char *s; int c; { tputs(tgoto(s, 0, c), 1, putcha); fflush(stdout); } void CCPutStr(s, x, y) char *s; int x, y; { tputs(tgoto(s, y, x), 1, putcha); fflush(stdout); } void GotoPos(x,y) int x,y; { tputs(tgoto(CM, x, y), 1, putcha); fflush(stdout); } void RETURN() { printf("Press to continue"); fflush(stdout); while(getchar() != '\n'); PutStr(CL); } screen-4.2.1/terminfo/test.txt0000644000175000017500000011376312326531270015254 0ustar amadeamade <(A)0[?4h[?5l lqqqqqqqqqwwwqqqqqqqqqk sssssssssssssssssssssssssssss xMerry Chrxxxmas * Merx \ / xry Christxxx * Merry x pr rp xChristmasxxxMerry Chrx oqrs srqo xistmas * xxxry Christx ooppqqwqwqqppoo tqqqqqqqqqjxmqqqqqqqqqu x x tqqqqqqqqqq`qqqqqqqqqqu x x tqqqqqqqqqkxlqqqqqqqqqu x x xry Christxxx * Merry x x x xChristmasxxxMerry Chrx x x xistmas * xxxry Christx x x xmas * MerxxxChristmasx srqqj mqqrs mqqqqqqqqqvvvqqqqqqqqqj  rqpo opqr  lmxx lqmqx x lqwmqvx xx x lqwqmqvqx x x x lqwqmqvqx x x x lqwqmqvqx x x x lqwqmqvqx x x x lqwqmqvqx x x x lqwqmqvqx x x x lqwqmqvqx x x x // // //  / / //  / /// //  //// //  //// // /  //// / /  // / // // / // / //s/ //  sssssssssss / / //  // / ss  / //  //  // rrrrrrrrrrr / /s //  // qqqqqqqqq //  //  // srqqqqqqqqqrs   //  /// srrs //  //// // rrqqqqrr /  //// / / ppppppp  // / // rrqqrr // / // / rqppppqr //s/ //  rqpppooooooopppqr / / //  // / qppoooooooooooppq  / //  //  // sssssssooo ooo. o f / /s //  //.f ssss .f //  //  // f ssssrrrrqqqqqrrrrsssss s   //  ///. . . sssrrrrqqqqqqqqqrrrrsssf f . f //  //// / f . rrrqqqqpppppppppqqqqrss. . o f /  //// / /f .f qqqppppooooooooopppqrss .f . s// / // f f sssssssssqppoooo oopqrss.o . // / // /f f. . ssrrrrrrrrrsqpooo opqrssf f f . f //s/ // f o o f . ssssssrrrrssssss   f o o .. . o f s/ //  /  . o o ff .f srrrrrrqqqqqqqqqqqqqqrrssrqf o o .  .f . / //  / mqvqqqqqq lqwqqqqqq x x x x . o f rqqqqqqppppppppppppppq mqvqqqqq lqwqqqqq x x x xf .o . o /s /  mqvqqqq lqwqqqq x x x x f f [14;51 qppppppoooooooooooooo mqvqqq lqwqqq x x x xf  .f f . f s /  mqvqq lqwqq x x x x. o f o o f f poooooo  mqvq lqwq x x x x o o of o o . rrrrrrrrrrrrrrrrrrrrrrrrrrrrr   mqv lqw x x x xo  mq lq x  x  . o o of o o .  .f .  m l x x. o o f o . . . o ff f     f o o f . ff .o . o #3 Cheers! #4 Cheers!   . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . #5 #5 f . o . f o ff  .f f . f  f f f . o f o o f f .  /ooooooooooooooo\  o o of o o .. . o f  / sss sss \ o o o . o o ff .f  x (sOs) (sOs) x  . o o of o o .  .f .  x ` x . o o f o . . . o ff f  \ \sssssssss/ / f o o f . ff .o . o  \ /  . o o . o f  f f . . .  \sssssssssss/ f . o . f o ff  .f f . f  ooppqqrrsss  f f f . o f o o f f .  ooppqqrrsss  o o of o o .. . o f  ooppqqrrsss o o o . o o ff .f  ooppqqrrsss  . o o of o o .  .f .  ooppqqrrsss . o o f o . . . o ff f  ooppqqrrsss f o o f . ff .o . o  ooppqqrrsss . o o . o f  f f . . . M x ` x f . o . f o ff  .f f . f M x (sOs) (sOs) x  f f f . o f o o f f . M / sss sss \  o o of o o .. . o f M /ooooooooooooooo\ o o o . o o ff .f M  . o o of o o .  .f . M . o o f o . . . o ff f M f o o f . ff .o . o M  . o o . o f  f f . . .  \ / f . o . f o ff  .f f . f  \sssssssssss/  f f f . o f o o f f .  ooppqqrrsss  o o of o o .. . o f  ooppqqrrsss o o o . o o ff .f  ooppqqrrsss  . o o of o o .  .f .  ooppqqrrsss . o o f o . . . o ff f  ooppqqrrsssf o o f . ff .o . o M / sss sss \  . o o . o f  f f . . . M /ooooooooooooooo\ f . o . f o ff  .f f . f M  f f f . o f o o f f . M  o o of o o .. . o f  ooppqqrrsss o o o . o o ff .f  ooppqqrrsss  . o o of o o .  .f .  ooppqqrrsss . o o f o . . . o ff f  ooppqqrrsssf o o f . ff .o . o M /ooooooooooooooo\  . o o . o f  f f . . . M f . o . f o ff  .f f . f M  f f f . o f o o f f . M  o o of o o .. . o f  \sssssssssss/ o o o . o o ff .f  ooppqqrrsss  . o o of o o .  .f .  ooppqqrrsss . o o f o . . . o ff f f o o f . ff .o . o Jin  . o o . o f  f f . . . gle f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f Bells,  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f Jin  . o o of o o .  .f . gle . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f Bells,  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f Jin  f f f . o f o o f f . gle  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f all f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f . the  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f way, f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f Oh! f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f . What  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f fun f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f . it  o o of o o .. . o f is o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o to  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f ride, o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f On o o o . o o ff .f a  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . one- f . o . f o ff  .f f . f horse  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f op  f f f . o f o o f f . en  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f . sleigh.  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff f  o o of o o  . o o o   f o o     o o o . o o ff f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff f  o o of o o  . o o o   f o o     Merry Christmas  -  o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff f  o o of o o  . o o o   f o o     o o o . o o ff f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff .f  . o o of o o .  .f . . o o f o . . . o ff f f o o f . ff .o . o  . o o . o f  f f . . . f . o . f o ff  .f f . f  f f f . o f o o f f .  o o of o o .. . o f o o o . o o ff f  o o of o o  . o o o   f o o     [?4l screen-4.2.1/terminfo/screencap0000644000175000017500000000222312326531270015406 0ustar amadeamadeSC|screen|VT 100/ANSI X3.64 virtual terminal:\ :am:xn:ms:mi:G0:km:\ :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\ :cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\ :do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\ :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\ :li#24:co#80:us=\E[4m:ue=\E[24m:so=\E[3m:se=\E[23m:\ :mb=\E[5m:md=\E[1m:mr=\E[7m:me=\E[m:sr=\EM:al=\E[L:\ :AL=\E[%dL:dl=\E[M:DL=\E[%dM:cs=\E[%i%d;%dr:dc=\E[P:\ :DC=\E[%dP:im=\E[4h:ei=\E[4l:IC=\E[%d@:\ :ks=\E[?1h\E=:ke=\E[?1l\E>:vb=\Eg:\ :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\ :kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:@7=\E[4~:kP=\E[5~:\ :kN=\E[6~:eA=\E(B\E)0:as=^N:ae=^O:ti=\E[?1049h:te=\E[?1049l:\ :vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\ :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\ :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00: SB|screen-bce|VT 100/ANSI X3.64 virtual terminal with bce:\ :ut:tc=screen: SH|screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line:\ :ts=\E_:fs=\E\\:ds=\E_\E\\:tc=screen: screen-4.2.1/config.h.in~0000644000175000017500000005022612326707503014130 0ustar amadeamade/* config.h.in. Generated from configure.in by autoheader. */ /* Copyright (c) 1993-2000 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, write to the * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * **************************************************************** * $Id$ FAU */ /********************************************************************** * * User Configuration Section */ /* * Maximum of simultaneously allowed windows per screen session. */ #ifndef MAXWIN # define MAXWIN 40 #endif /* * Define SOCKDIR to be the directory to contain the named sockets * screen creates. This should be in a common subdirectory, such as * /usr/local or /tmp. It makes things a little more secure if you * choose a directory which is not writable by everyone or where the * "sticky" bit is on, but this isn't required. * If SOCKDIR is not defined screen will put the named sockets in * the user's home directory. Notice that this can cause you problems * if some user's HOME directories are AFS- or NFS-mounted. Especially * AFS is unlikely to support named sockets. * * Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison). */ #undef SOCKDIR /* * Define this if the SOCKDIR is not shared between hosts. */ #define SOCKDIR_IS_LOCAL_TO_HOST /* * Screen sources two startup files. First a global file with a path * specified here, second your local $HOME/.screenrc * Don't define this, if you don't want it. */ #ifndef ETCSCREENRC # define ETCSCREENRC "/usr/local/etc/screenrc" #endif /* * Screen can look for the environment variable $SYSSCREENRC and -if it * exists- load the file specified in that variable as global screenrc. * If you want to enable this feature, define ALLOW_SYSSCREENRC to one (1). * Otherwise ETCSCREENRC is always loaded. */ #define ALLOW_SYSSCREENRC 1 /* * Screen needs encoding files for the translation of utf8 * into some encodings, e.g. JIS, BIG5. * Only needed if FONT, ENCODINGS and UTF8 are defined. */ #ifndef SCREENENCODINGS # define SCREENENCODINGS "/usr/local/lib/screen/encodings" #endif /* * Define CHECKLOGIN to force Screen users to enter their Unix password * in addition to the screen password. * * Define NOSYSLOG if yo do not have logging facilities. Currently * syslog() will be used to trace ``su'' commands only. */ #define CHECKLOGIN 1 #undef NOSYSLOG /* * define PTYMODE if you do not like the default of 0622, which allows * public write to your pty. * define PTYGROUP to some numerical group-id if you do not want the * tty to be in "your" group. * Note, screen is unable to change mode or group of the pty if it * is not installed with sufficient privilege. (e.g. set-uid-root) * define PTYROFS if the /dev/pty devices are mounted on a read-only * filesystem so screen should not even attempt to set mode or group * even if running as root (e.g. on TiVo). */ #undef PTYMODE #undef PTYGROUP #undef PTYROFS /* * If screen is NOT installed set-uid root, screen can provide tty * security by exclusively locking the ptys. While this keeps other * users from opening your ptys, it also keeps your own subprocesses * from being able to open /dev/tty. Define LOCKPTY to add this * exclusive locking. */ #undef LOCKPTY /* * If you'd rather see the status line on the first line of your * terminal rather than the last, define TOPSTAT. */ #undef TOPSTAT /* * define DETACH can detach a session. An absolute 'must'. */ #define DETACH /* * here come the erlangen extensions to screen: * define LOCK if you want to use a lock program for a screenlock. * define PASSWORD for secure reattach of your screen. * define COPY_PASTE to use the famous hacker's treasure zoo. * define POW_DETACH to have a detach_and_logout key (requires DETACH). * define REMOTE_DETACH (-d option) to move screen between terminals. * define AUTO_NUKE to enable Tim MacKenzies clear screen nuking * define PSEUDOS to allow window input/output filtering * define MULTI to allow multiple attaches. * define MULTIUSER to allow other users attach to your session * (if they are in the acl, of course) * define MAPKEYS to include input keyboard translation. * define FONT to support ISO2022/alternet charset support * define COLOR to include ansi color support. This may expose * a bug in x11r6-color-xterm. * define DW_CHARS to include support for double-width character * sets. * define ENCODINGS to include support for encodings like euc or big5. * Needs FONT to work. * define UTF8 if you want support for UTF-8 encoding. * Needs FONT and ENCODINGS to work. * define COLORS16 if you want 16 colors. * Needs COLOR to work. * define BUILTIN_TELNET to add telnet support to screen. * Syntax: screen //telnet host [port] * define RXVT_OSC if you want support for rxvts special * change fgcolor/bgcolor/bgpicture sequences */ #undef SIMPLESCREEN #ifndef SIMPLESCREEN # define LOCK # define PASSWORD # define COPY_PASTE # define REMOTE_DETACH # define POW_DETACH # define AUTO_NUKE # define PSEUDOS # define MULTI # define MULTIUSER # define MAPKEYS # define COLOR # define FONT # define DW_CHARS # define ENCODINGS # define UTF8 # define COLORS16 # define ZMODEM # define BLANKER_PRG #endif /* SIMPLESCREEN */ #undef BUILTIN_TELNET #undef RXVT_OSC #undef COLORS256 /* * If you have a braille display you should define HAVE_BRAILLE. * The code inside #ifdef HAVE_BRAILLE was contributed by Hadi Bargi * Rangin (bargi@dots.physics.orst.edu). * WARNING: this is more or less unsupported code, it may be full of * bugs leading to security holes, enable at your own risk! */ #undef HAVE_BRAILLE /* * As error messages are mostly meaningless to the user, we * try to throw out phrases that are somewhat more familiar * to ...well, at least familiar to us NetHack players. */ #ifndef NONETHACK # define NETHACK #endif /* NONETHACK */ /* * If screen is installed with permissions to update /etc/utmp (such * as if it is installed set-uid root), define UTMPOK. */ #define UTMPOK /* Set LOGINDEFAULT to one (1) * if you want entries added to /etc/utmp by default, else set it to * zero (0). * LOGINDEFAULT will be one (1) whenever LOGOUTOK is undefined! */ #define LOGINDEFAULT 1 /* Set LOGOUTOK to one (1) * if you want the user to be able to log her/his windows out. * (Meaning: They are there, but not visible in /etc/utmp). * Disabling this feature only makes sense if you have a secure /etc/utmp * database. * Negative examples: suns usually have a world writable utmp file, * xterm will run perfectly without s-bit. * * If LOGOUTOK is undefined and UTMPOK is defined, all windows are * initially and permanently logged in. * * Set CAREFULUTMP to one (1) if you want that users have at least one * window per screen session logged in. */ #define LOGOUTOK 1 #undef CAREFULUTMP /* * If UTMPOK is defined and your system (incorrectly) counts logins by * counting non-null entries in /etc/utmp (instead of counting non-null * entries with no hostname that are not on a pseudo tty), define USRLIMIT * to have screen put an upper-limit on the number of entries to write * into /etc/utmp. This helps to keep you from exceeding a limited-user * license. */ #undef USRLIMIT /* * both must be defined if you want to favor tcsendbreak over * other calls to generate a break condition on serial lines. * (Do not bother, if you are not using plain tty windows.) */ #define POSIX_HAS_A_GOOD_TCSENDBREAK #define SUNOS4_AND_WE_TRUST_TCSENDBREAK /* * to lower the interrupt load on the host machine, you may want to * adjust the VMIN and VTIME settings used for plain tty windows. * See the termio(4) manual page (Non-Canonical Mode Input Processing) * for details. * if undefined, VMIN=1, VTIME=0 is used as a default - this gives you * best user responsiveness, but highest interrupt frequency. * (Do not bother, if you are not using plain tty windows.) */ #define TTYVMIN 100 #define TTYVTIME 2 /* * looks like the above values are ignored by setting FNDELAY. * This is default for all pty/ttys, you may disable it for * ttys here. After playing with it for a while, one may find out * that this feature may cause screen to lock up. */ #ifdef bsdi # define TTY_DISABLE_FNBLOCK /* select barfs without it ... */ #endif /* * Some terminals, e.g. Wyse 120, use a bitfield to select attributes. * This doesn't work with the standard so/ul/m? terminal entries, * because they will cancel each other out. * On TERMINFO machines, "sa" (sgr) may work. If you want screen * to switch attributes only with sgr, define USE_SGR. * This is *not* recomended, do this only if you must. */ #undef USE_SGR /* * Define USE_LOCALE if you want screen to use the locale names * for the name of the month and day of the week. */ #define USE_LOCALE /* * Define USE_PAM if your system supports PAM (Pluggable Authentication * Modules) and you want screen to use it instead of calling crypt(). * (You may also need to add -lpam to LIBS in the Makefile.) */ #undef USE_PAM /* * Define CHECK_SCREEN_W if you want screen to set TERM to screen-w * if the terminal width is greater than 131 columns. No longer needed * on modern systems which use $COLUMNS or the tty settings instead. */ #undef CHECK_SCREEN_W /********************************************************************** * * End of User Configuration Section * * Rest of this file is modified by 'configure' * Change at your own risk! * */ /* * Some defines to identify special unix variants */ #ifndef SVR4 #undef SVR4 #endif /* #ifndef __osf__ */ #ifndef MIPS #undef MIPS #endif /* #endif */ #ifndef OSX #undef OSX #endif #ifndef ISC #undef ISC #endif #ifndef sysV68 #undef sysV68 #endif #ifndef _POSIX_SOURCE #undef _POSIX_SOURCE #endif /* * Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX). */ #undef POSIX /* * Define BSDJOBS if you have BSD-style job control (both process * groups and a tty that deals correctly with them). */ #undef BSDJOBS /* * Define TERMIO if you have struct termio instead of struct sgttyb. * This is usually the case for SVID systems, where BSD uses sgttyb. * POSIX systems should define this anyway, even though they use * struct termios. */ #undef TERMIO /* * Define CYTERMIO if you have cyrillic termio modes. */ #undef CYTERMIO /* * Define TERMINFO if your machine emulates the termcap routines * with the terminfo database. * Thus the .screenrc file is parsed for * the command 'terminfo' and not 'termcap'. */ #undef TERMINFO /* * If your library does not define ospeed, define this. */ #undef NEED_OSPEED /* * Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX) */ #ifndef SYSV #undef SYSV #endif /* * Define SIGVOID if your signal handlers return void. On older * systems, signal returns int, but on newer ones, it returns void. */ #undef SIGVOID /* * Define USESIGSET if you have sigset for BSD 4.1 reliable signals. */ #undef USESIGSET /* * Define SYSVSIGS if signal handlers must be reinstalled after * they have been called. */ #undef SYSVSIGS /* * Define BSDWAIT if your system defines a 'union wait' in * * Only allow BSDWAIT i.e. wait3 on nonposix systems, since * posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl * */ #ifndef POSIX #undef BSDWAIT #endif /* * On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com */ #ifdef BSDWAIT #undef USE_WAIT2 #endif /* * Define HAVE_DIRENT_H if your system has instead of * */ #undef HAVE_DIRENT_H /* * If your system has getutent(), pututline(), etc. to write to the * utmp file, define GETUTENT. */ #undef GETUTENT /* * Define UTHOST if the utmp file has a host field. */ #undef UTHOST /* * Define if you have the utempter utmp helper program */ #undef HAVE_UTEMPTER /* * If ttyslot() breaks getlogin() by returning indexes to utmp entries * of type DEAD_PROCESS, then our getlogin() replacement should be * selected by defining BUGGYGETLOGIN. */ #undef BUGGYGETLOGIN /* * If your system has the calls setreuid() and setregid(), * define HAVE_SETREUID. Otherwise screen will use a forked process to * safely create output files without retaining any special privileges. */ #undef HAVE_SETRESUID #undef HAVE_SETREUID /* * If your system supports BSD4.4's seteuid() and setegid(), define * HAVE_SETEUID. */ #undef HAVE_SETEUID /* * If you want the "time" command to display the current load average * define LOADAV. Maybe you must install screen with the needed * privileges to read /dev/kmem. * Note that NLIST_ stuff is only checked, when getloadavg() is not available. */ #undef LOADAV #undef LOADAV_NUM #undef LOADAV_TYPE #undef LOADAV_SCALE #undef LOADAV_GETLOADAVG #undef LOADAV_UNIX #undef LOADAV_AVENRUN #undef LOADAV_USE_NLIST64 #undef NLIST_DECLARED #undef NLIST_STRUCT #undef NLIST_NAME_UNION /* * If your system has the new format /etc/ttys (like 4.3 BSD) and the * getttyent(3) library functions, define GETTTYENT. */ #undef GETTTYENT /* * Define USEBCOPY if the bcopy/memcpy from your system's C library * supports the overlapping of source and destination blocks. When * undefined, screen uses its own (probably slower) version of bcopy(). * * SYSV machines may have a working memcpy() -- Oh, this is * quite unlikely. Tell me if you see one. * "But then, memmove() should work, if at all available" he thought... * Boing, never say "works everywhere" unless you checked SCO UNIX. * Their memove fails the test in the configure script. Sigh. (Juergen) */ #undef USEBCOPY #undef USEMEMCPY #undef USEMEMMOVE /* * If your system has vsprintf() and requires the use of the macros in * "varargs.h" to use functions with variable arguments, * define USEVARARGS. */ #undef USEVARARGS /* * If your system has strerror() define this. */ #undef HAVE_STRERROR /* * If the select return value doesn't treat a descriptor that is * usable for reading and writing as two hits, define SELECT_BROKEN. */ #undef SELECT_BROKEN /* * Define this if your system supports named pipes. */ #undef NAMEDPIPE /* * Define this if your system exits select() immediatly if a pipe is * opened read-only and no writer has opened it. */ #undef BROKEN_PIPE /* * Define this if the unix-domain socket implementation doesn't * create a socket in the filesystem. */ #undef SOCK_NOT_IN_FS /* * If your system has setenv() and unsetenv() define USESETENV */ #undef USESETENV /* * If your system does not come with a setenv()/putenv()/getenv() * functions, you may bring in our own code by defining NEEDPUTENV. */ #undef NEEDPUTENV /* * If the passwords are stored in a shadow file and you want the * builtin lock to work properly, define SHADOWPW. */ #undef SHADOWPW /* * If you are on a SYS V machine that restricts filename length to 14 * characters, you may need to enforce that by setting NAME_MAX to 14 */ #undef NAME_MAX /* KEEP_UNDEF_HERE override system value */ #undef NAME_MAX /* * define HAVE_RENAME if your system has a rename() function */ #undef HAVE_RENAME /* * define HAVE__EXIT if your system has the _exit() call. */ #undef HAVE__EXIT /* * define HAVE_LSTAT if your system has symlinks and the lstat() call. */ #undef HAVE_LSTAT /* * define HAVE_UTIMES if your system has the utimes() call. */ #undef HAVE_UTIMES /* * define HAVE_FCHOWN if your system has the fchown() call. */ #undef HAVE_FCHOWN /* * define HAVE_FCHMOD if your system has the fchmod() call. */ #undef HAVE_FCHMOD /* * define HAVE_VSNPRINTF if your system has vsnprintf() (GNU lib). */ #undef HAVE_VSNPRINTF /* * define HAVE_GETCWD if your system has the getcwd() call. */ #undef HAVE_GETCWD /* * define HAVE_SETLOCALE if your system has the setlocale() call. */ #undef HAVE_SETLOCALE /* * define HAVE_STRFTIME if your system has the strftime() call. */ #undef HAVE_STRFTIME /* * define HAVE_NL_LANGINFO if your system has the nl_langinfo() call * and defines CODESET. */ #undef HAVE_NL_LANGINFO /* * Newer versions of Solaris include fdwalk, which can greatly improve * the startup time of screen; otherwise screen spends a lot of time * closing file descriptors. */ #undef HAVE_FDWALK /* * define HAVE_DEV_PTC if you have a /dev/ptc character special * device. */ #undef HAVE_DEV_PTC /* * define HAVE_SVR4_PTYS if you have a /dev/ptmx character special * device and support the ptsname(), grantpt(), unlockpt() functions. */ #undef HAVE_SVR4_PTYS /* * define HAVE_GETPT if you have the getpt() function. */ #undef HAVE_GETPT /* * define HAVE_OPENPTY if your system has the openpty() call. */ #undef HAVE_OPENPTY /* * define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen * to unusual environments. E.g. For SunOs the defaults are "qpr" and * "0123456789abcdef". For SunOs 4.1.2 * #define PTYRANGE0 "pqrstuvwxyzPQRST" * is recommended by Dan Jacobson. */ #undef PTYRANGE0 #undef PTYRANGE1 /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the `fchmod' function. */ #undef HAVE_FCHMOD /* Define to 1 if you have the `fchown' function. */ #undef HAVE_FCHOWN /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `getpt' function. */ #undef HAVE_GETPT /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the `openpty' function. */ #undef HAVE_OPENPTY /* Define to 1 if you have the `rename' function. */ #undef HAVE_RENAME /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_STROPTS_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `utimes' function. */ #undef HAVE_UTIMES /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the `_exit' function. */ #undef HAVE__EXIT /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS screen-4.2.1/osdef.sh0000644000175000017500000000343512326531270013337 0ustar amadeamade#! /bin/sh if test -z "$CPP"; then CPP="cc -E" fi if test -z "$srcdir"; then srcdir=. fi rm -f core* sed < $srcdir/osdef.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([^ *]*\) __P.*@/[)*, ]\1[ (]/i\\\ \\/\\[^a-zA-Z_\\]\1 __P\\/d@p' > osdef1.sed cat << EOF > osdef0.c #include "config.h" #include #include #include #include #include #ifdef SHADOWPW #include #endif #ifndef sun #include #endif #ifdef linux #include #include #endif #ifndef NAMEDPIPE #include #endif #ifndef NOSYSLOG #include #endif #include "os.h" #if defined(UTMPOK) && defined (GETTTYENT) && !defined(GETUTENT) #include #endif #ifdef SVR4 # include #endif EOF cat << EOF > osdef2.sed 1i\\ /* 1i\\ * This file is automagically created from osdef.sh -- DO NOT EDIT 1i\\ */ EOF $CPP -I. -I$srcdir osdef0.c | sed -n -f osdef1.sed >> osdef2.sed sed -f osdef2.sed < $srcdir/osdef.h.in > osdef.h rm osdef0.c osdef1.sed osdef2.sed if test -f core*; then file core* echo " Sorry, your sed is broken. Call the system administrator." echo " Meanwhile, you may try to compile screen with an empty osdef.h file." echo " But if your compiler needs to have all functions declared, you should" echo " retry 'make' now and only remove offending lines from osdef.h later." exit 1 fi if eval test "`diff osdef.h $srcdir/osdef.h.in | wc -l`" -eq 4; then echo " Hmm, sed is very pessimistic about your system header files." echo " But it did not dump core -- strange! Let's continue carefully..." echo " If this fails, you may want to remove offending lines from osdef.h" echo " or try with an empty osdef.h file, if your compiler can do without" echo " function declarations." fi screen-4.2.1/nethack.c0000644000175000017500000001122612326710533013462 0ustar amadeamade/* Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ #include "config.h" #include "screen.h" #ifdef NETHACK extern int nethackflag; #endif struct nlstrans { char *from; char *to; }; #ifdef NETHACK static struct nlstrans nethacktrans[] = { {"Cannot lock terminal - fork failed", "Cannot fork terminal - lock failed"}, {"Got only %d bytes from %s", "You choke on your food: %d bytes from %s"}, {"Copy mode - Column %d Line %d(+%d) (%d,%d)", "Welcome to hacker's treasure zoo - Column %d Line %d(+%d) (%d,%d)"}, {"First mark set - Column %d Line %d", "You drop a magic marker - Column %d Line %d"}, {"Copy mode aborted", "You escaped the dungeon."}, {"Filter removed.", "You have a sad feeling for a moment..."}, {"Window %d (%s) killed.", "You destroy poor window %d (%s)."}, {"Window %d (%s) is now being monitored for all activity.", "You feel like someone is watching you..."}, {"Window %d (%s) is no longer being monitored for activity.", "You no longer sense the watcher's presence."}, {"empty buffer", "Nothing happens."}, {"switched to audible bell.", "Suddenly you can't see your bell!"}, {"switched to visual bell.", "Your bell is no longer invisible."}, {"The window is now being monitored for %d sec. silence.", "You feel like someone is waiting for %d sec. silence..."}, {"The window is no longer being monitored for silence.", "You no longer sense the watcher's silence."}, {"No other window.", "You cannot escape from window %d!"}, {"Logfile \"%s\" closed.", "You put away your scroll of logging named \"%s\"." }, {"Error opening logfile \"%s\"", "You don't seem to have a scroll of logging named \"%s\"."}, {"Creating logfile \"%s\".", "You start writing on your scroll of logging named \"%s\"."}, {"Appending to logfile \"%s\".", "You add to your scroll of logging named \"%s\"."}, {"Detach aborted.", "The blast of disintegration whizzes by you!"}, {"Empty register.", "Nothing happens."}, {"[ Passwords don't match - checking turned off ]", "[ Passwords don't match - your armor crumbles away ]"}, {"Aborted because of window size change.", "KAABLAMM!!! You triggered a land mine!"}, {"Out of memory.", "Who was that Maude person anyway?"}, {"getpwuid() can't identify your account!", "An alarm sounds through the dungeon...\nThe Keystone Kops are after you!"}, {"Must be connected to a terminal.", "You must play from a terminal."}, {"No Sockets found in %s.\n", "This room is empty (%s).\n"}, {"New screen...", "Be careful! New screen tonight."}, {"Child has been stopped, restarting.", "You regain consciousness."}, {"There are screens on:", "Your inventory:"}, {"There is a screen on:", "Your inventory:"}, {"There are several screens on:", "Prove thyself worthy or perish:"}, {"There is a suitable screen on:", "You see here a good looking screen:"}, {"There are several suitable screens on:", "You may wish for a screen, what do you want?"}, {"%d socket%s wiped out.", "You hear %d distant explosion%s."}, {"Remove dead screens with 'screen -wipe'.", "The dead screen%s touch%s you. Try 'screen -wipe'."}, {"Illegal reattach attempt from terminal %s.", "'%s' tries to touch your session, but fails."}, {"Could not write %s", "%s is too hard to dig in"}, {0, 0} }; #endif const char * DoNLS(from) const char *from; { #ifdef NETHACK struct nlstrans *t; if (nethackflag) { for (t = nethacktrans; t->from; t++) if (strcmp(from, t->from) == 0) return t->to; } #endif return from; } screen-4.2.1/resize.c0000644000175000017500000006247112326710533013356 0ustar amadeamade/* Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ #include #include #ifndef sun #include #endif #ifdef ISC # include # include # include #endif #include "config.h" #include "screen.h" #include "extern.h" static void CheckMaxSize __P((int)); static void FreeMline __P((struct mline *)); static int AllocMline __P((struct mline *ml, int)); static void MakeBlankLine __P((unsigned char *, int)); static void kaablamm __P((void)); static int BcopyMline __P((struct mline *, int, struct mline *, int, int, int)); static void SwapAltScreen __P((struct win *)); extern struct layer *flayer; extern struct display *display, *displays; extern unsigned char *blank, *null; extern struct mline mline_blank, mline_null, mline_old; extern struct win *windows; extern int Z0width, Z1width; extern int captionalways; #if defined(TIOCGWINSZ) || defined(TIOCSWINSZ) struct winsize glwz; #endif static struct mline mline_zero = { (unsigned char *)0, (unsigned char *)0 #ifdef FONT ,(unsigned char *)0 #endif #ifdef COLOR ,(unsigned char *)0 # ifdef COLORS256 ,(unsigned char *)0 # endif #endif }; /* * ChangeFlag: 0: try to modify no window * 1: modify fore (and try to modify no other) + redisplay * 2: modify all windows * * Note: Activate() is only called if change_flag == 1 * i.e. on a WINCH event */ void CheckScreenSize(change_flag) int change_flag; { int wi, he; if (display == 0) { debug("CheckScreenSize: No display -> no check.\n"); return; } #ifdef TIOCGWINSZ if (ioctl(D_userfd, TIOCGWINSZ, (char *)&glwz) != 0) { debug2("CheckScreenSize: ioctl(%d, TIOCGWINSZ) errno %d\n", D_userfd, errno); wi = D_CO; he = D_LI; } else { wi = glwz.ws_col; he = glwz.ws_row; if (wi == 0) wi = D_CO; if (he == 0) he = D_LI; } #else wi = D_CO; he = D_LI; #endif debug2("CheckScreenSize: screen is (%d,%d)\n", wi, he); #if 0 /* XXX: Fixme */ if (change_flag == 2) { debug("Trying to adapt all windows (-A)\n"); for (p = windows; p; p = p->w_next) if (p->w_display == 0 || p->w_display == display) ChangeWindowSize(p, wi, he, p->w_histheight); } #endif if (D_width == wi && D_height == he) { debug("CheckScreenSize: No change -> return.\n"); return; } #ifdef BLANKER_PRG KillBlanker(); #endif ResetIdle(); ChangeScreenSize(wi, he, change_flag); /* XXX Redisplay logic */ #if 0 if (change_flag == 1) Redisplay(D_fore ? D_fore->w_norefresh : 0); #endif } void ChangeScreenSize(wi, he, change_fore) int wi, he; int change_fore; { struct win *p; struct canvas *cv; int wwi; debug2("ChangeScreenSize from (%d,%d) ", D_width, D_height); debug3("to (%d,%d) (change_fore: %d)\n",wi, he, change_fore); cv = &D_canvas; cv->c_xe = wi - 1; cv->c_ye = he - 1 - ((cv->c_slperp && cv->c_slperp->c_slnext) || captionalways) - (D_has_hstatus == HSTATUS_LASTLINE); cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1; if (cv->c_slperp) { ResizeCanvas(cv); RecreateCanvasChain(); RethinkDisplayViewports(); } if (D_forecv == 0) D_forecv = D_cvlist; if (D_forecv) D_fore = Layer2Window(D_forecv->c_layer); D_width = wi; D_height = he; CheckMaxSize(wi); if (D_CWS) { D_defwidth = D_CO; D_defheight = D_LI; } else { if (D_CZ0 && (wi == Z0width || wi == Z1width) && (D_CO == Z0width || D_CO == Z1width)) D_defwidth = D_CO; else D_defwidth = wi; D_defheight = he; } debug2("Default size: (%d,%d)\n", D_defwidth, D_defheight); if (change_fore) ResizeLayersToCanvases(); if (change_fore == 2 && D_CWS == NULL && displays->d_next == 0) { /* adapt all windows - to be removed ? */ for (p = windows; p; p = p->w_next) { debug1("Trying to change window %d.\n", p->w_number); wwi = wi; #if 0 if (D_CZ0 && p->w_width != wi && (wi == Z0width || wi == Z1width)) { if (p->w_width > (Z0width + Z1width) / 2) wwi = Z0width; else wwi = Z1width; } #endif if (p->w_savelayer && p->w_savelayer->l_cvlist == 0) ResizeLayer(p->w_savelayer, wwi, he, 0); #if 0 ChangeWindowSize(p, wwi, he, p->w_histheight); #endif } } } void ResizeLayersToCanvases() { struct canvas *cv; struct layer *l; int lx, ly; debug("ResizeLayersToCanvases\n"); D_kaablamm = 0; for (cv = D_cvlist; cv; cv = cv->c_next) { l = cv->c_layer; if (l == 0) continue; debug("Doing canvas: "); if (l->l_width == cv->c_xe - cv->c_xs + 1 && l->l_height == cv->c_ye - cv->c_ys + 1) { debug("already fitting.\n"); continue; } if (!MayResizeLayer(l)) { debug("may not resize.\n"); } else { debug("doing resize.\n"); ResizeLayer(l, cv->c_xe - cv->c_xs + 1, cv->c_ye - cv->c_ys + 1, display); } /* normalize window, see screen.c */ lx = cv->c_layer->l_x; ly = cv->c_layer->l_y; if (ly + cv->c_yoff < cv->c_ys) { cv->c_yoff = cv->c_ys - ly; RethinkViewportOffsets(cv); } else if (ly + cv->c_yoff > cv->c_ye) { cv->c_yoff = cv->c_ye - ly; RethinkViewportOffsets(cv); } if (lx + cv->c_xoff < cv->c_xs) { int n = cv->c_xs - (lx + cv->c_xoff); if (n < (cv->c_xe - cv->c_xs + 1) / 2) n = (cv->c_xe - cv->c_xs + 1) / 2; if (cv->c_xoff + n > cv->c_xs) n = cv->c_xs - cv->c_xoff; cv->c_xoff += n; RethinkViewportOffsets(cv); } else if (lx + cv->c_xoff > cv->c_xe) { int n = lx + cv->c_xoff - cv->c_xe; if (n < (cv->c_xe - cv->c_xs + 1) / 2) n = (cv->c_xe - cv->c_xs + 1) / 2; if (cv->c_xoff - n + cv->c_layer->l_width - 1 < cv->c_xe) n = cv->c_xoff + cv->c_layer->l_width - 1 - cv->c_xe; cv->c_xoff -= n; RethinkViewportOffsets(cv); } } Redisplay(0); if (D_kaablamm) { kaablamm(); D_kaablamm = 0; } } int MayResizeLayer(l) struct layer *l; { int cvs = 0; debug("MayResizeLayer:\n"); for (; l; l = l->l_next) { if (l->l_cvlist) if (++cvs > 1 || l->l_cvlist->c_lnext) { debug1("may not - cvs %d\n", cvs); return 0; } } debug("may resize\n"); return 1; } /* * Easy implementation: rely on the fact that the only layers * supporting resize are Win and Blank. So just kill all overlays. * * This is a lot harder if done the right way... */ static void kaablamm() { Msg(0, "Aborted because of window size change."); } /* Kills non-resizable layers. */ #define RESIZE_OR_KILL_LAYERS(l, wi, he) do \ { \ struct layer *_last = NULL; \ flayer = (l); \ while (flayer->l_next) \ { \ if (LayResize(wi, he) == 0) \ { \ _last = flayer; \ flayer = flayer->l_next; \ } \ else \ { \ struct canvas *_cv; \ for (_cv = flayer->l_cvlist; _cv; _cv = _cv->c_lnext) \ _cv->c_display->d_kaablamm = 1; \ ExitOverlayPage(); \ if (_last) \ _last->l_next = flayer; \ } \ } \ /* We assume that the bottom-most layer, i.e. when flayer->l_next == 0, \ * is always resizable. Currently, WinLf and BlankLf can be the bottom-most layers. \ */ \ LayResize(wi, he); \ } while (0) void ResizeLayer(l, wi, he, norefdisp) struct layer *l; int wi, he; struct display *norefdisp; { struct win *p; struct canvas *cv; struct layer *oldflayer = flayer; struct display *d, *olddisplay = display; if (l->l_width == wi && l->l_height == he) return; p = Layer2Window(l); /* If 'flayer' and 'l' are for the same window, then we will not * restore 'flayer'. */ if (oldflayer && (l == oldflayer || Layer2Window(oldflayer) == p)) oldflayer = NULL; flayer = l; if (p) { /* It's a window layer. Kill the overlays on it in all displays. */ for (d = displays; d; d = d->d_next) for (cv = d->d_cvlist; cv; cv = cv->c_next) { if (p == Layer2Window(cv->c_layer)) { /* Canvas 'cv' on display 'd' shows this window. Remove any non-resizable * layers over it. */ RESIZE_OR_KILL_LAYERS(cv->c_layer, wi, he); } } } else { /* It's a Blank layer. Just kill the non-resizable overlays over it. */ RESIZE_OR_KILL_LAYERS(flayer, wi, he); } for (display = displays; display; display = display->d_next) { if (display == norefdisp) continue; for (cv = D_cvlist; cv; cv = cv->c_next) if (Layer2Window(cv->c_layer) == p) { CV_CALL(cv, LayRedisplayLine(-1, -1, -1, 0)); RefreshArea(cv->c_xs, cv->c_ys, cv->c_xe, cv->c_ye, 0); } if (D_kaablamm) { kaablamm(); D_kaablamm = 0; } } /* If we started resizing a non-flayer layer, then restore the flayer. * Otherwise, flayer should already be updated to the topmost foreground layer. */ if (oldflayer) flayer = oldflayer; display = olddisplay; } static void FreeMline(ml) struct mline *ml; { if (ml->image) free(ml->image); if (ml->attr && ml->attr != null) free(ml->attr); #ifdef FONT if (ml->font && ml->font != null) free(ml->font); if (ml->fontx && ml->fontx != null) free(ml->fontx); #endif #ifdef COLOR if (ml->color && ml->color != null) free(ml->color); # ifdef COLORS256 if (ml->colorx && ml->colorx != null) free(ml->colorx); # endif #endif *ml = mline_zero; } static int AllocMline(ml, w) struct mline *ml; int w; { ml->image = malloc(w); ml->attr = null; #ifdef FONT ml->font = null; ml->fontx = null; #endif #ifdef COLOR ml->color = null; # ifdef COLORS256 ml->colorx = null; # endif #endif if (ml->image == 0) return -1; return 0; } static int BcopyMline(mlf, xf, mlt, xt, l, w) struct mline *mlf, *mlt; int xf, xt, l, w; { int r = 0; bcopy((char *)mlf->image + xf, (char *)mlt->image + xt, l); if (mlf->attr != null && mlt->attr == null) { if ((mlt->attr = (unsigned char *)calloc(w, 1)) == 0) mlt->attr = null, r = -1; } if (mlt->attr != null) bcopy((char *)mlf->attr + xf, (char *)mlt->attr + xt, l); #ifdef FONT if (mlf->font != null && mlt->font == null) { if ((mlt->font = (unsigned char *)calloc(w, 1)) == 0) mlt->font = null, r = -1; } if (mlt->font != null) bcopy((char *)mlf->font + xf, (char *)mlt->font + xt, l); if (mlf->fontx != null && mlt->fontx == null) { if ((mlt->fontx = (unsigned char *)calloc(w, 1)) == 0) mlt->fontx = null, r = -1; } if (mlt->fontx != null) bcopy((char *)mlf->fontx + xf, (char *)mlt->fontx + xt, l); #endif #ifdef COLOR if (mlf->color != null && mlt->color == null) { if ((mlt->color = (unsigned char *)calloc(w, 1)) == 0) mlt->color = null, r = -1; } if (mlt->color != null) bcopy((char *)mlf->color + xf, (char *)mlt->color + xt, l); # ifdef COLORS256 if (mlf->colorx != null && mlt->colorx == null) { if ((mlt->colorx = (unsigned char *)calloc(w, 1)) == 0) mlt->colorx = null, r = -1; } if (mlt->colorx != null) bcopy((char *)mlf->colorx + xf, (char *)mlt->colorx + xt, l); # endif #endif return r; } static int maxwidth; static void CheckMaxSize(wi) int wi; { unsigned char *oldnull = null; unsigned char *oldblank = blank; struct win *p; int i; struct mline *ml; wi = ((wi + 1) + 255) & ~255; if (wi <= maxwidth) return; maxwidth = wi; debug1("New maxwidth: %d\n", maxwidth); blank = (unsigned char *)xrealloc((char *)blank, maxwidth); null = (unsigned char *)xrealloc((char *)null, maxwidth); mline_old.image = (unsigned char *)xrealloc((char *)mline_old.image, maxwidth); mline_old.attr = (unsigned char *)xrealloc((char *)mline_old.attr, maxwidth); #ifdef FONT mline_old.font = (unsigned char *)xrealloc((char *)mline_old.font, maxwidth); mline_old.fontx = (unsigned char *)xrealloc((char *)mline_old.fontx, maxwidth); #endif #ifdef COLOR mline_old.color = (unsigned char *)xrealloc((char *)mline_old.color, maxwidth); # ifdef COLORS256 mline_old.colorx = (unsigned char *)xrealloc((char *)mline_old.colorx, maxwidth); # endif #endif if (!(blank && null && mline_old.image && mline_old.attr IFFONT(&& mline_old.font) IFFONTX(&& mline_old.fontx) IFCOLOR(&& mline_old.color) IFCOLORX(&& mline_old.colorx))) Panic(0, "%s", strnomem); MakeBlankLine(blank, maxwidth); bzero((char *)null, maxwidth); mline_blank.image = blank; mline_blank.attr = null; mline_null.image = null; mline_null.attr = null; #ifdef FONT mline_blank.font = null; mline_null.font = null; mline_blank.fontx = null; mline_null.fontx = null; #endif #ifdef COLOR mline_blank.color = null; mline_null.color = null; # ifdef COLORS256 mline_blank.colorx = null; mline_null.colorx = null; # endif #endif #define RESET_AFC(x, bl) do { if (x == old##bl) x = bl; } while (0) #define RESET_LINES(lines, count) \ do { \ ml = lines; \ for (i = 0; i < count; i++, ml++) \ { \ RESET_AFC(ml->image, blank); \ RESET_AFC(ml->attr, null); \ IFFONT(RESET_AFC(ml->font, null)); \ IFFONT(RESET_AFC(ml->fontx, null)); \ IFCOLOR(RESET_AFC(ml->color, null)); \ IFCOLORX(RESET_AFC(ml->colorx, null)); \ } \ } while (0) /* We have to run through all windows to substitute * the null and blank references. */ for (p = windows; p; p = p->w_next) { RESET_LINES(p->w_mlines, p->w_height); #ifdef COPY_PASTE RESET_LINES(p->w_hlines, p->w_histheight); RESET_LINES(p->w_alt.hlines, p->w_alt.histheight); #endif RESET_LINES(p->w_alt.mlines, p->w_alt.height); } } char * xrealloc(mem, len) char *mem; int len; { register char *nmem; if (mem == 0) return malloc(len); if ((nmem = realloc(mem, len))) return nmem; free(mem); return (char *)0; } static void MakeBlankLine(p, n) register unsigned char *p; register int n; { while (n--) *p++ = ' '; } #ifdef COPY_PASTE #define OLDWIN(y) ((y < p->w_histheight) \ ? &p->w_hlines[(p->w_histidx + y) % p->w_histheight] \ : &p->w_mlines[y - p->w_histheight]) #define NEWWIN(y) ((y < hi) ? &nhlines[y] : &nmlines[y - hi]) #else #define OLDWIN(y) (&p->w_mlines[y]) #define NEWWIN(y) (&nmlines[y]) #endif int ChangeWindowSize(p, wi, he, hi) struct win *p; int wi, he, hi; { struct mline *mlf = 0, *mlt = 0, *ml, *nmlines, *nhlines; int fy, ty, l, lx, lf, lt, yy, oty, addone; int ncx, ncy, naka, t; int y, shift; if (wi <= 0 || he <= 0) wi = he = hi = 0; if (p->w_type == W_TYPE_GROUP) return 0; if (wi > 1000) { Msg(0, "Window width too large. Truncated to 1000."); wi = 1000; } if (he > 1000) { Msg(0, "Window height too large. Truncated to 1000."); he = 1000; } if (p->w_width == wi && p->w_height == he && p->w_histheight == hi) { debug("ChangeWindowSize: No change.\n"); return 0; } CheckMaxSize(wi); /* XXX */ #if 0 /* just in case ... */ if (wi && (p->w_width != wi || p->w_height != he) && p->w_lay != &p->w_winlay) { debug("ChangeWindowSize: No resize because of overlay?\n"); return -1; } #endif debug("ChangeWindowSize"); debug3(" from (%d,%d)+%d", p->w_width, p->w_height, p->w_histheight); debug3(" to(%d,%d)+%d\n", wi, he, hi); fy = p->w_histheight + p->w_height - 1; ty = hi + he - 1; nmlines = nhlines = 0; ncx = 0; ncy = 0; naka = 0; if (wi) { if (wi != p->w_width || he != p->w_height) { if ((nmlines = (struct mline *)calloc(he, sizeof(struct mline))) == 0) { KillWindow(p); Msg(0, "%s", strnomem); return -1; } } else { debug1("image stays the same: %d lines\n", he); nmlines = p->w_mlines; fy -= he; ty -= he; ncx = p->w_x; ncy = p->w_y; naka = p->w_autoaka; } } #ifdef COPY_PASTE if (hi) { if ((nhlines = (struct mline *)calloc(hi, sizeof(struct mline))) == 0) { Msg(0, "No memory for history buffer - turned off"); hi = 0; ty = he - 1; } } #endif /* special case: cursor is at magic margin position */ addone = 0; if (p->w_width && p->w_x == p->w_width) { debug2("Special addone case: %d %d\n", p->w_x, p->w_y); addone = 1; p->w_x--; } /* handle the cursor and autoaka lines now if the widths are equal */ if (p->w_width == wi) { ncx = p->w_x + addone; ncy = p->w_y + he - p->w_height; /* never lose sight of the line with the cursor on it */ shift = -ncy; for (yy = p->w_y + p->w_histheight - 1; yy >= 0 && ncy + shift < he; yy--) { ml = OLDWIN(yy); if (!ml->image) break; if (ml->image[p->w_width] == ' ') break; shift++; } if (shift < 0) shift = 0; else debug1("resize: cursor out of bounds, shifting %d\n", shift); ncy += shift; if (p->w_autoaka > 0) { naka = p->w_autoaka + he - p->w_height + shift; if (naka < 1 || naka > he) naka = 0; } while (shift-- > 0) { ml = OLDWIN(fy); FreeMline(ml); fy--; } } debug2("fy %d ty %d\n", fy, ty); if (fy >= 0) mlf = OLDWIN(fy); if (ty >= 0) mlt = NEWWIN(ty); while (fy >= 0 && ty >= 0) { if (p->w_width == wi) { /* here is a simple shortcut: just copy over */ *mlt = *mlf; *mlf = mline_zero; if (--fy >= 0) mlf = OLDWIN(fy); if (--ty >= 0) mlt = NEWWIN(ty); continue; } /* calculate lenght */ for (l = p->w_width - 1; l > 0; l--) if (mlf->image[l] != ' ' || mlf->attr[l]) break; if (fy == p->w_y + p->w_histheight && l < p->w_x) l = p->w_x; /* cursor is non blank */ l++; lf = l; /* add wrapped lines to length */ for (yy = fy - 1; yy >= 0; yy--) { ml = OLDWIN(yy); if (ml->image[p->w_width] == ' ') break; l += p->w_width; } /* rewrap lines */ lt = (l - 1) % wi + 1; /* lf is set above */ oty = ty; while (l > 0 && fy >= 0 && ty >= 0) { lx = lt > lf ? lf : lt; if (mlt->image == 0) { if (AllocMline(mlt, wi + 1)) goto nomem; MakeBlankLine(mlt->image + lt, wi - lt); mlt->image[wi] = ((oty == ty) ? ' ' : 0); } if (BcopyMline(mlf, lf - lx, mlt, lt - lx, lx, wi + 1)) goto nomem; /* did we copy the cursor ? */ if (fy == p->w_y + p->w_histheight && lf - lx <= p->w_x && lf > p->w_x) { ncx = p->w_x + lt - lf + addone; ncy = ty - hi; shift = wi ? -ncy + (l - lx) / wi : 0; if (ty + shift > hi + he - 1) shift = hi + he - 1 - ty; if (shift > 0) { debug3("resize: cursor out of bounds, shifting %d [%d/%d]\n", shift, lt - lx, wi); for (y = hi + he - 1; y >= ty; y--) { mlt = NEWWIN(y); FreeMline(mlt); if (y - shift < ty) continue; ml = NEWWIN(y - shift); *mlt = *ml; *ml = mline_zero; } ncy += shift; ty += shift; mlt = NEWWIN(ty); if (naka > 0) naka = naka + shift > he ? 0 : naka + shift; } ASSERT(ncy >= 0); } /* did we copy autoaka line ? */ if (p->w_autoaka > 0 && fy == p->w_autoaka - 1 + p->w_histheight && lf - lx <= 0) naka = ty - hi >= 0 ? 1 + ty - hi : 0; lf -= lx; lt -= lx; l -= lx; if (lf == 0) { FreeMline(mlf); lf = p->w_width; if (--fy >= 0) mlf = OLDWIN(fy); } if (lt == 0) { lt = wi; if (--ty >= 0) mlt = NEWWIN(ty); } } ASSERT(l != 0 || fy == yy); } while (fy >= 0) { FreeMline(mlf); if (--fy >= 0) mlf = OLDWIN(fy); } while (ty >= 0) { if (AllocMline(mlt, wi + 1)) goto nomem; MakeBlankLine(mlt->image, wi + 1); if (--ty >= 0) mlt = NEWWIN(ty); } #ifdef DEBUG if (nmlines != p->w_mlines) for (fy = 0; fy < p->w_height + p->w_histheight; fy++) { ml = OLDWIN(fy); ASSERT(ml->image == 0); } #endif if (p->w_mlines && p->w_mlines != nmlines) free((char *)p->w_mlines); p->w_mlines = nmlines; #ifdef COPY_PASTE if (p->w_hlines && p->w_hlines != nhlines) free((char *)p->w_hlines); p->w_hlines = nhlines; #endif /* change tabs */ if (p->w_width != wi) { if (wi) { t = p->w_tabs ? p->w_width : 0; p->w_tabs = xrealloc(p->w_tabs, wi + 1); if (p->w_tabs == 0) { nomem: if (nmlines) { for (ty = he + hi - 1; ty >= 0; ty--) { mlt = NEWWIN(ty); FreeMline(mlt); } if (nmlines && p->w_mlines != nmlines) free((char *)nmlines); #ifdef COPY_PASTE if (nhlines && p->w_hlines != nhlines) free((char *)nhlines); #endif } KillWindow(p); Msg(0, "%s", strnomem); if (nmlines) free(nmlines); if (nhlines) free(nhlines); return -1; } for (; t < wi; t++) p->w_tabs[t] = t && !(t & 7) ? 1 : 0; p->w_tabs[wi] = 0; } else { if (p->w_tabs) free(p->w_tabs); p->w_tabs = 0; } } /* Change w_saved.y - this is only an estimate... */ p->w_saved.y += ncy - p->w_y; p->w_x = ncx; p->w_y = ncy; if (p->w_autoaka > 0) p->w_autoaka = naka; /* do sanity checks */ if (p->w_x > wi) p->w_x = wi; if (p->w_y >= he) p->w_y = he - 1; if (p->w_saved.x > wi) p->w_saved.x = wi; if (p->w_saved.y >= he) p->w_saved.y = he - 1; if (p->w_saved.y < 0) p->w_saved.y = 0; if (p->w_alt.cursor.x > wi) p->w_alt.cursor.x = wi; if (p->w_alt.cursor.y >= he) p->w_alt.cursor.y = he - 1; if (p->w_alt.cursor.y < 0) p->w_alt.cursor.y = 0; /* reset scrolling region */ p->w_top = 0; p->w_bot = he - 1; /* signal new size to window */ #ifdef TIOCSWINSZ if (wi && (p->w_width != wi || p->w_height != he) && p->w_width != 0 && p->w_height != 0 && p->w_ptyfd >= 0 && p->w_pid) { glwz.ws_col = wi; glwz.ws_row = he; debug("Setting pty winsize.\n"); if (ioctl(p->w_ptyfd, TIOCSWINSZ, (char *)&glwz)) debug2("SetPtySize: errno %d (fd:%d)\n", errno, p->w_ptyfd); } #endif /* TIOCSWINSZ */ /* store new size */ p->w_width = wi; p->w_height = he; #ifdef COPY_PASTE p->w_histidx = 0; p->w_histheight = hi; #endif #ifdef BUILTIN_TELNET if (p->w_type == W_TYPE_TELNET) TelWindowSize(p); #endif #ifdef DEBUG /* Test if everything was ok */ for (fy = 0; fy < p->w_height + p->w_histheight; fy++) { ml = OLDWIN(fy); ASSERT(ml->image); # ifdef UTF8 if (p->w_encoding == UTF8) { for (l = 0; l < p->w_width; l++) ASSERT(ml->image[l] >= ' ' || ml->font[l] || ml->fontx); } else #endif for (l = 0; l < p->w_width; l++) ASSERT(ml->image[l] >= ' '); } #endif return 0; } void FreeAltScreen(p) struct win *p; { int i; if (p->w_alt.mlines) { for (i = 0; i < p->w_alt.height; i++) FreeMline(p->w_alt.mlines + i); free(p->w_alt.mlines); } p->w_alt.mlines = 0; p->w_alt.width = 0; p->w_alt.height = 0; #ifdef COPY_PASTE if (p->w_alt.hlines) { for (i = 0; i < p->w_alt.histheight; i++) FreeMline(p->w_alt.hlines + i); free(p->w_alt.hlines); } p->w_alt.hlines = 0; p->w_alt.histidx = 0; p->w_alt.histheight = 0; #endif } static void SwapAltScreen(p) struct win *p; { struct mline *ml; int t; #define SWAP(item, t) do { (t) = p->w_alt. item; p->w_alt. item = p->w_##item; p->w_##item = (t); } while (0) SWAP(mlines, ml); SWAP(width, t); SWAP(height, t); #ifdef COPY_PASTE SWAP(histheight, t); SWAP(hlines, ml); SWAP(histidx, t); #endif #undef SWAP } void EnterAltScreen(p) struct win *p; { if (!p->w_alt.on) { /* If not already using the alternate screen buffer, then create a new one and swap it with the 'real' screen buffer. */ FreeAltScreen(p); SwapAltScreen(p); } else { /* Already using the alternate buffer. Just clear the screen. To do so, it is only necessary to reset the height(s) without resetting the width. */ p->w_height = 0; p->w_histheight = 0; } ChangeWindowSize(p, p->w_alt.width, p->w_alt.height, p->w_alt.histheight); p->w_alt.on = 1; } void LeaveAltScreen(p) struct win *p; { if (!p->w_alt.on) return; SwapAltScreen(p); ChangeWindowSize(p, p->w_alt.width, p->w_alt.height, p->w_alt.histheight); FreeAltScreen(p); p->w_alt.on = 0; } screen-4.2.1/.iscreenrc0000644000175000017500000001516612326531270013665 0ustar amadeamade# # A sample .screenrc which I use for everyday work. # # some of the commands commented out here, have been moved to # /local/etc/screenrc # # we want no password, right? #password # This will ask us for a password. password none # Same as not even mentioning it. #password 12Bz/9hNlPLZk # "1234" #password YahtrWblnJw # ypmatch jnweiger passwd. Well, ... :-) scrollback 200 # we have a 200 lines history buffer markkeys "@=\177:@=^C" # our mad facit-twist terminal buffer overflow... markkeys "h=^B:l=^F:\$=^E" # some missing emacs style bindings in copymode echo -n "booting screen" # let it flash, not horn! #vbell on # "vbell" don't work any longer, sorry. #vbell_msg " Wuff, Wuff!! " # this is the default message #bell "Bimmmel No. %" # sounds the bell and shows a message # we want to login all windows we create. #login on # "login", "nologin" don't work any longer, sorry 2. echo -n "." # we have no termcap entry for screen on the target machine? Well then # we tell a lie. term screen # would be the obvious default here. #term vt100 # screen will understand vt100 for 99%. # we want to survive hangups # note that the default setting is off now! autodetach on # when we open a window, where shall its CWD be? chdir # without argument it's my $HOME echo -n "." # I hate nonexisting status lines! Force screen to believe me. #hardstatus off # now some Terminal setup: # Printing in the leftmost column is not save. We express that fact as :LP@: # # Emacs tends to smear it's highlighted status bar across the screen, producing # ugly areas of bright background, if termcap is'nt perfectly sober. # Give a little :ms@: in the termcap, this may help. # # And who invented the initialisation for facit terminals? We tell him that # we non't like smooth scroll, by specifying :ti=\E[?l:. # \E[?3l 80 Zeichen # \E[?3h 132 Zeichen # LP Last column Printable # \E[A cursor up # \E[B cursor down # \E[?4h smooth scroll # \E[?4l jump scroll # \E[%dL insert %d lines # \E[K clear to end of line # cs \E[%i%d;%dr for twist and xterm # ms@ Move in Standout mode is NOT save. # WS our private variable, it declares that the terminal can # be resized by an escape-sequence # The termcap statement takes 2 or three parameters. First parameter lists # which TERMCAPs are affected by this statement. Second we specify changes # in screen's view of that terminals. Third we may specify some capabilities # that user-programs want to see in the $TERMCAP environment variable or in # screen's termcap entry. termcap vt* cl=\E[H\E[J\E[?1h:vi=\E[?35h:ve=\E[35l:ti=\E[?4l[vt100] termcap facit ti=\E[?4l[facit] termcap xterm* is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l:Z0=\E[?3h:Z1=\E[?3l echo -n "." # "\E(B", "\E(0", "\E(1", "\E(2", ... to switch between charsets. # screen internally emulates G1: "\E)..", G2: "\E*..", G3: "\E+.." # you can switch between them, with: # # code | switch to # ------+------ # ^O | G0 # ^N | G1 # \En | G2 # \Eo | G3 #termcap facit|vt100|xterm* G0 # how do we resize windows? under sunview, this is standard, but xterm # needs to be a specially hacked xterm, to make this work. termcap xterm* WS=\E[8;%d;%dt # ICL 6402 testing: termcap icl* G0:S0=\E$[start]:E0=\E%[end]:C0=j9kx5 GS=\E(0^O:GE=\E(B^O:G1=k:G2=l:G3=m:G4=j:GV=x:GH=q:GR=u:GL=t:GU=w:GD=v:GC=n # Flowcontrol produces trouble. ^S und ^Q will never reach screen, as our # terminals catch them locally. Who can explain that to me?: #flow on|off|auto [interrupt] # Long Lines get wrapped around (the back of your terminal). This is the # default for vt100. But now programs make different asumptions about your # terminal. You may find two linefeeds where you'd expect one, or you may # be confronted with a truncated line. Currently there is no fix, but pressing # C-A r and doing a redraw. #wrap on # the autoaka allows you to see the currently executing shell command in the # window name field. To use that, your shell prompt must contain ^[k^[\ or # you will see the string "(init)" as a name. # in my .cshrc I may use this for a wonderfull tcsh-prompt: # set prompt="%{^[k^[\\%}%h %c2(%m)%# " # # defining a shellaka that contains a pipe-symbol (|) activites the # autoaka feature. To the left of that | you specify a constant part of # your prompt as a trigger, to the right you may place a default string # as in shellaka '> |tc' # but beware! specifying a window name with the -t option has priority over # the autoaka mechanism. Although specifying -t "> |foo" will work. # shellaka tc # ... now a little bit of key bindings # In case we don't have write permission for /etc/utmp (no s-bit) # we create even local windows via rlogin. -> Et voila: a utmp-slot # utmp-slots are strongly recomended to keep sccs and talk happy. # (thus we have ^A# or. ^Ac for windowcreation with or without utmp-slot.) # but if we run suid-root, we produce all the rlogins with -ln, # as nobody shall refer to these pty's. bind '!' screen -ln -k faui41 rlogin faui41 bind '@' screen -ln -k vme2 rlogin faui4_vme2 #bind '#' screen -k faui43 bind '#' screen -ln -k faui43 rlogin faui43 bind '$' screen -ln -k faui44 rlogin faui44 bind '%' screen -ln -k faui45 rlogin faui45 bind '\^' screen -ln -k sup1 rlogin fausup1 bind '&' screen -ln -k sup2 rlogin fausup2 bind '*' screen -ln -k faui48 rlogin faui48 bind '(' screen -ln -k faui09 rlogin faui09 bind ')' screen -ln -k faui10 rlogin faui10 bind 'J' screen -ln -k 4j rlogin faui4j bind 'P' screen -ln -k 4p rlogin faui4p bind '^C' screen -ln -k 45c rlogin faui45c bind '^D' screen -ln -k 45d rlogin faui45d bind '^E' screen -ln -k 45e rlogin faui45e bind '^I' screen -ln -k 45i rlogin faui45i # these two are logIn and logOut. As a toggle is too stupid. #bind 'I' set login on #bind 'O' set login off bind 'L' # What happens, when you 'think emacs' and want to erase a whole # line? You type ^A^K right? Under screen it should be ^Aa^K. But... # killing the window would be a real punishment for a little mistyping. bind k #wow! I even amange to type ^Ak by accident. #bind ^k #bind K kill echo -n "." #screen 1:faui43 # My good old : syntax #screen -k faui43 # The way Wayne Davison thinks about it. #screen -ln -k faui43 # this one not logged in. #screen -ln 2:faui09 rlogin faui09 -l jnweiger # Finally another bonus feature for people using strange terminal settings like # different baud rate, etc. The next user will get standard settings # as ^[c is a reset sequence. #pow_detach_msg "" # is the default pow_detach_msg "c" echo "done." screen-4.2.1/attacher.c0000644000175000017500000006214512326757071013656 0ustar amadeamade/* Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ #include "config.h" #include #include #include #include #include #include "screen.h" #include "extern.h" #include static int WriteMessage __P((int, struct msg *)); static sigret_t AttacherSigInt __P(SIGPROTOARG); #if defined(SIGWINCH) && defined(TIOCGWINSZ) static sigret_t AttacherWinch __P(SIGPROTOARG); #endif #ifdef LOCK static sigret_t DoLock __P(SIGPROTOARG); static void LockTerminal __P((void)); static sigret_t LockHup __P(SIGPROTOARG); static void screen_builtin_lck __P((void)); #endif #ifdef DEBUG static sigret_t AttacherChld __P(SIGPROTOARG); #endif static sigret_t AttachSigCont __P(SIGPROTOARG); extern int real_uid, real_gid, eff_uid, eff_gid; extern char *SockName, *SockMatch, SockPath[]; extern char HostName[]; extern struct passwd *ppp; extern char *attach_tty, *attach_term, *LoginName, *preselect; extern int xflag, dflag, rflag, quietflag, adaptflag; extern struct mode attach_Mode; extern struct NewWindow nwin_options; extern int MasterPid, attach_fd; #ifdef MULTIUSER extern char *multi; extern int multiattach, multi_uid, own_uid; extern int tty_mode, tty_oldmode; # ifndef USE_SETEUID static int multipipe[2]; # endif #endif static int ContinuePlease; static sigret_t AttachSigCont SIGDEFARG { debug("SigCont()\n"); ContinuePlease = 1; SIGRETURN; } static int QueryResult; static sigret_t QueryResultSuccess SIGDEFARG { QueryResult = 1; SIGRETURN; } static sigret_t QueryResultFail SIGDEFARG { QueryResult = 2; SIGRETURN; } /* * Send message to a screen backend. * returns 1 if we could attach one, or 0 if none. * Understands MSG_ATTACH, MSG_DETACH, MSG_POW_DETACH * MSG_CONT, MSG_WINCH and nothing else! * * if type == MSG_ATTACH and sockets are used, attaches * tty filedescriptor. */ static int WriteMessage(s, m) int s; struct msg *m; { int r, l = sizeof(*m); #ifndef NAMEDPIPE if (m->type == MSG_ATTACH) return SendAttachMsg(s, m, attach_fd); #endif while(l > 0) { r = write(s, (char *)m + (sizeof(*m) - l), l); if (r == -1 && errno == EINTR) continue; if (r == -1 || r == 0) return -1; l -= r; } return 0; } int Attach(how) int how; { int n, lasts; struct msg m; struct stat st; char *s; debug2("Attach: how=%d, tty=%s\n", how, attach_tty); #ifdef MULTIUSER # ifndef USE_SETEUID while ((how == MSG_ATTACH || how == MSG_CONT) && multiattach) { int ret; if (pipe(multipipe)) Panic(errno, "pipe"); if (chmod(attach_tty, 0666)) Panic(errno, "chmod %s", attach_tty); tty_oldmode = tty_mode; eff_uid = -1; /* make UserContext fork */ real_uid = multi_uid; if ((ret = UserContext()) <= 0) { char dummy; eff_uid = 0; real_uid = own_uid; if (ret < 0) Panic(errno, "UserContext"); close(multipipe[1]); read(multipipe[0], &dummy, 1); if (tty_oldmode >= 0) { chmod(attach_tty, tty_oldmode); tty_oldmode = -1; } ret = UserStatus(); #ifdef LOCK if (ret == SIG_LOCK) LockTerminal(); else #endif #ifdef SIGTSTP if (ret == SIG_STOP) kill(getpid(), SIGTSTP); else #endif if (ret == SIG_POWER_BYE) { int ppid; if (setgid(real_gid) || setuid(real_uid)) Panic(errno, "setuid/gid"); if ((ppid = getppid()) > 1) Kill(ppid, SIGHUP); exit(0); } else exit(ret); dflag = 0; #ifdef MULTI xflag = 1; #endif how = MSG_ATTACH; continue; } close(multipipe[0]); eff_uid = real_uid; break; } # else /* USE_SETEUID */ if ((how == MSG_ATTACH || how == MSG_CONT) && multiattach) { real_uid = multi_uid; eff_uid = own_uid; #ifdef HAVE_SETRESUID if (setresuid(multi_uid, own_uid, multi_uid)) Panic(errno, "setresuid"); #else xseteuid(multi_uid); xseteuid(own_uid); #endif if (chmod(attach_tty, 0666)) Panic(errno, "chmod %s", attach_tty); tty_oldmode = tty_mode; } # endif /* USE_SETEUID */ #endif /* MULTIUSER */ bzero((char *) &m, sizeof(m)); m.type = how; m.protocol_revision = MSG_REVISION; strncpy(m.m_tty, attach_tty, sizeof(m.m_tty) - 1); m.m_tty[sizeof(m.m_tty) - 1] = 0; if (how == MSG_WINCH) { if ((lasts = MakeClientSocket(0)) >= 0) { WriteMessage(lasts, &m); close(lasts); } return 0; } if (how == MSG_CONT) { if ((lasts = MakeClientSocket(0)) < 0) { Panic(0, "Sorry, cannot contact session \"%s\" again.\r\n", SockName); } } else { n = FindSocket(&lasts, (int *)0, (int *)0, SockMatch); switch (n) { case 0: if (rflag && (rflag & 1) == 0) return 0; if (quietflag) eexit(10); Panic(0, SockMatch && *SockMatch ? "There is no screen to be %sed matching %s." : "There is no screen to be %sed.", xflag ? "attach" : dflag ? "detach" : "resum", SockMatch); /* NOTREACHED */ case 1: break; default: if (rflag < 3) { if (quietflag) eexit(10 + n); Panic(0, "Type \"screen [-d] -r [pid.]tty.host\" to resume one of them."); } /* NOTREACHED */ } } /* * Go in UserContext. Advantage is, you can kill your attacher * when things go wrong. Any disadvantages? jw. * Do this before the attach to prevent races! */ #ifdef MULTIUSER if (!multiattach) #endif { if (setuid(real_uid)) Panic(errno, "setuid"); } #if defined(MULTIUSER) && defined(USE_SETEUID) else { /* This call to xsetuid should also set the saved uid */ xseteuid(real_uid); /* multi_uid, allow backend to send signals */ } #endif if (setgid(real_gid)) Panic(errno, "setgid"); eff_uid = real_uid; eff_gid = real_gid; debug2("Attach: uid %d euid %d\n", (int)getuid(), (int)geteuid()); MasterPid = 0; for (s = SockName; *s; s++) { if (*s > '9' || *s < '0') break; MasterPid = 10 * MasterPid + (*s - '0'); } debug1("Attach decided, it is '%s'\n", SockPath); debug1("Attach found MasterPid == %d\n", MasterPid); if (stat(SockPath, &st) == -1) Panic(errno, "stat %s", SockPath); if ((st.st_mode & 0600) != 0600) Panic(0, "Socket is in wrong mode (%03o)", (int)st.st_mode); /* * Change: if -x or -r ignore failing -d */ if ((xflag || rflag) && dflag && (st.st_mode & 0700) == 0600) dflag = 0; /* * Without -x, the mode must match. * With -x the mode is irrelevant unless -d. */ if ((dflag || !xflag) && (st.st_mode & 0700) != (dflag ? 0700 : 0600)) Panic(0, "That screen is %sdetached.", dflag ? "already " : "not "); #ifdef REMOTE_DETACH if (dflag && (how == MSG_DETACH || how == MSG_POW_DETACH)) { m.m.detach.dpid = getpid(); strncpy(m.m.detach.duser, LoginName, sizeof(m.m.detach.duser) - 1); m.m.detach.duser[sizeof(m.m.detach.duser) - 1] = 0; # ifdef POW_DETACH if (dflag == 2) m.type = MSG_POW_DETACH; else # endif m.type = MSG_DETACH; /* If there is no password for the session, or the user enters the correct * password, then we get a SIGCONT. Otherwise we get a SIG_BYE */ signal(SIGCONT, AttachSigCont); if (WriteMessage(lasts, &m)) Panic(errno, "WriteMessage"); close(lasts); while (!ContinuePlease) pause(); /* wait for SIGCONT */ signal(SIGCONT, SIG_DFL); ContinuePlease = 0; if (how != MSG_ATTACH) return 0; /* we detached it. jw. */ sleep(1); /* we dont want to overrun our poor backend. jw. */ if ((lasts = MakeClientSocket(0)) == -1) Panic(0, "Cannot contact screen again. Sigh."); m.type = how; } #endif ASSERT(how == MSG_ATTACH || how == MSG_CONT); strncpy(m.m.attach.envterm, attach_term, sizeof(m.m.attach.envterm) - 1); m.m.attach.envterm[sizeof(m.m.attach.envterm) - 1] = 0; debug1("attach: sending %d bytes... ", (int)sizeof(m)); strncpy(m.m.attach.auser, LoginName, sizeof(m.m.attach.auser) - 1); m.m.attach.auser[sizeof(m.m.attach.auser) - 1] = 0; m.m.attach.esc = DefaultEsc; m.m.attach.meta_esc = DefaultMetaEsc; strncpy(m.m.attach.preselect, preselect ? preselect : "", sizeof(m.m.attach.preselect) - 1); m.m.attach.preselect[sizeof(m.m.attach.preselect) - 1] = 0; m.m.attach.apid = getpid(); m.m.attach.adaptflag = adaptflag; m.m.attach.lines = m.m.attach.columns = 0; if ((s = getenv("LINES"))) m.m.attach.lines = atoi(s); if ((s = getenv("COLUMNS"))) m.m.attach.columns = atoi(s); m.m.attach.encoding = nwin_options.encoding > 0 ? nwin_options.encoding + 1 : 0; #ifdef REMOTE_DETACH #ifdef POW_DETACH if (dflag == 2) m.m.attach.detachfirst = MSG_POW_DETACH; else #endif if (dflag) m.m.attach.detachfirst = MSG_DETACH; else #endif m.m.attach.detachfirst = MSG_ATTACH; #ifdef MULTIUSER /* setup CONT signal handler to repair the terminal mode */ if (multi && (how == MSG_ATTACH || how == MSG_CONT)) signal(SIGCONT, AttachSigCont); #endif if (WriteMessage(lasts, &m)) Panic(errno, "WriteMessage"); close(lasts); debug1("Attach(%d): sent\n", m.type); #ifdef MULTIUSER if (multi && (how == MSG_ATTACH || how == MSG_CONT)) { while (!ContinuePlease) pause(); /* wait for SIGCONT */ signal(SIGCONT, SIG_DFL); ContinuePlease = 0; # ifndef USE_SETEUID close(multipipe[1]); # else xseteuid(own_uid); if (tty_oldmode >= 0) if (chmod(attach_tty, tty_oldmode)) Panic(errno, "chmod %s", attach_tty); tty_oldmode = -1; xseteuid(real_uid); # endif } #endif rflag = 0; return 1; } static int AttacherPanic = 0; #ifdef DEBUG static sigret_t AttacherChld SIGDEFARG { AttacherPanic = 1; SIGRETURN; } #endif static sigret_t AttacherSigAlarm SIGDEFARG { #ifdef DEBUG static int tick_cnt = 0; if ((tick_cnt = (tick_cnt + 1) % 4) == 0) debug("tick\n"); #endif SIGRETURN; } /* * the frontend's Interrupt handler * we forward SIGINT to the poor backend */ static sigret_t AttacherSigInt SIGDEFARG { signal(SIGINT, AttacherSigInt); Kill(MasterPid, SIGINT); SIGRETURN; } /* * Unfortunately this is also the SIGHUP handler, so we have to * check if the backend is already detached. */ sigret_t AttacherFinit SIGDEFARG { struct stat statb; struct msg m; int s; debug("AttacherFinit();\n"); signal(SIGHUP, SIG_IGN); /* Check if signal comes from backend */ if (stat(SockPath, &statb) == 0 && (statb.st_mode & 0777) != 0600) { debug("Detaching backend!\n"); bzero((char *) &m, sizeof(m)); strncpy(m.m_tty, attach_tty, sizeof(m.m_tty) - 1); m.m_tty[sizeof(m.m_tty) - 1] = 0; debug1("attach_tty is %s\n", attach_tty); m.m.detach.dpid = getpid(); m.type = MSG_HANGUP; m.protocol_revision = MSG_REVISION; if ((s = MakeClientSocket(0)) >= 0) { WriteMessage(s, &m); close(s); } } #ifdef MULTIUSER if (tty_oldmode >= 0) { if (setuid(own_uid)) Panic(errno, "setuid"); chmod(attach_tty, tty_oldmode); } #endif exit(0); SIGRETURN; } #ifdef POW_DETACH static sigret_t AttacherFinitBye SIGDEFARG { int ppid; debug("AttacherFintBye()\n"); #if defined(MULTIUSER) && !defined(USE_SETEUID) if (multiattach) exit(SIG_POWER_BYE); #endif if (setgid(real_gid)) Panic(errno, "setgid"); #ifdef MULTIUSER if (setuid(own_uid)) Panic(errno, "setuid"); #else if (setuid(real_uid)) Panic(errno, "setuid"); #endif /* we don't want to disturb init (even if we were root), eh? jw */ if ((ppid = getppid()) > 1) Kill(ppid, SIGHUP); /* carefully say good bye. jw. */ exit(0); SIGRETURN; } #endif #if defined(DEBUG) && defined(SIG_NODEBUG) static sigret_t AttacherNoDebug SIGDEFARG { debug("AttacherNoDebug()\n"); signal(SIG_NODEBUG, AttacherNoDebug); if (dfp) { debug("debug: closing debug file.\n"); fflush(dfp); fclose(dfp); dfp = NULL; } SIGRETURN; } #endif /* SIG_NODEBUG */ static int SuspendPlease; static sigret_t SigStop SIGDEFARG { debug("SigStop()\n"); SuspendPlease = 1; SIGRETURN; } #ifdef LOCK static int LockPlease; static sigret_t DoLock SIGDEFARG { # ifdef SYSVSIGS signal(SIG_LOCK, DoLock); # endif debug("DoLock()\n"); LockPlease = 1; SIGRETURN; } #endif #if defined(SIGWINCH) && defined(TIOCGWINSZ) static int SigWinchPlease; static sigret_t AttacherWinch SIGDEFARG { debug("AttacherWinch()\n"); SigWinchPlease = 1; SIGRETURN; } #endif /* * Attacher loop - no return */ void Attacher() { signal(SIGHUP, AttacherFinit); signal(SIG_BYE, AttacherFinit); #ifdef POW_DETACH signal(SIG_POWER_BYE, AttacherFinitBye); #endif #if defined(DEBUG) && defined(SIG_NODEBUG) signal(SIG_NODEBUG, AttacherNoDebug); #endif #ifdef LOCK signal(SIG_LOCK, DoLock); #endif signal(SIGINT, AttacherSigInt); #ifdef BSDJOBS signal(SIG_STOP, SigStop); #endif #if defined(SIGWINCH) && defined(TIOCGWINSZ) signal(SIGWINCH, AttacherWinch); #endif #ifdef DEBUG signal(SIGCHLD, AttacherChld); #endif debug("attacher: going for a nap.\n"); dflag = 0; #ifdef MULTI xflag = 1; #endif for (;;) { signal(SIGALRM, AttacherSigAlarm); alarm(15); pause(); alarm(0); if (kill(MasterPid, 0) < 0 && errno != EPERM) { debug1("attacher: Panic! MasterPid %d does not exist.\n", MasterPid); AttacherPanic++; } if (AttacherPanic) { fcntl(0, F_SETFL, 0); SetTTY(0, &attach_Mode); printf("\nError: Cannot find master process to attach to!\n"); eexit(1); } #ifdef BSDJOBS if (SuspendPlease) { SuspendPlease = 0; #if defined(MULTIUSER) && !defined(USE_SETEUID) if (multiattach) exit(SIG_STOP); #endif signal(SIGTSTP, SIG_DFL); debug("attacher: killing myself SIGTSTP\n"); kill(getpid(), SIGTSTP); debug("attacher: continuing from stop\n"); signal(SIG_STOP, SigStop); (void) Attach(MSG_CONT); } #endif #ifdef LOCK if (LockPlease) { LockPlease = 0; #if defined(MULTIUSER) && !defined(USE_SETEUID) if (multiattach) exit(SIG_LOCK); #endif LockTerminal(); # ifdef SYSVSIGS signal(SIG_LOCK, DoLock); # endif (void) Attach(MSG_CONT); } #endif /* LOCK */ #if defined(SIGWINCH) && defined(TIOCGWINSZ) if (SigWinchPlease) { SigWinchPlease = 0; # ifdef SYSVSIGS signal(SIGWINCH, AttacherWinch); # endif (void) Attach(MSG_WINCH); } #endif /* SIGWINCH */ } } #ifdef LOCK /* ADDED by Rainer Pruy 10/15/87 */ /* POLISHED by mls. 03/10/91 */ static char LockEnd[] = "Welcome back to screen !!\n"; static sigret_t LockHup SIGDEFARG { int ppid = getppid(); if (setgid(real_gid)) Panic(errno, "setgid"); #ifdef MULTIUSER if (setuid(own_uid)) Panic(errno, "setuid"); #else if (setuid(real_uid)) Panic(errno, "setuid"); #endif if (ppid > 1) Kill(ppid, SIGHUP); exit(0); } static void LockTerminal() { char *prg; int sig, pid; sigret_t (*sigs[NSIG])__P(SIGPROTOARG); for (sig = 1; sig < NSIG; sig++) sigs[sig] = signal(sig, sig == SIGCHLD ? SIG_DFL : SIG_IGN); signal(SIGHUP, LockHup); printf("\n"); prg = getenv("LOCKPRG"); if (prg && strcmp(prg, "builtin") && !access(prg, X_OK)) { signal(SIGCHLD, SIG_DFL); debug1("lockterminal: '%s' seems executable, execl it!\n", prg); if ((pid = fork()) == 0) { /* Child */ if (setgid(real_gid)) Panic(errno, "setgid"); #ifdef MULTIUSER if (setuid(own_uid)) Panic(errno, "setuid"); #else if (setuid(real_uid)) /* this should be done already */ Panic(errno, "setuid"); #endif closeallfiles(0); /* important: /etc/shadow may be open */ execl(prg, "SCREEN-LOCK", NULL); exit(errno); } if (pid == -1) Msg(errno, "Cannot lock terminal - fork failed"); else { #ifdef BSDWAIT union wait wstat; #else int wstat; #endif int wret; #ifdef hpux signal(SIGCHLD, SIG_DFL); #endif errno = 0; while (((wret = wait(&wstat)) != pid) || ((wret == -1) && (errno == EINTR)) ) errno = 0; if (errno) { Msg(errno, "Lock"); sleep(2); } else if (WTERMSIG(wstat) != 0) { fprintf(stderr, "Lock: %s: Killed by signal: %d%s\n", prg, WTERMSIG(wstat), WIFCORESIG(wstat) ? " (Core dumped)" : ""); sleep(2); } else if (WEXITSTATUS(wstat)) { debug2("Lock: %s: return code %d\n", prg, WEXITSTATUS(wstat)); } else printf("%s", LockEnd); } } else { if (prg) { debug1("lockterminal: '%s' seems NOT executable, we use our builtin\n", prg); } else { debug("lockterminal: using buitin.\n"); } screen_builtin_lck(); } /* reset signals */ for (sig = 1; sig < NSIG; sig++) { if (sigs[sig] != (sigret_t(*)__P(SIGPROTOARG)) -1) signal(sig, sigs[sig]); } } /* LockTerminal */ #ifdef USE_PAM /* * PAM support by Pablo Averbuj */ #include static int PAM_conv __P((int, const struct pam_message **, struct pam_response **, void *)); static int PAM_conv(num_msg, msg, resp, appdata_ptr) int num_msg; const struct pam_message **msg; struct pam_response **resp; void *appdata_ptr; { int replies = 0; struct pam_response *reply = NULL; reply = malloc(sizeof(struct pam_response)*num_msg); if (!reply) return PAM_CONV_ERR; #define COPY_STRING(s) (s) ? strdup(s) : NULL for (replies = 0; replies < num_msg; replies++) { switch (msg[replies]->msg_style) { case PAM_PROMPT_ECHO_OFF: /* wants password */ reply[replies].resp_retcode = PAM_SUCCESS; reply[replies].resp = appdata_ptr ? strdup((char *)appdata_ptr) : 0; break; case PAM_TEXT_INFO: /* ignore the informational mesage */ /* but first clear out any drek left by malloc */ reply[replies].resp = NULL; break; case PAM_PROMPT_ECHO_ON: /* user name given to PAM already */ /* fall through */ default: /* unknown or PAM_ERROR_MSG */ free(reply); return PAM_CONV_ERR; } } *resp = reply; return PAM_SUCCESS; } static struct pam_conv PAM_conversation = { &PAM_conv, NULL }; #endif /* -- original copyright by Luigi Cannelloni 1985 (luigi@faui70.UUCP) -- */ static void screen_builtin_lck() { char fullname[100], *cp1, message[100 + 100]; #ifdef USE_PAM pam_handle_t *pamh = 0; int pam_error; char *tty_name; #endif char *pass = 0, mypass[16 + 1], salt[3]; int using_pam = 1; #ifdef USE_PAM if (!ppp->pw_uid) { #endif using_pam = 0; pass = ppp->pw_passwd; if (pass == 0 || *pass == 0) { if ((pass = getpass("Key: "))) { strncpy(mypass, pass, sizeof(mypass) - 1); mypass[sizeof(mypass) - 1] = 0; if (*mypass == 0) return; if ((pass = getpass("Again: "))) { if (strcmp(mypass, pass)) { fprintf(stderr, "Passwords don't match.\007\n"); sleep(2); return; } } } if (pass == 0) { fprintf(stderr, "Getpass error.\007\n"); sleep(2); return; } salt[0] = 'A' + (int)(time(0) % 26); salt[1] = 'A' + (int)((time(0) >> 6) % 26); salt[2] = 0; pass = crypt(mypass, salt); if (!pass) { fprintf(stderr, "crypt() error.\007\n"); sleep(2); return; } pass = ppp->pw_passwd = SaveStr(pass); } #ifdef USE_PAM } #endif debug("screen_builtin_lck looking in gcos field\n"); strncpy(fullname, ppp->pw_gecos, sizeof(fullname) - 9); fullname[sizeof(fullname) - 9] = 0; if ((cp1 = index(fullname, ',')) != NULL) *cp1 = '\0'; if ((cp1 = index(fullname, '&')) != NULL) { strncpy(cp1, ppp->pw_name, 8); cp1[8] = 0; if (*cp1 >= 'a' && *cp1 <= 'z') *cp1 -= 'a' - 'A'; } sprintf(message, "Screen used by %s%s<%s> on %s.\nPassword:\007", fullname, fullname[0] ? " " : "", ppp->pw_name, HostName); /* loop here to wait for correct password */ for (;;) { debug("screen_builtin_lck awaiting password\n"); errno = 0; if ((cp1 = getpass(message)) == NULL) { AttacherFinit(SIGARG); /* NOTREACHED */ } if (using_pam) { #ifdef USE_PAM PAM_conversation.appdata_ptr = cp1; pam_error = pam_start("screen", ppp->pw_name, &PAM_conversation, &pamh); if (pam_error != PAM_SUCCESS) AttacherFinit(SIGARG); /* goodbye */ if (strncmp(attach_tty, "/dev/", 5) == 0) tty_name = attach_tty + 5; else tty_name = attach_tty; pam_error = pam_set_item(pamh, PAM_TTY, tty_name); if (pam_error != PAM_SUCCESS) AttacherFinit(SIGARG); /* goodbye */ pam_error = pam_authenticate(pamh, 0); pam_end(pamh, pam_error); PAM_conversation.appdata_ptr = 0; if (pam_error == PAM_SUCCESS) break; #endif } else { char *buf = crypt(cp1, pass); if (buf && !strncmp(buf, pass, strlen(pass))) break; } debug("screen_builtin_lck: NO!!!!!\n"); bzero(cp1, strlen(cp1)); } bzero(cp1, strlen(cp1)); debug("password ok.\n"); } #endif /* LOCK */ void SendCmdMessage(sty, match, av, query) char *sty; char *match; char **av; int query; { int i, s; struct msg m; char *p; int len, n; if (sty == 0) { i = FindSocket(&s, (int *)0, (int *)0, match); if (i == 0) Panic(0, "No screen session found."); if (i != 1) Panic(0, "Use -S to specify a session."); } else { #ifdef NAME_MAX if (strlen(sty) > NAME_MAX) sty[NAME_MAX] = 0; #endif if (strlen(sty) > 2 * MAXSTR - 1) sty[2 * MAXSTR - 1] = 0; sprintf(SockPath + strlen(SockPath), "/%s", sty); if ((s = MakeClientSocket(1)) == -1) exit(1); } bzero((char *)&m, sizeof(m)); m.type = query ? MSG_QUERY : MSG_COMMAND; if (attach_tty) { strncpy(m.m_tty, attach_tty, sizeof(m.m_tty) - 1); m.m_tty[sizeof(m.m_tty) - 1] = 0; } p = m.m.command.cmd; n = 0; for (; *av && n < MAXARGS - 1; ++av, ++n) { len = strlen(*av) + 1; if (p + len >= m.m.command.cmd + sizeof(m.m.command.cmd) - 1) break; strcpy(p, *av); p += len; } *p = 0; m.m.command.nargs = n; strncpy(m.m.attach.auser, LoginName, sizeof(m.m.attach.auser) - 1); m.m.command.auser[sizeof(m.m.command.auser) - 1] = 0; m.protocol_revision = MSG_REVISION; strncpy(m.m.command.preselect, preselect ? preselect : "", sizeof(m.m.command.preselect) - 1); m.m.command.preselect[sizeof(m.m.command.preselect) - 1] = 0; m.m.command.apid = getpid(); debug1("SendCommandMsg writing '%s'\n", m.m.command.cmd); if (query) { /* Create a server socket so we can get back the result */ char *sp = SockPath + strlen(SockPath); char query[] = "-queryX"; char c; int r = -1; for (c = 'A'; c <= 'Z'; c++) { query[6] = c; strcpy(sp, query); /* XXX: strncpy? */ if ((r = MakeServerSocket()) >= 0) break; } if (r < 0) { for (c = '0'; c <= '9'; c++) { query[6] = c; strcpy(sp, query); if ((r = MakeServerSocket()) >= 0) break; } } if (r < 0) Panic(0, "Could not create a listening socket to read the results."); strncpy(m.m.command.writeback, SockPath, sizeof(m.m.command.writeback) - 1); m.m.command.writeback[sizeof(m.m.command.writeback) - 1] = '\0'; /* Send the message, then wait for a response */ signal(SIGCONT, QueryResultSuccess); signal(SIG_BYE, QueryResultFail); if (WriteMessage(s, &m)) Msg(errno, "write"); close(s); while (!QueryResult) pause(); signal(SIGCONT, SIG_DFL); signal(SIG_BYE, SIG_DFL); /* Read the result and spit it out to stdout */ ReceiveRaw(r); unlink(SockPath); if (QueryResult == 2) /* An error happened */ exit(1); } else { if (WriteMessage(s, &m)) Msg(errno, "write"); close(s); } } screen-4.2.1/list_generic.h0000644000175000017500000000510612326710533014521 0ustar amadeamade/* Copyright (c) 2010 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ struct ListData; struct ListRow { void *data; /* Some data relevant to this row */ struct ListRow *next, *prev; /* doubly linked list */ int y; /* -1 if not on display */ }; struct GenericList { int (*gl_printheader) __P((struct ListData *)); /* Print the header */ int (*gl_printfooter) __P((struct ListData *)); /* Print the footer */ int (*gl_printrow) __P((struct ListData *, struct ListRow *)); /* Print one row */ int (*gl_pinput) __P((struct ListData *, char **inp, int *len)); /* Process input */ int (*gl_freerow) __P((struct ListData *, struct ListRow *)); /* Free data for a row */ int (*gl_free) __P((struct ListData *)); /* Free data for the list */ int (*gl_matchrow) __P((struct ListData *, struct ListRow *, const char *)); }; struct ListData { const char *name; /* An identifier for the list */ struct ListRow *root; /* The first item in the list */ struct ListRow *selected; /* The selected row */ struct ListRow *top; /* The topmost visible row */ struct GenericList *list_fn; /* The functions that deal with the list */ char *search; /* The search term, if any */ void *data; /* List specific data */ }; extern struct LayFuncs ListLf; struct ListRow * glist_add_row __P((struct ListData *ldata, void *data, struct ListRow *after)); void glist_remove_rows __P((struct ListData *ldata)); void glist_display_all __P((struct ListData *list)); struct ListData * glist_display __P((struct GenericList *list, const char *name)); void glist_abort __P((void)); void display_displays __P((void)); void display_windows __P((int onblank, int order, struct win *group)); screen-4.2.1/NEWS0000644000175000017500000000135212326531270012376 0ustar amadeamade ------------------------------ What's new in screen-4.0.3 ? ------------------------------ * zombie command has new option 'onerror' * buffer overflow in resize.c fixed * minor docu update * more robust startup * use setresuid; SendAttachMsg() for fd-passing added; DoCSI enhanced. ------------------------------ What's new in screen-4.0.0 ? ------------------------------ * new screenrc parser, not 100% compatible. * screenblanker support: new 'idle', 'blanker', 'blankerprg' commands. * zmodem support via the 'zmodem' command. * nonblock code rewritten, nonblock now understands a timeout. new command 'defnonblock'. screen-4.2.1/etc/0000755000175000017500000000000012326531270012451 5ustar amadeamadescreen-4.2.1/etc/toolcheck0000755000175000017500000000223212326531270014351 0ustar amadeamade#!/bin/sh # toolcheck -- check for tools that have severe bugs. Good that all the buggy # tools identify by version numbers. This is the spirit of GNU :-) # # 24.7.95 jw. retval=0 reply="`sh -version 2>&1 < /dev/null | sed q`" case "$reply" in GNU*1.14.3*) echo "- sh is '$reply'"; echo " CAUTION: This shell has a buggy 'trap' command."; echo " The configure script may fail silently."; retval=1; ;; GNU*1.14.2*|GNU*1.14.4*|GNU*1.13.*) echo "- sh is '$reply' - good."; ;; GNU*) echo "- sh is '$reply'."; ;; *) ;; esac reply="`sed --version 2>&1 < /dev/null | sed q`" case "$reply" in GNU\ sed\ version\ 2.0[34]) echo "- sed is '$reply'"; echo " CAUTION: This sed cannot configure screen properly." retval=1; ;; GNU\ sed\ version\ 2.05|GNU\ sed\ version\ 2.03\ kevin) echo "- sed is '$reply' - good."; ;; GNU*) echo "- sed is '$reply'."; ;; *) ;; esac if [ "$retval" != 0 ]; then echo " ***********************************************************" echo " Please fix the above problem before reporting a screen bug!" echo " ***********************************************************" fi exit $retval screen-4.2.1/etc/etcscreenrc0000644000175000017500000000636012326531270014701 0ustar amadeamade# # This is an example for the global screenrc file. # You may want to install this file as /usr/local/etc/screenrc. # Check config.h for the exact location. # # Flaws of termcap and standard settings are done here. # #startup_message off #defflow on # will force screen to process ^S/^Q deflogin on #autodetach off vbell on vbell_msg " Wuff ---- Wuff!! " # all termcap entries are now duplicated as terminfo entries. # only difference should be the slightly modified syntax, and check for # terminfo entries, that are already corected in the database. # # G0 we have a SEMI-GRAPHICS-CHARACTER-MODE # WS this sequence resizes our window. # cs this sequence changes the scrollregion # hs@ we have no hardware statusline. screen will only believe that # there is a hardware status line if hs,ts,fs,ds are all set. # ts to statusline # fs from statusline # ds delete statusline # al add one line # AL add multiple lines # dl delete one line # DL delete multiple lines # ic insert one char (space) # IC insert multiple chars # nx terminal uses xon/xoff termcap facit|vt100|xterm LP:G0 terminfo facit|vt100|xterm LP:G0 #the vt100 description does not mention "dl". *sigh* termcap vt100 dl=5\E[M terminfo vt100 dl=5\E[M #facit's "al" / "dl" are buggy if the current / last line #contain attributes... termcap facit al=\E[L\E[K:AL@:dl@:DL@:cs=\E[%i%d;%dr:ic@ terminfo facit al=\E[L\E[K:AL@:dl@:DL@:cs=\E[%i%p1%d;%p2%dr:ic@ #make sun termcap/info better termcap sun 'up=^K:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:IC=\E[%d@:WS=1000\E[8;%d;%dt' terminfo sun 'up=^K:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC:IC=\E[%p1%d@:WS=\E[8;%p1%d;%p2%dt$<1000>' #xterm understands both im/ic and doesn't have a status line. #Note: Do not specify im and ic in the real termcap/info file as #some programs (e.g. vi) will (no,no, may (jw)) not work anymore. termcap xterm|fptwist hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l terminfo xterm|fptwist hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l # Long time I had this in my private screenrc file. But many people # seem to want it (jw): # we do not want the width to change to 80 characters on startup: # on suns, /etc/termcap has :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l: termcap xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l' terminfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l' # # Do not use xterms alternate window buffer. # This one would not add lines to the scrollback buffer. #termcap xterm|xterms|xs ti=\E7\E[?47l #terminfo xterm|xterms|xs ti=\E7\E[?47l #make hp700 termcap/info better termcap hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@' terminfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@' #wyse-75-42 must have defflow control (xo = "terminal uses xon/xoff") #(nowadays: nx = padding doesn't work, have to use xon/off) #essential to have it here, as this is a slow terminal. termcap wy75-42 nx:xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h terminfo wy75-42 nx:xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h #remove some stupid / dangerous key bindings bind ^k #bind L bind ^\ #make them better bind \\ quit bind K kill bind I login on bind O login off bind } history screen-4.2.1/etc/gr-braille.tbl0000644000175000017500000002277612326531270015212 0ustar amadeamade# GERMAN BRAILLE TABLE # # Dec Hex Braille Description # ------------------------------------------------------------------------ 0 00 (--345--8) NUL 1 01 (1------8) SOH 2 02 (12-----8) STX 3 03 (1--4---8) ETX 4 04 (1--45--8) EOT 5 05 (1---5--8) ENQ 6 06 (12-4---8) ACK 7 07 (12-45--8) BEL 8 08 (12--5--8) BS 9 09 (-2-4---8) HT 10 OA (-2-45--8) LF 11 0B (1-3----8) VT 12 OC (123----8) FF 13 0D (1-34---8) CR 14 0E (1-345--8) SO 15 OF (1-3-5--8) SI 16 10 (1234---8) DLE 17 11 (12345--8) DC1 18 12 (123-5--8) DC2 19 13 (-234---8) DC3 20 14 (-2345--8) DC4 21 15 (1-3--6-8) NAK 22 16 (123--6-8) SYN 23 17 (-2-456-8) ETB 24 18 (1-34-6-8) CAN 25 19 (1-3456-8) EM 26 1A (1-3-56-8) SUB 27 lB (123-56-8) ESC 28 lC (--34---8) FS 29 1D (-23456-8) GS 30 lE (-234-6-8) RS 31 1F (---456-8) US 32 20 (--------) Space 33 21 (----5---) ! 34 22 (---4----) " 35 23 (--3456--) # 36 24 (---4-6--) $ 37 25 (123456--) % 38 26 (1234-6--) & 39 27 (-----6--) ' 40 28 (-23--6--) ( 41 29 (--3-56--) ) 42 2A (--3-5---) * 43 2B (-23-5---) + 44 2C (-2------) , 45 2D (--3--6--) - 46 2E (--3-----) . 47 2F (-2--56--) / 48 30 (--34-6--) 0 49 31 (1----6--) 1 50 32 (12---6--) 2 51 33 (1--4-6--) 3 52 34 (1--456--) 4 53 35 (1---56--) 5 54 36 (12-4-6--) 6 55 37 (12-456--) 7 56 38 (12--56--) 8 57 39 (-2-4-6--) 9 58 3A (-2--5---) : 59 3B (-23-----) ; 60 3C (----56--) < 61 3D (-23-56--) 62 3E (---45---) > 63 3F (-2---6--) ? 64 40 (--345---) Special sign 65 41 (1-----7-) A 66 42 (12----7-) B 67 43 (1--4--7-) C 68 44 (1--45-7-) D 69 45 (1---5-7-) E 70 46 (12-4--7-) F 71 47 (12-45-7-) G 72 48 (12--5-7-) H 73 49 (-2-4--7-) I 74 4A (-2-45-7-) j 75 4B (1-3---7-) K 76 4C (123---7-) L 77 4D (1-34--7-) M 78 4E (1-345-7-) N 79 4F (1-3-5-7-) O 80 50 (1234--7-) P 81 51 (12345-7-) Q 82 52 (123-5-7-) R 83 53 (-234--7-) S 84 54 (-2345-7-) T 85 55 (1-3--67-) U 86 56 (123--67-) V 87 57 (-2-4567-) W 88 58 (1-34-67-) X 89 59 (1-34567-) Y 90 5A (1-3-567-) Z 91 5B (123-567-) [ or A umlaut 92 5C (--34--7-) \ or umlaut O 93 5D (-234567-) ] or umlaut U 94 5E (-234-67-) ^ or tilde 95 5F (---456--) _ 96 60 (--345--8) ' 97 61 (1-------) a 98 62 (12------) b 99 63 (1--4----) c 100 64 (1--45---) d 101 65 (1---5---) e 102 66 (12-4----) f 103 67 (12-45---) g 104 68 (12--5---) h 105 69 (-2-4----) i 106 6A (-2-45---) j 107 6B (1-3-----) k 108 6C (123-----) l 109 6D (1-34----) m 110 6E (1-345---) n 111 6F (1-3-5---) o 112 70 (1234----) p 113 71 (12345---) q 114 72 (123-5---) r 115 73 (-234----) s 116 74 (-2345---) t 117 75 (1-3--6--) u 118 76 (123--6--) v 119 77 (-2-456--) w 120 78 (1-34-6--) x 121 79 (1-3456--) y 122 7A (1-3-56--) z 123 7B (123-56--) { or umlaut a 124 7C (--34----) | or umlaut o 125 7D (-23456--) } or umlaut u 126 7E (-234-6--) ' 127 7F (---456-8) DEL 128 80 (1234-67-) C Cedilla (upper case) 129 81 (12-456--) u Umlaut (lower case) 130 82 (123456-8) e Acute (lower case) 131 83 (1----6-8) a Circumflex 132 84 (123-56--) a Umlaut (lower case) 133 85 (123-56-8) a Grave 134 86 (-2-----8) a Ring (lower case) 135 87 (1234-6-8) c Cedilla (lower case) 136 88 (12---6-8) e Circumflex 137 89 (12-4-6-8) e Umlaut (lower case) 138 8A (-234-6-8) e Grave 139 8B (12-456-8) i Umlaut (lower case) 140 8C (1--4-6-8) i Circumflex 141 8D (-2-4---8) I Grave 142 8E (123-567-) A Umlaut (upper case) 143 8F (1----67-) A Ring (upper case) 144 90 (1234567-) E Acute (upper case) 145 91 (123-56--) ae Digraph (lower case) 146 92 (123-567-) AE Digraph (upper case) 147 93 (1--456-8) o Circumflex 148 94 (--34----) o Umlaut (lower case) 149 95 (--34-6-8) o Grave 150 96 (1---56-8) u Circumflex 151 97 (-23456-8) u Grave 152 98 (1-3456-8) y Umlaut 153 99 (--34--7-) O Umlaut (upper case) 154 9A (-234567-) U Umlaut (upper case) 155 9B (-23-5678) Cent 156 9C (----56-8) Pound/Sterling 157 9D (-2--5678) Yen 158 9E (-23-5--8) Peseta 159 9F (12-4---8) Franc 160 A0 (-23--678) a Acute (lower case) 161 Al (----5-7-) i Acute (lower case) 162 A2 (----5-78) o Acute (lower case) 163 A3 (--3-5678) u Acute (lower case) 164 A4 (1-345--8) n Tilde (lower case) 165 A5 (--345-7-) N Tilde (upper case) 166 A6 (1------8) Feminine Spanish Ordinal 167 A7 (1-3-5--8) Masculine Spanish Ordinal 168 A8 (--3----8) Inverted Question Mark 169 A9 (--3--67-) Left square corner 170 AA (--3--6-8) Right square corner 171 AB (-23----8) 1/2 172 AC (-2--56-8) 1/4 173 AD (----5--8) Inverted Exclamation Mark 174 AE (--3----8) Left Double Guillemet 175 AF (--3---7-) Right Double Guillemet 176 B0 (--34-67-) Box [Shade 1] 177 B1 (---4-678) Box [Shade 2] 178 B2 (12---67-) Box [Shade 3] 179 B3 (1--4-67-) Box [top bottom] 180 B4 (1--4567-) Box [left top bottom] 181 B5 (1---567-) Box [LEFT top bottom] 182 B6 (12-4-67-) Box [left TOP BOTTOM] 183 B7 (12-4567-) Box [left BOTTOM] 184 B8 (12--567-) Box [LEFT bottom] 185 B9 (-2-4-67-) Box [LEFT TOP BOTTOM] 186 BA (-2--5-7-) Box [TOP BOTTOM] 187 BB (-23---7-) Box [LEFT BOTTOM] 188 BC (----567-) Box [LEFT TOP] 189 BD (-23-567-) Box [left TOP] 190 BE (---45-7-) Box [LEFT top] 191 BF (-2---67-) Box [left bottom] 192 CO (--345--8) Box [top right] 193 C1 (--3---78) Box [left top right] 194 C2 (1--45678) Box [left right bottom] 195 C3 (-2-4-678) Box [top right bottom] 196 C4 (1--45--8) Box [left right] 197 C5 (1---5--8) Box [left top right bottom] 198 C6 (-2--5-78) Box [top RIGHT bottom] 199 C7 (12-45--8) Box [TOP right BOTTOM] 200 C8 (------78) Box [TOP RIGHT] 201 C9 (-2--5--8) Box [RIGHT BOTTOM] 202 CA (-2-45--8) Box [LEFT TOP RIGHT] 203 CB (1-3----8) Box [LEFT RIGHT BOTTOM] 204 CC (123----8) Box [TOP RIGHT BOTTOM] 205 CD (1-34---8) Box [LEFT RIGHT] 206 CE (---4--78) Box [LEFT TOP RIGHT BOTTOM] 207 CF (--345678) Box [LEFT top RIGHT] 208 DO (123----8) Box [left TOP right] 209 D1 (12345--8) Box [LEFT RIGHT bottom] 210 D2 (123-5--8) Box [left right BOTTOM] 211 D3 (-234---8) Box [TOP right] 212 D4 (-2345--8) Box [top RIGHT] 213 D5 (1-3--6-8) Box [RIGHT bottom] 214 D6 (123--6-8) Box [right BOTTOM] 215 D7 (-2-456-8) Box [left TOP right BOTTOM] 216 D8 (1-34-6-8) Box [LEFT top RIGHT bottom] 217 D9 (12345678) Box [left top] 218 DA (1-3-56-8) Box [right bottom] 219 DB (-----678) Box [Shade 4] 220 DC (--34-678) Box [box bottom] 221 DD (1234-678) Box [box right] 222 DE (--3-5-78) Box [box left] 223 DF (---4567-) Box [box top] 224 E0 (------7-) Alpha (lower case) 225 E1 (-234-6--) Beta (lower case) 226 E2 (-23-5-78) Gamma (upper case) 227 E3 (-23-5-7-) Pi (lower case) 228 E4 (---4-6-8) Sigma (upper case) 229 E5 (-2----78) Sigma (lower case) 230 E6 (--3--678) Mu (lower case) 231 E7 (-----6-8) Tau (lower case) 232 E8 (-23--6-8) Phi (upper case) 233 E9 (--3-56-8) Theta (lower case) 234 EA (--3-5--8) Omega (upper case) 235 EB (1----678) Delta (lower case) 236 EC (12---678) infinity 237 ED (1--4-678) Phi (lower case) 238 EE (1---5678) Epsilon (lower case) 239 EF (12-4-678) Intersection 240 F0 (12-45678) Equivalent (Member) 241 F1 (12--5678) Plus or minus 242 F2 (------7-) Greater than or equal 243 F3 (--34567-) Less than or equal 244 F4 (---4-67-) Integral [top] 245 F5 (-23---78) Integral [bottom] 246 F6 (-----67-) Division 247 F7 (-23--67-) Approximately equal 248 F8 (12--56-8) Small circle 249 F9 (-2-4-6-8) Bullet 250 FA (-2--5--8) Small bullet 251 FB (--3-567-) Bent Radical 252 FC (----56-8) Power of n 253 FD (-23-56-8) Power of 2 254 FE (---45--8) Large square bullet 255 FF (-2---6-8) blank (hard space) screen-4.2.1/etc/ccdefs0000755000175000017500000000143712326531270013633 0ustar amadeamade#!/bin/sh cd /tmp umask 022 CC=cc CPP=cpp PATH="$PATH:/lib" TEMP=def$$ trap 'rm -f ${TEMP}*; trap 0; exit' 0 1 2 3 15 set `type $CC` q=$# set x `type $CC` shift $q cc=$1 set `type $CPP` q=$# set x `type $CPP` shift $q cpp=$1 strings - "$cc" 2>/dev/null | tr ' ' '\012' > ${TEMP}.x if test -x "$cpp"; then strings - "$cpp" 2>/dev/null | tr ' ' '\012' >> ${TEMP}.x else echo "Warning: cpp not found." fi sort < ${TEMP}.x | uniq | awk ' /^-D[A-Za-z_][A-Za-z_0-9]*$/ { printf("#ifdef %s\n", substr($0,3)) printf("\"%s\": %s\n", substr($0,3), substr($0,3)) print "#endif" } /^[A-Za-z_][A-Za-z_0-9]*$/ { printf("#ifdef %s\n", $0) printf("\"%s\": %s\n", $0, $0) print "#endif" } ' > ${TEMP}.c echo "Defines in cc are:" cc -E ${TEMP}.c | sed -n -e 's/"\([^:]*\)":/\1:/p' | sort | uniq screen-4.2.1/etc/countmail0000755000175000017500000000255212326531270014376 0ustar amadeamade#!/usr/bin/perl sub countmsgs { return -1 unless open(M, "<$mbox"); my $inhdr = 0; my $cl = undef; my $msgread = 0; my $count = 0; while() { if (!$inhdr && /^From\s+\S+\s+(?i:sun|mon|tue|wed|thu|fri|sat)\s+(?i:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\s+\d+\s/) { $inhdr = 1; $msgread = 0; undef $cl; next; } if ($inhdr) { if (/^content-length:\s+(\d+)/i) { $cl = 0+$1; next; } if (/^status:\s+(\S)/i) { $msgread = 1 unless $1 eq 'N' || $1 eq 'U'; next; } if ($_ eq "\n") { $count++ if !$msgread; seek(M, $cl, 1) if defined $cl; $inhdr = 0; } } } close M; return $count; } $| = 1; $mbox = $ARGV[0] || $ENV{'MAIL'}; $oldfmt = $ARGV[1] || "%4d "; $newfmt = $ARGV[2] || "\005{Rk}%4d \005{-}"; @oldstat = stat($mbox); if (!@oldstat) { print "\005{Rk} ??? \005{-}\n"; exit 1; } $oldcount = 0; while(1) { $count = countmsgs($mbox); if ($count == -1) { print "\005{Rk} ??? \005{-}\n"; } elsif ($count < $oldcount || $count == 0) { printf "$oldfmt\n", $count; } else { printf "$newfmt\n", $count; } $oldcount = $count; while (1) { @newstat = stat($mbox); if (!@newstat) { print "\005{Rk} ??? \005{-}\n"; exit 1; } last if $newstat[7] != $oldstat[7] || $newstat[9] != $oldstat[9]; sleep 1; } @oldstat = @newstat; } screen-4.2.1/etc/screenrc0000644000175000017500000000722112326531270014202 0ustar amadeamade# # Example of a user's .screenrc file # # This is how one can set a reattach password: # password ODSJQf.4IJN7E # "1234" # no annoying audible bell, please vbell on # detach on hangup autodetach on # don't display the copyright page startup_message off # emulate .logout message pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." # advertise hardstatus support to $TERMCAP # termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\' # make the shell in every window a login shell #shell -$SHELL # autoaka testing # shellaka '> |tcsh' # shellaka '$ |sh' # set every new windows hardstatus line to somenthing descriptive # defhstatus "screen: ^En (^Et)" defscrollback 1000 # don't kill window after the process died # zombie "^[" # enable support for the "alternate screen" capability in all windows # altscreen on ################ # # xterm tweaks # #xterm understands both im/ic and doesn't have a status line. #Note: Do not specify im and ic in the real termcap/info file as #some programs (e.g. vi) will not work anymore. termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l #80/132 column switching must be enabled for ^AW to work #change init sequence to not switch width termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l # Make the output buffer large for (fast) xterms. #termcapinfo xterm* OL=10000 termcapinfo xterm* OL=100 # tell screen that xterm can switch to dark background and has function # keys. termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l' termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~' termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~' # special xterm hardstatus: use the window title. termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' #terminfo xterm 'vb=\E[?5h$<200/>\E[?5l' termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l' # emulate part of the 'K' charset termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' # xterm-52 tweaks: # - uses background color for delete operations termcapinfo xterm* be ################ # # wyse terminals # #wyse-75-42 must have flow control (xo = "terminal uses xon/xoff") #essential to have it here, as this is a slow terminal. termcapinfo wy75-42 xo:hs@ # New termcap sequences for cursor application mode. termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J ################ # # other terminals # # make hp700 termcap/info better termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@' # Extend the vt100 desciption by some sequences. termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC termcapinfo linux C8 # old rxvt versions also need this # termcapinfo rxvt C8 ################ # # keybindings # #remove some stupid / dangerous key bindings bind k bind ^k bind . bind ^\ bind \\ bind ^h bind h #make them better bind 'K' kill bind 'I' login on bind 'O' login off bind '}' history # Yet another hack: # Prepend/append register [/] to the paste if ^a^] is pressed. # This lets me have autoindent mode in vi. register [ "\033:se noai\015a" register ] "\033:se ai\015a" bind ^] paste [.] ################ # # default windows # # screen -t local 0 # screen -t mail 1 mutt # screen -t 40 2 rlogin server # caption always "%3n %t%? @%u%?%? [%h]%?%=%c" # hardstatus alwaysignore # hardstatus alwayslastline "%Lw" # bind = resize = # bind + resize +1 # bind - resize -1 # bind _ resize max # # defnonblock 1 # blankerprg rain -d 100 # idle 30 blanker screen-4.2.1/etc/mkinstalldirs0000755000175000017500000000115312326531270015257 0ustar amadeamade#!/bin/sh # Make directory hierarchy. # Written by Noah Friedman # Public domain. defaultIFS=' ' IFS="${IFS-${defaultIFS}}" errstatus=0 for file in ${1+"$@"} ; do oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' for d in ${1+"$@"} ; do pathcomp="${pathcomp}${d}" if test ! -d "${pathcomp}"; then echo "mkdir $pathcomp" 1>&2 mkdir "${pathcomp}" || errstatus=$? fi pathcomp="${pathcomp}/" done done exit $errstatus # eof screen-4.2.1/etc/completer.zsh0000644000175000017500000000725112326531270015176 0ustar amadeamade#compdef screen #Generated by # help2simple.pl -c screen -p -f # simple2long.xsl # args.xsl # For details see: # http://www.geocities.com/f_rosencrantz/xml_completion.htm local context state line typeset -A opt_args _arguments \ "-a[Force all capabilities into each window's termcap.]" \ '-A:Adapt all windows to the new display width & height.' \ "-c:Read configuration file instead of '.screenrc'.:_files -/" \ '-d:Detach the elsewhere running screen (with -r: reattach here).:->sessionname' \ '-dmS:Start as daemon: Screen session in detached mode.' \ '-D:Detach and logout remote (with -r: reattach here).' \ '-e:Change command characters.' \ '-f-:Flow control on, -fn = off, -fa = auto.:((n\:Flow\ conrol\ off a\:Flow\ conrol\ auto))' \ '-h:Set the size of the scrollback history buffer.' \ '-i[Interrupt output sooner when flow control is on.]' \ '-l[Login mode on (update /var/run/utmp), -ln = off.]' \ '-list[Do nothing, just list our SockDir.]' \ '-ls[Do nothing, just list our SockDir.]' \ "-L[Terminal's last character can be safely updated.]" \ '-m[ignore $STY variable, do create a new screen session.]' \ '-O[Choose optimal output rather than exact vt100 emulation.]' \ '-p:Preselect the named window if it exists.' \ '-q[Quiet startup. Exits with non-zero return code if unsuccessful.]' \ '-r[Reattach to a detached screen process.]:Handling Tag sessionname:->sessionname' \ '-R[Reattach if possible, otherwise start a new session.]' \ '-s:Shell to execute rather than $SHELL.' \ '-S:Name this session .sockname instead of ...' \ "-t:Set title. (window's name)." \ '-T:Use term as $TERM for windows, rather than "screen".' \ '-U[Tell screen to use UTF-8 encoding.]' \ '-v[Print "Screen version 3.09.11beta (FAU) 11-Oct-01".]' \ '-wipe[Do nothing, just clean up SockDir.]' \ '-x[Attach to a not detached screen. (Multi display mode).]' \ '-X[Execute as a screen command in the specified session.]:Handling Tag screencmd:( acladd addacl aclchg acldel aclgrp aclumask activity allpartial at attrcolor autodetach autonuke bce bell_msg bind bindkey break breaktype bufferfile c1 caption charset chdir clear colon command compacthist console copy copy_reg crlf debug defc1 defautonuke defbce defbreaktype defcharset defescape defflow defgr defhstatus defkanji deflogin defmode defmonitor defobuflimit defscrollback defshell defsilence defslowpaste defutf8 defwrap defwritelock defzombie detach dinfo displays digraph dumptermcap echo escape exec fit flow focus gr hardcopy hardcopy_append hardcopydir hardstatus height help history hstatus info ins_reg kill lastmsg license lockscreen log logfile login logtstamp mapdefault mapnotnext maptimeout markkeys meta monitor msgminwait msgwait multiuser nethack next nonblock number obu! ! flimit only other partial password paste pastefont pow_break pow_detach pow_detach_msg prev printcmd process quit readbuf readreg redisplay register remove removebuf reset resize screen scrollback select sessionname setenv shell shelltitle silence silencewait sleep slowpaste sorendition split startup_message stuff su term termcap terminfo termcapinfo time title unsetenv utf8 vbell vbell_msg vbellwait verbose version wall width windows wrap writebuf writelock xoff xon zombie defzombie)' case $state in "sessionname") # Complete folder names. local screendir screendir=(`screen -ls | grep Socket | sed -n -e 's/\.$//' -e '$p' | awk '{print $NF;}'`) _wanted files expl 'screen process' _path_files -W screendir ;; esac screen-4.2.1/etc/gs-braille.tbl0000644000175000017500000002376712326531270015214 0ustar amadeamade# GS BRAILLE TABLE # # Dec Hex Braille Description # ------------------------------------------------------------------------ 0 0 (--------) NUL 1 1 (--------) SOH 2 2 (--------) STX 3 3 (--------) ETX 4 4 (--------) EOT 5 5 (--------) ENQ 6 6 (--------) ACK 7 7 (--------) BEL 8 8 (--------) BS 9 9 (--------) HT 10 A (--------) LF 11 B (--------) VT 12 C (--------) FF 13 D (--------) CR 14 E (--------) SO 15 F (--------) SI 16 10 (--------) DLE 17 11 (--------) DC1 18 12 (--------) DC2 19 13 (--------) DC3 20 14 (--------) DC4 21 15 (--------) NAK 22 16 (--------) SYN 23 17 (--------) ETB 24 18 (--------) CAN 25 19 (--------) EM 26 1A (--------) SUB 27 1B (--------) ESC 28 1C (--------) FS 29 1D (--------) GS 30 1E (--------) RS 31 1F (--------) US 32 20 (--------) space 33 21 (-23-5---) bang 34 22 (--3--678) unidirectional double quote 35 23 (----5678) # (number or hash) symbol 36 24 (--34567-) $ 37 25 (--34---8) % symbol 38 26 (-23-5-78) & symbol 39 27 (--3-----) apostrophe 40 28 (-23----8) left parenthesis symbol 41 29 (----567-) right parenthesis symbol 42 2A (--34--7-) asterisk 43 2B (-2--5-7-) plus symbol 44 2C (-2------) comma 45 2D (--3--6--) dash, also used as over/under bar. 46 2E (-2--56--) period, decimal point 47 2F (--34--78) / symbol 48 30 (-2-45-78) zero 49 31 (1-----78) one 50 32 (12----78) two 51 33 (1--4--78) three 52 34 (1--45-78) four 53 35 (1---5-78) five 54 36 (12-4--78) six 55 37 (12-45-78) seven 56 38 (12--5-78) eight 57 39 (-2-4--78) nine 58 3A (-2--5---) colon 59 3B (-23-----) semicolon 60 3C (1234567-) open angle bracket 61 3D (-2--5-78) equals symbol 62 3E (123456-8) close angle bracket 63 3F (-23--6--) question mark 64 40 (--345-78) @ sign 65 41 (1-----7-) A 66 42 (12----7-) B 67 43 (1--4--7-) C 68 44 (1--45-7-) D 69 45 (1---5-7-) E 70 46 (12-4--7-) F 71 47 (12-45-7-) G 72 48 (12--5-7-) H 73 49 (-2-4--7-) I 74 4A (-2-45-7-) J 75 4B (1-3---7-) K 76 4C (123---7-) L 77 4D (1-34--7-) M 78 4E (1-345-7-) N 79 4F (1-3-5-7-) O 80 50 (1234--7-) P 81 51 (12345-7-) Q 82 52 (123-5-7-) R 83 53 (-234--7-) S 84 54 (-2345-7-) T 85 55 (1-3--67-) U 86 56 (123--67-) V 87 57 (-2-4567-) W 88 58 (1-34-67-) X 89 59 (1-34567-) Y 90 5A (1-3-567-) Z 91 5B (-23--678) [ symbol 92 5C (1----678) \ symbol 93 5D (--3-5678) ] symbol 94 5E (--345-7-) ^ 95 5F (-2---6-8) _ 96 60 (--3----8) opening single quote 97 61 (1-------) a 98 62 (12------) b 99 63 (1--4----) c 100 64 (1--45---) d 101 65 (1---5---) e 102 66 (12-4----) f 103 67 (12-45---) g 104 68 (12--5---) h 105 69 (-2-4----) i 106 6A (-2-45---) j 107 6B (1-3-----) k 108 6C (123-----) l 109 6D (1-34----) m 110 6E (1-345---) n 111 6F (1-3-5---) o 112 70 (1234----) p 113 71 (12345---) q 114 72 (123-5---) r 115 73 (-234----) s 116 74 (-2345---) t 117 75 (1-3--6--) u 118 76 (123--6--) v 119 77 (-2-456--) w 120 78 (1-34-6--) x 121 79 (1-3456--) y 122 7A (1-3-56--) z 123 7B (123-5678) { symbol 124 7C (--34-678) | 125 7D (-2345678) } symbol 126 7E (--34-67-) ~ 127 7F (1--4-678) del, nabla sign 128 80 (--3-5-7-) negative power indicator 129 81 (--34-67-) ~ 130 82 (--3---78) opening double quote 131 83 (--34----) complex fraction line indicator 132 84 (--3-5-78) left superscript 133 85 (--345678) start extended math mode 134 86 (-23---7-) end of line in 2-D array 135 87 (-23--67-) right arrow sign 136 88 (-23-567-) proportional to sign 137 89 (-23---78) ` (grave accent) 138 8A (-234-678) integral sign 139 8B (-23-5678) identically equals sign 140 8C (--3-5--8) < (less) symbol 141 8D (-2---67-) > (greater) symbol 142 8E (123--678) end extended math mode. 143 8F (12345678) infinity sign 144 90 (1--4-6--) overscript indicator 145 91 (1---56--) slashed symbol or NOT indicator 146 92 (1--456--) function indicator 147 93 (---45-7-) bold symbol indicator 148 94 (---4-67-) italic symbol indicator 149 95 (---4567-) special (text default=underlined) symbol indicator 150 96 (------78) minus sign 151 97 (---4--78) gothic font symbol indicator 152 98 (----5-78) divide by sign 153 99 (---45-78) special font 1 symbol indicator 154 9A (-----678) closing double quote 155 9B (---4-678) special font 2 symbol indicator 156 9C (---45678) special font 3 symbol indicator 157 9D (-2----78) times cross sign 158 9E (-2---678) left subscript 159 9F (--3---7-) end of element in 2-D array 160 A0 (-2-4-6--) radical indicator 161 A1 (-----67-) closing single quote 162 A2 (----5---) In 8 dot code in shapes and as a soft hyphen. 163 A3 (---45---) To be used for foreign indicators and/or phonetic indicators. 164 A4 (-----6--) 04 never appears in 8 dot code except shapes. 165 A5 (---4-6--) 05 never appears in 8 dot code except shapes. 166 A6 (----56--) grade 1 indicator in both codes. 167 A7 (---456--) Converts upper cell to cell + dot-67, other root to root + dot-78. 168 A8 (-------8) Under user control can indicate hyperlinks or font enhancements or... 169 A9 (---4---8) start shape beginning with 01 and ending at first root cell 170 AA (----5--8) start shape beginning with 02 171 AB (---45--8) start shape beginning with 03 172 AC (-----6-8) start shape beginning with 04 173 AD (---4-6-8) start shape beginning with 05 174 AE (----56-8) start shape beginning with 06 175 AF (---456-8) start shape beginning with 07 176 B0 (1--4---8) Copyright sign 177 B1 (1--4-6-8) partial differential sign 178 B2 (-2---6--) subscript indicator 179 B3 (1------8) alpha 180 B4 (12-----8) beta 181 B5 (12-45--8) gamma 182 B6 (1--45--8) delta 183 B7 (1---5--8) epsilon 184 B8 (1-3-56-8) zeta 185 B9 (1---56-8) eta 186 BA (1--456-8) theta 187 BB (-2-4---8) iota 188 BC (1-3----8) kappa 189 BD (123----8) lambda 190 BE (1-34---8) mu 191 BF (1-345--8) nu 192 C0 (1-34-6-8) xi 193 C1 (1-3-5--8) omichron 194 C2 (1234---8) pi 195 C3 (123-5--8) rho 196 C4 (-234---8) sigma 197 C5 (-2345--8) tau 198 C6 (1-3--6-8) upsilon 199 C7 (12-4---8) phi 200 C8 (1234-6-8) chi 201 C9 (1-3456-8) psi 202 CA (-2-456-8) omega 203 CB (1----67-) cap Alpha 204 CC (12---67-) cap Beta 205 CD (12-4567-) cap Gamma 206 CE (1--4567-) cap Delta 207 CF (1---567-) cap Epsilon 208 D0 (1-3-5678) cap zeta 209 D1 (1---5678) cap Eta 210 D2 (1--45678) cap Theta 211 D3 (-2-4-67-) cap Iota 212 D4 (1-3---78) cap kappa 213 D5 (123---78) cap lambda 214 D6 (1-34--78) cap mu 215 D7 (1-345-78) cap nu 216 D8 (1-34-678) cap xi 217 D9 (1-3-5-78) cap omichron 218 DA (1234--78) cap pi 219 DB (123-5-78) cap rho 220 DC (-234--78) cap sigma 221 DD (-2345-78) cap tau 222 DE (1-3--678) cap upsilon 223 DF (12-4-67-) cap Phi 224 E0 (1234-678) cap chi 225 E1 (1-345678) cap psi 226 E2 (-2-45678) cap omega 227 E3 (-2--5--8) times dot sign 228 E4 (-2-45--8) small circle sign 229 E5 (-2-4-6-8) radical sign, not operator 230 E6 (12---6--) open braille bracket 231 E7 (12-4-6--) horizontal combination symbol indicator 232 E8 (12--56--) vertical stack symbol indicator 233 E9 (12-456--) superimposed combination symbol indicator 234 EA (12--56-8) absolute value bar sign 235 EB (--3-5---) superscript indicator 236 EC (--345---) close braille bracket 237 ED (--34-6--) underscript indicator 238 EE (--3-56--) start math word indicator 239 EF (--3456--) Number indicator (6 dot code) 240 F0 (---4----) Accent mark 241 F1 (--3--6-8) ellipses sign 242 F2 (--34-6-8) dagger, transpose sign 243 F3 (--3-56-8) left arrow sign 244 F4 (--3456-8) UK pound 245 F5 (-234-6--) two dimensional array indicator 246 F6 (1----6--) simple fraction line indicator 247 F7 (-23-56--) contraction indicator. 248 F8 (-23456--) close fraction indicator 249 F9 (-234-6-8) end of two dimensional array 250 FA (-23-56-8) approximately equals sign, single tilde over single bar. 251 FB (1234-6--) Large symbol indicator. 252 FC (123-56--) open fraction indicator 253 FD (123456--) quantity indicator 254 FE (------7-) prime mark 255 FF (---4--7-) script font symbol indicator screen-4.2.1/etc/newsyntax380000755000175000017500000000373612326531270014623 0ustar amadeamade#! /bin/sh # # newsyntax38 -- update a screenrc file from 3.3 to 3.8 syntax # # Please bring your scripts up to syntax level 3.3 before running this script. # Please check all comments after running this script and watch out # for funny passages. # # * aka and shellaka are replaced by title and shelltitle. # # * Pairs of termcap and terminfo commands are folded into a single # termcapinfo command where possible. # # * trailing blanks are zapped. Unintentionally. # # 12.10.95, jnweiger, use at your own risk. # if [ $# != 1 ]; then echo "usage $0 screenrcfile" echo "" echo "The named file will be updated in place to the syntax of screen 3.8" echo "A backup copy will be written to .bak" exit 1; fi #Ultrix 4.2 /bin/sh does not handle "read a < $1" #Dean Gaudet exec < $1 read a if [ "$a" = "#3.8" ]; then echo "$1 already updated" exit 0 fi rm -f $1.old $1.dups cp $1 $1.old echo "#3.8" > $1 echo "# Do not remove the above line. This screen rc file was updated" >> $1 echo "# by the newsyntax script." >> $1 # termcap and terminfo lines can only be folded when there is no parameter # expansion in the codes. Parameters are denoted differently in # termcap and termcap syntax. Everything else is identical, I assume. # Thus codes not containing '%' can be savely folded. sed < $1.old > $1.dups \ -e 's/^\([ #]*\)aka/\1title/' \ -e 's/^\([ #]*\)shellaka/\1shelltitle/' \ -e 's/^\([ #]*\)termcap[ ][ ]*\([^%]*$\)/\1termcapinfo \2/' \ -e 's/^\([ #]*\)terminfo[ ][ ]*\([^%]*$\)/\1termcapinfo \2/' \ -e 's/\\/\\\\/g' # Oh, my bourne shell seems to gobble backslashes while reading. # Thus the sed above duplicates them in advance. # Hope this is not just another silly bash featureism. # It still zaps trailing blanks. I do not know why. But that is nice. exec < $1.dups while read a ; do if [ "$a" = "$b" ]; then case "$a" in *termcapinfo*) continue ;; esac fi echo "$a" >> $1 b="$a" done rm -f $1.dups screen-4.2.1/etc/newsyntax0000755000175000017500000000360312326531270014441 0ustar amadeamade#!/bin/sh # # newsyntax -- update a screenrc file from 3.2 to 3.3 syntax # # please check all comments after running this script and watch out # for funny passages. # if [ $# != 1 ]; then echo "usage $0 screenrcfile" exit 1; fi #Ultrix 4.2 /bin/sh does not handle "read a < $1" #Dean Gaudet exec < $1 read a if [ ."$a" = '.#3.3' ]; then echo "$1 already updated" exit 0 fi cp $1 $1.old echo "#3.3" > $1 echo "# Do not remove the above line. This screen rc file was updated" >> $1 echo "# by the newsyntax script." >> $1 sed < $1.old >> $1 \ -e 's/\([ #]\)flow/\1defflow/g' \ -e 's/^flow/defflow/g' \ -e 's/\([ #]\)set[ ]*defflow/\1flow/g' \ -e 's/^set[ ]*defflow/flow/g' \ -e 's/\([ #]\)mode/\1defmode/g' \ -e 's/^mode/defmode/g' \ -e 's/\([ #]\)set[ ]*defmode/\1defmode/g' \ -e 's/^set[ ]*defmode/defmode/g' \ -e 's/\([ #]\)monitor/\1defmonitor/g' \ -e 's/^monitor/defmonitor/g' \ -e 's/\([ #]\)set[ ]*defmonitor/\1monitor/g' \ -e 's/^set[ ]*defmonitor/monitor/g' \ -e 's/\([ #]\)login/\1deflogin/g' \ -e 's/^login/deflogin/g' \ -e 's/\([ #]\)set[ ]*deflogin/\1login/g' \ -e 's/^set[ ]*deflogin/login/g' \ -e 's/\([ #]\)wrap/\1defwrap/g' \ -e 's/^wrap/defwrap/g' \ -e 's/\([ #]\)set[ ]*defwrap/\1wrap/g' \ -e 's/^set[ ]*defwrap/wrap/g' \ -e 's/\([ #]\)scrollback/\1defscrollback/g' \ -e 's/^scrollback/defscrollback/g' \ -e 's/\([ #]\)set[ ]*defscrollback/\1scrollback/g' \ -e 's/^set[ ]*defscrollback/scrollback/g' \ -e 's/\([ #]\)refresh/\1allPARtial/g' \ -e 's/^refresh/allPARtial/g' \ -e 's/\([ #]\)redraw/\1allPARtial/g' \ -e 's/^redraw/allPARtial/g' \ -e 's/\([ #]\)set[ ]*allPARtial/\1PARtial/g' \ -e 's/^set[ ]*allPARtial/PARtial/g' \ -e 's/\([ #]\)visualbell/\1vbell/g' \ -e 's/^visualbell/vbell/g' \ -e 's/PARtial\([ ]*\)on/partial\1off/g' \ -e 's/PARtial\([ ]*\)off/partial\1on/g' \ -e 's/allPARtial/refresh/g' \ -e 's/^set[ ]//g' screen-4.2.1/etc/us-braille.tbl0000644000175000017500000002264312326531270015222 0ustar amadeamade# U.S. BRAILLE TABLE # # Dec Hex Braille Description # ------------------------------------------------------------------------ 0 00 (---4--78) NUL 1 01 (1-----78) SOH 2 02 (12----78) STX 3 03 (1--4--78) ETX 4 04 (1--45-78) EOT 5 05 (1---5-78) ENQ 6 06 (12-4--78) ACK 7 07 (12-45-78) BEL 8 08 (12--5-78) BS 9 09 (-2-4--78) HT 10 OA (-2-45-78) LF 11 0B (1-3---78) VT 12 OC (123---78) FF 13 0D (1-34--78) CR 14 0E (1-345-78) SO 15 OF (1-3-5-78) SI 16 10 (1234--78) DLE 17 11 (12345-78) DC1 18 12 (123-5-78) DC2 19 13 (-234--78) DC3 20 14 (-2345-78) DC4 21 15 (1-3--678) NAK 22 16 (123--678) SYN 23 17 (-2-45678) ETB 24 18 (1-34-678) CAN 25 19 (1-345678) EM 26 1A (1-3-5678) SUB 27 lB (-2-4-678) ESC 28 lC (12--5678) FS 29 1D (12-45678) GS 30 lE (---45-78) RS 31 1F (---45678) US 32 20 (--------) Space 33 21 (-234-6--) ! 34 22 (----5---) " 35 23 (--3456--) # 36 24 (12-4-6--) $ 37 25 (1--4-6--) % 38 26 (1234-6--) & 39 27 (--3-----) ' 40 28 (123-56--) ( 41 29 (-23456--) ) 42 2A (1----6--) * 43 2B (--34-6--) + 44 2C (-----6--) , 45 2D (--3--6--) - 46 2E (---4-6--) . 47 2F (--34----) / 48 30 (--3-56--) 0 49 31 (-2------) 1 50 32 (-23-----) 2 51 33 (-2--5---) 3 52 34 (-2--56--) 4 53 35 (-2---6--) 5 54 36 (-23-5---) 6 55 37 (-23-56--) 7 56 38 (-23--6--) 8 57 39 (--3-5---) 9 58 3A (1---56--) : 59 3B (----56--) ; 60 3C (12---6--) < 61 3D (123456--) - 62 3E (--345---) > 63 3F (1--456--) ? 64 40 (---4--7-) @ 65 41 (1-----7-) A 66 42 (12----7-) B 67 43 (1--4--7-) C 68 44 (1--45-7-) D 69 45 (1---5-7-) E 70 46 (12-4--7-) F 71 47 (12-45-7-) G 72 48 (12--5-7-) H 73 49 (-2-4--7-) I 74 4A (-2-45-7-) J 75 4B (1-3---7-) K 76 4C (123---7-) L 77 4D (1-34--7-) M 78 4E (1-345-7-) N 79 4F (1-3-5-7-) O 80 50 (1234--7-) P 81 51 (12345-7-) Q 82 52 (123-5-7-) R 83 53 (-234--7-) S 84 54 (-2345-7-) T 85 55 (1-3--67-) U 86 56 (123--67-) V 87 57 (-2-4567-) W 88 58 (1-34-67-) X 89 59 (1-34567-) Y 90 5A (1-3-567-) Z 91 5B (-2-4-67-) [ 92 5C (12--567-) \ 93 5D (12-4567-) ] 94 5E (---45-7-) ^ 95 5F (---4567-) _ 96 60 (---4----) ' 97 61 (1-------) a 98 62 (12------) b 99 63 (1--4----) c 100 64 (1--45---) d 101 65 (1---5---) e 102 66 (12-4----) f 103 67 (12-45---) g 104 68 (12--5---) h 105 69 (-2-4----) i 106 6A (-2-45---) j 107 6B (1-3-----) k 108 6C (123-----) l 109 6D (1-34----) m 110 6E (1-345---) n 111 6F (1-3-5---) o 112 70 (1234----) p 113 71 (12345---) q 114 72 (123-5---) r 115 73 (-234----) s 116 74 (-2345---) t 117 75 (1-3--6--) u 118 76 (123--6--) v 119 77 (-2-456--) w 120 78 (1-34-6--) x 121 79 (1-3456--) y 122 7A (1-3-56--) z 123 7B (-2-4-6--) { 124 7C (12--56--) | 125 7D (12-456--) } 126 7E (---45---) ~ 127 7F (---456--) DEL 128 80 (---4---8) C Cedilla (upper case) 129 81 (1------8) u Umlaut (lower case) 130 82 (12-----8) e Acute (lower case) 131 83 (1--4---8) a Circumflex 132 84 (1--45--8) a Umlaut (lower case) 133 85 (1---5--8) a Grave 134 86 (12-4---8) a Ring (lower case) 135 87 (12-45--8) c Cedilla (lower case) 136 88 (12--5--8) e Circumflex 137 89 (-2-4---8) e Umlaut (lower case) 138 8A (--2-45-8) e Grave 139 8B (1-3----8) i Umlaut (lower case) 140 8C (123----8) i Circumflex 141 8D (1-34---8) I Grave 142 8E (1-345--8) A Umlaut (upper case) 143 8F (1-3-5--8) A Ring (upper case) 144 90 (1234---8) E Acute (upper case) 145 91 (12345--8) ae Digraph (lower case) 146 92 (123-5--8) AE Digraph (upper case) 147 93 (-234---8) o Circumflex 148 94 (-2345--8) o Umlaut (lower case) 149 95 (1-3--6-8) o Grave 150 96 (123--6-8) u Circumflex 151 97 (-2-456-8) u Grave 152 98 (1-34-6-8) y Umlaut 153 99 (1-3456-8) O Umlaut (upper case) 154 9A (1-3-56-8) U Umlaut (upper case) 155 9B (-2-4-6-8) Cent 156 9C (12--56-8) Pound/Sterling 157 9D (12-456-8) Yen 158 9E (---45--8) Peseta 159 9F (---456-8) Franc 160 A0 (------7-) a Acute (lower case) 161 Al (-234-67-) i Acute (lower case) 162 A2 (----5-7-) o Acute (lower case) 163 A3 (--34567-) u Acute (lower case) 164 A4 (12-4-67-) n Tilde (lower case) 165 A5 (1--4-67-) N Tilde (upper case) 166 A6 (1234-67-) Feminine Spanish Ordinal 167 A7 (--3---7-) Masculine Spanish Ordinal 168 A8 (123-567-) Inverted Question Mark 169 A9 (-234567-) Left square corner 170 AA (1----67-) Right square corner 171 AB (--34-67-) 1/2 172 AC (-----67-) 1/4 173 AD (--3--67-) Inverted Exclamation Mark 174 AE (---4-67-) Left Double Guillemet 175 AF (--34--7-) Right Double Guillemet 176 B0 (--3-567-) Box [Shade 1] 177 B1 (-2----7-) Box [Shade 2] 178 B2 (-23---7-) Box [Shade 3] 179 B3 (-2--5-7-) Box [top bottom] 180 B4 (-2--567-) Box [left top bottom] 181 B5 (-2---67-) Box [LEFT top bottom] 182 B6 (-23-5-7-) Box [left TOP BOTTOM] 183 B7 (-23-567-) Box [left BOTTOM] 184 B8 (-23--67-) Box [LEFT bottom] 185 B9 (--3-5-7-) Box [LEFT TOP BOTTOM] 186 BA (1---567-) Box [TOP BOTTOM] 187 BB (----567-) Box [LEFT BOTTOM] 188 BC (12---67-) Box [LEFT TOP] 189 BD (1234567-) Box [left TOP] 190 BE (--345-7-) Box [LEFT top] 191 BF (1--4567-) Box [left bottom] 192 CO (------78) Box [top right] 193 C1 (-234-678) Box [left top right] 194 C2 (----5-78) Box [left right bottom] 195 C3 (--345678) Box [top right bottom] 196 C4 (12-4-678) Box [left right] 197 C5 (1--4-678) Box [left top right bottom] 198 C6 (1234-678) Box [top RIGHT bottom] 199 C7 (--3---78) Box [TOP right BOTTOM] 200 C8 (123-5678) Box [TOP RIGHT] 201 C9 (-2345678) Box [RIGHT BOTTOM] 202 CA (1----678) Box [LEFT TOP RIGHT] 203 CB (--34-678) Box [LEFT RIGHT BOTTOM] 204 CC (-----678) Box [TOP RIGHT BOTTOM] 205 CD (--3--678) Box [LEFT RIGHT] 206 CE (---4-678) Box [LEFT TOP RIGHT BOTTOM] 207 CF (--34--78) Box [LEFT top RIGHT] 208 DO (--3-5678) Box [left TOP right] 209 D1 (-2----78) Box [LEFT RIGHT bottom] 210 D2 (-23---78) Box [left right BOTTOM] 211 D3 (-2--5-78) Box [TOP right] 212 D4 (-2--5678) Box [top RIGHT] 213 D5 (-2---678) Box [RIGHT bottom] 214 D6 (-23-5-78) Box [right BOTTOM] 215 D7 (-23-5678) Box [left TOP right BOTTOM] 216 D8 (-23--678) Box [LEFT top RIGHT bottom] 217 D9 (--3-5-78) Box [left top] 218 DA (1---5678) Box [right bottom] 219 DB (----5678) Box [Shade 4] 220 DC (12---678) Box [box bottom] 221 DD (12345678) Box [box right] 222 DE (--345-78) Box [box left] 223 DF (1--45678) Box [box top] 224 E0 (-------8) Alpha (lower case) 225 E1 (-234-6-8) Beta (lower case) 226 E2 (----5--8) Gamma (upper case) 227 E3 (--3456-8) Pi (lower case) 228 E4 (12-4-6-8) Sigma (upper case) 229 E5 (1--4-6-8) Sigma (lower case) 230 E6 (1234-6-8) Mu (lower case) 231 E7 (--3----8) Tau (lower case) 232 E8 (123-56-8) Phi (upper case) 233 E9 (-23456-8) Theta (lower case) 234 EA (1----6-8) Omega (upper case) 235 EB (--34-6-8) Delta (lower case) 236 EC (-----6-8) infinity 237 ED (--3--6-8) Phi (lower case) 238 EE (---4-6-8) Epsilon (lower case) 239 EF (--34---8) Intersection 240 F0 (--3-56-8) Equivalent (Member) 241 F1 (-2-----8) Plus or minus 242 F2 (-23----8) Greater than or equal 243 F3 (-2--5--8) Less than or equal 244 F4 (-2--56-8) Integral [top] 245 F5 (-2---6-8) Integral [bottom] 246 F6 (-23-5--8) Division 247 F7 (-23-56-8) Approximately equal 248 F8 (-23--6-8) Small circle 249 F9 (--3-5--8) Bullet 250 FA (1---56-8) Small bullet 251 FB (----56-8) Bent Radical 252 FC (12---6-8) Power of n 253 FD (123456-8) Power of 2 254 FE (--345--8) Large square bullet 255 FF (1--456-8) blank (hard space) screen-4.2.1/logfile.c0000644000175000017500000001635312326710533013474 0ustar amadeamade/* Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ #include /* dev_t, ino_t, off_t, ... */ #include /* struct stat */ #include /* O_WRONLY for logfile_reopen */ #include "config.h" #include "screen.h" #include "extern.h" #include "logfile.h" static void changed_logfile __P((struct logfile *)); static struct logfile *lookup_logfile __P((char *)); static int stolen_logfile __P((struct logfile *)); static struct logfile *logroot = NULL; static void changed_logfile(l) struct logfile *l; { struct stat o, *s = l->st; if (fstat(fileno(l->fp), &o) < 0) /* get trouble later */ return; if (o.st_size > s->st_size) /* aha, appended text */ { s->st_size = o.st_size; /* this should have changed */ s->st_mtime = o.st_mtime; /* only size and mtime */ } } /* * Requires fd to be open and need_fd to be closed. * If possible, need_fd will be open afterwards and refer to * the object originally reffered by fd. fd will be closed then. * Works just like ``fcntl(fd, DUPFD, need_fd); close(fd);'' * * need_fd is returned on success, else -1 is returned. */ int lf_move_fd(fd, need_fd) int need_fd, fd; { int r = -1; if (fd == need_fd) return fd; if (fd >=0 && fd < need_fd) r = lf_move_fd(dup(fd), need_fd); close(fd); return r; } static int logfile_reopen(name, wantfd, l) char *name; int wantfd; struct logfile *l; { int got_fd; close(wantfd); if (((got_fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0) || lf_move_fd(got_fd, wantfd) < 0) { logfclose(l); debug1("logfile_reopen: failed for %s\n", name); return -1; } changed_logfile(l); debug2("logfile_reopen: %d = %s\n", wantfd, name); return 0; } static int (* lf_reopen_fn)() = logfile_reopen; /* * Whenever logfwrite discoveres that it is required to close and * reopen the logfile, the function registered here is called. * If you do not register anything here, the above logfile_reopen() * will be used instead. * Your function should perform the same steps as logfile_reopen(): * a) close the original filedescriptor without flushing any output * b) open a new logfile for future output on the same filedescriptor number. * c) zero out st_dev, st_ino to tell the stolen_logfile() indcator to * reinitialise itself. * d) return 0 on success. */ void logreopen_register(fn) int (*fn) __P((char *, int, struct logfile *)); { lf_reopen_fn = fn ? fn : logfile_reopen; } /* * If the logfile has been removed, truncated, unlinked or the like, * return nonzero. * The l->st structure initialised by logfopen is updated * on every call. */ static int stolen_logfile(l) struct logfile *l; { struct stat o, *s = l->st; o = *s; if (fstat(fileno(l->fp), s) < 0) /* remember that stat failed */ s->st_ino = s->st_dev = 0; ASSERT(s == l->st); if (!o.st_dev && !o.st_ino) /* nothing to compare with */ return 0; if ((!s->st_dev && !s->st_ino) || /* stat failed, that's new! */ !s->st_nlink || /* red alert: file unlinked */ (s->st_size < o.st_size) || /* file truncated */ (s->st_mtime != o.st_mtime) || /* file modified */ ((s->st_ctime != o.st_ctime) && /* file changed (moved) */ !(s->st_mtime == s->st_ctime && /* and it was not a change */ o.st_ctime < s->st_ctime))) /* due to delayed nfs write */ { debug1("stolen_logfile: %s stolen!\n", l->name); debug3("st_dev %d, st_ino %d, st_nlink %d\n", (int)s->st_dev, (int)s->st_ino, (int)s->st_nlink); debug2("s->st_size %d, o.st_size %d\n", (int)s->st_size, (int)o.st_size); debug2("s->st_mtime %d, o.st_mtime %d\n", (int)s->st_mtime, (int)o.st_mtime); debug2("s->st_ctime %d, o.st_ctime %d\n", (int)s->st_ctime, (int)o.st_ctime); return -1; } debug1("stolen_logfile: %s o.k.\n", l->name); return 0; } static struct logfile * lookup_logfile(name) char *name; { struct logfile *l; for (l = logroot; l; l = l->next) if (!strcmp(name, l->name)) return l; return NULL; } struct logfile * logfopen(name, fp) char *name; FILE *fp; { struct logfile *l; if (!fp) { if (!(l = lookup_logfile(name))) return NULL; l->opencount++; return l; } if (!(l = (struct logfile *)malloc(sizeof(struct logfile)))) return NULL; if (!(l->st = (struct stat *)malloc(sizeof(struct stat)))) { free((char *)l); return NULL; } if (!(l->name = SaveStr(name))) { free((char *)l->st); free((char *)l); return NULL; } l->fp = fp; l->opencount = 1; l->writecount = 0; l->flushcount = 0; changed_logfile(l); l->next = logroot; logroot = l; return l; } int islogfile(name) char *name; { if (!name) return logroot ? 1 : 0; return lookup_logfile(name) ? 1 : 0; } int logfclose(l) struct logfile *l; { struct logfile **lp; for (lp = &logroot; *lp; lp = &(*lp)->next) if (*lp == l) break; if (!*lp) return -1; if ((--l->opencount) > 0) return 0; if (l->opencount < 0) abort(); *lp = l->next; fclose(l->fp); free(l->name); free((char *)l); return 0; } /* * XXX * write and flush both *should* check the file's stat, if it disappeared * or changed, re-open it. */ int logfwrite(l, buf, n) struct logfile *l; char *buf; int n; { int r; if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l)) return -1; r = fwrite(buf, n, 1, l->fp); l->writecount += l->flushcount + 1; l->flushcount = 0; changed_logfile(l); return r; } int logfflush(l) struct logfile *l; { int r = 0; if (!l) for (l = logroot; l; l = l->next) { if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l)) return -1; r |= fflush(l->fp); l->flushcount++; changed_logfile(l); } else { if (stolen_logfile(l) && lf_reopen_fn(l->name, fileno(l->fp), l)) return -1; r = fflush(l->fp); l->flushcount++; changed_logfile(l); } return r; } screen-4.2.1/NEWS.3.70000644000175000017500000000270212326531270012704 0ustar amadeamade ---------------------------- What's new in screen-3.7 ? ---------------------------- * Color support. Screen understands the following capabilities: AF (setaf) = Set foreground color (ANSI compatible) AB (setab) = Set background color (ANSI compatible) AX = Does understand ANSI set default fg/bg color (\E[39m / \E[49m) The tweaks for the color xterm would be: termcap xterm 'AF=\E[3%dm:AB=\E[4%dm' terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm' * New 'digraph' command (bound to ^A^V) ^A^Va" or ^A^V0344 input an a-umlaut * activity/bell message strings can now include the window title: %t - title %n - number (a single % still works) * 'defhstatus' command to give everey window a default hardstatus line. ^E is used as a string escape instead of % (see above). Try 'defhstatus "Screen: window ^E (^Et)"' * Input parser changed to understand '^' (see ^E above). Note that the linux color xterm has a stupid bug: the characters get the color of the cursor, therefore if you change color and move the cursor around all the characters will get the new color... Here is a patch: pub/utilities/screen/color_xterm_patch Btw.: rxvt works fine. * Optional Braille support. If you can read Braille and have one of the devices listed in README.DOTSCREEN, please compile with -DHAVE_BRAILLE and let us know if this feature is useful. screen-4.2.1/NEWS.3.60000644000175000017500000000327412326531270012710 0ustar amadeamade ---------------------------- What's new in screen-3.6 ? ---------------------------- * Input translation! This makes the vt100 emulation complete. As an addition it is now possible to bind any command to any (function-) key. See the man page for more details (bindkey command). * Status line support. Each window can have a different status line. Use the ANSI APC string to set the status line, i.e.: _\ (For convenience the xterm sequence is also accepted.) You may want to add termcap * '' ':hs:ts=\E_:fs=\E\\:ds=\E_\E\\:' terminfo * '' ':hs:ts=\E_:fs=\E\\:ds=\E_\E\\:' to your ~/.screenrc to make screen advertise the hardstatus support. * Zombie feature added. Windows now may generate a message (with a timestamp) if they die and stay around until the user presses a key. * New paste syntax: Paste can now concatenate registers and paste either on screen or in anouther register. This makes the old "ins_reg", "copy_reg" commands obsolete. * More architecures supported. Screen now runs on AIX3.2.5, Solaris, NeXT and some other exotic platforms. * Kanji support added. Screen understands JIS, EUC and SJIS coding. This is an experimental feature. * GR charset switching (ISO 2022) implemented. Can be enabled with the "gr" command. * C1 sequences implemented (see the "c1" command). * Tek support from Xiaoguang Zhang. Apply tek.patch if you want to make screen pass tek sequences. * List of new commands: bindkey, c1, command, defc1, defgr, defkanji, gr, kanji, mapdefault, mapnotnext, maptimeout, pastefont, printcmd, readreg, stuff, zombie * Lots of other bugs fixed. screen-4.2.1/encoding.c0000644000175000017500000012616712326714546013656 0ustar amadeamade/* Copyright (c) 1993-2003 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ #include #include "config.h" #include "screen.h" #include "extern.h" #ifdef ENCODINGS extern unsigned char *null; extern struct display *display, *displays; extern struct layer *flayer; extern char *screenencodings; #ifdef DW_CHARS extern int cjkwidth; #endif static int encmatch __P((char *, char *)); # ifdef UTF8 static int recode_char __P((int, int, int)); static int recode_char_to_encoding __P((int, int)); static void comb_tofront __P((int, int)); # ifdef DW_CHARS static int recode_char_dw __P((int, int *, int, int)); static int recode_char_dw_to_encoding __P((int, int *, int)); # endif # endif struct encoding { char *name; char *charsets; int deffont; int usegr; int noc1; char *fontlist; }; /* big5 font: ^X */ /* KOI8-R font: 96 ! */ /* CP1251 font: 96 ? */ struct encoding encodings[] = { { "C", 0, 0, 0, 0, 0 }, { "eucJP", "B\002I\00401", 0, 1, 0, "\002\004I" }, { "SJIS", "BIBB01", 0, 1, 1, "\002I" }, { "eucKR", "B\003BB01", 0, 1, 0, "\003" }, { "eucCN", "B\001BB01", 0, 1, 0, "\001" }, { "Big5", "B\030BB01", 0, 1, 0, "\030" }, { "KOI8-R", 0, 0x80|'!', 0, 1, 0 }, { "CP1251", 0, 0x80|'?', 0, 1, 0 }, { "UTF-8", 0, -1, 0, 0, 0 }, { "ISO8859-2", 0, 0x80|'B', 0, 0, 0 }, { "ISO8859-3", 0, 0x80|'C', 0, 0, 0 }, { "ISO8859-4", 0, 0x80|'D', 0, 0, 0 }, { "ISO8859-5", 0, 0x80|'L', 0, 0, 0 }, { "ISO8859-6", 0, 0x80|'G', 0, 0, 0 }, { "ISO8859-7", 0, 0x80|'F', 0, 0, 0 }, { "ISO8859-8", 0, 0x80|'H', 0, 0, 0 }, { "ISO8859-9", 0, 0x80|'M', 0, 0, 0 }, { "ISO8859-10", 0, 0x80|'V', 0, 0, 0 }, { "ISO8859-15", 0, 0x80|'b', 0, 0, 0 }, { "jis", 0, 0, 0, 0, "\002\004I" }, { "GBK", "B\031BB01", 0x80|'b', 1, 1, "\031" } }; #ifdef UTF8 static unsigned short builtin_tabs[][2] = { { 0x30, 0 }, /* 0: special graphics (line drawing) */ { 0x005f, 0x25AE }, { 0x0060, 0x25C6 }, { 0x0061, 0x2592 }, { 0x0062, 0x2409 }, { 0x0063, 0x240C }, { 0x0064, 0x240D }, { 0x0065, 0x240A }, { 0x0066, 0x00B0 }, { 0x0067, 0x00B1 }, { 0x0068, 0x2424 }, { 0x0069, 0x240B }, { 0x006a, 0x2518 }, { 0x006b, 0x2510 }, { 0x006c, 0x250C }, { 0x006d, 0x2514 }, { 0x006e, 0x253C }, { 0x006f, 0x23BA }, { 0x0070, 0x23BB }, { 0x0071, 0x2500 }, { 0x0072, 0x23BC }, { 0x0073, 0x23BD }, { 0x0074, 0x251C }, { 0x0075, 0x2524 }, { 0x0076, 0x2534 }, { 0x0077, 0x252C }, { 0x0078, 0x2502 }, { 0x0079, 0x2264 }, { 0x007a, 0x2265 }, { 0x007b, 0x03C0 }, { 0x007c, 0x2260 }, { 0x007d, 0x00A3 }, { 0x007e, 0x00B7 }, { 0, 0}, { 0x34, 0 }, /* 4: Dutch */ { 0x0023, 0x00a3 }, { 0x0040, 0x00be }, { 0x005b, 0x00ff }, { 0x005c, 0x00bd }, { 0x005d, 0x007c }, { 0x007b, 0x00a8 }, { 0x007c, 0x0066 }, { 0x007d, 0x00bc }, { 0x007e, 0x00b4 }, { 0, 0}, { 0x35, 0 }, /* 5: Finnish */ { 0x005b, 0x00c4 }, { 0x005c, 0x00d6 }, { 0x005d, 0x00c5 }, { 0x005e, 0x00dc }, { 0x0060, 0x00e9 }, { 0x007b, 0x00e4 }, { 0x007c, 0x00f6 }, { 0x007d, 0x00e5 }, { 0x007e, 0x00fc }, { 0, 0}, { 0x36, 0 }, /* 6: Norwegian/Danish */ { 0x0040, 0x00c4 }, { 0x005b, 0x00c6 }, { 0x005c, 0x00d8 }, { 0x005d, 0x00c5 }, { 0x005e, 0x00dc }, { 0x0060, 0x00e4 }, { 0x007b, 0x00e6 }, { 0x007c, 0x00f8 }, { 0x007d, 0x00e5 }, { 0x007e, 0x00fc }, { 0, 0}, { 0x37, 0 }, /* 7: Swedish */ { 0x0040, 0x00c9 }, { 0x005b, 0x00c4 }, { 0x005c, 0x00d6 }, { 0x005d, 0x00c5 }, { 0x005e, 0x00dc }, { 0x0060, 0x00e9 }, { 0x007b, 0x00e4 }, { 0x007c, 0x00f6 }, { 0x007d, 0x00e5 }, { 0x007e, 0x00fc }, { 0, 0}, { 0x3d, 0}, /* =: Swiss */ { 0x0023, 0x00f9 }, { 0x0040, 0x00e0 }, { 0x005b, 0x00e9 }, { 0x005c, 0x00e7 }, { 0x005d, 0x00ea }, { 0x005e, 0x00ee }, { 0x005f, 0x00e8 }, { 0x0060, 0x00f4 }, { 0x007b, 0x00e4 }, { 0x007c, 0x00f6 }, { 0x007d, 0x00fc }, { 0x007e, 0x00fb }, { 0, 0}, { 0x41, 0}, /* A: UK */ { 0x0023, 0x00a3 }, { 0, 0}, { 0x4b, 0}, /* K: German */ { 0x0040, 0x00a7 }, { 0x005b, 0x00c4 }, { 0x005c, 0x00d6 }, { 0x005d, 0x00dc }, { 0x007b, 0x00e4 }, { 0x007c, 0x00f6 }, { 0x007d, 0x00fc }, { 0x007e, 0x00df }, { 0, 0}, { 0x51, 0}, /* Q: French Canadian */ { 0x0040, 0x00e0 }, { 0x005b, 0x00e2 }, { 0x005c, 0x00e7 }, { 0x005d, 0x00ea }, { 0x005e, 0x00ee }, { 0x0060, 0x00f4 }, { 0x007b, 0x00e9 }, { 0x007c, 0x00f9 }, { 0x007d, 0x00e8 }, { 0x007e, 0x00fb }, { 0, 0}, { 0x52, 0}, /* R: French */ { 0x0023, 0x00a3 }, { 0x0040, 0x00e0 }, { 0x005b, 0x00b0 }, { 0x005c, 0x00e7 }, { 0x005d, 0x00a7 }, { 0x007b, 0x00e9 }, { 0x007c, 0x00f9 }, { 0x007d, 0x00e8 }, { 0x007e, 0x00a8 }, { 0, 0}, { 0x59, 0}, /* Y: Italian */ { 0x0023, 0x00a3 }, { 0x0040, 0x00a7 }, { 0x005b, 0x00b0 }, { 0x005c, 0x00e7 }, { 0x005d, 0x00e9 }, { 0x0060, 0x00f9 }, { 0x007b, 0x00e0 }, { 0x007c, 0x00f2 }, { 0x007d, 0x00e8 }, { 0x007e, 0x00ec }, { 0, 0}, { 0x5a, 0}, /* Z: Spanish */ { 0x0023, 0x00a3 }, { 0x0040, 0x00a7 }, { 0x005b, 0x00a1 }, { 0x005c, 0x00d1 }, { 0x005d, 0x00bf }, { 0x007b, 0x00b0 }, { 0x007c, 0x00f1 }, { 0x007d, 0x00e7 }, { 0, 0}, { 0xe2, 0}, /* 96-b: ISO-8859-15 */ { 0x00a4, 0x20ac }, { 0x00a6, 0x0160 }, { 0x00a8, 0x0161 }, { 0x00b4, 0x017D }, { 0x00b8, 0x017E }, { 0x00bc, 0x0152 }, { 0x00bd, 0x0153 }, { 0x00be, 0x0178 }, { 0, 0}, { 0x4a, 0}, /* J: JIS 0201 Roman */ { 0x005c, 0x00a5 }, { 0x007e, 0x203e }, { 0, 0}, { 0x49, 0}, /* I: halfwidth katakana */ { 0x0021, 0xff61 }, { 0x005f|0x8000, 0xff9f }, { 0, 0}, { 0, 0} }; struct recodetab { unsigned short (*tab)[2]; int flags; }; #define RECODETAB_ALLOCED 1 #define RECODETAB_BUILTIN 2 #define RECODETAB_TRIED 4 static struct recodetab recodetabs[256]; void InitBuiltinTabs() { unsigned short (*p)[2]; for (p = builtin_tabs; (*p)[0]; p++) { recodetabs[(*p)[0]].flags = RECODETAB_BUILTIN; recodetabs[(*p)[0]].tab = p + 1; p++; while((*p)[0]) p++; } } static int recode_char(c, to_utf, font) int c, to_utf, font; { int f; unsigned short (*p)[2]; if (to_utf) { if (c < 256) return c; f = (c >> 8) & 0xff; c &= 0xff; /* map aliases to keep the table small */ switch (f) { case 'C': f ^= ('C' ^ '5'); break; case 'E': f ^= ('E' ^ '6'); break; case 'H': f ^= ('H' ^ '7'); break; default: break; } p = recodetabs[f].tab; if (p == 0 && recodetabs[f].flags == 0) { LoadFontTranslation(f, 0); p = recodetabs[f].tab; } if (p) for (; (*p)[0]; p++) { if ((p[0][0] & 0x8000) && (c <= (p[0][0] & 0x7fff)) && c >= p[-1][0]) return c - p[-1][0] + p[-1][1]; if ((*p)[0] == c) return (*p)[1]; } return c & 0xff; /* map to latin1 */ } if (font == -1) { if (c < 256) return c; /* latin1 */ for (font = 32; font < 128; font++) { p = recodetabs[font].tab; if (p) for (; (*p)[1]; p++) { if ((p[0][0] & 0x8000) && c <= p[0][1] && c >= p[-1][1]) return (c - p[-1][1] + p[-1][0]) | (font << 8); if ((*p)[1] == c) return (*p)[0] | (font << 8); } } return '?'; } if (c < 128 && (font & 128) != 0) return c; if (font >= 32) { p = recodetabs[font].tab; if (p == 0 && recodetabs[font].flags == 0) { LoadFontTranslation(font, 0); p = recodetabs[font].tab; } if (p) for (; (*p)[1]; p++) { if ((p[0][0] & 0x8000) && c <= p[0][1] && c >= p[-1][1]) return (c - p[-1][1] + p[-1][0]) | (font & 128 ? 0 : font << 8); if ((*p)[1] == c) return (*p)[0] | (font & 128 ? 0 : font << 8); } } return -1; } #ifdef DW_CHARS static int recode_char_dw(c, c2p, to_utf, font) int c, *c2p, to_utf, font; { int f; unsigned short (*p)[2]; if (to_utf) { f = (c >> 8) & 0xff; c = (c & 255) << 8 | (*c2p & 255); *c2p = 0xffff; p = recodetabs[f].tab; if (p == 0 && recodetabs[f].flags == 0) { LoadFontTranslation(f, 0); p = recodetabs[f].tab; } if (p) for (; (*p)[0]; p++) if ((*p)[0] == c) { #ifdef DW_CHARS if (!utf8_isdouble((*p)[1])) *c2p = ' '; #endif return (*p)[1]; } return UCS_REPL_DW; } if (font == -1) { for (font = 0; font < 030; font++) { p = recodetabs[font].tab; if (p) for (; (*p)[1]; p++) if ((*p)[1] == c) { *c2p = ((*p)[0] & 255) | font << 8 | 0x8000; return ((*p)[0] >> 8) | font << 8; } } *c2p = '?'; return '?'; } if (font < 32) { p = recodetabs[font].tab; if (p == 0 && recodetabs[font].flags == 0) { LoadFontTranslation(font, 0); p = recodetabs[font].tab; } if (p) for (; (*p)[1]; p++) if ((*p)[1] == c) { *c2p = ((*p)[0] & 255) | font << 8 | 0x8000; return ((*p)[0] >> 8) | font << 8; } } return -1; } #endif static int recode_char_to_encoding(c, encoding) int c, encoding; { char *fp; int x; if (encoding == UTF8) return recode_char(c, 1, -1); if ((fp = encodings[encoding].fontlist) != 0) while(*fp) if ((x = recode_char(c, 0, (unsigned char)*fp++)) != -1) return x; if (encodings[encoding].deffont) if ((x = recode_char(c, 0, encodings[encoding].deffont)) != -1) return x; return recode_char(c, 0, -1); } #ifdef DW_CHARS static int recode_char_dw_to_encoding(c, c2p, encoding) int c, *c2p, encoding; { char *fp; int x; if (encoding == UTF8) return recode_char_dw(c, c2p, 1, -1); if ((fp = encodings[encoding].fontlist) != 0) while(*fp) if ((x = recode_char_dw(c, c2p, 0, (unsigned char)*fp++)) != -1) return x; if (encodings[encoding].deffont) if ((x = recode_char_dw(c, c2p, 0, encodings[encoding].deffont)) != -1) return x; return recode_char_dw(c, c2p, 0, -1); } #endif struct mchar * recode_mchar(mc, from, to) struct mchar *mc; int from, to; { static struct mchar rmc; int c; debug3("recode_mchar %02x from %d to %d\n", mc->image, from, to); if (from == to || (from != UTF8 && to != UTF8)) return mc; rmc = *mc; if (rmc.font == 0 && from != UTF8) rmc.font = encodings[from].deffont; if (rmc.font == 0) /* latin1 is the same in unicode */ return mc; c = rmc.image | (rmc.font << 8); if (from == UTF8) c |= rmc.fontx << 16; #ifdef DW_CHARS if (rmc.mbcs) { int c2 = rmc.mbcs; c = recode_char_dw_to_encoding(c, &c2, to); rmc.mbcs = c2; } else #endif c = recode_char_to_encoding(c, to); rmc.image = c & 255; rmc.font = c >> 8 & 255; if (to == UTF8) rmc.fontx = c >> 16 & 255; return &rmc; } struct mline * recode_mline(ml, w, from, to) struct mline *ml; int w; int from, to; { static int maxlen; static int last; static struct mline rml[2], *rl; int i, c; if (from == to || (from != UTF8 && to != UTF8) || w == 0) return ml; if (ml->font == null && ml->fontx == null && encodings[from].deffont == 0) return ml; if (w > maxlen) { for (i = 0; i < 2; i++) { if (rml[i].image == 0) rml[i].image = malloc(w); else rml[i].image = realloc(rml[i].image, w); if (rml[i].font == 0) rml[i].font = malloc(w); else rml[i].font = realloc(rml[i].font, w); if (rml[i].fontx == 0) rml[i].fontx = malloc(w); else rml[i].fontx = realloc(rml[i].fontx, w); if (rml[i].image == 0 || rml[i].font == 0 || rml[i].fontx == 0) { maxlen = 0; return ml; /* sorry */ } } maxlen = w; } debug("recode_mline: from\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(ml->image[i] >> 4) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(ml->image[i] ) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(ml->font[i] >> 4) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(ml->font[i] ) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(ml->fontx[i] >> 4) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(ml->fontx[i] ) & 15]); debug("\n"); rl = rml + last; rl->attr = ml->attr; #ifdef COLOR rl->color = ml->color; # ifdef COLORS256 rl->colorx = ml->colorx; # endif #endif for (i = 0; i < w; i++) { c = ml->image[i] | (ml->font[i] << 8); if (from == UTF8) c |= ml->fontx[i] << 16; if (from != UTF8 && c < 256) c |= encodings[from].deffont << 8; #ifdef DW_CHARS if ((from != UTF8 && (c & 0x1f00) != 0 && (c & 0xe000) == 0) || (from == UTF8 && utf8_isdouble(c))) { if (i + 1 == w) c = '?'; else { int c2; i++; c2 = ml->image[i] | (ml->font[i] << 8); c = recode_char_dw_to_encoding(c, &c2, to); if (to == UTF8) rl->fontx[i - 1] = c >> 16 & 255; rl->font[i - 1] = c >> 8 & 255; rl->image[i - 1] = c & 255; c = c2; } } else #endif c = recode_char_to_encoding(c, to); rl->image[i] = c & 255; rl->font[i] = c >> 8 & 255; if (to == UTF8) rl->fontx[i] = c >> 16 & 255; } last ^= 1; debug("recode_mline: to\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(rl->image[i] >> 4) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(rl->image[i] ) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(rl->font[i] >> 4) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(rl->font[i] ) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(rl->fontx[i] >> 4) & 15]); debug("\n"); for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(rl->fontx[i] ) & 15]); debug("\n"); return rl; } struct combchar { unsigned int c1; unsigned int c2; unsigned int next; unsigned int prev; }; struct combchar **combchars; void AddUtf8(c) int c; { ASSERT(D_encoding == UTF8); if (c >= 0xd800 && c < 0xe000 && combchars && combchars[c - 0xd800]) { AddUtf8(combchars[c - 0xd800]->c1); c = combchars[c - 0xd800]->c2; } if (c >= 0x10000) { if (c >= 0x200000) { AddChar((c & 0x3000000) >> 12 ^ 0xf8); c = (c & 0xffffff) ^ ((0xf0 ^ 0x80) << 18); } AddChar((c & 0x1fc0000) >> 18 ^ 0xf0); c = (c & 0x3ffff) ^ ((0xe0 ^ 0x80) << 12); } if (c >= 0x800) { AddChar((c & 0x7f000) >> 12 ^ 0xe0); c = (c & 0x0fff) ^ ((0xc0 ^ 0x80) << 6); } if (c >= 0x80) { AddChar((c & 0x1fc0) >> 6 ^ 0xc0); c = (c & 0x3f) | 0x80; } AddChar(c); } int ToUtf8_comb(p, c) char *p; int c; { int l; if (c >= 0xd800 && c < 0xe000 && combchars && combchars[c - 0xd800]) { l = ToUtf8_comb(p, combchars[c - 0xd800]->c1); return l + ToUtf8(p ? p + l : 0, combchars[c - 0xd800]->c2); } return ToUtf8(p, c); } int ToUtf8(p, c) char *p; int c; { int l = 1; if (c >= 0x10000) { if (c >= 0x200000) { if (p) *p++ = (c & 0x3000000) >> 12 ^ 0xf8; l++; c = (c & 0xffffff) ^ ((0xf0 ^ 0x80) << 18); } if (p) *p++ = (c & 0x1fc0000) >> 18 ^ 0xf0; l++; c = (c & 0x3ffff) ^ ((0xe0 ^ 0x80) << 12); } if (c >= 0x800) { if (p) *p++ = (c & 0x7f000) >> 12 ^ 0xe0; l++; c = (c & 0x0fff) | 0x1000; } if (c >= 0x80) { if (p) *p++ = (c & 0x1fc0) >> 6 ^ 0xc0; l++; c = (c & 0x3f) | 0x80; } if (p) *p++ = c; return l; } /* * returns: * -1: need more bytes, sequence not finished * -2: corrupt sequence found, redo last char * >= 0: decoded character */ int FromUtf8(c, utf8charp) int c, *utf8charp; { int utf8char = *utf8charp; if (utf8char) { if ((c & 0xc0) != 0x80) { *utf8charp = 0; return -2; /* corrupt sequence! */ } else c = (c & 0x3f) | (utf8char << 6); if (!(utf8char & 0x40000000)) { /* check for overlong sequences */ if ((c & 0x820823e0) == 0x80000000) c = 0xfdffffff; else if ((c & 0x020821f0) == 0x02000000) c = 0xfff7ffff; else if ((c & 0x000820f8) == 0x00080000) c = 0xffffd000; else if ((c & 0x0000207c) == 0x00002000) c = 0xffffff70; } } else { /* new sequence */ if (c >= 0xfe) c = UCS_REPL; else if (c >= 0xfc) c = (c & 0x01) | 0xbffffffc; /* 5 bytes to follow */ else if (c >= 0xf8) c = (c & 0x03) | 0xbfffff00; /* 4 */ else if (c >= 0xf0) c = (c & 0x07) | 0xbfffc000; /* 3 */ else if (c >= 0xe0) c = (c & 0x0f) | 0xbff00000; /* 2 */ else if (c >= 0xc2) c = (c & 0x1f) | 0xfc000000; /* 1 */ else if (c >= 0xc0) c = 0xfdffffff; /* overlong */ else if (c >= 0x80) c = UCS_REPL; } *utf8charp = utf8char = (c & 0x80000000) ? c : 0; if (utf8char) return -1; #if 0 if (c & 0xffff0000) c = UCS_REPL; /* sorry, only know 16bit Unicode */ #else if (c & 0xff800000) c = UCS_REPL; /* sorry, only know 23bit Unicode */ #endif if (c >= 0xd800 && (c <= 0xdfff || c == 0xfffe || c == 0xffff)) c = UCS_REPL; /* illegal code */ return c; } void WinSwitchEncoding(p, encoding) struct win *p; int encoding; { int i, j, c; struct mline *ml; struct display *d; struct canvas *cv; struct layer *oldflayer; if ((p->w_encoding == UTF8) == (encoding == UTF8)) { p->w_encoding = encoding; return; } oldflayer = flayer; for (d = displays; d; d = d->d_next) for (cv = d->d_cvlist; cv; cv = cv->c_next) if (p == Layer2Window(cv->c_layer)) { flayer = cv->c_layer; while(flayer->l_next) { if (oldflayer == flayer) oldflayer = flayer->l_next; ExitOverlayPage(); } } flayer = oldflayer; for (j = 0; j < p->w_height + p->w_histheight; j++) { #ifdef COPY_PASTE ml = j < p->w_height ? &p->w_mlines[j] : &p->w_hlines[j - p->w_height]; #else ml = &p->w_mlines[j]; #endif if (ml->font == null && ml->fontx == 0 && encodings[p->w_encoding].deffont == 0) continue; for (i = 0; i < p->w_width; i++) { c = ml->image[i] | (ml->font[i] << 8); if (p->w_encoding == UTF8) c |= ml->fontx[i] << 16; if (p->w_encoding != UTF8 && c < 256) c |= encodings[p->w_encoding].deffont << 8; if (c < 256) continue; if (ml->font == null) { if ((ml->font = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->font = null; break; } } #ifdef DW_CHARS if ((p->w_encoding != UTF8 && (c & 0x1f00) != 0 && (c & 0xe000) == 0) || (p->w_encoding == UTF8 && utf8_isdouble(c))) { if (i + 1 == p->w_width) c = '?'; else { int c2; i++; c2 = ml->image[i] | (ml->font[i] << 8) | (ml->fontx[i] << 16); c = recode_char_dw_to_encoding(c, &c2, encoding); if (encoding == UTF8) { if (c > 0x10000 && ml->fontx == null) { if ((ml->fontx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->fontx = null; break; } } ml->fontx[i - 1] = c >> 16 & 255; } else ml->fontx = null; ml->font[i - 1] = c >> 8 & 255; ml->image[i - 1] = c & 255; c = c2; } } else #endif c = recode_char_to_encoding(c, encoding); ml->image[i] = c & 255; ml->font[i] = c >> 8 & 255; if (encoding == UTF8) { if (c > 0x10000 && ml->fontx == null) { if ((ml->fontx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->fontx = null; break; } } ml->fontx[i] = c >> 16 & 255; } else ml->fontx = null; } } p->w_encoding = encoding; return; } #ifdef DW_CHARS struct interval { int first; int last; }; /* auxiliary function for binary search in interval table */ static int bisearch(int ucs, const struct interval *table, int max) { int min = 0; int mid; if (ucs < table[0].first || ucs > table[max].last) return 0; while (max >= min) { mid = (min + max) / 2; if (ucs > table[mid].last) min = mid + 1; else if (ucs < table[mid].first) max = mid - 1; else return 1; } return 0; } int utf8_isdouble(c) int c; { /* sorted list of non-overlapping intervals of East Asian Ambiguous * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ static const struct interval ambiguous[] = { { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } }; return ((c >= 0x1100 && (c <= 0x115f || /* Hangul Jamo init. consonants */ c == 0x2329 || c == 0x232a || (c >= 0x2e80 && c <= 0xa4cf && c != 0x303f) || /* CJK ... Yi */ (c >= 0xac00 && c <= 0xd7a3) || /* Hangul Syllables */ (c >= 0xf900 && c <= 0xfaff) || /* CJK Compatibility Ideographs */ (c >= 0xfe30 && c <= 0xfe6f) || /* CJK Compatibility Forms */ (c >= 0xff00 && c <= 0xff60) || /* Fullwidth Forms */ (c >= 0xffe0 && c <= 0xffe6) || (c >= 0x20000 && c <= 0x2fffd) || (c >= 0x30000 && c <= 0x3fffd))) || (cjkwidth && bisearch(c, ambiguous, sizeof(ambiguous) / sizeof(struct interval) - 1))); } #endif int utf8_iscomb(c) int c; { /* taken from Markus Kuhn's wcwidth */ static const struct interval combining[] = { { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, { 0xE0100, 0xE01EF } }; return bisearch(c, combining, sizeof(combining) / sizeof(struct interval) - 1); } static void comb_tofront(root, i) int root, i; { for (;;) { debug1("bring to front: %x\n", i); combchars[combchars[i]->prev]->next = combchars[i]->next; combchars[combchars[i]->next]->prev = combchars[i]->prev; combchars[i]->next = combchars[root]->next; combchars[i]->prev = root; combchars[combchars[root]->next]->prev = i; combchars[root]->next = i; i = combchars[i]->c1; if (i < 0xd800 || i >= 0xe000) return; i -= 0xd800; } } void utf8_handle_comb(c, mc) int c; struct mchar *mc; { int root, i, c1; int isdouble; c1 = mc->image | (mc->font << 8) | mc->fontx << 16; isdouble = c1 >= 0x1100 && utf8_isdouble(c1); if (!combchars) { combchars = (struct combchar **)calloc(0x802, sizeof(struct combchar *)); if (!combchars) return; combchars[0x800] = (struct combchar *)malloc(sizeof(struct combchar)); combchars[0x801] = (struct combchar *)malloc(sizeof(struct combchar)); if (!combchars[0x800] || !combchars[0x801]) { if (combchars[0x800]) free(combchars[0x800]); if (combchars[0x801]) free(combchars[0x801]); free(combchars); return; } combchars[0x800]->c1 = 0x000; combchars[0x800]->c2 = 0x700; combchars[0x800]->next = 0x800; combchars[0x800]->prev = 0x800; combchars[0x801]->c1 = 0x700; combchars[0x801]->c2 = 0x800; combchars[0x801]->next = 0x801; combchars[0x801]->prev = 0x801; } root = isdouble ? 0x801 : 0x800; for (i = combchars[root]->c1; i < combchars[root]->c2; i++) { if (!combchars[i]) break; if (combchars[i]->c1 == c1 && combchars[i]->c2 == c) break; } if (i == combchars[root]->c2) { /* full, recycle old entry */ if (c1 >= 0xd800 && c1 < 0xe000) comb_tofront(root, c1 - 0xd800); i = combchars[root]->prev; if (c1 == i + 0xd800) { /* completely full, can't recycle */ debug("utf8_handle_comp: completely full!\n"); mc->image = '?'; mc->font = 0; return; } /* FIXME: delete old char from all buffers */ } else if (!combchars[i]) { combchars[i] = (struct combchar *)malloc(sizeof(struct combchar)); if (!combchars[i]) return; combchars[i]->prev = i; combchars[i]->next = i; } combchars[i]->c1 = c1; combchars[i]->c2 = c; mc->image = i & 0xff; mc->font = (i >> 8) + 0xd8; mc->fontx = 0; debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800); comb_tofront(root, i); } #else /* !UTF8 */ void WinSwitchEncoding(p, encoding) struct win *p; int encoding; { p->w_encoding = encoding; return; } #endif /* UTF8 */ static int encmatch(s1, s2) char *s1; char *s2; { int c1, c2; do { c1 = (unsigned char)*s1; if (c1 >= 'A' && c1 <= 'Z') c1 += 'a' - 'A'; if (!(c1 >= 'a' && c1 <= 'z') && !(c1 >= '0' && c1 <= '9')) { s1++; continue; } c2 = (unsigned char)*s2; if (c2 >= 'A' && c2 <= 'Z') c2 += 'a' - 'A'; if (!(c2 >= 'a' && c2 <= 'z') && !(c2 >= '0' && c2 <= '9')) { s2++; continue; } if (c1 != c2) return 0; s1++; s2++; } while(c1); return 1; } int FindEncoding(name) char *name; { int encoding; debug1("FindEncoding %s\n", name); if (name == 0 || *name == 0) return 0; if (encmatch(name, "euc")) name = "eucJP"; if (encmatch(name, "off") || encmatch(name, "iso8859-1")) return 0; #ifndef UTF8 if (encmatch(name, "UTF-8")) return -1; #endif for (encoding = 0; encoding < (int)(sizeof(encodings)/sizeof(*encodings)); encoding++) if (encmatch(name, encodings[encoding].name)) { #ifdef UTF8 LoadFontTranslationsForEncoding(encoding); #endif return encoding; } return -1; } char * EncodingName(encoding) int encoding; { if (encoding >= (int)(sizeof(encodings)/sizeof(*encodings))) return 0; return encodings[encoding].name; } int EncodingDefFont(encoding) int encoding; { return encodings[encoding].deffont; } void ResetEncoding(p) struct win *p; { char *c; int encoding = p->w_encoding; c = encodings[encoding].charsets; if (c) SetCharsets(p, c); #ifdef UTF8 LoadFontTranslationsForEncoding(encoding); #endif if (encodings[encoding].usegr) { p->w_gr = 2; p->w_FontE = encodings[encoding].charsets[1]; } else p->w_FontE = 0; if (encodings[encoding].noc1) p->w_c1 = 0; } /* decoded char: 32-bit * fontx: non-bmp utf8 * c2: multi-byte character * font is always zero for utf8 * returns: -1 need more bytes * -2 decode error */ int DecodeChar(c, encoding, statep) int c; int encoding; int *statep; { int t; debug2("Decoding char %02x for encoding %d\n", c, encoding); #ifdef UTF8 if (encoding == UTF8) { c = FromUtf8(c, statep); if (c >= 0x10000) c = (c & 0x7f0000) << 8 | (c & 0xffff); return c; } #endif if (encoding == SJIS) { if (!*statep) { if ((0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xef)) { *statep = c; return -1; } if (c < 0x80) return c; return c | (KANA << 16); } t = c; c = *statep; *statep = 0; if (0x40 <= t && t <= 0xfc && t != 0x7f) { if (c <= 0x9f) c = (c - 0x81) * 2 + 0x21; else c = (c - 0xc1) * 2 + 0x21; if (t <= 0x7e) t -= 0x1f; else if (t <= 0x9e) t -= 0x20; else t -= 0x7e, c++; return (c << 8) | t | (KANJI << 16); } return t; } if (encoding == EUC_JP || encoding == EUC_KR || encoding == EUC_CN) { if (!*statep) { if (c & 0x80) { *statep = c; return -1; } return c; } t = c; c = *statep; *statep = 0; if (encoding == EUC_JP) { if (c == 0x8e) return t | (KANA << 16); if (c == 0x8f) { *statep = t | (KANJI0212 << 8); return -1; } } c &= 0xff7f; t &= 0x7f; c = c << 8 | t; if (encoding == EUC_KR) return c | (3 << 16); if (encoding == EUC_CN) return c | (1 << 16); if (c & (KANJI0212 << 16)) return c; else return c | (KANJI << 16); } if (encoding == BIG5 || encoding == GBK) { if (!*statep) { if (c & 0x80) { if (encoding == GBK && c == 0x80) return 0xa4 | (('b'|0x80) << 16); *statep = c; return -1; } return c; } t = c; c = *statep; *statep = 0; c &= 0x7f; return c << 8 | t | (encoding == BIG5 ? 030 << 16 : 031 << 16); } return c | (encodings[encoding].deffont << 16); } int EncodeChar(bp, c, encoding, fontp) char *bp; int c; int encoding; int *fontp; { int t, f, l; debug2("Encoding char %02x for encoding %d\n", c, encoding); if (c == -1 && fontp) { if (*fontp == 0) return 0; if (bp) { *bp++ = 033; *bp++ = '('; *bp++ = 'B'; } return 3; } f = (c >> 16) & 0xff; #ifdef UTF8 if (encoding == UTF8) { if (f) { # ifdef DW_CHARS if (is_dw_font(f)) { int c2 = c & 0xff; c = (c >> 8 & 0xff) | (f << 8); c = recode_char_dw_to_encoding(c, &c2, encoding); } else # endif { c = (c & 0xff) | (f << 8); c = recode_char_to_encoding(c, encoding); } } return ToUtf8(bp, c); } if (f == 0 && (c & 0x7f00ff00) != 0) /* is_utf8? */ { if (c >= 0x10000) c = (c & 0x7f0000) >> 8 | (c & 0xffff); # ifdef DW_CHARS if (utf8_isdouble(c)) { int c2 = 0xffff; c = recode_char_dw_to_encoding(c, &c2, encoding); c = (c << 8) | (c2 & 0xff); } else # endif { c = recode_char_to_encoding(c, encoding); c = ((c & 0xff00) << 8) | (c & 0xff); } debug1("Encode: char mapped from utf8 to %x\n", c); f = c >> 16; } #endif if (f & 0x80) /* map special 96-fonts to latin1 */ f = 0; if (encoding == SJIS) { if (f == KANA) c = (c & 0xff) | 0x80; else if (f == KANJI) { if (!bp) return 2; t = c & 0xff; c = (c >> 8) & 0xff; t += (c & 1) ? ((t <= 0x5f) ? 0x1f : 0x20) : 0x7e; c = (c - 0x21) / 2 + ((c < 0x5f) ? 0x81 : 0xc1); *bp++ = c; *bp++ = t; return 2; } } if (encoding == EUC) { if (f == KANA) { if (bp) { *bp++ = 0x8e; *bp++ = c; } return 2; } if (f == KANJI) { if (bp) { *bp++ = (c >> 8) | 0x80; *bp++ = c | 0x80; } return 2; } if (f == KANJI0212) { if (bp) { *bp++ = 0x8f; *bp++ = c >> 8; *bp++ = c; } return 3; } } if ((encoding == EUC_KR && f == 3) || (encoding == EUC_CN && f == 1)) { if (bp) { *bp++ = (c >> 8) | 0x80; *bp++ = c | 0x80; } return 2; } if ((encoding == BIG5 && f == 030) || (encoding == GBK && f == 031)) { if (bp) { *bp++ = (c >> 8) | 0x80; *bp++ = c; } return 2; } if (encoding == GBK && f == 0 && c == 0xa4) c = 0x80; l = 0; if (fontp && f != *fontp) { *fontp = f; if (f && f < ' ') { if (bp) { *bp++ = 033; *bp++ = '$'; if (f > 2) *bp++ = '('; *bp++ = '@' + f; } l += f > 2 ? 4 : 3; } else if (f < 128) { if (f == 0) f = 'B'; if (bp) { *bp++ = 033; *bp++ = '('; *bp++ = f; } l += 3; } } if (c & 0xff00) { if (bp) *bp++ = c >> 8; l++; } if (bp) *bp++ = c; return l + 1; } int CanEncodeFont(encoding, f) int encoding, f; { switch(encoding) { #ifdef UTF8 case UTF8: return 1; #endif case SJIS: return f == KANJI || f == KANA; case EUC: return f == KANJI || f == KANA || f == KANJI0212; case EUC_KR: return f == 3; case EUC_CN: return f == 1; case BIG5: return f == 030; case GBK: return f == 031; default: break; } return 0; } #ifdef DW_CHARS int PrepareEncodedChar(c) int c; { int encoding; int t = 0; int f; encoding = D_encoding; f = D_rend.font; t = D_mbcs; if (encoding == SJIS) { if (f == KANA) return c | 0x80; else if (f == KANJI) { t += (c & 1) ? ((t <= 0x5f) ? 0x1f : 0x20) : 0x7e; c = (c - 0x21) / 2 + ((c < 0x5f) ? 0x81 : 0xc1); D_mbcs = t; } return c; } if (encoding == EUC) { if (f == KANA) { AddChar(0x8e); return c | 0x80; } if (f == KANJI) { D_mbcs = t | 0x80; return c | 0x80; } if (f == KANJI0212) { AddChar(0x8f); D_mbcs = t | 0x80; return c | 0x80; } } if ((encoding == EUC_KR && f == 3) || (encoding == EUC_CN && f == 1)) { D_mbcs = t | 0x80; return c | 0x80; } if ((encoding == BIG5 && f == 030) || (encoding == GBK && f == 031)) return c | 0x80; return c; } #endif int RecodeBuf(fbuf, flen, fenc, tenc, tbuf) unsigned char *fbuf; int flen; int fenc, tenc; unsigned char *tbuf; { int c, i, j; int decstate = 0, font = 0; for (i = j = 0; i < flen; i++) { c = fbuf[i]; c = DecodeChar(c, fenc, &decstate); if (c == -2) i--; if (c < 0) continue; j += EncodeChar(tbuf ? (char *)tbuf + j : 0, c, tenc, &font); } j += EncodeChar(tbuf ? (char *)tbuf + j : 0, -1, tenc, &font); return j; } #ifdef UTF8 int ContainsSpecialDeffont(ml, xs, xe, encoding) struct mline *ml; int xs, xe; int encoding; { unsigned char *f, *i; int c, x, dx; if (encoding == UTF8 || encodings[encoding].deffont == 0) return 0; i = ml->image + xs; f = ml->font + xs; dx = xe - xs + 1; while (dx-- > 0) { if (*f++) continue; c = *i++; x = recode_char_to_encoding(c | (encodings[encoding].deffont << 8), UTF8); if (c != x) { debug2("ContainsSpecialDeffont: yes %02x != %02x\n", c, x); return 1; } } debug("ContainsSpecialDeffont: no\n"); return 0; } int LoadFontTranslation(font, file) int font; char *file; { char buf[1024], *myfile; FILE *f; int i; int fo; int x, u, c, ok; unsigned short (*p)[2], (*tab)[2]; myfile = file; if (myfile == 0) { if (font == 0 || screenencodings == 0) return -1; if (strlen(screenencodings) > sizeof(buf) - 10) return -1; sprintf(buf, "%s/%02x", screenencodings, font & 0xff); myfile = buf; } debug1("LoadFontTranslation: trying %s\n", myfile); if ((f = secfopen(myfile, "r")) == 0) return -1; i = ok = 0; for (;;) { for(; i < 12; i++) if (getc(f) != "ScreenI2UTF8"[i]) break; if (getc(f) != 0) /* format */ break; fo = getc(f); /* id */ if (fo == EOF) break; if (font != -1 && font != fo) break; i = getc(f); x = getc(f); if (x == EOF) break; i = i << 8 | x; getc(f); while ((x = getc(f)) && x != EOF) getc(f); /* skip font name (padded to 2 bytes) */ if ((p = malloc(sizeof(*p) * (i + 1))) == 0) break; tab = p; while(i > 0) { x = getc(f); x = x << 8 | getc(f); u = getc(f); c = getc(f); u = u << 8 | c; if (c == EOF) break; (*p)[0] = x; (*p)[1] = u; p++; i--; } (*p)[0] = 0; (*p)[1] = 0; if (i || (tab[0][0] & 0x8000)) { free(tab); break; } if (recodetabs[fo].tab && (recodetabs[fo].flags & RECODETAB_ALLOCED) != 0) free(recodetabs[fo].tab); recodetabs[fo].tab = tab; recodetabs[fo].flags = RECODETAB_ALLOCED; debug1("Successful load of recodetab %02x\n", fo); c = getc(f); if (c == EOF) { ok = 1; break; } if (c != 'S') break; i = 1; } fclose(f); if (font != -1 && file == 0 && recodetabs[font].flags == 0) recodetabs[font].flags = RECODETAB_TRIED; return ok ? 0 : -1; } void LoadFontTranslationsForEncoding(encoding) int encoding; { char *c; int f; debug1("LoadFontTranslationsForEncoding: encoding %d\n", encoding); if ((c = encodings[encoding].fontlist) != 0) while ((f = (unsigned char)*c++) != 0) if (recodetabs[f].flags == 0) LoadFontTranslation(f, 0); f = encodings[encoding].deffont; if (f > 0 && recodetabs[f].flags == 0) LoadFontTranslation(f, 0); } #endif /* UTF8 */ #else /* !ENCODINGS */ /* Simple version of EncodeChar to encode font changes for * copy/paste mode */ int EncodeChar(bp, c, encoding, fontp) char *bp; int c; int encoding; int *fontp; { int f, l; f = (c == -1) ? 0 : c >> 16; l = 0; if (fontp && f != *fontp) { *fontp = f; if (f && f < ' ') { if (bp) { *bp++ = 033; *bp++ = '$'; if (f > 2) *bp++ = '('; *bp++ = '@' + f; } l += f > 2 ? 4 : 3; } else if (f < 128) { if (f == 0) f = 'B'; if (bp) { *bp++ = 033; *bp++ = '('; *bp++ = f; } l += 3; } } if (c == -1) return l; if (c & 0xff00) { if (bp) *bp++ = c >> 8; l++; } if (bp) *bp++ = c; return l + 1; } #endif /* ENCODINGS */ screen-4.2.1/search.c0000644000175000017500000002301412326710533013310 0ustar amadeamade/* Copyright (c) 2008, 2009 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Micah Cowan (micah@cowan.name) * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net) * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ #include #include "config.h" #include "screen.h" #include "mark.h" #include "extern.h" #define INPUTLINE (flayer->l_height - 1) extern struct layer *flayer; extern struct win *fore; #ifdef COPY_PASTE int search_ic; /******************************************************************** * VI style Search */ static int matchword __P((char *, int, int, int)); static void searchend __P((char *, int, char *)); static void backsearchend __P((char *, int, char *)); void Search(dir) int dir; { struct markdata *markdata; if (dir == 0) { markdata = (struct markdata *)flayer->l_data; if (markdata->isdir > 0) searchend(0, 0, NULL); else if (markdata->isdir < 0) backsearchend(0, 0, NULL); else LMsg(0, "No previous pattern"); } else Input((dir > 0 ? "/" : "?"), sizeof(markdata->isstr)-1, INP_COOKED, (dir > 0 ? searchend : backsearchend), NULL, 0); } static void searchend(buf, len, data) char *buf; int len; char *data; /* dummy */ { int x = 0, sx, ex, y; struct markdata *markdata; struct win *p; markdata = (struct markdata *)flayer->l_data; p = markdata->md_window; markdata->isdir = 1; if (len) strcpy(markdata->isstr, buf); sx = markdata->cx + 1; ex = flayer->l_width - 1; for (y = markdata->cy; y < p->w_histheight + flayer->l_height; y++, sx = 0) { if ((x = matchword(markdata->isstr, y, sx, ex)) >= 0) break; } if (y >= p->w_histheight + flayer->l_height) { LGotoPos(flayer, markdata->cx, W2D(markdata->cy)); LMsg(0, "Pattern not found"); } else revto(x, y); } static void backsearchend(buf, len, data) char *buf; int len; char *data; /* dummy */ { int sx, ex, x = -1, y; struct markdata *markdata; markdata = (struct markdata *)flayer->l_data; markdata->isdir = -1; if (len) strcpy(markdata->isstr, buf); ex = markdata->cx - 1; for (y = markdata->cy; y >= 0; y--, ex = flayer->l_width - 1) { sx = 0; while ((sx = matchword(markdata->isstr, y, sx, ex)) >= 0) x = sx++; if (x >= 0) break; } if (y < 0) { LGotoPos(flayer, markdata->cx, W2D(markdata->cy)); LMsg(0, "Pattern not found"); } else revto(x, y); } static int matchword(pattern, y, sx, ex) char *pattern; int y, sx, ex; { unsigned char *ip, *ipe, *cp, *pp; struct mline *ml; /* *sigh* to make WIN work */ fore = ((struct markdata *)flayer->l_data)->md_window; ml = WIN(y); ip = ml->image + sx; ipe = ml->image + flayer->l_width; for (;sx <= ex; sx++) { cp = ip++; pp = (unsigned char *)pattern; for (;;) { if (*cp != *pp) if (!search_ic || ((*cp ^ *pp) & 0xdf) || (*cp | 0x20) < 'a' || (*cp | 0x20) > 'z') break; cp++; pp++; if (*pp == 0) return sx; if (cp == ipe) break; } } return -1; } /******************************************************************** * Emacs style ISearch */ static char *isprompts[] = { "I-search backward: ", "failing I-search backward: ", "I-search: ", "failing I-search: " }; static int is_redo __P((struct markdata *)); static void is_process __P((char *, int, char *)); static int is_bm __P((char *, int, int, int, int)); static int is_bm(str, l, p, end, dir) char *str; int l, p, end, dir; { int tab[256]; int i, q; unsigned char *s, c; int w = flayer->l_width; /* *sigh* to make WIN work */ fore = ((struct markdata *)flayer->l_next->l_data)->md_window; debug2("is_bm: searching for %s len %d\n", str, l); debug3("start at %d end %d dir %d\n", p, end, dir); if (p < 0 || p + l > end) return -1; if (l == 0) return p; if (dir < 0) str += l - 1; for (i = 0; i < 256; i++) tab[i] = l * dir; for (i = 0; i < l - 1; i++, str += dir) { q = *(unsigned char *)str; tab[q] = (l - 1 - i) * dir; if (search_ic && (q | 0x20) >= 'a' && ((q | 0x20) <= 'z')) tab[q ^ 0x20] = (l - 1 - i) * dir; } if (dir > 0) p += l - 1; debug1("first char to match: %c\n", *str); while (p >= 0 && p < end) { q = p; s = (unsigned char *)str; for (i = 0;;) { c = (WIN(q / w))->image[q % w]; if (i == 0) p += tab[(int)(unsigned char) c]; if (c != *s) if (!search_ic || ((c ^ *s) & 0xdf) || (c | 0x20) < 'a' || (c | 0x20) > 'z') break; q -= dir; s -= dir; if (++i == l) return q + (dir > 0 ? 1 : -l); } } return -1; } /*ARGSUSED*/ static void is_process(p, n, data) /* i-search */ char *p; int n; char *data; /* dummy */ { int pos, x, y, dir; struct markdata *markdata; if (n == 0) return; ASSERT(p); markdata = (struct markdata *)flayer->l_next->l_data; pos = markdata->cx + markdata->cy * flayer->l_width; LGotoPos(flayer, markdata->cx, W2D(markdata->cy)); switch (*p) { case '\007': /* CTRL-G */ pos = markdata->isstartpos; /*FALLTHROUGH*/ case '\033': /* ESC */ *p = 0; break; case '\013': /* CTRL-K */ case '\027': /* CTRL-W */ markdata->isistrl = 1; /*FALLTHROUGH*/ case '\b': case '\177': if (markdata->isistrl == 0) return; markdata->isistrl--; pos = is_redo(markdata); *p = '\b'; break; case '\023': /* CTRL-S */ case '\022': /* CTRL-R */ if (markdata->isistrl >= (int)sizeof(markdata->isistr)) return; dir = (*p == '\023') ? 1 : -1; pos += dir; if (markdata->isdir == dir && markdata->isistrl == 0) { strcpy(markdata->isistr, markdata->isstr); markdata->isistrl = markdata->isstrl = strlen(markdata->isstr); break; } markdata->isdir = dir; markdata->isistr[markdata->isistrl++] = *p; break; default: if (*p < ' ' || markdata->isistrl >= (int)sizeof(markdata->isistr) || markdata->isstrl >= (int)sizeof(markdata->isstr) - 1) return; markdata->isstr[markdata->isstrl++] = *p; markdata->isistr[markdata->isistrl++] = *p; markdata->isstr[markdata->isstrl] = 0; debug2("New char: %c - left %d\n", *p, (int)sizeof(markdata->isistr) - markdata->isistrl); } if (*p && *p != '\b') pos = is_bm(markdata->isstr, markdata->isstrl, pos, flayer->l_width * (markdata->md_window->w_histheight + flayer->l_height), markdata->isdir); if (pos >= 0) { x = pos % flayer->l_width; y = pos / flayer->l_width; LAY_CALL_UP ( LayRedisplayLine(INPUTLINE, 0, flayer->l_width - 1, 0); revto(x, y); if (W2D(markdata->cy) == INPUTLINE) revto_line(markdata->cx, markdata->cy, INPUTLINE > 0 ? INPUTLINE - 1 : 1); ); } if (*p) inp_setprompt(isprompts[markdata->isdir + (pos < 0) + 1], markdata->isstrl ? markdata->isstr : ""); flayer->l_x = markdata->cx; flayer->l_y = W2D(markdata->cy); LGotoPos(flayer, flayer->l_x, flayer->l_y); if (!*p) { /* we are about to finish, keep cursor position */ flayer->l_next->l_x = markdata->cx; flayer->l_next->l_y = W2D(markdata->cy); } } static int is_redo(markdata) struct markdata *markdata; { int i, pos, npos, dir; char c; npos = pos = markdata->isstartpos; dir = markdata->isstartdir; markdata->isstrl = 0; for (i = 0; i < markdata->isistrl; i++) { c = markdata->isistr[i]; if (c == '\022') /* ^R */ pos += (dir = -1); else if (c == '\023') /* ^S */ pos += (dir = 1); else markdata->isstr[markdata->isstrl++] = c; if (pos >= 0) { npos = is_bm(markdata->isstr, markdata->isstrl, pos, flayer->l_width * (markdata->md_window->w_histheight + flayer->l_height), dir); if (npos >= 0) pos = npos; } } markdata->isstr[markdata->isstrl] = 0; markdata->isdir = dir; return npos; } void ISearch(dir) int dir; { struct markdata *markdata; markdata = (struct markdata *)flayer->l_data; markdata->isdir = markdata->isstartdir = dir; markdata->isstartpos = markdata->cx + markdata->cy * flayer->l_width; markdata->isistrl = markdata->isstrl = 0; if (W2D(markdata->cy) == INPUTLINE) revto_line(markdata->cx, markdata->cy, INPUTLINE > 0 ? INPUTLINE - 1 : 1); Input(isprompts[dir + 1], sizeof(markdata->isstr) - 1, INP_RAW, is_process, NULL, 0); LGotoPos(flayer, markdata->cx, W2D(markdata->cy)); flayer->l_x = markdata->cx; flayer->l_y = W2D(markdata->cy); } #endif /* COPY_PASTE */ screen-4.2.1/.gitignore0000644000175000017500000000026112326707020013663 0ustar amadeamade*.o .*.swp \#*\# *~ Makefile autom4te.cache cscope.out TAGS tags comm.h config.h config.h.in config.log config.status configure kmapdef.c osdef.h term.h screen stamp-h.in tty.c screen-4.2.1/braille_tsi.c0000644000175000017500000002217412326756555014360 0ustar amadeamade/* bd-tsi.c, TSI specific key bindings and display commands * * dotscreen * A braille interface to unix tty terminals * Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu * Bill Barry barryb@dots.physics.orst.edu * * Copyright (c) 1995 by Science Access Project, Oregon State University. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, see * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA * **************************************************************** */ #include "config.h" #include "screen.h" #include "extern.h" #include "braille.h" #ifdef HAVE_BRAILLE extern struct display *display; struct key2rc { int key; int nr; char *arg1; char *arg2; }; static int tsi_ctype = 1; /* cursor type, 0,1,2 */ static int tsi_line_type; /* indicates number of cells on powerbraille display 01=20 cells 02=40 cells 03=80 cells */ static int display_status_tsi __P((void)); static int write_line_tsi __P((char *, int, int)); static void buttonpress_tsi __P((struct key2rc *)); static void buttonpress_navigator_40 __P((void)); static void buttonpress_powerbraille_40 __P((void)); static void buttonpress_powerbraille_80 __P((void)); int bd_init_powerbraille_40() { bd.write_line_braille = write_line_tsi; bd.buttonpress = buttonpress_powerbraille_40; bd.bd_response_test = display_status_tsi; bd.bd_ncells = 40; tsi_line_type = 2; return 0; } int bd_init_powerbraille_80() { bd.write_line_braille = write_line_tsi; bd.buttonpress = buttonpress_powerbraille_80; bd.bd_response_test = display_status_tsi; bd.bd_ncells = 80; tsi_line_type = 3; return 0; } int bd_init_navigator_40() { bd.write_line_braille = write_line_tsi; bd.buttonpress = buttonpress_navigator_40; bd.bd_response_test = display_status_tsi; bd.bd_ncells = 40; tsi_line_type = 2; return 0; } static int display_status_tsi() { char obuf[3],ibuf[20]; int r; obuf[0] = 0xff; obuf[1] = 0xff; obuf[2] = 0x0a; r = read(bd.bd_fd, ibuf, 20); /* flush the input port */ r = write(bd.bd_fd, obuf, 3); if (r != 3) return -1; /* we have written to the display asking for a response we wait 1 second for the response, read it and if no response we wait 2 seconds, if still no response, return -1 to indicate no braille display available */ sleep(1); r = read(bd.bd_fd, ibuf, 2); if (r == -1) { sleep(2); r = read(bd.bd_fd, ibuf, 2); } debug2("first chars from braille display %d %d\n",ibuf[0],ibuf[1]); if (r != 2 || ibuf[0] != 0 || ibuf[1] != 5) return -1; r= read(bd.bd_fd,ibuf,2); if (r != 2) return -1; debug2("braille display size:%d dots:%d\n", ibuf[0], ibuf[1]); bd.bd_ncells = (unsigned char)ibuf[0]; if (bd.bd_ncells <= 1) return -1; r = read(bd.bd_fd,ibuf,1); if (r != 1) return -1; if (ibuf[0] == 'V') r = read(bd.bd_fd, ibuf, 3); else r = read(bd.bd_fd, ibuf + 1, 2) + 1; if (r != 3) return -1; ibuf[3] = 0; debug1("braille display version %s\n", ibuf); bd.bd_version = atof(ibuf); return 0; } static int write_line_tsi (bstr,line_length, cursor_pos) char *bstr; int line_length, cursor_pos; { int obp, i; bd.bd_obuf[0] = 0xff; bd.bd_obuf[1] = 0xff; bd.bd_obuf[2] = tsi_line_type; bd.bd_obuf[3] = 0x07; bd.bd_obuf[4] = cursor_pos; bd.bd_obuf[5] = tsi_ctype; obp=6; for (i=0; i < line_length; i++) { bd.bd_obuf[2*i+obp] = 0; bd.bd_obuf[2*i+1+obp] = bd.bd_btable[(int)(unsigned char)bstr[i]]; } for (i=line_length; i < bd.bd_ncells; i++) { bd.bd_obuf[2*i+obp] = 0; bd.bd_obuf[2*i+1+obp] = bd.bd_btable[(int)' ']; } bd.bd_obuflen = 2*bd.bd_ncells + obp ; return 0; } static struct key2rc keys_navigator_40[] = { {0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */ {0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */ {0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */ {0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */ {0x2000, RC_BD_BC_LEFT, 0, 0}, /* 6 */ {0x8000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */ {0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */ {0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */ {0x6000, RC_BD_UPPER_LEFT, 0, 0}, /* 6, 7 */ {0xc000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */ {0x12000, RC_BD_LOWER_LEFT, 0, 0}, /* 6, 9 */ {0x18000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */ {0xa000, RC_BD_INFO, "1032", 0}, /* bc 6, 8 */ {0x14000000, RC_BD_INFO, "2301", 0}, /* sc 1, 3 */ {0x4008000, RC_BD_INFO, "3330", 0}, /* bc+sc 1, 8 */ {0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */ {0x8004000, RC_BD_EIGHTDOT, 0, 0}, /* 2, 7 */ {0x40000000, RC_STUFF, "\015", 0}, /* 5 */ {0x20000, RC_BD_LINK, 0, 0}, /* 10 */ {0x10002000, RC_BD_SCROLL, 0, 0}, /* 3, 6 */ {0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */ {0x14000, RC_BD_SKIP, 0, 0}, /* 7, 9*/ {-1, RC_ILLEGAL, 0, 0} }; static struct key2rc keys_powerbraille_40[] = { {0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */ {0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */ {0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */ {0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */ {0x2000, RC_BD_BC_LEFT, 0, 0}, /* 6 */ {0x8000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */ {0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */ {0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */ {0x8002000, RC_BD_UPPER_LEFT, 0, 0}, /* 2, 6 */ {0xc000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */ {0x20002000, RC_BD_LOWER_LEFT, 0, 0}, /* 3, 6 */ {0x18000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */ {0x8008000, RC_BD_INFO, "1032", 0}, /* bc 2, 8 */ {0x6000, RC_BD_INFO, "2301", 0}, /* 6, 7 */ {0x8004000, RC_BD_INFO, "3330", 0}, /* bc+sc 2, 7 */ {0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */ {0x20008000, RC_BD_EIGHTDOT, 0, 0}, /* 4, 6 */ {0x40000000, RC_STUFF, "\015", 0}, /* 5 */ {0x20000, RC_BD_LINK, 0, 0}, /* 10 */ {0xa000, RC_BD_SCROLL, 0, 0}, /* 6, 8 */ {0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */ {0x20004000, RC_BD_SKIP, 0, 0}, /* 4, 7 */ {-1, RC_ILLEGAL, 0, 0} }; static struct key2rc keys_powerbraille_80[] = { {0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */ {0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */ {0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */ {0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */ {0x40000, RC_BD_BC_LEFT, 0, 0}, /* 6 */ {0x100000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */ {0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */ {0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */ {0x44000, RC_BD_UPPER_LEFT, 0, 0}, /* 6, 7 */ {0x104000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */ {0x50000, RC_BD_LOWER_LEFT, 0, 0}, /* 6, 9 */ {0x110000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */ {0x8100000, RC_BD_INFO, "1032", 0}, /* 2, 8 */ {0x8040000, RC_BD_INFO, "2301", 0}, /* 2, 6 */ {0x140000, RC_BD_INFO, "3330", 0}, /* 6, 8 */ {0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */ {0x8004000, RC_BD_EIGHTDOT, 0, 0}, /* 2, 7 */ {0x40000000, RC_STUFF, "\015", 0}, /* 5 */ {0x20000, RC_BD_LINK, 0, 0}, /* 10 */ {0x20004000, RC_BD_SCROLL, 0, 0}, /* 4, 7 */ {0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */ {0x40010000, RC_BD_SKIP, 0, 0}, /* 5, 9 */ {-1, RC_ILLEGAL, 0, 0} }; static void buttonpress_tsi(tab) struct key2rc *tab; { int i, nb; int bkeys; unsigned char buf[10]; nb = read(bd.bd_fd, buf, 10); debug1("buttonpress_tsi: read %d bytes\n", nb); for (i=0, bkeys=0; i < nb; i++) { switch (buf[i] & 0xE0) { case 0x00: bkeys += ((int)(buf[i] & 0x1f) ); break; case 0x20: bkeys += ((int)(buf[i] & 0x1f) << 5 ); break; case 0x40: bkeys += ((int)(buf[i] & 0x1f) << 9 ); break; case 0x60: bkeys += ((int)(buf[i] & 0x1f) << 13 ); break; case 0xA0: bkeys += ((int)(buf[i] & 0x1f) << 18 ); break; case 0xC0: bkeys += ((int)(buf[i] & 0x1f) << 22 ); break; case 0xE0: bkeys += ((int)(buf[i] & 0x1f) << 26 ); break; default: break; } } debug1("bkeys %x\n", bkeys); for (i = 0; tab[i].key != -1; i++) if (bkeys == tab[i].key) break; debug1("bkey index %d\n", i); if (tab[i].key != -1 && tab[i].nr != RC_ILLEGAL) { char *args[3]; int argl[2]; struct action act; args[0] = tab[i].arg1; args[1] = tab[i].arg2; args[2] = 0; argl[0] = args[0] ? strlen(args[0]) : 0; argl[1] = args[1] ? strlen(args[1]) : 0; act.nr = tab[i].nr; act.args = args; act.argl = argl; display = bd.bd_dpy; DoAction(&act, -2); } } static void buttonpress_navigator_40() { buttonpress_tsi(keys_navigator_40); } static void buttonpress_powerbraille_40() { buttonpress_tsi(keys_powerbraille_40); } static void buttonpress_powerbraille_80() { buttonpress_tsi(keys_powerbraille_80); } #endif /* HAVE_BRAILLE */ screen-4.2.1/doc/0000755000175000017500000000000012327301453012442 5ustar amadeamadescreen-4.2.1/doc/screen.info0000644000175000017500000077153512327301231014612 0ustar amadeamadeThis is screen.info, produced by texi2any version 5.2 from screen.texinfo. INFO-DIR-SECTION General Commands START-INFO-DIR-ENTRY * Screen: (screen). Full-screen window manager. END-INFO-DIR-ENTRY This file documents the 'Screen' virtual terminal manager. Copyright (c) 1993-2003 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.  File: screen.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) Screen ****** This file documents the 'Screen' virtual terminal manager, version 4.1.0. * Menu: * Overview:: Preliminary information. * Getting Started:: An introduction to 'screen'. * Invoking Screen:: Command line options for 'screen'. * Customization:: The '.screenrc' file. * Commands:: List all of the commands. * New Window:: Running a program in a new window. * Selecting:: Selecting a window to display. * Session Management:: Suspend/detach, grant access, connect sessions. * Regions:: Split-screen commands. * Window Settings:: Titles, logging, etc. * Virtual Terminal:: Controlling the 'screen' VT100 emulation. * Copy and Paste:: Exchanging text between windows and sessions. * Subprocess Execution:: I/O filtering with 'exec'. * Key Binding:: Binding commands to keys. * Flow Control:: Trap or pass flow control characters. * Termcap:: Tweaking your terminal's termcap entry. * Message Line:: The 'screen' message line. * Logging:: Keeping a record of your session. * Startup:: Functions only useful at 'screen' startup. * Miscellaneous:: Various other commands. * String Escapes:: Inserting current information into strings * Environment:: Environment variables used by 'screen'. * Files:: Files used by 'screen'. * Credits:: Who's who of 'screen'. * Bugs:: What to do if you find a bug. * Installation:: Getting 'screen' running on your system. * Concept Index:: Index of concepts. * Command Index:: Index of all 'screen' commands. * Keystroke Index:: Index of default key bindings.  File: screen.info, Node: Overview, Next: Getting Started, Prev: Top, Up: Top 1 Overview ********** Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. Each virtual terminal provides the functions of the DEC VT100 terminal and, in addition, several control functions from the ISO 6429 (ECMA 48, ANSI X3.64) and ISO 2022 standards (e.g. insert/delete line and support for multiple character sets). There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows the user to move text regions between windows. When 'screen' is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill the current window, view a list of the active windows, turn output logging on and off, copy text between windows, view the scrollback history, switch between windows, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user's terminal. When a program terminates, 'screen' (per default) kills the window that contained it. If this window was in the foreground, the display switches to the previously displayed window; if none are left, 'screen' exits. Shells usually distinguish between running as login-shell or sub-shell. Screen runs them as sub-shells, unless told otherwise (See 'shell' .screenrc command). Everything you type is sent to the program running in the current window. The only exception to this is the one keystroke that is used to initiate a command to the window manager. By default, each command begins with a control-a (abbreviated 'C-a' from now on), and is followed by one other keystroke. The command character (*note Command Character::) and all the key bindings (*note Key Binding::) can be fully customized to be anything you like, though they are always two characters in length. 'Screen' does not understand the prefix 'C-' to mean control, although this notation is used in this manual for readability. Please use the caret notation ('^A' instead of 'C-a') as arguments to e.g. the 'escape' command or the '-e' option. 'Screen' will also print out control characters in caret notation. The standard way to create a new window is to type 'C-a c'. This creates a new window running a shell and switches to that window immediately, regardless of the state of the process running in the current window. Similarly, you can create a new window with a custom command in it by first binding the command to a keystroke (in your '.screenrc' file or at the 'C-a :' command line) and then using it just like the 'C-a c' command. In addition, new windows can be created by running a command like: screen emacs prog.c from a shell prompt within a previously created window. This will not run another copy of 'screen', but will instead supply the command name and its arguments to the window manager (specified in the $STY environment variable) who will use it to create the new window. The above example would start the 'emacs' editor (editing 'prog.c') and switch to its window. - Note that you cannot transport environment variables from the invoking shell to the application (emacs in this case), because it is forked from the parent screen process, not from the invoking shell. If '/etc/utmp' is writable by 'screen', an appropriate record will be written to this file for each window, and removed when the window is closed. This is useful for working with 'talk', 'script', 'shutdown', 'rsend', 'sccs' and other similar programs that use the utmp file to determine who you are. As long as 'screen' is active on your terminal, the terminal's own record is removed from the utmp file. *Note Login::.  File: screen.info, Node: Getting Started, Next: Invoking Screen, Prev: Overview, Up: Top 2 Getting Started ***************** Before you begin to use 'screen' you'll need to make sure you have correctly selected your terminal type, just as you would for any other termcap/terminfo program. (You can do this by using 'tset', 'qterm', or just 'set term=mytermtype', for example.) If you're impatient and want to get started without doing a lot more reading, you should remember this one command: 'C-a ?' (*note Key Binding::). Typing these two characters will display a list of the available 'screen' commands and their bindings. Each keystroke is discussed in the section on keystrokes (*note Default Key Bindings::). Another section (*note Customization::) deals with the contents of your '.screenrc'. If your terminal is a "true" auto-margin terminal (it doesn't allow the last position on the screen to be updated without scrolling the screen) consider using a version of your terminal's termcap that has automatic margins turned _off_. This will ensure an accurate and optimal update of the screen in all circumstances. Most terminals nowadays have "magic" margins (automatic margins plus usable last column). This is the VT100 style type and perfectly suited for 'screen'. If all you've got is a "true" auto-margin terminal 'screen' will be content to use it, but updating a character put into the last position on the screen may not be possible until the screen scrolls or the character is moved into a safe position in some other way. This delay can be shortened by using a terminal with insert-character capability. *Note Special Capabilities::, for more information about telling 'screen' what kind of terminal you have.  File: screen.info, Node: Invoking Screen, Next: Customization, Prev: Getting Started, Up: Top 3 Invoking 'Screen' ******************* Screen has the following command-line options: '-a' Include _all_ capabilities (with some minor exceptions) in each window's termcap, even if 'screen' must redraw parts of the display in order to implement a function. '-A' Adapt the sizes of all windows to the size of the display. By default, 'screen' may try to restore its old window sizes when attaching to resizable terminals (those with 'WS' in their descriptions, e.g. 'suncmd' or some varieties of 'xterm'). '-c FILE' Use FILE as the user's configuration file instead of the default of '$HOME/.screenrc'. '-d [PID.SESSIONNAME]' '-D [PID.SESSIONNAME]' Do not start 'screen', but instead detach a 'screen' session running elsewhere (*note Detach::). '-d' has the same effect as typing 'C-a d' from the controlling terminal for the session. '-D' is the equivalent to the power detach key. If no session can be detached, this option is ignored. In combination with the '-r'/'-R' option more powerful effects can be achieved: '-d -r' Reattach a session and if necessary detach it first. '-d -R' Reattach a session and if necessary detach or even create it first. '-d -RR' Reattach a session and if necessary detach or create it. Use the first session if more than one session is available. '-D -r' Reattach a session. If necessary detach and logout remotely first. '-D -R' Attach here and now. In detail this means: If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user. This is the author's favorite. '-D -RR' Attach here and now. Whatever that means, just do it. _Note_: It is a good idea to check the status of your sessions with 'screen -list' before using this option. '-e XY' Set the command character to X, and the character generating a literal command character (when typed after the command character) to Y. The defaults are 'C-a' and 'a', which can be specified as '-e^Aa'. When creating a 'screen' session, this option sets the default command character. In a multiuser session all users added will start off with this command character. But when attaching to an already running session, this option only changes the command character of the attaching user. This option is equivalent to the commands 'defescape' or 'escape' respectively. (*note Command Character::). '-f' '-fn' '-fa' Set flow-control to on, off, or automatic switching mode, respectively. This option is equivalent to the 'defflow' command (*note Flow Control::). '-h NUM' Set the history scrollback buffer to be NUM lines high. Equivalent to the 'defscrollback' command (*note Copy::). '-i' Cause the interrupt key (usually 'C-c') to interrupt the display immediately when flow control is on. This option is equivalent to the 'interrupt' argument to the 'defflow' command (*note Flow Control::). Its use is discouraged. '-l' '-ln' Turn login mode on or off (for '/etc/utmp' updating). This option is equivalent to the 'deflogin' command (*note Login::). '-ls [MATCH]' '-list [MATCH]' Do not start 'screen', but instead print a list of session identification strings (usually of the form PID.TTY.HOST; *note Session Name::). Sessions marked 'detached' can be resumed with 'screen -r'. Those marked 'attached' are running and have a controlling terminal. If the session runs in multiuser mode, it is marked 'multi'. Sessions marked as 'unreachable' either live on a different host or are dead. An unreachable session is considered dead, when its name matches either the name of the local host, or the specified parameter, if any. See the '-r' flag for a description how to construct matches. Sessions marked as 'dead' should be thoroughly checked and removed. Ask your system administrator if you are not sure. Remove sessions with the '-wipe' option. '-L' Tell 'screen' to turn on automatic output logging for the windows. '-m' Tell 'screen' to ignore the '$STY' environment variable. When this option is used, a new session will always be created, regardless of whether 'screen' is being called from within another 'screen' session or not. This flag has a special meaning in connection with the '-d' option: '-d -m' Start 'screen' in _detached_ mode. This creates a new session but doesn't attach to it. This is useful for system startup scripts. '-D -m' This also starts 'screen' in _detached_ mode, but doesn't fork a new process. The command exits if the session terminates. '-O' Select a more optimal output mode for your terminal rather than true VT100 emulation (only affects auto-margin terminals without 'LP'). This can also be set in your '.screenrc' by specifying 'OP' in the 'termcap' command. '-p NAME_OR_NUMBER|-|=|+' Preselect a window. This is useful when you want to reattach to a specific window or you want to send a command via the '-X' option to a specific window. As with screen's select command, '-' selects the blank window. As a special case for reattach, '=' brings up the windowlist on the blank window, while a '+' will create new window. The command will not be executed if the specified window could not be found. '-q' Suppress printing of error messages. In combination with '-ls' the exit value is set as follows: 9 indicates a directory without sessions. 10 indicates a directory with running but not attachable sessions. 11 (or more) indicates 1 (or more) usable sessions. In combination with '-r' the exit value is as follows: 10 indicates that there is no session to resume. 12 (or more) indicates that there are 2 (or more) sessions to resume and you should specify which one to choose. In all other cases '-q' has no effect. '-Q' Some commands now can be queried from a remote session using this flag, e.g. 'screen -Q windows'. The commands will send the response to the stdout of the querying process. If there was an error in the command, then the querying process will exit with a non-zero status. The commands that can be queried now are: 'echo' 'info' 'lastmsg' 'number' 'select' 'time' 'title' 'windows' '-r [PID.SESSIONNAME]' '-r SESSIONOWNER/[PID.SESSIONNAME]' Resume a detached 'screen' session. No other options (except combinations with '-d' or '-D') may be specified, though the session name (*note Session Name::) may be needed to distinguish between multiple detached 'screen' sessions. The second form is used to connect to another user's screen session which runs in multiuser mode. This indicates that screen should look for sessions in another user's directory. This requires setuid-root. '-R' Resume the first appropriate detached 'screen' session. If successful, all other command-line options are ignored. If no detached session exists, start a new session using the specified options, just as if '-R' had not been specified. This option is set by default if screen is run as a login-shell (actually screen uses '-xRR' in that case). For combinations with the '-D'/'-d' option see there. '-s PROGRAM' Set the default shell to be PROGRAM. By default, 'screen' uses the value of the environment variable '$SHELL', or '/bin/sh' if it is not defined. This option is equivalent to the 'shell' command (*note Shell::). See also there. '-S SESSIONNAME' Set the name of the new session to SESSIONNAME. This option can be used to specify a meaningful name for the session in place of the default TTY.HOST suffix. This name identifies the session for the 'screen -list' and 'screen -r' commands. This option is equivalent to the 'sessionname' command (*note Session Name::). '-t NAME' Set the title (name) for the default shell or specified program. This option is equivalent to the 'shelltitle' command (*note Shell::). '-T TERM' Set the $TERM enviroment varible using the spcified _term_ as opposed to the defualt setting of 'screen'. '-U' Run screen in UTF-8 mode. This option tells screen that your terminal sends and understands UTF-8 encoded characters. It also sets the default encoding for new windows to 'utf8'. '-v' Print the version number. '-wipe [MATCH]' List available screens like 'screen -ls', but remove destroyed sessions instead of marking them as 'dead'. An unreachable session is considered dead, when its name matches either the name of the local host, or the explicitly given parameter, if any. See the '-r' flag for a description how to construct matches. '-x' Attach to a session which is already attached elsewhere (multi-display mode). 'Screen' refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care. '-X' Send the specified command to a running screen session. You may use the '-S' option to specify the screen session if you have several running. You can use the '-d' or '-r' option to tell screen to look only for attached or detached screen sessions. Note that this command doesn't work if the session is password protected.  File: screen.info, Node: Customization, Next: Commands, Prev: Invoking Screen, Up: Top 4 Customizing 'Screen' ********************** You can modify the default settings for 'screen' to fit your tastes either through a personal '.screenrc' file which contains commands to be executed at startup, or on the fly using the 'colon' command. * Menu: * Startup Files:: The '.screenrc' file. * Source:: Read commands from a file. * Colon:: Entering customization commands interactively.  File: screen.info, Node: Startup Files, Next: Source, Up: Customization 4.1 The '.screenrc' file ======================== When 'screen' is invoked, it executes initialization commands from the files '.screenrc' in the user's home directory and '/usr/local/etc/screenrc'. These defaults can be overridden in the following ways: For the global screenrc file 'screen' searches for the environment variable '$SYSSCREENRC' (this override feature may be disabled at compile-time). The user specific screenrc file is searched for in '$SCREENRC', then '$HOME/.screenrc'. The command line option '-c' specifies which file to use (*note Invoking Screen::. Commands in these files are used to set options, bind commands to keys, and to automatically establish one or more windows at the beginning of your 'screen' session. Commands are listed one per line, with empty lines being ignored. A command's arguments are separated by tabs or spaces, and may be surrounded by single or double quotes. A '#' turns the rest of the line into a comment, except in quotes. Unintelligible lines are warned about and ignored. Commands may contain references to environment variables. The syntax is the shell-like '$VAR' or '${VAR}'. Note that this causes incompatibility with previous 'screen' versions, as now the '$'-character has to be protected with '\' if no variable substitution is intended. A string in single-quotes is also protected from variable substitution. Two configuration files are shipped as examples with your screen distribution: 'etc/screenrc' and 'etc/etcscreenrc'. They contain a number of useful examples for various commands.  File: screen.info, Node: Source, Next: Colon, Prev: Startup Files, Up: Customization 4.2 Source ========== -- Command: source file (none) Read and execute commands from file FILE. Source commands may be nested to a maximum recursion level of ten. If FILE is not an absolute path and screen is already processing a source command, the parent directory of the running source command file is used to search for the new command file before screen's current directory. Note that termcap/terminfo/termcapinfo commands only work at startup and reattach time, so they must be reached via the default screenrc files to have an effect.  File: screen.info, Node: Colon, Prev: Source, Up: Customization 4.3 Colon ========= Customization can also be done online, with this command: -- Command: colon ('C-a :') Allows you to enter '.screenrc' command lines. Useful for on-the-fly modification of key bindings, specific window creation and changing settings. Note that the 'set' keyword no longer exists, as of version 3.3. Change default settings with commands starting with 'def'. You might think of this as the 'ex' command mode of 'screen', with 'copy' as its 'vi' command mode (*note Copy and Paste::).  File: screen.info, Node: Commands, Next: New Window, Prev: Customization, Up: Top 5 Commands ********** A command in 'screen' can either be bound to a key, invoked from a screenrc file, or called from the 'colon' prompt (*note Customization::). As of version 3.3, all commands can be bound to keys, although some may be less useful than others. For a number of real life working examples of the most important commands see the files 'etc/screenrc' and 'etc/etcscreenrc' of your screen distribution. In this manual, a command definition looks like this: - Command: command [-n] ARG1 [ARG2] ... (KEYBINDINGS) This command does something, but I can't remember what. An argument in square brackets ('[]') is optional. Many commands take an argument of 'on' or 'off', which is indicated as STATE in the definition. * Menu: * Default Key Bindings:: 'screen' keyboard commands. * Command Summary:: List of all commands.  File: screen.info, Node: Default Key Bindings, Next: Command Summary, Up: Commands 5.1 Default Key Bindings ======================== As mentioned previously, each keyboard command consists of a 'C-a' followed by one other character. For your convenience, all commands that are bound to lower-case letters are also bound to their control character counterparts (with the exception of 'C-a a'; see below). Thus, both 'C-a c' and 'C-a C-c' can be used to create a window. The following table shows the default key bindings: 'C-a '' (select) Prompt for a window identifier and switch. *Note Selecting::. 'C-a "' (windowlist -b) Present a list of all windows for selection. *Note Selecting::. 'C-a 0...9, -' (select 0...select 9, select -) Switch to window number 0...9, or the blank window. *Note Selecting::. 'C-a ' (focus) Switch the input focus to the next region. *Note Regions::. 'C-a C-a' (other) Toggle to the window displayed previously. If this window does no longer exist, 'other' has the same effect as 'next'. *Note Selecting::. 'C-a a' (meta) Send the command character (C-a) to window. See 'escape' command. *Note Command Character::. 'C-a A' (title) Allow the user to enter a title for the current window. *Note Naming Windows::. 'C-a b' 'C-a C-b' (break) Send a break to the tty. *Note Break::. 'C-a B' (pow_break) Close and reopen the tty-line. *Note Break::. 'C-a c' 'C-a C-c' (screen) Create a new window with a shell and switch to that window. *Note Screen Command::. 'C-a C' (clear) Clear the screen. *Note Clear::. 'C-a d' 'C-a C-d' (detach) Detach 'screen' from this terminal. *Note Detach::. 'C-a D D' (pow_detach) Detach and logout. *Note Power Detach::. 'C-a f' 'C-a C-f' (flow) Cycle flow among 'on', 'off' or 'auto'. *Note Flow::. 'C-a F' (fit) Resize the window to the current region size. *Note Fit::. 'C-a C-g' (vbell) Toggle visual bell mode. *Note Bell::. 'C-a h' (hardcopy) Write a hardcopy of the current window to the file "hardcopy.N". *Note Hardcopy::. 'C-a H' (log) Toggle logging of the current window to the file "screenlog.N". *Note Log::. 'C-a i' 'C-a C-i' (info) Show info about the current window. *Note Info::. 'C-a k' 'C-a C-k' (kill) Destroy the current window. *Note Kill::. 'C-a l' 'C-a C-l' (redisplay) Fully refresh the current window. *Note Redisplay::. 'C-a L' (login) Toggle the current window's login state. *Note Login::. 'C-a m' 'C-a C-m' (lastmsg) Repeat the last message displayed in the message line. *Note Last Message::. 'C-a M' (monitor) Toggle monitoring of the current window. *Note Monitor::. 'C-a ' 'C-a n' 'C-a C-n' (next) Switch to the next window. *Note Selecting::. 'C-a N' (number) Show the number (and title) of the current window. *Note Number::. 'C-a p' 'C-a C-p' 'C-a C-h' 'C-a ' (prev) Switch to the previous window (opposite of 'C-a n'). *Note Selecting::. 'C-a q' 'C-a C-q' (xon) Send a ^Q (ASCII XON) to the current window. *Note XON/XOFF::. 'C-a Q' (only) Delete all regions but the current one. *Note Regions::. 'C-a r' 'C-a C-r' (wrap) Toggle the current window's line-wrap setting (turn the current window's automatic margins on or off). *Note Wrap::. 'C-a s' 'C-a C-s' (xoff) Send a ^S (ASCII XOFF) to the current window. *Note XON/XOFF::. 'C-a S' (split) Split the current region horizontally into two new ones. *Note Regions::. 'C-a t' 'C-a C-t' (time) Show the load average and xref. *Note Time::. 'C-a v' (version) Display the version and compilation date. *Note Version::. 'C-a C-v' (digraph) Enter digraph. *Note Digraph::. 'C-a w' 'C-a C-w' (windows) Show a list of active windows. *Note Windows::. 'C-a W' (width) Toggle between 80 and 132 columns. *Note Window Size::. 'C-a x' 'C-a C-x' (lockscreen) Lock your terminal. *Note Lock::. 'C-a X' (remove) Kill the current region. *Note Regions::. 'C-a z' 'C-a C-z' (suspend) Suspend 'screen'. *Note Suspend::. 'C-a Z' (reset) Reset the virtual terminal to its "power-on" values. *Note Reset::. 'C-a .' (dumptermcap) Write out a '.termcap' file. *Note Dump Termcap::. 'C-a ?' (help) Show key bindings. *Note Help::. 'C-a \' (quit) Kill all windows and terminate 'screen'. *Note Quit::. 'C-a :' (colon) Enter a command line. *Note Colon::. 'C-a [' 'C-a C-[' 'C-a ' (copy) Enter copy/scrollback mode. *Note Copy::. 'C-a ]' 'C-a C-]' (paste .) Write the contents of the paste buffer to the stdin queue of the current window. *Note Paste::. 'C-a {' 'C-a }' (history) Copy and paste a previous (command) line. *Note History::. 'C-a >' (writebuf) Write the paste buffer out to the screen-exchange file. *Note Screen Exchange::. 'C-a <' (readbuf) Read the screen-exchange file into the paste buffer. *Note Screen Exchange::. 'C-a =' (removebuf) Delete the screen-exchange file. *Note Screen Exchange::. 'C-a _' (silence) Start/stop monitoring the current window for inactivity. *Note Monitor::. 'C-a |' (split -v) Split the current region vertically into two new ones. *Note Regions::. 'C-a ,' (license) Show the copyright page. *Note License::. 'C-a *' (displays) Show the listing of attached displays. *Note Displays::.  File: screen.info, Node: Command Summary, Prev: Default Key Bindings, Up: Commands 5.2 Command Summary =================== 'acladd USERNAMES' Allow other users in this session. *Note Multiuser Session::. 'aclchg USERNAMES PERMBITS LIST' Change a user's permissions. *Note Multiuser Session::. 'acldel USERNAME' Disallow other user in this session. *Note Multiuser Session::. 'aclgrp USRNAME [GROUPNAME]' Inherit permissions granted to a group leader. *Note Multiuser Session::. 'aclumask [USERS]+/-BITS ...' Predefine access to new windows. *Note Umask::. 'activity MESSAGE' Set the activity notification message. *Note Monitor::. 'addacl USERNAMES' Synonym to 'acladd'. *Note Multiuser Session::. 'allpartial STATE' Set all windows to partial refresh. *Note Redisplay::. 'altscreen STATE' Enables support for the "alternate screen" terminal capability. *Note Redisplay::. 'at [IDENT][#|*|%] COMMAND [ARGS]' Execute a command at other displays or windows. *Note At::. 'attrcolor ATTRIB [ATTRIBUTE/COLOR-MODIFIER]' Map attributes to colors. *Note Attrcolor::. 'autodetach STATE' Automatically detach the session on SIGHUP. *Note Detach::. 'autonuke STATE' Enable a clear screen to discard unwritten output. *Note Autonuke::. 'backtick ID LIFESPAN AUTOREFRESH COMMAND [ARGS]' Define a command for the backtick string escape. *Note Backtick::. 'bce [STATE]' Change background color erase. *Note Character Processing::. 'bell_msg [MESSAGE]' Set the bell notification message. *Note Bell::. 'bind [-c CLASS] KEY [COMMAND [ARGS]]' Bind a command to a key. *Note Bind::. 'bindkey [OPTS] [STRING [CMD ARGS]]' Bind a string to a series of keystrokes. *Note Bindkey::. 'blanker' Blank the screen. *Note Screen Saver::. 'blankerprg' Define a blanker program. *Note Screen Saver::. 'break [DURATION]' Send a break signal to the current window. *Note Break::. 'breaktype [TCSENDBREAK | TCSBRK | TIOCSBRK]' Specify how to generate breaks. *Note Break::. 'bufferfile [EXCHANGE-FILE]' Select a file for screen-exchange. *Note Screen Exchange::. 'c1 [STATE]' Change c1 code processing. *Note Character Processing::. 'caption MODE [STRING]' Change caption mode and string. *Note Regions::. 'chacl USERNAMES PERMBITS LIST' Synonym to 'aclchg'. *Note Multiuser Session::. 'charset SET' Change character set slot designation. *Note Character Processing::. 'chdir [DIRECTORY]' Change the current directory for future windows. *Note Chdir::. 'cjkwidth' Treat ambiguous width characters as full/half width. *Note Character Processing::. 'clear' Clear the window screen. *Note Clear::. 'colon' Enter a 'screen' command. *Note Colon::. 'command [-c CLASS]' Simulate the screen escape key. *Note Command Character::. 'compacthist [STATE]' Selects compaction of trailing empty lines. *Note Scrollback::. 'console [STATE]' Grab or ungrab console output. *Note Console::. 'copy' Enter copy mode. *Note Copy::. 'copy_reg [KEY]' Removed. Use 'paste' instead. *Note Registers::. 'crlf STATE' Select line break behavior for copying. *Note Line Termination::. 'debug STATE' Suppress/allow debugging output. *Note Debug::. 'defautonuke STATE' Select default autonuke behavior. *Note Autonuke::. 'defbce STATE' Select background color erase. *Note Character Processing::. 'defbreaktype [TCSENDBREAK | TCSBRK | TIOCSBRK]' Specify the default for generating breaks. *Note Break::. 'defc1 STATE' Select default c1 processing behavior. *Note Character Processing::. 'defcharset [SET]' Change defaul character set slot designation. *Note Character Processing::. 'defencoding ENC' Select default window encoding. *Note Character Processing::. 'defescape XY' Set the default command and 'meta' characters. *Note Command Character::. 'defflow FSTATE' Select default flow control behavior. *Note Flow::. 'defgr STATE' Select default GR processing behavior. *Note Character Processing::. 'defhstatus [STATUS]' Select default window hardstatus line. *Note Hardstatus::. 'deflog STATE' Select default window logging behavior. *Note Log::. 'deflogin STATE' Select default utmp logging behavior. *Note Login::. 'defmode MODE' Select default file mode for ptys. *Note Mode::. 'defmonitor STATE' Select default activity monitoring behavior. *Note Monitor::. 'defmousetrack ON|OFF' Select the default mouse tracking behavior. *Note Mousetrack::. 'defnonblock STATE|NUMSECS' Select default nonblock mode. *Note Nonblock::. 'defobuflimit LIMIT' Select default output buffer limit. *Note Obuflimit::. 'defscrollback NUM' Set default lines of scrollback. *Note Scrollback::. 'defshell COMMAND' Set the default program for new windows. *Note Shell::. 'defsilence STATE' Select default idle monitoring behavior. *Note Monitor::. 'defslowpaste MSEC' Select the default inter-character timeout when pasting. *Note Paste::. 'defutf8 STATE' Select default character encoding. *Note Character Processing::. 'defwrap STATE' Set default line-wrapping behavior. *Note Wrap::. 'defwritelock ON|OFF|AUTO' Set default writelock behavior. *Note Multiuser Session::. 'defzombie [KEYS]' Keep dead windows. *Note Zombie::. 'detach [-h]' Disconnect 'screen' from the terminal. *Note Detach::. 'digraph [PRESET [UNICODE-VALUE]]' Enter a digraph sequence. *Note Digraph::. 'dinfo' Display terminal information. *Note Info::. 'displays' List currently active user interfaces. *Note Displays::. 'dumptermcap' Write the window's termcap entry to a file. *Note Dump Termcap::. 'echo [-n] MESSAGE' Display a message on startup. *Note Startup::. 'encoding ENC [DENC]' Set the encoding of a window. *Note Character Processing::. 'escape XY' Set the command and 'meta' characters. *Note Command Character::. 'eval COMMAND1 [COMMAND2 ...]' Parse and execute each argument. *Note Eval::. 'exec [[FDPAT] COMMAND [ARGS ...]]' Run a subprocess (filter). *Note Exec::. 'fit' Change window size to current display size. *Note Window Size::. 'flow [FSTATE]' Set flow control behavior. *Note Flow::. 'focus' Move focus to next region. *Note Regions::. 'focusminsize' Force the current region to a certain size. *Note Focusminsize::. 'gr [STATE]' Change GR charset processing. *Note Character Processing::. 'group [GROUPTITLE]' Change or show the group the current window belongs to. *Note Window Groups::. 'hardcopy [-h] [FILE]' Write out the contents of the current window. *Note Hardcopy::. 'hardcopy_append STATE' Append to hardcopy files. *Note Hardcopy::. 'hardcopydir DIRECTORY' Place, where to dump hardcopy files. *Note Hardcopy::. 'hardstatus [STATE]' Use the hardware status line. *Note Hardware Status Line::. 'height [LINES [COLS]]' Set display height. *Note Window Size::. 'help [-c CLASS]' Display current key bindings. *Note Help::. 'history' Find previous command beginning .... *Note History::. 'hstatus STATUS' Change the window's hardstatus line. *Note Hardstatus::. 'idle [TIMEOUT [CMD ARGS]]' Define a screen saver command. *Note Screen Saver::. 'ignorecase [on|off]' Ignore character case in searches. *Note Searching::. 'info' Display window settings. *Note Info::. 'ins_reg [KEY]' Removed, use 'paste' instead. *Note Registers::. 'kill' Destroy the current window. *Note Kill::. 'lastmsg' Redisplay the last message. *Note Last Message::. 'layout new [TITLE]' Create a layout. *Note Layout::. 'layout remove [N|TITLE]' Delete a layout. *Note Layout::. 'layout next' Select the next layout. *Note Layout::. 'layout prev' Select the previous layout. *Note Layout::. 'layout select [N|TITLE]' Jump to a layout. *Note Layout::. 'layout show' List the available layouts. *Note Layout::. 'layout title [TITLE]' Show or set the title of a layout. *Note Layout::. 'layout number [N]' Show or set the number of a layout. *Note Layout::. 'layout attach [TITLE|:last]' Show or set which layout to reattach to. *Note Layout::. 'layout save [N|TITLE]' Remember the organization of a layout. *Note Layout::. 'layout autosave [ON|OFF]' Show or set the status of layout saving. *Note Layout::. 'layout dump [filename]' Save the layout arrangement to a file. *Note Layout::. 'license' Display licensing information. *Note Startup::. 'lockscreen' Lock the controlling terminal. *Note Lock::. 'log [STATE]' Log all output in the current window. *Note Log::. 'logfile FILENAME' Place where to collect logfiles. *Note Log::. 'login [STATE]' Log the window in '/etc/utmp'. *Note Login::. 'logtstamp [STATE]' Configure logfile time-stamps. *Note Log::. 'mapdefault' Use only the default mapping table for the next keystroke. *Note Bindkey Control::. 'mapnotnext' Don't try to do keymapping on the next keystroke. *Note Bindkey Control::. 'maptimeout N' Set the inter-character timeout used for keymapping. *Note Bindkey Control::. 'markkeys STRING' Rebind keys in copy mode. *Note Copy Mode Keys::. 'maxwin N' Set the maximum window number. *Note Maxwin::. 'meta' Insert the command character. *Note Command Character::. 'monitor [STATE]' Monitor activity in window. *Note Monitor::. 'mousetrack [ON|OFF]' Enable selecting split regions with mouse clicks. *Note Mousetrack::. 'msgminwait SEC' Set minimum message wait. *Note Message Wait::. 'msgwait SEC' Set default message wait. *Note Message Wait::. 'multiuser STATE' Go into single or multi user mode. *Note Multiuser Session::. 'nethack STATE' Use 'nethack'-like error messages. *Note Nethack::. 'next' Switch to the next window. *Note Selecting::. 'nonblock [STATE|NUMSECS]' Disable flow control to the current display. *Note Nonblock::.|NUMSECS] 'number [N]' Change/display the current window's number. *Note Number::. 'obuflimit [LIMIT]' Select output buffer limit. *Note Obuflimit::. 'only' Kill all other regions. *Note Regions::. 'other' Switch to the window you were in last. *Note Selecting::. 'partial STATE' Set window to partial refresh. *Note Redisplay::. 'password [CRYPTED_PW]' Set reattach password. *Note Detach::. 'paste [SRC_REGS [DEST_REG]]' Paste contents of paste buffer or registers somewhere. *Note Paste::. 'pastefont [STATE]' Include font information in the paste buffer. *Note Paste::. 'pow_break' Close and Reopen the window's terminal. *Note Break::. 'pow_detach' Detach and hang up. *Note Power Detach::. 'pow_detach_msg [MESSAGE]' Set message displayed on 'pow_detach'. *Note Power Detach::. 'prev' Switch to the previous window. *Note Selecting::. 'printcmd [CMD]' Set a command for VT100 printer port emulation. *Note Printcmd::. 'process [KEY]' Treat a register as input to 'screen'. *Note Registers::. 'quit' Kill all windows and exit. *Note Quit::. 'readbuf [-e ENCODING] [FILENAME]' Read the paste buffer from the screen-exchange file. *Note Screen Exchange::. 'readreg [-e ENCODING] [REG [FILE]]' Load a register from paste buffer or file. *Note Registers::. 'redisplay' Redisplay the current window. *Note Redisplay::. 'register [-e ENCODING] KEY STRING' Store a string to a register. *Note Registers::. 'remove' Kill current region. *Note Regions::. 'removebuf' Delete the screen-exchange file. *Note Screen Exchange::. 'rendition bell | monitor | silence | so ATTR [COLOR]' Change text attributes in caption for flagged windows. *Note Rendition::. 'reset' Reset the terminal settings for the window. *Note Reset::. 'resize [(+/-)lines]' Grow or shrink a region 'screen [OPTS] [N] [CMD [ARGS] | //group]' Create a new window. *Note Screen Command::. 'scrollback NUM' Set size of scrollback buffer. *Note Scrollback::. 'select [N|-|.]' Switch to a specified window. *Note Selecting::. 'sessionname [NAME]' Name this session. *Note Session Name::. 'setenv [VAR [STRING]]' Set an environment variable for new windows. *Note Setenv::. 'setsid STATE' Controll process group creation for windows. *Note Setsid::. 'shell COMMAND' Set the default program for new windows. *Note Shell::. 'shelltitle TITLE' Set the default name for new windows. *Note Shell::. 'silence [STATE|SECONDS]' Monitor a window for inactivity. *Note Monitor::. 'silencewait SECONDS' Default timeout to trigger an inactivity notify. *Note Monitor::. 'sleep NUM' Pause during startup. *Note Startup::. 'slowpaste MSEC' Slow down pasting in windows. *Note Paste::. 'source FILE' Run commands from a file. *Note Source::. 'sorendition [ATTR [COLOR]]' Deprecated. Use 'rendition so' instead. *Note Rendition::. 'split' Split region into two parts. *Note Regions::. 'startup_message STATE' Display copyright notice on startup. *Note Startup::. 'stuff [STRING]' Stuff a string in the input buffer of a window. *Note Paste::. 'su [USERNAME [PASSWORD [PASSWORD2]]]' Identify a user. *Note Multiuser Session::. 'suspend' Put session in background. *Note Suspend::. 'term TERM' Set '$TERM' for new windows. *Note Term::. 'termcap TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]' Tweak termcap entries for best performance. *Note Termcap Syntax::. 'terminfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]' Ditto, for terminfo systems. *Note Termcap Syntax::. 'termcapinfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]' Ditto, for both systems. *Note Termcap Syntax::. 'time [STRING]' Display time and load average. *Note Time::. 'title [WINDOWTITLE]' Set the name of the current window. *Note Title Command::. 'umask [USERS]+/-BITS ...' Synonym to 'aclumask'. *Note Umask::. 'unbindall' Unset all keybindings. *Note Bind::. 'unsetenv VAR' Unset environment variable for new windows. *Note Setenv::. 'utf8 [STATE [DSTATE]]' Select character encoding of the current window. *Note Character Processing::. 'vbell [STATE]' Use visual bell. *Note Bell::. 'vbell_msg [MESSAGE]' Set vbell message. *Note Bell::. 'vbellwait SEC' Set delay for vbell message. *Note Bell::. 'version' Display 'screen' version. *Note Version::. 'wall MESSAGE' Write a message to all displays. *Note Multiuser Session::. 'width [COLS [LINES]]' Set the width of the window. *Note Window Size::. 'windowlist [[-b] [-m] [-g]] | string [STRING] | title [TITLE]' Present a list of all windows for selection. *Note Windowlist::. 'windows' List active windows. *Note Windows::. 'wrap [ on | off ]' Control line-wrap behavior. *Note Wrap::. 'writebuf [-e ENCODING] [FILENAME]' Write paste buffer to screen-exchange file. *Note Screen Exchange::. 'writelock ON|OFF|AUTO' Grant exclusive write permission. *Note Multiuser Session::. 'xoff' Send an XOFF character. *Note XON/XOFF::. 'xon' Send an XON character. *Note XON/XOFF::. 'zmodem [off|auto|catch|pass]' Define how screen treats zmodem requests. *Note Zmodem::. 'zombie [KEYS [onerror] ]' Keep dead windows. *Note Zombie::.  File: screen.info, Node: New Window, Next: Selecting, Prev: Commands, Up: Top 6 New Window ************ This section describes the commands for creating a new window for running programs. When a new window is created, the first available number is assigned to it. The number of windows is limited at compile-time by the MAXWIN configuration parameter (which defaults to 40). * Menu: * Chdir:: Change the working directory for new windows. * Screen Command:: Create a new window. * Setenv:: Set environment variables for new windows. * Shell:: Parameters for shell windows. * Term:: Set the terminal type for new windows. * Window Types:: Creating different types of windows. * Window Groups:: Grouping windows together  File: screen.info, Node: Chdir, Next: Screen Command, Up: New Window 6.1 Chdir ========= -- Command: chdir [directory] (none) Change the current directory of 'screen' to the specified directory or, if called without an argument, to your home directory (the value of the environment variable '$HOME'). All windows that are created by means of the 'screen' command from within '.screenrc' or by means of 'C-a : screen ...' or 'C-a c' use this as their default directory. Without a 'chdir' command, this would be the directory from which 'screen' was invoked. Hardcopy and log files are always written to the _window's_ default directory, _not_ the current directory of the process running in the window. You can use this command multiple times in your '.screenrc' to start various windows in different default directories, but the last 'chdir' value will affect all the windows you create interactively.  File: screen.info, Node: Screen Command, Next: Setenv, Prev: Chdir, Up: New Window 6.2 Screen Command ================== -- Command: screen [opts] [n] [cmd [args] | //GROUP] ('C-a c', 'C-a C-c') Establish a new window. The flow-control options ('-f', '-fn' and '-fa'), title option ('-t'), login options ('-l' and '-ln') , terminal type option ('-T TERM'), the all-capability-flag ('-a') and scrollback option ('-h NUM') may be specified with each command. The option ('-M') turns monitoring on for this window. The option ('-L') turns output logging on for this window. If an optional number N in the range 0...MAXWIN-1 is given, the window number N is assigned to the newly created window (or, if this number is already in-use, the next available number). If a command is specified after 'screen', this command (with the given arguments) is started in the window; otherwise, a shell is created. If '//group' is supplied, a container-type window is created in which other windows may be created inside it. *Note Window Groups::. Screen has built in some functionality of 'cu' and 'telnet'. *Note Window Types::. Thus, if your '.screenrc' contains the lines # example for .screenrc: screen 1 screen -fn -t foobar 2 -L telnet foobar 'screen' creates a shell window (in window #1) and a window with a TELNET connection to the machine foobar (with no flow-control using the title 'foobar' in window #2) and will write a logfile 'screenlog.2' of the telnet session. If you do not include any 'screen' commands in your '.screenrc' file, then 'screen' defaults to creating a single shell window, number zero. When the initialization is completed, 'screen' switches to the last window specified in your .screenrc file or, if none, it opens default window #0.  File: screen.info, Node: Setenv, Next: Shell, Prev: Screen Command, Up: New Window 6.3 Setenv ========== -- Command: setenv var string (none) Set the environment variable VAR to value STRING. If only VAR is specified, the user will be prompted to enter a value. If no parameters are specified, the user will be prompted for both variable and value. The environment is inherited by all subsequently forked shells. -- Command: unsetenv var (none) Unset an environment variable.  File: screen.info, Node: Shell, Next: Term, Prev: Setenv, Up: New Window 6.4 Shell ========= -- Command: shell command -- Command: defshell command (none) Set the command to be used to create a new shell. This overrides the value of the environment variable '$SHELL'. This is useful if you'd like to run a tty-enhancer which is expecting to execute the program specified in '$SHELL'. If the command begins with a '-' character, the shell will be started as a login-shell. Typical shells do only minimal initialization when not started as a login-shell. E.g. Bash will not read your '~/.bashrc' unless it is a login-shell. 'defshell' is currently a synonym to the 'shell' .screenrc command. -- Command: shelltitle title (none) Set the title for all shells created during startup or by the C-a C-c command. *Note Naming Windows::, for details about what titles are.  File: screen.info, Node: Term, Next: Window Types, Prev: Shell, Up: New Window 6.5 Term ======== -- Command: term term (none) In each window 'screen' opens, it sets the '$TERM' variable to 'screen' by default, unless no description for 'screen' is installed in the local termcap or terminfo data base. In that case it pretends that the terminal emulator is 'vt100'. This won't do much harm, as 'screen' is VT100/ANSI compatible. The use of the 'term' command is discouraged for non-default purpose. That is, one may want to specify special '$TERM' settings (e.g. vt100) for the next 'screen rlogin othermachine' command. Use the command 'screen -T vt100 rlogin othermachine' rather than setting and resetting the default.  File: screen.info, Node: Window Types, Next: Window Groups, Prev: Term, Up: New Window 6.6 Window Types ================ Screen provides three different window types. New windows are created with 'screen''s 'screen' command (*note Screen Command::). The first parameter to the 'screen' command defines which type of window is created. The different window types are all special cases of the normal type. They have been added in order to allow 'screen' to be used efficiently as a console with 100 or more windows. * The normal window contains a shell (default, if no parameter is given) or any other system command that could be executed from a shell. (e.g. 'slogin', etc...). * If a tty (character special device) name (e.g. '/dev/ttya') is specified as the first parameter, then the window is directly connected to this device. This window type is similar to 'screen cu -l /dev/ttya'. Read and write access is required on the device node, an exclusive open is attempted on the node to mark the connection line as busy. An optional parameter is allowed consisting of a comma separated list of flags in the notation used by 'stty(1)': '' Usually 300, 1200, 9600 or 19200. This affects transmission as well as receive speed. 'cs8 or cs7' Specify the transmission of eight (or seven) bits per byte. 'ixon or -ixon' Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending data. 'ixoff or -ixoff' Enables (or disables) software flow-control for receiving data. 'istrip or -istrip' Clear (or keep) the eight bit in each received byte. You may want to specify as many of these options as applicable. Unspecified options cause the terminal driver to make up the parameter values of the connection. These values are system-dependent and may be in defaults or values saved from a previous connection. For tty windows, the 'info' command shows some of the modem control lines in the status line. These may include 'RTS', 'CTS', 'DTR', 'CD' and more. This depends rather on on the available 'ioctl()''s and system header files than on the physical capabilities of the serial board. The name of a logical low (inactive) signal is preceded by an exclamation mark ('!'), otherwise the signal is logical high (active). Unsupported but shown signals are usually shown low. When the 'CLOCAL' status bit is true, the whole set of modem signals is placed inside curly braces ('{' and '}'). When the 'CRTSCTS' or 'TIOCSOFTCAR' bit is true, the signals 'CTS' or 'CD' are shown in parenthesis, respectively. For tty windows, the command 'break' causes the Data transmission line (TxD) to go low for a specified period of time. This is expected to be interpreted as break signal on the other side. No data is sent and no modem control line is changed when a 'break' is issued. * If the first parameter is '//telnet', the second parameter is expected to be a host name, and an optional third parameter may specify a TCP port number (default decimal 23). Screen will connect to a server listening on the remote host and use the telnet protocol to communicate with that server. For telnet windows, the command 'info' shows details about the connection in square brackets ('[' and ']') at the end of the status line. 'b' BINARY. The connection is in binary mode. 'e' ECHO. Local echo is disabled. 'c' SGA. The connection is in 'character mode' (default: 'line mode'). 't' TTYPE. The terminal type has been requested by the remote host. Screen sends the name 'screen' unless instructed otherwise (see also the command 'term'). 'w' NAWS. The remote site is notified about window size changes. 'f' LFLOW. The remote host will send flow control information. (Ignored at the moment.) Additional flags for debugging are 'x', 't' and 'n' (XDISPLOC, TSPEED and NEWENV). For telnet windows, the command 'break' sends the telnet code 'IAC BREAK' (decimal 243) to the remote host.  File: screen.info, Node: Window Groups, Prev: Window Types, Up: New Window 6.7 Window Groups ================= Screen provides a method for grouping windows together. Windows can be organized in a hierarchical fashion, resembling a tree structure. New screens are created using the 'screen' command while new groups are created using 'screen //group'. *Note Screen Command::. Once a new group is created, it will act as a container for windows and even other groups. When a group is selected, you will see the output of the 'windowlist' command, allowing you to select a window inside. If there are no windows inside a group, use the 'screen' command to create one. Once inside a group, using the commands 'next' and 'prev' will switch between windows only in that group. Using the 'windowlist' command will give you the opportunity to leave the group you are in. *Note Windowlist::. -- Command: group [grouptitle] (none) Change or show the group the current window belongs to. Windows can be moved around between different groups by specifying the name of the destination group. Without specifying a group, the title of the current group is displayed. Using groups in combination with layouts will help create a multi-desktop experience. One group can be assigned for each layout made. Windows can be made, split, and organized within each group as desired. Afterwhich, switching between groups can be as easy as switching layouts.  File: screen.info, Node: Selecting, Next: Session Management, Prev: New Window, Up: Top 7 Selecting a Window ******************** This section describes the commands for switching between windows in an 'screen' session. The windows are numbered from 0 to 9, and are created in that order by default (*note New Window::). * Menu: * Next and Previous:: Forward or back one window. * Other Window:: Switch back and forth between two windows. * Select:: Switch to a window (and to one after 'kill'). * Windowlist:: Present a list of all windows for selection.  File: screen.info, Node: Next and Previous, Next: Other Window, Up: Selecting 7.1 Moving Back and Forth ========================= -- Command: next ('C-a ', 'C-a n', 'C-a C-n') Switch to the next window. This command can be used repeatedly to cycle through the list of windows. (On some terminals, C- generates a NUL character, so you must release the control key before pressing space.) -- Command: prev ('C-a p', 'C-a C-p', 'C-a C-h', 'C-a ') Switch to the previous window (the opposite of 'C-a n').  File: screen.info, Node: Other Window, Next: Select, Prev: Next and Previous, Up: Selecting 7.2 Other Window ================ -- Command: other ('C-a C-a') Switch to the last window displayed. Note that this command defaults to the command character typed twice, unless overridden. For instance, if you use the option '-e]x', this command becomes ']]' (*note Command Character::).  File: screen.info, Node: Select, Next: Windowlist, Prev: Other Window, Up: Selecting 7.3 Select ========== -- Command: select [n |-|.] ('C-a N', 'C-a '') Switch to the window with the number N. If no window number is specified, you get prompted for an identifier. This can be a window name (title) or a number. When a new window is established, the lowest available number is assigned to this window. Thus, the first window can be activated by 'select 0'; there can be no more than 10 windows present simultaneously (unless screen is compiled with a higher MAXWIN setting). There are two special arguments, 'select -' switches to the internal blank window and 'select .' switches to the current window. The latter is useful if used with screen's '-X' option.  File: screen.info, Node: Windowlist, Prev: Select, Up: Selecting 7.4 Windowlist ============== -- Command: windowlist [-b] [-m] [-g] -- Command: windowlist string [STRING] -- Command: windowlist title [TITLE] ('C-a "') Display all windows in a table for visual window selection. If screen was in a window group, screen will back out of the group and then display the windows in that group. If the '-b' option is given, screen will switch to the blank window before presenting the list, so that the current window is also selectable. The '-m' option changes the order of the windows, instead of sorting by window numbers screen uses its internal most-recently-used list. The '-g' option will show the windows inside any groups in that level and downwards. The following keys are used to navigate in 'windowlist': 'k', 'C-p', or 'up' Move up one line. 'j', 'C-n', or 'down' Move down one line. 'C-g' or 'escape' Exit windowlist. 'C-a' or 'home' Move to the first line. 'C-e' or 'end' Move to the last line. 'C-u' or 'C-d' Move one half page up or down. 'C-b' or 'C-f' Move one full page up or down. '0..9' Using the number keys, move to the selected line. 'mouseclick' Move to the selected line. Available when 'mousetrack' is set to 'on'. '/' Search. 'n' Repeat search in the forward direction. 'N' Repeat search in the backward direction. 'm' Toggle MRU. 'g' Toggle group nesting. 'a' All window view. 'C-h' or 'backspace' Back out the group. ',' Switch numbers with the previous window. '.' Switch numbers with the next window. 'K' Kill that window. 'space' or 'enter' Select that window. The table format can be changed with the string and title option, the title is displayed as table heading, while the lines are made by using the string setting. The default setting is 'Num Name%=Flags' for the title and '%3n %t%=%f' for the lines. See the string escapes chapter (*note String Escapes::) for more codes (e.g. color settings). 'Windowlist' needs a region size of at least 10 characters wide and 6 characters high in order to display.  File: screen.info, Node: Session Management, Next: Regions, Prev: Selecting, Up: Top 8 Session Management Commands ***************************** Perhaps the most useful feature of 'screen' is the way it allows the user to move a session between terminals, by detaching and reattaching. This also makes life easier for modem users who have to deal with unexpected loss of carrier. * Menu: * Detach:: Disconnect 'screen' from your terminal. * Power Detach:: Detach and log out. * Lock:: Lock your terminal temporarily. * Multiuser Session:: Changing number of allowed users. * Session Name:: Rename your session for later reattachment. * Suspend:: Suspend your session. * Quit:: Terminate your session.  File: screen.info, Node: Detach, Next: Power Detach, Up: Session Management 8.1 Detach ========== -- Command: autodetach state (none) Sets whether 'screen' will automatically detach upon hangup, which saves all your running programs until they are resumed with a 'screen -r' command. When turned off, a hangup signal will terminate 'screen' and all the processes it contains. Autodetach is on by default. -- Command: detach ('C-a d', 'C-a C-d') Detach the 'screen' session (disconnect it from the terminal and put it into the background). A detached 'screen' can be resumed by invoking 'screen' with the '-r' option (*note Invoking Screen::). The '-h' option tells screen to immediately close the connection to the terminal ('hangup'). -- Command: password [crypted_pw] (none) Present a crypted password in your '.screenrc' file and screen will ask for it, whenever someone attempts to resume a detached session. This is useful, if you have privileged programs running under 'screen' and you want to protect your session from reattach attempts by users that managed to assume your uid. (I.e. any superuser.) If no crypted password is specified, screen prompts twice a password and places its encryption in the paste buffer. Default is 'none', which disables password checking.  File: screen.info, Node: Power Detach, Next: Lock, Prev: Detach, Up: Session Management 8.2 Power Detach ================ -- Command: pow_detach ('C-a D D') Mainly the same as 'detach', but also sends a HANGUP signal to the parent process of 'screen'. _Caution_: This will result in a logout if 'screen' was started from your login-shell. -- Command: pow_detach_msg [message] (none) The MESSAGE specified here is output whenever a power detach is performed. It may be used as a replacement for a logout message or to reset baud rate, etc. Without a parameter, the current message is shown.  File: screen.info, Node: Lock, Next: Multiuser Session, Prev: Power Detach, Up: Session Management 8.3 Lock ======== -- Command: lockscreen ('C-a x', 'C-a C-x') Call a screenlock program ('/local/bin/lck' or '/usr/bin/lock' or a builtin, if no other is available). Screen does not accept any command keys until this program terminates. Meanwhile processes in the windows may continue, as the windows are in the detached state. The screenlock program may be changed through the environment variable '$LOCKPRG' (which must be set in the shell from which 'screen' is started) and is executed with the user's uid and gid. Warning: When you leave other shells unlocked and have no password set on 'screen', the lock is void: One could easily re-attach from an unlocked shell. This feature should rather be called 'lockterminal'.  File: screen.info, Node: Multiuser Session, Next: Session Name, Prev: Lock, Up: Session Management 8.4 Multiuser Session ===================== These commands allow other users to gain access to one single 'screen' session. When attaching to a multiuser 'screen' the sessionname is specified as 'username/sessionname' to the '-S' command line option. 'Screen' must be compiled with multiuser support to enable features described here. * Menu: * Multiuser:: Enable / Disable multiuser mode. * Acladd:: Enable a specific user. * Aclchg:: Change a users permissions. * Acldel:: Disable a specific user. * Aclgrp:: Grant a user permissions to other users. * Displays:: List all active users at their displays. * Umask:: Predefine access to new windows. * Wall:: Write a message to all users. * Writelock:: Grant exclusive window access. * Su:: Substitute user.  File: screen.info, Node: Multiuser, Next: Acladd, Up: Multiuser Session 8.4.1 Multiuser --------------- -- Command: multiuser STATE (none) Switch between single-user and multi-user mode. Standard screen operation is single-user. In multi-user mode the commands 'acladd', 'aclchg' and 'acldel' can be used to enable (and disable) other users accessing this 'screen'.  File: screen.info, Node: Acladd, Next: Aclchg, Prev: Multiuser, Up: Multiuser Session 8.4.2 Acladd ------------ -- Command: acladd USERNAMES -- Command: addacl USERNAMES (none) Enable users to fully access this screen session. USERNAMES can be one user or a comma separated list of users. This command enables to attach to the 'screen' session and performs the equivalent of 'aclchg USERNAMES +rwx "#?"'. To add a user with restricted access, use the 'aclchg' command below. 'Addacl' is a synonym to 'acladd'. Multi-user mode only.  File: screen.info, Node: Aclchg, Next: Acldel, Prev: Acladd, Up: Multiuser Session 8.4.3 Aclchg ------------ -- Command: aclchg USERNAMES PERMBITS LIST -- Command: chacl USERNAMES PERMBITS LIST (none) Change permissions for a comma separated list of users. Permission bits are represented as 'r', 'w' and 'x'. Prefixing '+' grants the permission, '-' removes it. The third parameter is a comma separated list of commands or windows (specified either by number or title). The special list '#' refers to all windows, '?' to all commands. If USERNAMES consists of a single '*', all known users are affected. A command can be executed when the user has the 'x' bit for it. The user can type input to a window when he has its 'w' bit set and no other user obtains a writelock for this window. Other bits are currently ignored. To withdraw the writelock from another user in e.g. window 2: 'aclchg USERNAME -w+w 2'. To allow read-only access to the session: 'aclchg USERNAME -w "#"'. As soon as a user's name is known to screen, he can attach to the session and (per default) has full permissions for all command and windows. Execution permission for the acl commands, 'at' and others should also be removed or the user may be able to regain write permission. 'Chacl' is a synonym to 'aclchg'. Multi-user mode only.  File: screen.info, Node: Acldel, Next: Aclgrp, Prev: Aclchg, Up: Multiuser Session 8.4.4 Acldel ------------ -- Command: acldel USERNAME (none) Remove a user from screen's access control list. If currently attached, all the user's displays are detached from the session. He cannot attach again. Multi-user mode only.  File: screen.info, Node: Aclgrp, Next: Displays, Prev: Acldel, Up: Multiuser Session 8.4.5 Aclgrp ------------ -- Command: aclgrp USERNAME [GROUPNAME] (none) Creates groups of users that share common access rights. The name of the group is the username of the group leader. Each member of the group inherits the permissions that are granted to the group leader. That means, if a user fails an access check, another check is made for the group leader. A user is removed from all groups the special value 'none' is used for GROUPNAME. If the second parameter is omitted all groups the user is in are listed.  File: screen.info, Node: Displays, Next: Umask, Prev: Aclgrp, Up: Multiuser Session 8.4.6 Displays -------------- -- Command: displays ('C-a *') Shows a tabular listing of all currently connected user front-ends (displays). This is most useful for multiuser sessions. The following keys can be used in 'displays' list: 'k', 'C-p', or 'up' Move up one line. 'j', 'C-n', or 'down' Move down one line. 'C-a' or 'home' Move to the first line. 'C-e' or 'end' Move to the last line. 'C-u' or 'C-d' Move one half page up or down. 'C-b' or 'C-f' Move one full page up or down. 'mouseclick' Move to the selected line. Available when 'mousetrack' is set to 'on'. 'space' Refresh the list. 'd' Detach the selected display. 'D' Power detach the selected display. 'C-g', 'enter', or 'escape' Exit the list. The following is an example of what 'displays' could look like: xterm 80x42 jnweiger@/dev/ttyp4 0(m11) &rWx facit 80x24 mlschroe@/dev/ttyhf nb 11(tcsh) rwx xterm 80x42 jnhollma@/dev/ttyp5 0(m11) &R.x (A) (B) (C) (D) (E) (F)(G) (H)(I) The legend is as follows: (A) The terminal type known by 'screen' for this display. (B) Displays geometry as width x height. (C) Username who is logged in at the display. (D) Device name of the display or the attached device (E) Display is in blocking or nonblocking mode. The available modes are "nb", "NB", "Z<", "Z>", and "BL". (F) Number of the window (G) Name/title of window (H) Whether the window is shared (I) Window permissions. Made up of three characters: (1st character) '-' : no read 'r' : read 'R' : read only due to foreign wlock (2nd character) '-' : no write '.' : write suppressed by foreign wlock 'w' : write 'W' : own wlock (3rd character) '-' : no execute 'x' : execute 'Displays' needs a region size of at least 10 characters wide and 5 characters high in order to display.  File: screen.info, Node: Umask, Next: Wall, Prev: Displays, Up: Multiuser Session 8.4.7 aclumask -------------- -- Command: aclumask [USERS]+/-BITS ... -- Command: umask [USERS]+/-BITS ... (none) This specifies the access other users have to windows that will be created by the caller of the command. USERS may be no, one or a comma separated list of known usernames. If no users are specified, a list of all currently known users is assumed. BITS is any combination of access control bits allowed defined with the 'aclchg' command. The special username '?' predefines the access that not yet known users will be granted to any window initially. The special username '??' predefines the access that not yet known users are granted to any command. Rights of the special username nobody cannot be changed (see the 'su' command). 'Umask' is a synonym to 'aclumask'.  File: screen.info, Node: Wall, Next: Writelock, Prev: Umask, Up: Multiuser Session 8.4.8 Wall ---------- -- Command: wall MESSAGE (none) Write a message to all displays. The message will appear in the terminal's status line.  File: screen.info, Node: Writelock, Next: Su, Prev: Wall, Up: Multiuser Session 8.4.9 Writelock --------------- -- Command: writelock ON|OFF|AUTO (none) In addition to access control lists, not all users may be able to write to the same window at once. Per default, writelock is in 'auto' mode and grants exclusive input permission to the user who is the first to switch to the particular window. When he leaves the window, other users may obtain the writelock (automatically). The writelock of the current window is disabled by the command 'writelock off'. If the user issues the command 'writelock on' he keeps the exclusive write permission while switching to other windows. -- Command: defwritelock ON|OFF|AUTO (none) Sets the default writelock behavior for new windows. Initially all windows will be created with no writelocks.  File: screen.info, Node: Su, Prev: Writelock, Up: Multiuser Session 8.4.10 Su --------- -- Command: su [USERNAME [PASSWORD [PASSWORD2]]] (none) Substitute the user of a display. The command prompts for all parameters that are omitted. If passwords are specified as parameters, they have to be specified un-crypted. The first password is matched against the systems passwd database, the second password is matched against the 'screen' password as set with the commands 'acladd' or 'password'. 'Su' may be useful for the 'screen' administrator to test multiuser setups. When the identification fails, the user has access to the commands available for user 'nobody'. These are 'detach', 'license', 'version', 'help' and 'displays'.  File: screen.info, Node: Session Name, Next: Suspend, Prev: Multiuser Session, Up: Session Management 8.5 Session Name ================ -- Command: sessionname [NAME] (none) Rename the current session. Note that for 'screen -list' the name shows up with the process-id prepended. If the argument NAME is omitted, the name of this session is displayed. _Caution_: The '$STY' environment variable will still reflect the old name in pre-existing shells. This may result in confusion. Use of this command is generally discouraged. Use the '-S' command-line option if you want to name a new session.The default is constructed from the tty and host names.  File: screen.info, Node: Suspend, Next: Quit, Prev: Session Name, Up: Session Management 8.6 Suspend =========== -- Command: suspend ('C-a z', 'C-a C-z') Suspend 'screen'. The windows are in the detached state while 'screen' is suspended. This feature relies on the parent shell being able to do job control.  File: screen.info, Node: Quit, Prev: Suspend, Up: Session Management 8.7 Quit ======== -- Command: quit ('C-a \') Kill all windows and terminate 'screen'. (*note Key Binding::).  File: screen.info, Node: Regions, Next: Window Settings, Prev: Session Management, Up: Top 9 Regions ********* Screen has the ability to display more than one window on the user's display. This is done by splitting the screen in regions, which can contain different windows. * Menu: * Split:: Split a region into two * Focus:: Change to the next region * Only:: Delete all other regions * Remove:: Delete the current region * Resize:: Grow or shrink a region * Caption:: Control the window's caption * Fit:: Resize a window to fit the region * Focusminsize:: Force a minimum size on a current region * Layout:: Manage groups of regions  File: screen.info, Node: Split, Next: Focus, Up: Regions 9.1 Split ========= -- Command: split [-v] ('C-a S', 'C-a |') Split the current region into two new ones. All regions on the display are resized to make room for the new region. The blank window is displayed on the new region. The default is to create a horizontal split, putting the new regions on the top and bottom of each other. Using -v will create a vertical split, causing the new regions to appear side by side of each other. With this current implementation of 'screen', scrolling data will appear much slower in a vertically split region than one that is not. This should be taken into consideration if you need to use system commands such as 'cat' or 'tail -f'.  File: screen.info, Node: Focus, Next: Only, Prev: Split, Up: Regions 9.2 Focus ========= -- Command: focus ('C-a ') Move the input focus to the next region. This is done in a cyclic way so that the top region is selected after the bottom one. If no subcommand is given it defaults to 'down'. 'up' cycles in the opposite order, 'top' and 'bottom' go to the top and bottom region respectively. Useful bindings are (j and k as in vi) bind j focus down bind k focus up bind t focus top bind b focus bottom  File: screen.info, Node: Only, Next: Remove, Prev: Focus, Up: Regions 9.3 Only ======== -- Command: only ('C-a Q') Kill all regions but the current one.  File: screen.info, Node: Remove, Next: Resize, Prev: Only, Up: Regions 9.4 Remove ========== -- Command: remove ('C-a X') Kill the current region. This is a no-op if there is only one region.  File: screen.info, Node: Resize, Next: Caption, Prev: Remove, Up: Regions 9.5 Resize ========== -- Command: resize [(+/-)LINES] (none) Resize the current region. The space will be removed from or added to the region below or if there's not enough space from the region above. resize +N increase current region height by N resize -N decrease current region height by N resize N set current region height to N resize = make all windows equally high resize max maximize current region height resize min minimize current region height  File: screen.info, Node: Caption, Next: Fit, Prev: Resize, Up: Regions 9.6 Caption =========== -- Command: caption 'always'|'splitonly' [string] -- Command: caption 'string' [string] (none) This command controls the display of the window captions. Normally a caption is only used if more than one window is shown on the display (split screen mode). But if the type is set to 'always', 'screen' shows a caption even if only one window is displayed. The default is 'splitonly'. The second form changes the text used for the caption. You can use all string escapes (*note String Escapes::). 'Screen' uses a default of '%3n %t'. You can mix both forms by providing the string as an additional argument.  File: screen.info, Node: Fit, Next: Focusminsize, Prev: Caption, Up: Regions 9.7 Fit ======= -- Command: fit ('C-a F') Change the window size to the size of the current region. This command is needed because screen doesn't adapt the window size automatically if the window is displayed more than once.  File: screen.info, Node: Focusminsize, Next: Layout, Prev: Fit, Up: Regions 9.8 Focusminsize ================ -- Command: focusminsize [ (width|'max'|'_') (height|'max'|'_') ] (none) This forces any currently selected region to be automatically resized at least a certain WIDTH and HEIGHT. All other surrounding regions will be resized in order to accommodate. This constraint follows every time the 'focus' command is used. The 'resize' command can be used to increase either dimension of a region, but never below what is set with 'focusminsize'. The underscore '_' is a synonym for 'max'. Setting a WIDTH and HEIGHT of '0 0' (zero zero) will undo any constraints and allow for manual resizing. Without any parameters, the minimum width and height is shown.  File: screen.info, Node: Layout, Prev: Focusminsize, Up: Regions 9.9 Layout ========== Using regions, and perhaps a large enough terminal, you can give 'screen' more of a desktop feel. By being able to split regions horizontally or vertically, you can take advantage of the lesser used spaces of your terminal. The catch to these splits has been that they're not kept between screen detachments and reattachments. Layouts will help organize your regions. You can create one layout of four horizontal regions and then create a separate layout of regions in a two by two array. The regions could contain the same windows, but they don't have to. You can easily switch between layouts and keep them between detachments and reattachments. Note that there are several subcommands to 'layout'. -- Command: layout 'new' [title] (none) Create a new layout. The screen will change to one whole region and be switched to the blank window. From here, you build the regions and the windows they show as you desire. The new layout will be numbered with the smallest available integer, starting with zero. You can optionally give a title to your new layout. Otherwise, it will have a default title of 'layout'. You can always change the title later by using the command 'layout title'. -- Command: layout 'remove' [n|title] (none) Remove, or in other words, delete the specified layout. Either the number or the title can be specified. Without either specification, 'screen' will remove the current layout. Removing a layout does not affect your set windows or regions. -- Command: layout 'next' (none) Switch to the next layout available -- Command: layout 'prev' (none) Switch to the previous layout available -- Command: layout 'select' [n|title] (none) Select the desired layout. Either the number or the title can be specified. Without either specification, 'screen' will prompt and ask which screen is desired. To see which layouts are available, use the 'layout show' command. -- Command: layout 'show' (none) List on the message line the number(s) and title(s) of the available layout(s). The current layout is flagged. -- Command: layout 'title' [title] (none) Change or display the title of the current layout. A string given will be used to name the layout. Without any options, the current title and number is displayed on the message line. -- Command: layout 'number' [n] (none) Change or display the number of the current layout. An integer given will be used to number the layout. Without any options, the current number and title is displayed on the message line. -- Command: layout 'attach' [title|':last'] (none) Change or display which layout to reattach back to. The default is ':last', which tells 'screen' to reattach back to the last used layout just before detachment. By supplying a title, You can instruct 'screen' to reattach to a particular layout regardless which one was used at the time of detachment. Without any options, the layout to reattach to will be shown in the message line. -- Command: layout 'save' [n|title] (none) Remember the current arrangement of regions. When used, 'screen' will remember the arrangement of vertically and horizontally split regions. This arrangement is restored when a 'screen' session is reattached or switched back from a different layout. If the session ends or the 'screen' process dies, the layout arrangements are lost. The 'layout dump' command should help in this siutation. If a number or title is supplied, 'screen' will remember the arrangement of that particular layout. Without any options, 'screen' will remember the current layout. Saving your regions can be done automatically by using the 'layout autosave' command. -- Command: layout 'autosave' ['on'|'off'] (none) Change or display the status of automatically saving layouts. The default is 'on', meaning when 'screen' is detached or changed to a different layout, the arrangement of regions and windows will be remembered at the time of change and restored upon return. If autosave is set to 'off', that arrangement will only be restored to either to the last manual save, using 'layout save', or to when the layout was first created, to a single region with a single window. Without either an 'on' or an 'off', the current status is displayed on the message line. -- Command: layout 'dump' [filename] (none) Write to a file the order of splits made in the current layout. This is useful to recreate the order of your regions used in your current layout. Only the current layout is recorded. While the order of the regions are recorded, the sizes of those regions and which windows correspond to which regions are not. If no filename is specified, the default is 'layout-dump', saved in the directory that the 'screen' process was started in. If the file already exists, 'layout dump' will append to that file. As an example: layout dump /home/user/.screenrc will save or append the layout to the user's '.screenrc' file.  File: screen.info, Node: Window Settings, Next: Virtual Terminal, Prev: Regions, Up: Top 10 Window Settings ****************** These commands control the way 'screen' treats individual windows in a session. *Note Virtual Terminal::, for commands to control the terminal emulation itself. * Menu: * Naming Windows:: Control the name of the window * Console:: See the host's console messages * Kill:: Destroy an unwanted window * Login:: Control '/etc/utmp' logging * Mode:: Control the file mode of the pty * Monitor:: Watch for activity or inactivity in a window * Windows:: List the active windows * Hardstatus:: Set a window's hardstatus line  File: screen.info, Node: Naming Windows, Next: Console, Up: Window Settings 10.1 Naming Windows (Titles) ============================ You can customize each window's name in the window display (viewed with the 'windows' command (*note Windows::) by setting it with one of the title commands. Normally the name displayed is the actual command name of the program created in the window. However, it is sometimes useful to distinguish various programs of the same name or to change the name on-the-fly to reflect the current state of the window. The default name for all shell windows can be set with the 'shelltitle' command (*note Shell::). You can specify the name you want for a window with the '-t' option to the 'screen' command when the window is created (*note Screen Command::). To change the name after the window has been created you can use the title-string escape-sequence (' k NAME \') and the 'title' command (C-a A). The former can be output from an application to control the window's name under software control, and the latter will prompt for a name when typed. You can also bind predefined names to keys with the 'title' command to set things quickly without prompting. * Menu: * Title Command:: The 'title' command. * Dynamic Titles:: Make shell windows change titles dynamically. * Title Prompts:: Set up your shell prompt for dynamic Titles. * Title Screenrc:: Set up Titles in your '.screenrc'.  File: screen.info, Node: Title Command, Next: Dynamic Titles, Up: Naming Windows 10.1.1 Title Command -------------------- -- Command: title [windowtitle] ('C-a A') Set the name of the current window to WINDOWTITLE. If no name is specified, screen prompts for one.  File: screen.info, Node: Dynamic Titles, Next: Title Prompts, Prev: Title Command, Up: Naming Windows 10.1.2 Dynamic Titles --------------------- 'screen' has a shell-specific heuristic that is enabled by setting the window's name to SEARCH|NAME and arranging to have a null title escape-sequence output as a part of your prompt. The SEARCH portion specifies an end-of-prompt search string, while the NAME portion specifies the default shell name for the window. If the NAME ends in a ':' 'screen' will add what it believes to be the current command running in the window to the end of the specified name (e.g. NAME:CMD). Otherwise the current command name supersedes the shell name while it is running. Here's how it works: you must modify your shell prompt to output a null title-escape-sequence ( k \) as a part of your prompt. The last part of your prompt must be the same as the string you specified for the SEARCH portion of the title. Once this is set up, 'screen' will use the title-escape-sequence to clear the previous command name and get ready for the next command. Then, when a newline is received from the shell, a search is made for the end of the prompt. If found, it will grab the first word after the matched string and use it as the command name. If the command name begins with '!', '%', or '^', 'screen' will use the first word on the following line (if found) in preference to the just-found name. This helps csh users get more accurate titles when using job control or history recall commands.  File: screen.info, Node: Title Prompts, Next: Title Screenrc, Prev: Dynamic Titles, Up: Naming Windows 10.1.3 Setting up your prompt for shell titles ---------------------------------------------- One thing to keep in mind when adding a null title-escape-sequence to your prompt is that some shells (like the csh) count all the non-control characters as part of the prompt's length. If these invisible characters aren't a multiple of 8 then backspacing over a tab will result in an incorrect display. One way to get around this is to use a prompt like this: set prompt='^[[0000m^[k^[\% ' The escape-sequence '^[[0000m' not only normalizes the character attributes, but all the zeros round the length of the invisible characters up to 8. Tcsh handles escape codes in the prompt more intelligently, so you can specify your prompt like this: set prompt="%{\ek\e\\%}\% " Bash users will probably want to echo the escape sequence in the PROMPT_COMMAND: PROMPT_COMMAND='printf "\033k\033\134"' (I used '\134' to output a '\' because of a bug in v1.04).  File: screen.info, Node: Title Screenrc, Prev: Title Prompts, Up: Naming Windows 10.1.4 Setting up shell titles in your '.screenrc' -------------------------------------------------- Here are some .screenrc examples: screen -t top 2 nice top Adding this line to your .screenrc would start a niced version of the 'top' command in window 2 named 'top' rather than 'nice'. shelltitle '> |csh' screen 1 This file would start a shell using the given shelltitle. The title specified is an auto-title that would expect the prompt and the typed command to look something like the following: /usr/joe/src/dir> trn (it looks after the '> ' for the command name). The window status would show the name 'trn' while the command was running, and revert to 'csh' upon completion. bind R screen -t '% |root:' su Having this command in your .screenrc would bind the key sequence 'C-a R' to the 'su' command and give it an auto-title name of 'root:'. For this auto-title to work, the screen could look something like this: % !em emacs file.c Here the user typed the csh history command '!em' which ran the previously entered 'emacs' command. The window status would show 'root:emacs' during the execution of the command, and revert to simply 'root:' at its completion. bind o title bind E title "" bind u title (unknown) The first binding doesn't have any arguments, so it would prompt you for a title when you type 'C-a o'. The second binding would clear an auto-titles current setting (C-a E). The third binding would set the current window's title to '(unknown)' (C-a u).  File: screen.info, Node: Console, Next: Kill, Prev: Naming Windows, Up: Window Settings 10.2 Console ============ -- Command: console [STATE] (none) Grabs or un-grabs the machines console output to a window. When the argument is omitted the current state is displayed. _Note_: Only the owner of '/dev/console' can grab the console output. This command is only available if the host supports the ioctl 'TIOCCONS'.  File: screen.info, Node: Kill, Next: Login, Prev: Console, Up: Window Settings 10.3 Kill ========= -- Command: kill ('C-a k', 'C-a C-k') Kill the current window. If there is an 'exec' command running (*note Exec::) then it is killed. Otherwise the process (e.g. shell) running in the window receives a 'HANGUP' condition, the window structure is removed and screen (your display) switches to another window. When the last window is destroyed, 'screen' exits. After a kill screen switches to the previously displayed window. _Caution_: 'emacs' users may find themselves killing their 'emacs' session when trying to delete the current line. For this reason, it is probably wise to use a different command character (*note Command Character::) or rebind 'kill' to another key sequence, such as 'C-a K' (*note Key Binding::).  File: screen.info, Node: Login, Next: Mode, Prev: Kill, Up: Window Settings 10.4 Login ========== -- Command: deflogin state (none) Same as the 'login' command except that the default setting for new windows is changed. This defaults to 'on' unless otherwise specified at compile time (*note Installation::). Both commands are only present when 'screen' has been compiled with utmp support. -- Command: login [state] ('C-a L') Adds or removes the entry in '/etc/utmp' for the current window. This controls whether or not the window is "logged in". In addition to this toggle, it is convenient to have "log in" and "log out" keys. For instance, 'bind I login on' and 'bind O login off' will map these keys to be 'C-a I' and 'C-a O' (*note Key Binding::).  File: screen.info, Node: Mode, Next: Monitor, Prev: Login, Up: Window Settings 10.5 Mode ========= -- Command: defmode mode (none) The mode of each newly allocated pseudo-tty is set to MODE. MODE is an octal number as used by chmod(1). Defaults to 0622 for windows which are logged in, 0600 for others (e.g. when '-ln' was specified for creation, *note Screen Command::).  File: screen.info, Node: Monitor, Next: Windows, Prev: Mode, Up: Window Settings 10.6 Monitoring =============== -- Command: activity message (none) When any activity occurs in a background window that is being monitored, 'screen' displays a notification in the message line. The notification message can be redefined by means of the 'activity' command. Each occurrence of '%' in MESSAGE is replaced by the number of the window in which activity has occurred, and each occurrence of '^G' is replaced by the definition for bell in your termcap (usually an audible bell). The default message is 'Activity in window %n' Note that monitoring is off for all windows by default, but can be altered by use of the 'monitor' command ('C-a M'). -- Command: defmonitor state (none) Same as the 'monitor' command except that the default setting for new windows is changed. Initial setting is 'off'. -- Command: monitor [state] ('C-a M') Toggles monitoring of the current window. When monitoring is turned on and the affected window is switched into the background, the activity notification message will be displayed in the status line at the first sign of output, and the window will also be marked with an '@' in the window-status display (*note Windows::). Monitoring defaults to 'off' for all windows. -- Command: silence [STATE|SEC] ('C-a _') Toggles silence monitoring of windows. When silence is turned on and an affected window is switched into the background, you will receive the silence notification message in the status line after a specified period of inactivity (silence). The default timeout can be changed with the 'silencewait' command or by specifying a number of seconds instead of 'on' or 'off'. Silence is initially off for all windows. -- Command: defsilence state (none) Same as the 'silence' command except that the default setting for new windows is changed. Initial setting is 'off'. -- Command: silencewait SECONDS (none) Define the time that all windows monitored for silence should wait before displaying a message. Default is 30 seconds.  File: screen.info, Node: Windows, Next: Hardstatus, Prev: Monitor, Up: Window Settings 10.7 Windows ============ -- Command: windows ('C-a w', 'C-a C-w') Uses the message line to display a list of all the windows. Each window is listed by number with the name of the program running in the window (or its title). The current window is marked with a '*'; the previous window is marked with a '-'; all the windows that are logged in are marked with a '$' (*note Login::); a background window that has received a bell is marked with a '!'; a background window that is being monitored and has had activity occur is marked with an '@' (*note Monitor::); a window which has output logging turned on is marked with '(L)'; windows occupied by other users are marked with '&' or '&&' if the window is shared by other users; windows in the zombie state are marked with 'Z'. If this list is too long to fit on the terminal's status line only the portion around the current window is displayed.  File: screen.info, Node: Hardstatus, Next: Mousetrack, Prev: Windows, Up: Window Settings 10.8 Hardstatus =============== 'Screen' maintains a hardstatus line for every window. If a window gets selected, the display's hardstatus will be updated to match the window's hardstatus line. The hardstatus line can be changed with the ANSI Application Program Command (APC): 'ESC_ESC\'. As a convenience for xterm users the sequence 'ESC]0..2;^G' is also accepted. -- Command: defhstatus [status] (none) The hardstatus line that all new windows will get is set to STATUS. This command is useful to make the hardstatus of every window display the window number or title or the like. STATUS may contain the same directives as in the window messages, but the directive escape character is '^E' (octal 005) instead of '%'. This was done to make a misinterpretation of program generated hardstatus lines impossible. If the parameter STATUS is omitted, the current default string is displayed. Per default the hardstatus line of new windows is empty. -- Command: hstatus status (none) Changes the current window's hardstatus line to STATUS.  File: screen.info, Node: Mousetrack, Prev: Hardstatus, Up: Miscellaneous 10.9 Mousetrack =============== -- Command: mousetrack [ 'on|off' ] (none) This command determines whether 'screen' will watch for mouse clicks. When this command is enabled, regions that have been split in various ways can be selected by pointing to them with a mouse and left-clicking them. Without specifying ON or OFF, the current state is displayed. The default state is determined by the 'defmousetrack' command. -- Command: defmousetrack 'on|off' (none) This command determines the default state of the 'mousetrack' command, currently defaulting of OFF.  File: screen.info, Node: Virtual Terminal, Next: Copy and Paste, Prev: Window Settings, Up: Top 11 Virtual Terminal ******************* Each window in a 'screen' session emulates a VT100 terminal, with some extra functions added. The VT100 emulator is hard-coded, no other terminal types can be emulated. The commands described here modify the terminal emulation. * Menu: * Control Sequences:: Details of the internal VT100 emulation. * Input Translation:: How keystrokes are remapped. * Digraph:: Entering digraph sequences. * Bell:: Getting your attention. * Clear:: Clear the window display. * Info:: Terminal emulation statistics. * Redisplay:: When the display gets confusing. * Wrap:: Automatic margins. * Reset:: Recovering from ill-behaved applications. * Window Size:: Changing the size of your terminal. * Character Processing:: Change the effect of special characters.  File: screen.info, Node: Control Sequences, Next: Input Translation, Up: Virtual Terminal 11.1 Control Sequences ====================== The following is a list of control sequences recognized by 'screen'. '(V)' and '(A)' indicate VT100-specific and ANSI- or ISO-specific functions, respectively. ESC E Next Line ESC D Index ESC M Reverse Index ESC H Horizontal Tab Set ESC Z Send VT100 Identification String ESC 7 (V) Save Cursor and Attributes ESC 8 (V) Restore Cursor and Attributes ESC [s (A) Save Cursor and Attributes ESC [u (A) Restore Cursor and Attributes ESC c Reset to Initial State ESC g Visual Bell ESC Pn p Cursor Visibility (97801) Pn = 6 Invisible 7 Visible ESC = (V) Application Keypad Mode ESC > (V) Numeric Keypad Mode ESC # 8 (V) Fill Screen with E's ESC \ (A) String Terminator ESC ^ (A) Privacy Message String (Message Line) ESC ! Global Message String (Message Line) ESC k Title Definition String ESC P (A) Device Control String Outputs a string directly to the host terminal without interpretation. ESC _ (A) Application Program Command (Hardstatus) ESC ] 0 ; string ^G (A) Operating System Command (Hardstatus, xterm title hack) ESC ] 83 ; cmd ^G (A) Execute screen command. This only works if multi-user support is compiled into screen. The pseudo-user ":window:" is used to check the access control list. Use "addacl :window: -rwx #?" to create a user with no rights and allow only the needed commands. Control-N (A) Lock Shift G1 (SO) Control-O (A) Lock Shift G0 (SI) ESC n (A) Lock Shift G2 ESC o (A) Lock Shift G3 ESC N (A) Single Shift G2 ESC O (A) Single Shift G3 ESC ( Pcs (A) Designate character set as G0 ESC ) Pcs (A) Designate character set as G1 ESC * Pcs (A) Designate character set as G2 ESC + Pcs (A) Designate character set as G3 ESC [ Pn ; Pn H Direct Cursor Addressing ESC [ Pn ; Pn f same as above ESC [ Pn J Erase in Display Pn = None or 0 From Cursor to End of Screen 1 From Beginning of Screen to Cursor 2 Entire Screen ESC [ Pn K Erase in Line Pn = None or 0 From Cursor to End of Line 1 From Beginning of Line to Cursor 2 Entire Line ESC [ Pn X Erase character ESC [ Pn A Cursor Up ESC [ Pn B Cursor Down ESC [ Pn C Cursor Right ESC [ Pn D Cursor Left ESC [ Pn E Cursor next line ESC [ Pn F Cursor previous line ESC [ Pn G Cursor horizontal position ESC [ Pn ` same as above ESC [ Pn d Cursor vertical position ESC [ Ps ;...; Ps m Select Graphic Rendition Ps = None or 0 Default Rendition 1 Bold 2 (A) Faint 3 (A) Standout Mode (ANSI: Italicized) 4 Underlined 5 Blinking 7 Negative Image 22 (A) Normal Intensity 23 (A) Standout Mode off (ANSI: Italicized off) 24 (A) Not Underlined 25 (A) Not Blinking 27 (A) Positive Image 30 (A) Foreground Black 31 (A) Foreground Red 32 (A) Foreground Green 33 (A) Foreground Yellow 34 (A) Foreground Blue 35 (A) Foreground Magenta 36 (A) Foreground Cyan 37 (A) Foreground White 39 (A) Foreground Default 40 (A) Background Black ... ... 49 (A) Background Default ESC [ Pn g Tab Clear Pn = None or 0 Clear Tab at Current Position 3 Clear All Tabs ESC [ Pn ; Pn r (V) Set Scrolling Region ESC [ Pn I (A) Horizontal Tab ESC [ Pn Z (A) Backward Tab ESC [ Pn L (A) Insert Line ESC [ Pn M (A) Delete Line ESC [ Pn @ (A) Insert Character ESC [ Pn P (A) Delete Character ESC [ Pn S Scroll Scrolling Region Up ESC [ Pn T Scroll Scrolling Region Down ESC [ Pn ^ same as above ESC [ Ps ;...; Ps h Set Mode ESC [ Ps ;...; Ps l Reset Mode Ps = 4 (A) Insert Mode 20 (A) 'Automatic Linefeed' Mode. 34 Normal Cursor Visibility ?1 (V) Application Cursor Keys ?3 (V) Change Terminal Width to 132 columns ?5 (V) Reverse Video ?6 (V) 'Origin' Mode ?7 (V) 'Wrap' Mode ?9 X10 mouse tracking ?25 (V) Visible Cursor ?47 Alternate Screen (old xterm code) ?1000 (V) VT200 mouse tracking ?1047 Alternate Screen (new xterm code) ?1049 Alternate Screen (new xterm code) ESC [ 5 i (A) Start relay to printer (ANSI Media Copy) ESC [ 4 i (A) Stop relay to printer (ANSI Media Copy) ESC [ 8 ; Ph ; Pw t Resize the window to 'Ph' lines and 'Pw' columns (SunView special) ESC [ c Send VT100 Identification String ESC [ x (V) Send Terminal Parameter Report ESC [ > c Send Secondary Device Attributes String ESC [ 6 n Send Cursor Position Report  File: screen.info, Node: Input Translation, Next: Digraph, Prev: Control Sequences, Up: Virtual Terminal 11.2 Input Translation ====================== In order to do a full VT100 emulation 'screen' has to detect that a sequence of characters in the input stream was generated by a keypress on the user's keyboard and insert the VT100 style escape sequence. 'Screen' has a very flexible way of doing this by making it possible to map arbitrary commands on arbitrary sequences of characters. For standard VT100 emulation the command will always insert a string in the input buffer of the window (see also command 'stuff', *note Paste::). Because the sequences generated by a keypress can change after a reattach from a different terminal type, it is possible to bind commands to the termcap name of the keys. 'Screen' will insert the correct binding after each reattach. See *note Bindkey:: for further details on the syntax and examples. Here is the table of the default key bindings. (A) means that the command is executed if the keyboard is switched into application mode. Key name Termcap name Command ----------------------------------------------------- Cursor up ku stuff \033[A stuff \033OA (A) Cursor down kd stuff \033[B stuff \033OB (A) Cursor right kr stuff \033[C stuff \033OC (A) Cursor left kl stuff \033[D stuff \033OD (A) Function key 0 k0 stuff \033[10~ Function key 1 k1 stuff \033OP Function key 2 k2 stuff \033OQ Function key 3 k3 stuff \033OR Function key 4 k4 stuff \033OS Function key 5 k5 stuff \033[15~ Function key 6 k6 stuff \033[17~ Function key 7 k7 stuff \033[18~ Function key 8 k8 stuff \033[19~ Function key 9 k9 stuff \033[20~ Function key 10 k; stuff \033[21~ Function key 11 F1 stuff \033[23~ Function key 12 F2 stuff \033[24~ Home kh stuff \033[1~ End kH stuff \033[4~ Insert kI stuff \033[2~ Delete kD stuff \033[3~ Page up kP stuff \033[5~ Page down kN stuff \033[6~ Keypad 0 f0 stuff 0 stuff \033Op (A) Keypad 1 f1 stuff 1 stuff \033Oq (A) Keypad 2 f2 stuff 2 stuff \033Or (A) Keypad 3 f3 stuff 3 stuff \033Os (A) Keypad 4 f4 stuff 4 stuff \033Ot (A) Keypad 5 f5 stuff 5 stuff \033Ou (A) Keypad 6 f6 stuff 6 stuff \033Ov (A) Keypad 7 f7 stuff 7 stuff \033Ow (A) Keypad 8 f8 stuff 8 stuff \033Ox (A) Keypad 9 f9 stuff 9 stuff \033Oy (A) Keypad + f+ stuff + stuff \033Ok (A) Keypad - f- stuff - stuff \033Om (A) Keypad * f* stuff * stuff \033Oj (A) Keypad / f/ stuff / stuff \033Oo (A) Keypad = fq stuff = stuff \033OX (A) Keypad . f. stuff . stuff \033On (A) Keypad , f, stuff , stuff \033Ol (A) Keypad enter fe stuff \015 stuff \033OM (A)  File: screen.info, Node: Digraph, Next: Bell, Prev: Input Translation, Up: Virtual Terminal 11.3 Digraph ============ -- Command: digraph [preset [unicode-value]] ('C-a C-v') This command prompts the user for a digraph sequence. The next two characters typed are looked up in a builtin table and the resulting character is inserted in the input stream. For example, if the user enters 'a"', an a-umlaut will be inserted. If the first character entered is a 0 (zero), 'screen' will treat the following characters (up to three) as an octal number instead. The optional argument PRESET is treated as user input, thus one can create an "umlaut" key. For example the command 'bindkey ^K digraph '"'' enables the user to generate an a-umlaut by typing 'CTRL-K a'. When a non-zero UNICODE-VALUE is specified, a new digraph is created with the specified preset. The digraph is unset if a zero value is provided for the UNICODE-VALUE. The following table is the builtin sequences. Sequence Octal Digraph Unicode Equivalent ----------------------------------------------- ' ', ' ' 160 (space) U+00A0 'N', 'S' 160 (space) U+00A0 '~', '!' 161 ¡ U+00A1 '!', '!' 161 ¡ U+00A1 '!', 'I' 161 ¡ U+00A1 'c', '|' 162 ¢ U+00A2 'c', 't' 162 ¢ U+00A2 '$', '$' 163 £ U+00A3 'P', 'd' 163 £ U+00A3 'o', 'x' 164 ¤ U+00A4 'C', 'u' 164 ¤ U+00A4 'C', 'u' 164 ¤ U+00A4 'E', 'u' 164 ¤ U+00A4 'Y', '-' 165 ¥ U+00A5 'Y', 'e' 165 ¥ U+00A5 '|', '|' 166 ¦ U+00A6 'B', 'B' 166 ¦ U+00A6 'p', 'a' 167 § U+00A7 'S', 'E' 167 § U+00A7 '"', '"' 168 ¨ U+00A8 ''', ':' 168 ¨ U+00A8 'c', 'O' 169 © U+00A9 'C', 'o' 169 © U+00A9 'a', '-' 170 ª U+00AA '<', '<' 171 « U+00AB '-', ',' 172 ¬ U+00AC 'N', 'O' 172 ¬ U+00AC '-', '-' 173 ­ U+00AD 'r', 'O' 174 ® U+00AE 'R', 'g' 174 ® U+00AE '-', '=' 175 ¯ U+00AF ''', 'm' 175 ¯ U+00AF '~', 'o' 176 ° U+00B0 'D', 'G' 176 ° U+00B0 '+', '-' 177 ± U+00B1 '2', '2' 178 ² U+00B2 '2', 'S' 178 ² U+00B2 '3', '3' 179 ³ U+00B3 '3', 'S' 179 ³ U+00B3 ''', ''' 180 ´ U+00B4 'j', 'u' 181 µ U+00B5 'M', 'y' 181 µ U+00B5 'p', 'p' 182 ¶ U+00B6 'P', 'I' 182 ¶ U+00B6 '~', '.' 183 · U+00B7 '.', 'M' 183 · U+00B7 ',', ',' 184 ¸ U+00B8 ''', ',' 184 ¸ U+00B8 '1', '1' 185 ¹ U+00B9 '1', 'S' 185 ¹ U+00B9 'o', '-' 186 º U+00BA '>', '>' 187 » U+00BB '1', '4' 188 ¼ U+00BC '1', '2' 189 ½ U+00BD '3', '4' 190 ¾ U+00BE '~', '?' 191 ¿ U+00BF '?', '?' 191 ¿ U+00BF '?', 'I' 191 ¿ U+00BF 'A', '`' 192 À U+00C0 'A', '!' 192 À U+00C0 'A', ''' 193 Á U+00C1 'A', '^' 194 Â U+00C2 'A', '>' 194 Â U+00C2 'A', '~' 195 Ã U+00C3 'A', '?' 195 Ã U+00C3 'A', '"' 196 Ä U+00C4 'A', ':' 196 Ä U+00C4 'A', '@' 197 Å U+00C5 'A', 'A' 197 Å U+00C5 'A', 'E' 198 Æ U+00C6 'C', ',' 199 Ç U+00C7 'E', '`' 200 È U+00C8 'E', '!' 200 È U+00C8 'E', ''' 201 É U+00C9 'E', '^' 202 Ê U+00CA 'E', '>' 202 Ê U+00CA 'E', '"' 203 Ë U+00CB 'E', ':' 203 Ë U+00CB 'I', '`' 204 Ì U+00CC 'I', '!' 204 Ì U+00CC 'I', ''' 205 Í U+00CD 'I', '^' 206 Î U+00CE 'I', '>' 206 Î U+00CE 'I', '"' 207 Ï U+00CF 'I', ':' 207 Ï U+00CF 'D', '-' 208 Ð U+00D0 'N', '~' 209 Ñ U+00D1 'N', '?' 209 Ñ U+00D1 'O', '`' 210 Ò U+00D2 'O', '!' 210 Ò U+00D2 'O', ''' 211 Ó U+00D3 'O', '^' 212 Ô U+00D4 'O', '>' 212 Ô U+00D4 'O', '~' 213 Õ U+00D5 'O', '?' 213 Õ U+00D5 'O', '"' 214 Ö U+00D6 'O', ':' 214 Ö U+00D6 '/', '\' 215 × U+00D7 '*', 'x' 215 × U+00D7 'O', '/' 216 Ø U+00D8 'U', '`' 217 Ù U+00D9 'U', '!' 217 Ù U+00D9 'U', ''' 218 Ú U+00DA 'U', '^' 219 Û U+00DB 'U', '>' 219 Û U+00DB 'U', '"' 220 Ü U+00DC 'U', ':' 220 Ü U+00DC 'Y', ''' 221 Ý U+00DD 'I', 'p' 222 Þ U+00DE 'T', 'H' 222 Þ U+00DE 's', 's' 223 ß U+00DF 's', '"' 223 ß U+00DF 'a', '`' 224 à U+00E0 'a', '!' 224 à U+00E0 'a', ''' 225 á U+00E1 'a', '^' 226 â U+00E2 'a', '>' 226 â U+00E2 'a', '~' 227 ã U+00E3 'a', '?' 227 ã U+00E3 'a', '"' 228 ä U+00E4 'a', ':' 228 ä U+00E4 'a', 'a' 229 å U+00E5 'a', 'e' 230 æ U+00E6 'c', ',' 231 ç U+00E7 'e', '`' 232 è U+00E8 'e', '!' 232 è U+00E8 'e', ''' 233 é U+00E9 'e', '^' 234 ê U+00EA 'e', '>' 234 ê U+00EA 'e', '"' 235 ë U+00EB 'e', ':' 235 ë U+00EB 'i', '`' 236 ì U+00EC 'i', '!' 236 ì U+00EC 'i', ''' 237 í U+00ED 'i', '^' 238 î U+00EE 'i', '>' 238 î U+00EE 'i', '"' 239 ï U+00EF 'i', ':' 239 ï U+00EF 'd', '-' 240 ð U+00F0 'n', '~' 241 ñ U+00F1 'n', '?' 241 ñ U+00F1 'o', '`' 242 ò U+00F2 'o', '!' 242 ò U+00F2 'o', ''' 243 ó U+00F3 'o', '^' 244 ô U+00F4 'o', '>' 244 ô U+00F4 'o', '~' 245 õ U+00F5 'o', '?' 245 õ U+00F5 'o', '"' 246 ö U+00F6 'o', ':' 246 ö U+00F6 ':', '-' 247 ÷ U+00F7 'o', '/' 248 ø U+00F8 'u', '`' 249 ù U+00F9 'u', '!' 249 ù U+00F9 'u', ''' 250 ú U+00FA 'u', '^' 251 û U+00FB 'u', '>' 251 û U+00FB 'u', '"' 252 ü U+00FC 'u', ':' 252 ü U+00FC 'y', ''' 253 ý U+00FD 'i', 'p' 254 þ U+00FE 't', 'h' 254 þ U+00FE 'y', '"' 255 ÿ U+00FF 'y', ':' 255 ÿ U+00FF '"', '[' 196 Ä U+00C4 '"', '\' 214 Ö U+00D6 '"', ']' 220 Ü U+00DC '"', '{' 228 ä U+00E4 '"', '|' 246 ö U+00F6 '"', '}' 252 ü U+00FC '"', '~' 223 ß U+00DF  File: screen.info, Node: Bell, Next: Clear, Prev: Digraph, Up: Virtual Terminal 11.4 Bell ========= -- Command: bell_msg [message] (none) When a bell character is sent to a background window, 'screen' displays a notification in the message line. The notification message can be re-defined by this command. Each occurrence of '%' in MESSAGE is replaced by the number of the window to which a bell has been sent, and each occurrence of '^G' is replaced by the definition for bell in your termcap (usually an audible bell). The default message is 'Bell in window %n' An empty message can be supplied to the 'bell_msg' command to suppress output of a message line ('bell_msg ""'). Without a parameter, the current message is shown. -- Command: vbell [state] ('C-a C-g') Sets or toggles the visual bell setting for the current window. If 'vbell' is switched to 'on', but your terminal does not support a visual bell, the visual bell message is displayed in the status line when the bell character is received. Visual bell support of a terminal is defined by the termcap variable 'vb'. *Note Visual Bell: (termcap)Bell, for more information on visual bells. The equivalent terminfo capability is 'flash'. Per default, 'vbell' is 'off', thus the audible bell is used. -- Command: vbell_msg [message] (none) Sets the visual bell message. MESSAGE is printed to the status line if the window receives a bell character (^G), 'vbell' is set to 'on' and the terminal does not support a visual bell. The default message is 'Wuff, Wuff!!'. Without a parameter, the current message is shown. -- Command: vbellwait sec (none) Define a delay in seconds after each display of 'screen' 's visual bell message. The default is 1 second.  File: screen.info, Node: Clear, Next: Info, Prev: Bell, Up: Virtual Terminal 11.5 Clear ========== -- Command: clear ('C-a C') Clears the screen and saves its contents to the scrollback buffer.  File: screen.info, Node: Info, Next: Redisplay, Prev: Clear, Up: Virtual Terminal 11.6 Info ========= -- Command: info ('C-a i', 'C-a C-i') Uses the message line to display some information about the current window: the cursor position in the form '(COLUMN,ROW)' starting with '(1,1)', the terminal width and height plus the size of the scrollback buffer in lines, like in '(80,24)+50', the current state of window XON/XOFF flow control is shown like this (*note Flow Control::): +flow automatic flow control, currently on. -flow automatic flow control, currently off. +(+)flow flow control enabled. Agrees with automatic control. -(+)flow flow control disabled. Disagrees with automatic control. +(-)flow flow control enabled. Disagrees with automatic control. -(-)flow flow control disabled. Agrees with automatic control. The current line wrap setting ('+wrap' indicates enabled, '-wrap' not) is also shown. The flags 'ins', 'org', 'app', 'log', 'mon' and 'nored' are displayed when the window is in insert mode, origin mode, application-keypad mode, has output logging, activity monitoring or partial redraw enabled. The currently active character set ('G0', 'G1', 'G2', or 'G3'), and in square brackets the terminal character sets that are currently designated as 'G0' through 'G3'. If the window is in UTF-8 mode, the string 'UTF-8' is shown instead. Additional modes depending on the type of the window are displayed at the end of the status line (*note Window Types::). If the state machine of the terminal emulator is in a non-default state, the info line is started with a string identifying the current state. For system information use 'time'. -- Command: dinfo (none) Show what 'screen' thinks about your terminal. Useful if you want to know why features like color or the alternate charset don't work.  File: screen.info, Node: Redisplay, Next: Wrap, Prev: Info, Up: Virtual Terminal 11.7 Redisplay ============== -- Command: allpartial state (none) If set to on, only the current cursor line is refreshed on window change. This affects all windows and is useful for slow terminal lines. The previous setting of full/partial refresh for each window is restored with 'allpartial off'. This is a global flag that immediately takes effect on all windows overriding the 'partial' settings. It does not change the default redraw behavior of newly created windows. -- Command: altscreen state (none) If set to on, "alternate screen" support is enabled in virtual terminals, just like in xterm. Initial setting is 'off'. -- Command: partial state (none) Defines whether the display should be refreshed (as with 'redisplay') after switching to the current window. This command only affects the current window. To immediately affect all windows use the 'allpartial' command. Default is 'off', of course. This default is fixed, as there is currently no 'defpartial' command. -- Command: redisplay ('C-a l', 'C-a C-l') Redisplay the current window. Needed to get a full redisplay in partial redraw mode.  File: screen.info, Node: Wrap, Next: Reset, Prev: Redisplay, Up: Virtual Terminal 11.8 Wrap ========= -- Command: wrap [ on | off ] ('C-a r', 'C-a C-r') Sets the line-wrap setting for the current window. When line-wrap is on, the second consecutive printable character output at the last column of a line will wrap to the start of the following line. As an added feature, backspace (^H) will also wrap through the left margin to the previous line. Default is 'on'. Without any options, the state of 'wrap' is toggled. -- Command: defwrap state (none) Same as the 'wrap' command except that the default setting for new windows is changed. Initially line-wrap is on and can be toggled with the 'wrap' command ('C-a r') or by means of "C-a : wrap on|off".  File: screen.info, Node: Reset, Next: Window Size, Prev: Wrap, Up: Virtual Terminal 11.9 Reset ========== -- Command: reset ('C-a Z') Reset the virtual terminal to its "power-on" values. Useful when strange settings (like scroll regions or graphics character set) are left over from an application.  File: screen.info, Node: Window Size, Next: Character Processing, Prev: Reset, Up: Virtual Terminal 11.10 Window Size ================= -- Command: width ['-w'|'-d'] [cols [lines]] ('C-a W') Toggle the window width between 80 and 132 columns, or set it to COLS columns if an argument is specified. This requires a capable terminal and the termcap entries 'Z0' and 'Z1'. See the 'termcap' command (*note Termcap::), for more information. You can also specify a height if you want to change both values. The '-w' option tells screen to leave the display size unchanged and just set the window size, '-d' vice versa. -- Command: height ['-w'|'-d'] [lines [cols]] (none) Set the display height to a specified number of lines. When no argument is given it toggles between 24 and 42 lines display.  File: screen.info, Node: Character Processing, Prev: Window Size, Up: Virtual Terminal 11.11 Character Processing ========================== -- Command: c1 [state] (none) Change c1 code processing. 'c1 on' tells screen to treat the input characters between 128 and 159 as control functions. Such an 8-bit code is normally the same as ESC followed by the corresponding 7-bit code. The default setting is to process c1 codes and can be changed with the 'defc1' command. Users with fonts that have usable characters in the c1 positions may want to turn this off. -- Command: gr [state] (none) Turn GR charset switching on/off. Whenever screen sees an input char with an 8th bit set, it will use the charset stored in the GR slot and print the character with the 8th bit stripped. The default (see also 'defgr') is not to process GR switching because otherwise the ISO88591 charset would not work. -- Command: bce [state] (none) Change background-color-erase setting. If 'bce' is set to on, all characters cleared by an erase/insert/scroll/clear operation will be displayed in the current background color. Otherwise the default background color is used. -- Command: encoding enc [denc] (none) Tell screen how to interpret the input/output. The first argument sets the encoding of the current window. Each window can emulate a different encoding. The optional second parameter overwrites the encoding of the connected terminal. It should never be needed as screen uses the locale setting to detect the encoding. There is also a way to select a terminal encoding depending on the terminal type by using the 'KJ' termcap entry. *Note Special Capabilities::. Supported encodings are 'eucJP', 'SJIS', 'eucKR', 'eucCN', 'Big5', 'GBK', 'KOI8-R', 'CP1251', 'UTF-8', 'ISO8859-2', 'ISO8859-3', 'ISO8859-4', 'ISO8859-5', 'ISO8859-6', 'ISO8859-7', 'ISO8859-8', 'ISO8859-9', 'ISO8859-10', 'ISO8859-15', 'jis'. See also 'defencoding', which changes the default setting of a new window. -- Command: charset set (none) Change the current character set slot designation and charset mapping. The first four character of SET are treated as charset designators while the fifth and sixth character must be in range '0' to '3' and set the GL/GR charset mapping. On every position a '.' may be used to indicate that the corresponding charset/mapping should not be changed (SET is padded to six characters internally by appending '.' chars). New windows have 'BBBB02' as default charset, unless a 'encoding' command is active. The current setting can be viewed with the *note Info:: command. -- Command: utf8 [state [dstate]] (none) Change the encoding used in the current window. If utf8 is enabled, the strings sent to the window will be UTF-8 encoded and vice versa. Omitting the parameter toggles the setting. If a second parameter is given, the display's encoding is also changed (this should rather be done with screen's '-U' option). See also 'defutf8', which changes the default setting of a new window. -- Command: defc1 state (none) Same as the 'c1' command except that the default setting for new windows is changed. Initial setting is 'on'. -- Command: defgr state (none) Same as the 'gr' command except that the default setting for new windows is changed. Initial setting is 'off'. -- Command: defbce state (none) Same as the 'bce' command except that the default setting for new windows is changed. Initial setting is 'off'. -- Command: defencoding enc (none) Same as the 'encoding' command except that the default setting for new windows is changed. Initial setting is the encoding taken from the terminal. -- Command: defcharset [set] (none) Like the 'charset' command except that the default setting for new windows is changed. Shows current default if called without argument. -- Command: defutf8 state (none) Same as the 'utf8' command except that the default setting for new windows is changed. Initial setting is 'on' if screen was started with '-U', otherwise 'off'. -- Command: cjkwidth [state] (none) Toggle how ambiguoous characters are treated. If cjkwidth is on screen interprets them as double (full) width characters. If off then they are seen as one cell (half) width characters.  File: screen.info, Node: Copy and Paste, Next: Subprocess Execution, Prev: Virtual Terminal, Up: Top 12 Copy and Paste ***************** For those confined to a hardware terminal, these commands provide a cut and paste facility more powerful than those provided by most windowing systems. * Menu: * Copy:: Copy from scrollback to buffer * Paste:: Paste from buffer into window * Registers:: Longer-term storage * Screen Exchange:: Sharing data between screen users * History:: Recalling previous input  File: screen.info, Node: Copy, Next: Paste, Up: Copy and Paste 12.1 Copying ============ -- Command: copy ('C-a [', 'C-a C-[', 'C-a ') Enter copy/scrollback mode. This allows you to copy text from the current window and its history into the paste buffer. In this mode a 'vi'-like full screen editor is active, with controls as outlined below. * Menu: * Line Termination:: End copied lines with CR/LF * Scrollback:: Set the size of the scrollback buffer * Copy Mode Keys:: Remap keys in copy mode * Movement:: Move around in the scrollback buffer * Marking:: Select the text you want * Repeat count:: Repeat a command * Searching:: Find the text you want * Specials:: Other random keys  File: screen.info, Node: Line Termination, Next: Scrollback, Up: Copy 12.1.1 CR/LF ------------ -- Command: crlf [state] (none) This affects the copying of text regions with the 'copy' command. If it is set to 'on', lines will be separated by the two character sequence 'CR'/'LF'. Otherwise only 'LF' is used. 'crlf' is off by default. When no parameter is given, the state is toggled.  File: screen.info, Node: Scrollback, Next: Copy Mode Keys, Prev: Line Termination, Up: Copy 12.1.2 Scrollback ----------------- To access and use the contents in the scrollback buffer, use the 'copy' command. *Note Copy::. -- Command: defscrollback num (none) Same as the 'scrollback' command except that the default setting for new windows is changed. Defaults to 100. -- Command: scrollback num (none) Set the size of the scrollback buffer for the current window to NUM lines. The default scrollback is 100 lines. Use 'info' to view the current setting. -- Command: compacthist [state] (none) This tells screen whether to suppress trailing blank lines when scrolling up text into the history buffer. Turn compacting 'on' to hold more useful lines in your scrollback buffer.  File: screen.info, Node: Copy Mode Keys, Next: Movement, Prev: Scrollback, Up: Copy 12.1.3 Markkeys --------------- -- Command: markkeys string (none) This is a method of changing the keymap used for copy/history mode. The string is made up of OLDCHAR=NEWCHAR pairs which are separated by ':'. Example: The command 'markkeys h=^B:l=^F:$=^E' would set some keys to be more familiar to 'emacs' users. If your terminal sends characters, that cause you to abort copy mode, then this command may help by binding these characters to do nothing. The no-op character is '@' and is used like this: 'markkeys @=L=H' if you do not want to use the 'H' or 'L' commands any longer. As shown in this example, multiple keys can be assigned to one function in a single statement.  File: screen.info, Node: Movement, Next: Marking, Prev: Copy Mode Keys, Up: Copy 12.1.4 Movement Keys -------------------- 'h', 'C-h', or 'left arrow' move the cursor left. 'j', 'C-n', or 'down arrow' move the cursor down. 'k', 'C-p', or 'up arrow' move the cursor up. 'l' ('el'), or 'right arrow' move the cursor right. '0' (zero) or 'C-a' move to the leftmost column. '+' and '-' move the cursor to the leftmost column of the next or previous line. 'H', 'M' and 'L' move the cursor to the leftmost column of the top, center or bottom line of the window. '|' moves to the specified absolute column. 'g' or 'home' moves to the beginning of the buffer. 'G' or 'end' moves to the specified absolute line (default: end of buffer). '%' jumps to the specified percentage of the buffer. '^' or '$' move to the first or last non-whitespace character on the line. 'w', 'b', and 'e' move the cursor word by word. 'B', 'E' move the cursor WORD by WORD (as in vi). 'f'/'F', 't'/'T' move the cursor forward/backward to the next occurence of the target. (eg, '3fy' will move the cursor to the 3rd 'y' to the right.) ';' and ',' Repeat the last f/F/t/T command in the same/opposite direction. 'C-e' and 'C-y' scroll the display up/down by one line while preserving the cursor position. 'C-u' and 'C-d' scroll the display up/down by the specified amount of lines while preserving the cursor position. (Default: half screenful). 'C-b' and 'C-f' move the cursor up/down a full screen. Note that Emacs-style movement keys can be specified by a .screenrc command. ('markkeys "h=^B:l=^F:$=^E"') There is no simple method for a full emacs-style keymap, however, as this involves multi-character codes.  File: screen.info, Node: Marking, Next: Repeat count, Prev: Movement, Up: Copy 12.1.5 Marking -------------- The copy range is specified by setting two marks. The text between these marks will be highlighted. Press: 'space' or 'enter' to set the first or second mark respectively. If 'mousetrack' is set to 'on', marks can also be set using 'left mouse click'. 'Y' and 'y' can be used to mark one whole line or to mark from start of line. 'W' marks exactly one word.  File: screen.info, Node: Repeat count, Next: Searching, Prev: Marking, Up: Copy 12.1.6 Repeat Count ------------------- Any command in copy mode can be prefixed with a number (by pressing digits '0...9') which is taken as a repeat count. Example: C-a C-[ H 10 j 5 Y will copy lines 11 to 15 into the paste buffer.  File: screen.info, Node: Searching, Next: Specials, Prev: Repeat count, Up: Copy 12.1.7 Searching ---------------- '/' 'vi'-like search forward. '?' 'vi'-like search backward. 'C-a s' 'emacs' style incremental search forward. 'C-r' 'emacs' style reverse i-search. -- Command: ignorecase [on|off] (none) Tell screen to ignore the case of characters in searches. Default is 'off'. Without any options, the state of 'ignorecase' is toggled. 'n' Repeat search in forward direction. 'N' Repeat search in backward direction.  File: screen.info, Node: Specials, Prev: Searching, Up: Copy 12.1.8 Specials --------------- There are, however, some keys that act differently here from in 'vi'. 'Vi' does not allow to yank rectangular blocks of text, but 'screen' does. Press: 'c' or 'C' to set the left or right margin respectively. If no repeat count is given, both default to the current cursor position. Example: Try this on a rather full text screen: C-a [ M 20 l SPACE c 10 l 5 j C SPACE. This moves one to the middle line of the screen, moves in 20 columns left, marks the beginning of the paste buffer, sets the left column, moves 5 columns down, sets the right column, and then marks the end of the paste buffer. Now try: C-a [ M 20 l SPACE 10 l 5 j SPACE and notice the difference in the amount of text copied. 'J' joins lines. It toggles between 4 modes: lines separated by a newline character (012), lines glued seamless, lines separated by a single space or comma separated lines. Note that you can prepend the newline character with a carriage return character, by issuing a 'set crlf on'. 'v' or 'V' is for all the 'vi' users who use ':set numbers' - it toggles the left margin between column 9 and 1. 'a' before the final 'space' key turns on append mode. Thus the contents of the paste buffer will not be overwritten, but appended to. 'A' turns on append mode and sets a (second) mark. '>' sets the (second) mark and writes the contents of the paste buffer to the screen-exchange file ('/tmp/screen-exchange' per default) once copy-mode is finished. *Note Screen Exchange::. This example demonstrates how to dump the whole scrollback buffer to that file: C-a [ g SPACE G $ >. 'C-g' gives information about the current line and column. 'x' or 'o' ('oh') exchanges the first mark and the current cursor position. You can use this to adjust an already placed mark. 'C-l' ('el') will redraw the screen. '@' does nothing. Absolutely nothing. Does not even exit copy mode. All keys not described here exit copy mode.  File: screen.info, Node: Paste, Next: Registers, Prev: Copy, Up: Copy and Paste 12.2 Paste ========== -- Command: paste [registers [destination]] ('C-a ]', 'C-a C-]') Write the (concatenated) contents of the specified registers to the stdin stream of the current window. The register '.' is treated as the paste buffer. If no parameter is specified the user is prompted to enter a single register. The paste buffer can be filled with the 'copy', 'history' and 'readbuf' commands. Other registers can be filled with the 'register', 'readreg' and 'paste' commands. If 'paste' is called with a second argument, the contents of the specified registers is pasted into the named destination register rather than the window. If '.' is used as the second argument, the display's paste buffer is the destination. Note, that 'paste' uses a wide variety of resources: Usually both, a current window and a current display are required. But whenever a second argument is specified no current window is needed. When the source specification only contains registers (not the paste buffer) then there need not be a current display (terminal attached), as the registers are a global resource. The paste buffer exists once for every user. -- Command: stuff [string] (none) Stuff the string STRING in the input buffer of the current window. This is like the 'paste' command, but with much less overhead. Without a paramter, 'screen' will prompt for a string to stuff. You cannot paste large buffers with the 'stuff' command. It is most useful for key bindings. *Note Bindkey::. -- Command: pastefont [state] Tell screen to include font information in the paste buffer. The default is not to do so. This command is especially useful for multi character fonts like kanji. -- Command: slowpaste msec -- Command: defslowpaste msec (none) Define the speed text is inserted in the current window by the 'paste' command. If the slowpaste value is nonzero text is written character by character. 'screen' will pause for MSEC milliseconds after each write to allow the application to process the input. only use 'slowpaste' if your underlying system exposes flow control problems while pasting large amounts of text. 'defslowpaste' specifies the default for new windows. -- Command: readreg [-e encoding] [register [filename]] (none) Does one of two things, dependent on number of arguments: with zero or one arguments it it duplicates the paste buffer contents into the register specified or entered at the prompt. With two arguments it reads the contents of the named file into the register, just as 'readbuf' reads the screen-exchange file into the paste buffer. You can tell screen the encoding of the file via the '-e' option. The following example will paste the system's password file into the screen window (using register p, where a copy remains): C-a : readreg p /etc/passwd C-a : paste p  File: screen.info, Node: Registers, Next: Screen Exchange, Prev: Paste, Up: Copy and Paste 12.3 Registers ============== -- Command: copy_reg [key] (none) Removed. Use 'readreg' instead. -- Command: ins_reg [key] (none) Removed. Use 'paste' instead. -- Command: process [key] (none) Stuff the contents of the specified register into the 'screen' input queue. If no argument is given you are prompted for a register name. The text is parsed as if it had been typed in from the user's keyboard. This command can be used to bind multiple actions to a single key. -- Command: register [-e encoding] key string (none) Save the specified STRING to the register KEY. The encoding of the string can be specified via the '-e' option.  File: screen.info, Node: Screen Exchange, Next: History, Prev: Registers, Up: Copy and Paste 12.4 Screen Exchange ==================== -- Command: bufferfile [EXCHANGE-FILE] (none) Change the filename used for reading and writing with the paste buffer. If the EXCHANGE-FILE parameter is omitted, 'screen' reverts to the default of '/tmp/screen-exchange'. The following example will paste the system's password file into the screen window (using the paste buffer, where a copy remains): C-a : bufferfile /etc/passwd C-a < C-a ] C-a : bufferfile -- Command: readbuf [-e ENCODING] [FILENAME] ('C-a <') Reads the contents of the specified file into the paste buffer. You can tell screen the encoding of the file via the '-e' option. If no file is specified, the screen-exchange filename is used. -- Command: removebuf ('C-a =') Unlinks the screen-exchange file. -- Command: writebuf [-e ENCODING] [FILENAME] ('C-a >') Writes the contents of the paste buffer to the specified file, or the public accessible screen-exchange file if no filename is given. This is thought of as a primitive means of communication between 'screen' users on the same host. If an encoding is specified the paste buffer is recoded on the fly to match the encoding. See also 'C-a ' (*note Copy::).  File: screen.info, Node: History, Prev: Screen Exchange, Up: Copy and Paste 12.5 History ============ -- Command: history ('C-a {', 'C-a }') Usually users work with a shell that allows easy access to previous commands. For example, 'csh' has the command '!!' to repeat the last command executed. 'screen' provides a primitive way of recalling "the command that started ...": You just type the first letter of that command, then hit 'C-a {' and 'screen' tries to find a previous line that matches with the prompt character to the left of the cursor. This line is pasted into this window's input queue. Thus you have a crude command history (made up by the visible window and its scrollback buffer).  File: screen.info, Node: Subprocess Execution, Next: Key Binding, Prev: Copy and Paste, Up: Top 13 Subprocess Execution *********************** Control Input or Output of a window by another filter process. Use with care! * Menu: * Exec:: The 'exec' command syntax. * Using Exec:: Weird things that filters can do.  File: screen.info, Node: Exec, Next: Using Exec, Up: Subprocess Execution 13.1 Exec ========= -- Command: exec [[FDPAT] NEWCOMMAND [ARGS ... ]] (none) Run a unix subprocess (specified by an executable path NEWCOMMAND and its optional arguments) in the current window. The flow of data between newcommands stdin/stdout/stderr, the process originally started (let us call it "application-process") and screen itself (window) is controlled by the file descriptor pattern FDPAT. This pattern is basically a three character sequence representing stdin, stdout and stderr of newcommand. A dot ('.') connects the file descriptor to screen. An exclamation mark ('!') causes the file descriptor to be connected to the application-process. A colon (':') combines both. User input will go to newcommand unless newcommand receives the application-process' output (FDPATs first character is '!' or ':') or a pipe symbol ('|') is added to the end of FDPAT. Invoking 'exec' without arguments shows name and arguments of the currently running subprocess in this window. Only one subprocess can be running per window. When a subprocess is running the 'kill' command will affect it instead of the windows process. Only one subprocess a time can be running in each window. Refer to the postscript file 'doc/fdpat.ps' for a confusing illustration of all 21 possible combinations. Each drawing shows the digits 2, 1, 0 representing the three file descriptors of newcommand. The box marked 'W' is usual pty that has the application-process on its slave side. The box marked 'P' is the secondary pty that now has screen at its master side.  File: screen.info, Node: Using Exec, Prev: Exec, Up: Subprocess Execution 13.2 Using Exec =============== Abbreviations: * Whitespace between the word 'exec' and FDPAT and the command name can be omitted. * Trailing dots and a FDPAT consisting only of dots can be omitted. * A simple '|' is synonymous for the '!..|' pattern. * The word 'exec' can be omitted when the '|' abbreviation is used. * The word 'exec' can always be replaced by leading '!'. Examples: '!/bin/sh' 'exec /bin/sh' 'exec ... /bin/sh' All of the above are equivalent. Creates another shell in the same window, while the original shell is still running. Output of both shells is displayed and user input is sent to the new '/bin/sh'. '!!stty 19200' 'exec!stty 19200' 'exec !.. stty 19200' All of the above are equivalent. Set the speed of the window's tty. If your stty command operates on stdout, then add another '!'. This is a useful command, when a screen window is directly connected to a serial line that needs to be configured. '|less' 'exec !..| less' Both are equivalent. This adds a pager to the window output. The special character '|' is needed to give the user control over the pager although it gets its input from the window's process. This works, because 'less' listens on stderr (a behavior that 'screen' would not expect without the '|') when its stdin is not a tty. 'Less' versions newer than 177 fail miserably here; good old 'pg' still works. '!:sed -n s/.*Error.*/\007/p' Sends window output to both, the user and the sed command. The sed inserts an additional bell character (oct. 007) to the window output seen by screen. This will cause 'Bell in window x' messages, whenever the string 'Error' appears in the window.  File: screen.info, Node: Key Binding, Next: Flow Control, Prev: Subprocess Execution, Up: Top 14 Key Binding ************** You may disagree with some of the default bindings (I know I do). The 'bind' command allows you to redefine them to suit your preferences. * Menu: * Bind:: 'bind' syntax. * Bind Examples:: Using 'bind'. * Command Character:: The character used to start keyboard commands. * Help:: Show current key bindings. * Bindkey:: 'bindkey' syntax. * Bindkey Examples:: Some easy examples. * Bindkey Control:: How to control the bindkey mechanism.  File: screen.info, Node: Bind, Next: Bind Examples, Up: Key Binding 14.1 The 'bind' command ======================= -- Command: bind [-c class] key [command [args]] (none) Bind a command to a key. The KEY argument is either a single character, a two-character sequence of the form '^x' (meaning 'C-x'), a backslash followed by an octal number (specifying the ASCII code of the character), or a backslash followed by a second character, such as '\^' or '\\'. The argument can also be quoted, if you like. If no further argument is given, any previously established binding for this key is removed. The COMMAND argument can be any command (*note Command Index::). If a command class is specified via the '-c' option, the key is bound for the specified class. Use the 'command' command to activate a class. Command classes can be used to create multiple command keys or multi-character bindings. By default, most suitable commands are bound to one or more keys (*note Default Key Bindings::); for instance, the command to create a new window is bound to 'C-c' and 'c'. The 'bind' command can be used to redefine the key bindings and to define new bindings. -- Command: unbindall (none) Unbind all the bindings. This can be useful when screen is used solely for its detaching abilities, such as when letting a console application run as a daemon. If, for some reason, it is necessary to bind commands after this, use 'screen -X'.  File: screen.info, Node: Bind Examples, Next: Command Character, Prev: Bind, Up: Key Binding 14.2 Examples of the 'bind' command =================================== Some examples: bind ' ' windows bind ^f screen telnet foobar bind \033 screen -ln -t root -h 1000 9 su would bind the space key to the command that displays a list of windows (so that the command usually invoked by 'C-a C-w' would also be available as 'C-a space'), bind 'C-f' to the command "create a window with a TELNET connection to foobar", and bind to the command that creates an non-login window with title 'root' in slot #9, with a superuser shell and a scrollback buffer of 1000 lines. bind -c demo1 0 select 10 bind -c demo1 1 select 11 bind -c demo1 2 select 12 bindkey "^B" command -c demo1 makes 'C-b 0' select window 10, 'C-b 1' window 11, etc. bind -c demo2 0 select 10 bind -c demo2 1 select 11 bind -c demo2 2 select 12 bind - command -c demo2 makes 'C-a - 0' select window 10, 'C-a - 1' window 11, etc.  File: screen.info, Node: Command Character, Next: Help, Prev: Bind Examples, Up: Key Binding 14.3 Command Character ====================== -- Command: escape xy (none) Set the command character to X and the character generating a literal command character (by triggering the 'meta' command) to Y (similar to the '-e' option). Each argument is either a single character, a two-character sequence of the form '^x' (meaning 'C-x'), a backslash followed by an octal number (specifying the ASCII code of the character), or a backslash followed by a second character, such as '\^' or '\\'. The default is '^Aa', but '``' is recommended by one of the authors. -- Command: defescape xy (none) Set the default command characters. This is equivalent to the command 'escape' except that it is useful for multiuser sessions only. In a multiuser session 'escape' changes the command character of the calling user, where 'defescape' changes the default command characters for users that will be added later. -- Command: meta ('C-a a') Send the command character ('C-a') to the process in the current window. The keystroke for this command is the second parameter to the '-e' command line switch (*note Invoking Screen::), or the 'escape' .screenrc directive. -- Command: command [-c CLASS] (none) This command has the same effect as typing the screen escape character ('C-a'). It is probably only useful for key bindings. If the '-c' option is given, select the specified command class. *Note Bind::, *Note Bindkey::.  File: screen.info, Node: Help, Next: Bindkey, Prev: Command Character, Up: Key Binding 14.4 Help ========= -- Command: help ('C-a ?') Displays a help screen showing you all the key bindings. The first pages list all the internal commands followed by their bindings. Subsequent pages will display the custom commands, one command per key. Press space when you're done reading each page, or return to exit early. All other characters are ignored. If the '-c' option is given, display all bound commands for the specified command class. *Note Default Key Bindings::.  File: screen.info, Node: Bindkey, Next: Bindkey Examples, Prev: Help, Up: Key Binding 14.5 Bindkey ============ -- Command: bindkey [OPTS] [STRING [CMD ARGS]] (none) This command manages screen's input translation tables. Every entry in one of the tables tells screen how to react if a certain sequence of characters is encountered. There are three tables: one that should contain actions programmed by the user, one for the default actions used for terminal emulation and one for screen's copy mode to do cursor movement. See *note Input Translation:: for a list of default key bindings. If the '-d' option is given, bindkey modifies the default table, '-m' changes the copy mode table and with neither option the user table is selected. The argument 'string' is the sequence of characters to which an action is bound. This can either be a fixed string or a termcap keyboard capability name (selectable with the '-k' option). Some keys on a VT100 terminal can send a different string if application mode is turned on (e.g. the cursor keys). Such keys have two entries in the translation table. You can select the application mode entry by specifying the '-a' option. The '-t' option tells screen not to do inter-character timing. One cannot turn off the timing if a termcap capability is used. 'cmd' can be any of screen's commands with an arbitrary number of 'args'. If 'cmd' is omitted the key-binding is removed from the table.  File: screen.info, Node: Bindkey Examples, Next: Bindkey Control, Prev: Bindkey, Up: Key Binding 14.6 Bindkey Examples ===================== Here are some examples of keyboard bindings: bindkey -d Show all of the default key bindings. The application mode entries are marked with [A]. bindkey -k k1 select 1 Make the "F1" key switch to window one. bindkey -t foo stuff barfoo Make 'foo' an abbreviation of the word 'barfoo'. Timeout is disabled so that users can type slowly. bindkey "\024" mapdefault This key-binding makes 'C-t' an escape character for key-bindings. If you did the above 'stuff barfoo' binding, you can enter the word 'foo' by typing 'C-t foo'. If you want to insert a 'C-t' you have to press the key twice (i.e., escape the escape binding). bindkey -k F1 command Make the F11 (not F1!) key an alternative screen escape (besides 'C-a').  File: screen.info, Node: Bindkey Control, Prev: Bindkey Examples, Up: Key Binding 14.7 Bindkey Control ==================== -- Command: mapdefault (none) Tell screen that the next input character should only be looked up in the default bindkey table. -- Command: mapnotnext (none) Like mapdefault, but don't even look in the default bindkey table. -- Command: maptimeout n (none) Set the inter-character timer for input sequence detection to a timeout of N ms. The default timeout is 300ms. Maptimeout with no arguments shows the current setting.  File: screen.info, Node: Flow Control, Next: Termcap, Prev: Key Binding, Up: Top 15 Flow Control *************** 'screen' can trap flow control characters or pass them to the program, as you see fit. This is useful when your terminal wants to use XON/XOFF flow control and you are running a program which wants to use ^S/^Q for other purposes (i.e. 'emacs'). * Menu: * Flow Control Summary:: The effect of 'screen' flow control * Flow:: Setting the flow control behavior * XON/XOFF:: Sending XON or XOFF to the window  File: screen.info, Node: Flow Control Summary, Next: Flow, Up: Flow Control 15.1 About 'screen' flow control settings ========================================= Each window has a flow-control setting that determines how screen deals with the XON and XOFF characters (and perhaps the interrupt character). When flow-control is turned off, screen ignores the XON and XOFF characters, which allows the user to send them to the current program by simply typing them (useful for the 'emacs' editor, for instance). The trade-off is that it will take longer for output from a "normal" program to pause in response to an XOFF. With flow-control turned on, XON and XOFF characters are used to immediately pause the output of the current window. You can still send these characters to the current program, but you must use the appropriate two-character screen commands (typically 'C-a q' (xon) and 'C-a s' (xoff)). The xon/xoff commands are also useful for typing C-s and C-q past a terminal that intercepts these characters. Each window has an initial flow-control value set with either the '-f' option or the 'defflow' command. By default the windows are set to automatic flow-switching. It can then be toggled between the three states 'fixed on', 'fixed off' and 'automatic' interactively with the 'flow' command bound to 'C-a f'. The automatic flow-switching mode deals with flow control using the TIOCPKT mode (like 'rlogin' does). If the tty driver does not support TIOCPKT, screen tries to determine the right mode based on the current setting of the application keypad -- when it is enabled, flow-control is turned off and visa versa. Of course, you can still manipulate flow-control manually when needed. If you're running with flow-control enabled and find that pressing the interrupt key (usually C-c) does not interrupt the display until another 6-8 lines have scrolled by, try running screen with the 'interrupt' option (add the 'interrupt' flag to the 'flow' command in your .screenrc, or use the '-i' command-line option). This causes the output that 'screen' has accumulated from the interrupted program to be flushed. One disadvantage is that the virtual terminal's memory contains the non-flushed version of the output, which in rare cases can cause minor inaccuracies in the output. For example, if you switch screens and return, or update the screen with 'C-a l' you would see the version of the output you would have gotten without 'interrupt' being on. Also, you might need to turn off flow-control (or use auto-flow mode to turn it off automatically) when running a program that expects you to type the interrupt character as input, as the 'interrupt' parameter only takes effect when flow-control is enabled. If your program's output is interrupted by mistake, a simple refresh of the screen with 'C-a l' will restore it. Give each mode a try, and use whichever mode you find more comfortable.  File: screen.info, Node: Flow, Next: XON/XOFF, Prev: Flow Control Summary, Up: Flow Control 15.2 Flow ========= -- Command: defflow fstate [interrupt] (none) Same as the 'flow' command except that the default setting for new windows is changed. Initial setting is 'auto'. Specifying 'flow auto interrupt' has the same effect as the command-line options '-fa' and '-i'. Note that if 'interrupt' is enabled, all existing displays are changed immediately to forward interrupt signals. -- Command: flow [fstate] ('C-a f', 'C-a C-f') Sets the flow-control mode for this window to FSTATE, which can be 'on', 'off' or 'auto'. Without parameters it cycles the current window's flow-control setting. Default is set by 'defflow'.  File: screen.info, Node: XON/XOFF, Prev: Flow, Up: Flow Control 15.3 XON and XOFF ================= -- Command: xon ('C-a q', 'C-a C-q') Send a ^Q (ASCII XON) to the program in the current window. Redundant if flow control is set to 'off' or 'auto'. -- Command: xoff ('C-a s', 'C-a C-s') Send a ^S (ASCII XOFF) to the program in the current window.  File: screen.info, Node: Termcap, Next: Message Line, Prev: Flow Control, Up: Top 16 Termcap ********** 'Screen' demands the most out of your terminal so that it can perform its VT100 emulation most efficiently. These functions provide means for tweaking the termcap entries for both your physical terminal and the one simulated by 'screen'. * Menu: * Window Termcap:: Choosing a termcap entry for the window. * Dump Termcap:: Write out a termcap entry for the window. * Termcap Syntax:: The 'termcap' and 'terminfo' commands. * Termcap Examples:: Uses for 'termcap'. * Special Capabilities:: Non-standard capabilities used by 'screen'. * Autonuke:: Flush unseen output * Obuflimit:: Allow pending output when reading more * Character Translation:: Emulating fonts and charsets.  File: screen.info, Node: Window Termcap, Next: Dump Termcap, Up: Termcap 16.1 Choosing the termcap entry for a window ============================================ Usually 'screen' tries to emulate as much of the VT100/ANSI standard as possible. But if your terminal lacks certain capabilities the emulation may not be complete. In these cases 'screen' has to tell the applications that some of the features are missing. This is no problem on machines using termcap, because 'screen' can use the '$TERMCAP' variable to customize the standard screen termcap. But if you do a rlogin on another machine or your machine supports only terminfo this method fails. Because of this 'screen' offers a way to deal with these cases. Here is how it works: When 'screen' tries to figure out a terminal name for itself, it first looks for an entry named 'screen.TERM', where TERM is the contents of your '$TERM' variable. If no such entry exists, 'screen' tries 'screen' (or 'screen-w', if the terminal is wide (132 cols or more)). If even this entry cannot be found, 'vt100' is used as a substitute. The idea is that if you have a terminal which doesn't support an important feature (e.g. delete char or clear to EOS) you can build a new termcap/terminfo entry for 'screen' (named 'screen.DUMBTERM') in which this capability has been disabled. If this entry is installed on your machines you are able to do a rlogin and still keep the correct termcap/terminfo entry. The terminal name is put in the '$TERM' variable of all new windows. 'screen' also sets the '$TERMCAP' variable reflecting the capabilities of the virtual terminal emulated. Furthermore, the variable '$WINDOW' is set to the window number of each window. The actual set of capabilities supported by the virtual terminal depends on the capabilities supported by the physical terminal. If, for instance, the physical terminal does not support underscore mode, 'screen' does not put the 'us' and 'ue' capabilities into the window's '$TERMCAP' variable, accordingly. However, a minimum number of capabilities must be supported by a terminal in order to run 'screen'; namely scrolling, clear screen, and direct cursor addressing (in addition, 'screen' does not run on hardcopy terminals or on terminals that over-strike). Also, you can customize the '$TERMCAP' value used by 'screen' by using the 'termcap' command, or by defining the variable '$SCREENCAP' prior to startup. When the latter defined, its value will be copied verbatim into each window's '$TERMCAP' variable. This can either be the full terminal definition, or a filename where the terminal 'screen' (and/or 'screen-w') is defined. Note that 'screen' honors the 'terminfo' command if the system uses the terminfo database rather than termcap. On such machines the '$TERMCAP' variable has no effect and you must use the 'dumptermcap' command (*note Dump Termcap::) and the 'tic' program to generate terminfo entries for 'screen' windows. When the boolean 'G0' capability is present in the termcap entry for the terminal on which 'screen' has been called, the terminal emulation of 'screen' supports multiple character sets. This allows an application to make use of, for instance, the VT100 graphics character set or national character sets. The following control functions from ISO 2022 are supported: 'lock shift G0' ('SI'), 'lock shift G1' ('SO'), 'lock shift G2', 'lock shift G3', 'single shift G2', and 'single shift G3'. When a virtual terminal is created or reset, the ASCII character set is designated as 'G0' through 'G3'. When the 'G0' capability is present, screen evaluates the capabilities 'S0', 'E0', and 'C0' if present. 'S0' is the sequence the terminal uses to enable and start the graphics character set rather than 'SI'. 'E0' is the corresponding replacement for 'SO'. 'C0' gives a character by character translation string that is used during semi-graphics mode. This string is built like the 'acsc' terminfo capability. When the 'po' and 'pf' capabilities are present in the terminal's termcap entry, applications running in a 'screen' window can send output to the printer port of the terminal. This allows a user to have an application in one window sending output to a printer connected to the terminal, while all other windows are still active (the printer port is enabled and disabled again for each chunk of output). As a side-effect, programs running in different windows can send output to the printer simultaneously. Data sent to the printer is not displayed in the window. The 'info' command displays a line starting with 'PRIN' while the printer is active. Some capabilities are only put into the '$TERMCAP' variable of the virtual terminal if they can be efficiently implemented by the physical terminal. For instance, 'dl' (delete line) is only put into the '$TERMCAP' variable if the terminal supports either delete line itself or scrolling regions. Note that this may provoke confusion, when the session is reattached on a different terminal, as the value of '$TERMCAP' cannot be modified by parent processes. You can force 'screen' to include all capabilities in '$TERMCAP' with the '-a' command-line option (*note Invoking Screen::). The "alternate screen" capability is not enabled by default. Set the 'altscreen' '.screenrc' command to enable it.  File: screen.info, Node: Dump Termcap, Next: Termcap Syntax, Prev: Window Termcap, Up: Termcap 16.2 Write out the window's termcap entry ========================================= -- Command: dumptermcap ('C-a .') Write the termcap entry for the virtual terminal optimized for the currently active window to the file '.termcap' in the user's '$HOME/.screen' directory (or wherever 'screen' stores its sockets. *note Files::). This termcap entry is identical to the value of the environment variable '$TERMCAP' that is set up by 'screen' for each window. For terminfo based systems you will need to run a converter like 'captoinfo' and then compile the entry with 'tic'.  File: screen.info, Node: Termcap Syntax, Next: Termcap Examples, Prev: Dump Termcap, Up: Termcap 16.3 The 'termcap' command ========================== -- Command: termcap term terminal-tweaks [window-tweaks] -- Command: terminfo term terminal-tweaks [window-tweaks] -- Command: termcapinfo term terminal-tweaks [window-tweaks] (none) Use this command to modify your terminal's termcap entry without going through all the hassles involved in creating a custom termcap entry. Plus, you can optionally customize the termcap generated for the windows. You have to place these commands in one of the screenrc startup files, as they are meaningless once the terminal emulator is booted. If your system uses the terminfo database rather than termcap, 'screen' will understand the 'terminfo' command, which has the same effects as the 'termcap' command. Two separate commands are provided, as there are subtle syntactic differences, e.g. when parameter interpolation (using '%') is required. Note that the termcap names of the capabilities should also be used with the 'terminfo' command. In many cases, where the arguments are valid in both terminfo and termcap syntax, you can use the command 'termcapinfo', which is just a shorthand for a pair of 'termcap' and 'terminfo' commands with identical arguments. The first argument specifies which terminal(s) should be affected by this definition. You can specify multiple terminal names by separating them with '|'s. Use '*' to match all terminals and 'vt*' to match all terminals that begin with 'vt'. Each TWEAK argument contains one or more termcap defines (separated by ':'s) to be inserted at the start of the appropriate termcap entry, enhancing it or overriding existing values. The first tweak modifies your terminal's termcap, and contains definitions that your terminal uses to perform certain functions. Specify a null string to leave this unchanged (e.g. ""). The second (optional) tweak modifies all the window termcaps, and should contain definitions that screen understands (*note Virtual Terminal::).  File: screen.info, Node: Termcap Examples, Next: Special Capabilities, Prev: Termcap Syntax, Up: Termcap 16.4 Termcap Examples ===================== Some examples: termcap xterm* xn:hs@ Informs 'screen' that all terminals that begin with 'xterm' have firm auto-margins that allow the last position on the screen to be updated (xn), but they don't really have a status line (no 'hs' - append '@' to turn entries off). Note that we assume 'xn' for all terminal names that start with 'vt', but only if you don't specify a termcap command for that terminal. termcap vt* xn termcap vt102|vt220 Z0=\E[?3h:Z1=\E[?3l Specifies the firm-margined 'xn' capability for all terminals that begin with 'vt', and the second line will also add the escape-sequences to switch into (Z0) and back out of (Z1) 132-character-per-line mode if this is a VT102 or VT220. (You must specify Z0 and Z1 in your termcap to use the width-changing commands.) termcap vt100 "" l0=PF1:l1=PF2:l2=PF3:l3=PF4 This leaves your vt100 termcap alone and adds the function key labels to each window's termcap entry. termcap h19|z19 am@:im=\E@:ei=\EO dc=\E[P Takes a h19 or z19 termcap and turns off auto-margins (am@) and enables the insert mode (im) and end-insert (ei) capabilities (the '@' in the 'im' string is after the '=', so it is part of the string). Having the 'im' and 'ei' definitions put into your terminal's termcap will cause screen to automatically advertise the character-insert capability in each window's termcap. Each window will also get the delete-character capability (dc) added to its termcap, which screen will translate into a line-update for the terminal (we're pretending it doesn't support character deletion). If you would like to fully specify each window's termcap entry, you should instead set the '$SCREENCAP' variable prior to running 'screen'. *Note Virtual Terminal::, for the details of the 'screen' terminal emulation. *Note Termcap: (termcap)Top, for more information on termcap definitions.  File: screen.info, Node: Special Capabilities, Next: Autonuke, Prev: Termcap Examples, Up: Termcap 16.5 Special Terminal Capabilities ================================== The following table describes all terminal capabilities that are recognized by 'screen' and are not in the termcap manual (*note Termcap: (termcap)Top.). You can place these capabilities in your termcap entries (in '/etc/termcap') or use them with the commands 'termcap', 'terminfo' and 'termcapinfo' in your 'screenrc' files. It is often not possible to place these capabilities in the terminfo database. 'LP' (bool) Terminal has VT100 style margins ('magic margins'). Note that this capability is obsolete -- 'screen' now uses the standard 'xn' instead. 'Z0' (str) Change width to 132 columns. 'Z1' (str) Change width to 80 columns. 'WS' (str) Resize display. This capability has the desired width and height as arguments. SunView(tm) example: '\E[8;%d;%dt'. 'NF' (bool) Terminal doesn't need flow control. Send ^S and ^Q direct to the application. Same as 'flow off'. The opposite of this capability is 'nx'. 'G0' (bool) Terminal can deal with ISO 2022 font selection sequences. 'S0' (str) Switch charset 'G0' to the specified charset. Default is '\E(%.'. 'E0' (str) Switch charset 'G0' back to standard charset. Default is '\E(B'. 'C0' (str) Use the string as a conversion table for font 0. See the 'ac' capability for more details. 'CS' (str) Switch cursor-keys to application mode. 'CE' (str) Switch cursor-keys to cursor mode. 'AN' (bool) Enable autonuke for displays of this terminal type. (*note Autonuke::). 'OL' (num) Set the output buffer limit. See the 'obuflimit' command (*note Obuflimit::) for more details. 'KJ' (str) Set the encoding of the terminal. See the 'encoding' command (*note Character Processing::) for valid encodings. 'AF' (str) Change character foreground color in an ANSI conform way. This capability will almost always be set to '\E[3%dm' ('\E[3%p1%dm' on terminfo machines). 'AB' (str) Same as 'AF', but change background color. 'AX' (bool) Does understand ANSI set default fg/bg color ('\E[39m / \E[49m'). 'XC' (str) Describe a translation of characters to strings depending on the current font. (*note Character Translation::). 'XT' (bool) Terminal understands special xterm sequences (OSC, mouse tracking). 'C8' (bool) Terminal needs bold to display high-intensity colors (e.g. Eterm). 'TF' (bool) Add missing capabilities to the termcap/info entry. (Set by default).  File: screen.info, Node: Autonuke, Next: Obuflimit, Prev: Special Capabilities, Up: Termcap 16.6 Autonuke ============= -- Command: autonuke STATE (none) Sets whether a clear screen sequence should nuke all the output that has not been written to the terminal. *Note Obuflimit::. This property is set per display, not per window. -- Command: defautonuke STATE (none) Same as the 'autonuke' command except that the default setting for new displays is also changed. Initial setting is 'off'. Note that you can use the special 'AN' terminal capability if you want to have a terminal type dependent setting.  File: screen.info, Node: Obuflimit, Next: Character Translation, Prev: Autonuke, Up: Termcap 16.7 Obuflimit ============== -- Command: obuflimit [LIMIT] (none) If the output buffer contains more bytes than the specified limit, no more data will be read from the windows. The default value is 256. If you have a fast display (like 'xterm'), you can set it to some higher value. If no argument is specified, the current setting is displayed. This property is set per display, not per window. -- Command: defobuflimit LIMIT (none) Same as the 'obuflimit' command except that the default setting for new displays is also changed. Initial setting is 256 bytes. Note that you can use the special 'OL' terminal capability if you want to have a terminal type dependent limit.  File: screen.info, Node: Character Translation, Prev: Obuflimit, Up: Termcap 16.8 Character Translation ========================== 'Screen' has a powerful mechanism to translate characters to arbitrary strings depending on the current font and terminal type. Use this feature if you want to work with a common standard character set (say ISO8851-latin1) even on terminals that scatter the more unusual characters over several national language font pages. Syntax: XC={,,} :=