diff options
-rw-r--r-- | acls.c | 18 | ||||
-rw-r--r-- | ansi.c | 88 | ||||
-rw-r--r-- | attacher.c | 9 | ||||
-rw-r--r-- | comm.sh | 1 | ||||
-rw-r--r-- | display.c | 10 | ||||
-rw-r--r-- | doc/screen.1 | 12 | ||||
-rw-r--r-- | doc/screen.texinfo | 9 | ||||
-rw-r--r-- | encoding.c | 132 | ||||
-rw-r--r-- | image.h | 12 | ||||
-rw-r--r-- | layer.c | 3 | ||||
-rw-r--r-- | mark.c | 23 | ||||
-rw-r--r-- | patchlevel.h | 6 | ||||
-rw-r--r-- | process.c | 10 | ||||
-rw-r--r-- | resize.c | 26 | ||||
-rw-r--r-- | screen.c | 2 | ||||
-rw-r--r-- | socket.c | 9 | ||||
-rw-r--r-- | window.c | 4 |
17 files changed, 308 insertions, 66 deletions
@@ -455,6 +455,16 @@ int recursive; return gp; /* *gp is NULL */ } +static int +PasswordMatches(pw, password) +const char *pw, *password; +{ + if (!*password) + return 0; + char *buf = crypt((char *)pw, (char *)password); + return (buf && !strcmp(buf, password)); +} + /* * Returns nonzero if failed or already linked. * Both users are created on demand. @@ -544,8 +554,7 @@ char *name, *pw1, *pw2; if (pw2 && *pw2 && *pw2 != '\377') /* provided a system password */ { - if (!*pass || /* but needed none */ - strcmp(crypt(pw2, pass), pass)) + if (!PasswordMatches(pw2, pass)) { debug("System password mismatch\n"); sorry++; @@ -554,11 +563,10 @@ char *name, *pw1, *pw2; else /* no pasword provided */ if (*pass) /* but need one */ sorry++; -#endif +#endif /* CHECKLOGIN */ if (pw1 && *pw1 && *pw1 != '\377') /* provided a screen password */ { - if (!*u->u_password || /* but needed none */ - strcmp(crypt(pw1, u->u_password), u->u_password)) + if (!PasswordMatches(pw1, u->u_password)) { debug("screen password mismatch\n"); sorry++; @@ -683,6 +683,7 @@ register int len; mc.image = c; mc.mbcs = 0; mc.font = '0'; + mc.fontx = 0; mcp = recode_mchar(&mc, 0, UTF8); debug2("%02x %02x\n", mcp->image, mcp->font); c = mcp->image | mcp->font << 8; @@ -708,7 +709,7 @@ register int len; if (oy < 0) oy = 0; copy_mline2mchar(&omc, &curr->w_mlines[oy], ox); - if (omc.image == 0xff && omc.font == 0xff) + if (omc.image == 0xff && omc.font == 0xff && omc.fontx == 0) { ox--; if (ox >= 0) @@ -839,7 +840,10 @@ register int len; curr->w_rend.image = c; #ifdef UTF8 if (curr->w_encoding == UTF8) - curr->w_rend.font = c >> 8; + { + curr->w_rend.font = c >> 8; + curr->w_rend.fontx = c >> 16; + } #endif #ifdef DW_CHARS curr->w_rend.mbcs = curr->w_mbcs; @@ -2378,10 +2382,18 @@ struct mchar *mc; ml->font = null; p->w_FontL = p->w_charsets[p->w_ss ? p->w_ss : p->w_Charset] = 0; p->w_FontR = p->w_charsets[p->w_ss ? p->w_ss : p->w_CharsetR] = 0; - mc->font = p->w_rend.font = 0; + mc->font = mc->fontx = p->w_rend.font = 0; WMsg(p, 0, "Warning: no space for font - turned off"); } } + if (mc->fontx && ml->fontx == null) + { + if ((ml->fontx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) + { + ml->fontx = null; + mc->fontx = 0; + } + } #endif #ifdef COLOR if (mc->color && ml->color == null) @@ -2519,6 +2531,9 @@ int n, ys, ye, bce; 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) @@ -2564,6 +2579,9 @@ int n, ys, ye, bce; 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) @@ -2680,7 +2698,10 @@ int x, y; if (p->w_encoding != UTF8) ml->font[x + 1] |= 0x80; else if (p->w_encoding == UTF8 && c->mbcs) - ml->font[x + 1] = c->mbcs; + { + ml->font[x + 1] = c->mbcs; + ml->fontx[x + 1] = 0; + } # else ml->font[x + 1] |= 0x80; # endif @@ -2711,7 +2732,10 @@ int x, y; if (p->w_encoding != UTF8) ml->font[x + 1] |= 0x80; else if (p->w_encoding == UTF8 && c->mbcs) - ml->font[x + 1] = c->mbcs; + { + ml->font[x + 1] = c->mbcs; + ml->fontx[x + 1] = 0; + } # else ml->font[x + 1] |= 0x80; # endif @@ -2767,22 +2791,40 @@ int x, y; MKillDwRight(p, ml, x); MKillDwLeft(p, ml, x + n - 1); bcopy(s, (char *)ml->image + x, n); - b = ml->attr + x; - for (i = n; i-- > 0;) - *b++ = r->attr; + if (ml->attr != null) + { + b = ml->attr + x; + for (i = n; i-- > 0;) + *b++ = r->attr; + } #ifdef FONT - b = ml->font + x; - for (i = n; i-- > 0;) - *b++ = r->font; + if (ml->font != null) + { + b = ml->font + x; + for (i = n; i-- > 0;) + *b++ = r->font; + } + if (ml->fontx != null) + { + b = ml->fontx + x; + for (i = n; i-- > 0;) + *b++ = r->fontx; + } #endif #ifdef COLOR - b = ml->color + x; - for (i = n; i-- > 0;) - *b++ = r->color; + if (ml->color != null) + { + b = ml->color + x; + for (i = n; i-- > 0;) + *b++ = r->color; + } # ifdef COLORS256 - b = ml->colorx + x; - for (i = n; i-- > 0;) - *b++ = r->colorx; + if (ml->colorx != null) + { + b = ml->colorx + x; + for (i = n; i-- > 0;) + *b++ = r->colorx; + } # endif #endif } @@ -2840,6 +2882,9 @@ struct mline *ml; 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 @@ -2881,6 +2926,15 @@ int ys, ye; break; # endif #endif +#ifdef UTF8 + if (p->w_encoding == UTF8) + { + if (ml->font != null && bcmp((char*)ml->font, null, p->w_width)) + break; + if (ml->fontx != null && bcmp((char*)ml->fontx, null, p->w_width)) + break; + } +#endif } debug1("MFindUsedLine returning %d\n", y); return y; @@ -882,6 +882,12 @@ screen_builtin_lck() salt[1] = 'A' + (int)((time(0) >> 6) % 26); salt[2] = 0; pass = crypt(mypass, salt); + if (!pass) + { + fprintf(stderr, "crypt() error.\007\n"); + sleep(2); + return; + } pass = ppp->pw_passwd = SaveStr(pass); } #endif @@ -924,7 +930,8 @@ screen_builtin_lck() if (pam_error == PAM_SUCCESS) break; #else - if (!strncmp(crypt(cp1, pass), pass, strlen(pass))) + char *buf = crypt(cp1, pass); + if (buf && !strncmp(buf, pass, strlen(pass))) break; #endif debug("screen_builtin_lck: NO!!!!!\n"); @@ -80,6 +80,7 @@ $AWK < ${srcdir}/comm.c >> comm.h ' old = $2; } ' + $CC -E -I. -I${srcdir} ${srcdir}/comm.c > comm.cpp sed < comm.cpp \ -n \ @@ -594,7 +594,7 @@ int c; # ifdef UTF8 if (D_encoding == UTF8) { - c = (c & 255) | (unsigned char)D_rend.font << 8; + c = (c & 255) | (unsigned char)D_rend.font << 8 | (unsigned char)D_rend.fontx << 16; # ifdef DW_CHARS if (D_mbcs) { @@ -1882,6 +1882,10 @@ struct mchar *mc; #ifdef FONT if (D_rend.font != mc->font) SetFont(mc->font); +#ifdef UTF8 + if (D_encoding == UTF8) + D_rend.fontx = mc->fontx; +#endif #endif } @@ -1934,6 +1938,10 @@ int x; #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 } diff --git a/doc/screen.1 b/doc/screen.1 index bbb5a3d..2ec73b5 100644 --- a/doc/screen.1 +++ b/doc/screen.1 @@ -394,10 +394,12 @@ refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care. .TP 5 .B \-X -Send the specified command to a running screen session. You can use -the \fB-d\fP or \fB-r\fP option to tell screen to look only for -attached or detached screen sessions. Note that this command doesn't -work if the session is password protected. +Send the specified command to a running screen session. You may +use the \fB-S\fP option to specify the screen session if you have +several screen sessions running. You can use the \fB-d\fP or +\fB-r\fP option to tell screen to look only for attached or +detached screen sessions. Note that this command doesn't work if +the session is password protected. .SH "DEFAULT KEY BINDINGS" .ta 12n 26n @@ -512,7 +514,7 @@ Switch to the next window. Show the number (and title) of the current window. .IP "\fBC-a backspace\fP" .PD 0 -.IP "\fBC-a h\fP" +.IP "\fBC-a C-h\fP" .IP "\fBC-a p\fP" .IP "\fBC-a C-p\fP (prev)" .PD diff --git a/doc/screen.texinfo b/doc/screen.texinfo index e39003a..d721647 100644 --- a/doc/screen.texinfo +++ b/doc/screen.texinfo @@ -458,10 +458,11 @@ But when cascading multiple screens, loops are not detected; take care. @item -X -Send the specified command to a running screen session. You can use -the @code{-d} or @code{-r} option to tell screen to look only for -attached or detached screen sessions. Note that this command doesn't -work if the session is password protected. +Send the specified command to a running screen session. You may use +the @code{-S} option to specify the screen session if you have several +running. You can use the @code{-d} or @code{-r} option to tell screen +to look only for attached or detached screen sessions. Note that this +command doesn't work if the session is password protected. @end table @@ -514,6 +514,8 @@ int from, to; if (rmc.font == 0) /* latin1 is the same in unicode */ return mc; c = rmc.image | (rmc.font << 8); + if (from == UTF8) + c |= rmc.fontx << 16; #ifdef DW_CHARS if (rmc.mbcs) { @@ -526,6 +528,8 @@ int from, to; c = recode_char_to_encoding(c, to); rmc.image = c & 255; rmc.font = c >> 8 & 255; + if (to == UTF8) + rmc.fontx = c >> 16 & 255; return &rmc; } @@ -542,7 +546,7 @@ int from, to; if (from == to || (from != UTF8 && to != UTF8) || w == 0) return ml; - if (ml->font == null && encodings[from].deffont == 0) + if (ml->font == null && ml->fontx == null && encodings[from].deffont == 0) return ml; if (w > maxlen) { @@ -556,7 +560,11 @@ int from, to; rml[i].font = malloc(w); else rml[i].font = realloc(rml[i].font, w); - if (rml[i].image == 0 || rml[i].font == 0) + if (rml[i].fontx == 0) + rml[i].fontx = malloc(w); + else + rml[i].fontx = realloc(rml[i].fontx, w); + if (rml[i].image == 0 || rml[i].font == 0 || rml[i].fontx == 0) { maxlen = 0; return ml; /* sorry */ @@ -578,6 +586,12 @@ int from, to; for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(ml->font[i] ) & 15]); debug("\n"); + for (i = 0; i < w; i++) + debug1("%c", "0123456789abcdef"[(ml->fontx[i] >> 4) & 15]); + debug("\n"); + for (i = 0; i < w; i++) + debug1("%c", "0123456789abcdef"[(ml->fontx[i] ) & 15]); + debug("\n"); rl = rml + last; rl->attr = ml->attr; @@ -590,6 +604,8 @@ int from, to; for (i = 0; i < w; i++) { c = ml->image[i] | (ml->font[i] << 8); + if (from == UTF8) + c |= ml->fontx[i] << 16; if (from != UTF8 && c < 256) c |= encodings[from].deffont << 8; #ifdef DW_CHARS @@ -603,6 +619,8 @@ int from, to; i++; c2 = ml->image[i] | (ml->font[i] << 8); c = recode_char_dw_to_encoding(c, &c2, to); + if (to == UTF8) + rl->fontx[i - 1] = c >> 16 & 255; rl->font[i - 1] = c >> 8 & 255; rl->image[i - 1] = c & 255; c = c2; @@ -613,6 +631,8 @@ int from, to; c = recode_char_to_encoding(c, to); rl->image[i] = c & 255; rl->font[i] = c >> 8 & 255; + if (to == UTF8) + rl->fontx[i] = c >> 16 & 255; } last ^= 1; debug("recode_mline: to\n"); @@ -628,14 +648,20 @@ int from, to; for (i = 0; i < w; i++) debug1("%c", "0123456789abcdef"[(rl->font[i] ) & 15]); debug("\n"); + for (i = 0; i < w; i++) + debug1("%c", "0123456789abcdef"[(rl->fontx[i] >> 4) & 15]); + debug("\n"); + for (i = 0; i < w; i++) + debug1("%c", "0123456789abcdef"[(rl->fontx[i] ) & 15]); + debug("\n"); return rl; } struct combchar { - unsigned short c1; - unsigned short c2; - unsigned short next; - unsigned short prev; + unsigned int c1; + unsigned int c2; + unsigned int next; + unsigned int prev; }; struct combchar **combchars; @@ -649,10 +675,20 @@ int c; AddUtf8(combchars[c - 0xd800]->c1); c = combchars[c - 0xd800]->c2; } + if (c >= 0x10000) + { + if (c >= 0x200000) + { + AddChar((c & 0x3000000) >> 12 ^ 0xf8); + c = (c & 0xffffff) ^ ((0xf0 ^ 0x80) << 18); + } + AddChar((c & 0x1fc0000) >> 18 ^ 0xf0); + c = (c & 0x3ffff) ^ ((0xe0 ^ 0x80) << 12); + } if (c >= 0x800) { - AddChar((c & 0xf000) >> 12 | 0xe0); - c = (c & 0x0fff) | 0x1000; + AddChar((c & 0x7f000) >> 12 ^ 0xe0); + c = (c & 0x0fff) ^ ((0xc0 ^ 0x80) << 6); } if (c >= 0x80) { @@ -683,10 +719,24 @@ char *p; int c; { int l = 1; + if (c >= 0x10000) + { + if (c >= 0x200000) + { + if (p) + *p++ = (c & 0x3000000) >> 12 ^ 0xf8; + l++; + c = (c & 0xffffff) ^ ((0xf0 ^ 0x80) << 18); + } + if (p) + *p++ = (c & 0x1fc0000) >> 18 ^ 0xf0; + l++; + c = (c & 0x3ffff) ^ ((0xe0 ^ 0x80) << 12); + } if (c >= 0x800) { if (p) - *p++ = (c & 0xf000) >> 12 | 0xe0; + *p++ = (c & 0x7f000) >> 12 ^ 0xe0; l++; c = (c & 0x0fff) | 0x1000; } @@ -758,8 +808,13 @@ int c, *utf8charp; *utf8charp = utf8char = (c & 0x80000000) ? c : 0; if (utf8char) return -1; +#if 0 if (c & 0xffff0000) c = UCS_REPL; /* sorry, only know 16bit Unicode */ +#else + if (c & 0xff800000) + c = UCS_REPL; /* sorry, only know 23bit Unicode */ +#endif if (c >= 0xd800 && (c <= 0xdfff || c == 0xfffe || c == 0xffff)) c = UCS_REPL; /* illegal code */ return c; @@ -803,11 +858,13 @@ int encoding; #else ml = &p->w_mlines[j]; #endif - if (ml->font == null && encodings[p->w_encoding].deffont == 0) + if (ml->font == null && ml->fontx == 0 && encodings[p->w_encoding].deffont == 0) continue; for (i = 0; i < p->w_width; i++) { c = ml->image[i] | (ml->font[i] << 8); + if (p->w_encoding == UTF8) + c |= ml->fontx[i] << 16; if (p->w_encoding != UTF8 && c < 256) c |= encodings[p->w_encoding].deffont << 8; if (c < 256) @@ -829,8 +886,22 @@ int encoding; { int c2; i++; - c2 = ml->image[i] | (ml->font[i] << 8); + c2 = ml->image[i] | (ml->font[i] << 8) | (ml->fontx[i] << 16); c = recode_char_dw_to_encoding(c, &c2, encoding); + if (encoding == UTF8) + { + if (c > 0x10000 && ml->fontx == null) + { + if ((ml->fontx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) + { + ml->fontx = null; + break; + } + } + ml->fontx[i - 1] = c >> 16 & 255; + } + else + ml->fontx = null; ml->font[i - 1] = c >> 8 & 255; ml->image[i - 1] = c & 255; c = c2; @@ -841,6 +912,20 @@ int encoding; c = recode_char_to_encoding(c, encoding); ml->image[i] = c & 255; ml->font[i] = c >> 8 & 255; + if (encoding == UTF8) + { + if (c > 0x10000 && ml->fontx == null) + { + if ((ml->fontx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) + { + ml->fontx = null; + break; + } + } + ml->fontx[i] = c >> 16 & 255; + } + else + ml->fontx = null; } } p->w_encoding = encoding; @@ -1039,7 +1124,7 @@ struct mchar *mc; int root, i, c1; int isdouble; - c1 = mc->image | (mc->font << 8); + c1 = mc->image | (mc->font << 8) | mc->fontx << 16; isdouble = c1 >= 0x1100 && utf8_isdouble(c1); if (!combchars) { @@ -1102,6 +1187,7 @@ struct mchar *mc; combchars[i]->c2 = c; mc->image = i & 0xff; mc->font = (i >> 8) + 0xd8; + mc->fontx = 0; debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800); comb_tofront(root, i); } @@ -1220,6 +1306,15 @@ struct win *p; p->w_c1 = 0; } +/* decoded char: 32-bit <fontx><font><c2><c> + * fontx: non-bmp utf8 + * c2: multi-byte character + * font is always zero for utf8 + * returns: -1 need more bytes + * -2 decode error + */ + + int DecodeChar(c, encoding, statep) int c; @@ -1231,7 +1326,12 @@ int *statep; debug2("Decoding char %02x for encoding %d\n", c, encoding); #ifdef UTF8 if (encoding == UTF8) - return FromUtf8(c, statep); + { + c = FromUtf8(c, statep); + if (c >= 0x10000) + c = (c & 0x7f0000) << 8 | (c & 0xffff); + return c; + } #endif if (encoding == SJIS) { @@ -1345,7 +1445,7 @@ int *fontp; } return 3; } - f = c >> 16; + f = (c >> 16) & 0xff; #ifdef UTF8 if (encoding == UTF8) @@ -1368,8 +1468,10 @@ int *fontp; } return ToUtf8(bp, c); } - if ((c & 0xff00) && f == 0) /* is_utf8? */ + if (f == 0 && (c & 0x7f00ff00) != 0) /* is_utf8? */ { + if (c >= 0x10000) + c = (c & 0x7f0000) >> 8 | (c & 0xffff); # ifdef DW_CHARS if (utf8_isdouble(c)) { @@ -33,8 +33,10 @@ #ifdef FONT # define IFFONT(x) x +# define IFFONTX(x) x #else # define IFFONT(x) +# define IFFONTX(x) #endif #ifdef COLOR @@ -59,6 +61,7 @@ struct mchar { unsigned char image; unsigned char attr; IFFONT( unsigned char font; ) +IFFONTX( unsigned char fontx; ) IFCOLOR( unsigned char color; ) IFCOLORX(unsigned char colorx; ) IFDWCHAR(unsigned char mbcs; ) @@ -68,6 +71,7 @@ struct mline { unsigned char *image; unsigned char *attr; IFFONT( unsigned char *font; ) +IFFONTX( unsigned char *fontx; ) IFCOLOR( unsigned char *color; ) IFCOLORX(unsigned char *colorx; ) }; @@ -78,6 +82,7 @@ IFCOLORX(unsigned char *colorx; ) bcopy((char *)(ml)->image, (char *)mline_old.image, (n)); \ bcopy((char *)(ml)->attr, (char *)mline_old.attr, (n)); \ IFFONT( bcopy((char *)(ml)->font, (char *)mline_old.font, (n)); ) \ +IFFONTX( bcopy((char *)(ml)->fontx, (char *)mline_old.fontx, (n)); ) \ IFCOLOR( bcopy((char *)(ml)->color, (char *)mline_old.color, (n)); ) \ IFCOLORX(bcopy((char *)(ml)->colorx, (char *)mline_old.colorx, (n)); ) \ } while (0) @@ -86,6 +91,7 @@ IFCOLORX(bcopy((char *)(ml)->colorx, (char *)mline_old.colorx, (n)); ) \ bcopy((char *)(ml)->image + (xf), (char *)(ml)->image + (xt), (n)); \ bcopy((char *)(ml)->attr + (xf), (char *)(ml)->attr + (xt), (n)); \ IFFONT( bcopy((char *)(ml)->font + (xf), (char *)(ml)->font + (xt), (n)); ) \ +IFFONTX( bcopy((char *)(ml)->fontx + (xf), (char *)(ml)->fontx + (xt), (n)); ) \ IFCOLOR( bcopy((char *)(ml)->color + (xf), (char *)(ml)->color + (xt), (n)); ) \ IFCOLORX(bcopy((char *)(ml)->colorx + (xf), (char *)(ml)->colorx + (xt), (n));) \ } while (0) @@ -94,6 +100,7 @@ IFCOLORX(bcopy((char *)(ml)->colorx + (xf), (char *)(ml)->colorx + (xt), (n));) bclear((char *)(ml)->image + (x), (n)); \ if ((ml)->attr != null) bzero((char *)(ml)->attr + (x), (n)); \ IFFONT( if ((ml)->font != null) bzero((char *)(ml)->font + (x), (n)); ) \ +IFFONTX( if ((ml)->fontx != null) bzero((char *)(ml)->fontx + (x), (n)); ) \ IFCOLOR( if ((ml)->color!= null) bzero((char *)(ml)->color + (x), (n)); ) \ IFCOLORX(if ((ml)->colorx!= null) bzero((char *)(ml)->colorx + (x), (n)); ) \ } while (0) @@ -102,6 +109,7 @@ IFCOLORX(if ((ml)->colorx!= null) bzero((char *)(ml)->colorx + (x), (n)); ) \ (ml1)->image[x] == (ml2)->image[x] \ && (ml1)->attr[x] == (ml2)->attr[x] \ IFFONT( && (ml1)->font[x] == (ml2)->font[x] ) \ +IFFONTX( && (ml1)->fontx[x] == (ml2)->fontx[x] ) \ IFCOLOR( && (ml1)->color[x] == (ml2)->color[x] ) \ IFCOLORX(&& (ml1)->colorx[x] == (ml2)->colorx[x] ) \ ) @@ -110,6 +118,7 @@ IFCOLORX(&& (ml1)->colorx[x] == (ml2)->colorx[x] ) \ (mc1)->image == (mc2)->image \ && (mc1)->attr == (mc2)->attr \ IFFONT( && (mc1)->font == (mc2)->font ) \ +IFFONTX( && (mc1)->fontx == (mc2)->fontx ) \ IFCOLOR( && (mc1)->color == (mc2)->color ) \ IFCOLORX(&& (mc1)->colorx == (mc2)->colorx ) \ ) @@ -118,6 +127,7 @@ IFCOLORX(&& (mc1)->colorx == (mc2)->colorx ) \ (mc)->image == (ml)->image[x] \ && (mc)->attr == (ml)->attr[x] \ IFFONT( && (mc)->font == (ml)->font[x] ) \ +IFFONTX( && (mc)->fontx == (ml)->fontx[x] ) \ IFCOLOR( && (mc)->color == (ml)->color[x] ) \ IFCOLORX(&& (mc)->colorx == (ml)->colorx[x] ) \ ) @@ -126,6 +136,7 @@ IFCOLORX(&& (mc)->colorx == (ml)->colorx[x] ) \ (ml)->image[x] = (mc)->image; \ (ml)->attr[x] = (mc)->attr; \ IFFONT( (ml)->font[x] = (mc)->font; ) \ +IFFONTX( (ml)->fontx[x] = (mc)->fontx; ) \ IFCOLOR( (ml)->color[x] = (mc)->color; ) \ IFCOLORX((ml)->colorx[x] = (mc)->colorx; ) \ } while (0) @@ -134,6 +145,7 @@ IFCOLORX((ml)->colorx[x] = (mc)->colorx; ) \ (mc)->image = (ml)->image[x]; \ (mc)->attr = (ml)->attr[x]; \ IFFONT( (mc)->font = (ml)->font[x]; ) \ +IFFONTX( (mc)->fontx = (ml)->fontx[x]; ) \ IFCOLOR( (mc)->color = (ml)->color[x]; ) \ IFCOLORX((mc)->colorx = (ml)->colorx[x]; ) \ IFDWCHAR((mc)->mbcs = 0; ) \ @@ -68,6 +68,7 @@ int 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; @@ -409,7 +410,7 @@ int x, y; SetRendition(r); s2 = s + xs2 - x - vp->v_xoff; #ifdef UTF8 - if (D_encoding == UTF8 && l->l_encoding != UTF8 && (r->font || l->l_encoding)) + if (D_encoding == UTF8 && l->l_encoding != UTF8 && (r->font || r->fontx || l->l_encoding)) { struct mchar mc; mc = *r; @@ -283,8 +283,8 @@ char *pt; unsigned char *im; struct mline *ml; #ifdef FONT - int cf, font; - unsigned char *fo; + int cf, cfx, font; + unsigned char *fo, *fox; #endif markdata->second = 0; @@ -332,6 +332,7 @@ char *pt; im = ml->image + j; #ifdef FONT fo = ml->font + j; + fox = ml->fontx + j; font = ASCII; #endif for (; j <= to; j++) @@ -339,10 +340,11 @@ char *pt; c = (unsigned char)*im++; #ifdef FONT cf = (unsigned char)*fo++; + cfx = (unsigned char)*fox++; # ifdef UTF8 if (fore->w_encoding == UTF8) { - c |= cf << 8; + c |= cf << 8 | cfx << 16; if (c == UCS_HIDDEN) continue; c = ToUtf8_comb(pt, c); @@ -1234,7 +1236,10 @@ int tx, ty, line; mc = mchar_so; #ifdef FONT if (pastefont) - mc.font = ml->font[x]; + { + mc.font = ml->font[x]; + mc.fontx = ml->fontx[x]; + } #endif mc.image = ml->image[x]; } @@ -1354,7 +1359,10 @@ int isblank; break; #ifdef FONT if (pastefont) - mchar_marked.font = ml->font[x]; + { + mchar_marked.font = ml->font[x]; + mchar_marked.fontx = ml->fontx[x]; + } #endif mchar_marked.image = ml->image[x]; #ifdef DW_CHARS @@ -1433,7 +1441,10 @@ struct mchar *rend; { #ifdef FONT if (pastefont) - mchar_marked.font = ml->font[x]; + { + mchar_marked.font = ml->font[x]; + mchar_marked.fontx = ml->fontx[x]; + } #endif rend->image = mchar_marked.image; if (!cmp_mchar(rend, &mchar_marked)) diff --git a/patchlevel.h b/patchlevel.h index 0695698..e3985ce 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -532,7 +532,7 @@ #define ORIGIN "GNU" #define REV 4 -#define VERS 1 +#define VERS 2 #define PATCHLEVEL 0 -#define DATE "2-May-06" -#define STATE "devel" +#define DATE "16-Apr-14" +#define STATE "" @@ -6360,6 +6360,12 @@ char *data; buf = crypt(u->u_password, salt); bzero(u->u_password, strlen(u->u_password)); free((char *)u->u_password); + if (!buf) + { + Msg(0, "[ crypt() error - no secure ]"); + u->u_password = NullStr; + return; + } u->u_password = SaveStr(buf); bzero(buf, strlen(buf)); #ifdef COPY_PASTE @@ -6472,6 +6478,7 @@ int i; { struct action *act; int discard = 0; + int keyno = i; debug1("StuffKey #%d", i); #ifdef DEBUG @@ -6511,6 +6518,9 @@ int i; if (discard && (!act || act->nr != RC_COMMAND)) { + /* if the input was just a single byte we let it through */ + if (D_tcs[keyno + T_CAPS].str && strlen(D_tcs[keyno + T_CAPS].str) == 1) + return -1; if (D_ESCseen) { D_ESCseen = 0; @@ -428,6 +428,8 @@ struct mline *ml; #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) @@ -449,6 +451,7 @@ int w; ml->attr = null; #ifdef FONT ml->font = null; + ml->fontx = null; #endif #ifdef COLOR ml->color = null; @@ -485,6 +488,13 @@ int xf, xt, l, w; } if (mlt->font != null) bcopy((char *)mlf->font + xf, (char *)mlt->font + xt, l); + if (mlf->fontx != null && mlt->fontx == null) + { + if ((mlt->fontx = (unsigned char *)calloc(w, 1)) == 0) + mlt->fontx = null, r = -1; + } + if (mlt->fontx != null) + bcopy((char *)mlf->fontx + xf, (char *)mlt->fontx + xt, l); #endif #ifdef COLOR if (mlf->color != null && mlt->color == null) @@ -531,6 +541,7 @@ int wi; 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); @@ -538,7 +549,7 @@ int wi; 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) IFCOLOR(&& mline_old.color) IFCOLORX(&& mline_old.colorx))) + if (!(blank && null && mline_old.image && mline_old.attr IFFONT(&& mline_old.font) IFFONTX(&& mline_old.fontx) IFCOLOR(&& mline_old.color) IFCOLORX(&& mline_old.colorx))) Panic(0, "%s", strnomem); MakeBlankLine(blank, maxwidth); @@ -550,7 +561,9 @@ int wi; mline_null.attr = null; #ifdef FONT mline_blank.font = null; - mline_null.font = null; + mline_null.font = null; + mline_blank.fontx = null; + mline_null.fontx = null; #endif #ifdef COLOR mline_blank.color = null; @@ -571,6 +584,7 @@ int wi; RESET_AFC(ml->image, blank); \ RESET_AFC(ml->attr, null); \ IFFONT(RESET_AFC(ml->font, null)); \ + IFFONT(RESET_AFC(ml->fontx, null)); \ IFCOLOR(RESET_AFC(ml->color, null)); \ IFCOLORX(RESET_AFC(ml->colorx, null)); \ } \ @@ -966,14 +980,16 @@ int wi, he, hi; p->w_y = he - 1; if (p->w_saved.x > wi) p->w_saved.x = wi; - if (p->w_saved.y < 0) - p->w_saved.y = 0; if (p->w_saved.y >= he) p->w_saved.y = he - 1; + if (p->w_saved.y < 0) + p->w_saved.y = 0; if (p->w_alt.cursor.x > wi) p->w_alt.cursor.x = wi; if (p->w_alt.cursor.y >= he) p->w_alt.cursor.y = he - 1; + if (p->w_alt.cursor.y < 0) + p->w_alt.cursor.y = 0; /* reset scrolling region */ p->w_top = 0; @@ -1015,7 +1031,7 @@ int wi, he, hi; if (p->w_encoding == UTF8) { for (l = 0; l < p->w_width; l++) - ASSERT(ml->image[l] >= ' ' || ml->font[l]); + ASSERT(ml->image[l] >= ' ' || ml->font[l] || ml->fontx); } else #endif @@ -988,7 +988,7 @@ char **av; Panic(0, "$HOME too long - sorry."); attach_tty = ""; - if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag) && !(!mflag && !SockMatch && sty && !xflag)) + if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag) && !(sty && !SockMatch && !mflag && !rflag && !xflag)) { #ifndef NAMEDPIPE int fl; @@ -1565,13 +1565,18 @@ int ilen; c = *(unsigned char *)ibuf++; if (c == '\r' || c == '\n') { + char *buf = NULL; up = D_user->u_password; pwdata->buf[l] = 0; - if (strncmp(crypt(pwdata->buf, up), up, strlen(up))) + buf = crypt(pwdata->buf, up); + if (!buf || strncmp(buf, up, strlen(up))) { /* uh oh, user failed */ bzero(pwdata->buf, sizeof(pwdata->buf)); - AddStr("\r\nPassword incorrect.\r\n"); + if (!buf) + AddStr("\r\ncrypt() failed.\r\n"); + else + AddStr("\r\nPassword incorrect.\r\n"); D_processinputdata = 0; /* otherwise freed by FreeDis */ FreeDisplay(); Msg(0, "Illegal reattach attempt from terminal %s.", pwdata->m.m_tty); @@ -403,6 +403,7 @@ struct mchar *rend; register unsigned char *p, *i; #ifdef FONT register unsigned char *f; + register unsigned char *fx; #endif #ifdef COLOR register unsigned char *c; @@ -424,6 +425,7 @@ struct mchar *rend; 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; @@ -448,6 +450,8 @@ struct mchar *rend; #ifdef FONT if (*f++ != rend->font) return EXPENSIVE; + if (*fx++ != rend->fontx) + return EXPENSIVE; #endif #ifdef COLOR if (*c++ != rend->color) |