diff options
author | Amadeusz Sławiński (amade) <amade@asmblr.net> | 2011-01-04 20:31:39 +0100 |
---|---|---|
committer | Amadeusz Sławiński <amade@asmblr.net> | 2014-05-15 15:36:18 +0200 |
commit | 05c104fa44881d12a1ec908f1876e21c22bf4ed9 (patch) | |
tree | f04f1a6f903a81afc78d77ea765edcebd953d45f | |
parent | f1115ba0d242a5391aa07f482c79c918d434c602 (diff) | |
download | screen-05c104fa44881d12a1ec908f1876e21c22bf4ed9.tar.gz |
make most features as always built in from now on
removed #define SIMPLESCREEN and it's #defines
also removed #define DETACH and RXVT_SOC
all of this options are now default
-rw-r--r-- | src/acconfig.h | 61 | ||||
-rw-r--r-- | src/acls.c | 28 | ||||
-rw-r--r-- | src/acls.h | 8 | ||||
-rw-r--r-- | src/ansi.c | 222 | ||||
-rw-r--r-- | src/ansi.h | 24 | ||||
-rw-r--r-- | src/attacher.c | 63 | ||||
-rw-r--r-- | src/canvas.c | 4 | ||||
-rw-r--r-- | src/comm.c | 78 | ||||
-rw-r--r-- | src/comm.sh | 2 | ||||
-rw-r--r-- | src/configure.in | 8 | ||||
-rw-r--r-- | src/display.c | 270 | ||||
-rw-r--r-- | src/display.h | 28 | ||||
-rw-r--r-- | src/encoding.c | 117 | ||||
-rw-r--r-- | src/extern.h | 30 | ||||
-rw-r--r-- | src/fileio.c | 36 | ||||
-rw-r--r-- | src/help.c | 74 | ||||
-rw-r--r-- | src/image.h | 68 | ||||
-rw-r--r-- | src/layer.c | 27 | ||||
-rw-r--r-- | src/list_display.c | 12 | ||||
-rw-r--r-- | src/list_window.c | 2 | ||||
-rw-r--r-- | src/mark.c | 44 | ||||
-rw-r--r-- | src/process.c | 290 | ||||
-rw-r--r-- | src/resize.c | 71 | ||||
-rw-r--r-- | src/screen.c | 101 | ||||
-rw-r--r-- | src/screen.h | 2 | ||||
-rw-r--r-- | src/search.c | 2 | ||||
-rw-r--r-- | src/socket.c | 73 | ||||
-rw-r--r-- | src/term.sh | 5 | ||||
-rw-r--r-- | src/termcap.c | 38 | ||||
-rw-r--r-- | src/tty.sh | 6 | ||||
-rw-r--r-- | src/window.c | 114 | ||||
-rw-r--r-- | src/window.h | 30 |
32 files changed, 41 insertions, 1897 deletions
diff --git a/src/acconfig.h b/src/acconfig.h index b36392f..2ede634 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -108,67 +108,6 @@ #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 - - -/* * 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. @@ -61,7 +61,6 @@ extern char SockPath[]; extern struct display *display, *displays; struct acluser *users; -#ifdef MULTIUSER int maxusercount = 0; /* used in process.c: RC_MONITOR, RC_SILENCE */ /* record given user ids here */ @@ -118,7 +117,6 @@ GrowBitfield(AclBits *bfp, int len, int delta, int defaultbit) return 0; } -#endif /* MULTIUSER */ /* * Returns an nonzero Address. Its contents is either a User-ptr, @@ -132,12 +130,8 @@ FindUserPtr(char *name) for (u = &users; *u; u = &(*u)->u_next) if (!strcmp((*u)->u_name, name)) break; -#ifdef MULTIUSER debug3("FindUserPtr %s %sfound, id %d\n", name, (*u)?"":"not ", (*u)?(*u)->u_id:-1); -#else /* MULTIUSER */ - debug2("FindUserPtr %s %sfound\n", name, (*u)?"":"not "); -#endif /* MULTIUSER */ return u; } @@ -152,9 +146,7 @@ int DefaultMetaEsc = -1; int UserAdd(char *name, char *pass, struct acluser **up) { -#ifdef MULTIUSER int j; -#endif if (!up) up = FindUserPtr(name); @@ -168,13 +160,9 @@ UserAdd(char *name, char *pass, struct acluser **up) *up = (struct acluser *)calloc(1, sizeof(struct acluser)); if (!*up) return -1; /* he still does not exist */ -#ifdef COPY_PASTE (*up)->u_plop.buf = NULL; (*up)->u_plop.len = 0; -# ifdef ENCODINGS (*up)->u_plop.enc = 0; -# endif -#endif (*up)->u_Esc = DefaultEsc; (*up)->u_MetaEsc = DefaultMetaEsc; strncpy((*up)->u_name, name, MAXLOGINLEN); @@ -186,7 +174,6 @@ UserAdd(char *name, char *pass, struct acluser **up) (*up)->u_detachwin = -1; (*up)->u_detachotherwin = -1; -#ifdef MULTIUSER (*up)->u_group = NULL; /* now find an unused index */ for ((*up)->u_id = 0; (*up)->u_id < maxusercount; (*up)->u_id++) @@ -294,9 +281,6 @@ UserAdd(char *name, char *pass, struct acluser **up) } ACLBYTE((*up)->u_umask_w_bits[j], (*up)->u_id) |= ACLBIT((*up)->u_id); } -#else /* MULTIUSER */ - debug1("UserAdd %s\n", name); -#endif /* MULTIUSER */ return 0; } @@ -308,9 +292,7 @@ int UserDel(char *name, struct acluser **up) { struct acluser *u; -#ifdef MULTIUSER int i; -#endif struct display *old, *next; if (!up) @@ -330,7 +312,6 @@ UserDel(char *name, struct acluser **up) display = old; *up = u->u_next; -#ifdef MULTIUSER for (up = &users; *up; up = &(*up)->u_next) { /* unlink all group references to this user */ @@ -357,11 +338,8 @@ UserDel(char *name, struct acluser **up) AclSetPerm(NULL, u, default_c_bit[ACL_EXEC] ? "+x" : "-x", "?"); for (i = 0; i < ACL_BITS_PER_WIN; i++) free((char *)u->u_umask_w_bits[i]); -#endif /* MULTIUSER */ debug1("FREEING user structure for %s\n", u->u_name); -#ifdef COPY_PASTE UserFreeCopyBuffer(u); -#endif free((char *)u); if (!users) { @@ -372,7 +350,6 @@ UserDel(char *name, struct acluser **up) } -#ifdef COPY_PASTE /* * returns 0 if the copy buffer was really deleted. @@ -398,9 +375,7 @@ UserFreeCopyBuffer(struct acluser *u) u->u_plop.buf = 0; return 0; } -#endif /* COPY_PASTE */ -#ifdef MULTIUSER /* * Traverses group nodes. It searches for a node that references user u. * If recursive is true, nodes found in the users are also searched using @@ -565,14 +540,12 @@ DoSu(struct acluser **up, char *name, char *pw1, char *pw2) *up = u; /* substitute user now */ return NULL; } -#endif /* MULTIUSER */ /************************************************************************ * end of user managing code * ************************************************************************/ -#ifdef MULTIUSER /* This gives the users default rights to the new window w created by u */ int @@ -1083,4 +1056,3 @@ AclCheckPermCmd(struct acluser *u, int mode, struct comm *c) return !ok; } -#endif /* MULTIUSER */ @@ -26,7 +26,6 @@ **************************************************************** */ -#ifdef MULTIUSER /* three known bits: */ #define ACL_EXEC 0 @@ -52,7 +51,6 @@ struct aclusergroup struct acluser *u; /* the user who borrows us his rights */ struct aclusergroup *next; }; -#endif /* MULTIUSER */ /*************** * ==> user.h @@ -65,9 +63,7 @@ struct plop { char *buf; int len; -#ifdef ENCODINGS int enc; -#endif }; /* @@ -84,14 +80,10 @@ typedef struct acluser int u_detachwin; /* the window where he last detached */ int u_detachotherwin; /* window that was "other" when he detached */ int u_Esc, u_MetaEsc; /* the users screen escape character */ -#ifdef COPY_PASTE struct plop u_plop; -#endif -#ifdef MULTIUSER int u_id; /* a uniq index in the bitfields. */ AclBits u_umask_w_bits[ACL_BITS_PER_WIN]; /* his window create umask */ struct aclusergroup *u_group; /* linked list of pointers to other users */ -#endif } User; extern int DefaultEsc, DefaultMetaEsc; @@ -48,12 +48,8 @@ extern char *logtstamp_string; extern char *captionstring; extern char *hstatusstring; extern char *wliststr; -#ifdef COPY_PASTE extern int compacthist; -#endif -#ifdef MULTIUSER extern struct acluser *EffectiveAclUser; -#endif int Z0width, Z1width; /* widths for Z0/Z1 switching */ @@ -116,11 +112,9 @@ static int StringEnd (void); static void PrintStart (void); static void PrintChar (int); static void PrintFlush (void); -#ifdef FONT static void DesignateCharset (int, int); static void MapCharset (int); static void MapCharsetR (int); -#endif static void SaveCursor (struct cursor *); static void RestoreCursor (struct cursor *); static void BackSpace (void); @@ -149,9 +143,7 @@ static void FillWithEs (void); static void FindAKA (void); static void Report (char *, int, int); static void ScrollRegion (int); -#ifdef COPY_PASTE static void WAddLineToHist (struct win *, struct mline *); -#endif static void WLogString (struct win *, char *, int); static void WReverseVideo (struct win *, int); static int WindowChangedCheck (char *, int, int *); @@ -163,15 +155,9 @@ static void MInsChar (struct win *, struct mchar *, int, int); static void MPutChar (struct win *, struct mchar *, int, int); static void MPutStr (struct win *, char *, int, struct mchar *, int, int); static void MWrapChar (struct win *, struct mchar *, int, int, int, int); -#ifdef COLOR static void MBceLine (struct win *, int, int, int, int); -#endif -#ifdef COLOR -# define CURR_BCE (curr->w_bce ? rend_getbg(&curr->w_rend) : 0) -#else -# define CURR_BCE 0 -#endif +#define CURR_BCE (curr->w_bce ? rend_getbg(&curr->w_rend) : 0) void ResetAnsiState(struct win *p) @@ -205,12 +191,8 @@ ResetWindow(register struct win *p) for (i = 8; i < p->w_width; i += 8) p->w_tabs[i] = 1; p->w_rend = mchar_null; -#ifdef FONT ResetCharsets(p); -#endif -#ifdef COLOR p->w_bce = nwin_default.bce; -#endif } /* adds max 22 bytes */ @@ -239,7 +221,6 @@ GetAnsiStatus(struct win *w, char *buf) } -#ifdef FONT void ResetCharsets(struct win *p) @@ -249,9 +230,7 @@ ResetCharsets(struct win *p) SetCharsets(p, "BBBB02"); if (nwin_default.charset) SetCharsets(p, nwin_default.charset); -#ifdef ENCODINGS ResetEncoding(p); -#endif } void @@ -270,7 +249,6 @@ SetCharsets(struct win *p, char *s) p->w_FontL = p->w_charsets[p->w_Charset]; p->w_FontR = p->w_charsets[p->w_CharsetR]; } -#endif /* FONT */ /*****************************************************************/ @@ -287,9 +265,7 @@ void WriteString(struct win *wp, register char *buf, register int len) { register int c; -#ifdef FONT register int font; -#endif struct canvas *cv; if (!len) @@ -316,27 +292,15 @@ WriteString(struct win *wp, register char *buf, register int len) do { c = (unsigned char)*buf++; -#ifdef FONT -# ifdef DW_CHARS if (!curr->w_mbcs) -# endif curr->w_rend.font = curr->w_FontL; /* Default: GL */ -#endif /* The next part is only for speedup */ if (curr->w_state == LIT && -#ifdef UTF8 curr->w_encoding != UTF8 && -#endif -#ifdef DW_CHARS !is_dw_font(curr->w_rend.font) && -# ifdef ENCODINGS curr->w_rend.font != KANA && !curr->w_mbcs && -# endif -#endif -#ifdef FONT curr->w_rend.font != '<' && -#endif c >= ' ' && c != 0x7f && ((c & 0x80) == 0 || ((c >= 0xa0 || !curr->w_c1) && !curr->w_gr)) && !curr->w_ss && !curr->w_insert && curr->w_x < cols - 1) @@ -365,7 +329,6 @@ WriteString(struct win *wp, register char *buf, register int len) } /* end of speedup code */ -#ifdef UTF8 if (curr->w_encoding == UTF8) { c = FromUtf8(c, &curr->w_decodestate); @@ -381,7 +344,6 @@ WriteString(struct win *wp, register char *buf, register int len) if (c > 0xff) debug1("read UNICODE %04x\n", c); } -#endif tryagain: switch (curr->w_state) @@ -531,11 +493,9 @@ WriteString(struct win *wp, register char *buf, register int len) { if (curr->w_intermediate) { -#ifdef DW_CHARS if (curr->w_intermediate == '$') c |= '$' << 8; else -#endif c = -1; } curr->w_intermediate = c; @@ -591,11 +551,9 @@ WriteString(struct win *wp, register char *buf, register int len) break; case LIT: default: -#ifdef DW_CHARS if (curr->w_mbcs) if (c <= ' ' || c == 0x7f || (c >= 0x80 && c < 0xa0 && curr->w_c1)) curr->w_mbcs = 0; -#endif if (c < ' ') { if (c == '\033') @@ -610,13 +568,9 @@ WriteString(struct win *wp, register char *buf, register int len) break; } if (c >= 0x80 && c < 0xa0 && curr->w_c1) -#ifdef FONT if ((curr->w_FontR & 0xf0) != 0x20 -# ifdef UTF8 || curr->w_encoding == UTF8 -# endif ) -#endif { switch (c) { @@ -645,23 +599,15 @@ WriteString(struct win *wp, register char *buf, register int len) break; } -#ifdef FONT -# ifdef DW_CHARS if (!curr->w_mbcs) { -# endif if (c < 0x80 || curr->w_gr == 0) curr->w_rend.font = curr->w_FontL; -# ifdef ENCODINGS else if (curr->w_gr == 2 && !curr->w_ss) curr->w_rend.font = curr->w_FontE; -# endif else curr->w_rend.font = curr->w_FontR; -# ifdef DW_CHARS } -# endif -# ifdef UTF8 if (curr->w_encoding == UTF8) { if (curr->w_rend.font == '0') @@ -679,10 +625,8 @@ WriteString(struct win *wp, register char *buf, register int len) } curr->w_rend.font = 0; } -# ifdef DW_CHARS if (curr->w_encoding == UTF8 && utf8_isdouble(c)) curr->w_mbcs = 0xff; -# endif if (curr->w_encoding == UTF8 && c >= 0x0300 && utf8_iscomb(c)) { int ox, oy; @@ -718,9 +662,6 @@ WriteString(struct win *wp, register char *buf, register int len) break; } font = curr->w_rend.font; -# endif -# ifdef DW_CHARS -# ifdef ENCODINGS if (font == KANA && curr->w_encoding == SJIS && curr->w_mbcs == 0) { /* Lets see if it is the first byte of a kanji */ @@ -732,7 +673,6 @@ WriteString(struct win *wp, register char *buf, register int len) break; } } -# endif if (font == 031 && c == 0x80 && !curr->w_mbcs) font = curr->w_rend.font = 0; if (is_dw_font(font) && c == ' ') @@ -750,12 +690,9 @@ WriteString(struct win *wp, register char *buf, register int len) curr->w_x += curr->w_wrap ? 1 : -1; debug1("Patched w_x to %d\n", curr->w_x); } -# ifdef UTF8 if (curr->w_encoding != UTF8) -# endif { c = curr->w_mbcs; -# ifdef ENCODINGS if (font == KANA && curr->w_encoding == SJIS) { debug2("SJIS !! %x %x\n", c, t); @@ -786,7 +723,6 @@ WriteString(struct win *wp, register char *buf, register int len) } debug2("SJIS after %x %x\n", c, t); } -# endif if (t && curr->w_gr && font != 030 && font != 031) { t &= 0x7f; @@ -798,45 +734,29 @@ WriteString(struct win *wp, register char *buf, register int len) curr->w_mbcs = t; } } -# endif /* DW_CHARS */ if (font == '<' && c >= ' ') { font = curr->w_rend.font = 0; c |= 0x80; } -# ifdef UTF8 else if (curr->w_gr && curr->w_encoding != UTF8) -# else - else if (curr->w_gr) -# endif { -#ifdef ENCODINGS if (c == 0x80 && font == 0 && curr->w_encoding == GBK) c = 0xa4; else c &= 0x7f; if (c < ' ' && font != 031) goto tryagain; -#else - c &= 0x7f; - if (c < ' ') /* this is ugly but kanji support */ - goto tryagain; /* prevents nicer programming */ -#endif } -#endif /* FONT */ if (c == '\177') break; curr->w_rend.image = c; -#ifdef UTF8 if (curr->w_encoding == UTF8) { curr->w_rend.font = c >> 8; curr->w_rend.fontx = c >> 16; } -#endif -#ifdef DW_CHARS curr->w_rend.mbcs = curr->w_mbcs; -#endif if (curr->w_x < cols - 1) { if (curr->w_insert) @@ -868,14 +788,11 @@ WriteString(struct win *wp, register char *buf, register int len) curr->w_y++; curr->w_x = 1; } -#ifdef FONT -# ifdef DW_CHARS if (curr->w_mbcs) { curr->w_rend.mbcs = curr->w_mbcs = 0; curr->w_x++; } -# endif if (curr->w_ss) { curr->w_FontL = curr->w_charsets[curr->w_Charset]; @@ -884,7 +801,6 @@ WriteString(struct win *wp, register char *buf, register int len) LSetRendition(&curr->w_layer, &curr->w_rend); curr->w_ss = 0; } -#endif /* FONT */ break; } } @@ -938,14 +854,12 @@ Special(register int c) case '\t': ForwardTab(); return 1; -#ifdef FONT case '\017': /* SI */ MapCharset(G0); return 1; case '\016': /* SO */ MapCharset(G1); return 1; -#endif } return 0; } @@ -1007,7 +921,6 @@ DoESC(int c, int intermediate) WNewAutoFlow(curr, 1); #endif /* !TIOCPKT */ break; -#ifdef FONT case 'n': /* LS2 */ MapCharset(G2); break; @@ -1038,7 +951,6 @@ DoESC(int c, int intermediate) else curr->w_ss = 0; break; -#endif /* FONT */ case 'g': /* VBELL, private screen sequence */ WBell(curr, 1); break; @@ -1052,7 +964,6 @@ DoESC(int c, int intermediate) break; } break; -#ifdef FONT case '(': DesignateCharset(c, G0); break; @@ -1065,7 +976,6 @@ DoESC(int c, int intermediate) case '+': DesignateCharset(c, G3); break; -# ifdef DW_CHARS /* * ESC $ ( Fn: invoke multi-byte charset, Fn, to G0 * ESC $ Fn: same as above. (old sequence) @@ -1086,8 +996,6 @@ DoESC(int c, int intermediate) case '$'<<8 | '+': DesignateCharset(c & 037, G3); break; -# endif -#endif /* FONT */ } } @@ -1346,18 +1254,14 @@ DoCSI(int c, int intermediate) case 2: /* ANM: ansi/vt52 mode */ if (i) { -#ifdef FONT -# ifdef ENCODINGS if (curr->w_encoding) break; -# endif curr->w_charsets[0] = curr->w_charsets[1] = curr->w_charsets[2] = curr->w_charsets[3] = curr->w_FontL = curr->w_FontR = ASCII; curr->w_Charset = 0; curr->w_CharsetR = 2; curr->w_ss = 0; -#endif } break; case 3: /* COLM: column mode */ @@ -1505,7 +1409,6 @@ StringEnd() break; typ = atoi(curr->w_string); p++; -#ifdef MULTIUSER if (typ == 83) /* 83 = 'S' */ { /* special execute commands sequence */ @@ -1533,8 +1436,6 @@ StringEnd() } break; } -#endif -#ifdef RXVT_OSC if (typ == 0 || typ == 1 || typ == 2 || typ == 20 || typ == 39 || typ == 49) { int typ2; @@ -1559,10 +1460,6 @@ StringEnd() } if (typ != 0 && typ != 2) break; -#else - if (typ < 0 || typ > 2) - break; -#endif curr->w_stringp -= p - curr->w_string; if (curr->w_stringp > curr->w_string) @@ -1696,16 +1593,13 @@ WNewAutoFlow(struct win *win, int on) } -#ifdef FONT static void DesignateCharset(int c, int n) { curr->w_ss = 0; -# ifdef ENCODINGS if (c == ('@' & 037)) /* map JIS 6226 to 0208 */ c = KANJI; -# endif if (c == 'B') c = ASCII; if (curr->w_charsets[n] != c) @@ -1747,7 +1641,6 @@ MapCharsetR(int n) curr->w_gr = 1; } -#endif /* FONT */ static void SaveCursor(struct cursor *cursor) @@ -1756,12 +1649,10 @@ SaveCursor(struct cursor *cursor) cursor->x = curr->w_x; cursor->y = curr->w_y; cursor->Rend = curr->w_rend; -#ifdef FONT cursor->Charset = curr->w_Charset; cursor->CharsetR = curr->w_CharsetR; bcopy((char *) curr->w_charsets, (char *) cursor->Charsets, 4 * sizeof(int)); -#endif } static void @@ -1773,7 +1664,6 @@ RestoreCursor(struct cursor *cursor) curr->w_x = cursor->x; curr->w_y = cursor->y; curr->w_rend = cursor->Rend; -#ifdef FONT bcopy((char *) cursor->Charsets, (char *) curr->w_charsets, 4 * sizeof(int)); curr->w_Charset = cursor->Charset; @@ -1781,7 +1671,6 @@ RestoreCursor(struct cursor *cursor) curr->w_ss = 0; curr->w_FontL = curr->w_charsets[curr->w_Charset]; curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; -#endif LSetRendition(&curr->w_layer, &curr->w_rend); } @@ -1938,11 +1827,7 @@ static void ClearScreen() { LClearArea(&curr->w_layer, 0, 0, curr->w_width - 1, curr->w_height - 1, CURR_BCE, 1); -#ifdef COPY_PASTE MScrollV(curr, curr->w_height, 0, curr->w_height - 1, CURR_BCE); -#else - MClearArea(curr, 0, 0, curr->w_width - 1, curr->w_height - 1, CURR_BCE); -#endif } static void @@ -2069,19 +1954,12 @@ static char rendlist[] = static void SelectRendition() { -#ifdef COLOR register int j, i = 0, a = curr->w_rend.attr, c = curr->w_rend.color; -# ifdef COLORS256 int cx = curr->w_rend.colorx; -# endif -#else - register int j, i = 0, a = curr->w_rend.attr; -#endif do { j = curr->w_args[i]; -#ifdef COLOR if ((j == 38 || j == 48) && i + 2 < curr->w_NumArgs && curr->w_args[i + 1] == 5) { int jj; @@ -2090,7 +1968,6 @@ SelectRendition() jj = curr->w_args[i]; if (jj < 0 || jj > 255) continue; -# ifdef COLORS256 if (j == 38) { c = (c & 0xf0) | ((jj & 0x0f) ^ 9); @@ -2113,14 +1990,7 @@ SelectRendition() cx = (cx & 0x0f) | (jj & 0xf0); } continue; -# else - jj = color256to16(jj) + 30; - if (jj >= 38) - jj += 60 - 8; - j = j == 38 ? jj : jj + 10; -# endif } -# ifdef COLORS16 if (j == 0 || (j >= 30 && j <= 39 && j != 38)) a &= 0xbf; if (j == 0 || (j >= 40 && j <= 49 && j != 48)) @@ -2129,7 +1999,6 @@ SelectRendition() a |= 0x40; if (j >= 100 && j <= 107) a |= 0x80; -# endif if (j >= 90 && j <= 97) j -= 60; if (j >= 100 && j <= 107) @@ -2140,13 +2009,10 @@ SelectRendition() c = (c & 0x0f) | (((j - 40) ^ 9) << 4); if (j == 0) c = 0; -# ifdef COLORS256 if (j == 0 || (j >= 30 && j <= 39 && j != 38)) cx &= 0xf0; if (j == 0 || (j >= 40 && j <= 49 && j != 48)) cx &= 0x0f; -# endif -#endif if (j < 0 || j >= (int)(sizeof(rendlist)/sizeof(*rendlist))) continue; j = rendlist[j]; @@ -2157,12 +2023,8 @@ SelectRendition() } while (++i < curr->w_NumArgs); curr->w_rend.attr = a; -#ifdef COLOR curr->w_rend.color = c; -# ifdef COLORS256 curr->w_rend.colorx = cx; -# endif -#endif LSetRendition(&curr->w_layer, &curr->w_rend); } @@ -2284,7 +2146,6 @@ Report(char *fmt, int n1, int n2) sprintf(rbuf, fmt, n1, n2); len = strlen(rbuf); -#ifdef PSEUDOS if (W_UWP(curr)) { if ((unsigned)(curr->w_pwin->p_inlen + len) <= sizeof(curr->w_pwin->p_inbuf)) @@ -2294,7 +2155,6 @@ Report(char *fmt, int n1, int n2) } } else -#endif { if ((unsigned)(curr->w_inlen + len) <= sizeof(curr->w_inbuf)) { @@ -2330,7 +2190,6 @@ MFixLine(struct win *p, int y, struct mchar *mc) WMsg(p, 0, "Warning: no space for attr - turned off"); } } -#ifdef FONT if (mc->font && ml->font == null) { if ((ml->font = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) @@ -2350,8 +2209,6 @@ MFixLine(struct win *p, int y, struct mchar *mc) mc->fontx = 0; } } -#endif -#ifdef COLOR if (mc->color && ml->color == null) { if ((ml->color = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) @@ -2361,7 +2218,6 @@ MFixLine(struct win *p, int y, struct mchar *mc) WMsg(p, 0, "Warning: no space for color - turned off"); } } -# ifdef COLORS256 if (mc->colorx && ml->colorx == null) { if ((ml->colorx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) @@ -2371,13 +2227,10 @@ MFixLine(struct win *p, int y, struct mchar *mc) WMsg(p, 0, "Warning: no space for extended colors - turned off"); } } -# endif -#endif } /*****************************************************************/ -#ifdef DW_CHARS # define MKillDwRight(p, ml, x) \ if (dw_right(ml, x, p->w_encoding)) \ { \ @@ -2392,10 +2245,6 @@ MFixLine(struct win *p, int y, struct mchar *mc) copy_mchar2mline(&mchar_blank, ml, x); \ copy_mchar2mline(&mchar_blank, ml, x + 1); \ } -#else -# define MKillDwRight(p, ml, x) ; -# define MKillDwLeft(p, ml, x) ; -#endif static void MScrollH(struct win *p, int n, int y, int xs, int xe, int bce) @@ -2417,10 +2266,8 @@ MScrollH(struct win *p, int n, int y, int xs, int xe, int bce) else n = xe - xs + 1; clear_mline(ml, xe + 1 - n, n); -#ifdef COLOR if (bce) MBceLine(p, y, xe + 1 - n, n, bce); -#endif } else { @@ -2433,10 +2280,8 @@ MScrollH(struct win *p, int n, int y, int xs, int xe, int bce) else n = xe - xs + 1; clear_mline(ml, xs, n); -#ifdef COLOR if (bce) MBceLine(p, y, xs, n, bce); -#endif } } @@ -2458,7 +2303,6 @@ MScrollV(struct win *p, int n, int ys, int ye, int bce) } if (ye - ys + 1 < n) n = ye - ys + 1; -#ifdef COPY_PASTE if (compacthist) { ye = MFindUsedLine(p, ye, ys); @@ -2467,41 +2311,30 @@ MScrollV(struct win *p, int n, int ys, int ye, int bce) if (n <= 0) return; } -#endif /* Clear lines */ ml = p->w_mlines + ys; for (i = ys; i < ys + n; i++, ml++) { -#ifdef COPY_PASTE if (ys == p->w_top) WAddLineToHist(p, ml); -#endif if (ml->attr != null) free(ml->attr); ml->attr = null; -#ifdef FONT if (ml->font != null) free(ml->font); ml->font = null; if (ml->fontx != null) free(ml->fontx); ml->fontx = null; -#endif -#ifdef COLOR if (ml->color != null) free(ml->color); ml->color = null; -# ifdef COLORS256 if (ml->colorx != null) free(ml->colorx); ml->colorx = null; -# endif -#endif bclear((char *)ml->image, p->w_width + 1); -#ifdef COLOR if (bce) MBceLine(p, i, 0, p->w_width, bce); -#endif } /* switch 'em over */ cnt1 = n * sizeof(struct mline); @@ -2527,29 +2360,21 @@ MScrollV(struct win *p, int n, int ys, int ye, int bce) if (ml->attr != null) free(ml->attr); ml->attr = null; -#ifdef FONT if (ml->font != null) free(ml->font); ml->font = null; if (ml->fontx != null) free(ml->fontx); ml->fontx = null; -#endif -#ifdef COLOR if (ml->color != null) free(ml->color); ml->color = null; -# ifdef COLORS256 if (ml->colorx != null) free(ml->colorx); ml->colorx = null; -# endif -#endif bclear((char *)ml->image, p->w_width + 1); -#ifdef COLOR if (bce) MBceLine(p, i, 0, p->w_width, bce); -#endif } cnt1 = n * sizeof(struct mline); cnt2 = (ye - ys + 1 - n) * sizeof(struct mline); @@ -2604,10 +2429,8 @@ MClearArea(struct win *p, int xs, int ys, int xe, int ye, int bce) n = xxe - xs + 1; if (n > 0) clear_mline(ml, xs, n); -#ifdef COLOR if (n > 0 && bce) MBceLine(p, y, xs, xs + n - 1, bce); -#endif xs = 0; } } @@ -2629,7 +2452,6 @@ MInsChar(struct win *p, struct mchar *c, int x, int y) bcopy_mline(ml, x, x + 1, n); } copy_mchar2mline(c, ml, x); -#ifdef DW_CHARS if (c->mbcs) { if (--n > 0) @@ -2639,7 +2461,6 @@ MInsChar(struct win *p, struct mchar *c, int x, int y) } copy_mchar2mline(c, ml, x + 1); ml->image[x + 1] = c->mbcs; -# ifdef UTF8 if (p->w_encoding != UTF8) ml->font[x + 1] |= 0x80; else if (p->w_encoding == UTF8 && c->mbcs) @@ -2647,11 +2468,7 @@ MInsChar(struct win *p, struct mchar *c, int x, int y) ml->font[x + 1] = c->mbcs; ml->fontx[x + 1] = 0; } -# else - ml->font[x + 1] |= 0x80; -# endif } -#endif } static void @@ -2664,13 +2481,11 @@ MPutChar(struct win *p, struct mchar *c, int x, int y) MKillDwRight(p, ml, x); MKillDwLeft(p, ml, x); copy_mchar2mline(c, ml, x); -#ifdef DW_CHARS if (c->mbcs) { MKillDwLeft(p, ml, x + 1); copy_mchar2mline(c, ml, x + 1); ml->image[x + 1] = c->mbcs; -# ifdef UTF8 if (p->w_encoding != UTF8) ml->font[x + 1] |= 0x80; else if (p->w_encoding == UTF8 && c->mbcs) @@ -2678,11 +2493,7 @@ MPutChar(struct win *p, struct mchar *c, int x, int y) ml->font[x + 1] = c->mbcs; ml->fontx[x + 1] = 0; } -# else - ml->font[x + 1] |= 0x80; -# endif } -#endif } @@ -2692,11 +2503,7 @@ MWrapChar(struct win *p, struct mchar *c, int y, int top, int bot, int ins) struct mline *ml; int bce; -#ifdef COLOR bce = rend_getbg(c); -#else - bce = 0; -#endif MFixLine(p, y, c); ml = &p->w_mlines[y]; copy_mchar2mline(&mchar_null, ml, p->w_width); @@ -2730,7 +2537,6 @@ MPutStr(struct win *p, char *s, int n, struct mchar *r, int x, int y) for (i = n; i-- > 0;) *b++ = r->attr; } -#ifdef FONT if (ml->font != null) { b = ml->font + x; @@ -2743,26 +2549,20 @@ MPutStr(struct win *p, char *s, int n, struct mchar *r, int x, int y) for (i = n; i-- > 0;) *b++ = r->fontx; } -#endif -#ifdef COLOR if (ml->color != null) { b = ml->color + x; for (i = n; i-- > 0;) *b++ = r->color; } -# ifdef COLORS256 if (ml->colorx != null) { b = ml->colorx + x; for (i = n; i-- > 0;) *b++ = r->colorx; } -# endif -#endif } -#ifdef COLOR static void MBceLine(struct win *p, int y, int xs, int xe, int bce) { @@ -2774,24 +2574,18 @@ MBceLine(struct win *p, int y, int xs, int xe, int bce) rend_setbg(&mc, bce); MFixLine(p, y, &mc); ml = p->w_mlines + y; -# ifdef COLORS16 if (mc.attr) for (x = xs; x <= xe; x++) ml->attr[x] = mc.attr; -# endif if (mc.color) for (x = xs; x <= xe; x++) ml->color[x] = mc.color; -# ifdef COLORS256 if (mc.colorx) for (x = xs; x <= xe; x++) ml->colorx[x] = mc.colorx; -# endif } -#endif -#ifdef COPY_PASTE static void WAddLineToHist(struct win *wp, struct mline *ml) { @@ -2807,30 +2601,22 @@ WAddLineToHist(struct win *wp, struct mline *ml) if (o != null) free(o); -#ifdef FONT q = ml->font; o = hml->font; hml->font = q; ml->font = null; if (o != null) free(o); q = ml->fontx; o = hml->fontx; hml->fontx = q; ml->fontx = null; if (o != null) free(o); -#endif - -#ifdef COLOR q = ml->color; o = hml->color; hml->color = q; ml->color = null; if (o != null) free(o); -# ifdef COLORS256 q = ml->colorx; o = hml->colorx; hml->colorx = q; ml->colorx = null; if (o != null) free(o); -# endif -#endif if (++wp->w_histidx >= wp->w_histheight) wp->w_histidx = 0; } -#endif int MFindUsedLine(struct win *p, int ye, int ys) @@ -2845,15 +2631,10 @@ MFindUsedLine(struct win *p, int ye, int ys) break; if (ml->attr != null && bcmp((char*)ml->attr, null, p->w_width)) break; -#ifdef COLOR if (ml->color != null && bcmp((char*)ml->color, null, p->w_width)) break; -# ifdef COLORS256 if (ml->colorx != null && bcmp((char*)ml->colorx, null, p->w_width)) break; -# endif -#endif -#ifdef UTF8 if (p->w_encoding == UTF8) { if (ml->font != null && bcmp((char*)ml->font, null, p->w_width)) @@ -2861,7 +2642,6 @@ MFindUsedLine(struct win *p, int ye, int ys) if (ml->fontx != null && bcmp((char*)ml->fontx, null, p->w_width)) break; } -#endif } debug1("MFindUsedLine returning %d\n", y); return y; @@ -48,13 +48,11 @@ #define ATYP_S (1<<1) #define ATYP_U (1<<2) -#ifdef COLORS16 /* pseudo attributes */ # define ATTR_BFG 6 /* bright foreground */ # define ATTR_BBG 7 /* bright background */ # define A_BFG (1<<ATTR_BFG) # define A_BBG (1<<ATTR_BBG) -#endif /* * Parser state @@ -119,7 +117,6 @@ enum move_t { #define STATLINE (D_height-1) #endif -#ifdef ENCODINGS #define KANJI ('B' & 037) #define KANJI0212 ('D' & 037) @@ -136,23 +133,15 @@ enum move_t { #define EUC EUC_JP -#endif -#ifdef UTF8 -#undef UTF8 #define UTF8 8 -#endif -#ifdef UTF8 # define UCS_REPL 0xfffd /* character for illegal codes */ # define UCS_REPL_DW 0xff1f /* character for illegal codes */ # define UCS_HIDDEN 0xffff -#endif -#ifdef DW_CHARS # define is_dw_font(f) ((f) && ((f) & 0x60) == 0) -# ifdef UTF8 # define dw_left(ml, x, enc) ((enc == UTF8) ? \ (unsigned char)(ml)->font[(x) + 1] == 0xff && (unsigned char)(ml)->image[(x) + 1] == 0xff : \ ((unsigned char)(ml)->font[x] & 0x1f) != 0 && ((unsigned char)(ml)->font[x] & 0xe0) == 0 \ @@ -161,15 +150,4 @@ enum move_t { (unsigned char)(ml)->font[x] == 0xff && (unsigned char)(ml)->image[x] == 0xff : \ ((unsigned char)(ml)->font[x] & 0xe0) == 0x80 \ ) -# else -# define dw_left(ml, x, enc) ( \ - ((unsigned char)(ml)->font[x] & 0x1f) != 0 && ((unsigned char)(ml)->font[x] & 0xe0) == 0 \ - ) -# define dw_right(ml, x, enc) ( \ - ((unsigned char)(ml)->font[x] & 0xe0) == 0x80 \ - ) -# endif /* UTF8 */ -#else -# define dw_left(ml, x, enc) 0 -# define dw_right(ml, x, enc) 0 -#endif + diff --git a/src/attacher.c b/src/attacher.c index e2e3ccb..8e980d9 100644 --- a/src/attacher.c +++ b/src/attacher.c @@ -42,12 +42,10 @@ static sigret_t AttacherSigInt SIGPROTOARG; #if defined(SIGWINCH) && defined(TIOCGWINSZ) static sigret_t AttacherWinch SIGPROTOARG; #endif -#ifdef LOCK static sigret_t DoLock SIGPROTOARG; static void LockTerminal (void); static sigret_t LockHup SIGPROTOARG; static void screen_builtin_lck (void); -#endif #ifdef DEBUG static sigret_t AttacherChld SIGPROTOARG; #endif @@ -63,14 +61,12 @@ 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; @@ -141,7 +137,6 @@ Attach(int how) 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) { @@ -169,11 +164,9 @@ Attach(int how) tty_oldmode = -1; } ret = UserStatus(); -#ifdef LOCK if (ret == SIG_LOCK) LockTerminal(); else -#endif #ifdef SIGTSTP if (ret == SIG_STOP) kill(getpid(), SIGTSTP); @@ -191,9 +184,7 @@ Attach(int how) else exit(ret); dflag = 0; -#ifdef MULTI xflag = 1; -#endif how = MSG_ATTACH; continue; } @@ -218,7 +209,6 @@ Attach(int how) tty_oldmode = tty_mode; } # endif /* USE_SETEUID */ -#endif /* MULTIUSER */ bzero((char *) &m, sizeof(m)); m.type = how; @@ -283,14 +273,12 @@ Attach(int how) * 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) +#if defined(USE_SETEUID) else { /* This call to xsetuid should also set the saved uid */ @@ -329,18 +317,15 @@ Attach(int how) */ 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 */ @@ -359,7 +344,6 @@ Attach(int how) 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; @@ -380,29 +364,22 @@ Attach(int how) 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) @@ -420,7 +397,6 @@ Attach(int how) xseteuid(real_uid); # endif } -#endif rflag = 0; return 1; } @@ -491,44 +467,35 @@ AttacherFinit SIGDEFARG 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 !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 @@ -557,7 +524,6 @@ SigStop SIGDEFARG SIGRETURN; } -#ifdef LOCK static int LockPlease; static sigret_t @@ -570,7 +536,6 @@ DoLock SIGDEFARG LockPlease = 1; SIGRETURN; } -#endif #if defined(SIGWINCH) && defined(TIOCGWINSZ) static int SigWinchPlease; @@ -594,15 +559,11 @@ 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); @@ -615,9 +576,7 @@ Attacher() #endif debug("attacher: going for a nap.\n"); dflag = 0; -#ifdef MULTI xflag = 1; -#endif for (;;) { signal(SIGALRM, AttacherSigAlarm); @@ -640,7 +599,7 @@ Attacher() if (SuspendPlease) { SuspendPlease = 0; -#if defined(MULTIUSER) && !defined(USE_SETEUID) +#if !defined(USE_SETEUID) if (multiattach) exit(SIG_STOP); #endif @@ -652,11 +611,10 @@ Attacher() (void) Attach(MSG_CONT); } #endif -#ifdef LOCK if (LockPlease) { LockPlease = 0; -#if defined(MULTIUSER) && !defined(USE_SETEUID) +#if !defined(USE_SETEUID) if (multiattach) exit(SIG_LOCK); #endif @@ -666,7 +624,6 @@ Attacher() # endif (void) Attach(MSG_CONT); } -#endif /* LOCK */ #if defined(SIGWINCH) && defined(TIOCGWINSZ) if (SigWinchPlease) { @@ -680,7 +637,6 @@ Attacher() } } -#ifdef LOCK /* ADDED by Rainer Pruy 10/15/87 */ /* POLISHED by mls. 03/10/91 */ @@ -693,13 +649,8 @@ 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); @@ -727,13 +678,8 @@ LockTerminal() /* 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); @@ -976,7 +922,6 @@ screen_builtin_lck() debug("password ok.\n"); } -#endif /* LOCK */ void diff --git a/src/canvas.c b/src/canvas.c index c696f80..6c851dc 100644 --- a/src/canvas.c +++ b/src/canvas.c @@ -251,9 +251,7 @@ SetCanvasWindow(struct canvas *cv, struct win *win) if (p && cv == D_forecv) { -#ifdef MULTIUSER ReleaseAutoWritelock(display, p); -#endif if (p->w_silence) { SetTimeout(&p->w_silenceev, p->w_silencewait * 1000); @@ -313,9 +311,7 @@ SetCanvasWindow(struct canvas *cv, struct win *win) fore = D_fore; /* XXX ? */ if (win) { -#ifdef MULTIUSER ObtainAutoWritelock(display, win); -#endif /* * Place the window at the head of the most-recently-used list */ @@ -38,90 +38,58 @@ struct comm comms[RC_LAST + 1] = { -#ifdef MULTIUSER { "acladd", ARGS_1234 }, { "aclchg", ARGS_23 }, { "acldel", ARGS_1 }, { "aclgrp", ARGS_12 }, { "aclumask", ARGS_1|ARGS_ORMORE }, -#endif { "activity", ARGS_1 }, -#ifdef MULTIUSER { "addacl", ARGS_1234 }, -#endif { "allpartial", NEED_DISPLAY|ARGS_1 }, { "altscreen", ARGS_01 }, { "at", ARGS_2|ARGS_ORMORE }, -#ifdef COLOR { "attrcolor", ARGS_12 }, -#endif { "autodetach", ARGS_1 }, -#ifdef AUTO_NUKE { "autonuke", NEED_DISPLAY|ARGS_1 }, -#endif { "backtick", ARGS_1|ARGS_ORMORE }, -#ifdef COLOR { "bce", NEED_FORE|ARGS_01 }, -#endif { "bell", ARGS_01 }, { "bell_msg", ARGS_01 }, { "bind", ARGS_1|ARGS_ORMORE }, -#ifdef MAPKEYS { "bindkey", ARGS_0|ARGS_ORMORE }, -#endif { "blanker", NEED_DISPLAY|ARGS_0}, -#ifdef BLANKER_PRG { "blankerprg", ARGS_0|ARGS_ORMORE }, -#endif { "break", NEED_FORE|ARGS_01 }, { "breaktype", NEED_FORE|ARGS_01 }, -#ifdef COPY_PASTE { "bufferfile", ARGS_01 }, -#endif { "bumpleft", ARGS_0 }, { "bumpright", ARGS_0 }, { "c1", NEED_FORE|ARGS_01 }, { "caption", ARGS_12 }, -#ifdef MULTIUSER { "chacl", ARGS_23 }, -#endif { "charset", NEED_FORE|ARGS_1 }, { "chdir", ARGS_01 }, -#ifdef DW_CHARS { "cjkwidth", ARGS_01 }, -#endif { "clear", NEED_FORE|ARGS_0 }, { "collapse", ARGS_0 }, { "colon", NEED_LAYER|ARGS_01 }, { "command", NEED_DISPLAY|ARGS_02 }, -#ifdef COPY_PASTE { "compacthist", ARGS_01 }, -#endif { "console", NEED_FORE|ARGS_01 }, -#ifdef COPY_PASTE { "copy", NEED_FORE|NEED_DISPLAY|ARGS_0 }, { "crlf", ARGS_01 }, -#endif { "debug", ARGS_01 }, -#ifdef AUTO_NUKE { "defautonuke", ARGS_1 }, -#endif -#ifdef COLOR { "defbce", ARGS_1 }, -#endif { "defbreaktype", ARGS_01 }, { "defc1", ARGS_1 }, { "defcharset", ARGS_01 }, -#ifdef ENCODINGS { "defencoding", ARGS_1 }, -#endif { "defescape", ARGS_1 }, { "defflow", ARGS_12 }, { "defgr", ARGS_1 }, { "defhstatus", ARGS_01 }, -#ifdef ENCODINGS { "defkanji", ARGS_1 }, -#endif { "deflog", ARGS_1 }, #if defined(UTMPOK) && defined(LOGOUTOK) { "deflogin", ARGS_1 }, @@ -129,37 +97,25 @@ struct comm comms[RC_LAST + 1] = { "defmode", ARGS_1 }, { "defmonitor", ARGS_1 }, { "defmousetrack", ARGS_1 }, -#ifdef MULTI { "defnonblock", ARGS_1 }, -#endif { "defobuflimit", ARGS_1 }, -#ifdef COPY_PASTE { "defscrollback", ARGS_1 }, -#endif { "defshell", ARGS_1 }, { "defsilence", ARGS_1 }, { "defslowpaste", ARGS_1 }, -#ifdef UTF8 { "defutf8", ARGS_1 }, -#endif { "defwrap", ARGS_1 }, { "defwritelock", ARGS_1 }, -#ifdef DETACH { "detach", NEED_DISPLAY|ARGS_01 }, -#endif { "digraph", NEED_LAYER|ARGS_012 }, { "dinfo", NEED_DISPLAY|ARGS_0 }, { "displays", NEED_LAYER|ARGS_0 }, { "dumptermcap", NEED_FORE|ARGS_0 }, { "echo", CAN_QUERY|ARGS_12 }, -#ifdef ENCODINGS { "encoding", ARGS_12 }, -#endif { "escape", ARGS_1 }, { "eval", ARGS_1|ARGS_ORMORE }, -#ifdef PSEUDOS { "exec", ARGS_0|ARGS_ORMORE }, -#endif { "fit", NEED_DISPLAY|ARGS_0 }, { "flow", NEED_FORE|ARGS_01 }, { "focus", NEED_DISPLAY|ARGS_01 }, @@ -172,89 +128,63 @@ struct comm comms[RC_LAST + 1] = { "hardstatus", ARGS_012 }, { "height", ARGS_0123 }, { "help", NEED_LAYER|ARGS_02 }, -#ifdef COPY_PASTE { "history", NEED_DISPLAY|NEED_FORE|ARGS_0 }, -#endif { "hstatus", NEED_FORE|ARGS_1 }, { "idle", ARGS_0|ARGS_ORMORE }, { "ignorecase", ARGS_01 }, { "info", CAN_QUERY|NEED_LAYER|ARGS_0 }, -#ifdef ENCODINGS { "kanji", NEED_FORE|ARGS_12 }, -#endif { "kill", NEED_FORE|ARGS_0 }, { "lastmsg", CAN_QUERY|NEED_DISPLAY|ARGS_0 }, { "layout", ARGS_1|ARGS_ORMORE}, { "license", NEED_LAYER|ARGS_0 }, -#ifdef LOCK { "lockscreen", NEED_DISPLAY|ARGS_0 }, -#endif { "log", NEED_FORE|ARGS_01 }, { "logfile", ARGS_012 }, #if defined(UTMPOK) && defined(LOGOUTOK) { "login", NEED_FORE|ARGS_01 }, #endif { "logtstamp", ARGS_012 }, -#ifdef MAPKEYS { "mapdefault", NEED_DISPLAY|ARGS_0 }, { "mapnotnext", NEED_DISPLAY|ARGS_0 }, { "maptimeout", ARGS_01 }, -#endif -#ifdef COPY_PASTE { "markkeys", ARGS_1 }, -#endif { "maxwin", ARGS_01 }, { "meta", NEED_LAYER|ARGS_0 }, { "monitor", NEED_FORE|ARGS_01 }, { "mousetrack", NEED_DISPLAY | ARGS_01 }, { "msgminwait", ARGS_1 }, { "msgwait", ARGS_1 }, -#ifdef MULTIUSER { "multiuser", ARGS_1 }, -#endif { "nethack", ARGS_1 }, { "next", ARGS_0 }, -#ifdef MULTI { "nonblock", NEED_DISPLAY|ARGS_01 }, -#endif { "number", CAN_QUERY|NEED_FORE|ARGS_01 }, { "obuflimit", NEED_DISPLAY|ARGS_01 }, { "only", NEED_DISPLAY|ARGS_0 }, { "other", ARGS_0 }, { "partial", NEED_FORE|ARGS_01 }, -#ifdef PASSWORD { "password", ARGS_01 }, -#endif -#ifdef COPY_PASTE { "paste", NEED_LAYER|ARGS_012 }, { "pastefont", ARGS_01 }, -#endif { "pow_break", NEED_FORE|ARGS_01 }, -#if defined(DETACH) && defined(POW_DETACH) { "pow_detach", NEED_DISPLAY|ARGS_0 }, { "pow_detach_msg", ARGS_01 }, -#endif { "prev", ARGS_0 }, { "printcmd", ARGS_01 }, { "process", NEED_DISPLAY|ARGS_01 }, { "quit", ARGS_0 }, -#ifdef COPY_PASTE { "readbuf", ARGS_0123 }, -#endif { "readreg", ARGS_0|ARGS_ORMORE }, { "redisplay", NEED_DISPLAY|ARGS_0 }, { "register", ARGS_24 }, { "remove", NEED_DISPLAY|ARGS_0 }, -#ifdef COPY_PASTE { "removebuf", ARGS_0 }, -#endif { "rendition", ARGS_23 }, { "reset", NEED_FORE|ARGS_0 }, { "resize", NEED_DISPLAY|ARGS_0|ARGS_ORMORE }, { "screen", ARGS_0|ARGS_ORMORE }, -#ifdef COPY_PASTE { "scrollback", NEED_FORE|ARGS_1 }, -#endif { "select", CAN_QUERY|ARGS_01 }, { "sessionname", ARGS_01 }, { "setenv", ARGS_012 }, @@ -270,9 +200,7 @@ struct comm comms[RC_LAST + 1] = { "split", NEED_DISPLAY|ARGS_01 }, { "startup_message", ARGS_1 }, { "stuff", NEED_LAYER|ARGS_012 }, -#ifdef MULTIUSER { "su", NEED_DISPLAY|ARGS_012 }, -#endif #ifdef BSDJOBS { "suspend", NEED_DISPLAY|ARGS_0 }, #endif @@ -285,9 +213,7 @@ struct comm comms[RC_LAST + 1] = { "umask", ARGS_1|ARGS_ORMORE }, { "unbindall", ARGS_0 }, { "unsetenv", ARGS_1 }, -#ifdef UTF8 { "utf8", NEED_FORE|ARGS_012 }, -#endif { "vbell", ARGS_01 }, { "vbell_msg", ARGS_01 }, { "vbellwait", ARGS_1 }, @@ -298,14 +224,10 @@ struct comm comms[RC_LAST + 1] = { "windowlist", ARGS_012 }, { "windows", CAN_QUERY|ARGS_0 }, { "wrap", NEED_FORE|ARGS_01 }, -#ifdef COPY_PASTE { "writebuf", ARGS_0123 }, -#endif { "writelock", NEED_FORE|ARGS_01 }, { "xoff", NEED_LAYER|ARGS_0 }, { "xon", NEED_LAYER|ARGS_0 }, -#ifdef ZMODEM { "zmodem", ARGS_012 }, -#endif { "zombie", ARGS_012 } }; diff --git a/src/comm.sh b/src/comm.sh index ad2210c..d1d9a99 100644 --- a/src/comm.sh +++ b/src/comm.sh @@ -23,9 +23,7 @@ struct comm { char *name; int flags; -#ifdef MULTIUSER AclBits userbits[ACL_BITS_PER_CMD]; -#endif }; #define ARGS_MASK (3) diff --git a/src/configure.in b/src/configure.in index 87fd43b..9b02f0c 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1279,14 +1279,6 @@ AC_ARG_ENABLE(telnet, [ --enable-telnet enable builtin telnet]) if test "$enable_telnet" = "yes"; then AC_DEFINE(BUILTIN_TELNET) fi -AC_ARG_ENABLE(colors256, [ --enable-colors256 enable support for 256 colors]) -if test "$enable_colors256" = "yes"; then - AC_DEFINE(COLORS256) -fi -AC_ARG_ENABLE(rxvt_osc, [ --enable-rxvt_osc enable support for rxvt OSC codes]) -if test "$enable_rxvt_osc" = "yes"; then - AC_DEFINE(RXVT_OSC) -fi dnl dnl **** the end **** diff --git a/src/display.c b/src/display.c index fdc55b0..701fde4 100644 --- a/src/display.c +++ b/src/display.c @@ -50,19 +50,13 @@ static void disp_writeev_eagain (struct event *, char *); static void disp_status_fn (struct event *, char *); static void disp_hstatus_fn (struct event *, char *); static void disp_blocked_fn (struct event *, char *); -#ifdef MAPKEYS static void disp_map_fn (struct event *, char *); -#endif static void disp_idle_fn (struct event *, char *); -#ifdef BLANKER_PRG static void disp_blanker_fn (struct event *, char *); -#endif static void WriteLP (int, int); static void INSERTCHAR (int); static void RAW_PUTCHAR (int); -#ifdef COLOR static void SetBackColor (int); -#endif static void RemoveStatusMinWait (void); @@ -86,14 +80,12 @@ extern char *captionstring; extern int pastefont; extern int idletimo; -#ifdef BLANKER_PRG extern int pty_preopen; #if defined(TIOCSWINSZ) || defined(TIOCGWINSZ) extern struct winsize glwz; #endif extern char **NewEnv; extern int real_uid, real_gid; -#endif /* * tputs needs this to calculate the padding @@ -105,14 +97,8 @@ short ospeed; struct display *display, *displays; -#ifdef COLOR int attr2color[8][4]; int nattr2color; -#endif - -#ifndef MULTI -struct display TheDisplay; -#endif /* * The default values @@ -120,9 +106,7 @@ struct display TheDisplay; int defobuflimit = OBUF_MAX; int defnonblock = -1; int defmousetrack = 0; -#ifdef AUTO_NUKE int defautonuke = 0; -#endif int captionalways; int hardstatusemu = HSTATUS_IGNORE; @@ -220,15 +204,8 @@ MakeDisplay(char *uname, char *utty, char *term, int fd, int pid, struct mode *M if (!*(u = FindUserPtr(uname)) && UserAdd(uname, (char *)0, u)) return 0; /* could not find or add user */ -#ifdef MULTI if ((display = (struct display *)calloc(1, sizeof(*display))) == 0) return 0; -#else - if (displays) - return 0; - bzero((char *)&TheDisplay, sizeof(TheDisplay)); - display = &TheDisplay; -#endif display->d_next = displays; displays = display; D_flow = 1; @@ -256,28 +233,22 @@ MakeDisplay(char *uname, char *utty, char *term, int fd, int pid, struct mode *M D_blockedev.condpos = &D_obuffree; D_blockedev.condneg = &D_obuflenmax; D_hstatusev.handler = disp_hstatus_fn; -#ifdef MAPKEYS D_mapev.type = EV_TIMEOUT; D_mapev.data = (char *)display; D_mapev.handler = disp_map_fn; -#endif D_idleev.type = EV_TIMEOUT; D_idleev.data = (char *)display; D_idleev.handler = disp_idle_fn; -#ifdef BLANKER_PRG D_blankerev.type = EV_READ; D_blankerev.data = (char *)display; D_blankerev.handler = disp_blanker_fn; D_blankerev.fd = -1; -#endif D_OldMode = *Mode; D_status_obuffree = -1; Resize_obuf(); /* Allocate memory for buffer */ D_obufmax = defobuflimit; D_obuflenmax = D_obuflen - D_obufmax; -#ifdef AUTO_NUKE D_auto_nuke = defautonuke; -#endif D_obufp = D_obuf; D_printfd = -1; D_userpid = pid; @@ -310,16 +281,10 @@ void FreeDisplay() { struct win *p; -#ifdef MULTI struct display *d, **dp; -#endif -#ifdef FONT FreeTransTable(); -#endif -#ifdef BLANKER_PRG KillBlanker(); -#endif if (D_userfd >= 0) { Flush(3); @@ -341,7 +306,6 @@ FreeDisplay() evdeq(&D_readev); evdeq(&D_writeev); evdeq(&D_blockedev); -#ifdef MAPKEYS evdeq(&D_mapev); if (D_kmaps) { @@ -353,13 +317,9 @@ FreeDisplay() D_seql = 0; D_seqh = 0; } -#endif evdeq(&D_idleev); -#ifdef BLANKER_PRG evdeq(&D_blankerev); -#endif -#ifdef MULTI for (dp = &displays; (d = *dp) ; dp = &d->d_next) if (d == display) break; @@ -369,11 +329,6 @@ FreeDisplay() if (D_obuf) free(D_obuf); *dp = display->d_next; -#else /* MULTI */ - ASSERT(display == displays); - ASSERT(display == &TheDisplay); - displays = 0; -#endif /* MULTI */ while (D_canvas.c_slperp) FreeCanvas(D_canvas.c_slperp); @@ -388,19 +343,15 @@ FreeDisplay() if (p->w_readev.condneg == &D_status || p->w_readev.condneg == &D_obuflenmax) p->w_readev.condpos = p->w_readev.condneg = 0; } -#ifdef ZMODEM for (p = windows; p; p = p->w_next) if (p->w_zdisplay == display) zmodem_abort(p, 0); -#endif if (D_mousetrack) { D_mousetrack = 0; MouseMode(0); } -#ifdef MULTI free((char *)display); -#endif display = 0; } @@ -420,16 +371,8 @@ InitTerm(int adapt) if (D_IM && strcmp(D_IM, D_EI)) AddCStr(D_EI); D_insert = 0; -#ifdef MAPKEYS AddCStr(D_KS); AddCStr(D_CCS); -#else - /* Check for toggle */ - if (D_KS && strcmp(D_KS, D_KE)) - AddCStr(D_KE); - if (D_CCS && strcmp(D_CCS, D_CCE)) - AddCStr(D_CCE); -#endif D_keypad = 0; D_cursorkeys = 0; AddCStr(D_ME); @@ -453,9 +396,7 @@ void FinitTerm() { ASSERT(display); -#ifdef BLANKER_PRG KillBlanker(); -#endif if (D_tcinited) { ResizeDisplay(D_defwidth, D_defheight); @@ -469,15 +410,11 @@ FinitTerm() MouseMode(0); SetRendition(&mchar_null); SetFlow(FLOW_NOW); -#ifdef MAPKEYS AddCStr(D_KE); AddCStr(D_CCE); -#endif if (D_hstatus) ShowHStatus((char *)0); -#ifdef RXVT_OSC ClearAllXtermOSC(); -#endif D_x = D_y = -1; GotoPos(0, D_height - 1); AddChar('\r'); @@ -544,7 +481,6 @@ PUTCHARLP(int c) D_lp_missing = 1; D_rend.image = c; D_lpchar = D_rend; -#ifdef DW_CHARS /* XXX -> PutChar ? */ if (D_mbcs) { @@ -553,7 +489,6 @@ PUTCHARLP(int c) D_mbcs = 0; D_x--; } -#endif } /* @@ -566,12 +501,9 @@ RAW_PUTCHAR(int c) { ASSERT(display); -#ifdef FONT -# ifdef UTF8 if (D_encoding == UTF8) { c = (c & 255) | (unsigned char)D_rend.font << 8 | (unsigned char)D_rend.fontx << 16; -# ifdef DW_CHARS if (D_mbcs) { c = D_mbcs; @@ -585,7 +517,6 @@ RAW_PUTCHAR(int c) D_x++; return; } -# endif if (c < 32) { AddCStr2(D_CS0, '0'); @@ -604,8 +535,6 @@ RAW_PUTCHAR(int c) AddUtf8(c); goto addedutf8; } -# endif -# ifdef DW_CHARS if (is_dw_font(D_rend.font)) { int t = c; @@ -621,25 +550,15 @@ RAW_PUTCHAR(int c) c = D_mbcs; D_mbcs = t; } -# endif -# if defined(ENCODINGS) && defined(DW_CHARS) if (D_encoding) c = PrepareEncodedChar(c); -# endif -# ifdef DW_CHARS kanjiloop: -# endif if (D_xtable && D_xtable[(int)(unsigned char)D_rend.font] && D_xtable[(int)(unsigned char)D_rend.font][(int)(unsigned char)c]) AddStr(D_xtable[(int)(unsigned char)D_rend.font][(int)(unsigned char)c]); else AddChar(D_rend.font != '0' ? c : D_c0_tab[(int)(unsigned char)c]); -#else /* FONT */ - AddChar(c); -#endif /* FONT */ -#ifdef UTF8 addedutf8: -#endif if (++D_x >= D_width) { if (D_AM == 0) @@ -651,14 +570,12 @@ addedutf8: D_y++; } } -#ifdef DW_CHARS if (D_mbcs) { c = D_mbcs; D_mbcs = 0; goto kanjiloop; } -#endif } static int @@ -710,37 +627,15 @@ InsertMode(int on) void KeypadMode(int on) { -#ifdef MAPKEYS if (display) D_keypad = on; -#else - if (display && D_keypad != on && D_KS) - { - D_keypad = on; - if (on) - AddCStr(D_KS); - else - AddCStr(D_KE); - } -#endif } void CursorkeysMode(int on) { -#ifdef MAPKEYS if (display) D_cursorkeys = on; -#else - if (display && D_cursorkeys != on && D_CCS) - { - D_cursorkeys = on; - if (on) - AddCStr(D_CCS); - else - AddCStr(D_CCE); - } -#endif } void @@ -872,10 +767,8 @@ CallRewrite(int y, int xs, int xe, int doit) return EXPENSIVE; /* line not on layer */ if (xs - vp->v_xoff < 0 || xe - vp->v_xoff >= cv->c_layer->l_width) return EXPENSIVE; /* line not on layer */ -#ifdef UTF8 if (D_encoding == UTF8) D_rend.font = 0; -#endif oldflayer = flayer; flayer = cv->c_layer; debug3("Calling Rewrite %d %d %d\n", y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff); @@ -1114,10 +1007,8 @@ ClearArea(int x1, int y1, int xs, int xe, int x2, int y2, int bce, int uselayfn) xe = x2; if (D_UT) /* Safe to erase ? */ SetRendition(&mchar_null); -#ifdef COLOR if (D_BE) SetBackColor(bce); -#endif if (D_lp_missing && y1 <= D_bot && xe >= D_width - 1) { if (y2 > D_bot || (y2 == D_bot && x2 >= D_width - 1)) @@ -1125,10 +1016,8 @@ ClearArea(int x1, int y1, int xs, int xe, int x2, int y2, int bce, int uselayfn) } if (x2 == D_width - 1 && (xs == 0 || y1 == y2) && xe == D_width - 1 && y2 == D_height - 1 && (!bce || D_BE)) { -#ifdef AUTO_NUKE if (x1 == 0 && y1 == 0 && D_auto_nuke) NukePending(); -#endif if (x1 == 0 && y1 == 0 && D_CL) { AddCStr(D_CL); @@ -1225,9 +1114,7 @@ Redisplay(int cur_only) SetFlow(FLOW_NOW); ClearAll(); -#ifdef RXVT_OSC RefreshXtermOSC(); -#endif if (cur_only > 0 && D_fore) RefreshArea(0, D_fore->w_y, D_width - 1, D_fore->w_y, 1); else @@ -1263,10 +1150,8 @@ ScrollH(int y, int xs, int xe, int n, int bce, struct mline *oml) GotoPos(xs, y); if (D_UT) SetRendition(&mchar_null); -#ifdef COLOR if (D_BE) SetBackColor(bce); -#endif if (n > 0) { if (n >= xe - xs + 1) @@ -1302,9 +1187,7 @@ ScrollH(int y, int xs, int xe, int n, int bce, struct mline *oml) { InsertMode(1); SetRendition(&mchar_null); -#ifdef COLOR SetBackColor(bce); -#endif for (i = -n; i--; ) INSERTCHAR(' '); bce = 0; /* all done */ @@ -1319,9 +1202,7 @@ ScrollH(int y, int xs, int xe, int n, int bce, struct mline *oml) else { SetRendition(&mchar_null); -#ifdef COLOR SetBackColor(bce); -#endif for (i = -n; i--; ) INSERTCHAR(' '); bce = 0; /* all done */ @@ -1416,10 +1297,8 @@ ScrollV(int xs, int ys, int xe, int ye, int n, int bce) if (D_UT) SetRendition(&mchar_null); -#ifdef COLOR if (D_BE) SetBackColor(bce); -#endif aldlfaster = (n > 1 && ys >= D_top && ye == D_bot && ((up && D_CDL) || (!up && D_CAL))); @@ -1487,12 +1366,10 @@ SetAttr(register int new) if (!display || (old = D_rend.attr) == new) return; -#ifdef COLORS16 D_col16change = (old ^ new) & (A_BFG | A_BBG); new ^= D_col16change; if (old == new) return; -#endif #if defined(TERMINFO) && defined(USE_SGR) if (D_SA) { @@ -1504,10 +1381,8 @@ SetAttr(register int new) 0), 1, DoAddChar); D_rend.attr = new; D_atyp = 0; -# ifdef COLOR if (D_hascolor) rend_setdefault(&D_rend); -# endif return; } #endif @@ -1522,21 +1397,15 @@ SetAttr(register int new) if ((typ & ATYP_M)) { AddCStr(D_ME); -#ifdef COLOR /* ansi attrib handling: \E[m resets color, too */ if (D_hascolor) rend_setdefault(&D_rend); -#endif -#ifdef FONT if (!D_CG0) { /* D_ME may also reset the alternate charset */ D_rend.font = 0; -# ifdef ENCODINGS D_realfont = 0; -# endif } -#endif } old = 0; typ = 0; @@ -1556,7 +1425,6 @@ SetAttr(register int new) D_atyp = typ; } -#ifdef FONT void SetFont(int new) { @@ -1564,13 +1432,11 @@ SetFont(int new) if (!display || old == new) return; D_rend.font = new; -#ifdef ENCODINGS if (D_encoding && CanEncodeFont(D_encoding, new)) return; if (new == D_realfont) return; D_realfont = new; -#endif if (D_xtable && D_xtable[(int)(unsigned char)new] && D_xtable[(int)(unsigned char)new][256]) { @@ -1587,7 +1453,6 @@ SetFont(int new) if (new == ASCII) AddCStr(D_CE0); -#ifdef DW_CHARS else if (new < ' ') { AddStr("\033$"); @@ -1595,13 +1460,10 @@ SetFont(int new) AddChar('('); AddChar(new + '@'); } -#endif else AddCStr2(D_CS0, new); } -#endif -#ifdef COLOR int color256to16(int jj) @@ -1631,7 +1493,6 @@ min) / (max - min) | (max > 3 ? 8 : 0); return jj; } -#ifdef COLORS256 int color256to88(int jj) { @@ -1649,7 +1510,6 @@ color256to88(int jj) } return jj; } -#endif void SetColor(int f, int b) @@ -1663,13 +1523,11 @@ SetColor(int f, int b) of = rend_getfg(&D_rend); ob = rend_getbg(&D_rend); -#ifdef COLORS16 /* intense default not invented yet */ if (f == 0x100) f = 0; if (b == 0x100) b = 0; -#endif debug2("SetColor %d %d", coli2e(of), coli2e(ob)); debug2(" -> %d %d\n", coli2e(f), coli2e(b)); debug2("(%d %d", of, ob); @@ -1684,16 +1542,12 @@ SetColor(int f, int b) int oattr; oattr = D_rend.attr; AddCStr(D_ME ? D_ME : "\033[m"); -#ifdef FONT if (D_ME && !D_CG0) { /* D_ME may also reset the alternate charset */ D_rend.font = 0; -# ifdef ENCODINGS D_realfont = 0; -# endif } -#endif D_atyp = 0; D_rend.attr = 0; SetAttr(oattr); @@ -1702,16 +1556,13 @@ SetColor(int f, int b) } rend_setfg(&D_rend, f); rend_setbg(&D_rend, b); -#ifdef COLORS16 D_col16change = 0; -#endif if (!D_hascolor) return; f = f ? coli2e(f) : -1; b = b ? coli2e(b) : -1; of = of ? coli2e(of) : -1; ob = ob ? coli2e(ob) : -1; -#ifdef COLORS256 if (f != of && f > 15 && D_CCO != 256) f = D_CCO == 88 && D_CAF ? color256to88(f) : color256to16(f); if (f != of && f > 15 && D_CAF) @@ -1726,7 +1577,6 @@ SetColor(int f, int b) AddCStr2(D_CAB, b); ob = b; } -#endif if (f != of && f != (of | 8)) { if (f == -1) @@ -1745,7 +1595,6 @@ SetColor(int f, int b) else if (D_CSB) AddCStr2(D_CSB, sftrans[b & 7]); } -#ifdef COLORS16 if (f != of && D_CXT && (f & 8) != 0 && f != -1) { # ifdef TERMINFO @@ -1762,7 +1611,6 @@ SetColor(int f, int b) AddCStr2("\033[10%dm", b & 7); # endif } -#endif } static void @@ -1772,14 +1620,12 @@ SetBackColor(int new) return; SetColor(rend_getfg(&D_rend), new); } -#endif /* COLOR */ void SetRendition(struct mchar *mc) { if (!display) return; -#ifdef COLOR if (nattr2color && D_hascolor && (mc->attr & nattr2color) != 0) { static struct mchar mmc; @@ -1800,7 +1646,6 @@ SetRendition(struct mchar *mc) mc = &mmc; debug2("SetRendition: mapped to %02x %02x\n", (unsigned char)mc->attr, 0x99 - (unsigned char)mc->color); } -# ifdef COLORS16 if (D_hascolor && D_CC8 && (mc->attr & (A_BFG|A_BBG))) { int a = mc->attr; @@ -1812,30 +1657,18 @@ SetRendition(struct mchar *mc) SetAttr(a); } else -# endif /* COLORS16 */ -#endif /* COLOR */ if (D_rend.attr != mc->attr) SetAttr(mc->attr); -#ifdef COLOR if (D_rend.color != mc->color -# ifdef COLORS256 || D_rend.colorx != mc->colorx -# endif -# ifdef COLORS16 || D_col16change -# endif ) SetColor(rend_getfg(mc), rend_getbg(mc)); -#endif -#ifdef FONT if (D_rend.font != mc->font) SetFont(mc->font); -#ifdef UTF8 if (D_encoding == UTF8) D_rend.fontx = mc->fontx; -#endif -#endif } void @@ -1843,7 +1676,6 @@ SetRenditionMline(struct mline *ml, int x) { if (!display) return; -#ifdef COLOR if (nattr2color && D_hascolor && (ml->attr[x] & nattr2color) != 0) { struct mchar mc; @@ -1851,7 +1683,6 @@ SetRenditionMline(struct mline *ml, int x) SetRendition(&mc); return; } -# ifdef COLORS16 if (D_hascolor && D_CC8 && (ml->attr[x] & (A_BFG|A_BBG))) { int a = ml->attr[x]; @@ -1863,33 +1694,21 @@ SetRenditionMline(struct mline *ml, int x) SetAttr(a); } else -# endif /* COLORS16 */ -#endif /* COLOR */ if (D_rend.attr != ml->attr[x]) SetAttr(ml->attr[x]); -#ifdef COLOR if (D_rend.color != ml->color[x] -# ifdef COLORS256 || D_rend.colorx != ml->colorx[x] -# endif -# ifdef COLORS16 || D_col16change -# endif ) { struct mchar mc; copy_mline2mchar(&mc, ml, x); SetColor(rend_getfg(&mc), rend_getbg(&mc)); } -#endif -#ifdef FONT if (D_rend.font != ml->font[x]) SetFont(ml->font[x]); -#ifdef UTF8 if (D_encoding == UTF8) D_rend.fontx = ml->fontx[x]; -#endif -#endif } void @@ -2071,7 +1890,6 @@ RemoveStatusMinWait() RemoveStatus(); } -#ifdef UTF8 static int strlen_onscreen(unsigned char *c, unsigned char *end) { @@ -2120,16 +1938,6 @@ PrePutWinMsg(char *s, int start, int max) return max; } } -#else -static int -PrePutWinMsg(char *s, int start, int max) -char *s; -int start, max; -{ - PutWinMsg(s, start, max); - return max; -} -#endif /* refresh the display's hstatus line */ void @@ -2442,7 +2250,6 @@ WriteLP(int x2, int y2) ASSERT(D_lp_missing); oldrend = D_rend; debug2("WriteLP(%d,%d)\n", x2, y2); -#ifdef DW_CHARS if (D_lpchar.mbcs) { if (x2 > 0) @@ -2450,15 +2257,12 @@ WriteLP(int x2, int y2) else D_lpchar = mchar_blank; } -#endif /* Can't use PutChar */ GotoPos(x2, y2); SetRendition(&D_lpchar); PUTCHAR(D_lpchar.image); -#ifdef DW_CHARS if (D_lpchar.mbcs) PUTCHAR(D_lpchar.mbcs); -#endif D_lp_missing = 0; SetRendition(&oldrend); } @@ -2467,17 +2271,13 @@ void ClearLine(struct mline *oml, int y, int from, int to, int bce) { int x; -#ifdef COLOR struct mchar bcechar; -#endif debug3("ClearLine %d,%d-%d\n", y, from, to); if (D_UT) /* Safe to erase ? */ SetRendition(&mchar_null); -#ifdef COLOR if (D_BE) SetBackColor(bce); -#endif if (from == 0 && D_CB && (to != D_width - 1 || (D_x == to && D_y == y)) && (!bce || D_BE)) { GotoPos(to, y); @@ -2492,7 +2292,6 @@ ClearLine(struct mline *oml, int y, int from, int to, int bce) } if (oml == 0) oml = &mline_null; -#ifdef COLOR if (!bce) { DisplayLine(oml, &mline_blank, y, from, to); @@ -2503,9 +2302,6 @@ ClearLine(struct mline *oml, int y, int from, int to, int bce) for (x = from; x <= to; x++) copy_mchar2mline(&bcechar, &mline_old, x); DisplayLine(oml, &mline_old, y, from, to); -#else - DisplayLine(oml, &mline_blank, y, from, to); -#endif } void @@ -2522,11 +2318,7 @@ DisplayLine(struct mline *oml, struct mline *ml, int y, int from, int to) { if (D_lp_missing || !cmp_mline(oml, ml, to)) { -#ifdef DW_CHARS if ((D_IC || D_IM) && from < to && !dw_left(ml, to, D_encoding)) -#else - if ((D_IC || D_IM) && from < to) -#endif { last2flag = 1; D_lp_missing = 0; @@ -2541,7 +2333,6 @@ DisplayLine(struct mline *oml, struct mline *ml, int y, int from, int to) } to--; } -#ifdef DW_CHARS if (D_mbcs) { /* finish dw-char (can happen after a wrap) */ @@ -2550,7 +2341,6 @@ DisplayLine(struct mline *oml, struct mline *ml, int y, int from, int to) PUTCHAR(ml->image[from]); from++; } -#endif for (x = from; x <= to; x++) { { @@ -2559,7 +2349,6 @@ DisplayLine(struct mline *oml, struct mline *ml, int y, int from, int to) continue; GotoPos(x, y); } -#ifdef DW_CHARS if (dw_right(ml, x, D_encoding)) { x--; @@ -2568,13 +2357,10 @@ DisplayLine(struct mline *oml, struct mline *ml, int y, int from, int to) } if (x == to && dw_left(ml, x, D_encoding)) break; /* don't start new kanji */ -#endif SetRenditionMline(ml, x); PUTCHAR(ml->image[x]); -#ifdef DW_CHARS if (dw_left(ml, x, D_encoding)) PUTCHAR(ml->image[++x]); -#endif } if (last2flag) { @@ -2604,16 +2390,12 @@ PutChar(struct mchar *c, int x, int y) GotoPos(x, y); SetRendition(c); PUTCHARLP(c->image); -#ifdef DW_CHARS if (c->mbcs) { -# ifdef UTF8 if (D_encoding == UTF8) D_rend.font = 0; -# endif PUTCHARLP(c->mbcs); } -#endif } void @@ -2647,35 +2429,24 @@ InsChar(struct mchar *c, int x, int xe, int y, struct mline *oml) InsertMode(1); if (!D_insert) { -#ifdef DW_CHARS if (c->mbcs && D_IC) AddCStr(D_IC); if (D_IC) AddCStr(D_IC); else AddCStr2(D_CIC, c->mbcs ? 2 : 1); -#else - if (D_IC) - AddCStr(D_IC); - else - AddCStr2(D_CIC, 1); -#endif } SetRendition(c); RAW_PUTCHAR(c->image); -#ifdef DW_CHARS if (c->mbcs) { -# ifdef UTF8 if (D_encoding == UTF8) D_rend.font = 0; -# endif if (D_x == D_width - 1) PUTCHARLP(c->mbcs); else RAW_PUTCHAR(c->mbcs); } -#endif } void @@ -2683,11 +2454,7 @@ WrapChar(struct mchar *c, int x, int y, int xs, int ys, int xe, int ye, int ins) { int bce; -#ifdef COLOR bce = rend_getbg(c); -#else - bce = 0; -#endif debug("WrapChar:"); debug2(" x %d y %d", x, y); debug2(" Dx %d Dy %d", D_x, D_y); @@ -2745,16 +2512,12 @@ WrapChar(struct mchar *c, int x, int y, int xs, int ys, int xe, int ye, int ins) D_x = 0; SetRendition(c); RAW_PUTCHAR(c->image); -#ifdef DW_CHARS if (c->mbcs) { -# ifdef UTF8 if (D_encoding == UTF8) D_rend.font = 0; -# endif RAW_PUTCHAR(c->mbcs); } -#endif debug2(" -> done (%d,%d)\n", D_x, D_y); } @@ -2811,7 +2574,6 @@ ChangeScrollRegion(int newtop, int newbot) D_y = D_x = -1; /* Just in case... */ } -#ifdef RXVT_OSC #define WT_FLAG "2" /* change to "0" to set both title and icon */ void @@ -2852,7 +2614,6 @@ ClearAllXtermOSC() AddStr("\033[23;" WT_FLAG "t"); /* unstack titles (xterm patch #251) */ } #undef WT_FLAG -#endif /* * Output buffering routines @@ -2865,14 +2626,12 @@ AddStr(char *str) ASSERT(display); -#ifdef UTF8 if (D_encoding == UTF8) { while ((c = *str++)) AddUtf8((unsigned char)c); return; } -#endif while ((c = *str++)) AddChar(c); } @@ -2883,14 +2642,12 @@ AddStrn(char *str, int n) register char c; ASSERT(display); -#ifdef UTF8 if (D_encoding == UTF8) { while ((c = *str++) && n-- > 0) AddUtf8((unsigned char)c); } else -#endif while ((c = *str++) && n-- > 0) AddChar(c); while (n-- > 0) @@ -3058,7 +2815,6 @@ DisplaySleep1000(int n, int eat) debug2("DisplaySleep(%d) ending, eat was %d\n", n, eat); } -#ifdef AUTO_NUKE void NukePending() {/* Nuke pending output in current display, clear screen */ @@ -3092,10 +2848,8 @@ NukePending() AddCStr(D_ME); else { -#ifdef COLOR if (D_hascolor) AddStr("\033[m"); /* why is D_ME not set? */ -#endif AddCStr(D_SE); AddCStr(D_UE); } @@ -3104,19 +2858,10 @@ NukePending() AddCStr(D_EI); D_insert = 0; /* Check for toggle */ -#ifdef MAPKEYS if (D_KS && strcmp(D_KS, D_KE)) AddCStr(D_KS); if (D_CCS && strcmp(D_CCS, D_CCE)) AddCStr(D_CCS); -#else - if (D_KS && strcmp(D_KS, D_KE)) - AddCStr(D_KE); - D_keypad = 0; - if (D_CCS && strcmp(D_CCS, D_CCE)) - AddCStr(D_CCE); - D_cursorkeys = 0; -#endif AddCStr(D_CE0); D_rend = mchar_null; D_atyp = 0; @@ -3141,7 +2886,6 @@ NukePending() AddCStr(D_width == Z0width ? D_CZ0 : D_CZ1); } } -#endif /* AUTO_NUKE */ #ifdef linux /* linux' select can't handle flow control, so wait 100ms if @@ -3274,11 +3018,9 @@ disp_readev_fn(struct event *ev, char *data) size = IOSIZE; else { -#ifdef PSEUDOS if (W_UWP(D_fore)) size = sizeof(D_fore->w_pwin->p_inbuf) - D_fore->w_pwin->p_inlen; else -#endif size = sizeof(D_fore->w_inbuf) - D_fore->w_inlen; } @@ -3311,14 +3053,11 @@ disp_readev_fn(struct event *ev, char *data) if (D_blocked == 4) { D_blocked = 0; -#ifdef BLANKER_PRG KillBlanker(); -#endif Activate(D_fore ? D_fore->w_norefresh : 0); ResetIdle(); return; } -#ifdef ZMODEM if (D_blocked > 1) /* 2, 3 */ { char *bufp; @@ -3337,7 +3076,6 @@ disp_readev_fn(struct event *ev, char *data) debug("zmodem window gone, deblocking display"); zmodem_abort(0, display); } -#endif if (idletimo > 0) ResetIdle(); if (D_fore) @@ -3399,7 +3137,6 @@ disp_readev_fn(struct event *ev, char *data) size -= 5; } } -#ifdef ENCODINGS if (D_encoding != (D_forecv ? D_forecv->c_layer->l_encoding : 0)) { int i, j, c, enc; @@ -3427,7 +3164,6 @@ disp_readev_fn(struct event *ev, char *data) (*D_processinput)(buf2, j); return; } -#endif (*D_processinput)(buf, size); } @@ -3474,7 +3210,6 @@ disp_blocked_fn(struct event *ev, char *data) } } -#ifdef MAPKEYS static void disp_map_fn(struct event *ev, char *data) { @@ -3506,7 +3241,6 @@ disp_map_fn(struct event *ev, char *data) D_dontmap = 1; ProcessInput(p, l); } -#endif static void disp_idle_fn(struct event *ev, char *data) @@ -3543,7 +3277,6 @@ ResetIdle() } -#ifdef BLANKER_PRG static void disp_blanker_fn(struct event *ev, char *data) @@ -3587,10 +3320,8 @@ KillBlanker() } else { -#ifdef COLOR if (D_hascolor) AddStr("\033[m\033[m"); /* why is D_ME not set? */ -#endif AddCStr(D_SE); AddCStr(D_UE); } @@ -3702,6 +3433,5 @@ RunBlanker(char **cmdv) close(slave); } -#endif /* BLANKER_PRG */ diff --git a/src/display.h b/src/display.h index 3afe89d..e27ee65 100644 --- a/src/display.h +++ b/src/display.h @@ -34,8 +34,6 @@ #include "canvas.h" #include "viewport.h" -#ifdef MAPKEYS - #define KMAP_KEYS (T_OCAPS-T_CAPS) #define KMAP_AKEYS (T_OCAPS-T_CURSOR) @@ -50,11 +48,6 @@ struct kmap_ext struct action mm; }; -#else - -#define KMAP_KEYS 0 - -#endif struct win; /* forward declaration */ @@ -83,14 +76,10 @@ struct display struct mchar d_rend; /* current rendition */ int d_col16change; /* the 16col bits changed in attr */ char d_atyp; /* current attribute types */ -#ifdef DW_CHARS int d_mbcs; /* saved char for multibytes charset */ -#endif -#ifdef ENCODINGS int d_encoding; /* what encoding type the display is */ int d_decodestate; /* state of our decoder */ int d_realfont; /* real font of terminal */ -#endif int d_insert; /* insert mode flag */ int d_keypad; /* application keypad flag */ int d_cursorkeys; /* application cursorkeys flag */ @@ -102,9 +91,7 @@ struct display int d_mouse; /* mouse mode */ int d_mousetrack; /* set when user wants to use mouse even when the window does not */ -#ifdef RXVT_OSC int d_xtermosc[4]; /* osc used */ -#endif struct mchar d_lpchar; /* missing char */ struct timeval d_status_time; /* time of status display */ int d_status; /* is status displayed? */ @@ -137,10 +124,7 @@ struct display int d_obuflenmax; /* len - max */ char *d_obufp; /* pointer in buffer */ int d_obuffree; /* free bytes in buffer */ -#ifdef AUTO_NUKE int d_auto_nuke; /* autonuke flag */ -#endif -#ifdef MAPKEYS int d_nseqs; /* number of valid mappings */ int d_aseqs; /* number of allocated mappings */ unsigned char *d_kmaps; /* keymaps */ @@ -150,16 +134,13 @@ struct display struct event d_mapev; /* timeout event */ int d_dontmap; /* do not map next */ int d_mapdefault; /* do map next to default */ -#endif union tcu d_tcs[T_N]; /* terminal capabilities */ char *d_attrtab[NATTR]; /* attrib emulation table */ char d_attrtyp[NATTR]; /* attrib group table */ int d_hascolor; /* do we support color */ short d_dospeed; /* baudrate of tty */ -#ifdef FONT char d_c0_tab[256]; /* conversion for C0 */ char ***d_xtable; /* char translation table */ -#endif int d_UPcost, d_DOcost, d_LEcost, d_NDcost; int d_CRcost, d_IMcost, d_EIcost, d_NLcost; int d_printfd; /* fd for vt100 print sequence */ @@ -174,18 +155,11 @@ struct display int d_blocked; int d_blocked_fuzz; struct event d_idleev; /* screen blanker */ -#ifdef BLANKER_PRG int d_blankerpid; struct event d_blankerev; -#endif }; -#ifdef MULTI -# define DISPLAY(x) display->x -#else -extern struct display TheDisplay; -# define DISPLAY(x) TheDisplay.x -#endif +#define DISPLAY(x) display->x #define D_user DISPLAY(d_user) #define D_username (DISPLAY(d_user) ? DISPLAY(d_user)->u_name : 0) diff --git a/src/encoding.c b/src/encoding.c index 8e5b0af..6ea456f 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -27,7 +27,6 @@ #include "screen.h" #include "extern.h" -#ifdef ENCODINGS extern unsigned char *null; extern struct display *display, *displays; @@ -35,20 +34,14 @@ extern struct layer *flayer; extern char *screenencodings; -#ifdef DW_CHARS extern int cjkwidth; -#endif static int encmatch (char *, char *); -# ifdef UTF8 static int recode_char (int, int, int); static int recode_char_to_encoding (int, int); static void comb_tofront (int, int); -# ifdef DW_CHARS static int recode_char_dw (int, int *, int, int); static int recode_char_dw_to_encoding (int, int *, int); -# endif -# endif struct encoding { char *name; @@ -87,7 +80,6 @@ struct encoding encodings[] = { { "GBK", "B\031BB01", 0x80|'b', 1, 1, "\031" } }; -#ifdef UTF8 static unsigned short builtin_tabs[][2] = { { 0x30, 0 }, /* 0: special graphics (line drawing) */ @@ -388,7 +380,6 @@ recode_char(int c, int to_utf, int font) } -#ifdef DW_CHARS static int recode_char_dw(int c, int *c2p, int to_utf, int font) { @@ -410,10 +401,8 @@ recode_char_dw(int c, int *c2p, int to_utf, int font) 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; @@ -452,7 +441,6 @@ recode_char_dw(int c, int *c2p, int to_utf, int font) } return -1; } -#endif static int recode_char_to_encoding(int c, int encoding) @@ -472,7 +460,6 @@ recode_char_to_encoding(int c, int encoding) return recode_char(c, 0, -1); } -#ifdef DW_CHARS static int recode_char_dw_to_encoding(int c, int *c2p, int encoding) { @@ -490,7 +477,6 @@ recode_char_dw_to_encoding(int c, int *c2p, int encoding) return x; return recode_char_dw(c, c2p, 0, -1); } -#endif struct mchar * @@ -510,7 +496,6 @@ recode_mchar(struct mchar *mc, int from, int to) c = rmc.image | (rmc.font << 8); if (from == UTF8) c |= rmc.fontx << 16; -#ifdef DW_CHARS if (rmc.mbcs) { int c2 = rmc.mbcs; @@ -518,7 +503,6 @@ recode_mchar(struct mchar *mc, int from, int to) rmc.mbcs = c2; } else -#endif c = recode_char_to_encoding(c, to); rmc.image = c & 255; rmc.font = c >> 8 & 255; @@ -586,12 +570,8 @@ recode_mline(struct mline *ml, int w, int from, int to) 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); @@ -599,7 +579,6 @@ recode_mline(struct mline *ml, int w, int from, int to) 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) @@ -618,7 +597,6 @@ recode_mline(struct mline *ml, int w, int from, int to) } } else -#endif c = recode_char_to_encoding(c, to); rl->image[i] = c & 255; rl->font[i] = c >> 8 & 255; @@ -836,11 +814,7 @@ WinSwitchEncoding(struct win *p, int encoding) 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++) @@ -860,7 +834,6 @@ WinSwitchEncoding(struct win *p, int encoding) 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) @@ -891,7 +864,6 @@ WinSwitchEncoding(struct win *p, int encoding) } } else -#endif c = recode_char_to_encoding(c, encoding); ml->image[i] = c & 255; ml->font[i] = c >> 8 & 255; @@ -915,7 +887,6 @@ WinSwitchEncoding(struct win *p, int encoding) return; } -#ifdef DW_CHARS struct interval { int first; int last; @@ -1017,7 +988,6 @@ utf8_isdouble(int c) bisearch(c, ambiguous, sizeof(ambiguous) / sizeof(struct interval) - 1))); } -#endif int utf8_iscomb(int c) @@ -1170,17 +1140,6 @@ utf8_handle_comb(int c, struct mchar *mc) comb_tofront(root, i); } -#else /* !UTF8 */ - -void -WinSwitchEncoding(struct win *p, int encoding) -{ - p->w_encoding = encoding; - return; -} - -#endif /* UTF8 */ - static int encmatch(char *s1, char *s2) { @@ -1224,16 +1183,10 @@ FindEncoding(char *name) 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; @@ -1262,9 +1215,7 @@ ResetEncoding(struct win *p) c = encodings[encoding].charsets; if (c) SetCharsets(p, c); -#ifdef UTF8 LoadFontTranslationsForEncoding(encoding); -#endif if (encodings[encoding].usegr) { p->w_gr = 2; @@ -1291,7 +1242,6 @@ DecodeChar(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); @@ -1299,7 +1249,6 @@ DecodeChar(int c, int encoding, int *statep) c = (c & 0x7f0000) << 8 | (c & 0xffff); return c; } -#endif if (encoding == SJIS) { if (!*statep) @@ -1410,12 +1359,10 @@ EncodeChar(char *bp, int c, int encoding, int *fontp) } f = (c >> 16) & 0xff; -#ifdef UTF8 if (encoding == UTF8) { if (f) { -# ifdef DW_CHARS if (is_dw_font(f)) { int c2 = c & 0xff; @@ -1423,7 +1370,6 @@ EncodeChar(char *bp, int c, int encoding, int *fontp) c = recode_char_dw_to_encoding(c, &c2, encoding); } else -# endif { c = (c & 0xff) | (f << 8); c = recode_char_to_encoding(c, encoding); @@ -1435,7 +1381,6 @@ EncodeChar(char *bp, int c, int encoding, int *fontp) { if (c >= 0x10000) c = (c & 0x7f0000) >> 8 | (c & 0xffff); -# ifdef DW_CHARS if (utf8_isdouble(c)) { int c2 = 0xffff; @@ -1443,7 +1388,6 @@ EncodeChar(char *bp, int c, int encoding, int *fontp) c = (c << 8) | (c2 & 0xff); } else -# endif { c = recode_char_to_encoding(c, encoding); c = ((c & 0xff00) << 8) | (c & 0xff); @@ -1451,7 +1395,6 @@ EncodeChar(char *bp, int c, int encoding, int *fontp) 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; @@ -1569,10 +1512,8 @@ CanEncodeFont(int encoding, int f) { switch(encoding) { -#ifdef UTF8 case UTF8: return 1; -#endif case SJIS: return f == KANJI || f == KANA; case EUC: @@ -1591,7 +1532,6 @@ CanEncodeFont(int encoding, int f) return 0; } -#ifdef DW_CHARS int PrepareEncodedChar(int c) { @@ -1642,7 +1582,6 @@ PrepareEncodedChar(int c) return c | 0x80; return c; } -#endif int RecodeBuf(unsigned char *fbuf, int flen, int fenc, int tenc, unsigned char *tbuf) @@ -1664,7 +1603,6 @@ RecodeBuf(unsigned char *fbuf, int flen, int fenc, int tenc, unsigned char *tbuf return j; } -#ifdef UTF8 int ContainsSpecialDeffont(struct mline *ml, int xs, int xe, int encoding) { @@ -1798,58 +1736,3 @@ LoadFontTranslationsForEncoding(int encoding) LoadFontTranslation(f, 0); } -#endif /* UTF8 */ - -#else /* !ENCODINGS */ - -/* Simple version of EncodeChar to encode font changes for - * copy/paste mode - */ -int -EncodeChar(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 */ diff --git a/src/extern.h b/src/extern.h index d5e16c7..1404964 100644 --- a/src/extern.h +++ b/src/extern.h @@ -132,26 +132,20 @@ extern void display_bindkey (char *, struct action *); extern int InWList (void); extern void WListUpdatecv (struct canvas *, struct win *); extern void WListLinkChanged (void); -#ifdef ZMODEM extern void ZmodemPage (void); -#endif /* window.c */ extern int MakeWindow (struct NewWindow *); extern int RemakeWindow (struct win *); extern void FreeWindow (struct win *); -#ifdef PSEUDOS extern int winexec (char **); extern void FreePseudowin (struct win *); -#endif extern void nwin_compose (struct NewWindow *, struct NewWindow *, struct NewWindow *); extern int DoStartLog (struct win *, char *, int); extern int ReleaseAutoWritelock (struct display *, struct win *); extern int ObtainAutoWritelock (struct display *, struct win *); extern void CloseDevice (struct win *); -#ifdef ZMODEM extern void zmodem_abort (struct win *, struct display *); -#endif #ifndef HAVE_EXECVPE extern void execvpe (char *, char **, char **); #endif @@ -188,9 +182,7 @@ extern void InitPTY (int); /* process.c */ extern void InitKeytab (void); extern void ProcessInput (char *, int); -#ifdef MAPKEYS extern void ProcessInput2 (char *, int); -#endif extern void DoProcess (struct win *, char **, int *, struct paster *); extern void DoAction (struct action *, int); extern int FindCommnr (const char *); @@ -208,12 +200,8 @@ extern char *AddWindowFlags (char *, int, struct win *); extern char *AddOtherUsers (char *, int, struct win *); extern int WindowByNoN (char *); extern struct win *FindNiceWindow (struct win *, char *); -#ifdef COPY_PASTE extern int CompileKeys (char *, int, unsigned char *); -#endif -#ifdef RXVT_OSC extern void RefreshXtermOSC (void); -#endif extern int ParseSaveStr (struct action *act, char **); extern int ParseNum (struct action *act, int *); extern int ParseSwitch (struct action *, int *); @@ -226,10 +214,8 @@ extern int StuffKey (int); extern int InitTermcap (int, int); extern char *MakeTermcap (int); extern char *gettermcapstring (char *); -#ifdef MAPKEYS extern int remap (int, int); extern void CheckEscape (void); -#endif extern int CreateTransTable (char *); extern void FreeTransTable (void); @@ -292,19 +278,11 @@ extern void AddStrn (char *, int); extern void Flush (int); extern void freetty (void); extern void Resize_obuf (void); -#ifdef AUTO_NUKE extern void NukePending (void); -#endif -#ifdef RXVT_OSC extern void ClearAllXtermOSC (void); extern void SetXtermOSC (int, char *); -#endif -#ifdef COLOR extern int color256to16 (int); -# ifdef COLORS256 extern int color256to88 (int); -# endif -#endif extern void ResetIdle (void); extern void KillBlanker (void); extern void DisplaySleep1000 (int, int); @@ -378,7 +356,6 @@ extern void opendebug (int, int); /* acl.c */ -#ifdef MULTIUSER extern int AclCheckPermWin (struct acluser *, int, struct win *); extern int AclCheckPermCmd (struct acluser *, int, struct comm *); extern int AclSetPerm (struct acluser *, struct acluser *, char *, char *); @@ -389,7 +366,6 @@ extern int NewWindowAcl (struct win *, struct acluser *); extern void FreeWindowAcl (struct win *); extern char *DoSu (struct acluser **, char *, char *, char *); extern int AclLinkUser (char *, char *); -#endif /* MULTIUSER */ extern int UserFreeCopyBuffer (struct acluser *); extern struct acluser **FindUserPtr (char *); extern int UserAdd (char *, char *, struct acluser **); @@ -441,8 +417,6 @@ extern void TelStatus (struct win *, char *, int); extern const char *DoNLS (const char *); /* encoding.c */ -#ifdef ENCODINGS -# ifdef UTF8 extern void InitBuiltinTabs (void); extern struct mchar *recode_mchar (struct mchar *, int, int); extern struct mline *recode_mline (struct mline *, int, int, int); @@ -456,7 +430,6 @@ extern void utf8_handle_comb (int, struct mchar *); extern int ContainsSpecialDeffont (struct mline *, int, int, int); extern int LoadFontTranslation (int, char *); extern void LoadFontTranslationsForEncoding (int); -# endif /* UTF8 */ extern void WinSwitchEncoding (struct win *, int); extern int FindEncoding (char *); extern char *EncodingName (int); @@ -465,10 +438,7 @@ extern void ResetEncoding (struct win *); extern int CanEncodeFont (int, int); extern int DecodeChar (int, int, int *); extern int RecodeBuf (unsigned char *, int, int, int, unsigned char *); -# ifdef DW_CHARS extern int PrepareEncodedChar (int); -# endif -#endif extern int EncodeChar (char *, int, int, int *); /* layout.c */ diff --git a/src/fileio.c b/src/fileio.c index 6e21fbe..e5277c4 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -47,9 +47,7 @@ extern int real_gid, eff_gid; extern char *extra_incap, *extra_outcap; extern char *home, *RcFileName; extern char SockPath[], *SockName; -#ifdef COPY_PASTE extern char *BufferFile; -#endif extern int hardcopy_append; extern char *hardcopydir; @@ -352,10 +350,8 @@ RcLine(char *ubuf, int ubufl) { char *args[MAXARGS]; int argl[MAXARGS]; -#ifdef MULTIUSER extern struct acluser *EffectiveAclUser; /* acl.c */ extern struct acluser *users; /* acl.c */ -#endif if (display) { @@ -366,18 +362,14 @@ RcLine(char *ubuf, int ubufl) flayer = fore ? fore->w_savelayer : 0; if (Parse(ubuf, ubufl, args, argl) <= 0) return; -#ifdef MULTIUSER if (!display) { /* the session owner does it, when there is no display here */ EffectiveAclUser = users; debug("RcLine: WARNING, no display no user! Session owner executes command\n"); } -#endif DoCommand(args, argl); -#ifdef MULTIUSER EffectiveAclUser = 0; -#endif } /* @@ -388,9 +380,7 @@ WriteFile(struct acluser *user, char *fn, int dump) { /* dump==0: create .termcap, * dump==1: hardcopy, - * #ifdef COPY_PASTE * dump==2: BUFFERFILE - * #endif COPY_PASTE * dump==1: scrollback, */ register int i, j, k; @@ -398,12 +388,10 @@ WriteFile(struct acluser *user, char *fn, int dump) register FILE *f; char fnbuf[1024]; char *mode = "w"; -#ifdef COPY_PASTE int public = 0; -# ifdef HAVE_LSTAT +#ifdef HAVE_LSTAT struct stat stb, stb2; int fd, exists = 0; -# endif #endif switch (dump) @@ -434,7 +422,6 @@ WriteFile(struct acluser *user, char *fn, int dump) if (hardcopy_append && !access(fn, W_OK)) mode = "a"; break; -#ifdef COPY_PASTE case DUMP_EXCHANGE: if (fn == 0) { @@ -443,26 +430,24 @@ WriteFile(struct acluser *user, char *fn, int dump) fn = fnbuf; } public = !strcmp(fn, DEFAULT_BUFFERFILE); -# ifdef HAVE_LSTAT +#ifdef HAVE_LSTAT exists = !lstat(fn, &stb); if (public && exists && (S_ISLNK(stb.st_mode) || stb.st_nlink > 1)) { Msg(0, "No write to links, please."); return; } -# endif - break; #endif + break; } debug2("WriteFile(%d) %s\n", dump, fn); if (UserContext() > 0) { debug("Writefile: usercontext\n"); -#ifdef COPY_PASTE if (dump == DUMP_EXCHANGE && public) { -# ifdef HAVE_LSTAT +#ifdef HAVE_LSTAT if (exists) { if ((fd = open(fn, O_WRONLY, 0666)) >= 0) @@ -479,12 +464,11 @@ WriteFile(struct acluser *user, char *fn, int dump) else fd = open(fn, O_WRONLY|O_CREAT|O_EXCL, 0666); f = fd >= 0 ? fdopen(fd, mode) : 0; -# else +#else f = fopen(fn, mode); -# endif +#endif } else -#endif /* COPY_PASTE */ f = fopen(fn, mode); if (f == NULL) { @@ -508,7 +492,6 @@ WriteFile(struct acluser *user, char *fn, int dump) } if (dump == DUMP_SCROLLBACK) { -#ifdef COPY_PASTE for (i = 0; i < fore->w_histheight; i++) { p = (char *)(WIN(i)->image); @@ -518,7 +501,6 @@ WriteFile(struct acluser *user, char *fn, int dump) putc(p[j], f); putc('\n', f); } -#endif } for (i = 0; i < fore->w_height; i++) { @@ -537,7 +519,6 @@ WriteFile(struct acluser *user, char *fn, int dump) putc('\n', f); } break; -#ifdef COPY_PASTE case DUMP_EXCHANGE: p = user->u_plop.buf; for (i = user->u_plop.len; i-- > 0; p++) @@ -546,7 +527,6 @@ WriteFile(struct acluser *user, char *fn, int dump) else putc(*p, f); break; -#endif } (void) fclose(f); UserReturn(1); @@ -566,15 +546,12 @@ WriteFile(struct acluser *user, char *fn, int dump) Msg(0, "Screen image %s to \"%s\".", (*mode == 'a') ? "appended" : "written", fn); break; -#ifdef COPY_PASTE case DUMP_EXCHANGE: Msg(0, "Copybuffer written to \"%s\".", fn); -#endif } } } -#ifdef COPY_PASTE /* * returns an allocated buffer which holds a copy of the file named fn. @@ -640,7 +617,6 @@ KillBuffers() errno = UserStatus(); Msg(errno, "%s %sremoved", BufferFile, errno ? "not " : ""); } -#endif /* COPY_PASTE */ /* @@ -49,9 +49,7 @@ extern struct mchar mchar_blank, mchar_so; extern int renditions[]; extern unsigned char *blank; extern struct win **wtab; -#ifdef MAPKEYS extern struct term term[]; -#endif extern struct LayFuncs ListLf; @@ -68,12 +66,10 @@ exit_with_usage(char *myname, char *message, char *arg) printf("-a Force all capabilities into each window's termcap.\n"); printf("-A -[r|R] Adapt all windows to the new display width & height.\n"); printf("-c file Read configuration file instead of '.screenrc'.\n"); -#ifdef REMOTE_DETACH printf("-d (-r) Detach the elsewhere running screen (and reattach here).\n"); printf("-dmS name Start as daemon: Screen session in detached mode.\n"); printf("-D (-r) Detach and logout remote (and reattach here).\n"); printf("-D -RR Do whatever is needed to get a screen session.\n"); -#endif printf("-e xy Change command characters.\n"); printf("-f Flow control on, -fn = off, -fa = auto.\n"); printf("-h lines Set the size of the scrollback history buffer.\n"); @@ -95,14 +91,10 @@ exit_with_usage(char *myname, char *message, char *arg) printf("-S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>.\n"); printf("-t title Set title. (window's name).\n"); printf("-T term Use term as $TERM for windows, rather than \"screen\".\n"); -#ifdef UTF8 printf("-U Tell screen to use UTF-8 encoding.\n"); -#endif printf("-v Print \"Screen version %s\".\n", version); printf("-wipe [match] Do nothing, just clean up SockDir [on possible matches].\n"); -#ifdef MULTI printf("-x Attach to a not detached screen. (Multi display mode).\n"); -#endif /* MULTI */ printf("-X Execute <cmd> as a screen command in the specified session.\n"); if (message && *message) { @@ -436,7 +428,6 @@ add_key_to_buf(char *buf, int key) strcpy(buf, "unset"); else if (key == ' ') strcpy(buf, "sp"); -#ifdef MAPKEYS else if (key >= 256) { key = key - 256 + T_CAPS; @@ -446,7 +437,6 @@ add_key_to_buf(char *buf, int key) buf[3] = ':'; buf[4] = 0; } -#endif else buf[AddXChar(buf, key)] = 0; } @@ -528,66 +518,6 @@ http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., \ Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to \ screen-devel@gnu.org\n\n\n" -"Capabilities:\n" - -#ifdef COPY_PASTE -"+copy " -#else -"-copy " -#endif - -#ifdef REMOTE_DETACH -"+remote-detach " -#else -"-remote-detach " -#endif - -#ifdef POW_DETACH -"+power-detach " -#else -"-power-detach " -#endif - -#ifdef MULTI -"+multi-attach " -#else -"-multi-attach " -#endif - -#ifdef MULTIUSER -"+multi-user " -#else -"-multi-user " -#endif - -#ifdef FONT -"+font " -#else -"-font " -#endif - -#ifdef COLORS256 -"+color-256 " -#elif defined(COLORS16) -"+color-16 " -#elif defined(COLOR) -"+color " -#else -"-color " -#endif - -#ifdef UTF8 -"+utf8 " -#else -"-utf8 " -#endif - -#ifdef RXVT_OSC -"+rxvt " -#else -"-rxvt " -#endif - #ifdef BUILTIN_TELNET "+builtin-telnet " #else @@ -752,7 +682,6 @@ CopyrightRedisplayLine(int y, int xs, int xe, int isblank) ** */ -#ifdef MAPKEYS extern struct kmap_ext *kmap_exts; extern int kmap_extn; extern struct action dmtab[]; @@ -953,7 +882,6 @@ BindkeyRedisplayLine(int y, int xs, int xe, int isblank) LClearArea(flayer, xs, y, xe, y, 0, 0); } -#endif /* MAPKEYS */ /* @@ -962,7 +890,6 @@ BindkeyRedisplayLine(int y, int xs, int xe, int isblank) ** */ -#ifdef ZMODEM static void ZmodemRedisplayLine (int, int, int, int); static int ZmodemResize (int, int); @@ -1007,7 +934,6 @@ ZmodemPage() flayer->l_y = 0; } -#endif diff --git a/src/image.h b/src/image.h index 2e9b1a6..82c5d1b 100644 --- a/src/image.h +++ b/src/image.h @@ -31,31 +31,15 @@ #undef IFFONT #undef IFCOLOR -#ifdef FONT -# define IFFONT(x) x -# define IFFONTX(x) x -#else -# define IFFONT(x) -# define IFFONTX(x) -#endif - -#ifdef COLOR -# define IFCOLOR(x) x -#else -# define IFCOLOR(x) -#endif - -#if defined(COLOR) && defined(COLORS16) && defined(COLORS256) -# define IFCOLORX(x) x -#else -# define IFCOLORX(x) -#endif - -#ifdef DW_CHARS -# define IFDWCHAR(x) x -#else -# define IFDWCHAR(x) -#endif +#define IFFONT(x) x + +#define IFFONTX(x) x + +#define IFCOLOR(x) x + +#define IFCOLORX(x) x + +#define IFDWCHAR(x) x struct mchar { unsigned char image; @@ -151,34 +135,14 @@ IFCOLORX((mc)->colorx = (ml)->colorx[x]; ) \ IFDWCHAR((mc)->mbcs = 0; ) \ } while (0) -#ifdef COLOR -# ifdef COLORS16 -# ifdef COLORS256 -# define rend_getbg(mc) (((mc)->color & 0xf0) >> 4 | ((mc)->attr & A_BBG ? 0x100 : 0) | ((mc)->colorx & 0xf0)) -# define rend_setbg(mc, c) ((mc)->color = ((mc)->color & 0x0f) | (c << 4 & 0xf0), (mc)->colorx = ((mc)->colorx & 0x0f) | (c & 0xf0), (mc)->attr = ((mc)->attr | A_BBG) ^ (c & 0x100 ? 0 : A_BBG)) -# define rend_getfg(mc) (((mc)->color & 0x0f) | ((mc)->attr & A_BFG ? 0x100 : 0) | (((mc)->colorx & 0x0f) << 4)) -# define rend_setfg(mc, c) ((mc)->color = ((mc)->color & 0xf0) | (c & 0x0f), (mc)->colorx = ((mc)->colorx & 0xf0) | ((c & 0xf0) >> 4), (mc)->attr = ((mc)->attr | A_BFG) ^ (c & 0x100 ? 0 : A_BFG)) -# define rend_setdefault(mc) ((mc)->color = (mc)->colorx = 0, (mc)->attr &= ~(A_BBG|A_BFG)) -# else -# define rend_getbg(mc) (((mc)->color & 0xf0) >> 4 | ((mc)->attr & A_BBG ? 0x100 : 0)) -# define rend_setbg(mc, c) ((mc)->color = ((mc)->color & 0x0f) | (c << 4 & 0xf0), (mc)->attr = ((mc)->attr | A_BBG) ^ (c & 0x100 ? 0 : A_BBG)) -# define rend_getfg(mc) (((mc)->color & 0x0f) | ((mc)->attr & A_BFG ? 0x100 : 0)) -# define rend_setfg(mc, c) ((mc)->color = ((mc)->color & 0xf0) | (c & 0x0f), (mc)->attr = ((mc)->attr | A_BFG) ^ (c & 0x100 ? 0 : A_BFG)) -# define rend_setdefault(mc) ((mc)->color = 0, (mc)->attr &= ~(A_BBG|A_BFG)) -# endif -# define coli2e(c) ((((c) & 0x1f8) == 0x108 ? (c) ^ 0x108 : (c & 0xff)) ^ 9) -# define cole2i(c) ((c) >= 8 && (c) < 16 ? (c) ^ 0x109 : (c) ^ 9) -# else -# define rend_getbg(mc) (((mc)->color & 0xf0) >> 4) -# define rend_setbg(mc, c) ((mc)->color = ((mc)->color & 0x0f) | (c << 4 & 0xf0)) -# define rend_getfg(mc) ((mc)->color & 0x0f) -# define rend_setfg(mc, c) ((mc)->color = ((mc)->color & 0xf0) | (c & 0x0f)) -# define rend_setdefault(mc) ((mc)->color = 0) -# define coli2e(c) ((c) ^ 9) -# define cole2i(c) ((c) ^ 9) -# endif -#endif +#define rend_getbg(mc) (((mc)->color & 0xf0) >> 4 | ((mc)->attr & A_BBG ? 0x100 : 0) | ((mc)->colorx & 0xf0)) +#define rend_setbg(mc, c) ((mc)->color = ((mc)->color & 0x0f) | (c << 4 & 0xf0), (mc)->colorx = ((mc)->colorx & 0x0f) | (c & 0xf0), (mc)->attr = ((mc)->attr | A_BBG) ^ (c & 0x100 ? 0 : A_BBG)) +#define rend_getfg(mc) (((mc)->color & 0x0f) | ((mc)->attr & A_BFG ? 0x100 : 0) | (((mc)->colorx & 0x0f) << 4)) +#define rend_setfg(mc, c) ((mc)->color = ((mc)->color & 0xf0) | (c & 0x0f), (mc)->colorx = ((mc)->colorx & 0xf0) | ((c & 0xf0) >> 4), (mc)->attr = ((mc)->attr | A_BFG) ^ (c & 0x100 ? 0 : A_BFG)) +#define rend_setdefault(mc) ((mc)->color = (mc)->colorx = 0, (mc)->attr &= ~(A_BBG|A_BFG)) +#define coli2e(c) ((((c) & 0x1f8) == 0x108 ? (c) ^ 0x108 : (c & 0xff)) ^ 9) +#define cole2i(c) ((c) >= 8 && (c) < 16 ? (c) ^ 0x109 : (c) ^ 9) enum { REND_BELL = 0, diff --git a/src/layer.c b/src/layer.c index f1fc744..e7ecd22 100644 --- a/src/layer.c +++ b/src/layer.c @@ -63,26 +63,15 @@ mloff(struct mline *ml, int off) return 0; mml.image = ml->image + off; mml.attr = ml->attr + off; -#ifdef FONT mml.font = ml->font + off; mml.fontx = ml->fontx + off; -#endif -#ifdef COLOR mml.color = ml->color + off; -# ifdef COLORS256 mml.colorx = ml->colorx + off; -# endif -#endif return &mml; } -#ifdef UTF8 # define RECODE_MCHAR(mc) ((l->l_encoding == UTF8) != (D_encoding == UTF8) ? recode_mchar(mc, l->l_encoding, D_encoding) : (mc)) # define RECODE_MLINE(ml) ((l->l_encoding == UTF8) != (D_encoding == UTF8) ? recode_mline(ml, l->l_width, l->l_encoding, D_encoding) : (ml)) -#else -# define RECODE_MCHAR(mc) (mc) -# define RECODE_MLINE(ml) (ml) -#endif #define FOR_EACH_UNPAUSED_CANVAS(l, fn) for (cv = (l)->l_cvlist; cv; cv = cv->c_lnext) \ { \ @@ -302,11 +291,7 @@ LPutChar(struct layer *l, struct mchar *c, int x, int y) if (l->l_pause.d) LayPauseUpdateRegion(l, x, -#ifdef DW_CHARS x + (c->mbcs ? 1 : 0) -#else - x -#endif , y, y); FOR_EACH_UNPAUSED_CANVAS(l, @@ -362,7 +347,6 @@ LPutStr(struct layer *l, char *s, int n, struct mchar *r, int x, int y) GotoPos(xs2, y2); SetRendition(r); s2 = s + xs2 - x - vp->v_xoff; -#ifdef UTF8 if (D_encoding == UTF8 && l->l_encoding != UTF8 && (r->font || r->fontx || l->l_encoding)) { struct mchar mc; @@ -374,7 +358,6 @@ LPutStr(struct layer *l, char *s, int n, struct mchar *r, int x, int y) } continue; } -#endif while (xs2++ <= xe2) PUTCHARLP(*s2++); } @@ -570,13 +553,11 @@ LCDisplayLineWrap(struct layer *l, struct mline *ml, int y, int from, int to, in { struct mchar nc; copy_mline2mchar(&nc, ml, 0); -#ifdef DW_CHARS if (dw_left(ml, 0, l->l_encoding)) { nc.mbcs = ml->image[1]; from++; } -#endif LWrapChar(l, &nc, y - 1, -1, -1, 0); from++; if (from <= to) @@ -609,11 +590,7 @@ LWrapChar(struct layer *l, struct mchar *c, int y, int top, int bot, int ins) /* XXX: 'y'? */ LayPauseUpdateRegion(l, 0, l->l_width - 1, top, bot); -#ifdef COLOR bce = rend_getbg(c); -#else - bce = 0; -#endif if (y != bot) { /* simple case: no scrolling */ @@ -1017,10 +994,8 @@ ExitOverlayPage() } if (p && p->w_savelayer == oldlay) p->w_savelayer = flayer; -#ifdef COPY_PASTE if (p && oldlay == p->w_paster.pa_pastelayer) p->w_paster.pa_pastelayer = 0; -#endif for (lay = layouts; lay; lay = lay->lay_next) for (cv = lay->lay_cvlist; cv; cv = cv->c_next) @@ -1127,14 +1102,12 @@ void LayPause(struct layer *layer, int pause) if (xs < vp->v_xs) xs = vp->v_xs; if (xe > vp->v_xe) xe = vp->v_xe; -#if defined(DW_CHARS) && defined(UTF8) if (layer->l_encoding == UTF8 && xe < vp->v_xe && win) { struct mline *ml = win->w_mlines + line; if (dw_left(ml, xe, UTF8)) xe++; } -#endif if (xs <= xe) RefreshLine(line + vp->v_yoff, xs, xe, 0); diff --git a/src/list_display.c b/src/list_display.c index 113bc1c..496cfa9 100644 --- a/src/list_display.c +++ b/src/list_display.c @@ -37,7 +37,6 @@ #include "extern.h" #include "list_generic.h" -#ifdef MULTI extern struct layer *flayer; extern struct display *display, *displays; @@ -111,7 +110,6 @@ gl_Display_row(struct ListData *ldata, struct ListRow *lrow) * write, own wlock * -,x no execute, execute */ -#ifdef MULTIUSER (AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' : ((w->w_wlock == WLOCK_OFF || d->d_user == w->w_wlockuser) ? 'r' : 'R')), @@ -119,9 +117,6 @@ gl_Display_row(struct ListData *ldata, struct ListRow *lrow) ((w->w_wlock == WLOCK_OFF) ? 'w' : ((d->d_user == w->w_wlockuser) ? 'W' : 'v'))), (AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' : 'x') -#else - 'r', 'w', 'x' -#endif ); } leftline(tbuf, lrow->y, lrow == ldata->selected ? &mchar_so : d == display ? &m_current : 0); @@ -171,24 +166,18 @@ gl_Display_input(struct ListData *ldata, char **inp, int *len) *len = 0; break; -#ifdef REMOTE_DETACH case 'd': /* Detach */ case 'D': /* Power detach */ display = ldata->selected->data; if (display == cd) /* We do not allow detaching the current display */ break; Detach( -#ifdef POW_DETACH ch == 'D' ? D_REMOTE_POWER : D_REMOTE -#else - D_REMOTE -#endif ); display = cd; glist_remove_rows(ldata); gl_Display_rebuild(ldata); break; -#endif default: /* We didn't actually process the input. */ @@ -241,5 +230,4 @@ display_displays() gl_Display_rebuild(ldata); } -#endif /* MULTI */ diff --git a/src/list_window.c b/src/list_window.c index 005b77b..ac62387 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -304,10 +304,8 @@ gl_Window_input(struct ListData *ldata, char **inp, int *len) 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 @@ -34,7 +34,6 @@ #include "mark.h" #include "extern.h" -#ifdef COPY_PASTE /* * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -65,9 +64,7 @@ extern struct win *fore; extern struct mline mline_blank, mline_null; extern struct mchar mchar_so; -#ifdef FONT int pastefont = 1; -#endif struct LayFuncs MarkLf = { @@ -276,10 +273,8 @@ rem(int x1, int y1, int x2, int y2, int redisplay, char *pt, int yend) int l = 0; unsigned char *im; struct mline *ml; -#ifdef FONT int cf, cfx, font; unsigned char *fo, *fox; -#endif markdata->second = 0; if (y2 < y1 || ((y2 == y1) && (x2 < x1))) @@ -319,23 +314,17 @@ rem(int x1, int y1, int x2, int y2, int redisplay, char *pt, int yend) if (redisplay != 2 && pt == 0) /* don't count/copy */ continue; j = from; -#ifdef DW_CHARS if (dw_right(ml, j, fore->w_encoding)) j--; -#endif im = ml->image + j; -#ifdef FONT fo = ml->font + j; fox = ml->fontx + j; font = ASCII; -#endif for (; j <= to; j++) { c = (unsigned char)*im++; -#ifdef FONT cf = (unsigned char)*fo++; cfx = (unsigned char)*fox++; -# ifdef UTF8 if (fore->w_encoding == UTF8) { c |= cf << 8 | cfx << 16; @@ -347,15 +336,12 @@ rem(int x1, int y1, int x2, int y2, int redisplay, char *pt, int yend) pt += c; continue; } -# endif -# ifdef DW_CHARS if (is_dw_font(cf)) { c = c << 8 | (unsigned char)*im++; fo++; j++; } -# endif if (pastefont) { c = EncodeChar(pt, c | cf << 16, fore->w_encoding, &font); @@ -364,12 +350,10 @@ rem(int x1, int y1, int x2, int y2, int redisplay, char *pt, int yend) pt += c; continue; } -#endif /* FONT */ if (pt) *pt++ = c; l++; } -#ifdef FONT if (pastefont && font != ASCII) { if (pt) @@ -379,7 +363,6 @@ rem(int x1, int y1, int x2, int y2, int redisplay, char *pt, int yend) } l += 3; } -#endif if (i != y2 && (to != fore->w_width - 1 || ml->image[to + 1] == ' ')) { /* @@ -477,9 +460,7 @@ GetHistory() /* return value 1 if copybuffer changed */ } bcopy((char *)linep - i + x + 1, D_user->u_plop.buf, i - x + 1); D_user->u_plop.len = i - x + 1; -#ifdef ENCODINGS D_user->u_plop.enc = fore->w_encoding; -#endif return 1; } @@ -1021,9 +1002,7 @@ processchar: md_user->u_plop.len += rem(markdata->x1, markdata->y1, x2, y2, markdata->hist_offset == fore->w_histheight, md_user->u_plop.buf + md_user->u_plop.len, yend); -#ifdef ENCODINGS md_user->u_plop.enc = fore->w_encoding; -#endif } if (markdata->hist_offset != fore->w_histheight) { @@ -1119,14 +1098,12 @@ void revto_line(int tx, int ty, int line) fx = markdata->cx; fy = markdata->cy; -#ifdef DW_CHARS /* don't just move inside of a kanji, the user wants to see something */ ml = WIN(ty); if (ty == fy && fx + 1 == tx && dw_right(ml, tx, fore->w_encoding) && tx < D_width - 1) tx++; if (ty == fy && fx - 1 == tx && dw_right(ml, fx, fore->w_encoding) && tx) tx--; -#endif markdata->cx = tx; markdata->cy = ty; @@ -1211,7 +1188,6 @@ void revto_line(int tx, int ty, int line) } if (x <= ce && x >= markdata->left_mar && x <= markdata->right_mar) { -#ifdef DW_CHARS if (dw_right(ml, x, fore->w_encoding)) { if (t == revst) @@ -1219,34 +1195,27 @@ void revto_line(int tx, int ty, int line) t--; x--; } -#endif if (t >= revst && t <= reven) { mc = mchar_so; -#ifdef FONT if (pastefont) { mc.font = ml->font[x]; mc.fontx = ml->fontx[x]; } -#endif mc.image = ml->image[x]; } else copy_mline2mchar(&mc, ml, x); -#ifdef DW_CHARS if (dw_left(ml, x, fore->w_encoding)) { mc.mbcs = ml->image[x + 1]; LPutChar(flayer, &mc, x, W2D(y)); t++; } -#endif LPutChar(flayer, &mc, x, W2D(y)); -#ifdef DW_CHARS if (dw_left(ml, x, fore->w_encoding)) x++; -#endif } } flayer->l_x = tx; @@ -1334,37 +1303,29 @@ MarkRedisplayLine(int y, int xs, int xe, int isblank) for (x = xs; x <= xe; x++, cp++) if (cp >= sta && x >= markdata->left_mar) break; -#ifdef DW_CHARS if (dw_right(ml, x, fore->w_encoding)) x--; -#endif if (x > xs) LCDisplayLine(flayer, ml, y, xs, x - 1, isblank); for (; x <= xe; x++, cp++) { if (cp > sto || x > rm) break; -#ifdef FONT if (pastefont) { mchar_marked.font = ml->font[x]; mchar_marked.fontx = ml->fontx[x]; } -#endif mchar_marked.image = ml->image[x]; -#ifdef DW_CHARS mchar_marked.mbcs = 0; if (dw_left(ml, x, fore->w_encoding)) { mchar_marked.mbcs = ml->image[x + 1]; cp++; } -#endif LPutChar(flayer, &mchar_marked, x, y); -#ifdef DW_CHARS if (dw_left(ml, x, fore->w_encoding)) x++; -#endif } if (x <= xe) LCDisplayLine(flayer, ml, y, x, xe, isblank); @@ -1389,10 +1350,8 @@ MarkRewrite(int ry, int xs, int xe, struct mchar *rend, int doit) fore = markdata->md_window; y = D2W(ry); ml = WIN(y); -#ifdef UTF8 if (fore->w_encoding && fore->w_encoding != UTF8 && D_encoding == UTF8 && ContainsSpecialDeffont(ml, xs, xe, fore->w_encoding)) return EXPENSIVE; -#endif dx = xe - xs + 1; if (doit) { @@ -1424,13 +1383,11 @@ MarkRewrite(int ry, int xs, int xe, struct mchar *rend, int doit) { if (t >= st && t <= en && x >= markdata->left_mar && x <= rm) { -#ifdef FONT if (pastefont) { mchar_marked.font = ml->font[x]; mchar_marked.fontx = ml->fontx[x]; } -#endif rend->image = mchar_marked.image; if (!cmp_mchar(rend, &mchar_marked)) return EXPENSIVE; @@ -1509,5 +1466,4 @@ FreePaster(struct paster *pa) evdeq(&pa->pa_slowev); } -#endif /* COPY_PASTE */ diff --git a/src/process.c b/src/process.c index 41a41f1..2a924a5 100644 --- a/src/process.c +++ b/src/process.c @@ -73,10 +73,8 @@ extern int TtyMode, auto_detach, use_altscreen; extern int iflag, maxwin; extern int focusminwidth, focusminheight; extern int use_hardstatus, visual_bell; -#ifdef COLOR extern int attr2color[][4]; extern int nattr2color; -#endif extern int hardstatusemu; extern char *printcmd; extern int default_startup; @@ -86,42 +84,26 @@ extern int defmousetrack; extern int ZombieKey_destroy; extern int ZombieKey_resurrect; extern int ZombieKey_onerror; -#ifdef AUTO_NUKE extern int defautonuke; -#endif extern int separate_sids; extern struct NewWindow nwin_default, nwin_undef; -#ifdef COPY_PASTE extern int join_with_cr; extern int compacthist; extern int search_ic; -# ifdef FONT extern int pastefont; -# endif extern unsigned char mark_key_tab[]; extern char *BufferFile; -#endif -#ifdef POW_DETACH extern char *BufferFile, *PowDetachString; -#endif -#ifdef MULTIUSER extern struct acluser *EffectiveAclUser; /* acl.c */ -#endif extern struct term term[]; /* terminal capabilities */ -#ifdef MAPKEYS extern char *kmapdef[]; extern char *kmapadef[]; extern char *kmapmdef[]; -#endif extern struct mchar mchar_so, mchar_null; extern int renditions[]; extern int VerboseCreate; -#ifdef UTF8 extern char *screenencodings; -#endif -#ifdef DW_CHARS extern int cjkwidth; -#endif static int CheckArgNum (int, char **); static void ClearAction (struct action *); @@ -145,23 +127,15 @@ static void Colonfin (char *, int, char *); static void InputSelect (void); static void InputSetenv (char *); static void InputAKA (void); -#ifdef MULTIUSER static int InputSu (struct win *, struct acluser **, char *); static void su_fin (char *, int, char *); -#endif static void AKAfin (char *, int, char *); -#ifdef COPY_PASTE static void copy_reg_fn (char *, int, char *); static void ins_reg_fn (char *, int, char *); -#endif static void process_fn (char *, int, char *); -#ifdef PASSWORD static void pass1 (char *, int, char *); static void pass2 (char *, int, char *); -#endif -#ifdef POW_DETACH static void pow_detach_fn (char *, int, char *); -#endif static void digraph_fn (char *, int, char *); static int digraph_find (const char *buf); static void confirm_fn (char *, int, char *); @@ -194,10 +168,8 @@ extern int nethackflag; extern struct win **wtab; -#ifdef MULTIUSER extern char *multi; extern int maxusercount; -#endif char NullStr[] = ""; struct plop plop_tab[MAX_PLOP_DEFS]; @@ -209,18 +181,14 @@ struct plop plop_tab[MAX_PLOP_DEFS]; int TtyMode = PTYMODE; int hardcopy_append = 0; int all_norefresh = 0; -#ifdef ZMODEM int zmodem_mode = 0; char *zmodem_sendcmd; char *zmodem_recvcmd; static char *zmodes[4] = {"off", "auto", "catch", "pass"}; -#endif int idletimo; struct action idleaction; -#ifdef BLANKER_PRG char **blankerprg; -#endif struct action ktab[256 + KMAP_KEYS]; /* command key translation table */ struct kclass { @@ -230,14 +198,12 @@ struct kclass { }; struct kclass *kclasses; -#ifdef MAPKEYS struct action umtab[KMAP_KEYS+KMAP_AKEYS]; struct action dmtab[KMAP_KEYS+KMAP_AKEYS]; struct action mmtab[KMAP_KEYS+KMAP_AKEYS]; struct kmap_ext *kmap_exts; int kmap_extn; static int maptimeout = 300; -#endif struct digraph { @@ -1633,9 +1599,7 @@ void InitKeytab() { register unsigned int i; -#ifdef MAPKEYS char *argarr[2]; -#endif for (i = 0; i < sizeof(ktab)/sizeof(*ktab); i++) { @@ -1643,7 +1607,6 @@ InitKeytab() ktab[i].args = noargs; ktab[i].argl = 0; } -#ifdef MAPKEYS for (i = 0; i < KMAP_KEYS+KMAP_AKEYS; i++) { umtab[i].nr = RC_ILLEGAL; @@ -1691,7 +1654,6 @@ InitKeytab() argarr[1] = 0; SaveAction(mmtab + i + (KMAPMDEFSTART - T_CAPS), RC_STUFF, argarr, 0); } -#endif ktab['h'].nr = RC_HARDCOPY; #ifdef BSDJOBS @@ -1720,12 +1682,8 @@ InitKeytab() ktab['W'].nr = RC_WIDTH; ktab['.'].nr = RC_DUMPTERMCAP; ktab[Ctrl('\\')].nr = RC_QUIT; -#ifdef DETACH ktab['d'].nr = ktab[Ctrl('d')].nr = RC_DETACH; -# ifdef POW_DETACH ktab['D'].nr = RC_POW_DETACH; -# endif -#endif ktab['r'].nr = ktab[Ctrl('r')].nr = RC_WRAP; ktab['f'].nr = ktab[Ctrl('f')].nr = RC_FLOW; ktab['C'].nr = RC_CLEAR; @@ -1733,9 +1691,7 @@ InitKeytab() ktab['H'].nr = RC_LOG; ktab['M'].nr = RC_MONITOR; ktab['?'].nr = RC_HELP; -#ifdef MULTI ktab['*'].nr = RC_DISPLAYS; -#endif { char *args[2]; args[0] = "-"; @@ -1759,7 +1715,6 @@ InitKeytab() } ktab[Ctrl('G')].nr = RC_VBELL; ktab[':'].nr = RC_COLON; -#ifdef COPY_PASTE ktab['['].nr = ktab[Ctrl('[')].nr = RC_COPY; { char *args[2]; @@ -1773,17 +1728,12 @@ InitKeytab() ktab['>'].nr = RC_WRITEBUF; ktab['<'].nr = RC_READBUF; ktab['='].nr = RC_REMOVEBUF; -#endif /* co-opting "^A [<>=]", looking for alternatives */ ktab['>'].nr = ktab[Ctrl('.')].nr = RC_BUMPRIGHT; ktab['<'].nr = ktab[Ctrl(',')].nr = RC_BUMPLEFT; ktab['='].nr = RC_COLLAPSE; -#ifdef POW_DETACH ktab['D'].nr = RC_POW_DETACH; -#endif -#ifdef LOCK ktab['x'].nr = ktab[Ctrl('x')].nr = RC_LOCKSCREEN; -#endif ktab['b'].nr = ktab[Ctrl('b')].nr = RC_BREAK; ktab['B'].nr = RC_POW_BREAK; ktab['_'].nr = RC_SILENCE; @@ -1883,7 +1833,6 @@ ClearAction(struct action *act) * the layer on canvas D_forecv. */ -#ifdef MAPKEYS /* * This ProcessInput just does the keybindings and passes @@ -2020,9 +1969,6 @@ ProcessInput(char *ibuf, int ilen) ProcessInput2(ibuf, slen); } -#else -# define ProcessInput2 ProcessInput -#endif /* @@ -2095,7 +2041,6 @@ DoProcess(struct win *p, char **bufp, int *lenp, struct paster *pa) int oldlen; struct display *d = display; -#ifdef COPY_PASTE /* XXX -> PasteStart */ if (pa && *lenp > 1 && p && p->w_slowpaste) { @@ -2104,10 +2049,8 @@ DoProcess(struct win *p, char **bufp, int *lenp, struct paster *pa) evenq(&p->w_paster.pa_slowev); return; } -#endif while (flayer && *lenp) { -#ifdef COPY_PASTE if (!pa && p && p->w_paster.pa_pastelen && flayer == p->w_paster.pa_pastelayer) { debug("layer is busy - beep!\n"); @@ -2117,13 +2060,10 @@ DoProcess(struct win *p, char **bufp, int *lenp, struct paster *pa) display = d; return; } -#endif oldlen = *lenp; LayProcess(bufp, lenp); -#ifdef COPY_PASTE if (pa && !pa->pa_pastelayer) break; /* flush rest of paste */ -#endif if (*lenp == oldlen) { if (pa) @@ -2140,10 +2080,8 @@ DoProcess(struct win *p, char **bufp, int *lenp, struct paster *pa) *bufp += *lenp; *lenp = 0; display = d; -#ifdef COPY_PASTE if (pa && pa->pa_pastelen == 0) FreePaster(pa); -#endif } int @@ -2338,7 +2276,6 @@ DoAction(struct action *act, int key) } if ((argc = CheckArgNum(nr, args)) < 0) return; -#ifdef MULTIUSER if (display) { if (AclCheckPermCmd(D_user, ACL_EXEC, &comms[nr])) @@ -2349,7 +2286,6 @@ DoAction(struct action *act, int key) return; } } -#endif /* MULTIUSER */ msgok = display && !*rc_name; switch(nr) @@ -2380,7 +2316,6 @@ DoAction(struct action *act, int key) else if (queryflag >= 0) queryflag = -1; /* ParseWinNum already prints out an appropriate error message. */ break; -#ifdef AUTO_NUKE case RC_DEFAUTONUKE: if (ParseOnOff(act, &defautonuke) == 0 && msgok) OutputMsg(0, "Default autonuke turned %s", defautonuke ? "on" : "off"); @@ -2391,7 +2326,6 @@ DoAction(struct action *act, int key) if (ParseOnOff(act, &D_auto_nuke) == 0 && msgok) OutputMsg(0, "Autonuke turned %s", D_auto_nuke ? "on" : "off"); break; -#endif case RC_DEFOBUFLIMIT: if (ParseNum(act, &defobuflimit) == 0 && msgok) OutputMsg(0, "Default limit set to %d", defobuflimit); @@ -2464,22 +2398,16 @@ DoAction(struct action *act, int key) if (key >= 0) { -#ifdef PSEUDOS Input(fore->w_pwin ? "Really kill this filter [y/n]" : "Really kill this window [y/n]", 1, INP_RAW, confirm_fn, NULL, RC_KILL); -#else - Input("Really kill this window [y/n]", 1, INP_RAW, confirm_fn, NULL, RC_KILL); -#endif break; } n = fore->w_number; -#ifdef PSEUDOS if (fore->w_pwin) { FreePseudowin(fore); OutputMsg(0, "Filter removed."); break; } -#endif name = SaveStr(fore->w_title); KillWindow(fore); OutputMsg(0, "Window %d (%s) killed.", n, name); @@ -2495,14 +2423,12 @@ DoAction(struct action *act, int key) } Finit(0); /* NOTREACHED */ -#ifdef DETACH case RC_DETACH: if (*args && !strcmp(*args, "-h")) Hangup(); else Detach(D_DETACH); break; -# ifdef POW_DETACH case RC_POW_DETACH: if (key >= 0) { @@ -2514,8 +2440,6 @@ DoAction(struct action *act, int key) else Detach(D_POWER); /* detach and kill Attacher's parent */ break; -# endif -#endif case RC_DEBUG: #ifdef DEBUG if (!*args) @@ -2544,7 +2468,6 @@ DoAction(struct action *act, int key) OutputMsg(0, "Sorry, screen was compiled without -DDEBUG option."); #endif break; -#ifdef ZMODEM case RC_ZMODEM: if (*args && !strcmp(*args, "sendcmd")) { @@ -2585,7 +2508,6 @@ DoAction(struct action *act, int key) if (msgok) OutputMsg(0, "zmodem mode is %s", zmodes[zmodem_mode]); break; -#endif case RC_UNBINDALL: { register unsigned int i; @@ -2623,11 +2545,7 @@ DoAction(struct action *act, int key) } break; case RC_WALL: -#ifdef MULTIUSER s = D_user->u_name; -#else - s = D_usertty; -#endif { struct display *olddisplay = display; display = 0; /* no display will cause a broadcast */ @@ -2639,13 +2557,9 @@ DoAction(struct action *act, int key) /* where this AT command comes from: */ if (!user) break; -#ifdef MULTIUSER s = SaveStr(user->u_name); /* DO NOT RETURN FROM HERE WITHOUT RESETTING THIS: */ EffectiveAclUser = user; -#else - s = SaveStr(display ? D_usertty : user->u_name); -#endif n = strlen(args[0]); if (n) n--; /* @@ -2797,14 +2711,10 @@ DoAction(struct action *act, int key) } } free(s); -#ifdef MULTIUSER EffectiveAclUser = NULL; -#endif break; -#ifdef COPY_PASTE case RC_READREG: -#ifdef ENCODINGS i = fore ? fore->w_encoding : display ? display->d_encoding : 0; if (args[0] && args[1] && !strcmp(args[0], "-e")) { @@ -2816,7 +2726,6 @@ DoAction(struct action *act, int key) } args += 2; } -#endif /* * Without arguments we prompt for a destination register. * It will receive the copybuffer contents. @@ -2852,9 +2761,7 @@ DoAction(struct action *act, int key) free(pp->buf); pp->buf = s; pp->len = n; -#ifdef ENCODINGS pp->enc = i; -#endif } } else @@ -2865,9 +2772,7 @@ DoAction(struct action *act, int key) */ copy_reg_fn(&ch, 0, NULL); break; -#endif case RC_REGISTER: -#ifdef ENCODINGS i = fore ? fore->w_encoding : display ? display->d_encoding : 0; if (args[0] && args[1] && !strcmp(args[0], "-e")) { @@ -2880,7 +2785,6 @@ DoAction(struct action *act, int key) args += 2; argc -= 2; } -#endif if (argc != 2) { OutputMsg(0, "%s: register: illegal number of arguments.", rc_name); @@ -2892,7 +2796,6 @@ DoAction(struct action *act, int key) break; } ch = args[0][0]; -#ifdef COPY_PASTE if (ch == '.') { if (user->u_plop.buf != NULL) @@ -2901,13 +2804,10 @@ DoAction(struct action *act, int key) { user->u_plop.buf = SaveStrn(args[1], argl[1]); user->u_plop.len = argl[1]; -#ifdef ENCODINGS user->u_plop.enc = i; -#endif } } else -#endif { struct plop *plp = plop_tab + (int)(unsigned char)ch; @@ -2915,9 +2815,7 @@ DoAction(struct action *act, int key) free(plp->buf); plp->buf = SaveStrn(args[1], argl[1]); plp->len = argl[1]; -#ifdef ENCODINGS plp->enc = i; -#endif } break; case RC_PROCESS: @@ -2958,10 +2856,8 @@ DoAction(struct action *act, int key) OutputMsg(0, "%s: stuff: unknown key '%s'", rc_name, s); break; } -#ifdef MAPKEYS if (StuffKey(i - T_CAPS) == 0) break; -#endif s = display ? D_tcs[i].str : 0; if (s == 0) break; @@ -3085,11 +2981,9 @@ DoAction(struct action *act, int key) break; SendBreak(fore, n, nr == RC_POW_BREAK); break; -#ifdef LOCK case RC_LOCKSCREEN: Detach(D_LOCK); break; -#endif case RC_WIDTH: case RC_HEIGHT: { @@ -3280,7 +3174,6 @@ DoAction(struct action *act, int key) OutputMsg(0, "%cflow%s", (fore->w_flow & FLOW_NOW) ? '+' : '-', (fore->w_flow & FLOW_AUTOFLAG) ? "(auto)" : ""); break; -#ifdef MULTIUSER case RC_DEFWRITELOCK: if (args[0][0] == 'a') nwin_default.wlock = WLOCK_AUTO; @@ -3314,43 +3207,35 @@ DoAction(struct action *act, int key) OutputMsg(0, "writelock %s", (fore->w_wlock == WLOCK_AUTO) ? "auto" : ((fore->w_wlock == WLOCK_OFF) ? "off" : "on")); break; -#endif case RC_CLEAR: ResetAnsiState(fore); WriteString(fore, "\033[H\033[J", 6); break; case RC_RESET: ResetAnsiState(fore); -#ifdef ZMODEM if (fore->w_zdisplay) zmodem_abort(fore, fore->w_zdisplay); -#endif WriteString(fore, "\033c", 2); break; case RC_MONITOR: n = fore->w_monitor != MON_OFF; -#ifdef MULTIUSER if (display) n = n && (ACLBYTE(fore->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id)); -#endif if (ParseSwitch(act, &n)) break; if (n) { -#ifdef MULTIUSER if (display) /* we tell only this user */ ACLBYTE(fore->w_mon_notify, D_user->u_id) |= ACLBIT(D_user->u_id); else for (i = 0; i < maxusercount; i++) ACLBYTE(fore->w_mon_notify, i) |= ACLBIT(i); -#endif if (fore->w_monitor == MON_OFF) fore->w_monitor = MON_ON; OutputMsg(0, "Window %d (%s) is now being monitored for all activity.", fore->w_number, fore->w_title); } else { -#ifdef MULTIUSER if (display) /* we remove only this user */ ACLBYTE(fore->w_mon_notify, D_user->u_id) &= ~ACLBIT(D_user->u_id); @@ -3361,16 +3246,13 @@ DoAction(struct action *act, int key) if (ACLBYTE(fore->w_mon_notify, i)) break; if (i < 0) -#endif fore->w_monitor = MON_OFF; OutputMsg(0, "Window %d (%s) is no longer being monitored for activity.", fore->w_number, fore->w_title); } break; -#ifdef MULTI case RC_DISPLAYS: display_displays(); break; -#endif case RC_WINDOWLIST: if (!*args) display_windows(0, WLIST_NUM, (struct win *)0); @@ -3435,7 +3317,6 @@ DoAction(struct action *act, int key) case RC_LICENSE: display_copyright(); break; -#ifdef COPY_PASTE case RC_COPY: if (flayer->l_layfn != &WinLf) { @@ -3467,9 +3348,7 @@ DoAction(struct action *act, int key) { char *ss, *dbuf, dch; int l = 0; -# ifdef ENCODINGS int enc = -1; -# endif /* * without args we prompt for one(!) register to be pasted in the window @@ -3491,10 +3370,8 @@ DoAction(struct action *act, int key) rc_name); break; } -# ifdef ENCODINGS else if (fore) enc = fore->w_encoding; -# endif /* * measure length of needed buffer @@ -3503,24 +3380,20 @@ DoAction(struct action *act, int key) { if (ch == '.') { -# ifdef ENCODINGS if (enc == -1) enc = user->u_plop.enc; if (enc != user->u_plop.enc) l += RecodeBuf((unsigned char *)user->u_plop.buf, user->u_plop.len, user->u_plop.enc, enc, (unsigned char *)0); else -# endif l += user->u_plop.len; } else { -# ifdef ENCODINGS if (enc == -1) enc = plop_tab[(int)(unsigned char)ch].enc; if (enc != plop_tab[(int)(unsigned char)ch].enc) l += RecodeBuf((unsigned char *)plop_tab[(int)(unsigned char)ch].buf, plop_tab[(int)(unsigned char)ch].len, plop_tab[(int)(unsigned char)ch].enc, enc, (unsigned char *)0); else -# endif l += plop_tab[(int)(unsigned char)ch].len; } } @@ -3535,9 +3408,7 @@ DoAction(struct action *act, int key) * pass a pointer rather than duplicating the buffer. */ if (s[1] == 0 && args[1] == 0) -# ifdef ENCODINGS if (enc == (*s == '.' ? user->u_plop.enc : plop_tab[(int)(unsigned char)*s].enc)) -# endif { MakePaster(&fore->w_paster, *s == '.' ? user->u_plop.buf : plop_tab[(int)(unsigned char)*s].buf, l, 0); break; @@ -3558,13 +3429,11 @@ DoAction(struct action *act, int key) for (ss = s; (ch = *ss); ss++) { struct plop *pp = (ch == '.' ? &user->u_plop : &plop_tab[(int)(unsigned char)ch]); -#ifdef ENCODINGS if (pp->enc != enc) { l += RecodeBuf((unsigned char *)pp->buf, pp->len, pp->enc, enc, (unsigned char *)dbuf + l); continue; } -#endif bcopy(pp->buf, dbuf + l, pp->len); l += pp->len; } @@ -3588,9 +3457,7 @@ DoAction(struct action *act, int key) UserFreeCopyBuffer(user); user->u_plop.buf = dbuf; user->u_plop.len = l; -#ifdef ENCODINGS user->u_plop.enc = enc; -#endif } else { @@ -3599,9 +3466,7 @@ DoAction(struct action *act, int key) free(pp->buf); pp->buf = dbuf; pp->len = l; -#ifdef ENCODINGS pp->enc = enc; -#endif } } break; @@ -3612,7 +3477,6 @@ DoAction(struct action *act, int key) OutputMsg(0, "empty buffer"); break; } -#ifdef ENCODINGS { struct plop oldplop; @@ -3643,20 +3507,16 @@ DoAction(struct action *act, int key) } args += 2; } -#endif if (args[0] && args[1]) OutputMsg(0, "%s: writebuf: too many arguments", rc_name); else WriteFile(user, args[0], DUMP_EXCHANGE); -#ifdef ENCODINGS if (user->u_plop.buf != oldplop.buf) free(user->u_plop.buf); user->u_plop = oldplop; } -#endif break; case RC_READBUF: -#ifdef ENCODINGS i = fore ? fore->w_encoding : display ? display->d_encoding : 0; if (args[0] && args[1] && !strcmp(args[0], "-e")) { @@ -3668,7 +3528,6 @@ DoAction(struct action *act, int key) } args += 2; } -#endif if (args[0] && args[1]) { OutputMsg(0, "%s: readbuf: too many arguments", rc_name); @@ -3680,9 +3539,7 @@ DoAction(struct action *act, int key) UserFreeCopyBuffer(user); user->u_plop.len = n; user->u_plop.buf = s; -#ifdef ENCODINGS user->u_plop.enc = i; -#endif } break; case RC_REMOVEBUF: @@ -3693,7 +3550,6 @@ DoAction(struct action *act, int key) if (msgok) OutputMsg(0, "Will %signore case in searches", search_ic ? "" : "not "); break; -#endif /* COPY_PASTE */ case RC_ESCAPE: if (*argl == 0) SetEscape(user, -1, -1); @@ -3720,9 +3576,7 @@ DoAction(struct action *act, int key) OutputMsg(0, "%s: two characters required after defescape.", rc_name); break; } -#ifdef MAPKEYS CheckEscape(); -#endif break; case RC_CHDIR: s = *args ? *args : home; @@ -3852,7 +3706,6 @@ DoAction(struct action *act, int key) } (void)ParseSaveStr(act, &BellString); break; -#ifdef COPY_PASTE case RC_BUFFERFILE: if (*args == 0) BufferFile = SaveStr(DEFAULT_BUFFERFILE); @@ -3861,11 +3714,9 @@ DoAction(struct action *act, int key) if (msgok) OutputMsg(0, "Bufferfile is now '%s'", BufferFile); break; -#endif case RC_ACTIVITY: (void)ParseSaveStr(act, &ActivityString); break; -#if defined(DETACH) && defined(POW_DETACH) case RC_POW_DETACH_MSG: if (*args == 0) { @@ -3876,7 +3727,6 @@ DoAction(struct action *act, int key) } (void)ParseSaveStr(act, &PowDetachString); break; -#endif #if defined(UTMPOK) && defined(LOGOUTOK) case RC_LOGIN: n = fore->w_slot != (slot_t)-1; @@ -3934,11 +3784,9 @@ DoAction(struct action *act, int key) case RC_DEFC1: (void)ParseOnOff(act, &nwin_default.c1); break; -#ifdef COLOR case RC_DEFBCE: (void)ParseOnOff(act, &nwin_default.bce); break; -#endif case RC_DEFGR: (void)ParseOnOff(act, &nwin_default.gr); break; @@ -4188,13 +4036,11 @@ DoAction(struct action *act, int key) break; if (n) { -#ifdef MULTIUSER if (display) /* we tell only this user */ ACLBYTE(fore->w_lio_notify, D_user->u_id) |= ACLBIT(D_user->u_id); else for (n = 0; n < maxusercount; n++) ACLBYTE(fore->w_lio_notify, n) |= ACLBIT(n); -#endif fore->w_silencewait = i; fore->w_silence = SILENCE_ON; SetTimeout(&fore->w_silenceev, fore->w_silencewait * 1000); @@ -4206,7 +4052,6 @@ DoAction(struct action *act, int key) } else { -#ifdef MULTIUSER if (display) /* we remove only this user */ ACLBYTE(fore->w_lio_notify, D_user->u_id) &= ~ACLBIT(D_user->u_id); @@ -4217,7 +4062,6 @@ DoAction(struct action *act, int key) if (ACLBYTE(fore->w_lio_notify, i)) break; if (i < 0) -#endif { fore->w_silence = SILENCE_OFF; evdeq(&fore->w_silenceev); @@ -4227,7 +4071,6 @@ DoAction(struct action *act, int key) OutputMsg(0, "The window is no longer being monitored for silence."); } break; -#ifdef COPY_PASTE case RC_DEFSCROLLBACK: (void)ParseNum(act, &nwin_default.histheight); break; @@ -4242,7 +4085,6 @@ DoAction(struct action *act, int key) if (msgok) OutputMsg(0, "scrollback set to %d", fore->w_histheight); break; -#endif case RC_SESSIONNAME: if (*args == 0) OutputMsg(0, "This session is named '%s'\n", SockName); @@ -4294,7 +4136,6 @@ DoAction(struct action *act, int key) unsetenv(*args); MakeNewEnv(); break; -#ifdef COPY_PASTE case RC_DEFSLOWPASTE: (void)ParseNum(act, &nwin_default.slow); break; @@ -4318,12 +4159,10 @@ DoAction(struct action *act, int key) } debug1("markkeys %s\n", *args); break; -# ifdef FONT case RC_PASTEFONT: if (ParseSwitch(act, &pastefont) == 0 && msgok) OutputMsg(0, "Will %spaste font settings", pastefont ? "" : "not "); break; -# endif case RC_CRLF: (void)ParseSwitch(act, &join_with_cr); break; @@ -4331,7 +4170,6 @@ DoAction(struct action *act, int key) if (ParseSwitch(act, &compacthist) == 0 && msgok) OutputMsg(0, "%scompacting history lines", compacthist ? "" : "not "); break; -#endif #ifdef NETHACK case RC_NETHACK: (void)ParseOnOff(act, &nethackflag); @@ -4373,7 +4211,6 @@ DoAction(struct action *act, int key) case RC_STARTUP_MESSAGE: (void)ParseOnOff(act, &default_startup); break; -#ifdef PASSWORD case RC_PASSWORD: if (*args) { @@ -4398,7 +4235,6 @@ DoAction(struct action *act, int key) Input("New screen password:", 100, INP_NOECHO, pass1, display ? (char *)D_user : (char *)users, 0); } break; -#endif /* PASSWORD */ case RC_BIND: { struct action *ktabp = ktab; @@ -4425,7 +4261,6 @@ DoAction(struct action *act, int key) else break; } -#ifdef MAPKEYS if (kflag) { for (n = 0; n < KMAP_KEYS; n++) @@ -4439,7 +4274,6 @@ DoAction(struct action *act, int key) n += 256; } else -#endif if (*argl != 1) { OutputMsg(0, "%s: bind: character, ^x, or (octal) \\032 expected.", rc_name); @@ -4464,7 +4298,6 @@ DoAction(struct action *act, int key) ClearAction(&ktabp[n]); } break; -#ifdef MAPKEYS case RC_BINDKEY: { struct action *newact; @@ -4635,8 +4468,6 @@ DoAction(struct action *act, int key) case RC_MAPDEFAULT: D_mapdefault = 1; break; -#endif -#ifdef MULTIUSER case RC_ACLCHG: case RC_ACLADD: case RC_ADDACL: @@ -4725,13 +4556,9 @@ DoAction(struct action *act, int key) if (msgok) OutputMsg(0, "Multiuser mode %s", multi ? "enabled" : "disabled"); break; -#endif /* MULTIUSER */ -#ifdef PSEUDOS case RC_EXEC: winexec(args); break; -#endif -#ifdef MULTI case RC_NONBLOCK: i = D_nonblock >= 0; if (*args && ((args[0][0] >= '0' && args[0][0] <= '9') || args[0][0] == '.')) @@ -4770,33 +4597,24 @@ DoAction(struct action *act, int key) evdeq(&D_blockedev); } break; -#endif case RC_GR: -#ifdef ENCODINGS if (fore->w_gr == 2) fore->w_gr = 0; -#endif if (ParseSwitch(act, &fore->w_gr) == 0 && msgok) OutputMsg(0, "Will %suse GR", fore->w_gr ? "" : "not "); -#ifdef ENCODINGS if (fore->w_gr == 0 && fore->w_FontE) fore->w_gr = 2; -#endif break; case RC_C1: if (ParseSwitch(act, &fore->w_c1) == 0 && msgok) OutputMsg(0, "Will %suse C1", fore->w_c1 ? "" : "not "); break; -#ifdef COLOR case RC_BCE: if (ParseSwitch(act, &fore->w_bce) == 0 && msgok) OutputMsg(0, "Will %serase with background color", fore->w_bce ? "" : "not "); break; -#endif -#ifdef ENCODINGS case RC_KANJI: case RC_ENCODING: -#ifdef UTF8 if (*args && !strcmp(args[0], "-d")) { if (!args[1]) @@ -4818,14 +4636,6 @@ DoAction(struct action *act, int key) OutputMsg(0, "encoding: utf8 encoding file loaded"); break; } -#else - if (*args && (!strcmp(args[0], "-l") || !strcmp(args[0], "-d"))) - { - if (msgok) - OutputMsg(0, "encoding: screen is not compiled for UTF-8."); - break; - } -#endif for (i = 0; i < 2; i++) { if (args[i] == 0) @@ -4857,9 +4667,6 @@ DoAction(struct action *act, int key) } nwin_default.encoding = n; break; -#endif - -#ifdef UTF8 case RC_DEFUTF8: n = nwin_default.encoding == UTF8; if (ParseSwitch(act, &n) == 0) @@ -4897,8 +4704,6 @@ DoAction(struct action *act, int key) break; } break; -#endif - case RC_PRINTCMD: if (*args) { @@ -4935,7 +4740,6 @@ DoAction(struct action *act, int key) { if (!args[1][1]) digraphs[i].value = (int)args[1][0]; -#ifdef UTF8 else { int t; @@ -4953,7 +4757,6 @@ DoAction(struct action *act, int key) break; } } -#endif } } break; @@ -4994,7 +4797,6 @@ DoAction(struct action *act, int key) WindowChanged(fore, 'h'); break; -#ifdef FONT case RC_DEFCHARSET: case RC_CHARSET: if (*args == 0) @@ -5028,8 +4830,6 @@ DoAction(struct action *act, int key) free(nwin_default.charset); nwin_default.charset = SaveStr(*args); break; -#endif -#ifdef COLOR case RC_ATTRCOLOR: s = args[0]; if (*s >= '0' && *s <= '9') @@ -5069,7 +4869,6 @@ DoAction(struct action *act, int key) n |= 1 << i; nattr2color = n; break; -#endif case RC_RENDITION: i = -1; if (strcmp(args[0], "bell") == 0) @@ -5116,18 +4915,13 @@ DoAction(struct action *act, int key) debug2("--> %x %x\n", mchar_so.attr, mchar_so.color); } if (msgok) -#ifdef COLOR OutputMsg(0, "Standout attributes 0x%02x color 0x%02x", (unsigned char)mchar_so.attr, 0x99 ^ (unsigned char)mchar_so.color); -#else - OutputMsg(0, "Standout attributes 0x%02x ", (unsigned char)mchar_so.attr); -#endif break; case RC_SOURCE: do_source(*args); break; -#ifdef MULTIUSER case RC_SU: s = NULL; if (!*args) @@ -5144,7 +4938,6 @@ DoAction(struct action *act, int key) if (s) OutputMsg(0, "%s", s); break; -#endif /* MULTIUSER */ case RC_SPLIT: s = args[0]; if (s && !strcmp(s, "-v")) @@ -5295,18 +5088,15 @@ DoAction(struct action *act, int key) WindowChanged(0, '`'); break; case RC_BLANKER: -#ifdef BLANKER_PRG if (blankerprg) { RunBlanker(blankerprg); break; } -#endif ClearAll(); CursorVisibility(-1); D_blocked = 4; break; -#ifdef BLANKER_PRG case RC_BLANKERPRG: if (!args[0]) { @@ -5334,7 +5124,6 @@ DoAction(struct action *act, int key) if (args[0][0]) blankerprg = SaveArgs(args); break; -#endif case RC_IDLE: if (*args) { @@ -5657,7 +5446,6 @@ DoAction(struct action *act, int key) else OutputMsg(0, "unknown layout subcommand"); break; -#ifdef DW_CHARS case RC_CJKWIDTH: if(ParseSwitch(act, &cjkwidth) == 0) { @@ -5665,7 +5453,6 @@ DoAction(struct action *act, int key) OutputMsg(0, "Treat ambiguous width characters as %s width", cjkwidth ? "full" : "half"); } break; -#endif default: break; } @@ -5799,7 +5586,6 @@ Parse(char *buf, int bufl, char **args, int *argl) *lp = 0; while (*p && (*p == ' ' || *p == '\t')) ++p; -#ifdef PSEUDOS if (argc == 0 && *p == '!') { *ap++ = "exec"; @@ -5808,7 +5594,6 @@ Parse(char *buf, int bufl, char **args, int *argl) argc++; continue; } -#endif if (*p == '\0' || *p == '#' || *p == '\n') { *p = '\0'; @@ -6289,13 +6074,11 @@ SwitchWindow(int n) Msg(0, "This IS window %d (%s).", n, p->w_title); return; } -#ifdef MULTIUSER if (AclCheckPermWin(D_user, ACL_READ, p)) { Msg(0, "Access to window %d denied.", p->w_number); return; } -#endif SetForeWindow(p); Activate(fore->w_norefresh); } @@ -6458,13 +6241,11 @@ KillWindow(struct win *win) } if (gotone) { -#ifdef ZMODEM if (win->w_zdisplay == display) { D_blocked = 0; D_readev.condpos = D_readev.condneg = 0; } -#endif Activate(-1); } } @@ -6596,9 +6377,7 @@ AddWindowFlags(char *buf, int len, struct win *p) if (p->w_layer.l_cvlist && p->w_layer.l_cvlist->c_lnext) *s++ = '&'; if (p->w_monitor == MON_DONE -#ifdef MULTIUSER && (ACLBYTE(p->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id)) -#endif ) *s++ = '@'; if (p->w_bell == BELL_DONE) @@ -6700,9 +6479,7 @@ ShowInfo() *p++ = ' '; sprintf(p, "(%d,%d)/(%d,%d)", wp->w_x + 1, wp->w_y + 1, wp->w_width, wp->w_height); -#ifdef COPY_PASTE sprintf(p += strlen(p), "+%d", wp->w_histheight); -#endif sprintf(p += strlen(p), " %c%sflow", (wp->w_flow & FLOW_NOW) ? '+' : '-', (wp->w_flow & FLOW_AUTOFLAG) ? "" : @@ -6713,31 +6490,22 @@ ShowInfo() if (wp->w_keypad) sprintf(p += strlen(p), " app"); if (wp->w_log) sprintf(p += strlen(p), " log"); if (wp->w_monitor != MON_OFF -#ifdef MULTIUSER && (ACLBYTE(wp->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id)) -#endif ) sprintf(p += strlen(p), " mon"); if (wp->w_mouse) sprintf(p += strlen(p), " mouse"); -#ifdef COLOR if (wp->w_bce) sprintf(p += strlen(p), " bce"); -#endif if (!wp->w_c1) sprintf(p += strlen(p), " -c1"); if (wp->w_norefresh) sprintf(p += strlen(p), " nored"); p += strlen(p); -#ifdef FONT -# ifdef ENCODINGS if (wp->w_encoding && (display == 0 || D_encoding != wp->w_encoding || EncodingDefFont(wp->w_encoding) <= 0)) { *p++ = ' '; strcpy(p, EncodingName(wp->w_encoding)); p += strlen(p); } -# ifdef UTF8 if (wp->w_encoding != UTF8) -# endif -# endif if (D_CC0 || (D_CS0 && *D_CS0)) { if (wp->w_gr == 2) @@ -6774,7 +6542,6 @@ ShowInfo() *p++ = ']'; *p = 0; } -#endif if (wp->w_type == W_TYPE_PLAIN) { @@ -6801,27 +6568,22 @@ ShowDInfo() p = buf; sprintf(p, "(%d,%d)", D_width, D_height), p += strlen(p); -#ifdef ENCODINGS if (D_encoding) { *p++ = ' '; strcpy(p, EncodingName(D_encoding)); p += strlen(p); } -#endif if (D_CXT) { strcpy(p, " xterm"); p += strlen(p); } -#ifdef COLOR if (D_hascolor) { strcpy(p, " color"); p += strlen(p); } -#endif -#ifdef FONT if (D_CG0) { strcpy(p, " iso2022"); @@ -6832,7 +6594,6 @@ ShowDInfo() strcpy(p, " altchar"); p += strlen(p); } -#endif Msg(0, "%s", buf); } @@ -7152,7 +6913,6 @@ DoScreen(char *fn, char **av) MakeWindow(&nwin); } -#ifdef COPY_PASTE /* * CompileKeys must be called before Markroutine is first used. * to initialise the keys with defaults, call CompileKeys(NULL, mark_key_tab); @@ -7197,13 +6957,11 @@ CompileKeys(char *s, int sl, unsigned char *array) } return 0; } -#endif /* COPY_PASTE */ /* * Asynchronous input functions */ -#if defined(DETACH) && defined(POW_DETACH) static void pow_detach_fn(char *buf, int len, char *data) { @@ -7222,9 +6980,7 @@ pow_detach_fn(char *buf, int len, char *data) else Detach(D_POWER); } -#endif /* POW_DETACH */ -#ifdef COPY_PASTE static void copy_reg_fn(char *buf, int len, char *data) { @@ -7249,9 +7005,7 @@ copy_reg_fn(char *buf, int len, char *data) bcopy(D_user->u_plop.buf, pp->buf, D_user->u_plop.len); } pp->len = D_user->u_plop.len; -#ifdef ENCODINGS pp->enc = D_user->u_plop.enc; -#endif Msg(0, "Copied %d characters into register %c", D_user->u_plop.len, *buf); } @@ -7276,7 +7030,6 @@ ins_reg_fn(char *buf, int len, char *data) } Msg(0, "Empty register."); } -#endif /* COPY_PASTE */ static void process_fn(char *buf, int len, char *data) @@ -7313,7 +7066,6 @@ confirm_fn(char *buf, int len, char *data) DoAction(&act, -1); } -#ifdef MULTIUSER struct inputsu { struct acluser **up; @@ -7366,9 +7118,6 @@ InputSu(struct win *win, struct acluser **up, char *name) su_fin((char *)0, 0, (char *)i); return 0; } -#endif /* MULTIUSER */ - -#ifdef PASSWORD static void pass1(char *buf, int len, char *data) @@ -7426,13 +7175,10 @@ pass2(char *buf, int len, char *data) } u->u_password = SaveStr(buf); bzero(buf, strlen(buf)); -#ifdef COPY_PASTE if (u->u_plop.buf) UserFreeCopyBuffer(u); u->u_plop.len = strlen(u->u_password); -# ifdef ENCODINGS u->u_plop.enc = 0; -#endif if (!(u->u_plop.buf = SaveStr(u->u_password))) { Msg(0, "%s", strnomem); @@ -7440,12 +7186,8 @@ pass2(char *buf, int len, char *data) } else Msg(0, "[ Password moved into copybuffer ]"); -#else /* COPY_PASTE */ - Msg(0, "[ Crypted password is \"%s\" ]", u->u_password); -#endif /* COPY_PASTE */ } } -#endif /* PASSWORD */ static int digraph_find(const char *buf) @@ -7516,15 +7258,12 @@ digraph_fn(char *buf, int len, char *data) } i = 1; *buf = x; -#ifdef UTF8 if (flayer->l_encoding == UTF8) i = ToUtf8(buf, x); /* buf is big enough for all UTF-8 codes */ -#endif while(i) LayProcess(&buf, &i); } -#ifdef MAPKEYS int StuffKey(int i) { @@ -7559,10 +7298,8 @@ StuffKey(int i) flayer = D_forecv->c_layer; fore = D_fore; act = 0; -#ifdef COPY_PASTE if (flayer && flayer->l_mode == 1) act = i < KMAP_KEYS+KMAP_AKEYS ? &mmtab[i] : &kmap_exts[i - (KMAP_KEYS+KMAP_AKEYS)].mm; -#endif if ((!act || act->nr == RC_ILLEGAL) && !D_mapdefault) act = i < KMAP_KEYS+KMAP_AKEYS ? &umtab[i] : &kmap_exts[i - (KMAP_KEYS+KMAP_AKEYS)].um; if (!act || act->nr == RC_ILLEGAL) @@ -7587,7 +7324,6 @@ StuffKey(int i) DoAction(act, 0); return 0; } -#endif static int @@ -7615,15 +7351,12 @@ FindNiceWindow(struct win *win, char *presel) } if (!display) return win; -#ifdef MULTIUSER if (win && AclCheckPermWin(D_user, ACL_READ, win)) win = 0; -#endif if (!win || (IsOnDisplay(win) && !presel)) { /* try to get another window */ win = 0; -#ifdef MULTIUSER for (win = windows; win; win = win->w_next) if (!win->w_layer.l_cvlist && !AclCheckPermWin(D_user, ACL_WRITE, win)) break; @@ -7639,7 +7372,6 @@ FindNiceWindow(struct win *win, char *presel) for (win = windows; win; win = win->w_next) if (win->w_layer.l_cvlist && !IsOnDisplay(win) && !AclCheckPermWin(D_user, ACL_READ, win)) break; -#endif if (!win) for (win = windows; win; win = win->w_next) if (!win->w_layer.l_cvlist) @@ -7649,10 +7381,8 @@ FindNiceWindow(struct win *win, char *presel) if (win->w_layer.l_cvlist && !IsOnDisplay(win)) break; } -#ifdef MULTIUSER if (win && AclCheckPermWin(D_user, ACL_READ, win)) win = 0; -#endif return win; } @@ -7939,18 +7669,14 @@ SetForeCanvas(struct display *d, struct canvas *cv) if (D_other == fore) D_other = 0; flayer = D_forecv->c_layer; -#ifdef RXVT_OSC if (D_xtermosc[2] || D_xtermosc[3]) { Activate(-1); } else -#endif { RefreshHStatus(); -#ifdef RXVT_OSC RefreshXtermOSC(); -#endif flayer = D_forecv->c_layer; CV_CALL(D_forecv, LayRestore();LaySetCursor()); WindowChanged(0, 'F'); @@ -7959,7 +7685,6 @@ SetForeCanvas(struct display *d, struct canvas *cv) display = odisplay; } -#ifdef RXVT_OSC void RefreshXtermOSC() { @@ -7970,7 +7695,6 @@ RefreshXtermOSC() for (i = 3; i >=0; i--) SetXtermOSC(i, p ? p->w_xtermosc[i] : 0); } -#endif int ParseAttrColor(char *s1, char *s2, int msgok) @@ -8079,7 +7803,6 @@ ParseAttrColor(char *s1, char *s2, int msgok) s++; } -#ifdef COLOR if (*s) { static char costr[] = "krgybmcw d i.01234567 9 f FKRGYBMCW I "; @@ -8105,18 +7828,14 @@ ParseAttrColor(char *s1, char *s2, int msgok) } numco++; n = n << 4 | (i & 15); -#ifdef COLORS16 if (i >= 48) n = (n & 0x20ff) | 0x200; -#endif s++; } if ((n & 0xf00) == 0xf00) n ^= 0xf00; /* clear superflous bits */ -#ifdef COLORS16 if (n & 0x2000) n ^= 0x2400; /* shift bit into right position */ -#endif if (numco == 1) n |= 0xf0; /* don't change bg color */ if (numco != 2 && n != 0xff) @@ -8130,7 +7849,6 @@ ParseAttrColor(char *s1, char *s2, int msgok) n ^= 0xff; r |= n << 16; } -#endif while (*s && *s == ' ') s++; @@ -8158,24 +7876,17 @@ ApplyAttrColor(int i, struct mchar *mc) debug1("ApplyAttrColor %06x\n", i); mc->attr |= i >> 8 & 255; mc->attr ^= i & 255; -#ifdef COLOR i = (i >> 16) ^ 0xff; if ((i & 0x100) != 0) { i &= 0xeff; if (mc->attr & (A_SO|A_RV)) -# ifdef COLORS16 i = ((i & 0x0f) << 4) | ((i & 0xf0) >> 4) | ((i & 0x200) << 1) | ((i & 0x400) >> 1); -# else - i = ((i & 0x0f) << 4) | ((i & 0xf0) >> 4); -# endif } -# ifdef COLORS16 if ((i & 0x0f) != 0x0f) mc->attr = (mc->attr & 0xbf) | ((i >> 3) & 0x40); if ((i & 0xf0) != 0xf0) mc->attr = (mc->attr & 0x7f) | ((i >> 3) & 0x80); -# endif mc->color = 0x99 ^ mc->color; if ((i & 0x0e) == 0x0e) i = (i & 0xf0) | (mc->color & 0x0f); @@ -8183,5 +7894,4 @@ ApplyAttrColor(int i, struct mchar *mc) i = (i & 0x0f) | (mc->color & 0xf0); mc->color = 0x99 ^ i; debug2("ApplyAttrColor - %02x %02x\n", mc->attr, i); -#endif } diff --git a/src/resize.c b/src/resize.c index 23426d4..b8af594 100644 --- a/src/resize.c +++ b/src/resize.c @@ -64,16 +64,10 @@ struct winsize glwz; static struct mline mline_zero = { (unsigned char *)0, + (unsigned char *)0, + (unsigned char *)0, + (unsigned char *)0, (unsigned char *)0 -#ifdef FONT - ,(unsigned char *)0 -#endif -#ifdef COLOR - ,(unsigned char *)0 -# ifdef COLORS256 - ,(unsigned char *)0 -# endif -#endif }; /* @@ -123,9 +117,7 @@ CheckScreenSize(int change_flag) debug("CheckScreenSize: No change -> return.\n"); return; } -#ifdef BLANKER_PRG KillBlanker(); -#endif ResetIdle(); ChangeScreenSize(wi, he, change_flag); } @@ -392,20 +384,14 @@ FreeMline(struct mline *ml) 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; } @@ -414,16 +400,10 @@ AllocMline(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; @@ -443,7 +423,6 @@ BcopyMline(struct mline *mlf, int xf, struct mline *mlt, int xt, int l, int w) } 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) @@ -458,8 +437,6 @@ BcopyMline(struct mline *mlf, int xf, struct mline *mlt, int xt, int l, int w) } 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) @@ -467,7 +444,6 @@ BcopyMline(struct mline *mlf, int xf, struct mline *mlt, int xt, int l, int w) } 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) @@ -475,8 +451,6 @@ BcopyMline(struct mline *mlf, int xf, struct mline *mlt, int xt, int l, int w) } if (mlt->colorx != null) bcopy((char *)mlf->colorx + xf, (char *)mlt->colorx + xt, l); -# endif -#endif return r; } @@ -501,16 +475,10 @@ CheckMaxSize(int wi) 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); @@ -521,20 +489,14 @@ CheckMaxSize(int wi) 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) @@ -559,10 +521,8 @@ CheckMaxSize(int wi) { 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); } @@ -590,23 +550,12 @@ MakeBlankLine(register unsigned char *p, register int n) } - - -#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(struct win *p, int wi, int he, int hi) @@ -676,7 +625,6 @@ ChangeWindowSize(struct win *p, int wi, int he, int hi) naka = p->w_autoaka; } } -#ifdef COPY_PASTE if (hi) { if ((nhlines = (struct mline *)calloc(hi, sizeof(struct mline))) == 0) @@ -686,7 +634,6 @@ ChangeWindowSize(struct win *p, int wi, int he, int hi) ty = he - 1; } } -#endif /* special case: cursor is at magic margin position */ addone = 0; @@ -864,11 +811,9 @@ ChangeWindowSize(struct win *p, int wi, int he, int hi) 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) @@ -889,10 +834,8 @@ ChangeWindowSize(struct win *p, int wi, int he, int hi) } 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); @@ -960,10 +903,8 @@ ChangeWindowSize(struct win *p, int wi, int he, int hi) /* 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) @@ -976,14 +917,12 @@ ChangeWindowSize(struct win *p, int wi, int he, int hi) { 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] >= ' '); } @@ -1005,7 +944,6 @@ FreeAltScreen(struct win *p) 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++) @@ -1015,7 +953,6 @@ FreeAltScreen(struct win *p) p->w_alt.hlines = 0; p->w_alt.histidx = 0; p->w_alt.histheight = 0; -#endif } static void @@ -1030,11 +967,9 @@ SwapAltScreen(struct win *p) SWAP(width, t); SWAP(height, t); -#ifdef COPY_PASTE SWAP(histheight, t); SWAP(hlines, ml); SWAP(histidx, t); -#endif #undef SWAP } diff --git a/src/screen.c b/src/screen.c index 48aa4c0..fe04539 100644 --- a/src/screen.c +++ b/src/screen.c @@ -69,10 +69,10 @@ #if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX) # include <compat.h> #endif -#if defined(USE_LOCALE) || defined(ENCODINGS) +#if defined(USE_LOCALE) # include <locale.h> #endif -#if defined(HAVE_NL_LANGINFO) && defined(ENCODINGS) +#if defined(HAVE_NL_LANGINFO) # include <langinfo.h> #endif @@ -85,9 +85,7 @@ * builtin lock is used. Therefore disable SHADOWPW if * we do not really need it (kind of security thing). */ -#ifndef LOCK -# undef SHADOWPW -#endif +#undef SHADOWPW #include <pwd.h> #ifdef SHADOWPW @@ -112,15 +110,11 @@ extern struct LayFuncs MarkLf; extern int visual_bell; -#ifdef COPY_PASTE extern unsigned char mark_key_tab[]; -#endif extern char version[]; extern char DefaultShell[]; -#ifdef ZMODEM extern char *zmodem_sendcmd; extern char *zmodem_recvcmd; -#endif extern struct layout *layout_last; @@ -183,12 +177,8 @@ char *hardcopydir = NULL; char *BellString; char *VisualBellString; char *ActivityString; -#ifdef COPY_PASTE char *BufferFile; -#endif -#ifdef POW_DETACH char *PowDetachString; -#endif char *hstatusstring; char *captionstring; char *timestring; @@ -200,7 +190,6 @@ int cmdflag; int queryflag = -1; int adaptflag; -#ifdef MULTIUSER char *multi; char *multi_home; int multi_uid; @@ -208,7 +197,6 @@ int own_uid; int multiattach; int tty_mode; int tty_oldmode = -1; -#endif char HostName[MAXSTR]; int MasterPid, PanicPid; @@ -217,13 +205,9 @@ int default_startup; int ZombieKey_destroy, ZombieKey_resurrect, ZombieKey_onerror; char *preselect = NULL; /* only used in Attach() */ -#ifdef UTF8 char *screenencodings; -#endif -#ifdef DW_CHARS int cjkwidth; -#endif #ifdef NETHACK int nethackflag = 0; @@ -365,9 +349,7 @@ main(int argc, char **argv) #endif struct NewWindow nwin; int detached = 0; /* start up detached */ -#ifdef MULTIUSER char *sockp; -#endif char *sty = 0; #if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX) @@ -453,34 +435,22 @@ main(int argc, char **argv) timestring = SaveStr("%c:%s %M %d %H%? %l%?"); wlisttit = SaveStr(" Num Name%=Flags"); wliststr = SaveStr("%4n %t%=%f"); -#ifdef COPY_PASTE BufferFile = SaveStr(DEFAULT_BUFFERFILE); -#endif ShellProg = NULL; -#ifdef POW_DETACH PowDetachString = 0; -#endif default_startup = (argc > 1) ? 0 : 1; adaptflag = 0; VBellWait = VBELLWAIT * 1000; MsgWait = MSGWAIT * 1000; MsgMinWait = MSGMINWAIT * 1000; SilenceWait = SILENCEWAIT; -#ifdef ZMODEM zmodem_sendcmd = SaveStr("!!! sz -vv -b "); zmodem_recvcmd = SaveStr("!!! rz -vv -b -E"); -#endif -#ifdef COPY_PASTE CompileKeys((char *)0, 0, mark_key_tab); -#endif -#ifdef UTF8 InitBuiltinTabs(); screenencodings = SaveStr(SCREENENCODINGS); -#endif -#ifdef DW_CHARS cjkwidth = 0; -#endif nwin = nwin_undef; nwin_options = nwin_undef; strcpy(screenterm, "screen"); @@ -492,11 +462,7 @@ main(int argc, char **argv) if (*av0 == '-') { rflag = 4; -#ifdef MULTI xflag = 1; -#else - dflag = 1; -#endif ShellProg = SaveStr(DefaultShell); /* to prevent nasty circles */ } while (argc > 0) @@ -664,24 +630,19 @@ main(int argc, char **argv) break; case 'r': case 'R': -#ifdef MULTI case 'x': -#endif if (argc > 1 && *argv[1] != '-' && !SockMatch) { SockMatch = *++argv; argc--; debug2("rflag=%d, SockMatch=%s\n", dflag, SockMatch); } -#ifdef MULTI if (*ap == 'x') xflag = 1; -#endif if (rflag) rflag = 2; rflag += (*ap == 'R') ? 2 : 1; break; -#ifdef REMOTE_DETACH case 'd': dflag = 1; /* FALLTHROUGH */ @@ -698,7 +659,6 @@ main(int argc, char **argv) } } break; -#endif case 's': if (--argc == 0) exit_with_usage(myname, "Specify shell with -s", NULL); @@ -723,11 +683,9 @@ main(int argc, char **argv) case 'v': Panic(0, "Screen version %s", version); /* NOTREACHED */ -#ifdef UTF8 case 'U': nwin_options.encoding = nwin_options.encoding == -1 ? UTF8 : 0; break; -#endif default: exit_with_usage(myname, "Unknown option %s", --ap); } @@ -751,7 +709,6 @@ main(int argc, char **argv) #ifdef USE_LOCALE setlocale(LC_ALL, ""); #endif -#ifdef ENCODINGS if (nwin_options.encoding == -1) { /* ask locale if we should start in UTF-8 mode */ @@ -762,15 +719,12 @@ main(int argc, char **argv) nwin_options.encoding = FindEncoding(nl_langinfo(CODESET)); debug1("locale says encoding = %d\n", nwin_options.encoding); # else -# ifdef UTF8 char *s; if ((s = locale_name()) && InStr(s, "UTF-8")) nwin_options.encoding = UTF8; -# endif debug1("environment says encoding=%d\n", nwin_options.encoding); #endif } -# ifdef DW_CHARS { char *s; if ((s = locale_name())) @@ -781,11 +735,8 @@ main(int argc, char **argv) } } } -#endif -#endif if (nwin_options.aka) { -#ifdef ENCODINGS if (nwin_options.encoding > 0) { size_t len = strlen(nwin_options.aka); @@ -799,7 +750,6 @@ main(int argc, char **argv) nwin_options.aka = newbuf; } else -#endif { /* If we just use the original value from av, subsequent shelltitle invocations will attempt to free @@ -815,9 +765,7 @@ main(int argc, char **argv) if (!cmdflag && dflag && mflag && !(rflag || xflag)) detached = 1; nwin = nwin_options; -#ifdef ENCODINGS nwin.encoding = nwin_undef.encoding; /* let screenrc overwrite it */ -#endif if (argc) nwin.args = argv; @@ -868,7 +816,6 @@ main(int argc, char **argv) } #endif -#ifdef MULTIUSER own_uid = multi_uid = real_uid; if (SockMatch && (sockp = index(SockMatch, '/'))) { @@ -884,11 +831,9 @@ main(int argc, char **argv) multi_home = SaveStr(mppp->pw_dir); if (strlen(multi_home) > MAXPATHLEN - 10) Panic(0, "home directory path too long"); -# ifdef MULTI /* always fake multi attach mode */ if (rflag || lsflag) xflag = 1; -# endif /* MULTI */ detached = 0; multiattach = 1; } @@ -898,7 +843,6 @@ main(int argc, char **argv) } if (SockMatch && *SockMatch == 0) SockMatch = 0; -#endif /* MULTIUSER */ if ((LoginName = getlogin()) && LoginName[0] != '\0') { @@ -919,7 +863,7 @@ main(int argc, char **argv) ppp = getpwbyname(LoginName, ppp); -#if !defined(SOCKDIR) && defined(MULTIUSER) +#if !defined(SOCKDIR) if (multi && !multiattach) { if (home && strcmp(home, ppp->pw_dir)) @@ -959,10 +903,8 @@ main(int argc, char **argv) home = ppp->pw_dir; if (strlen(LoginName) > MAXLOGINLEN) Panic(0, "LoginName too long - sorry."); -#ifdef MULTIUSER if (multi && strlen(multi) > MAXLOGINLEN) Panic(0, "Screen owner name too long - sorry."); -#endif if (strlen(home) > MAXPATHLEN - 25) Panic(0, "$HOME too long - sorry."); @@ -975,9 +917,7 @@ main(int argc, char **argv) /* ttyname implies isatty */ SET_TTYNAME(1); -#ifdef MULTIUSER tty_mode = (int)st.st_mode & 0777; -#endif #ifndef NAMEDPIPE fl = fcntl(0, F_GETFL, 0); @@ -1013,12 +953,9 @@ main(int argc, char **argv) { if (strlen(SockDir) >= MAXPATHLEN - 1) Panic(0, "Ridiculously long $SCREENDIR - try again."); -#ifdef MULTIUSER if (multi) Panic(0, "No $SCREENDIR with multi screens, please."); -#endif } -#ifdef MULTIUSER if (multiattach) { # ifndef SOCKDIR @@ -1030,7 +967,6 @@ main(int argc, char **argv) # endif } else -#endif { #ifndef SOCKDIR if (SockDir == 0) @@ -1100,14 +1036,12 @@ main(int argc, char **argv) else if (!S_ISDIR(st.st_mode)) Panic(0, "%s is not a directory.", SockPath); -#ifdef MULTIUSER if (multi) { if ((int)st.st_uid != multi_uid) Panic(0, "%s is not the owner of %s.", multi, SockPath); } else -#endif { if ((int)st.st_uid != real_uid) Panic(0, "You are not the owner of %s.", SockPath); @@ -1137,10 +1071,8 @@ main(int argc, char **argv) { int i, fo, oth; -#ifdef MULTIUSER if (multi) real_uid = multi_uid; -#endif SET_GUID(); i = FindSocket((int *)NULL, &fo, &oth, SockMatch); if (quietflag) { @@ -1173,10 +1105,8 @@ main(int argc, char **argv) Attacher(); /* NOTREACHED */ } -#ifdef MULTIUSER if (multiattach) Panic(0, "Can't create sessions of other users."); -#endif debug("screen -r: backend not responding -- still crying\n"); } else if (dflag && !mflag) @@ -1298,10 +1228,8 @@ main(int argc, char **argv) if (MakeDisplay(LoginName, attach_tty, attach_term, n, getppid(), &attach_Mode) == 0) Panic(0, "Could not alloc display"); PanicPid = 0; -#ifdef ENCODINGS D_encoding = nwin_options.encoding > 0 ? nwin_options.encoding : 0; debug1("D_encoding = %d\n", D_encoding); -#endif } if (SockMatch) @@ -1744,14 +1672,12 @@ DoWait() } break; } -#ifdef PSEUDOS if (p->w_pwin && pid == p->w_pwin->p_pid) { debug2("pseudo of win Nr %d died. pid == %d\n", p->w_number, p->w_pwin->p_pid); FreePseudowin(p); break; } -#endif } if (p == 0) { @@ -1906,13 +1832,10 @@ Detach(int mode) sign = SIG_STOP; break; #endif -#ifdef REMOTE_DETACH case D_REMOTE: AddStrSock("remote detached"); sign = SIG_BYE; break; -#endif -#ifdef POW_DETACH case D_POWER: AddStrSock("power detached"); if (PowDetachString) @@ -1922,7 +1845,6 @@ Detach(int mode) } sign = SIG_POWER_BYE; break; -#ifdef REMOTE_DETACH case D_REMOTE_POWER: AddStrSock("remote power detached"); if (PowDetachString) @@ -1932,8 +1854,6 @@ Detach(int mode) } sign = SIG_POWER_BYE; break; -#endif -#endif case D_LOCK: ClearAll(); sign = SIG_LOCK; @@ -1970,9 +1890,7 @@ Detach(int mode) } if (D_fore) { -#ifdef MULTIUSER ReleaseAutoWritelock(display, D_fore); -#endif D_user->u_detachwin = D_fore->w_number; D_user->u_detachotherwin = D_other ? D_other->w_number : -1; } @@ -2143,7 +2061,6 @@ void Panic(int err, const char *fmt, VA_DOTS) if (D_userpid) Kill(D_userpid, SIG_BYE); } -#ifdef MULTIUSER if (tty_oldmode >= 0) { # ifdef USE_SETEUID @@ -2155,7 +2072,6 @@ void Panic(int err, const char *fmt, VA_DOTS) debug1("Panic: changing back modes from %s\n", attach_tty); chmod(attach_tty, tty_oldmode); } -#endif eexit(1); } @@ -2783,7 +2699,6 @@ MakeWinMsgEv(char *str, struct win *win, int esc, int padlen, struct event *ev, break; case 'P': p--; -#ifdef COPY_PASTE if (display && ev && ev != &D_hstatusev) /* Hack */ { /* Is the layer in the current canvas in copy mode? */ @@ -2791,7 +2706,6 @@ MakeWinMsgEv(char *str, struct win *win, int esc, int padlen, struct event *ev, if (ev == &cv->c_captev && cv->c_layer->l_layfn == &MarkLf) qmflag = 1; } -#endif break; case 'E': p--; @@ -3106,15 +3020,10 @@ serv_select_fn(struct event *ev, char *data) #else char ibuf = displays->d_OldMode.m_tchars.t_intrc; #endif -#ifdef PSEUDOS write(W_UWP(fore) ? fore->w_pwin->p_ptyfd : fore->w_ptyfd, &ibuf, 1); debug1("Backend wrote interrupt to %d", fore->w_number); debug1("%s\n", W_UWP(fore) ? " (pseudowin)" : ""); -#else - write(fore->w_ptyfd, &ibuf, 1); - debug1("Backend wrote interrupt to %d\n", fore->w_number); -#endif } InterruptPlease = 0; } @@ -3163,10 +3072,8 @@ serv_select_fn(struct event *ev, char *data) break; if (cv) continue; /* user already sees window */ -#ifdef MULTIUSER if (!(ACLBYTE(p->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id))) continue; /* user doesn't care */ -#endif Msg(0, "%s", MakeWinMsg(ActivityString, p, '%')); p->w_monitor = MON_DONE; } diff --git a/src/screen.h b/src/screen.h index 1efbc10..0755686 100644 --- a/src/screen.h +++ b/src/screen.h @@ -276,13 +276,11 @@ extern char strnomem[]; #define INP_EVERY 4 -#ifdef MULTIUSER struct acl { struct acl *next; char *name; }; -#endif /* register list */ #define MAX_PLOP_DEFS 256 diff --git a/src/search.c b/src/search.c index 3e604c5..e645e37 100644 --- a/src/search.c +++ b/src/search.c @@ -38,7 +38,6 @@ extern struct layer *flayer; extern struct win *fore; -#ifdef COPY_PASTE int search_ic; @@ -359,4 +358,3 @@ ISearch(int dir) flayer->l_y = W2D(markdata->cy); } -#endif /* COPY_PASTE */ diff --git a/src/socket.c b/src/socket.c index 32fca58..40a4d4e 100644 --- a/src/socket.c +++ b/src/socket.c @@ -73,9 +73,7 @@ extern struct win *fore, **wtab, *console_window, *windows; extern struct layer *flayer; extern struct layout *layout_attach, *layout_last, layout_last_marker; extern struct NewWindow nwin_undef; -#ifdef MULTIUSER extern char *multi; -#endif extern int maxwin; extern char *getenv(); @@ -85,11 +83,7 @@ extern struct event serv_read; extern char *rc_name; extern struct comm comms[]; -#ifdef MULTIUSER -# define SOCKMODE (S_IWRITE | S_IREAD | (displays ? S_IEXEC : 0) | (multi ? 1 : 0)) -#else -# define SOCKMODE (S_IWRITE | S_IREAD | (displays ? S_IEXEC : 0)) -#endif +#define SOCKMODE (S_IWRITE | S_IREAD | (displays ? S_IEXEC : 0) | (multi ? 1 : 0)) /* @@ -231,7 +225,6 @@ FindSocket(int *fdp, int *nfoundp, int *notherp, char *match) continue; mode = (int)st.st_mode & 0777; debug1(" has mode 0%03o\n", mode); -#ifdef MULTIUSER if (multi && ((mode & 0677) != 0601)) { debug(" is not a MULTI-USER session"); @@ -245,7 +238,6 @@ FindSocket(int *fdp, int *nfoundp, int *notherp, char *match) debug(", but it is our own session.\n"); } } -#endif debug(" store it.\n"); if ((sent = (struct sent *)malloc(sizeof(struct sent))) == 0) continue; @@ -361,14 +353,12 @@ FindSocket(int *fdp, int *nfoundp, int *notherp, char *match) case 0600: printf("\t%s\t(Detached)\n", sent->name); break; -#ifdef MULTIUSER case 0701: printf("\t%s\t(Multi, attached)\n", sent->name); break; case 0601: printf("\t%s\t(Multi, detached)\n", sent->name); break; -#endif case -1: /* No trigraphs here! */ printf("\t%s\t(Dead ?%c?)\n", sent->name, '?'); @@ -815,16 +805,12 @@ CreateTempDisplay(struct msg *m, int recvfd, struct win *win) user = m->m.attach.auser; attach = 1; break; -#ifdef REMOTE_DETACH case MSG_DETACH: -# ifdef POW_DETACH case MSG_POW_DETACH: -# endif /* POW_DETACH */ pid = m->m.detach.dpid; user = m->m.detach.duser; attach = 0; break; -#endif default: return -1; } @@ -854,10 +840,8 @@ CreateTempDisplay(struct msg *m, int recvfd, struct win *win) Kill(pid, SIG_BYE); return -1; } -#ifdef MULTIUSER if (attach) Kill(pid, SIGCONT); -#endif #if defined(ultrix) || defined(pyr) || defined(NeXT) brktty(i); /* for some strange reason this must be done */ @@ -874,7 +858,6 @@ CreateTempDisplay(struct msg *m, int recvfd, struct win *win) return -1; } -#ifdef MULTIUSER if (strcmp(user, LoginName)) if (*FindUserPtr(user) == 0) { @@ -884,18 +867,8 @@ CreateTempDisplay(struct msg *m, int recvfd, struct win *win) Msg(0, "Attach: access denied for user %s.", user); return -1; } -#endif debug2("RecMsg: apid %d is o.k. and we just opened '%s'\n", pid, m->m_tty); -#ifndef MULTI - if (displays) - { - write(i, "Screen session in use.\n", 23); - close(i); - Kill(pid, SIG_BYE); - return -1; - } -#endif } /* create new display */ @@ -908,18 +881,12 @@ CreateTempDisplay(struct msg *m, int recvfd, struct win *win) Kill(pid, SIG_BYE); return -1; } -#ifdef ENCODINGS if (attach) { -# ifdef UTF8 D_encoding = m->m.attach.encoding == 1 ? UTF8 : m->m.attach.encoding ? m->m.attach.encoding - 1 : 0; -# else - D_encoding = m->m.attach.encoding ? m->m.attach.encoding - 1 : 0; -# endif if (D_encoding < 0 || !EncodingName(D_encoding)) D_encoding = 0; } -#endif if (iflag && olddisplays) { @@ -1126,11 +1093,9 @@ ReceiveMsg() case MSG_ATTACH: if (CreateTempDisplay(&m, recvfd, wi)) break; -#ifdef PASSWORD if (D_user->u_password && *D_user->u_password) AskPassword(&m); else -#endif FinishAttach(&m); break; case MSG_ERROR: @@ -1140,12 +1105,8 @@ ReceiveMsg() if (!wi) /* ignore hangups from inside */ Hangup(); break; -#ifdef REMOTE_DETACH case MSG_DETACH: -# ifdef POW_DETACH case MSG_POW_DETACH: -# endif /* POW_DETACH */ -#ifdef PASSWORD user = *FindUserPtr(m.m.detach.duser); if (user && user->u_password && *user->u_password) { @@ -1154,10 +1115,8 @@ ReceiveMsg() AskPassword(&m); } else -#endif /* PASSWORD */ FinishDetach(&m); break; -#endif case MSG_QUERY: { char *oldSockPath = SaveStr(SockPath); @@ -1295,14 +1254,10 @@ FinishAttach(struct msg *m) ASSERT(display); pid = D_userpid; -#ifdef REMOTE_DETACH if (m->m.attach.detachfirst == MSG_DETACH -# ifdef POW_DETACH || m->m.attach.detachfirst == MSG_POW_DETACH -# endif ) FinishDetach(m); -#endif #if defined(pyr) || defined(xelos) || defined(sequent) /* @@ -1419,9 +1374,7 @@ FinishAttach(struct msg *m) SetForeWindow(fore); else if (!noshowwin) { -#ifdef MULTIUSER if (!AclCheckPermCmd(D_user, ACL_EXEC, &comms[RC_WINDOWLIST])) -#endif { struct display *olddisplay = display; flayer = D_forecv->c_layer; @@ -1477,20 +1430,16 @@ FinishDetach(struct msg *m) for (display = displays; display; display = next) { next = display->d_next; -# ifdef POW_DETACH if (m->type == MSG_POW_DETACH) Detach(D_REMOTE_POWER); else -# endif /* POW_DETACH */ if (m->type == MSG_DETACH) Detach(D_REMOTE); else if (m->type == MSG_ATTACH) { -#ifdef POW_DETACH if (m->m.attach.detachfirst == MSG_POW_DETACH) Detach(D_REMOTE_POWER); else -#endif if (m->m.attach.detachfirst == MSG_DETACH) Detach(D_REMOTE); } @@ -1504,7 +1453,6 @@ FinishDetach(struct msg *m) } } -#ifdef PASSWORD static void PasswordProcessInput (char *, int); struct pwdata { @@ -1567,15 +1515,11 @@ PasswordProcessInput(char *ibuf, int ilen) AddStr("\r\n"); D_processinputdata = 0; D_processinput = ProcessInput; -#ifdef REMOTE_DETACH if (pwdata->m.type == MSG_DETACH -# ifdef POW_DETACH || pwdata->m.type == MSG_POW_DETACH -# endif ) FinishDetach(&pwdata->m); else -#endif FinishAttach(&pwdata->m); free(pwdata); return; @@ -1603,7 +1547,6 @@ PasswordProcessInput(char *ibuf, int ilen) } pwdata->l = l; } -#endif /* 'end' is exclusive, i.e. you should *not* write in *end */ static char * @@ -1637,11 +1580,7 @@ DoCommandMsg(struct msg *mp) int n; register char *p = mp->m.command.cmd; struct acluser *user; -#ifdef MULTIUSER extern struct acluser *EffectiveAclUser; /* acls.c */ -#else - extern struct acluser *users; /* acls.c */ -#endif n = mp->m.command.nargs; if (n > MAXARGS - 1) @@ -1667,7 +1606,6 @@ DoCommandMsg(struct msg *mp) queryflag = -1; return; } -#ifdef MULTIUSER user = *FindUserPtr(mp->m.attach.auser); if (user == 0) { @@ -1675,17 +1613,12 @@ DoCommandMsg(struct msg *mp) queryflag = -1; return; } -#else - user = users; -#endif -#ifdef PASSWORD if (user->u_password && *user->u_password) { Msg(0, "User %s has a password, cannot use remote commands (using -Q or -X option).", mp->m.attach.auser); queryflag = -1; return; } -#endif if (!display) for (display = displays; display; display = display->d_next) if (D_user == user) @@ -1733,9 +1666,7 @@ DoCommandMsg(struct msg *mp) } if (!fore) fore = windows; /* sigh */ -#ifdef MULTIUSER EffectiveAclUser = user; -#endif if (*args) { char *oldrcname = rc_name; @@ -1747,9 +1678,7 @@ DoCommandMsg(struct msg *mp) DoCommand(args, argl); rc_name = oldrcname; } -#ifdef MULTIUSER EffectiveAclUser = 0; -#endif } #ifndef NAMEDPIPE diff --git a/src/term.sh b/src/term.sh index 1d05cb9..0db55c0 100644 --- a/src/term.sh +++ b/src/term.sh @@ -83,14 +83,12 @@ nolist = 1; nolist = 0; } END { - printf "\n#ifdef MAPKEYS\n" printf "# define KMAPDEFSTART %d\n", min printf "# define NKMAPDEF %d\n", max-min+1 printf "# define KMAPADEFSTART %d\n", amin printf "# define NKMAPADEF %d\n", amax-amin+1 printf "# define KMAPMDEFSTART %d\n", mmin printf "# define NKMAPMDEF %d\n", mmax-mmin+1 - printf "#endif\n" } ' | sed -e s/NUM/num/ -e s/STR/str/ -e s/FLG/flg/ \ >> term.h @@ -103,7 +101,6 @@ cat << EOF > kmapdef.c #include "config.h" -#ifdef MAPKEYS EOF @@ -167,7 +164,7 @@ END { else printf "\n" } - printf "};\n\n#endif\n" + printf "};\n" } ' >> kmapdef.c diff --git a/src/termcap.c b/src/termcap.c index 98211e0..7984804 100644 --- a/src/termcap.c +++ b/src/termcap.c @@ -38,7 +38,6 @@ extern struct NewWindow nwin_undef, nwin_default, nwin_options; extern int force_vt; extern int Z0width, Z1width; extern int hardstatusemu; -#ifdef MAPKEYS extern struct action umtab[]; extern struct action mmtab[]; extern struct action dmtab[]; @@ -46,7 +45,6 @@ extern struct action ktab[]; extern struct kmap_ext *kmap_exts; extern int kmap_extn; extern int DefaultEsc; -#endif static void AddCap (char *); @@ -57,7 +55,6 @@ static int e_tgetent (char *, char *); static char *e_tgetstr (char *, char **); static int e_tgetflag (char *); static int e_tgetnum (char *); -#ifdef MAPKEYS static int findseq_ge (char *, int, unsigned char **); static void setseqoff (unsigned char *, int, int); static int addmapseq (char *, int, int); @@ -65,7 +62,6 @@ static int remmapseq (char *, int); #ifdef DEBUGG static void dumpmap (void); #endif -#endif char Termcap[TERMCAP_BUFSIZE + 8]; /* new termcap +8:"TERMCAP=" */ @@ -353,7 +349,6 @@ InitTermcap(int wi, int he) if (D_CCE == 0) D_CCS = 0; -#ifdef FONT if (D_CG0) { if (D_CS0 == 0) @@ -393,16 +388,13 @@ InitTermcap(int wi, int he) for (i = strlen(D_CC0) & ~1; i >= 0; i -= 2) D_c0_tab[(int)(unsigned char)D_CC0[i]] = D_CC0[i + 1]; debug1("ISO2022 = %d\n", D_CG0); -#endif /* FONT */ if (D_PF == 0) D_PO = 0; debug2("terminal size is %d, %d (says TERMCAP)\n", D_CO, D_LI); -#ifdef FONT if (D_CXC) if (CreateTransTable(D_CXC)) return -1; -#endif /* Termcap fields Z0 & Z1 contain width-changing sequences. */ if (D_CZ1 == 0) @@ -424,14 +416,12 @@ InitTermcap(int wi, int he) if (D_HS && !(hardstatusemu & HSTATUS_ALWAYS)) D_has_hstatus = HSTATUS_HS; -#ifdef ENCODINGS if (D_CKJ) { int enc = FindEncoding(D_CKJ); if (enc != -1) D_encoding = enc; } -#endif if (!D_tcs[T_NAVIGATE].str && D_tcs[T_NAVIGATE + 1].str) D_tcs[T_NAVIGATE].str = D_tcs[T_NAVIGATE + 1].str; /* kh = @1 */ if (!D_tcs[T_NAVIGATE + 2].str && D_tcs[T_NAVIGATE + 3].str) @@ -446,13 +436,11 @@ InitTermcap(int wi, int he) D_IMcost = CalcCost(D_IM); D_EIcost = CalcCost(D_EI); -#ifdef AUTO_NUKE if (D_CAN) { debug("termcap has AN, setting autonuke\n"); D_auto_nuke = 1; } -#endif if (D_COL > 0) { debug1("termcap has OL (%d), setting limit\n", D_COL); @@ -470,7 +458,6 @@ InitTermcap(int wi, int he) if (D_tcs[T_CURSOR + 3].str && !strcmp(D_tcs[T_CURSOR + 3].str, "\008")) D_tcs[T_CURSOR + 3].str = 0; -#ifdef MAPKEYS D_nseqs = 0; for (i = 0; i < T_OCAPS - T_CAPS; i++) remap(i, 1); @@ -479,17 +466,13 @@ InitTermcap(int wi, int he) D_seqp = D_kmaps + 3; D_seql = 0; D_seqh = 0; -#endif D_tcinited = 1; MakeTermcap(0); -#ifdef MAPKEYS CheckEscape(); -#endif return 0; } -#ifdef MAPKEYS int remap(int n, int map) @@ -799,7 +782,6 @@ dumpmap() } #endif /* DEBUGG */ -#endif /* MAPKEYS */ /* * Appends to the static variable Termcap @@ -874,14 +856,12 @@ MakeTermcap(int aflag) if (e_tgetent(buf, p) == 1) break; } -#ifdef COLOR if (nwin_default.bce) { sprintf(p, "%s-bce", screenterm); if (e_tgetent(buf, p) == 1) break; } -#endif #ifdef CHECK_SCREEN_W if (wi >= 132) { @@ -956,10 +936,8 @@ MakeTermcap(int aflag) AddCap("mi:"); AddCap("IC=\\E[%d@:"); } -#ifdef MAPKEYS AddCap("ks=\\E[?1h\\E=:"); AddCap("ke=\\E[?1l\\E>:"); -#endif AddCap("vi=\\E[?25l:"); AddCap("ve=\\E[34h\\E[?25h:"); AddCap("vs=\\E[34l:"); @@ -991,18 +969,6 @@ MakeTermcap(int aflag) AddCap("Co#8:pa#64:AF=\\E[3%dm:AB=\\E[4%dm:op=\\E[39;49m:AX:"); if (D_VB) AddCap("vb=\\Eg:"); -#ifndef MAPKEYS - if (D_KS) - { - AddCap("ks=\\E=:"); - AddCap("ke=\\E>:"); - } - if (D_CCS) - { - AddCap("CS=\\E[?1h:"); - AddCap("CE=\\E[?1l:"); - } -#endif if (D_CG0) AddCap("G0:"); if (D_CC0 || (D_CS0 && *D_CS0)) @@ -1027,7 +993,6 @@ MakeTermcap(int aflag) } for (i = T_CAPS; i < T_ECAPS; i++) { -#ifdef MAPKEYS struct action *act; if (i < T_OCAPS) { @@ -1062,7 +1027,6 @@ MakeTermcap(int aflag) continue; } } -#endif if (display == 0) continue; switch(term[i].type) @@ -1139,7 +1103,6 @@ MakeString(char *cap, char *buf, int buflen, char *s) #define QUOTES(p) \ (*p == '\\' && (p[1] == '\\' || p[1] == ',' || p[1] == '%')) -#ifdef FONT int CreateTransTable(char *s) { @@ -1252,7 +1215,6 @@ FreeTransTable() } free(D_xtable); } -#endif /* FONT */ static int copyarg(char **pp, char *s) @@ -415,7 +415,7 @@ IF{LCRTBS} | LCRTBS # endif /* TERMIO */ #endif /* POSIX */ -#if defined(ENCODINGS) && defined(TIOCKSET) +#if defined(TIOCKSET) m->m_jtchars.t_ascii = 'J'; m->m_jtchars.t_kanji = 'B'; m->m_knjmode = KM_ASCII | KM_SYSSJIS; @@ -453,7 +453,7 @@ struct mode *mp; ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); /* moved here for apollo. jw */ # endif #endif -#if defined(ENCODINGS) && defined(TIOCKSET) +#if defined(TIOCKSET) ioctl(fd, TIOCKSETC, &mp->m_jtchars); ioctl(fd, TIOCKSET, &mp->m_knjmode); #endif @@ -497,7 +497,7 @@ struct mode *mp; ioctl(fd, TIOCGETD, (char *)&mp->m_ldisc); # endif #endif -#if defined(ENCODINGS) && defined(TIOCKSET) +#if defined(TIOCKSET) ioctl(fd, TIOCKGETC, &mp->m_jtchars); ioctl(fd, TIOCKGET, &mp->m_knjmode); #endif diff --git a/src/window.c b/src/window.c index c98a4b6..c299e25 100644 --- a/src/window.c +++ b/src/window.c @@ -62,12 +62,10 @@ extern int ZombieKey_destroy, ZombieKey_resurrect, ZombieKey_onerror; extern struct layer *flayer; extern int maxusercount; extern int pty_preopen; -#ifdef ZMODEM extern int zmodem_mode; extern struct mchar mchar_blank; extern char *zmodem_sendcmd; extern char *zmodem_recvcmd; -#endif #if defined(TIOCSWINSZ) || defined(TIOCGWINSZ) extern struct winsize glwz; @@ -88,23 +86,17 @@ static void ZombieProcess (char **, int *); static void win_readev_fn (struct event *, char *); static void win_writeev_fn (struct event *, char *); static int muchpending (struct win *, struct event *); -#ifdef COPY_PASTE static void paste_slowev_fn (struct event *, char *); -#endif -#ifdef PSEUDOS static void pseu_readev_fn (struct event *, char *); static void pseu_writeev_fn (struct event *, char *); -#endif static void win_silenceev_fn (struct event *, char *); static void win_destroyev_fn (struct event *, char *); static int OpenDevice (char **, int, int *, char **); static int ForkWindow (struct win *, char **, char *); -#ifdef ZMODEM static void zmodem_found (struct win *, int, char *, int); static void zmodem_fin (char *, int, char *); static int zmodem_parse (struct win *, char *, int); -#endif struct win **wtab; /* window table */ @@ -262,7 +254,6 @@ WinProcess(char **bufpp, int *lenp) ZombieProcess(bufpp, lenp); return; } -#ifdef MULTIUSER /* a pending writelock is this: * fore->w_wlock == WLOCK_AUTO, fore->w_wlockuse = NULL * The user who wants to use this window next, will get the lock, if he can. @@ -287,7 +278,6 @@ WinProcess(char **bufpp, int *lenp) *lenp = 0; return; } -#endif /* MULTIUSER */ #ifdef BUILTIN_TELNET if (fore->w_type == W_TYPE_TELNET && TelIsline(fore) && *bufpp != fore->w_telbuf) @@ -297,7 +287,6 @@ WinProcess(char **bufpp, int *lenp) } #endif -#ifdef PSEUDOS if (W_UWP(fore)) { /* we send the user input to our pseudowin */ @@ -305,7 +294,6 @@ WinProcess(char **bufpp, int *lenp) f = sizeof(fore->w_pwin->p_inbuf) - *ilen; } else -#endif /* PSEUDOS */ { /* we send the user input to the window */ ibuf = fore->w_inbuf; ilen = &fore->w_inlen; @@ -390,16 +378,10 @@ WinRewrite(int y, int x1, int x2, struct mchar *rend, int doit) { register int cost, dx; register unsigned char *p, *i; -#ifdef FONT register unsigned char *f; register unsigned char *fx; -#endif -#ifdef COLOR register unsigned char *c; -# ifdef COLORS256 register unsigned char *cx; -# endif -#endif debug3("WinRewrite %d, %d-%d\n", y, x1, x2); fore = (struct win *)flayer->l_data; @@ -412,44 +394,28 @@ WinRewrite(int y, int x1, int x2, struct mchar *rend, int doit) return 0; } p = fore->w_mlines[y].attr + x1; -#ifdef FONT f = fore->w_mlines[y].font + x1; fx = fore->w_mlines[y].fontx + x1; -# ifdef DW_CHARS if (is_dw_font(rend->font)) return EXPENSIVE; -# endif -# ifdef UTF8 if (fore->w_encoding && fore->w_encoding != UTF8 && D_encoding == UTF8 && ContainsSpecialDeffont(fore->w_mlines + y, x1, x2, fore->w_encoding)) return EXPENSIVE; -# endif -#endif -#ifdef COLOR c = fore->w_mlines[y].color + x1; -# ifdef COLORS256 cx = fore->w_mlines[y].colorx + x1; -# endif -#endif cost = dx = x2 - x1 + 1; while(dx-- > 0) { if (*p++ != rend->attr) return EXPENSIVE; -#ifdef FONT if (*f++ != rend->font) return EXPENSIVE; if (*fx++ != rend->fontx) return EXPENSIVE; -#endif -#ifdef COLOR if (*c++ != rend->color) return EXPENSIVE; -# ifdef COLORS256 if (*cx++ != rend->colorx) return EXPENSIVE; -# endif -#endif } return cost; } @@ -543,9 +509,7 @@ MakeWindow(struct NewWindow *newwin) struct NewWindow nwin; int type, startat; char *TtyName; -#ifdef MULTIUSER extern struct acluser *users; -#endif if (!wtab) { @@ -628,7 +592,6 @@ MakeWindow(struct NewWindow *newwin) p->w_group = fore; else if (fore && fore->w_group) p->w_group = fore->w_group; -#ifdef MULTIUSER /* * This is dangerous: without a display we use creators umask * This is intended to be useful for detached startup. @@ -641,7 +604,6 @@ MakeWindow(struct NewWindow *newwin) Msg(0, "%s", strnomem); return -1; } -#endif p->w_layer.l_next = 0; p->w_layer.l_bottom = &p->w_layer; p->w_layer.l_layfn = &WinLf; @@ -650,11 +612,9 @@ MakeWindow(struct NewWindow *newwin) p->w_pdisplay = 0; p->w_lastdisp = 0; -#ifdef MULTIUSER if (display && !AclCheckPermWin(D_user, ACL_WRITE, p)) p->w_wlockuser = D_user; p->w_wlock = nwin.wlock; -#endif p->w_ptyfd = f; p->w_aflag = nwin.aflag; p->w_flow = nwin.flowflag | ((nwin.flowflag & FLOW_AUTOFLAG) ? (FLOW_AUTO|FLOW_NOW) : FLOW_AUTO); @@ -673,32 +633,24 @@ MakeWindow(struct NewWindow *newwin) if (nwin.hstatus) p->w_hstatus = SaveStr(nwin.hstatus); p->w_monitor = nwin.monitor; -#ifdef MULTIUSER if (p->w_monitor == MON_ON) { /* always tell all users */ for (i = 0; i < maxusercount; i++) ACLBYTE(p->w_mon_notify, i) |= ACLBIT(i); } -#endif /* * defsilence by Lloyd Zusman (zusman_lloyd@jpmorgan.com) */ p->w_silence = nwin.silence; p->w_silencewait = SilenceWait; -#ifdef MULTIUSER if (p->w_silence == SILENCE_ON) { /* always tell all users */ for (i = 0; i < maxusercount; i++) ACLBYTE(p->w_lio_notify, i) |= ACLBIT(i); } -#endif -#ifdef COPY_PASTE p->w_slowpaste = nwin.slow; -#else - nwin.histheight = 0; -#endif p->w_norefresh = 0; strncpy(p->w_tty, TtyName, MAXSTR - 1); @@ -714,10 +666,8 @@ MakeWindow(struct NewWindow *newwin) p->w_encoding = nwin.encoding; ResetWindow(p); /* sets w_wrap, w_c1, w_gr, w_bce */ -#ifdef FONT if (nwin.charset) SetCharsets(p, nwin.charset); -#endif if (VerboseCreate && type != W_TYPE_GROUP) { @@ -737,9 +687,7 @@ MakeWindow(struct NewWindow *newwin) p->w_deadpid = 0; p->w_pid = 0; -#ifdef PSEUDOS p->w_pwin = 0; -#endif #ifdef BUILTIN_TELNET if (type == W_TYPE_TELNET) @@ -816,11 +764,9 @@ MakeWindow(struct NewWindow *newwin) p->w_writeev.condpos = &p->w_inlen; evenq(&p->w_readev); evenq(&p->w_writeev); -#ifdef COPY_PASTE p->w_paster.pa_slowev.type = EV_TIMEOUT; p->w_paster.pa_slowev.data = (char *)&p->w_paster; p->w_paster.pa_slowev.handler = paste_slowev_fn; -#endif p->w_silenceev.type = EV_TIMEOUT; p->w_silenceev.data = (char *)p; p->w_silenceev.handler = win_silenceev_fn; @@ -942,10 +888,8 @@ FreeWindow(struct win *wp) struct layer *l; debug1("FreeWindow %d\n", wp ? wp->w_number: -1); -#ifdef PSEUDOS if (wp->w_pwin) FreePseudowin(wp); -#endif #ifdef UTMPOK RemoveUtmp(wp); #endif @@ -1013,16 +957,12 @@ FreeWindow(struct win *wp) flayer = 0; LayerCleanupMemory(&wp->w_layer); -#ifdef MULTIUSER FreeWindowAcl(wp); -#endif /* MULTIUSER */ evdeq(&wp->w_readev); /* just in case */ evdeq(&wp->w_writeev); /* just in case */ evdeq(&wp->w_silenceev); evdeq(&wp->w_destroyev); -#ifdef COPY_PASTE FreePaster(&wp->w_paster); -#endif free((char *)wp); } @@ -1163,10 +1103,8 @@ ForkWindow(struct win *win, char **args, char *ttyn) int newfd; int w = win->w_width; int h = win->w_height; -#ifdef PSEUDOS int i, pat, wfdused; struct pseudowin *pwin = win->w_pwin; -#endif int slave = -1; #ifdef O_NOCTTY @@ -1215,9 +1153,7 @@ ForkWindow(struct win *win, char **args, char *ttyn) Panic(errno, "Setuid/gid"); eff_uid = real_uid; eff_gid = real_gid; -#ifdef PSEUDOS if (!pwin) /* ignore directory if pseudo */ -#endif if (win->w_dir && *win->w_dir && chdir(win->w_dir)) Panic(errno, "Cannot chdir to %s", win->w_dir); @@ -1263,7 +1199,6 @@ ForkWindow(struct win *win, char **args, char *ttyn) /* * distribute filedescriptors between the ttys */ -#ifdef PSEUDOS pat = pwin ? pwin->p_fdpat : ((F_PFRONT<<(F_PSHIFT*2)) | (F_PFRONT<<F_PSHIFT) | F_PFRONT); debug1("Using window pattern 0x%x\n", pat); @@ -1304,20 +1239,6 @@ ForkWindow(struct win *win, char **args, char *ttyn) if (fcntl(win->w_ptyfd, F_SETFL, 0)) Msg(errno, "Warning: clear NBLOCK fcntl failed"); } -#else /* PSEUDOS */ -# ifdef O_NOCTTY - if (separate_sids) - newfd = open(ttyn, O_RDWR); - else - newfd = open(ttyn, O_RDWR|O_NOCTTY); -# else - newfd = open(ttyn, O_RDWR); -# endif - if (newfd != 0) - Panic(errno, "Cannot open %s", ttyn); - dup(0); - dup(0); -#endif /* PSEUDOS */ close(win->w_ptyfd); if (slave != -1) close(slave); @@ -1344,7 +1265,6 @@ ForkWindow(struct win *win, char **args, char *ttyn) /* We only want echo if the users input goes to the pseudo * and the pseudo's stdout is not send to the window. */ -#ifdef PSEUDOS if (pwin && (!(pat & F_UWP) || (pat & F_PBACK << F_PSHIFT))) { debug1("clearing echo on pseudywin fd (pat %x)\n", pat); @@ -1355,7 +1275,6 @@ ForkWindow(struct win *win, char **args, char *ttyn) modep->m_ttyb.sg_flags &= ~ECHO; # endif } -#endif SetTTY(newfd, modep); #ifdef TIOCSWINSZ glwz.ws_col = w; @@ -1371,14 +1290,7 @@ ForkWindow(struct win *win, char **args, char *ttyn) NewEnv[5] = libuf; NewEnv[6] = cobuf; #endif -#ifdef MAPKEYS NewEnv[2] = MakeTermcap(display == 0 || win->w_aflag); -#else - if (win->w_aflag) - NewEnv[2] = MakeTermcap(1); - else - NewEnv[2] = Termcap; -#endif strcpy(shellbuf, "SHELL="); strncpy(shellbuf + 6, ShellProg + (*ShellProg == '-'), sizeof(shellbuf) - 7); shellbuf[sizeof(shellbuf) - 1] = 0; @@ -1471,7 +1383,6 @@ execvpe(char *prog, char **args, char **env) } #endif -#ifdef PSEUDOS int winexec(char **av) @@ -1651,10 +1562,8 @@ FreePseudowin(struct win *w) w->w_pwin = NULL; } -#endif /* PSEUDOS */ -#ifdef MULTIUSER /* * returns 0, if the lock really has been released */ @@ -1701,13 +1610,11 @@ ObtainAutoWritelock(struct display *d, struct win *w) return 1; } -#endif /* MULTIUSER */ /********************************************************************/ -#ifdef COPY_PASTE static void paste_slowev_fn(struct event *ev, char *data) { @@ -1729,7 +1636,6 @@ paste_slowev_fn(struct event *ev, char *data) evenq(&pa->pa_slowev); } } -#endif static int @@ -1780,14 +1686,11 @@ win_readev_fn(struct event *ev, char *data) struct win *p = (struct win *)data; char buf[IOSIZE], *bp; int size, len; -#ifdef PSEUDOS int wtop; -#endif bp = buf; size = IOSIZE; -#ifdef PSEUDOS wtop = p->w_pwin && W_WTOP(p); if (wtop) { @@ -1800,12 +1703,9 @@ win_readev_fn(struct event *ev, char *data) return; } } -#endif if (p->w_layer.l_cvlist && muchpending(p, ev)) return; -#ifdef ZMODEM if (!p->w_zdisplay) -#endif if (p->w_blocked) { ev->condpos = &const_one; @@ -1871,18 +1771,14 @@ win_readev_fn(struct event *ev, char *data) #endif if (len == 0) return; -#ifdef ZMODEM if (zmodem_mode && zmodem_parse(p, bp, len)) return; -#endif -#ifdef PSEUDOS if (wtop) { debug("sending input to pwin\n"); bcopy(bp, p->w_pwin->p_inbuf + p->w_pwin->p_inlen, len); p->w_pwin->p_inlen += len; } -#endif LayPause(&p->w_layer, 1); WriteString(p, bp, len); @@ -1905,7 +1801,6 @@ win_writeev_fn(struct event *ev, char *data) if ((p->w_inlen -= len)) bcopy(p->w_inbuf + len, p->w_inbuf, p->w_inlen); } -#ifdef COPY_PASTE if (p->w_paster.pa_pastelen && !p->w_slowpaste) { struct paster *pa = &p->w_paster; @@ -1913,13 +1808,11 @@ win_writeev_fn(struct event *ev, char *data) if (flayer) DoProcess(p, &pa->pa_pasteptr, &pa->pa_pastelen, pa); } -#endif return; } -#ifdef PSEUDOS static void pseu_readev_fn(struct event *ev, char *data) @@ -1999,7 +1892,6 @@ pseu_writeev_fn(struct event *ev, char *data) } -#endif /* PSEUDOS */ static void win_silenceev_fn(struct event *ev, char *data) @@ -2014,10 +1906,8 @@ win_silenceev_fn(struct event *ev, char *data) break; if (cv) continue; /* user already sees window */ -#ifdef MULTIUSER if (!(ACLBYTE(p->w_lio_notify, D_user->u_id) & ACLBIT(D_user->u_id))) continue; -#endif Msg(0, "Window %d: silence for %d seconds", p->w_number, p->w_silencewait); p->w_silence = SILENCE_FOUND; WindowChanged(p, 'f'); @@ -2031,7 +1921,6 @@ win_destroyev_fn(struct event *ev, char *data) WindowDied(p, p->w_exitstatus, 1); } -#ifdef ZMODEM static int zmodem_parse(struct win *p, char *bp, int len) @@ -2202,7 +2091,6 @@ zmodem_abort(struct win *p, struct display *d) flayer = oldflayer; } -#endif int WindowChangeNumber(int old, int dest) @@ -2222,10 +2110,8 @@ WindowChangeNumber(int old, int dest) wtab[old] = p; if (p) p->w_number = old; -#ifdef MULTIUSER /* exchange the acls for these windows. */ AclWinSwap(old, dest); -#endif #ifdef UTMPOK /* exchange the utmp-slots for these windows */ if ((win_old->w_slot != (slot_t) -1) && (win_old->w_slot != (slot_t) 0)) diff --git a/src/window.h b/src/window.h index 3aa872f..e07f5bd 100644 --- a/src/window.h +++ b/src/window.h @@ -59,7 +59,6 @@ struct NewWindow char *charset; }; -#ifdef PSEUDOS struct pseudowin { @@ -112,7 +111,6 @@ struct pseudowin /* window output has to be stuffed in pseudo */ #define W_WTOP(w) (((w)->w_pwin->p_fdpat & F_PMASK) == F_PBOTH) -#endif /* PSEUDOS */ /* definitions for wlocktype */ #define WLOCK_OFF 0 /* all in w_userbits can write */ @@ -120,7 +118,6 @@ struct pseudowin #define WLOCK_ON 2 /* user writes even if deselected */ -#ifdef COPY_PASTE struct paster { char *pa_pastebuf; /* this gets pasted in the window */ @@ -129,9 +126,6 @@ struct paster struct layer *pa_pastelayer; /* layer to paste into */ struct event pa_slowev; /* slowpaste event */ }; -#else -struct paster; -#endif struct win { @@ -141,9 +135,7 @@ struct win struct layer w_layer; /* our layer */ struct layer *w_savelayer; /* the layer to keep */ int w_blocked; /* block input */ -#ifdef PSEUDOS struct pseudowin *w_pwin; /* ptr to pseudo */ -#endif struct display *w_pdisplay; /* display for printer relay */ struct display *w_lastdisp; /* where the last input was made */ int w_number; /* window number */ @@ -165,38 +157,30 @@ struct win int w_args[MAXARGS]; /* emulator args */ int w_NumArgs; -#ifdef MULTIUSER int w_wlock; /* WLOCK_AUTO, WLOCK_OFF, WLOCK_ON */ struct acluser *w_wlockuser; /* NULL when unlocked or user who writes */ AclBits w_userbits[ACL_BITS_PER_WIN]; AclBits w_lio_notify; /* whom to tell when lastio+seconds < time() */ AclBits w_mon_notify; /* whom to tell monitor statis */ -#endif enum state_t w_state; /* parser state */ enum string_t w_StringType; struct mline *w_mlines; struct mchar w_rend; /* current rendition */ -#ifdef FONT char w_FontL; /* character font GL */ char w_FontR; /* character font GR */ -# ifdef ENCODINGS char w_FontE; /* character font GR locked */ -# endif int w_Charset; /* charset number GL */ int w_CharsetR; /* charset number GR */ int w_charsets[4]; /* Font = charsets[Charset] */ -#endif int w_ss; struct cursor { int on; int x, y; struct mchar Rend; -#ifdef FONT int Charset; int CharsetR; int Charsets[4]; -#endif } w_saved; int w_top, w_bot; /* scrollregion */ int w_wrap; /* autowrap */ @@ -213,9 +197,7 @@ struct win int w_c1; /* enable C1 flag */ int w_bce; /* enable backcol erase */ int w_decodestate; /* state of our input decoder */ -#ifdef DW_CHARS int w_mbcs; /* saved char for multibytes charset */ -#endif char w_string[MAXSTR]; char *w_stringp; char *w_tabs; /* line with tabs */ @@ -228,20 +210,14 @@ struct win int w_silence; /* silence status (Lloyd Zusman) */ char w_vbwait; char w_norefresh; /* dont redisplay when switching to that win */ -#ifdef RXVT_OSC char w_xtermosc[4][MAXSTR]; /* special xterm/rxvt escapes */ -#endif int w_mouse; /* mouse mode 0,9,1000 */ -#ifdef COPY_PASTE int w_slowpaste; /* do careful writes to the window */ int w_histheight; /* all histbases are malloced with width * histheight */ int w_histidx; /* 0 <= histidx < histheight; where we insert lines */ struct mline *w_hlines; /* history buffer */ struct paster w_paster; /* paste info */ -#else - int w_histheight; /* always 0 */ -#endif int w_pid; /* process at the other end of ptyfd */ int w_deadpid; /* saved w_pid of a process that closed the ptyfd to us */ @@ -258,9 +234,7 @@ struct win char w_tty[MAXSTR]; int w_zauto; -#ifdef ZMODEM struct display *w_zdisplay; -#endif #ifdef BUILTIN_TELNET struct sockaddr_in w_telsa; char w_telbuf[IOSIZE]; @@ -277,13 +251,9 @@ struct win struct mline *mlines; int width; int height; -#ifdef COPY_PASTE int histheight; struct mline *hlines; int histidx; -#else - int histheight; /* 0 */ -#endif struct cursor cursor; } w_alt; |