diff options
author | joerg <joerg@FreeBSD.org> | 1997-11-05 20:20:17 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1997-11-05 20:20:17 +0000 |
commit | a79b41490ac424ce48e1668239a29e4d1232d37a (patch) | |
tree | 1dee5beb8c799a2f8871ce5cff88482ff328d6a9 /usr.bin/window | |
parent | 0bc9255aaad71db6321c5ff6bcc2dea8ada0b3a6 (diff) | |
download | FreeBSD-src-a79b41490ac424ce48e1668239a29e4d1232d37a.zip FreeBSD-src-a79b41490ac424ce48e1668239a29e4d1232d37a.tar.gz |
Make window(1) honor the LC_CTYPE setting.
While i was at it, don't export \E[OA style cursor key strings into the
TERMCAP variable since window's emulation doesn't support it. Instead,
convert to \E[[A etc.
Diffstat (limited to 'usr.bin/window')
-rw-r--r-- | usr.bin/window/main.c | 2 | ||||
-rw-r--r-- | usr.bin/window/wwinit.c | 33 |
2 files changed, 31 insertions, 4 deletions
diff --git a/usr.bin/window/main.c b/usr.bin/window/main.c index 4b95868..3613ca1 100644 --- a/usr.bin/window/main.c +++ b/usr.bin/window/main.c @@ -46,6 +46,7 @@ static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/2/94"; #include "defs.h" #include <paths.h> +#include <locale.h> #include <stdio.h> #include "string.h" #include "char.h" @@ -120,6 +121,7 @@ char **argv; default_nline = NLINE; default_smooth = 1; (void) gettimeofday(&starttime, (struct timezone *)0); + (void) setlocale(LC_CTYPE, ""); if (wwinit() < 0) { (void) fprintf(stderr, "%s.\n", wwerror()); exit(1); diff --git a/usr.bin/window/wwinit.c b/usr.bin/window/wwinit.c index 05cc0b0..7d742b7 100644 --- a/usr.bin/window/wwinit.c +++ b/usr.bin/window/wwinit.c @@ -280,10 +280,10 @@ wwinit() if (tt.tt_delchar) wwaddcap1(WWT_DC, &kp); wwaddcap("kb", &kp); - wwaddcap("ku", &kp); - wwaddcap("kd", &kp); - wwaddcap("kl", &kp); - wwaddcap("kr", &kp); + wwaddcap2("ku", &kp); + wwaddcap2("kd", &kp); + wwaddcap2("kl", &kp); + wwaddcap2("kr", &kp); wwaddcap("kh", &kp); if ((j = tgetnum("kn")) >= 0) { char cap[32]; @@ -361,6 +361,31 @@ wwaddcap1(cap, kp) (*kp)--; } +wwaddcap2(cap, kp) + register char *cap; + register char **kp; +{ + char tbuf[512]; + char *tp = tbuf; + register char *str, *p; + + if ((str = tgetstr(cap, &tp)) != 0) { + /* we don't support vt100's application key mode, remap */ + if (str[0] == ctrl('[') && str[1] == 'O') + str[1] = '['; + while (*(*kp)++ = *cap++) + ; + (*kp)[-1] = '='; + while (*str) { + for (p = unctrl(*str++); *(*kp)++ = *p++;) + ; + (*kp)--; + } + *(*kp)++ = ':'; + **kp = 0; + } +} + wwstart() { register i; |