summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--Makefile.in59
-rw-r--r--NEWS80
-rw-r--r--TODO5
-rw-r--r--acls.c111
-rw-r--r--acls.h29
-rw-r--r--ansi.c899
-rw-r--r--ansi.h62
-rw-r--r--attacher.c248
-rw-r--r--braille.c12
-rw-r--r--braille.h3
-rw-r--r--comm.c91
-rw-r--r--comm.h.dist306
-rw-r--r--comm.sh3
-rw-r--r--config.h.in71
-rwxr-xr-xconfigure908
-rw-r--r--configure.in234
-rw-r--r--debian/README.Debian53
-rw-r--r--debian/README.terminfo4
-rw-r--r--debian/changelog170
-rw-r--r--debian/conffiles1
-rw-r--r--debian/config10
-rw-r--r--debian/control23
-rw-r--r--debian/copyright46
-rw-r--r--debian/dirs2
-rw-r--r--debian/docs10
-rw-r--r--debian/info6
-rw-r--r--debian/manpages1
-rw-r--r--debian/pam.d-screen1
-rw-r--r--debian/postinst43
-rw-r--r--debian/postrm9
-rw-r--r--debian/preinst109
-rw-r--r--debian/prerm5
-rwxr-xr-xdebian/rules144
-rw-r--r--debian/screen.lintian.overrides2
-rw-r--r--debian/screen.pam6
-rw-r--r--debian/screenrc108
-rw-r--r--debian/templates8
-rw-r--r--debian/templates.de13
-rw-r--r--debian/templates.es14
-rw-r--r--debian/templates.fr14
-rw-r--r--debian/templates.ru13
-rw-r--r--display.c1233
-rw-r--r--display.h42
-rw-r--r--doc/Makefile.in19
-rw-r--r--doc/screen.1588
-rw-r--r--doc/screen.info325
-rw-r--r--doc/screen.info-1325
-rw-r--r--doc/screen.info-2446
-rw-r--r--doc/screen.info-3622
-rw-r--r--doc/screen.info-4934
-rw-r--r--doc/screen.info-5770
-rw-r--r--doc/screen.texinfo811
-rw-r--r--encoding.c1502
-rwxr-xr-xetc/ccdefs3
-rw-r--r--etc/completer.zsh53
-rw-r--r--etc/etcscreenrc16
-rw-r--r--etc/screenrc23
-rwxr-xr-xetc/toolcheck16
-rw-r--r--extern.h158
-rw-r--r--fileio.c178
-rw-r--r--help.c540
-rw-r--r--image.h138
-rw-r--r--input.c14
-rw-r--r--layer.c227
-rw-r--r--layer.h35
-rw-r--r--loadav.c41
-rw-r--r--logfile.c25
-rw-r--r--logfile.h2
-rw-r--r--mark.c253
-rw-r--r--mark.h4
-rw-r--r--misc.c9
-rw-r--r--nethack.c4
-rw-r--r--os.h21
-rw-r--r--osdef.h.in6
-rw-r--r--osdef.sh8
-rw-r--r--patchlevel.h66
-rw-r--r--process.c1851
-rw-r--r--pty.c20
-rw-r--r--putenv.c14
-rw-r--r--rcs.h2
-rw-r--r--resize.c191
-rw-r--r--sched.c30
-rw-r--r--sched.h23
-rw-r--r--screen.c686
-rw-r--r--screen.h25
-rw-r--r--search.c41
-rw-r--r--socket.c152
-rw-r--r--teln.c15
-rw-r--r--term.c6
-rw-r--r--term.h.dist179
-rw-r--r--termcap.c90
-rw-r--r--terminfo/screeninfo.src28
-rw-r--r--tty.c.dist140
-rw-r--r--tty.sh128
-rw-r--r--utf8encodings/01bin0 -> 29808 bytes
-rw-r--r--utf8encodings/02bin0 -> 27550 bytes
-rw-r--r--utf8encodings/03bin0 -> 32926 bytes
-rw-r--r--utf8encodings/04bin0 -> 24302 bytes
-rw-r--r--utf8encodings/18bin0 -> 54862 bytes
-rw-r--r--utf8encodings/a1bin0 -> 536 bytes
-rw-r--r--utf8encodings/bfbin0 -> 232 bytes
-rw-r--r--utf8encodings/c2bin0 -> 256 bytes
-rw-r--r--utf8encodings/c3bin0 -> 140 bytes
-rw-r--r--utf8encodings/c4bin0 -> 228 bytes
-rw-r--r--utf8encodings/c6bin0 -> 68 bytes
-rw-r--r--utf8encodings/c7bin0 -> 52 bytes
-rw-r--r--utf8encodings/c8bin0 -> 40 bytes
-rw-r--r--utf8encodings/ccbin0 -> 68 bytes
-rw-r--r--utf8encodings/cdbin0 -> 52 bytes
-rw-r--r--utf8encodings/d6bin0 -> 212 bytes
-rw-r--r--utmp.c12
-rw-r--r--window.c204
-rw-r--r--window.h27
114 files changed, 12242 insertions, 5018 deletions
diff --git a/Makefile b/Makefile
index d3d2088..06b972a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,3 @@
install all Makefiles and config:
- sh ./configure
+ rm -f config.cache
+ sh ./configure
diff --git a/Makefile.in b/Makefile.in
index e23a776..652b75e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7,6 +7,8 @@
srcdir = @srcdir@
VPATH = @srcdir@
+DESTDIR =
+
# Where to install screen.
prefix = @prefix@
@@ -19,12 +21,15 @@ VERSION = @VERSION@
SCREEN = screen-$(VERSION)
ETCSCREENRC = `sed < config.h -n -e '/define ETCSCREENRC/s/^.*"\([^"]*\)"/\1/p'`
+SCREENENCODINGS = `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'`
CC = @CC@
-CFLAGS = -O @USEPAM@
-LDFLAGS =
-LIBS = @LIBS@ @LIBPAM@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+CPP=@CPP@
CPP_DEPEND=$(CC) -MM
INSTALL = @INSTALL@
@@ -41,11 +46,6 @@ AWK = @AWK@
# -DDUMPSHADOW
# With shadow-pw screen would never dump core. Use this option if
# you still want to have a core. Use only for debugging.
-# -DFORKDEBUG
-# Swap roles of father and son when forking the SCREEN process.
-# Note: "detach" will be less powerfull, but "pow_detach" may be
-# more forcefull than usual.
-# Useful only for debugging.
OPTIONS=
#OPTIONS= -DDEBUG
@@ -55,12 +55,12 @@ CFILES= screen.c ansi.c fileio.c mark.c misc.c resize.c socket.c \
search.c tty.c term.c window.c utmp.c loadav.c putenv.c help.c \
termcap.c input.c attacher.c pty.c process.c display.c comm.c \
kmapdef.c acls.c braille.c braille_tsi.c logfile.c layer.c \
- sched.c teln.c nethack.c
+ sched.c teln.c nethack.c encoding.c
OFILES= screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \
search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \
termcap.o input.o attacher.o pty.o process.o display.o comm.o \
kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o \
- sched.o teln.o nethack.o
+ sched.o teln.o nethack.o encoding.o
all: screen
@@ -71,20 +71,21 @@ screen: $(OFILES)
$(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $<
install_bin: .version screen
- -if [ -f $(bindir)/$(SCREEN) ] && [ ! -f $(bindir)/$(SCREEN).old ]; \
- then mv $(bindir)/$(SCREEN) $(bindir)/$(SCREEN).old; fi
- $(INSTALL_PROGRAM) screen $(bindir)/$(SCREEN)
- -chown root $(bindir)/$(SCREEN) && chmod 4755 $(bindir)/$(SCREEN)
+ -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
+ then mv $(DESTDIR)$(bindir)/$(SCREEN) $(DESTDIR)$(bindir)/$(SCREEN).old; fi
+ $(INSTALL_PROGRAM) screen $(DESTDIR)$(bindir)/$(SCREEN)
+ -chown root $(DESTDIR)$(bindir)/$(SCREEN) && chmod 4755 $(DESTDIR)$(bindir)/$(SCREEN)
# This doesn't work if $(bindir)/screen is a symlink
- -if [ -f $(bindir)/screen ] && [ ! -f $(bindir)/screen.old ]; then mv $(bindir)/screen $(bindir)/screen.old; fi
- rm -f $(bindir)/screen
- ln -s $(SCREEN) $(bindir)/screen
+ -if [ -f $(DESTDIR)$(bindir)/screen ] && [ ! -f $(DESTDIR)$(bindir)/screen.old ]; then mv $(DESTDIR)$(bindir)/screen $(DESTDIR)$(bindir)/screen.old; fi
+ rm -f $(DESTDIR)$(bindir)/screen
+ (cd $(DESTDIR)$(bindir) && ln -sf $(SCREEN) screen)
+ cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS)
###############################################################################
install: installdirs install_bin
cd doc ; $(MAKE) install
-if [ -d /usr/lib/terminfo ]; then \
- PATH="$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
+ PATH="$$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \
chmod 644 /usr/lib/terminfo/s/screen*; \
fi
# Better do this by hand. E.g. under RCS...
@@ -94,14 +95,14 @@ install: installdirs install_bin
installdirs:
# Path leading to ETCSCREENRC and Socketdirectory not checked.
- $(srcdir)/etc/mkinstalldirs $(bindir)
+ $(srcdir)/etc/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(SCREENENCODINGS)
cd doc ; $(MAKE) installdirs
uninstall: .version
- rm -f $(bindir)/$(SCREEN)
- rm -f $(bindir)/screen
- -mv $(bindir)/screen.old $(bindir)/screen
- rm -f $(ETCSCREENRC)
+ rm -f $(DESTDIR)$(bindir)/$(SCREEN)
+ rm -f $(DESTDIR)$(bindir)/screen
+ -mv $(DESTDIR)$(bindir)/screen.old $(DESTDIR)$(bindir)/screen
+ rm -f $(DESTDIR)$(ETCSCREENRC)
cd doc; $(MAKE) uninstall
shadow:
@@ -124,7 +125,7 @@ comm.h: comm.c comm.sh config.h
AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh
osdef.h: osdef.sh config.h osdef.h.in
- CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh
+ CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh
docs:
cd doc; $(MAKE) dvi screen.info
@@ -136,7 +137,7 @@ mostlyclean:
rm -f $(OFILES) screen config.cache osdef0.c osdef1.sed osdef2.sed
clean celan: mostlyclean
- rm -f tty.c term.h comm.h osdef.h core
+ rm -f tty.c term.h comm.h osdef.h kmapdef.c core
# Delete all files from the current directory that are created by
# configuring or building the program.
@@ -157,7 +158,7 @@ maintainer-clean:
realclean: .version mostlyclean
rm -f $(SCREEN).tar $(SCREEN).tar.gz
rm -f config.status Makefile doc/Makefile
- rm -f tty.c term.h comm.h osdef.h
+ rm -f tty.c term.h comm.h osdef.h kmapdef.c
rm -f config.h
echo "install all Makefiles and config:" > Makefile
echo " sh ./configure" >> Makefile
@@ -193,7 +194,9 @@ $(SCREEN).tar: .version term.h comm.h tty.c kmapdef.c
../dist/$(SCREEN)/terminfo
mkdir dist/$(SCREEN)/etc
cd etc; ln * ../dist/$(SCREEN)/etc
- sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/$(SCREEN)/etc/etcscreenrc
+ mkdir dist/$(SCREEN)/utf8encodings
+ cd utf8encodings; ln * ../dist/$(SCREEN)/utf8encodings
+ # sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/$(SCREEN)/etc/etcscreenrc
cp $(HOME)/.screenrc dist/$(SCREEN)/etc/screenrc
mkdir dist/$(SCREEN)/doc
sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/$(SCREEN)/doc/Makefile.in
@@ -324,3 +327,5 @@ teln.o: teln.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
nethack.o: nethack.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \
comm.h layer.h term.h image.h display.h window.h extern.h
+encoding.o: encoding.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \
+ comm.h layer.h term.h image.h display.h window.h extern.h
diff --git a/NEWS b/NEWS
index b0ecf3b..ad4b9e2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,83 @@
+ -------------------------------
+ What's new in screen-3.9.11 ?
+ -------------------------------
+
+* windowlist, bound to ^A"
+
+* support for other encodings, e.g. big5, koi8r, cp1251
+ new commands 'encoding', 'defencoding'
+ 'register', 'readreg', 'readbuf', 'writebuf' now understand
+ an extra encoding parameter
+
+* support for double utf-8 characters
+
+* lots of new string escapes and extensions to existsing ones:
+ %LD, %LM, %Lw, %W, %-w, %+w, %H, %f, %F, %l, %=, %<, %>
+
+* new commands: 'source', 'eval', 'deflog', 'ignorecase', 'setsid'
+
+* command key classes: 'bind', 'command' and 'help' understand
+ a '-c <class>' parameter. See the man page for examples
+
+* new login state: always - don't remove slot even if screen gets
+ detached
+
+* 256 color support (experimental)
+
+* configurable time format string (for ^At)
+
+* config option to use localized month/week names
+
+* new option '-h' for hardcopy: also dump the scrollback buffer
+
+
+ ------------------------------
+ What's new in screen-3.9.9 ?
+ ------------------------------
+
+* new '-X' option to send commands to screen sessions.
+
+ screen -X echo Hi...
+
+* added a possibility to change the attributes/color in caption or
+ hardstatus strings:
+
+ caption always "%3n %{r}%t%{-}%? @%u%?%? %{g}[%h]%{-}%?"
+
+* new 'dinfo' command to show what screen thinks about your terminal.
+
+* new 'attrcolor' command to map attributes to color codes:
+ attrcolor u "-u b"
+ attrcolor b "r"
+
+* support for UTF-8: new commands 'utf8', 'defutf8' to change the
+ encoding of a window, plus a '-U' option to tell screen that
+ your terminal sends/receives UTF-8 codes.
+
+* support for 16 colors.
+
+
+ ------------------------------
+ What's new in screen-3.9.8 ?
+ ------------------------------
+
+* new command 'resize' to resize regions (aka split windows), try:
+ bind = resize =
+ bind + resize +1
+ bind - resize -1
+ bind _ resize max
+
+* new argument for 'focus': up, down, top, bottom
+
+* X11 mouse tracking support
+
+* Support for the "new color model", aka "background color erase":
+ the bce/defbce commands change the color model of the current
+ window/new windows.
+
+* experimental rxvt OSC sequence support (used to set a background
+ picture or to change the default colors), disabled by default.
+
----------------------------
What's new in screen-3.9 ?
diff --git a/TODO b/TODO
index 2493216..01912af 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,7 @@
- display size adaption (Activate)
-- better kanji
-- message protocol (send screen command)
-- esc-sequence for screen commands
- process.c cleanup via comm splitting
- writelocks?
- partial?
- nonblock?
+- type into several windows at once (for cluster admins)
+- configurable digraph table
diff --git a/acls.c b/acls.c
index 74378d1..93b951a 100644
--- a/acls.c
+++ b/acls.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -57,7 +57,7 @@ extern struct win *windows, *wtab[];
extern char NullStr[];
extern char SockPath[];
extern struct display *display, *displays;
-struct user *users;
+struct acluser *users;
#ifdef MULTIUSER
int maxusercount = 0; /* used in process.c: RC_MONITOR, RC_SILENCE */
@@ -89,11 +89,11 @@ static char default_c_bit[ACL_BITS_PER_CMD] =
*/
static int GrowBitfield __P((AclBits *, int, int, int));
-static struct usergroup **FindGroupPtr __P((struct usergroup **, struct user *, int));
-static int AclSetPermCmd __P((struct user *, char *, struct comm *));
-static int AclSetPermWin __P((struct user *, struct user *, char *, struct win *));
-static int UserAcl __P((struct user *, struct user **, int, char **));
-static int UserAclCopy __P((struct user **, struct user **));
+static struct aclusergroup **FindGroupPtr __P((struct aclusergroup **, struct acluser *, int));
+static int AclSetPermCmd __P((struct acluser *, char *, struct comm *));
+static int AclSetPermWin __P((struct acluser *, struct acluser *, char *, struct win *));
+static int UserAcl __P((struct acluser *, struct acluser **, int, char **));
+static int UserAclCopy __P((struct acluser **, struct acluser **));
static int
@@ -124,11 +124,11 @@ int len, delta, defaultbit;
* Returns an nonzero Address. Its contents is either a User-ptr,
* or NULL which may be replaced by a User-ptr to create the entry.
*/
-struct user **
+struct acluser **
FindUserPtr(name)
char *name;
{
- struct user **u;
+ struct acluser **u;
for (u = &users; *u; u = &(*u)->u_next)
if (!strcmp((*u)->u_name, name))
@@ -153,7 +153,7 @@ int DefaultMetaEsc = -1;
int
UserAdd(name, pass, up)
char *name, *pass;
-struct user **up;
+struct acluser **up;
{
#ifdef MULTIUSER
int j;
@@ -168,12 +168,15 @@ struct user **up;
return 1; /* he is already there */
}
if (strcmp("none", name)) /* "none" is a reserved word */
- *up = (struct user *)calloc(1, sizeof(struct user));
+ *up = (struct acluser *)calloc(1, sizeof(struct acluser));
if (!*up)
return -1; /* he still does not exist */
#ifdef COPY_PASTE
- (*up)->u_copybuffer = NULL;
- (*up)->u_copylen = 0;
+ (*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;
@@ -197,7 +200,7 @@ struct user **up;
{
int j;
struct win *w;
- struct user *u;
+ struct acluser *u;
debug2("growing all bitfields %d += %d\n", maxusercount, USER_CHUNK);
/* the bitfields are full, grow a chunk */
@@ -305,7 +308,7 @@ struct user **up;
int
UserSetPass(name, pass, up)
char *name, *pass;
-struct user **up;
+struct acluser **up;
{
if (!up)
up = FindUserPtr(name);
@@ -326,9 +329,9 @@ struct user **up;
int
UserDel(name, up)
char *name;
-struct user **up;
+struct acluser **up;
{
- struct user *u;
+ struct acluser *u;
#ifdef MULTIUSER
int i;
#endif
@@ -355,13 +358,13 @@ struct user **up;
for (up = &users; *up; up = &(*up)->u_next)
{
/* unlink all group references to this user */
- struct usergroup **g = &(*up)->u_group;
+ struct aclusergroup **g = &(*up)->u_group;
while (*g)
{
if ((*g)->u == u)
{
- struct usergroup *next = (*g)->next;
+ struct aclusergroup *next = (*g)->next;
free((char *)(*g));
*g = next;
@@ -401,23 +404,23 @@ struct user **up;
*/
int
UserFreeCopyBuffer(u)
-struct user *u;
+struct acluser *u;
{
struct win *w;
struct paster *pa;
- if (!u->u_copybuffer)
+ if (!u->u_plop.buf)
return 1;
for (w = windows; w; w = w->w_next)
{
pa = &w->w_paster;
- if (pa->pa_pasteptr >= u->u_copybuffer &&
- pa->pa_pasteptr - u->u_copybuffer < u->u_copylen)
+ if (pa->pa_pasteptr >= u->u_plop.buf &&
+ pa->pa_pasteptr - u->u_plop.buf < u->u_plop.len)
FreePaster(pa);
}
- free((char *)u->u_copybuffer);
- u->u_copylen = 0;
- u->u_copybuffer = NULL;
+ free((char *)u->u_plop.buf);
+ u->u_plop.len = 0;
+ u->u_plop.buf = 0;
return 0;
}
#endif /* COPY_PASTE */
@@ -429,13 +432,13 @@ struct user *u;
* depth first method. If none of the nodes references u, the address of
* the last next pointer is returned. This address will contain NULL.
*/
-static struct usergroup **
+static struct aclusergroup **
FindGroupPtr(gp, u, recursive)
-struct usergroup **gp;
-struct user *u;
+struct aclusergroup **gp;
+struct acluser *u;
int recursive;
{
- struct usergroup **g;
+ struct aclusergroup **g;
ASSERT(recursive < 1000); /* Ouch, cycle detection failed */
while (*gp)
@@ -459,8 +462,8 @@ int
AclLinkUser(from, to)
char *from, *to;
{
- struct user **u1, **u2;
- struct usergroup **g;
+ struct acluser **u1, **u2;
+ struct aclusergroup **g;
if (!*(u1 = FindUserPtr(from)) && UserAdd(from, NULL, u1))
return -1;
@@ -472,7 +475,7 @@ char *from, *to;
if (*(g = FindGroupPtr(&(*u1)->u_group, *u2, 0)))
return 2; /* aha, we are already linked! */
- if (!(*g = (struct usergroup *)malloc(sizeof(struct usergroup))))
+ if (!(*g = (struct aclusergroup *)malloc(sizeof(struct aclusergroup))))
return -1; /* Could not alloc link. Poor screen */
(*g)->u = (*u2);
(*g)->next = NULL;
@@ -486,10 +489,10 @@ char *from, *to;
*/
char *
DoSu(up, name, pw1, pw2)
-struct user **up;
+struct acluser **up;
char *name, *pw1, *pw2;
{
- struct user *u;
+ struct acluser *u;
int sorry = 0;
if (!(u = *FindUserPtr(name)))
@@ -598,7 +601,7 @@ char *name, *pw1, *pw2;
int
NewWindowAcl(w, u)
struct win *w;
-struct user *u;
+struct acluser *u;
{
int i, j;
@@ -648,7 +651,7 @@ struct win *w;
*/
static int
AclSetPermCmd(u, mode, cmd)
-struct user *u;
+struct acluser *u;
char *mode;
struct comm *cmd;
{
@@ -693,7 +696,7 @@ struct comm *cmd;
*/
static int
AclSetPermWin(uu, u, mode, win)
-struct user *u, *uu;
+struct acluser *u, *uu;
char *mode;
struct win *win;
{
@@ -793,7 +796,7 @@ struct win *win;
*/
int
AclSetPerm(uu, u, mode, s)
-struct user *uu, *u;
+struct acluser *uu, *u;
char *mode, *s;
{
struct win *w;
@@ -813,7 +816,7 @@ char *mode, *s;
AclSetPermWin(uu, u, mode, (struct win *)1);
else /* .. or all windows */
for (w = windows; w; w = w->w_next)
- AclSetPermWin((struct user *)0, u, mode, w);
+ AclSetPermWin((struct acluser *)0, u, mode, w);
s++;
break;
case '?':
@@ -832,7 +835,7 @@ char *mode, *s;
if ((i = FindCommnr(s)) != RC_ILLEGAL)
AclSetPermCmd(u, mode, &comms[i]);
else if (((i = WindowByNoN(s)) >= 0) && wtab[i])
- AclSetPermWin((struct user *)0, u, mode, wtab[i]);
+ AclSetPermWin((struct acluser *)0, u, mode, wtab[i]);
else
/* checking group name */
return -1;
@@ -857,7 +860,7 @@ char *mode, *s;
*/
static int
UserAcl(uu, u, argc, argv)
-struct user *uu, **u;
+struct acluser *uu, **u;
int argc;
char **argv;
{
@@ -889,7 +892,7 @@ char **argv;
static int
UserAclCopy(to_up, from_up)
-struct user **to_up, **from_up;
+struct acluser **to_up, **from_up;
{
struct win *w;
int i, j, to_id, from_id;
@@ -944,13 +947,13 @@ struct user **to_up, **from_up;
*/
int
UsersAcl(uu, argc, argv)
-struct user *uu;
+struct acluser *uu;
int argc;
char **argv;
{
char *s;
int r;
- struct user **cf_u = NULL;
+ struct acluser **cf_u = NULL;
if (argc == 1)
{
@@ -968,7 +971,7 @@ char **argv;
if (argv[0][0] == '*' && argv[0][1] == '\0')
{
- struct user **u;
+ struct acluser **u;
debug("all users acls.\n");
for (u = &users; *u; u = &(*u)->u_next)
@@ -1005,7 +1008,7 @@ char **argv;
*/
int
AclUmask(u, str, errp)
-struct user *u;
+struct acluser *u;
char *str;
char **errp;
{
@@ -1054,11 +1057,11 @@ int a, b;
debug2("AclWinSwap(%d, %d) NOP.\n", a, b);
}
-struct user *EffectiveAclUser = NULL; /* hook for AT command permission */
+struct acluser *EffectiveAclUser = NULL; /* hook for AT command permission */
int
AclCheckPermWin(u, mode, w)
-struct user *u;
+struct acluser *u;
int mode;
struct win *w;
{
@@ -1076,8 +1079,8 @@ struct win *w;
if (!ok)
{
- struct usergroup **g = &u->u_group;
- struct user *saved_eff = EffectiveAclUser;
+ struct aclusergroup **g = &u->u_group;
+ struct acluser *saved_eff = EffectiveAclUser;
EffectiveAclUser = NULL;
while (*g)
@@ -1096,7 +1099,7 @@ struct win *w;
int
AclCheckPermCmd(u, mode, c)
-struct user *u;
+struct acluser *u;
int mode;
struct comm *c;
{
@@ -1113,8 +1116,8 @@ struct comm *c;
debug3("AclCheckPermCmd(%s %d %s) = ", u->u_name, mode, c->name);
if (!ok)
{
- struct usergroup **g = &u->u_group;
- struct user *saved_eff = EffectiveAclUser;
+ struct aclusergroup **g = &u->u_group;
+ struct acluser *saved_eff = EffectiveAclUser;
EffectiveAclUser = NULL;
while (*g)
diff --git a/acls.h b/acls.h
index 1438113..b71b573 100644
--- a/acls.h
+++ b/acls.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -43,10 +43,10 @@ typedef unsigned char * AclBits;
* How a user joins a group.
* Here is the node to construct one list per user.
*/
-struct usergroup
+struct aclusergroup
{
- struct user *u; /* the user who borrows us his rights */
- struct usergroup *next;
+ struct acluser *u; /* the user who borrows us his rights */
+ struct aclusergroup *next;
};
#endif /* MULTIUSER */
@@ -55,13 +55,25 @@ struct usergroup
*/
/*
+ * a copy buffer
+ */
+struct plop
+{
+ char *buf;
+ int len;
+#ifdef ENCODINGS
+ int enc;
+#endif
+};
+
+/*
* A User has a list of groups, and points to other users.
* users is the User entry of the session owner (creator)
* and anchors all other users. Add/Delete users there.
*/
-typedef struct user
+typedef struct acluser
{
- struct user *u_next; /* continue the main user list */
+ struct acluser *u_next; /* continue the main user list */
char u_name[20+1]; /* login name how he showed up */
char *u_password; /* his password (may be NullStr). */
int u_checkpassword; /* nonzero if this u_password is valid */
@@ -69,13 +81,12 @@ typedef struct user
int u_detachotherwin; /* window that was "other" when he detached */
int u_Esc, u_MetaEsc; /* the users screen escape character */
#ifdef COPY_PASTE
- char *u_copybuffer;
- int u_copylen;
+ 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 usergroup *u_group; /* linked list of pointers to other users */
+ struct aclusergroup *u_group; /* linked list of pointers to other users */
#endif
} User;
diff --git a/ansi.c b/ansi.c
index d2a4244..76353ef 100644
--- a/ansi.c
+++ b/ansi.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -44,9 +44,13 @@ extern int log_flush, logtstamp_on, logtstamp_after;
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 */
@@ -58,8 +62,8 @@ int visual_bell = 0;
int use_hardstatus = 1; /* display status line in hs */
char *printcmd = 0;
-char *blank; /* line filled with spaces */
-char *null; /* line filled with '\0' */
+unsigned char *blank; /* line filled with spaces */
+unsigned char *null; /* line filled with '\0' */
struct mline mline_old;
struct mline mline_blank;
@@ -117,7 +121,6 @@ static void BackSpace __P((void));
static void Return __P((void));
static void LineFeed __P((int));
static void ReverseLineFeed __P((void));
-static void InsertAChar __P((int));
static void InsertChar __P((int));
static void DeleteChar __P((int));
static void DeleteLine __P((int));
@@ -140,18 +143,29 @@ static void FillWithEs __P((void));
static void FindAKA __P((void));
static void Report __P((char *, int, int));
static void ScrollRegion __P((int));
-static void AddLineToHist __P((struct win *, struct mline *));
-static void LogString __P((struct win *, char *, int));
+#ifdef COPY_PASTE
+static void WAddLineToHist __P((struct win *, struct mline *));
+#endif
+static void WLogString __P((struct win *, char *, int));
static void WReverseVideo __P((struct win *, int));
+static int WindowChangedCheck __P((char *, int, int *));
static void MFixLine __P((struct win *, int, struct mchar *));
-static void MScrollH __P((struct win *, int, int, int, int));
-static void MScrollV __P((struct win *, int, int, int));
-static void MClear __P((struct win *, int, int, int, int));
+static void MScrollH __P((struct win *, int, int, int, int, int));
+static void MScrollV __P((struct win *, int, int, int, int));
+static void MClearArea __P((struct win *, int, int, int, int, int));
static void MInsChar __P((struct win *, struct mchar *, int, int));
static void MPutChar __P((struct win *, struct mchar *, int, int));
+static void MPutStr __P((struct win *, char *, int, struct mchar *, int, int));
static void MWrapChar __P((struct win *, struct mchar *, int, int, int, int));
-static int WindowChangedCheck __P((char *, int, int *));
+#ifdef COLOR
+static void MBceLine __P((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
void
ResetAnsiState(p)
@@ -171,6 +185,7 @@ register struct win *p;
p->w_origin = 0;
p->w_insert = 0;
p->w_revvid = 0;
+ p->w_mouse = 0;
p->w_curinv = 0;
p->w_curvvis = 0;
p->w_autolf = 0;
@@ -189,6 +204,9 @@ register struct win *p;
#ifdef FONT
ResetCharsets(p);
#endif
+#ifdef COLOR
+ p->w_bce = nwin_default.bce;
+#endif
}
/* adds max 22 bytes */
@@ -210,6 +228,7 @@ char *buf;
if (w->w_intermediate > 0xff)
p += AddXChar(p, w->w_intermediate >> 8);
p += AddXChar(p, w->w_intermediate & 0xff);
+ *p = 0;
}
if (w->w_state == ASTR || w->w_state == STRESC)
sprintf(p, "-%s", string_t_string[w->w_StringType]);
@@ -220,31 +239,17 @@ char *buf;
#ifdef FONT
-# ifdef KANJI
-static char *kanjicharsets[3] = {
- "BBBB02", /* jis */
- "B\002IB01", /* euc */
- "BIBB01" /* sjis */
-};
-# endif
-
void
ResetCharsets(p)
-register struct win *p;
+struct win *p;
{
p->w_gr = nwin_default.gr;
p->w_c1 = nwin_default.c1;
- SetCharsets(p, "BBBB02");
+ SetCharsets(p, "BBBBB02");
if (nwin_default.charset)
SetCharsets(p, nwin_default.charset);
-#ifdef KANJI
- if (p->w_kanji)
- {
- p->w_gr = 1;
- if (p->w_kanji == SJIS)
- p->w_c1 = 0;
- SetCharsets(p, kanjicharsets[p->w_kanji]);
- }
+#ifdef ENCODINGS
+ ResetEncoding(p);
#endif
}
@@ -255,7 +260,7 @@ char *s;
{
int i;
- for (i = 0; i < 4 && *s; i++, s++)
+ for (i = 0; i < 5 && *s; i++, s++)
if (*s != '.')
p->w_charsets[i] = ((*s == 'B') ? ASCII : *s);
if (*s && *s++ != '.')
@@ -266,7 +271,7 @@ char *s;
p->w_FontL = p->w_charsets[p->w_Charset];
p->w_FontR = p->w_charsets[p->w_CharsetR];
}
-#endif
+#endif /* FONT */
/*****************************************************************/
@@ -298,7 +303,7 @@ register int len;
if (!len)
return;
if (wp->w_log)
- LogString(wp, buf, len);
+ WLogString(wp, buf, len);
/* set global variables (yuck!) */
curr = wp;
@@ -309,8 +314,10 @@ register int len;
for (cv = wp->w_layer.l_cvlist; cv; cv = cv->c_lnext)
{
display = cv->c_display;
+#if 0 /* done by new status code */
if (D_status == STATUS_ON_WIN)
RemoveStatus();
+#endif
if (D_nonblock == 1 && (D_obufp - D_obuf > D_obufmax))
{
/* one last surprising '~' means: lost data */
@@ -333,66 +340,47 @@ register int len;
{
c = (unsigned char)*buf++;
#ifdef FONT
- curr->w_rend.font = curr->w_FontL; /* Default: GL */
+# 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
- * (therefore no mchars are used) */
+ /* The next part is only for speedup */
if (curr->w_state == LIT &&
-#ifdef KANJI
- curr->w_FontL != KANJI && curr->w_FontL != KANA && !curr->w_mbcs &&
+#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
- c >= ' ' &&
+#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)
{
- register int currx;
- register char *imp, *atp, at;
-#ifdef FONT
- register char *fop, fo;
-#endif
-#ifdef COLOR
- register char *cop, co;
-#endif
+ register int currx = curr->w_x;
+ char *imp = buf - 1;
- if (c == '\177')
- continue;
- MFixLine(curr, curr->w_y, &curr->w_rend);
- currx = curr->w_x;
- imp = curr->w_mlines[curr->w_y].image + currx;
- atp = curr->w_mlines[curr->w_y].attr + currx;
- at = curr->w_rend.attr;
-#ifdef FONT
- fop = curr->w_mlines[curr->w_y].font + currx;
- fo = curr->w_rend.font;
-#endif
-#ifdef COLOR
- cop = curr->w_mlines[curr->w_y].color + currx;
- co = curr->w_rend.color;
-#endif
while (currx < cols - 1)
{
- *imp++ = c;
- *atp++ = at;
-#ifdef FONT
- *fop++ = fo;
-#endif
-#ifdef COLOR
- *cop++ = co;
-#endif
currx++;
-skip: if (--len == 0)
+ if (--len == 0)
break;
c = (unsigned char)*buf++;
- if (c == '\177')
- goto skip;
- if (c < ' ' || ((c & 0x80) && ((c < 0xa0 && curr->w_c1) || curr->w_gr)))
+ if (c < ' ' || c == 0x7f || ((c & 0x80) && ((c < 0xa0 && curr->w_c1) || curr->w_gr)))
break;
}
currx -= curr->w_x;
if (currx > 0)
{
- LPutStr(&curr->w_layer, imp - currx, currx, &curr->w_rend, curr->w_x, curr->w_y);
+ MPutStr(curr, imp, currx, &curr->w_rend, curr->w_x, curr->w_y);
+ LPutStr(&curr->w_layer, imp, currx, &curr->w_rend, curr->w_x, curr->w_y);
curr->w_x += currx;
}
if (len == 0)
@@ -400,6 +388,24 @@ skip: if (--len == 0)
}
/* end of speedup code */
+#ifdef UTF8
+ if (curr->w_encoding == UTF8)
+ {
+ c = FromUtf8(c, &curr->w_decodestate);
+ if (c == -1)
+ continue;
+ if (c == -2)
+ {
+ c = UCS_REPL;
+ /* try char again */
+ buf--;
+ len++;
+ }
+ if (c > 0xff)
+ debug1("read UNICODE %04x\n", c);
+ }
+#endif
+
tryagain:
switch (curr->w_state)
{
@@ -548,7 +554,7 @@ skip: if (--len == 0)
{
if (curr->w_intermediate)
{
-#ifdef KANJI
+#ifdef DW_CHARS
if (curr->w_intermediate == '$')
c |= '$' << 8;
else
@@ -574,10 +580,11 @@ skip: if (--len == 0)
{
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- if (curr->w_NumArgs < MAXARGS)
+ if (curr->w_NumArgs >= 0 && curr->w_NumArgs < MAXARGS)
{
- curr->w_args[curr->w_NumArgs] =
- 10 * curr->w_args[curr->w_NumArgs] + (c - '0');
+ if (curr->w_args[curr->w_NumArgs] < 100000000)
+ curr->w_args[curr->w_NumArgs] =
+ 10 * curr->w_args[curr->w_NumArgs] + (c - '0');
}
break;
case ';':
@@ -605,9 +612,10 @@ skip: if (--len == 0)
break;
case LIT:
default:
-#ifdef KANJI
- if (c <= ' ' || c == 0x7f || (c >= 0x80 && c < 0xa0 && curr->w_c1))
- curr->w_mbcs = 0;
+#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 < ' ')
{
@@ -623,6 +631,13 @@ skip: if (--len == 0)
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)
{
@@ -652,9 +667,22 @@ skip: if (--len == 0)
}
#ifdef FONT
- font = curr->w_rend.font = (c >= 0x80 ? curr->w_FontR : curr->w_FontL);
-# ifdef KANJI
- if (font == KANA && curr->w_kanji == SJIS && curr->w_mbcs == 0)
+# ifdef DW_CHARS
+ if (!curr->w_mbcs)
+# endif
+ curr->w_rend.font = (c >= 0x80 ? curr->w_FontR : curr->w_FontL);
+# ifdef UTF8
+ if (curr->w_encoding == UTF8)
+ curr->w_rend.font = 0;
+# ifdef DW_CHARS
+ if (curr->w_encoding == UTF8 && utf8_isdouble(c))
+ curr->w_mbcs = 0xff;
+# endif
+ 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 */
debug1("%x may be first of SJIS\n", c);
@@ -665,9 +693,10 @@ skip: if (--len == 0)
break;
}
}
- if (font == KANJI && c == ' ')
+# endif
+ if (is_dw_font(font) && c == ' ')
font = curr->w_rend.font = 0;
- if (font == KANJI || curr->w_mbcs)
+ if (is_dw_font(font) || curr->w_mbcs)
{
int t = c;
if (curr->w_mbcs == 0)
@@ -680,42 +709,65 @@ skip: if (--len == 0)
curr->w_x += curr->w_wrap ? 1 : -1;
debug1("Patched w_x to %d\n", curr->w_x);
}
- c = curr->w_mbcs;
- if (font != KANJI)
+# ifdef UTF8
+ if (curr->w_encoding != UTF8)
+# endif
{
- debug2("SJIS !! %x %x\n", c, t);
- /*
- * SJIS -> EUC mapping:
- * First byte:
- * 81,82...9f -> 21,23...5d
- * e0,e1...ef -> 5f,61...7d
- * Second byte:
- * 40-7e -> 21-5f
- * 80-9e -> 60-7e
- * 9f-fc -> 21-7e (increment first byte!)
- */
- if (0x40 <= t && t <= 0xfc && t != 0x7f)
+ c = curr->w_mbcs;
+# ifdef ENCODINGS
+ if (font == KANA && curr->w_encoding == SJIS)
{
- if (c <= 0x9f) c = (c - 0x81) * 2 + 0x21;
- else c = (c - 0xc1) * 2 + 0x21;
- if (t <= 0x7e) t -= 0x1f;
- else if (t <= 0x9e) t -= 0x20;
- else t -= 0x7e, c++;
- curr->w_rend.font = KANJI;
+ debug2("SJIS !! %x %x\n", c, t);
+ /*
+ * SJIS -> EUC mapping:
+ * First byte:
+ * 81,82...9f -> 21,23...5d
+ * e0,e1...ef -> 5f,61...7d
+ * Second byte:
+ * 40-7e -> 21-5f
+ * 80-9e -> 60-7e
+ * 9f-fc -> 21-7e (increment first byte!)
+ */
+ if (0x40 <= t && t <= 0xfc && t != 0x7f)
+ {
+ if (c <= 0x9f) c = (c - 0x81) * 2 + 0x21;
+ else c = (c - 0xc1) * 2 + 0x21;
+ if (t <= 0x7e) t -= 0x1f;
+ else if (t <= 0x9e) t -= 0x20;
+ else t -= 0x7e, c++;
+ curr->w_rend.font = KANJI;
+ }
+ else
+ {
+ /* Incomplete shift-jis - skip first byte */
+ c = t;
+ t = 0;
+ }
+ debug2("SJIS after %x %x\n", c, t);
}
- else
+# endif
+ if (t && curr->w_gr && font != 030)
{
- /* Incomplete shift-jis - skip first byte */
- c = t;
- t = 0;
+ t &= 0x7f;
+ if (t < ' ')
+ goto tryagain;
}
- debug2("SJIS after %x %x\n", c, t);
+ if (t == '\177')
+ break;
+ curr->w_mbcs = t;
}
- curr->w_mbcs = t;
}
- kanjiloop:
+# 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
- if (curr->w_gr)
{
c &= 0x7f;
if (c < ' ') /* this is ugly but kanji support */
@@ -725,10 +777,22 @@ skip: if (--len == 0)
if (c == '\177')
break;
curr->w_rend.image = c;
+#ifdef UTF8
+ if (curr->w_encoding == UTF8)
+ curr->w_rend.font = c >> 8;
+#endif
+#ifdef DW_CHARS
+ curr->w_rend.mbcs = curr->w_mbcs;
+#endif
if (curr->w_x < cols - 1)
{
if (curr->w_insert)
- InsertAChar(c);
+ {
+ save_mline(&curr->w_mlines[curr->w_y], cols);
+ MInsChar(curr, &curr->w_rend, curr->w_x, curr->w_y);
+ LInsChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y, &mline_old);
+ curr->w_x++;
+ }
else
{
MPutChar(curr, &curr->w_rend, curr->w_x, curr->w_y);
@@ -752,12 +816,11 @@ skip: if (--len == 0)
curr->w_x = 1;
}
#ifdef FONT
-# ifdef KANJI
+# ifdef DW_CHARS
if (curr->w_mbcs)
{
- c = curr->w_mbcs;
- curr->w_mbcs = 0;
- goto kanjiloop; /* what a hack! */
+ curr->w_rend.mbcs = curr->w_mbcs = 0;
+ curr->w_x++;
}
# endif
if (curr->w_ss)
@@ -778,7 +841,7 @@ skip: if (--len == 0)
}
static void
-LogString(p, buf, len)
+WLogString(p, buf, len)
struct win *p;
char *buf;
int len;
@@ -816,7 +879,7 @@ register int c;
case '\n':
if (curr->w_autoaka)
FindAKA();
- LineFeed(1);
+ LineFeed(0);
return 1;
case '\007':
WBell(curr, visual_bell);
@@ -847,10 +910,10 @@ int c, intermediate;
switch (c)
{
case 'E':
- LineFeed(2);
+ LineFeed(1);
break;
case 'D':
- LineFeed(1);
+ LineFeed(0);
break;
case 'M':
ReverseLineFeed();
@@ -873,24 +936,25 @@ int c, intermediate;
LKeypadMode(&curr->w_layer, 0);
LCursorkeysMode(&curr->w_layer, 0);
#ifndef TIOCPKT
- NewAutoFlow(curr, 1);
+ WNewAutoFlow(curr, 1);
#endif
/* XXX
SetRendition(&mchar_null);
InsertMode(0);
ChangeScrollRegion(0, rows - 1);
*/
+ LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
break;
case '=':
LKeypadMode(&curr->w_layer, curr->w_keypad = 1);
#ifndef TIOCPKT
- NewAutoFlow(curr, 0);
+ WNewAutoFlow(curr, 0);
#endif /* !TIOCPKT */
break;
case '>':
LKeypadMode(&curr->w_layer, curr->w_keypad = 0);
#ifndef TIOCPKT
- NewAutoFlow(curr, 1);
+ WNewAutoFlow(curr, 1);
#endif /* !TIOCPKT */
break;
#ifdef FONT
@@ -951,7 +1015,7 @@ int c, intermediate;
case '+':
DesignateCharset(c, G3);
break;
-# ifdef KANJI
+# ifdef DW_CHARS
/*
* ESC $ ( Fn: invoke multi-byte charset, Fn, to G0
* ESC $ Fn: same as above. (old sequence)
@@ -1201,19 +1265,20 @@ int c, intermediate;
case 1: /* CKM: cursor key mode */
LCursorkeysMode(&curr->w_layer, curr->w_cursorkeys = i);
#ifndef TIOCPKT
- NewAutoFlow(curr, !i);
+ WNewAutoFlow(curr, !i);
#endif /* !TIOCPKT */
break;
case 2: /* ANM: ansi/vt52 mode */
if (i)
{
#ifdef FONT
-# ifdef KANJI
- if (curr->w_kanji)
+# ifdef ENCODINGS
+ if (curr->w_encoding)
break;
# endif
curr->w_charsets[0] = curr->w_charsets[1] =
- curr->w_charsets[2] = curr->w_charsets[2] =
+ curr->w_charsets[2] = curr->w_charsets[3] =
+ curr->w_charsets[4] =
curr->w_FontL = curr->w_FontR = ASCII;
curr->w_Charset = 0;
curr->w_CharsetR = 2;
@@ -1248,6 +1313,10 @@ int c, intermediate;
break;
/* case 8: ARM: auto repeat mode */
/* case 9: INLM: interlace mode */
+ case 9: /* X10 mouse tracking */
+ curr->w_mouse = i ? 9 : 0;
+ LMouseMode(&curr->w_layer, curr->w_mouse);
+ break;
/* case 10: EDM: edit mode */
/* case 11: LTM: line transmit mode */
/* case 13: SCFDM: space compression / field delimiting */
@@ -1268,6 +1337,10 @@ int c, intermediate;
/* case 44: margin bell enable */
/* case 66: NKM: Numeric keypad appl mode */
/* case 68: KBUM: Keyboard usage mode (data process) */
+ case 1000: /* VT200 mouse tracking */
+ curr->w_mouse = i ? 1000 : 0;
+ LMouseMode(&curr->w_layer, curr->w_mouse);
+ break;
}
}
break;
@@ -1311,20 +1384,73 @@ static int
StringEnd()
{
struct canvas *cv;
+ char *p;
+ int typ;
curr->w_state = LIT;
*curr->w_stringp = '\0';
switch (curr->w_StringType)
{
case OSC: /* special xterm compatibility hack */
- if (curr->w_stringp - curr->w_string < 2 ||
- curr->w_string[0] < '0' ||
- curr->w_string[0] > '2' ||
- curr->w_string[1] != ';')
+ if (curr->w_string[0] == ';' || (p = index(curr->w_string, ';')) == 0)
+ break;
+ typ = atoi(curr->w_string);
+ p++;
+#ifdef MULTIUSER
+ if (typ == 83) /* 83 = 'S' */
+ {
+ /* special execute commands sequence */
+ char *args[MAXARGS];
+ struct acluser *windowuser;
+
+ windowuser = *FindUserPtr(":window:");
+ if (windowuser && Parse(p, args))
+ {
+ for (display = displays; display; display = display->d_next)
+ if (D_forecv->c_layer->l_bottom == &curr->w_layer)
+ break; /* found it */
+ if (display == 0 && curr->w_layer.l_cvlist)
+ display = curr->w_layer.l_cvlist->c_display;
+ EffectiveAclUser = windowuser;
+ DoCommand(args);
+ EffectiveAclUser = 0;
+ }
+ break;
+ }
+#endif
+#ifdef RXVT_OSC
+ if (typ == 0 || typ == 1 || typ == 20 || typ == 39 || typ == 49)
+ {
+ int typ2;
+ typ2 = typ / 10;
+ if (--typ2 < 0)
+ typ2 = 0;
+ if (strcmp(curr->w_xtermosc[typ2], p))
+ {
+ strncpy(curr->w_xtermosc[typ2], p, sizeof(curr->w_xtermosc[typ2]) - 1);
+ curr->w_xtermosc[typ2][sizeof(curr->w_xtermosc[typ2]) - 1] = 0;
+
+ for (display = displays; display; display = display->d_next)
+ {
+ if (!D_CXT)
+ continue;
+ if (D_forecv->c_layer->l_bottom == &curr->w_layer)
+ SetXtermOSC(typ2, curr->w_xtermosc[typ2]);
+ if ((typ2 == 2 || typ2 == 3) && D_xtermosc[typ2])
+ Redisplay(0);
+ }
+ }
+ }
+ if (typ != 0 && typ != 2)
break;
- curr->w_stringp -= 2;
+#else
+ if (typ < 0 || typ > 2)
+ break;
+#endif
+
+ curr->w_stringp -= p - curr->w_string;
if (curr->w_stringp > curr->w_string)
- bcopy(curr->w_string + 2, curr->w_string, curr->w_stringp - curr->w_string);
+ bcopy(p, curr->w_string, curr->w_stringp - curr->w_string);
*curr->w_stringp = '\0';
/* FALLTHROUGH */
case APC:
@@ -1356,7 +1482,7 @@ StringEnd()
case AKA:
if (curr->w_title == curr->w_akabuf && !*curr->w_string)
break;
- ChangeAKA(curr, curr->w_string, 20);
+ ChangeAKA(curr, curr->w_string, strlen(curr->w_string));
if (!*curr->w_string)
curr->w_autoaka = curr->w_y + 1;
break;
@@ -1432,9 +1558,9 @@ PrintFlush()
}
else if (display && curr->w_stringp > curr->w_string)
{
- PutStr(D_PO);
+ AddCStr(D_PO);
AddStrn(curr->w_string, curr->w_stringp - curr->w_string);
- PutStr(D_PF);
+ AddCStr(D_PF);
Flush();
}
curr->w_stringp = curr->w_string;
@@ -1442,11 +1568,11 @@ PrintFlush()
void
-NewAutoFlow(win, on)
+WNewAutoFlow(win, on)
struct win *win;
int on;
{
- debug1("NewAutoFlow: %d\n", on);
+ debug1("WNewAutoFlow: %d\n", on);
if (win->w_flow & FLOW_AUTOFLAG)
win->w_flow = FLOW_AUTOFLAG | (FLOW_AUTO|FLOW_NOW) * on;
else
@@ -1462,11 +1588,11 @@ DesignateCharset(c, n)
int c, n;
{
curr->w_ss = 0;
-# ifdef KANJI
- if (c == ('@' & 037))
+# ifdef ENCODINGS
+ if (c == ('@' & 037)) /* map JIS 6226 to 0208 */
c = KANJI;
# endif
- if (c == 'B' || c == 'J')
+ if (c == 'B')
c = ASCII;
if (curr->w_charsets[n] != c)
{
@@ -1501,7 +1627,7 @@ MapCharsetR(n)
int n;
{
curr->w_ss = 0;
- if (curr->w_CharsetR != n)
+ if (curr->w_CharsetR != n && curr->w_CharsetR != 4)
{
curr->w_CharsetR = n;
curr->w_FontR = curr->w_charsets[n];
@@ -1517,12 +1643,12 @@ SaveCursor()
curr->w_saved = 1;
curr->w_Saved_x = curr->w_x;
curr->w_Saved_y = curr->w_y;
- curr->w_SavedRend= curr->w_rend;
+ curr->w_SavedRend = curr->w_rend;
#ifdef FONT
curr->w_SavedCharset = curr->w_Charset;
curr->w_SavedCharsetR = curr->w_CharsetR;
bcopy((char *) curr->w_charsets, (char *) curr->w_SavedCharsets,
- 4 * sizeof(int));
+ 5 * sizeof(int));
#endif
}
@@ -1537,7 +1663,7 @@ RestoreCursor()
curr->w_rend = curr->w_SavedRend;
#ifdef FONT
bcopy((char *) curr->w_SavedCharsets, (char *) curr->w_charsets,
- 4 * sizeof(int));
+ 5 * sizeof(int));
curr->w_Charset = curr->w_SavedCharset;
curr->w_CharsetR = curr->w_SavedCharsetR;
curr->w_ss = 0;
@@ -1575,25 +1701,21 @@ static void
LineFeed(out_mode)
int out_mode;
{
- /* out_mode: 0=cr+lf no-output, 1=lf, 2=cr+lf */
- if (out_mode != 1)
+ /* out_mode: 0=lf, 1=cr+lf */
+ if (out_mode)
curr->w_x = 0;
if (curr->w_y != curr->w_bot) /* Don't scroll */
{
if (curr->w_y < rows-1)
curr->w_y++;
- if (out_mode)
- LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
+ LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
return;
}
- MScrollV(curr, 1, curr->w_top, curr->w_bot);
if (curr->w_autoaka > 1)
curr->w_autoaka--;
- if (out_mode)
- {
- LScrollV(&curr->w_layer, 1, curr->w_top, curr->w_bot);
- LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
- }
+ MScrollV(curr, 1, curr->w_top, curr->w_bot, CURR_BCE);
+ LScrollV(&curr->w_layer, 1, curr->w_top, curr->w_bot, CURR_BCE);
+ LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
}
static void
@@ -1601,8 +1723,8 @@ ReverseLineFeed()
{
if (curr->w_y == curr->w_top)
{
- MScrollV(curr, -1, curr->w_top, curr->w_bot);
- LScrollV(&curr->w_layer, -1, curr->w_top, curr->w_bot);
+ MScrollV(curr, -1, curr->w_top, curr->w_bot, CURR_BCE);
+ LScrollV(&curr->w_layer, -1, curr->w_top, curr->w_bot, CURR_BCE);
LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
}
else if (curr->w_y > 0)
@@ -1610,19 +1732,6 @@ ReverseLineFeed()
}
static void
-InsertAChar(c)
-int c;
-{
- register int y = curr->w_y, x = curr->w_x;
-
- save_mline(&curr->w_mlines[y], cols);
- curr->w_rend.image = c;
- MInsChar(curr, &curr->w_rend, x, y);
- curr->w_x = x + 1;
- LInsChar(&curr->w_layer, &curr->w_rend, x, y, &mline_old);
-}
-
-static void
InsertChar(n)
int n;
{
@@ -1633,8 +1742,8 @@ int n;
if (x == cols)
x--;
save_mline(&curr->w_mlines[y], cols);
- MScrollH(curr, -n, y, x, curr->w_width - 1);
- LScrollH(&curr->w_layer, -n, y, x, curr->w_width - 1, &mline_old);
+ MScrollH(curr, -n, y, x, curr->w_width - 1, CURR_BCE);
+ LScrollH(&curr->w_layer, -n, y, x, curr->w_width - 1, CURR_BCE, &mline_old);
LGotoPos(&curr->w_layer, x, y);
}
@@ -1647,8 +1756,8 @@ int n;
if (x == cols)
x--;
save_mline(&curr->w_mlines[y], cols);
- MScrollH(curr, n, y, x, curr->w_width - 1);
- LScrollH(&curr->w_layer, n, y, x, curr->w_width - 1, &mline_old);
+ MScrollH(curr, n, y, x, curr->w_width - 1, CURR_BCE);
+ LScrollH(&curr->w_layer, n, y, x, curr->w_width - 1, CURR_BCE, &mline_old);
LGotoPos(&curr->w_layer, x, y);
}
@@ -1660,8 +1769,8 @@ int n;
return;
if (n > curr->w_bot - curr->w_y + 1)
n = curr->w_bot - curr->w_y + 1;
- MScrollV(curr, n, curr->w_y, curr->w_bot);
- LScrollV(&curr->w_layer, n, curr->w_y, curr->w_bot);
+ MScrollV(curr, n, curr->w_y, curr->w_bot, CURR_BCE);
+ LScrollV(&curr->w_layer, n, curr->w_y, curr->w_bot, CURR_BCE);
LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
}
@@ -1673,8 +1782,8 @@ int n;
return;
if (n > curr->w_bot - curr->w_y + 1)
n = curr->w_bot - curr->w_y + 1;
- MScrollV(curr, -n, curr->w_y, curr->w_bot);
- LScrollV(&curr->w_layer, -n, curr->w_y, curr->w_bot);
+ MScrollV(curr, -n, curr->w_y, curr->w_bot, CURR_BCE);
+ LScrollV(&curr->w_layer, -n, curr->w_y, curr->w_bot, CURR_BCE);
LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
}
@@ -1682,8 +1791,8 @@ static void
ScrollRegion(n)
int n;
{
- MScrollV(curr, n, curr->w_top, curr->w_bot);
- LScrollV(&curr->w_layer, n, curr->w_top, curr->w_bot);
+ MScrollV(curr, n, curr->w_top, curr->w_bot, CURR_BCE);
+ LScrollV(&curr->w_layer, n, curr->w_top, curr->w_bot, CURR_BCE);
LGotoPos(&curr->w_layer, curr->w_x, curr->w_y);
}
@@ -1695,7 +1804,7 @@ ForwardTab()
if (x == cols)
{
- LineFeed(2);
+ LineFeed(1);
x = 0;
}
if (curr->w_tabs[x] && x < cols - 1)
@@ -1722,11 +1831,11 @@ BackwardTab()
static void
ClearScreen()
{
- LClear(&curr->w_layer, 0, 0, curr->w_width - 1, curr->w_height - 1, 1);
+ 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);
+ MScrollV(curr, curr->w_height, 0, curr->w_height - 1, CURR_BCE);
#else
- MClear(curr, 0, 0, curr->w_width - 1, curr->w_height - 1);
+ MClearArea(curr, 0, 0, curr->w_width - 1, curr->w_height - 1, CURR_BCE);
#endif
}
@@ -1735,8 +1844,8 @@ ClearFromBOS()
{
register int y = curr->w_y, x = curr->w_x;
- LClear(&curr->w_layer, 0, 0, x, y, 1);
- MClear(curr, 0, 0, x, y);
+ LClearArea(&curr->w_layer, 0, 0, x, y, CURR_BCE, 1);
+ MClearArea(curr, 0, 0, x, y, CURR_BCE);
RestorePosRendition();
}
@@ -1748,10 +1857,11 @@ ClearToEOS()
if (x == 0 && y == 0)
{
ClearScreen();
+ RestorePosRendition();
return;
}
- LClear(&curr->w_layer, x, y, cols - 1, rows - 1, 1);
- MClear(curr, x, y, cols - 1, rows - 1);
+ LClearArea(&curr->w_layer, x, y, cols - 1, rows - 1, CURR_BCE, 1);
+ MClearArea(curr, x, y, cols - 1, rows - 1, CURR_BCE);
RestorePosRendition();
}
@@ -1760,8 +1870,8 @@ ClearLineRegion(from, to)
int from, to;
{
register int y = curr->w_y;
- LClear(&curr->w_layer, from, y, to, y, 1);
- MClear(curr, from, y, to, y);
+ LClearArea(&curr->w_layer, from, y, to, y, CURR_BCE, 1);
+ MClearArea(curr, from, y, to, y, CURR_BCE);
RestorePosRendition();
}
@@ -1773,7 +1883,7 @@ register int n;
if (x == cols)
{
- LineFeed(2);
+ LineFeed(1);
x = 0;
}
if ((curr->w_x += n) >= cols)
@@ -1851,7 +1961,7 @@ int on;
static char rendlist[] =
{
- (1 << NATTR), A_BD, A_DI, A_SO, A_US, A_BL, 0, A_RV, 0, 0,
+ ~((1 << NATTR) - 1), A_BD, A_DI, A_SO, A_US, A_BL, 0, A_RV, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, ~(A_BD|A_SO|A_DI), ~A_SO, ~A_US, ~A_BL, 0, ~A_RV
};
@@ -1859,21 +1969,83 @@ static char rendlist[] =
static void
SelectRendition()
{
- register int j, i = 0, a = curr->w_rend.attr;
#ifdef COLOR
- register int c = curr->w_rend.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 >= 30 && j <= 39)
- c = (c & 0xf0) | (39 - j);
- else if (j >= 40 && j <= 49)
- c = (c & 0x0f) | ((49 - j) << 4);
+ if ((j == 38 || j == 48) && i + 2 < curr->w_NumArgs && curr->w_args[i + 1] == 5)
+ {
+ int jj;
+
+ i += 2;
+ jj = curr->w_args[i];
+ if (jj < 0 || jj > 255)
+ continue;
+# ifdef COLORS256
+ if (j == 38)
+ {
+ c = (c & 0xf0) | ((jj & 0x0f) ^ 9);
+ a |= A_BFG;
+ if (jj >= 8 && jj < 16)
+ c |= 0x08;
+ else
+ a ^= A_BFG;
+ a = (a & 0xbf) | (jj & 8 ? 0x40 : 0);
+ cx = (cx & 0xf0) | (jj >> 4 & 0x0f);
+ }
+ else
+ {
+ c = (c & 0x0f) | ((jj & 0x0f) ^ 9) << 4;
+ a |= A_BBG;
+ if (jj >= 8 && jj < 16)
+ c |= 0x80;
+ else
+ a ^= A_BBG;
+ 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))
+ a &= 0x7f;
+ if (j >= 90 && j <= 97)
+ a |= 0x40;
+ if (j >= 100 && j <= 107)
+ a |= 0x80;
+# endif
+ if (j >= 90 && j <= 97)
+ j -= 60;
+ if (j >= 100 && j <= 107)
+ j -= 60;
+ if (j >= 30 && j <= 39 && j != 38)
+ c = (c & 0xf0) | ((j - 30) ^ 9);
+ else if (j >= 40 && j <= 49 && j != 48)
+ 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 >= (sizeof(rendlist)/sizeof(*rendlist)))
continue;
@@ -1887,6 +2059,9 @@ SelectRendition()
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);
}
@@ -1895,9 +2070,9 @@ static void
FillWithEs()
{
register int i;
- register char *p, *ep;
+ register unsigned char *p, *ep;
- ClearLayer(&curr->w_layer, 1);
+ LClearAll(&curr->w_layer, 1);
curr->w_y = curr->w_x = 0;
for (i = 0; i < rows; ++i)
{
@@ -1907,7 +2082,7 @@ FillWithEs()
while (p < ep)
*p++ = 'E';
}
- RedisplayLayer(&curr->w_layer, 1);
+ LRefreshAll(&curr->w_layer, 1);
}
@@ -1923,8 +2098,8 @@ struct win *p;
char *s;
int l;
{
- if (l > 20)
- l = 20;
+ if (l > MAXAKA)
+ l = MAXAKA;
strncpy(p->w_akachange, s, l);
p->w_akachange[l] = 0;
p->w_title = p->w_akachange;
@@ -1939,7 +2114,7 @@ int l;
static void
FindAKA()
{
- register char *cp, *line;
+ register unsigned char *cp, *line;
register struct win *wp = curr;
register int len = strlen(wp->w_akabuf);
int y;
@@ -1958,7 +2133,7 @@ FindAKA()
goto try_line;
return;
}
- if (strncmp(cp, wp->w_akabuf, len) == 0)
+ if (strncmp((char *)cp, wp->w_akabuf, len) == 0)
break;
cp++;
}
@@ -1979,7 +2154,7 @@ FindAKA()
line = cp;
len--;
}
- ChangeAKA(wp, line, cp - line);
+ ChangeAKA(wp, (char *)line, cp - line);
}
else
wp->w_autoaka = 0;
@@ -2033,18 +2208,18 @@ struct mchar *mc;
struct mline *ml = &p->w_mlines[y];
if (mc->attr && ml->attr == null)
{
- if ((ml->attr = (char *)malloc(p->w_width + 1)) == 0)
+ if ((ml->attr = (unsigned char *)malloc(p->w_width + 1)) == 0)
{
ml->attr = null;
mc->attr = p->w_rend.attr = 0;
WMsg(p, 0, "Warning: no space for attr - turned off");
}
- bzero(ml->attr, p->w_width + 1);
+ bzero((char *)ml->attr, p->w_width + 1);
}
#ifdef FONT
if (mc->font && ml->font == null)
{
- if ((ml->font = (char *)malloc(p->w_width + 1)) == 0)
+ if ((ml->font = (unsigned char *)malloc(p->w_width + 1)) == 0)
{
ml->font = null;
p->w_FontL = p->w_charsets[p->w_ss ? p->w_ss : p->w_Charset] = 0;
@@ -2052,62 +2227,109 @@ struct mchar *mc;
mc->font = p->w_rend.font = 0;
WMsg(p, 0, "Warning: no space for font - turned off");
}
- bzero(ml->font, p->w_width + 1);
+ bzero((char *)ml->font, p->w_width + 1);
}
#endif
#ifdef COLOR
if (mc->color && ml->color == null)
{
- if ((ml->color = (char *)malloc(p->w_width + 1)) == 0)
+ if ((ml->color = (unsigned char *)malloc(p->w_width + 1)) == 0)
{
ml->color = null;
mc->color = p->w_rend.color = 0;
WMsg(p, 0, "Warning: no space for color - turned off");
}
- bzero(ml->color, p->w_width + 1);
+ bzero((char *)ml->color, p->w_width + 1);
}
+# ifdef COLORS256
+ if (mc->colorx && ml->colorx == null)
+ {
+ if ((ml->colorx = (unsigned char *)malloc(p->w_width + 1)) == 0)
+ {
+ ml->colorx = null;
+ mc->colorx = p->w_rend.colorx = 0;
+ WMsg(p, 0, "Warning: no space for extended colors - turned off");
+ }
+ bzero((char *)ml->colorx, p->w_width + 1);
+ }
+# endif
#endif
}
/*****************************************************************/
+#ifdef DW_CHARS
+# define MKillDwRight(p, ml, x) \
+ if (dw_right(ml, x, p->w_encoding)) \
+ { \
+ if (x > 0) \
+ copy_mchar2mline(&mchar_blank, ml, x - 1); \
+ copy_mchar2mline(&mchar_blank, ml, x); \
+ }
+
+# define MKillDwLeft(p, ml, x) \
+ if (dw_left(ml, x, p->w_encoding)) \
+ { \
+ 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(p, n, y, xs, xe)
+MScrollH(p, n, y, xs, xe, bce)
struct win *p;
-int n, y, xs, xe;
+int n, y, xs, xe, bce;
{
struct mline *ml;
if (n == 0)
return;
ml = &p->w_mlines[y];
+ MKillDwRight(p, ml, xs);
+ MKillDwLeft(p, ml, xe);
if (n > 0)
{
if (xe - xs + 1 > n)
- bcopy_mline(ml, xs + n, xs, xe + 1 - xs - n);
+ {
+ MKillDwRight(p, ml, xs + n);
+ bcopy_mline(ml, xs + n, xs, xe + 1 - xs - n);
+ }
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
{
n = -n;
if (xe - xs + 1 > n)
- bcopy_mline(ml, xs, xs + n, xe + 1 - xs - n);
+ {
+ MKillDwLeft(p, ml, xe - n);
+ bcopy_mline(ml, xs, xs + n, xe + 1 - xs - n);
+ }
else
n = xe - xs + 1;
clear_mline(ml, xs, n);
+#ifdef COLOR
+ if (bce)
+ MBceLine(p, y, xs, n, bce);
+#endif
}
}
static void
-MScrollV(p, n, ys, ye)
+MScrollV(p, n, ys, ye, bce)
struct win *p;
-int n;
-int ys, ye;
+int n, ys, ye, bce;
{
int i, cnt1, cnt2;
- struct mline *tmp[256];
+ struct mline tmp[256];
struct mline *ml;
if (n == 0)
@@ -2116,7 +2338,7 @@ int ys, ye;
{
if (n > 256)
{
- MScrollV(p, n - 256, ys, ye);
+ MScrollV(p, n - 256, ys, ye, bce);
n = 256;
}
if (ye - ys + 1 < n)
@@ -2137,7 +2359,7 @@ int ys, ye;
{
#ifdef COPY_PASTE
if (ys == p->w_top)
- AddLineToHist(p, ml);
+ WAddLineToHist(p, ml);
#endif
if (ml->attr != null)
free(ml->attr);
@@ -2151,8 +2373,17 @@ int ys, ye;
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
- bclear(ml->image, p->w_width + 1);
}
/* switch 'em over */
cnt1 = n * sizeof(struct mline);
@@ -2164,7 +2395,7 @@ int ys, ye;
{
if (n < -256)
{
- MScrollV(p, n + 256, ys, ye);
+ MScrollV(p, n + 256, ys, ye, bce);
n = -256;
}
n = -n;
@@ -2187,8 +2418,17 @@ int ys, ye;
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
- bclear(ml->image, p->w_width + 1);
}
cnt1 = n * sizeof(struct mline);
cnt2 = (ye - ys + 1 - n) * sizeof(struct mline);
@@ -2219,9 +2459,9 @@ int cnt1, cnt2;
}
static void
-MClear(p, xs, ys, xe, ye)
+MClearArea(p, xs, ys, xe, ye, bce)
struct win *p;
-int xs, ys, xe, ye;
+int xs, ys, xe, ye, bce;
{
int n, y;
int xxe;
@@ -2233,6 +2473,9 @@ int xs, ys, xe, ye;
if (xe >= p->w_width)
xe = p->w_width - 1;
+ MKillDwRight(p, p->w_mlines + ys, xs);
+ MKillDwLeft(p, p->w_mlines + ye, xe);
+
ml = p->w_mlines + ys;
for (y = ys; y <= ye; y++, ml++)
{
@@ -2240,6 +2483,10 @@ int xs, ys, xe, ye;
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;
}
}
@@ -2257,9 +2504,33 @@ int x, y;
MFixLine(p, y, c);
ml = p->w_mlines + y;
n = p->w_width - x - 1;
+ MKillDwRight(p, ml, x);
if (n > 0)
- bcopy_mline(ml, x, x + 1, n);
+ {
+ MKillDwRight(p, ml, p->w_width - 1);
+ bcopy_mline(ml, x, x + 1, n);
+ }
copy_mchar2mline(c, ml, x);
+#ifdef DW_CHARS
+ if (c->mbcs)
+ {
+ if (--n > 0)
+ {
+ MKillDwRight(p, ml, p->w_width - 1);
+ bcopy_mline(ml, x + 1, x + 2, n);
+ }
+ 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)
+ ml->font[x + 1] = c->mbcs;
+# else
+ ml->font[x + 1] |= 0x80;
+# endif
+ }
+#endif
}
static void
@@ -2272,7 +2543,24 @@ int x, y;
MFixLine(p, y, c);
ml = &p->w_mlines[y];
+ MKillDwRight(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)
+ ml->font[x + 1] = c->mbcs;
+# else
+ ml->font[x + 1] |= 0x80;
+# endif
+ }
+#endif
}
@@ -2284,28 +2572,103 @@ int y, top, 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);
if (y == bot)
- MScrollV(p, 1, top, bot);
+ MScrollV(p, 1, top, bot, bce);
else if (y < p->w_height - 1)
y++;
- MFixLine(p, y, c);
+ if (ins)
+ MInsChar(p, c, 0, y);
+ else
+ MPutChar(p, c, 0, y);
+}
+
+static void
+MPutStr(p, s, n, r, x, y)
+struct win *p;
+char *s;
+int n;
+struct mchar *r;
+int x, y;
+{
+ struct mline *ml;
+ int i;
+ unsigned char *b;
+
+ if (n <= 0)
+ return;
+ MFixLine(p, y, r);
ml = &p->w_mlines[y];
- if (ins && p->w_width > 1)
- bcopy_mline(ml, 0, 1, p->w_width - 1);
- copy_mchar2mline(c, ml, 0);
+ 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;
+#ifdef FONT
+ b = ml->font + x;
+ for (i = n; i-- > 0;)
+ *b++ = r->font;
+#endif
+#ifdef COLOR
+ 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;
+# endif
+#endif
+}
+
+#ifdef COLOR
+static void
+MBceLine(p, y, xs, xe, bce)
+struct win *p;
+int y, xs, xe, bce;
+{
+ struct mchar mc;
+ struct mline *ml;
+ int x;
+
+ mc = mchar_null;
+ 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
-AddLineToHist(wp, ml)
+WAddLineToHist(wp, ml)
struct win *wp;
struct mline *ml;
{
- register char *q, *o;
+ register unsigned char *q, *o;
struct mline *hml;
if (wp->w_histheight == 0)
@@ -2327,6 +2690,11 @@ struct mline *ml;
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)
@@ -2352,6 +2720,10 @@ int ys, ye;
#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
}
debug1("MFindUsedLine returning %d\n", y);
@@ -2366,7 +2738,7 @@ int ys, ye;
/*
* Tricky: send only one bell even if the window is displayed
- * more than one times.
+ * more than once.
*/
void
WBell(p, visual)
@@ -2380,9 +2752,9 @@ int visual;
if (cv->c_layer->l_bottom == &p->w_layer)
break;
if (cv && !visual)
- PutStr(D_BL);
+ AddCStr(D_BL);
else if (cv && D_VB)
- PutStr(D_VB);
+ AddCStr(D_VB);
else
p->w_bell = visual ? BELL_VISUAL : BELL_FOUND;
}
@@ -2410,7 +2782,7 @@ int on;
if (!on && p->w_revvid && !D_CVR)
{
if (D_VB)
- PutStr(D_VB);
+ AddCStr(D_VB);
else
p->w_bell = BELL_VISUAL;
}
@@ -2485,15 +2857,22 @@ int what;
int *hp;
{
int h = 0;
+ int l;
while(*s)
{
- if (*s++ != '%')
+ if (*s++ != (hp ? '%' : '\005'))
continue;
+ l = 0;
while (*s >= '0' && *s <= '9')
s++;
+ if (*s == 'L')
+ {
+ s++;
+ l = 0x100;
+ }
if (*s == 'h')
h = 1;
- if (*s == what || what == 'd')
+ if (*s == what || ((*s | l) == what) || what == 'd')
break;
if (*s)
s++;
@@ -2508,16 +2887,31 @@ WindowChanged(p, what)
struct win *p;
int what;
{
- int inwstr, inhstr;
- int inwstrh, inhstrh;
+ int inwstr, inhstr, inlstr;
+ int inwstrh = 0, inhstrh = 0, inlstrh = 0;
int got, ox, oy;
struct display *olddisplay = display;
struct canvas *cv;
inwstr = inhstr = 0;
- inwstr = WindowChangedCheck(captionstring, what, &inwstrh);
- inhstr = WindowChangedCheck(hstatusstring, what, &inhstrh);
+ if (what == 'f')
+ {
+ WindowChanged((struct win *)0, 'w'|0x100);
+ WindowChanged((struct win *)0, 'W'|0x100);
+ }
+
+ if (what)
+ {
+ inwstr = WindowChangedCheck(captionstring, what, &inwstrh);
+ inhstr = WindowChangedCheck(hstatusstring, what, &inhstrh);
+ inlstr = WindowChangedCheck(wliststr, what, &inlstrh);
+ }
+ else
+ {
+ inwstr = inhstr = 0;
+ inlstr = 1;
+ }
if (p == 0)
{
@@ -2527,6 +2921,8 @@ int what;
oy = D_y;
for (cv = D_cvlist; cv; cv = cv->c_next)
{
+ if (inlstr || (inlstrh && p && p->w_hstatus && *p->w_hstatus && WindowChangedCheck(p->w_hstatus, what, (int *)0)))
+ WListUpdatecv(cv, (struct win *)0);
p = Layer2Window(cv->c_layer);
if (inwstr || (inwstrh && p && p->w_hstatus && *p->w_hstatus && WindowChangedCheck(p->w_hstatus, what, (int *)0)))
if (cv->c_ye + 1 < D_height)
@@ -2542,12 +2938,13 @@ int what;
return;
}
- if (p->w_hstatus && *p->w_hstatus && (inwstrh || inhstrh) && WindowChangedCheck(p->w_hstatus, what, (int *)0))
+ if (p->w_hstatus && *p->w_hstatus && (inwstrh || inhstrh || inlstrh) && WindowChangedCheck(p->w_hstatus, what, (int *)0))
{
inwstr |= inwstrh;
inhstr |= inhstrh;
+ inlstr |= inlstrh;
}
- if (!inwstr && !inhstr)
+ if (!inwstr && !inhstr && !inlstr)
return;
for (display = displays; display; display = display->d_next)
{
@@ -2556,6 +2953,8 @@ int what;
oy = D_y;
for (cv = D_cvlist; cv; cv = cv->c_next)
{
+ if (inlstr)
+ WListUpdatecv(cv, p);
if (Layer2Window(cv->c_layer) != p)
continue;
got = 1;
diff --git a/ansi.h b/ansi.h
index b34d7bd..1ac661b 100644
--- a/ansi.h
+++ b/ansi.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -43,6 +43,14 @@
#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
*/
@@ -106,13 +114,57 @@ enum move_t {
#define STATLINE (D_height-1)
#endif
-#ifdef KANJI
+#ifdef ENCODINGS
-#undef KANJI
-#define KANJI ('B' & 037)
+#define KANJI ('B' & 037)
+#define KANJI0212 ('D' & 037)
#define KANA 'I'
-#define EUC 1
+#define EUC_JP 1
#define SJIS 2
+#define EUC_KR 3
+#define EUC_CN 4
+#define BIG5 5
+#define KOI8R 6
+#define CP1251 7
+
+#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 \
+ )
+# define dw_right(ml, x, enc) ((enc == UTF8) ? \
+ (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/attacher.c b/attacher.c
index 71e40d8..92de3ce 100644
--- a/attacher.c
+++ b/attacher.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -33,12 +33,9 @@ RCS_ID("$Id: attacher.c,v 1.8 1994/05/31 12:31:32 mlschroe Exp $ FAU")
#include "screen.h"
#include "extern.h"
-#ifdef USE_PAM
-#include <security/pam_appl.h>
-#endif /* USE_PAM */
-
#include <pwd.h>
+static int WriteMessage __P((int, struct msg *));
static sigret_t AttacherSigInt __P(SIGPROTOARG);
#if defined(SIGWINCH) && defined(TIOCGWINSZ)
static sigret_t AttacherWinch __P(SIGPROTOARG);
@@ -62,6 +59,7 @@ extern struct passwd *ppp;
extern char *attach_tty, *attach_term, *LoginName, *preselect;
extern int xflag, dflag, rflag, quietflag, adaptflag;
extern struct mode attach_Mode;
+extern struct NewWindow nwin_options;
extern int MasterPid;
#ifdef MULTIUSER
@@ -73,10 +71,6 @@ static int multipipe[2];
# endif
#endif
-#ifdef USE_PAM
-static char *PAM_password;
-static char *PAM_name;
-#endif
#ifdef MULTIUSER
static int ContinuePlease;
@@ -98,6 +92,26 @@ AttachSigCont SIGDEFARG
* MSG_CONT, MSG_WINCH and nothing else!
*/
+static int
+WriteMessage(s, m)
+int s;
+struct msg *m;
+{
+ int r, l = sizeof(*m);
+
+ while(l > 0)
+ {
+ r = write(s, (char *)m + (sizeof(*m) - l), l);
+ if (r == -1 && errno == EINTR)
+ continue;
+ if (r == -1 || r == 0)
+ return -1;
+ l -= r;
+ }
+ return 0;
+}
+
+
int
Attach(how)
int how;
@@ -149,8 +163,8 @@ int how;
if (ret == SIG_POWER_BYE)
{
int ppid;
- setuid(real_uid);
setgid(real_gid);
+ setuid(real_uid);
if ((ppid = getppid()) > 1)
Kill(ppid, SIGHUP);
exit(0);
@@ -192,7 +206,7 @@ int how;
{
if ((lasts = MakeClientSocket(0)) >= 0)
{
- write(lasts, (char *)&m, sizeof(m));
+ WriteMessage(lasts, &m);
close(lasts);
}
return 0;
@@ -293,8 +307,8 @@ int how;
else
# endif
m.type = MSG_DETACH;
- if (write(lasts, (char *) &m, sizeof(m)) != sizeof(m))
- Panic(errno, "write");
+ if (WriteMessage(lasts, &m))
+ Panic(errno, "WriteMessage");
close(lasts);
if (how != MSG_ATTACH)
return 0; /* we detached it. jw. */
@@ -322,6 +336,7 @@ int how;
m.m.attach.lines = atoi(s);
if ((s = getenv("COLUMNS")))
m.m.attach.columns = atoi(s);
+ m.m.attach.encoding = nwin_options.encoding > 0 ? nwin_options.encoding + 1 : 0;
#ifdef MULTIUSER
/* setup CONT signal handler to repair the terminal mode */
@@ -329,8 +344,8 @@ int how;
signal(SIGCONT, AttachSigCont);
#endif
- if (write(lasts, (char *) &m, sizeof(m)) != sizeof(m))
- Panic(errno, "write");
+ if (WriteMessage(lasts, &m))
+ Panic(errno, "WriteMessage");
close(lasts);
debug1("Attach(%d): sent\n", m.type);
#ifdef MULTIUSER
@@ -358,14 +373,14 @@ int how;
#if defined(DEBUG) || !defined(DO_NOT_POLL_MASTER)
-static int AttacherPanic;
+static int AttacherPanic = 0;
#endif
#ifdef DEBUG
static sigret_t
AttacherChld SIGDEFARG
{
- AttacherPanic=1;
+ AttacherPanic = 1;
SIGRETURN;
}
#endif
@@ -395,7 +410,7 @@ AttacherSigInt SIGDEFARG
/*
* Unfortunatelly this is also the SIGHUP handler, so we have to
- * check, if the backend is already detached.
+ * check if the backend is already detached.
*/
sigret_t
@@ -420,7 +435,7 @@ AttacherFinit SIGDEFARG
m.protocol_revision = MSG_REVISION;
if ((s = MakeClientSocket(0)) >= 0)
{
- write(s, (char *)&m, sizeof(m));
+ WriteMessage(s, &m);
close(s);
}
}
@@ -445,12 +460,12 @@ AttacherFinitBye SIGDEFARG
if (multiattach)
exit(SIG_POWER_BYE);
#endif
+ setgid(real_gid);
#ifdef MULTIUSER
setuid(own_uid);
#else
setuid(real_uid);
#endif
- setgid(real_gid);
/* 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. */
@@ -565,14 +580,10 @@ Attacher()
#if defined(DEBUG) || !defined(DO_NOT_POLL_MASTER)
if (AttacherPanic)
{
-# ifdef FORKDEBUG
- exit(0);
-# else
fcntl(0, F_SETFL, 0);
SetTTY(0, &attach_Mode);
printf("\nSuddenly the Dungeon collapses!! - You die...\n");
eexit(1);
-# endif
}
#endif
#ifdef BSDJOBS
@@ -630,12 +641,12 @@ static sigret_t
LockHup SIGDEFARG
{
int ppid = getppid();
+ setgid(real_gid);
#ifdef MULTIUSER
setuid(own_uid);
#else
setuid(real_uid);
#endif
- setgid(real_gid);
if (ppid > 1)
Kill(ppid, SIGHUP);
exit(0);
@@ -661,12 +672,12 @@ LockTerminal()
if ((pid = fork()) == 0)
{
/* Child */
+ setgid(real_gid);
#ifdef MULTIUSER
setuid(own_uid);
#else
setuid(real_uid); /* this should be done already */
#endif
- setgid(real_gid);
closeallfiles(0); /* important: /etc/shadow may be open */
execl(prg, "SCREEN-LOCK", NULL);
exit(errno);
@@ -731,66 +742,79 @@ LockTerminal()
} /* LockTerminal */
#ifdef USE_PAM
-static int PAM_conv (int num_msg,
- const struct pam_message **msg,
- struct pam_response **resp,
- void *appdata_ptr) {
- int replies = 0;
- struct pam_response *reply = NULL;
-
- reply = malloc(sizeof(struct pam_response)*num_msg);
- if (!reply) return PAM_CONV_ERR;
- #define COPY_STRING(s) (s) ? strdup(s) : NULL
-
- for (replies = 0; replies < num_msg; replies++) {
- switch (msg[replies]->msg_style) {
- case PAM_PROMPT_ECHO_OFF:
- /* wants password */
- reply[replies].resp_retcode = PAM_SUCCESS;
- reply[replies].resp = COPY_STRING(PAM_password);
- break;
- case PAM_TEXT_INFO:
- /* ignore the informational mesage */
- /* but first clear out any drek left by malloc */
- reply[replies].resp = NULL;
- break;
- case PAM_PROMPT_ECHO_ON:
- /* user name given to PAM already */
- /* fall through */
- default:
- /* unknown or PAM_ERROR_MSG */
- free (reply);
- return PAM_CONV_ERR;
- }
+
+/*
+ * PAM support by Pablo Averbuj <pablo@averbuj.com>
+ */
+
+#include <security/pam_appl.h>
+
+static int PAM_conv __P((int, const struct pam_message **, struct pam_response **, void *));
+
+static int
+PAM_conv(num_msg, msg, resp, appdata_ptr)
+int num_msg;
+const struct pam_message **msg;
+struct pam_response **resp;
+void *appdata_ptr;
+{
+ int replies = 0;
+ struct pam_response *reply = NULL;
+
+ reply = malloc(sizeof(struct pam_response)*num_msg);
+ if (!reply)
+ return PAM_CONV_ERR;
+ #define COPY_STRING(s) (s) ? strdup(s) : NULL
+
+ for (replies = 0; replies < num_msg; replies++)
+ {
+ switch (msg[replies]->msg_style)
+ {
+ case PAM_PROMPT_ECHO_OFF:
+ /* wants password */
+ reply[replies].resp_retcode = PAM_SUCCESS;
+ reply[replies].resp = appdata_ptr ? strdup((char *)appdata_ptr) : 0;
+ break;
+ case PAM_TEXT_INFO:
+ /* ignore the informational mesage */
+ /* but first clear out any drek left by malloc */
+ reply[replies].resp = NULL;
+ break;
+ case PAM_PROMPT_ECHO_ON:
+ /* user name given to PAM already */
+ /* fall through */
+ default:
+ /* unknown or PAM_ERROR_MSG */
+ free(reply);
+ return PAM_CONV_ERR;
+ }
}
- *resp = reply;
- return PAM_SUCCESS;
+ *resp = reply;
+ return PAM_SUCCESS;
}
static struct pam_conv PAM_conversation = {
&PAM_conv,
NULL
};
-#endif
+#endif
+
/* -- original copyright by Luigi Cannelloni 1985 (luigi@faui70.UUCP) -- */
static void
screen_builtin_lck()
{
char fullname[100], *cp1, message[100 + 100];
- char *pass;
#ifdef USE_PAM
+ pam_handle_t *pamh = 0;
int pam_error;
- pam_handle_t *pamh = NULL;
#else
- char mypass[9];
-#endif /* USE_PAM */
+ char *pass, mypass[9];
+#endif
+#ifndef USE_PAM
pass = ppp->pw_passwd;
-
-#ifndef USE_PAM
- /* if we're using PAM this will evaluate to true. which we don't want. */
if (pass == 0 || *pass == 0)
{
if ((pass = getpass("Key: ")))
@@ -817,7 +841,7 @@ screen_builtin_lck()
}
pass = 0;
}
-#endif /* USE_PAM */
+#endif
debug("screen_builtin_lck looking in gcos field\n");
strncpy(fullname, ppp->pw_gecos, sizeof(fullname) - 9);
@@ -847,20 +871,15 @@ screen_builtin_lck()
/* NOTREACHED */
}
#ifdef USE_PAM
- PAM_password=cp1;
- PAM_name=ppp->pw_name;
-
- pam_error = pam_start("screen", PAM_name, &PAM_conversation, &pamh);
-
- if (pam_error == PAM_SUCCESS) {
- pam_error = pam_authenticate(pamh, 0);
- pam_end(pamh, PAM_SUCCESS);
- if (pam_error == PAM_SUCCESS) {
- memset(cp1,0,strlen(cp1));
- PAM_password = NULL;
- break;
- }
- }
+ PAM_conversation.appdata_ptr = cp1;
+ pam_error = pam_start("screen", ppp->pw_name, &PAM_conversation, &pamh);
+ if (pam_error != PAM_SUCCESS)
+ AttacherFinit(SIGARG); /* goodbye */
+ pam_error = pam_authenticate(pamh, 0);
+ pam_end(pamh, pam_error);
+ PAM_conversation.appdata_ptr = 0;
+ if (pam_error == PAM_SUCCESS)
+ break;
#else
if (pass)
{
@@ -874,8 +893,73 @@ screen_builtin_lck()
}
#endif
debug("screen_builtin_lck: NO!!!!!\n");
+ bzero(cp1, strlen(cp1));
}
+ bzero(cp1, strlen(cp1));
debug("password ok.\n");
}
#endif /* LOCK */
+
+
+void
+SendCmdMessage(sty, match, av)
+char *sty;
+char *match;
+char **av;
+{
+ int i, s;
+ struct msg m;
+ char *p;
+ int len, n;
+
+ if (sty == 0)
+ {
+ i = FindSocket(&s, (int *)0, (int *)0, match);
+ if (i == 0)
+ Panic(0, "No screen session found.");
+ if (i != 1)
+ Panic(0, "Use -S to specify a session.");
+ }
+ else
+ {
+#ifdef NAME_MAX
+ if (strlen(sty) > NAME_MAX)
+ sty[NAME_MAX] = 0;
+#endif
+ if (strlen(sty) > 2 * MAXSTR - 1)
+ sty[2 * MAXSTR - 1] = 0;
+ sprintf(SockPath + strlen(SockPath), "/%s", sty);
+ if ((s = MakeClientSocket(1)) == -1)
+ exit(1);
+ }
+ bzero((char *)&m, sizeof(m));
+ m.type = MSG_COMMAND;
+ if (attach_tty)
+ {
+ strncpy(m.m_tty, attach_tty, sizeof(m.m_tty) - 1);
+ m.m_tty[sizeof(m.m_tty) - 1] = 0;
+ }
+ p = m.m.command.cmd;
+ n = 0;
+ for (; *av && n < MAXARGS - 1; ++av, ++n)
+ {
+ len = strlen(*av) + 1;
+ if (p + len >= m.m.command.cmd + sizeof(m.m.command.cmd) - 1)
+ break;
+ strcpy(p, *av);
+ p += len;
+ }
+ *p = 0;
+ m.m.command.nargs = n;
+ strncpy(m.m.attach.auser, LoginName, sizeof(m.m.attach.auser) - 1);
+ m.m.command.auser[sizeof(m.m.command.auser) - 1] = 0;
+ m.protocol_revision = MSG_REVISION;
+ strncpy(m.m.command.preselect, preselect ? preselect : "", sizeof(m.m.command.preselect) - 1);
+ m.m.command.preselect[sizeof(m.m.command.preselect) - 1] = 0;
+ m.m.command.apid = getpid();
+ debug1("SendCommandMsg writing '%s'\n", m.m.command.cmd);
+ if (WriteMessage(s, &m))
+ Msg(errno, "write");
+ close(s);
+}
diff --git a/braille.c b/braille.c
index 8a05599..a0c1bc6 100644
--- a/braille.c
+++ b/braille.c
@@ -341,8 +341,8 @@ RefreshBraille()
}
else if (xs <= xe)
{
- RedisplayLine(-1, xs, xe, 1);
- RedisplayLine(y, xs, xe, 1);
+ LayRedisplayLine(-1, xs, xe, 1);
+ LayRedisplayLine(y, xs, xe, 1);
}
debug1("Braille: got >%s<\n", bd.bd_line);
@@ -380,10 +380,10 @@ bd_signal()
return;
display = bd.bd_dpy;
if (D_obufp != D_obuf)
- PutStr(D_BL);
+ AddCStr(D_BL);
else
{
- PutStr(D_BL);
+ AddCStr(D_BL);
Flush();
}
}
@@ -411,8 +411,8 @@ int y, xs, xe;
bd.bd_refreshing = bd.bd_searching = 1;
bd.bd_searchstart = xs;
bd.bd_searchend = xe;
- RedisplayLine(-1, xs, xe, 1);
- RedisplayLine(y, xs, xe, 1);
+ LayRedisplayLine(-1, xs, xe, 1);
+ LayRedisplayLine(y, xs, xe, 1);
bd.bd_refreshing = bd.bd_searching = 0;
BD_FORE->w_bd_y = oy;
}
diff --git a/braille.h b/braille.h
index 4d751b8..c0157de 100644
--- a/braille.h
+++ b/braille.h
@@ -25,6 +25,8 @@
* $Id: braille.h,v 1.1 1995/09/06 15:51:18 jnweiger Exp jnweiger $ FAU
*/
+#ifdef HAVE_BRAILLE
+
extern void StartBraille __P((void));
struct braille_display
@@ -78,3 +80,4 @@ extern struct braille_display bd;
#define BD_FORE bd.bd_dpy->d_fore
+#endif
diff --git a/comm.c b/comm.c
index ab468e6..e053ec7 100644
--- a/comm.c
+++ b/comm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -56,10 +56,16 @@ struct comm comms[RC_LAST + 1] =
#endif
{ "allpartial", NEED_DISPLAY|ARGS_1 },
{ "at", NEED_DISPLAY|ARGS_2|ARGS_ORMORE },
+#ifdef COLOR
+ { "attrcolor", ARGS_12 },
+#endif
{ "autodetach", ARGS_1 },
#ifdef AUTO_NUKE
{ "autonuke", NEED_DISPLAY|ARGS_1 },
#endif
+#ifdef COLOR
+ { "bce", NEED_FORE|ARGS_01 },
+#endif
#ifdef HAVE_BRAILLE
/* keywords for braille display (bd) */
@@ -104,8 +110,8 @@ struct comm comms[RC_LAST + 1] =
{ "charset", NEED_FORE|ARGS_1 },
{ "chdir", ARGS_01 },
{ "clear", NEED_FORE|ARGS_0 },
- { "colon", NEED_DISPLAY|ARGS_01 },
- { "command", NEED_DISPLAY|ARGS_0 },
+ { "colon", NEED_LAYER|ARGS_01 },
+ { "command", NEED_DISPLAY|ARGS_02 },
#ifdef COPY_PASTE
{ "compacthist", ARGS_01 },
#endif
@@ -118,16 +124,23 @@ struct comm comms[RC_LAST + 1] =
#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 KANJI
+#ifdef ENCODINGS
{ "defkanji", ARGS_1 },
#endif
+ { "deflog", ARGS_1 },
#if defined(UTMPOK) && defined(LOGOUTOK)
{ "deflogin", ARGS_1 },
#endif
@@ -140,40 +153,49 @@ struct comm comms[RC_LAST + 1] =
{ "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_0 },
+ { "detach", NEED_DISPLAY|ARGS_01 },
#endif
- { "digraph", NEED_DISPLAY|ARGS_01 },
- { "displays", NEED_DISPLAY|ARGS_0 },
+ { "digraph", NEED_LAYER|ARGS_01 },
+ { "dinfo", NEED_DISPLAY|ARGS_0 },
+ { "displays", NEED_LAYER|ARGS_0 },
{ "dumptermcap", NEED_FORE|ARGS_0 },
{ "echo", ARGS_12 },
- { "escape", NEED_DISPLAY|ARGS_1 },
+#ifdef ENCODINGS
+ { "encoding", ARGS_12 },
+#endif
+ { "escape", ARGS_1 },
+ { "eval", ARGS_1|ARGS_ORMORE },
#ifdef PSEUDOS
{ "exec", NEED_FORE|ARGS_0|ARGS_ORMORE },
#endif
{ "fit", NEED_DISPLAY|ARGS_0 },
{ "flow", NEED_FORE|ARGS_01 },
- { "focus", NEED_DISPLAY|ARGS_0 },
+ { "focus", NEED_DISPLAY|ARGS_01 },
{ "gr", NEED_FORE|ARGS_01 },
- { "hardcopy", NEED_FORE|ARGS_0 },
+ { "hardcopy", ARGS_012 },
{ "hardcopy_append", ARGS_1 },
- { "hardcopydir", ARGS_1 },
+ { "hardcopydir", ARGS_01 },
{ "hardstatus", ARGS_012 },
- { "height", NEED_DISPLAY|ARGS_01 },
- { "help", NEED_DISPLAY|ARGS_0 },
+ { "height", ARGS_0123 },
+ { "help", NEED_LAYER|ARGS_02 },
#ifdef COPY_PASTE
- { "history", NEED_FORE|ARGS_0 },
+ { "history", NEED_DISPLAY|NEED_FORE|ARGS_0 },
#endif
{ "hstatus", NEED_FORE|ARGS_1 },
- { "info", NEED_DISPLAY|ARGS_0 },
-#ifdef KANJI
+ { "ignorecase", ARGS_01 },
+ { "info", NEED_LAYER|ARGS_0 },
+#ifdef ENCODINGS
{ "kanji", NEED_FORE|ARGS_12 },
#endif
{ "kill", NEED_FORE|ARGS_0 },
{ "lastmsg", NEED_DISPLAY|ARGS_0 },
- { "license", NEED_DISPLAY|ARGS_0 },
+ { "license", NEED_LAYER|ARGS_0 },
#ifdef LOCK
{ "lockscreen", NEED_DISPLAY|ARGS_0 },
#endif
@@ -191,7 +213,7 @@ struct comm comms[RC_LAST + 1] =
#ifdef COPY_PASTE
{ "markkeys", ARGS_1 },
#endif
- { "meta", NEED_DISPLAY|ARGS_0 },
+ { "meta", NEED_LAYER|ARGS_0 },
{ "monitor", NEED_FORE|ARGS_01 },
{ "msgminwait", ARGS_1 },
{ "msgwait", ARGS_1 },
@@ -201,20 +223,20 @@ struct comm comms[RC_LAST + 1] =
#ifdef NETHACK
{ "nethack", ARGS_1 },
#endif
- { "next", NEED_DISPLAY|ARGS_0 },
+ { "next", ARGS_0 },
#ifdef MULTI
{ "nonblock", NEED_DISPLAY|ARGS_01 },
#endif
{ "number", NEED_FORE|ARGS_01 },
{ "obuflimit", NEED_DISPLAY|ARGS_01 },
{ "only", NEED_DISPLAY|ARGS_0 },
- { "other", NEED_DISPLAY|ARGS_0 },
+ { "other", ARGS_0 },
{ "partial", NEED_FORE|ARGS_01 },
#ifdef PASSWORD
{ "password", ARGS_01 },
#endif
#ifdef COPY_PASTE
- { "paste", NEED_DISPLAY|ARGS_012 },
+ { "paste", NEED_LAYER|ARGS_012 },
{ "pastefont", ARGS_01 },
#endif
{ "pow_break", NEED_FORE|ARGS_01 },
@@ -222,21 +244,22 @@ struct comm comms[RC_LAST + 1] =
{ "pow_detach", NEED_DISPLAY|ARGS_0 },
{ "pow_detach_msg", ARGS_01 },
#endif
- { "prev", NEED_DISPLAY|ARGS_0 },
+ { "prev", ARGS_0 },
{ "printcmd", ARGS_01 },
{ "process", NEED_DISPLAY|ARGS_01 },
{ "quit", ARGS_0 },
#ifdef COPY_PASTE
- { "readbuf", NEED_DISPLAY|ARGS_0 },
+ { "readbuf", ARGS_0123 },
#endif
- { "readreg", ARGS_012 },
+ { "readreg", ARGS_0|ARGS_ORMORE },
{ "redisplay", NEED_DISPLAY|ARGS_0 },
- { "register", ARGS_2 },
+ { "register", ARGS_24 },
{ "remove", NEED_DISPLAY|ARGS_0 },
#ifdef COPY_PASTE
{ "removebuf", ARGS_0 },
#endif
{ "reset", NEED_FORE|ARGS_0 },
+ { "resize", NEED_DISPLAY|ARGS_01 },
{ "screen", ARGS_0|ARGS_ORMORE },
#ifdef COPY_PASTE
{ "scrollback", NEED_FORE|ARGS_1 },
@@ -244,6 +267,7 @@ struct comm comms[RC_LAST + 1] =
{ "select", ARGS_01 },
{ "sessionname", ARGS_01 },
{ "setenv", ARGS_012 },
+ { "setsid", ARGS_1 },
{ "shell", ARGS_1 },
{ "shelltitle", ARGS_1 },
{ "silence", NEED_FORE|ARGS_01 },
@@ -251,9 +275,10 @@ struct comm comms[RC_LAST + 1] =
{ "sleep", ARGS_1 },
{ "slowpaste", NEED_FORE|ARGS_01 },
{ "sorendition", ARGS_012 },
+ { "source", ARGS_1 },
{ "split", NEED_DISPLAY|ARGS_0 },
{ "startup_message", ARGS_1 },
- { "stuff", NEED_DISPLAY|ARGS_12 },
+ { "stuff", NEED_LAYER|ARGS_12 },
#ifdef MULTIUSER
{ "su", NEED_DISPLAY|ARGS_012 },
#endif
@@ -264,24 +289,28 @@ struct comm comms[RC_LAST + 1] =
{ "termcap", ARGS_23 },
{ "termcapinfo", ARGS_23 },
{ "terminfo", ARGS_23 },
- { "time", ARGS_0 },
+ { "time", ARGS_01 },
{ "title", NEED_FORE|ARGS_01 },
{ "umask", ARGS_1|ARGS_ORMORE },
{ "unsetenv", ARGS_1 },
+#ifdef UTF8
+ { "utf8", NEED_FORE|ARGS_012 },
+#endif
{ "vbell", ARGS_01 },
{ "vbell_msg", ARGS_01 },
{ "vbellwait", ARGS_1 },
{ "verbose", ARGS_01 },
{ "version", ARGS_0 },
{ "wall", NEED_DISPLAY|ARGS_1},
- { "width", ARGS_01 },
+ { "width", ARGS_0123 },
+ { "windowlist", NEED_DISPLAY|ARGS_012 },
{ "windows", NEED_DISPLAY|ARGS_0 },
{ "wrap", NEED_FORE|ARGS_01 },
#ifdef COPY_PASTE
- { "writebuf", NEED_DISPLAY|ARGS_0 },
+ { "writebuf", ARGS_0123 },
#endif
{ "writelock", NEED_FORE|ARGS_01 },
- { "xoff", NEED_DISPLAY|ARGS_0 },
- { "xon", NEED_DISPLAY|ARGS_0 },
+ { "xoff", NEED_LAYER|ARGS_0 },
+ { "xon", NEED_LAYER|ARGS_0 },
{ "zombie", ARGS_01 }
};
diff --git a/comm.h.dist b/comm.h.dist
index d004f71..3ddd8e4 100644
--- a/comm.h.dist
+++ b/comm.h.dist
@@ -25,13 +25,16 @@ struct comm
#define NEED_FORE (1<<6) /* this command needs a fore window */
#define NEED_DISPLAY (1<<7) /* this command needs a display */
+#define NEED_LAYER (1<<8) /* this command needs a layer */
#define ARGS_01 (ARGS_0 | ARGS_PLUS1)
#define ARGS_02 (ARGS_0 | ARGS_PLUS2)
#define ARGS_12 (ARGS_1 | ARGS_PLUS1)
#define ARGS_23 (ARGS_2 | ARGS_PLUS1)
+#define ARGS_24 (ARGS_2 | ARGS_PLUS2)
#define ARGS_34 (ARGS_3 | ARGS_PLUS1)
#define ARGS_012 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2)
+#define ARGS_0123 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
#define ARGS_123 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2)
#define ARGS_124 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS3)
#define ARGS_1234 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
@@ -53,148 +56,163 @@ struct action
#define RC_ADDACL 6
#define RC_ALLPARTIAL 7
#define RC_AT 8
-#define RC_AUTODETACH 9
-#define RC_AUTONUKE 10
-#define RC_BELL 11
-#define RC_BELL_MSG 12
-#define RC_BIND 13
-#define RC_BINDKEY 14
-#define RC_BREAK 15
-#define RC_BREAKTYPE 16
-#define RC_BUFFERFILE 17
-#define RC_C1 18
-#define RC_CAPTION 19
-#define RC_CHACL 20
-#define RC_CHARSET 21
-#define RC_CHDIR 22
-#define RC_CLEAR 23
-#define RC_COLON 24
-#define RC_COMMAND 25
-#define RC_COMPACTHIST 26
-#define RC_CONSOLE 27
-#define RC_COPY 28
-#define RC_CRLF 29
-#define RC_DEBUG 30
-#define RC_DEFAUTONUKE 31
-#define RC_DEFBREAKTYPE 32
-#define RC_DEFC1 33
-#define RC_DEFCHARSET 34
-#define RC_DEFESCAPE 35
-#define RC_DEFFLOW 36
-#define RC_DEFGR 37
-#define RC_DEFHSTATUS 38
-#define RC_DEFKANJI 39
-#define RC_DEFLOGIN 40
-#define RC_DEFMODE 41
-#define RC_DEFMONITOR 42
-#define RC_DEFOBUFLIMIT 43
-#define RC_DEFSCROLLBACK 44
-#define RC_DEFSHELL 45
-#define RC_DEFSILENCE 46
-#define RC_DEFSLOWPASTE 47
-#define RC_DEFWRAP 48
-#define RC_DEFWRITELOCK 49
-#define RC_DETACH 50
-#define RC_DIGRAPH 51
-#define RC_DISPLAYS 52
-#define RC_DUMPTERMCAP 53
-#define RC_ECHO 54
-#define RC_ESCAPE 55
-#define RC_EXEC 56
-#define RC_FIT 57
-#define RC_FLOW 58
-#define RC_FOCUS 59
-#define RC_GR 60
-#define RC_HARDCOPY 61
-#define RC_HARDCOPY_APPEND 62
-#define RC_HARDCOPYDIR 63
-#define RC_HARDSTATUS 64
-#define RC_HEIGHT 65
-#define RC_HELP 66
-#define RC_HISTORY 67
-#define RC_HSTATUS 68
-#define RC_INFO 69
-#define RC_KANJI 70
-#define RC_KILL 71
-#define RC_LASTMSG 72
-#define RC_LICENSE 73
-#define RC_LOCKSCREEN 74
-#define RC_LOG 75
-#define RC_LOGFILE 76
-#define RC_LOGIN 77
-#define RC_LOGTSTAMP 78
-#define RC_MAPDEFAULT 79
-#define RC_MAPNOTNEXT 80
-#define RC_MAPTIMEOUT 81
-#define RC_MARKKEYS 82
-#define RC_META 83
-#define RC_MONITOR 84
-#define RC_MSGMINWAIT 85
-#define RC_MSGWAIT 86
-#define RC_MULTIUSER 87
-#define RC_NETHACK 88
-#define RC_NEXT 89
-#define RC_NONBLOCK 90
-#define RC_NUMBER 91
-#define RC_OBUFLIMIT 92
-#define RC_ONLY 93
-#define RC_OTHER 94
-#define RC_PARTIAL 95
-#define RC_PASSWORD 96
-#define RC_PASTE 97
-#define RC_PASTEFONT 98
-#define RC_POW_BREAK 99
-#define RC_POW_DETACH 100
-#define RC_POW_DETACH_MSG 101
-#define RC_PREV 102
-#define RC_PRINTCMD 103
-#define RC_PROCESS 104
-#define RC_QUIT 105
-#define RC_READBUF 106
-#define RC_READREG 107
-#define RC_REDISPLAY 108
-#define RC_REGISTER 109
-#define RC_REMOVE 110
-#define RC_REMOVEBUF 111
-#define RC_RESET 112
-#define RC_SCREEN 113
-#define RC_SCROLLBACK 114
-#define RC_SELECT 115
-#define RC_SESSIONNAME 116
-#define RC_SETENV 117
-#define RC_SHELL 118
-#define RC_SHELLTITLE 119
-#define RC_SILENCE 120
-#define RC_SILENCEWAIT 121
-#define RC_SLEEP 122
-#define RC_SLOWPASTE 123
-#define RC_SORENDITION 124
-#define RC_SPLIT 125
-#define RC_STARTUP_MESSAGE 126
-#define RC_STUFF 127
-#define RC_SU 128
-#define RC_SUSPEND 129
-#define RC_TERM 130
-#define RC_TERMCAP 131
-#define RC_TERMCAPINFO 132
-#define RC_TERMINFO 133
-#define RC_TIME 134
-#define RC_TITLE 135
-#define RC_UMASK 136
-#define RC_UNSETENV 137
-#define RC_VBELL 138
-#define RC_VBELL_MSG 139
-#define RC_VBELLWAIT 140
-#define RC_VERBOSE 141
-#define RC_VERSION 142
-#define RC_WALL 143
-#define RC_WIDTH 144
-#define RC_WINDOWS 145
-#define RC_WRAP 146
-#define RC_WRITEBUF 147
-#define RC_WRITELOCK 148
-#define RC_XOFF 149
-#define RC_XON 150
-#define RC_ZOMBIE 151
+#define RC_ATTRCOLOR 9
+#define RC_AUTODETACH 10
+#define RC_AUTONUKE 11
+#define RC_BCE 12
+#define RC_BELL 13
+#define RC_BELL_MSG 14
+#define RC_BIND 15
+#define RC_BINDKEY 16
+#define RC_BREAK 17
+#define RC_BREAKTYPE 18
+#define RC_BUFFERFILE 19
+#define RC_C1 20
+#define RC_CAPTION 21
+#define RC_CHACL 22
+#define RC_CHARSET 23
+#define RC_CHDIR 24
+#define RC_CLEAR 25
+#define RC_COLON 26
+#define RC_COMMAND 27
+#define RC_COMPACTHIST 28
+#define RC_CONSOLE 29
+#define RC_COPY 30
+#define RC_CRLF 31
+#define RC_DEBUG 32
+#define RC_DEFAUTONUKE 33
+#define RC_DEFBCE 34
+#define RC_DEFBREAKTYPE 35
+#define RC_DEFC1 36
+#define RC_DEFCHARSET 37
+#define RC_DEFENCODING 38
+#define RC_DEFESCAPE 39
+#define RC_DEFFLOW 40
+#define RC_DEFGR 41
+#define RC_DEFHSTATUS 42
+#define RC_DEFKANJI 43
+#define RC_DEFLOG 44
+#define RC_DEFLOGIN 45
+#define RC_DEFMODE 46
+#define RC_DEFMONITOR 47
+#define RC_DEFOBUFLIMIT 48
+#define RC_DEFSCROLLBACK 49
+#define RC_DEFSHELL 50
+#define RC_DEFSILENCE 51
+#define RC_DEFSLOWPASTE 52
+#define RC_DEFUTF8 53
+#define RC_DEFWRAP 54
+#define RC_DEFWRITELOCK 55
+#define RC_DETACH 56
+#define RC_DIGRAPH 57
+#define RC_DINFO 58
+#define RC_DISPLAYS 59
+#define RC_DUMPTERMCAP 60
+#define RC_ECHO 61
+#define RC_ENCODING 62
+#define RC_ESCAPE 63
+#define RC_EVAL 64
+#define RC_EXEC 65
+#define RC_FIT 66
+#define RC_FLOW 67
+#define RC_FOCUS 68
+#define RC_GR 69
+#define RC_HARDCOPY 70
+#define RC_HARDCOPY_APPEND 71
+#define RC_HARDCOPYDIR 72
+#define RC_HARDSTATUS 73
+#define RC_HEIGHT 74
+#define RC_HELP 75
+#define RC_HISTORY 76
+#define RC_HSTATUS 77
+#define RC_IGNORECASE 78
+#define RC_INFO 79
+#define RC_KANJI 80
+#define RC_KILL 81
+#define RC_LASTMSG 82
+#define RC_LICENSE 83
+#define RC_LOCKSCREEN 84
+#define RC_LOG 85
+#define RC_LOGFILE 86
+#define RC_LOGIN 87
+#define RC_LOGTSTAMP 88
+#define RC_MAPDEFAULT 89
+#define RC_MAPNOTNEXT 90
+#define RC_MAPTIMEOUT 91
+#define RC_MARKKEYS 92
+#define RC_META 93
+#define RC_MONITOR 94
+#define RC_MSGMINWAIT 95
+#define RC_MSGWAIT 96
+#define RC_MULTIUSER 97
+#define RC_NETHACK 98
+#define RC_NEXT 99
+#define RC_NONBLOCK 100
+#define RC_NUMBER 101
+#define RC_OBUFLIMIT 102
+#define RC_ONLY 103
+#define RC_OTHER 104
+#define RC_PARTIAL 105
+#define RC_PASSWORD 106
+#define RC_PASTE 107
+#define RC_PASTEFONT 108
+#define RC_POW_BREAK 109
+#define RC_POW_DETACH 110
+#define RC_POW_DETACH_MSG 111
+#define RC_PREV 112
+#define RC_PRINTCMD 113
+#define RC_PROCESS 114
+#define RC_QUIT 115
+#define RC_READBUF 116
+#define RC_READREG 117
+#define RC_REDISPLAY 118
+#define RC_REGISTER 119
+#define RC_REMOVE 120
+#define RC_REMOVEBUF 121
+#define RC_RESET 122
+#define RC_RESIZE 123
+#define RC_SCREEN 124
+#define RC_SCROLLBACK 125
+#define RC_SELECT 126
+#define RC_SESSIONNAME 127
+#define RC_SETENV 128
+#define RC_SETSID 129
+#define RC_SHELL 130
+#define RC_SHELLTITLE 131
+#define RC_SILENCE 132
+#define RC_SILENCEWAIT 133
+#define RC_SLEEP 134
+#define RC_SLOWPASTE 135
+#define RC_SORENDITION 136
+#define RC_SOURCE 137
+#define RC_SPLIT 138
+#define RC_STARTUP_MESSAGE 139
+#define RC_STUFF 140
+#define RC_SU 141
+#define RC_SUSPEND 142
+#define RC_TERM 143
+#define RC_TERMCAP 144
+#define RC_TERMCAPINFO 145
+#define RC_TERMINFO 146
+#define RC_TIME 147
+#define RC_TITLE 148
+#define RC_UMASK 149
+#define RC_UNSETENV 150
+#define RC_UTF8 151
+#define RC_VBELL 152
+#define RC_VBELL_MSG 153
+#define RC_VBELLWAIT 154
+#define RC_VERBOSE 155
+#define RC_VERSION 156
+#define RC_WALL 157
+#define RC_WIDTH 158
+#define RC_WINDOWLIST 159
+#define RC_WINDOWS 160
+#define RC_WRAP 161
+#define RC_WRITEBUF 162
+#define RC_WRITELOCK 163
+#define RC_XOFF 164
+#define RC_XON 165
+#define RC_ZOMBIE 166
-#define RC_LAST 151
+#define RC_LAST 166
diff --git a/comm.sh b/comm.sh
index d5fd8b0..3d09f81 100644
--- a/comm.sh
+++ b/comm.sh
@@ -39,13 +39,16 @@ struct comm
#define NEED_FORE (1<<6) /* this command needs a fore window */
#define NEED_DISPLAY (1<<7) /* this command needs a display */
+#define NEED_LAYER (1<<8) /* this command needs a layer */
#define ARGS_01 (ARGS_0 | ARGS_PLUS1)
#define ARGS_02 (ARGS_0 | ARGS_PLUS2)
#define ARGS_12 (ARGS_1 | ARGS_PLUS1)
#define ARGS_23 (ARGS_2 | ARGS_PLUS1)
+#define ARGS_24 (ARGS_2 | ARGS_PLUS2)
#define ARGS_34 (ARGS_3 | ARGS_PLUS1)
#define ARGS_012 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2)
+#define ARGS_0123 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
#define ARGS_123 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2)
#define ARGS_124 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS3)
#define ARGS_1234 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3)
diff --git a/config.h.in b/config.h.in
index 7fd18ba..974ab55 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2000
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -37,6 +37,11 @@
#define MAXWIN 40
/*
+ * Maximum length of window title
+ */
+#define MAXAKA 60
+
+/*
* Define SOCKDIR to be the directory to contain the named sockets
* screen creates. This should be in a common subdirectory, such as
* /usr/local or /tmp. It makes things a little more secure if you
@@ -49,9 +54,12 @@
*
* Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison).
*/
+#undef SOCKDIR
-/* #define SOCKDIR (eff_uid ? "/tmp/uscreens" : "/tmp/screens") */
-#define SOCKDIR "/var/run/screen"
+/*
+ * Define this if the SOCKDIR is not shared between hosts.
+ */
+#define SOCKDIR_IS_LOCAL_TO_HOST
/*
* Screen sources two startup files. First a global file with a path
@@ -59,7 +67,7 @@
* Don't define this, if you don't want it.
*/
#ifndef ETCSCREENRC
-# define ETCSCREENRC "/etc/screenrc"
+# define ETCSCREENRC "/usr/local/etc/screenrc"
#endif
/*
@@ -71,6 +79,14 @@
#define ALLOW_SYSSCREENRC 1
/*
+ * Screen needs encoding files for the translation of utf8
+ * into some encodings, e.g. JIS, BIG5.
+ * Only needed if FONT, ENCODINGS and UTF8 are defined.
+ */
+#ifndef SCREENENCODINGS
+# define SCREENENCODINGS "/usr/local/lib/screen/encodings"
+#endif
+/*
* Define CHECKLOGIN to force Screen users to enter their Unix password
* in addition to the screen password.
*
@@ -128,10 +144,18 @@
* 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 KANJI to include support for japanese character sets.
+ * 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
@@ -147,10 +171,15 @@
# define MAPKEYS
# define COLOR
# define FONT
-# define KANJI
+# define DW_CHARS
+# define ENCODINGS
+# define UTF8
+# define COLORS16
#endif /* SIMPLESCREEN */
#undef BUILTIN_TELNET
+#undef RXVT_OSC
+#undef COLORS256
/*
@@ -253,6 +282,19 @@
#undef USE_SGR
+/*
+ * Define USE_LOCALE if you want screen to use the locale names
+ * for the name of the month and day of the week.
+ */
+#define USE_LOCALE
+
+/*
+ * Define USE_PAM if your system supports PAM (Pluggable Authentication
+ * Modules) and you want screen to use it instead of calling crypt().
+ * (You may also need to add -lpam to LIBS in the Makefile.)
+ */
+#undef USE_PAM
+
/**********************************************************************
*
* End of User Configuration Section
@@ -426,6 +468,7 @@
#undef LOADAV_GETLOADAVG
#undef LOADAV_UNIX
#undef LOADAV_AVENRUN
+#undef LOADAV_USE_NLIST64
#undef NLIST_DECLARED
#undef NLIST_STRUCT
@@ -552,6 +595,22 @@
#undef HAVE_GETCWD
/*
+ * define HAVE_SETLOCALE if your system has the setlocale() call.
+ */
+#undef HAVE_SETLOCALE
+
+/*
+ * define HAVE_STRFTIME if your system has the strftime() call.
+ */
+#undef HAVE_STRFTIME
+
+/*
+ * define HAVE_NL_LANGINFO if your system has the nl_langinfo() call
+ * and <langinfo.h> defines CODESET.
+ */
+#undef HAVE_NL_LANGINFO
+
+/*
* define HAVE_DEV_PTC if you have a /dev/ptc character special
* device.
*/
diff --git a/configure b/configure
index be72464..773fff8 100755
--- a/configure
+++ b/configure
@@ -12,7 +12,21 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --with-libpam use libpam for PAM support"
+ --disable-socket-dir disable system wide socket-dir and use ~/.screen instead"
+ac_help="$ac_help
+ --with-socket-dir=path where to put the per-user sockets"
+ac_help="$ac_help
+ --enable-pam enable PAM support"
+ac_help="$ac_help
+ --enable-locale use localized month/day names"
+ac_help="$ac_help
+ --enable-telnet enable builtin telnet"
+ac_help="$ac_help
+ --enable-colors256 enable support for 256 colors"
+ac_help="$ac_help
+ --enable-rxvt_osc enable support for rxvt OSC codes"
+ac_help="$ac_help
+ --with-sys-screenrc=path where to put the global screenrc file"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -526,13 +540,6 @@ fi
-# Check whether --with-libpam or --without-libpam was given.
-if test "${with_libpam+set}" = set; then
- withval="$with_libpam"
- :
-fi
-
-
rev=`sed < ${srcdir}/patchlevel.h -n -e '/#define REV/s/#define REV *//p'`
vers=`sed < ${srcdir}/patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`
pat=`sed < ${srcdir}/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`
@@ -545,7 +552,7 @@ echo $ac_n "checking for prefix by $ac_c" 1>&6
# Extract the first word of "screen", so it can be a program name with args.
set dummy screen; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:549: checking for $ac_word" >&5
+echo "configure:556: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SCREEN'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -587,7 +594,7 @@ echo $ac_n "checking for prefix by $ac_c" 1>&6
# Extract the first word of "gzip", so it can be a program name with args.
set dummy gzip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:591: checking for $ac_word" >&5
+echo "configure:598: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GZIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -625,10 +632,11 @@ fi
fi
+old_CFLAGS="$CFLAGS"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:632: checking for $ac_word" >&5
+echo "configure:640: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -658,7 +666,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:662: checking for $ac_word" >&5
+echo "configure:670: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -709,7 +717,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:713: checking for $ac_word" >&5
+echo "configure:721: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -741,7 +749,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:745: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:753: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -752,12 +760,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 756 "configure"
+#line 764 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -783,12 +791,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:787: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:795: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:792: checking whether we are using GNU C" >&5
+echo "configure:800: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -797,7 +805,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -816,7 +824,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:820: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:828: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -848,7 +856,7 @@ else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:852: checking how to run the C preprocessor" >&5
+echo "configure:860: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -863,13 +871,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 867 "configure"
+#line 875 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -880,13 +888,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 884 "configure"
+#line 892 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -897,13 +905,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 901 "configure"
+#line 909 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -929,13 +937,13 @@ echo "$ac_t""$CPP" 1>&6
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:933: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:941: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 939 "configure"
+#line 947 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -953,7 +961,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 957 "configure"
+#line 965 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -975,7 +983,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:979: checking for POSIXized ISC" >&5
+echo "configure:987: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -1000,11 +1008,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1004 "configure"
+#line 1012 "configure"
#include "confdefs.h"
main(){exit(0);}
EOF
-if { (eval echo configure:1008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1031,11 +1039,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1035 "configure"
+#line 1043 "configure"
#include "confdefs.h"
main(){exit(0);}
EOF
-if { (eval echo configure:1039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1058,7 +1066,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1062 "configure"
+#line 1070 "configure"
#include "confdefs.h"
main()
@@ -1068,7 +1076,7 @@ main()
}
EOF
-if { (eval echo configure:1072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
{ echo "configure: error: Your compiler does not set the exit status - sorry" 1>&2; exit 1; }
else
@@ -1084,7 +1092,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1088: checking for $ac_word" >&5
+echo "configure:1096: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1145,7 +1153,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1149: checking for a BSD compatible install" >&5
+echo "configure:1157: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1200,10 +1208,43 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
if test -f etc/toolcheck; then
echo "checking for buggy tools" 1>&6
-echo "configure:1204: checking for buggy tools" >&5
+echo "configure:1212: checking for buggy tools" >&5
sh etc/toolcheck 1>&6
fi
+
+
+echo $ac_n "checking if a system-wide socket dir should be used""... $ac_c" 1>&6
+echo "configure:1219: checking if a system-wide socket dir should be used" >&5
+# Check whether --enable-socket-dir or --disable-socket-dir was given.
+if test "${enable_socket_dir+set}" = set; then
+ enableval="$enable_socket_dir"
+
+ echo "$ac_t""no. ~/.screen will be used instead." 1>&6
+
+else
+
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for the socket dir""... $ac_c" 1>&6
+echo "configure:1230: checking for the socket dir" >&5
+ SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")"
+ # Check whether --with-socket-dir or --without-socket-dir was given.
+if test "${with_socket_dir+set}" = set; then
+ withval="$with_socket_dir"
+ SOCKDIR="\"${withval}\""
+fi
+
+ echo "$ac_t""${SOCKDIR}" 1>&6
+ cat >> confdefs.h <<EOF
+#define SOCKDIR $SOCKDIR
+EOF
+
+
+
+fi
+
+
+
if test -n "$ISC"; then
cat >> confdefs.h <<\EOF
#define ISC 1
@@ -1220,21 +1261,21 @@ EOF
fi
echo "checking for MIPS" 1>&6
-echo "configure:1224: checking for MIPS" >&5
+echo "configure:1265: checking for MIPS" >&5
if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
oldlibs="$LIBS"
test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
echo "checking mld library" 1>&6
-echo "configure:1229: checking mld library" >&5
+echo "configure:1270: checking mld library" >&5
cat > conftest.$ac_ext <<EOF
-#line 1231 "configure"
+#line 1272 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -1249,32 +1290,32 @@ cat >> confdefs.h <<\EOF
EOF
echo "checking wait3" 1>&6
-echo "configure:1253: checking wait3" >&5
+echo "configure:1294: checking wait3" >&5
cat > conftest.$ac_ext <<EOF
-#line 1255 "configure"
+#line 1296 "configure"
#include "confdefs.h"
int main() {
wait3();
; return 0; }
EOF
-if { (eval echo configure:1262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "checking wait2" 1>&6
-echo "configure:1269: checking wait2" >&5
+echo "configure:1310: checking wait2" >&5
cat > conftest.$ac_ext <<EOF
-#line 1271 "configure"
+#line 1312 "configure"
#include "confdefs.h"
int main() {
wait2();
; return 0; }
EOF
-if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define USE_WAIT2 1
@@ -1293,9 +1334,9 @@ fi
echo "checking for Ultrix" 1>&6
-echo "configure:1297: checking for Ultrix" >&5
+echo "configure:1338: checking for Ultrix" >&5
cat > conftest.$ac_ext <<EOF
-#line 1299 "configure"
+#line 1340 "configure"
#include "confdefs.h"
#if defined(ultrix) || defined(__ultrix)
yes;
@@ -1314,16 +1355,16 @@ if test -f /usr/lib/libpyr.a ; then
oldlibs="$LIBS"
LIBS="$LIBS -lpyr"
echo "checking Pyramid OSX" 1>&6
-echo "configure:1318: checking Pyramid OSX" >&5
+echo "configure:1359: checking Pyramid OSX" >&5
cat > conftest.$ac_ext <<EOF
-#line 1320 "configure"
+#line 1361 "configure"
#include "confdefs.h"
int main() {
open_controlling_pty("")
; return 0; }
EOF
-if { (eval echo configure:1327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define OSX 1
@@ -1339,9 +1380,9 @@ rm -f conftest*
fi
echo "checking for butterfly" 1>&6
-echo "configure:1343: checking for butterfly" >&5
+echo "configure:1384: checking for butterfly" >&5
cat > conftest.$ac_ext <<EOF
-#line 1345 "configure"
+#line 1386 "configure"
#include "confdefs.h"
#if defined(butterfly)
yes;
@@ -1361,9 +1402,9 @@ if test -n "$ULTRIX"; then
test -z "$GCC" && CC="$CC -YBSD"
fi
echo "checking for POSIX.1" 1>&6
-echo "configure:1365: checking for POSIX.1" >&5
+echo "configure:1406: checking for POSIX.1" >&5
cat > conftest.$ac_ext <<EOF
-#line 1367 "configure"
+#line 1408 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <unistd.h>
@@ -1387,9 +1428,9 @@ rm -f conftest*
fi
echo "checking for System V" 1>&6
-echo "configure:1391: checking for System V" >&5
+echo "configure:1432: checking for System V" >&5
cat > conftest.$ac_ext <<EOF
-#line 1393 "configure"
+#line 1434 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1398,7 +1439,7 @@ int main() {
int x = SIGCHLD | FNDELAY;
; return 0; }
EOF
-if { (eval echo configure:1402: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
:
else
echo "configure: failed program was:" >&5
@@ -1412,9 +1453,9 @@ fi
rm -f conftest*
echo "checking for sequent/ptx" 1>&6
-echo "configure:1416: checking for sequent/ptx" >&5
+echo "configure:1457: checking for sequent/ptx" >&5
cat > conftest.$ac_ext <<EOF
-#line 1418 "configure"
+#line 1459 "configure"
#include "confdefs.h"
#ifdef _SEQUENT_
yes;
@@ -1432,9 +1473,9 @@ rm -f conftest*
oldlibs="$LIBS"
LIBS="$LIBS -lelf"
echo "checking SVR4" 1>&6
-echo "configure:1436: checking SVR4" >&5
+echo "configure:1477: checking SVR4" >&5
cat > conftest.$ac_ext <<EOF
-#line 1438 "configure"
+#line 1479 "configure"
#include "confdefs.h"
#include <utmpx.h>
@@ -1442,21 +1483,21 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:1446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_safe=`echo "dwarf.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dwarf.h""... $ac_c" 1>&6
-echo "configure:1450: checking for dwarf.h" >&5
+echo "configure:1491: checking for dwarf.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1455 "configure"
+#line 1496 "configure"
#include "confdefs.h"
#include <dwarf.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1501: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1483,17 +1524,17 @@ else
echo "$ac_t""no" 1>&6
ac_safe=`echo "elf.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for elf.h""... $ac_c" 1>&6
-echo "configure:1487: checking for elf.h" >&5
+echo "configure:1528: checking for elf.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1492 "configure"
+#line 1533 "configure"
#include "confdefs.h"
#include <elf.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1497: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1532,9 +1573,9 @@ fi
rm -f conftest*
echo "checking for Solaris 2.x" 1>&6
-echo "configure:1536: checking for Solaris 2.x" >&5
+echo "configure:1577: checking for Solaris 2.x" >&5
cat > conftest.$ac_ext <<EOF
-#line 1538 "configure"
+#line 1579 "configure"
#include "confdefs.h"
#if defined(SVR4) && defined(sun)
yes
@@ -1552,9 +1593,9 @@ rm -f conftest*
echo "checking BSD job jontrol" 1>&6
-echo "configure:1556: checking BSD job jontrol" >&5
+echo "configure:1597: checking BSD job jontrol" >&5
cat > conftest.$ac_ext <<EOF
-#line 1558 "configure"
+#line 1599 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -1574,7 +1615,7 @@ int y = TIOCNOTTY;
; return 0; }
EOF
-if { (eval echo configure:1578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "- you have jobcontrol" 1>&6
cat >> confdefs.h <<\EOF
@@ -1591,9 +1632,9 @@ fi
rm -f conftest*
echo "checking setreuid" 1>&6
-echo "configure:1595: checking setreuid" >&5
+echo "configure:1636: checking setreuid" >&5
cat > conftest.$ac_ext <<EOF
-#line 1597 "configure"
+#line 1638 "configure"
#include "confdefs.h"
int main() {
@@ -1606,7 +1647,7 @@ setreuid(0, 0);
; return 0; }
EOF
-if { (eval echo configure:1610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SETREUID 1
@@ -1618,9 +1659,9 @@ else
fi
rm -f conftest*
echo "checking seteuid" 1>&6
-echo "configure:1622: checking seteuid" >&5
+echo "configure:1663: checking seteuid" >&5
cat > conftest.$ac_ext <<EOF
-#line 1624 "configure"
+#line 1665 "configure"
#include "confdefs.h"
int main() {
@@ -1633,7 +1674,7 @@ seteuid(0);
; return 0; }
EOF
-if { (eval echo configure:1637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SETEUID 1
@@ -1647,16 +1688,16 @@ rm -f conftest*
echo "checking select" 1>&6
-echo "configure:1651: checking select" >&5
+echo "configure:1692: checking select" >&5
cat > conftest.$ac_ext <<EOF
-#line 1653 "configure"
+#line 1694 "configure"
#include "confdefs.h"
int main() {
select(0, 0, 0, 0, 0);
; return 0; }
EOF
-if { (eval echo configure:1660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -1664,16 +1705,16 @@ else
rm -rf conftest*
LIBS="$LIBS -lnet -lnsl"
echo "checking select with $LIBS" 1>&6
-echo "configure:1668: checking select with $LIBS" >&5
+echo "configure:1709: checking select with $LIBS" >&5
cat > conftest.$ac_ext <<EOF
-#line 1670 "configure"
+#line 1711 "configure"
#include "confdefs.h"
int main() {
select(0, 0, 0, 0, 0);
; return 0; }
EOF
-if { (eval echo configure:1677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -1687,12 +1728,12 @@ fi
rm -f conftest*
echo "checking fifos" 1>&6
-echo "configure:1691: checking fifos" >&5
+echo "configure:1732: checking fifos" >&5
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1696 "configure"
+#line 1737 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -1711,7 +1752,11 @@ char *fin = "/tmp/conftest$$";
main()
{
struct stat stb;
+#ifdef FD_SET
+ fd_set f;
+#else
int f;
+#endif
(void)alarm(5);
#ifdef POSIX
@@ -1745,14 +1790,18 @@ main()
exit(1);
exit(0);
}
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
f = 1;
+#endif
if (select(1, &f, 0, 0, 0) == -1)
exit(1);
exit(0);
}
EOF
-if { (eval echo configure:1756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "- your fifos are usable" 1>&6
fifo=1
@@ -1770,12 +1819,12 @@ rm -f /tmp/conftest*
if test -n "$fifo"; then
echo "checking for broken fifo implementation" 1>&6
-echo "configure:1774: checking for broken fifo implementation" >&5
+echo "configure:1823: checking for broken fifo implementation" >&5
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1779 "configure"
+#line 1828 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -1795,7 +1844,11 @@ char *fin = "/tmp/conftest$$";
main()
{
struct timeval tv;
- int r, x;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
#ifdef POSIX
if (mkfifo(fin, 0600))
@@ -1806,16 +1859,20 @@ main()
close(0);
if (open(fin, O_RDONLY|O_NONBLOCK))
exit(1);
- r = 1;
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
+ f = 1;
+#endif
tv.tv_sec = 1;
tv.tv_usec = 0;
- if (select(1, &r, 0, 0, &tv))
+ if (select(1, &f, 0, 0, &tv))
exit(1);
exit(0);
}
EOF
-if { (eval echo configure:1819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "- your implementation is ok" 1>&6
@@ -1837,12 +1894,12 @@ fi
echo "checking sockets" 1>&6
-echo "configure:1841: checking sockets" >&5
+echo "configure:1898: checking sockets" >&5
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1846 "configure"
+#line 1903 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -1854,8 +1911,13 @@ char *son = "/tmp/conftest$$";
main()
{
- int s1, s2, s3, l;
+ int s1, s2, l;
struct sockaddr_un a;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
(void)alarm(5);
if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
@@ -1880,14 +1942,18 @@ main()
close(0);
if (accept(s1, &a, &l))
exit(1);
- l = 1;
- if (select(1, &l, 0, 0, 0) == -1)
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
+ f = 1;
+#endif
+ if (select(1, &f, 0, 0, 0) == -1)
exit(1);
exit(0);
}
EOF
-if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "- your sockets are usable" 1>&6
sock=1
@@ -1905,12 +1971,12 @@ rm -f /tmp/conftest*
if test -n "$sock"; then
echo "checking socket implementation" 1>&6
-echo "configure:1909: checking socket implementation" >&5
+echo "configure:1975: checking socket implementation" >&5
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1914 "configure"
+#line 1980 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -1939,7 +2005,7 @@ main()
}
EOF
-if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "- you are normal" 1>&6
@@ -1998,12 +2064,12 @@ fi
echo "checking select return value" 1>&6
-echo "configure:2002: checking select return value" >&5
+echo "configure:2068: checking select return value" >&5
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2007 "configure"
+#line 2073 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2024,7 +2090,11 @@ char *nam = "/tmp/conftest$$";
main()
{
- int l;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
#ifdef __FreeBSD__
/* From Andrew A. Chernov (ache@astral.msk.su):
@@ -2054,8 +2124,13 @@ main()
main()
{
- int s1, s2, s3, l;
+ int s1, s2, l;
struct sockaddr_un a;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
(void)alarm(5);
if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
@@ -2083,16 +2158,20 @@ main()
#endif
- l = 1;
- if (select(1, &l, 0, 0, 0) == -1)
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
+ f = 1;
+#endif
+ if (select(1, &f, 0, 0, 0) == -1)
exit(1);
- if (select(1, &l, &l, 0, 0) != 2)
+ if (select(1, &f, &f, 0, 0) != 2)
exit(1);
exit(0);
}
EOF
-if { (eval echo configure:2096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "- select is ok" 1>&6
@@ -2100,7 +2179,7 @@ else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- echo "- it is not usable" 1>&6
+ echo "- select can't count" 1>&6
cat >> confdefs.h <<\EOF
#define SELECT_BROKEN 1
EOF
@@ -2111,13 +2190,27 @@ fi
echo "checking for tgetent" 1>&6
-echo "configure:2115: checking for tgetent" >&5
-olibs="$LIBS"
+echo "configure:2194: checking for tgetent" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2196 "configure"
+#include "confdefs.h"
+
+int main() {
+tgetent((char *)0, (char *)0);
+; return 0; }
+EOF
+if { (eval echo configure:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ olibs="$LIBS"
LIBS="-lcurses $olibs"
echo "checking libcurses" 1>&6
-echo "configure:2119: checking libcurses" >&5
+echo "configure:2212: checking libcurses" >&5
cat > conftest.$ac_ext <<EOF
-#line 2121 "configure"
+#line 2214 "configure"
#include "confdefs.h"
int main() {
@@ -2130,7 +2223,7 @@ tgetent((char *)0, (char *)0);
; return 0; }
EOF
-if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -2138,16 +2231,16 @@ else
rm -rf conftest*
LIBS="-ltermcap $olibs"
echo "checking libtermcap" 1>&6
-echo "configure:2142: checking libtermcap" >&5
+echo "configure:2235: checking libtermcap" >&5
cat > conftest.$ac_ext <<EOF
-#line 2144 "configure"
+#line 2237 "configure"
#include "confdefs.h"
int main() {
tgetent((char *)0, (char *)0);
; return 0; }
EOF
-if { (eval echo configure:2151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -2155,16 +2248,16 @@ else
rm -rf conftest*
LIBS="-ltermlib $olibs"
echo "checking libtermlib" 1>&6
-echo "configure:2159: checking libtermlib" >&5
+echo "configure:2252: checking libtermlib" >&5
cat > conftest.$ac_ext <<EOF
-#line 2161 "configure"
+#line 2254 "configure"
#include "confdefs.h"
int main() {
tgetent((char *)0, (char *)0);
; return 0; }
EOF
-if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -2172,16 +2265,16 @@ else
rm -rf conftest*
LIBS="-lncurses $olibs"
echo "checking libncurses" 1>&6
-echo "configure:2176: checking libncurses" >&5
+echo "configure:2269: checking libncurses" >&5
cat > conftest.$ac_ext <<EOF
-#line 2178 "configure"
+#line 2271 "configure"
#include "confdefs.h"
int main() {
tgetent((char *)0, (char *)0);
; return 0; }
EOF
-if { (eval echo configure:2185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -2196,12 +2289,14 @@ fi
rm -f conftest*
fi
rm -f conftest*
+fi
+rm -f conftest*
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2205 "configure"
+#line 2300 "configure"
#include "confdefs.h"
main()
@@ -2209,7 +2304,7 @@ main()
exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
}
EOF
-if { (eval echo configure:2213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "- you use the termcap database" 1>&6
@@ -2227,16 +2322,16 @@ rm -fr conftest*
fi
echo "checking ospeed" 1>&6
-echo "configure:2231: checking ospeed" >&5
+echo "configure:2326: checking ospeed" >&5
cat > conftest.$ac_ext <<EOF
-#line 2233 "configure"
+#line 2328 "configure"
#include "confdefs.h"
extern short ospeed;
int main() {
ospeed=5;
; return 0; }
EOF
-if { (eval echo configure:2240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -2250,7 +2345,7 @@ fi
rm -f conftest*
echo "checking for /dev/ptc" 1>&6
-echo "configure:2254: checking for /dev/ptc" >&5
+echo "configure:2349: checking for /dev/ptc" >&5
if test -r /dev/ptc; then
cat >> confdefs.h <<\EOF
#define HAVE_DEV_PTC 1
@@ -2259,17 +2354,17 @@ EOF
fi
echo "checking for SVR4 ptys" 1>&6
-echo "configure:2263: checking for SVR4 ptys" >&5
+echo "configure:2358: checking for SVR4 ptys" >&5
if test -c /dev/ptmx ; then
cat > conftest.$ac_ext <<EOF
-#line 2266 "configure"
+#line 2361 "configure"
#include "confdefs.h"
int main() {
ptsname(0);grantpt(0);unlockpt(0);
; return 0; }
EOF
-if { (eval echo configure:2273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define HAVE_SVR4_PTYS 1
@@ -2281,15 +2376,16 @@ else
fi
rm -f conftest*
fi
+
for ac_func in getpt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2288: checking for $ac_func" >&5
+echo "configure:2384: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2293 "configure"
+#line 2389 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2312,7 +2408,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2338,14 +2434,14 @@ done
echo "checking for ptyranges" 1>&6
-echo "configure:2342: checking for ptyranges" >&5
+echo "configure:2438: checking for ptyranges" >&5
if test -d /dev/ptym ; then
pdir='/dev/ptym'
else
pdir='/dev'
fi
cat > conftest.$ac_ext <<EOF
-#line 2349 "configure"
+#line 2445 "configure"
#include "confdefs.h"
#ifdef M_UNIX
yes;
@@ -2376,13 +2472,13 @@ EOF
fi
echo "checking default tty permissions/group" 1>&6
-echo "configure:2380: checking default tty permissions/group" >&5
+echo "configure:2476: checking default tty permissions/group" >&5
rm -f conftest_grp
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2386 "configure"
+#line 2482 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2414,12 +2510,12 @@ main()
}
EOF
-if { (eval echo configure:2418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
if test -f conftest_grp; then
ptygrp=`cat conftest_grp`
- echo "- pty mode: 0620" 1>&6
+ echo "- pty mode: 0620, group: $ptygrp" 1>&6
cat >> confdefs.h <<\EOF
#define PTYMODE 0620
@@ -2438,8 +2534,118 @@ else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- echo "- can't determine - assume ptys are world accessable" 1>&6
+
+ WRITEPATH=''
+ XTERMPATH=''
+ # Extract the first word of "write", so it can be a program name with args.
+set dummy write; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2544: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_WRITEPATH'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$WRITEPATH" in
+ /*)
+ ac_cv_path_WRITEPATH="$WRITEPATH" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_WRITEPATH="$WRITEPATH" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_WRITEPATH="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+fi
+WRITEPATH="$ac_cv_path_WRITEPATH"
+if test -n "$WRITEPATH"; then
+ echo "$ac_t""$WRITEPATH" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xterm", so it can be a program name with args.
+set dummy xterm; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2579: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XTERMPATH'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XTERMPATH" in
+ /*)
+ ac_cv_path_XTERMPATH="$XTERMPATH" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_XTERMPATH="$XTERMPATH" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_XTERMPATH="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+fi
+XTERMPATH="$ac_cv_path_XTERMPATH"
+if test -n "$XTERMPATH"; then
+ echo "$ac_t""$XTERMPATH" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ found=
+ if test -n "$WRITEPATH$XTERMPATH"; then
+ findfollow=
+ lsfollow=
+ found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null`
+ if test -n "$found"; then
+ findfollow=-follow
+ lsfollow=L
+ fi
+ if test -n "$XTERMPATH"; then
+ ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'`
+ if test tty != "$ptygrpn"; then
+ XTERMPATH=
+ fi
+ fi
+ fi
+ if test -n "$WRITEPATH$XTERMPATH"; then
+ found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print`
+ if test -n "$found"; then
+ ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'`
+ echo "- pty mode: 0620, group: $ptygrp" 1>&6
+
+ cat >> confdefs.h <<\EOF
+#define PTYMODE 0620
+EOF
+
+ cat >> confdefs.h <<EOF
+#define PTYGROUP $ptygrp
+EOF
+
+ else
+ echo "- ptys are world accessable" 1>&6
+
+ fi
+ else
+ echo "- can't determine - assume ptys are world accessable" 1>&6
+
+ fi
+
fi
rm -fr conftest*
@@ -2448,9 +2654,9 @@ fi
rm -f conftest_grp
echo "checking getutent" 1>&6
-echo "configure:2452: checking getutent" >&5
+echo "configure:2658: checking getutent" >&5
cat > conftest.$ac_ext <<EOF
-#line 2454 "configure"
+#line 2660 "configure"
#include "confdefs.h"
#include <time.h> /* to get time_t on SCO */
@@ -2469,7 +2675,7 @@ int main() {
int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();
; return 0; }
EOF
-if { (eval echo configure:2473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define GETUTENT 1
@@ -2482,9 +2688,9 @@ else
olibs="$LIBS"
LIBS="$LIBS -lgen"
echo "checking getutent with -lgen" 1>&6
-echo "configure:2486: checking getutent with -lgen" >&5
+echo "configure:2692: checking getutent with -lgen" >&5
cat > conftest.$ac_ext <<EOF
-#line 2488 "configure"
+#line 2694 "configure"
#include "confdefs.h"
#include <time.h>
@@ -2503,7 +2709,7 @@ int main() {
int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();
; return 0; }
EOF
-if { (eval echo configure:2507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define GETUTENT 1
@@ -2520,9 +2726,9 @@ rm -f conftest*
fi
rm -f conftest*
echo "checking ut_host" 1>&6
-echo "configure:2524: checking ut_host" >&5
+echo "configure:2730: checking ut_host" >&5
cat > conftest.$ac_ext <<EOF
-#line 2526 "configure"
+#line 2732 "configure"
#include "confdefs.h"
#include <time.h>
@@ -2538,7 +2744,7 @@ int main() {
struct utmp u; u.ut_host[0] = 0;
; return 0; }
EOF
-if { (eval echo configure:2542: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2748: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define UTHOST 1
@@ -2551,17 +2757,17 @@ fi
rm -f conftest*
ac_safe=`echo "utempter.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for utempter.h""... $ac_c" 1>&6
-echo "configure:2555: checking for utempter.h" >&5
+echo "configure:2761: checking for utempter.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2560 "configure"
+#line 2766 "configure"
#include "confdefs.h"
#include <utempter.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2592,21 +2798,21 @@ EOF
fi
echo "checking for libutil(s)" 1>&6
-echo "configure:2596: checking for libutil(s)" >&5
+echo "configure:2802: checking for libutil(s)" >&5
test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
echo "checking getloadavg" 1>&6
-echo "configure:2601: checking getloadavg" >&5
+echo "configure:2807: checking getloadavg" >&5
cat > conftest.$ac_ext <<EOF
-#line 2603 "configure"
+#line 2809 "configure"
#include "confdefs.h"
int main() {
getloadavg((double *)0, 0);
; return 0; }
EOF
-if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define LOADAV_GETLOADAVG 1
@@ -2620,16 +2826,16 @@ else
olibs="$LIBS"
LIBS="$LIBS -lkvm"
echo "checking getloadavg with -lkvm" 1>&6
-echo "configure:2624: checking getloadavg with -lkvm" >&5
+echo "configure:2830: checking getloadavg with -lkvm" >&5
cat > conftest.$ac_ext <<EOF
-#line 2626 "configure"
+#line 2832 "configure"
#include "confdefs.h"
int main() {
getloadavg((double *)0, 0);
; return 0; }
EOF
-if { (eval echo configure:2633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define LOADAV_GETLOADAVG 1
@@ -2649,7 +2855,7 @@ rm -f conftest*
if test -z "$load" ; then
cat > conftest.$ac_ext <<EOF
-#line 2653 "configure"
+#line 2859 "configure"
#include "confdefs.h"
#if defined(NeXT) || defined(apollo) || defined(linux)
yes;
@@ -2666,7 +2872,7 @@ rm -f conftest*
fi
if test -z "$load" ; then
echo "checking for kernelfile" 1>&6
-echo "configure:2670: checking for kernelfile" >&5
+echo "configure:2876: checking for kernelfile" >&5
for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do
if test -f $core || test -c $core; then
break
@@ -2685,17 +2891,17 @@ EOF
ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for nlist.h""... $ac_c" 1>&6
-echo "configure:2689: checking for nlist.h" >&5
+echo "configure:2895: checking for nlist.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2694 "configure"
+#line 2900 "configure"
#include "confdefs.h"
#include <nlist.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2716,16 +2922,16 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
EOF
echo "checking n_un in struct nlist" 1>&6
-echo "configure:2720: checking n_un in struct nlist" >&5
+echo "configure:2926: checking n_un in struct nlist" >&5
cat > conftest.$ac_ext <<EOF
-#line 2722 "configure"
+#line 2928 "configure"
#include "confdefs.h"
#include <nlist.h>
int main() {
struct nlist n; n.n_un.n_name = 0;
; return 0; }
EOF
-if { (eval echo configure:2729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define NLIST_NAME_UNION 1
@@ -2742,9 +2948,9 @@ fi
echo "checking for nlist declaration" 1>&6
-echo "configure:2746: checking for nlist declaration" >&5
+echo "configure:2952: checking for nlist declaration" >&5
cat > conftest.$ac_ext <<EOF
-#line 2748 "configure"
+#line 2954 "configure"
#include "confdefs.h"
#ifdef NLIST_STRUCT
@@ -2766,13 +2972,14 @@ rm -f conftest*
echo "checking for avenrun symbol" 1>&6
-echo "configure:2770: checking for avenrun symbol" >&5
- for av in avenrun _avenrun _Loadavg ; do
+echo "configure:2976: checking for avenrun symbol" >&5
+ nlist64=
+ for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2776 "configure"
+#line 2983 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2782,11 +2989,7 @@ else
#include <a.out.h>
#endif
-#ifdef __sgi
-# if _MIPS_SZLONG == 64 || (defined(_MIPS_ISA) && _MIPS_ISA > 2)
-# define nlist nlist64
-# endif
-#endif
+$nlist64
struct nlist nl[2];
@@ -2808,7 +3011,7 @@ main()
}
EOF
-if { (eval echo configure:2812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
avensym=$av;break
else
@@ -2818,6 +3021,9 @@ fi
rm -fr conftest*
fi
+ if test "$av" = _Loadavg; then
+ nlist64='#define nlist nlist64'
+ fi
done
if test -z "$avensym" ; then
echo "- no avenrun symbol found" 1>&6
@@ -2829,6 +3035,14 @@ fi
#define LOADAV_AVENRUN "$avensym"
EOF
+ if test -n "$nlist64"; then
+ echo "- used nlist64 to find it" 1>&6
+
+ cat >> confdefs.h <<\EOF
+#define LOADAV_USE_NLIST64 1
+EOF
+
+ fi
load=1
fi
else
@@ -2851,13 +3065,14 @@ fi
fi
cat > conftest.c <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
_CUT_HERE_
-#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || !(defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
+#if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || (defined(SVR4) && !defined(__hpux)) || defined(sony_news) || (!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
loadtype=long
# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
loadscale=65536
@@ -2889,7 +3104,7 @@ loadnum=3
#endif
EOF
-eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' > conftest.out"
+eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out"
. ./conftest.out
rm -f conftest*
@@ -2923,9 +3138,9 @@ EOF
else
echo "checking return type of signal handlers" 1>&6
-echo "configure:2927: checking return type of signal handlers" >&5
+echo "configure:3142: checking return type of signal handlers" >&5
cat > conftest.$ac_ext <<EOF
-#line 2929 "configure"
+#line 3144 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -2937,7 +3152,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:2941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define SIGVOID 1
@@ -2949,9 +3164,9 @@ else
fi
rm -f conftest*
echo "checking sigset" 1>&6
-echo "configure:2953: checking sigset" >&5
+echo "configure:3168: checking sigset" >&5
cat > conftest.$ac_ext <<EOF
-#line 2955 "configure"
+#line 3170 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2967,7 +3182,7 @@ sigset(0, (int (*)())0);
; return 0; }
EOF
-if { (eval echo configure:2971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define USESIGSET 1
@@ -2979,12 +3194,12 @@ else
fi
rm -f conftest*
echo "checking signal implementation" 1>&6
-echo "configure:2983: checking signal implementation" >&5
+echo "configure:3198: checking signal implementation" >&5
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2988 "configure"
+#line 3203 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3021,7 +3236,7 @@ main()
}
EOF
-if { (eval echo configure:3025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -3041,21 +3256,21 @@ fi
echo "checking for crypt and sec libraries" 1>&6
-echo "configure:3045: checking for crypt and sec libraries" >&5
+echo "configure:3260: checking for crypt and sec libraries" >&5
test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
oldlibs="$LIBS"
LIBS="$LIBS -lcrypt"
echo "checking crypt" 1>&6
-echo "configure:3050: checking crypt" >&5
+echo "configure:3265: checking crypt" >&5
cat > conftest.$ac_ext <<EOF
-#line 3052 "configure"
+#line 3267 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -3069,16 +3284,16 @@ test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow
oldlibs="$LIBS"
LIBS="$LIBS -lsun"
echo "checking IRIX sun library" 1>&6
-echo "configure:3073: checking IRIX sun library" >&5
+echo "configure:3288: checking IRIX sun library" >&5
cat > conftest.$ac_ext <<EOF
-#line 3075 "configure"
+#line 3290 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:3082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -3089,16 +3304,16 @@ fi
rm -f conftest*
echo "checking syslog" 1>&6
-echo "configure:3093: checking syslog" >&5
+echo "configure:3308: checking syslog" >&5
cat > conftest.$ac_ext <<EOF
-#line 3095 "configure"
+#line 3310 "configure"
#include "confdefs.h"
int main() {
closelog();
; return 0; }
EOF
-if { (eval echo configure:3102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
:
else
echo "configure: failed program was:" >&5
@@ -3107,16 +3322,16 @@ else
oldlibs="$LIBS"
LIBS="$LIBS -lbsd"
echo "checking syslog in libbsd.a" 1>&6
-echo "configure:3111: checking syslog in libbsd.a" >&5
+echo "configure:3326: checking syslog in libbsd.a" >&5
cat > conftest.$ac_ext <<EOF
-#line 3113 "configure"
+#line 3328 "configure"
#include "confdefs.h"
int main() {
closelog();
; return 0; }
EOF
-if { (eval echo configure:3120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "- found." 1>&6
@@ -3124,7 +3339,7 @@ else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- LIBS="oldlibs"
+ LIBS="$oldlibs"
echo "- bad news: syslog missing." 1>&6
cat >> confdefs.h <<\EOF
#define NOSYSLOG 1
@@ -3136,7 +3351,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3140 "configure"
+#line 3355 "configure"
#include "confdefs.h"
#ifdef M_UNIX
yes;
@@ -3152,9 +3367,9 @@ rm -f conftest*
echo "checking wait union" 1>&6
-echo "configure:3156: checking wait union" >&5
+echo "configure:3371: checking wait union" >&5
cat > conftest.$ac_ext <<EOF
-#line 3158 "configure"
+#line 3373 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -3169,7 +3384,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define BSDWAIT 1
@@ -3183,14 +3398,14 @@ rm -f conftest*
if test -z "$butterfly"; then
echo "checking for termio or termios" 1>&6
-echo "configure:3187: checking for termio or termios" >&5
+echo "configure:3402: checking for termio or termios" >&5
cat > conftest.$ac_ext <<EOF
-#line 3189 "configure"
+#line 3404 "configure"
#include "confdefs.h"
#include <termio.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3205,12 +3420,12 @@ else
rm -rf conftest*
if test -n "$posix"; then
cat > conftest.$ac_ext <<EOF
-#line 3209 "configure"
+#line 3424 "configure"
#include "confdefs.h"
#include <termios.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3230,42 +3445,17 @@ fi
rm -f conftest*
fi
-
-
-if test "$with_libpam" = "yes"; then
- LIBPAM="-lpam -lpam_misc -ldl"
- USEPAM="-DUSE_PAM"
- cat >> confdefs.h <<\EOF
-#define PAM 1
-EOF
-
-# AC_CACHE_CHECK(whether pam_strerror needs two arguments,
-# ac_cv_pam_strerror_needs_two_args,
-# AC_TRY_COMPILE(
-# [#include <security/pam_appl.h>],
-# [ pam_handle_t *pamh; pam_strerror(pamh, PAM_SUCCESS);
-# ],
-# ac_cv_pam_strerror_needs_two_args=yes,
-# ac_cv_pam_strerror_needs_two_args=no
-# )
-# )
-# if test "$ac_cv_pam_strerror_needs_two_args" = "yes"; then
-# AC_DEFINE(PAM_STRERROR_NEEDS_TWO_ARGS)
-# fi
-fi
-
-
echo "checking getspnam" 1>&6
-echo "configure:3260: checking getspnam" >&5
+echo "configure:3450: checking getspnam" >&5
cat > conftest.$ac_ext <<EOF
-#line 3262 "configure"
+#line 3452 "configure"
#include "confdefs.h"
#include <shadow.h>
int main() {
getspnam("x");
; return 0; }
EOF
-if { (eval echo configure:3269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define SHADOWPW 1
@@ -3278,16 +3468,16 @@ fi
rm -f conftest*
echo "checking getttyent" 1>&6
-echo "configure:3282: checking getttyent" >&5
+echo "configure:3472: checking getttyent" >&5
cat > conftest.$ac_ext <<EOF
-#line 3284 "configure"
+#line 3474 "configure"
#include "confdefs.h"
int main() {
getttyent();
; return 0; }
EOF
-if { (eval echo configure:3291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define GETTTYENT 1
@@ -3300,12 +3490,12 @@ fi
rm -f conftest*
echo "checking whether memcpy/memmove/bcopy handles overlapping arguments" 1>&6
-echo "configure:3304: checking whether memcpy/memmove/bcopy handles overlapping arguments" >&5
+echo "configure:3494: checking whether memcpy/memmove/bcopy handles overlapping arguments" >&5
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3309 "configure"
+#line 3499 "configure"
#include "confdefs.h"
main() {
@@ -3321,7 +3511,7 @@ main() {
exit(0); /* libc version works properly. */
}
EOF
-if { (eval echo configure:3325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
cat >> confdefs.h <<\EOF
#define USEBCOPY 1
@@ -3339,7 +3529,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3343 "configure"
+#line 3533 "configure"
#include "confdefs.h"
#define bcopy(s,d,l) memmove(d,s,l)
@@ -3356,7 +3546,7 @@ main() {
exit(0); /* libc version works properly. */
}
EOF
-if { (eval echo configure:3360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
cat >> confdefs.h <<\EOF
#define USEMEMMOVE 1
@@ -3375,7 +3565,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3379 "configure"
+#line 3569 "configure"
#include "confdefs.h"
#define bcopy(s,d,l) memcpy(d,s,l)
@@ -3392,7 +3582,7 @@ main() {
exit(0); /* libc version works properly. */
}
EOF
-if { (eval echo configure:3396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
cat >> confdefs.h <<\EOF
#define USEMEMCPY 1
@@ -3407,7 +3597,7 @@ fi
echo $ac_n "checking long file names""... $ac_c" 1>&6
-echo "configure:3411: checking long file names" >&5
+echo "configure:3601: checking long file names" >&5
(echo 1 > /tmp/conftest9012345) 2>/dev/null
(echo 2 > /tmp/conftest9012346) 2>/dev/null
val=`cat /tmp/conftest9012345 2>/dev/null`
@@ -3423,16 +3613,16 @@ fi
rm -f /tmp/conftest*
echo $ac_n "checking for vsprintf""... $ac_c" 1>&6
-echo "configure:3427: checking for vsprintf" >&5
+echo "configure:3617: checking for vsprintf" >&5
cat > conftest.$ac_ext <<EOF
-#line 3429 "configure"
+#line 3619 "configure"
#include "confdefs.h"
int main() {
vsprintf(0,0,0);
; return 0; }
EOF
-if { (eval echo configure:3436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define USEVARARGS 1
@@ -3451,12 +3641,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:3455: checking for $ac_hdr that defines DIR" >&5
+echo "configure:3645: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3460 "configure"
+#line 3650 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -3464,7 +3654,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:3468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -3489,7 +3679,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:3493: checking for opendir in -ldir" >&5
+echo "configure:3683: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3497,7 +3687,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3501 "configure"
+#line 3691 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3508,7 +3698,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:3512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3530,7 +3720,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:3534: checking for opendir in -lx" >&5
+echo "configure:3724: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3538,7 +3728,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3542 "configure"
+#line 3732 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3549,7 +3739,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:3553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3573,16 +3763,16 @@ fi
echo $ac_n "checking for setenv""... $ac_c" 1>&6
-echo "configure:3577: checking for setenv" >&5
+echo "configure:3767: checking for setenv" >&5
cat > conftest.$ac_ext <<EOF
-#line 3579 "configure"
+#line 3769 "configure"
#include "confdefs.h"
int main() {
setenv((char *)0,(char *)0);unsetenv((char *)0);
; return 0; }
EOF
-if { (eval echo configure:3586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define USESETENV 1
@@ -3594,16 +3784,16 @@ else
rm -rf conftest*
echo "$ac_t""no" 1>&6
echo $ac_n "checking for putenv""... $ac_c" 1>&6
-echo "configure:3598: checking for putenv" >&5
+echo "configure:3788: checking for putenv" >&5
cat > conftest.$ac_ext <<EOF
-#line 3600 "configure"
+#line 3790 "configure"
#include "confdefs.h"
int main() {
putenv((char *)0);unsetenv((char *)0);
; return 0; }
EOF
-if { (eval echo configure:3607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
@@ -3619,16 +3809,41 @@ fi
rm -f conftest*
fi
rm -f conftest*
+echo $ac_n "checking for nl_langinfo(CODESET)""... $ac_c" 1>&6
+echo "configure:3814: checking for nl_langinfo(CODESET)" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3816 "configure"
+#include "confdefs.h"
-for ac_func in rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd
+#include <langinfo.h>
+
+int main() {
+nl_langinfo(CODESET);
+; return 0; }
+EOF
+if { (eval echo configure:3825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
+#define HAVE_NL_LANGINFO 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+for ac_func in rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3627: checking for $ac_func" >&5
+echo "configure:3842: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3632 "configure"
+#line 3847 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3651,7 +3866,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3676,17 +3891,109 @@ fi
done
+# Check whether --enable-pam or --disable-pam was given.
+if test "${enable_pam+set}" = set; then
+ enableval="$enable_pam"
+ :
+fi
+
+if test "$enable_pam" = "yes"; then
+ echo $ac_n "checking for PAM support""... $ac_c" 1>&6
+echo "configure:3903: checking for PAM support" >&5
+ oldlibs="$LIBS"
+ LIBS="$LIBS -lpam"
+ cat > conftest.$ac_ext <<EOF
+#line 3907 "configure"
+#include "confdefs.h"
+#include <security/pam_appl.h>
+int main() {
+
+ pam_start(0, 0, 0, 0);
+ pam_authenticate(0, 0);
+ pam_end(0,0);
+
+; return 0; }
+EOF
+if { (eval echo configure:3918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
+#define USE_PAM 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6;LIBS="$oldlibs"
+fi
+rm -f conftest*
+fi
+
+# Check whether --enable-use_locale or --disable-use_locale was given.
+if test "${enable_use_locale+set}" = set; then
+ enableval="$enable_use_locale"
+ :
+fi
+
+if test "$enable_use_locale" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define USE_LOCALE 1
+EOF
+
+fi
+# Check whether --enable-telnet or --disable-telnet was given.
+if test "${enable_telnet+set}" = set; then
+ enableval="$enable_telnet"
+ :
+fi
+
+if test "$enable_telnet" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define BUILTIN_TELNET 1
+EOF
+
+fi
+# Check whether --enable-colors256 or --disable-colors256 was given.
+if test "${enable_colors256+set}" = set; then
+ enableval="$enable_colors256"
+ :
+fi
+
+if test "$enable_colors256" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define COLORS256 1
+EOF
+
+fi
+# Check whether --enable-rxvt_osc or --disable-rxvt_osc was given.
+if test "${enable_rxvt_osc+set}" = set; then
+ enableval="$enable_rxvt_osc"
+ :
+fi
+
+if test "$enable_rxvt_osc" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define RXVT_OSC 1
+EOF
+
+fi
+
+if test -z "$old_CFLAGS"; then
+ if test "x$CFLAGS" = "x-g"; then
+ CFLAGS="-O"
+ fi
+fi
test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3686 "configure"
+#line 3993 "configure"
#include "confdefs.h"
main(){exit(0);}
EOF
-if { (eval echo configure:3690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -3698,12 +4005,37 @@ fi
rm -fr conftest*
fi
+
+ETCSCREENRC="\"/usr/local/etc/screenrc\""
if test -n "$prefix"; then
+ETCSCREENRC="\"$prefix/etc/screenrc\""
+fi
+echo $ac_n "checking for the global screenrc file""... $ac_c" 1>&6
+echo "configure:4015: checking for the global screenrc file" >&5
+# Check whether --with-sys-screenrc or --without-sys-screenrc was given.
+if test "${with_sys_screenrc+set}" = set; then
+ withval="$with_sys_screenrc"
+ ETCSCREENRC="\"${withval}\""
+fi
+
cat >> confdefs.h <<EOF
-#define ETCSCREENRC "/etc/screenrc"
+#define ETCSCREENRC $ETCSCREENRC
EOF
+echo "$ac_t""$ETCSCREENRC" 1>&6
+
+SCREENENCODINGS="\"/usr/local/lib/screen/utf8encodings\""
+if test -n "$datadir"; then
+eval SCREENENCODINGS="$datadir/screen/utf8encodings"
+SCREENENCODINGS="\"$SCREENENCODINGS\""
fi
+echo $ac_n "checking for the utf8-encodings location""... $ac_c" 1>&6
+echo "configure:4034: checking for the utf8-encodings location" >&5
+cat >> confdefs.h <<EOF
+#define SCREENENCODINGS $SCREENENCODINGS
+EOF
+
+echo "$ac_t""$SCREENENCODINGS" 1>&6
trap '' 1 2 15
cat > confcache <<\EOF
@@ -3847,8 +4179,8 @@ s%@AWK@%$AWK%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@LIBPAM@%$LIBPAM%g
-s%@USEPAM@%$USEPAM%g
+s%@WRITEPATH@%$WRITEPATH%g
+s%@XTERMPATH@%$XTERMPATH%g
CEOF
EOF
diff --git a/configure.in b/configure.in
index d3080ff..98dd2cf 100644
--- a/configure.in
+++ b/configure.in
@@ -14,11 +14,12 @@ dnl Define some useful macros
dnl
AC_DEFUN(AC_PROGRAM_SOURCE,
[AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF
+#include "confdefs.h"
[$1]
_CUT_HERE_
[$2]
EOF
-eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' > conftest.out"
+eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out"
. ./conftest.out
rm -f conftest*
])dnl
@@ -27,8 +28,6 @@ define(AC_NOTE,
[echo "$1" 1>&AC_FD_MSG
])dnl
-AC_ARG_WITH(libpam, [ --with-libpam use libpam for PAM support])
-
dnl
dnl Extract version from patchlevel.h
dnl
@@ -41,6 +40,7 @@ AC_SUBST(VERSION)
AC_PREFIX_PROGRAM(screen)
AC_PREFIX_PROGRAM(gzip)
+old_CFLAGS="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
@@ -80,6 +80,26 @@ AC_CHECKING(for buggy tools)
sh etc/toolcheck 1>&AC_FD_MSG
fi
+
+
+dnl SOCKDIR
+AC_MSG_CHECKING(if a system-wide socket dir should be used)
+AC_ARG_ENABLE(socket-dir,
+ [ --disable-socket-dir disable system wide socket-dir and use ~/.screen instead],
+ [
+ AC_MSG_RESULT(no. ~/.screen will be used instead.)
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING(for the socket dir)
+ SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")"
+ AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [ SOCKDIR="\"${withval}\"" ])
+ AC_MSG_RESULT(${SOCKDIR})
+ AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR)
+ ]
+)
+
+
dnl
dnl **** special unix variants ****
dnl
@@ -290,7 +310,11 @@ char *fin = "/tmp/conftest$$";
main()
{
struct stat stb;
+#ifdef FD_SET
+ fd_set f;
+#else
int f;
+#endif
(void)alarm(5);
#ifdef POSIX
@@ -324,7 +348,11 @@ main()
exit(1);
exit(0);
}
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
f = 1;
+#endif
if (select(1, &f, 0, 0, 0) == -1)
exit(1);
exit(0);
@@ -353,7 +381,11 @@ char *fin = "/tmp/conftest$$";
main()
{
struct timeval tv;
- int r, x;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
#ifdef POSIX
if (mkfifo(fin, 0600))
@@ -364,10 +396,14 @@ main()
close(0);
if (open(fin, O_RDONLY|O_NONBLOCK))
exit(1);
- r = 1;
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
+ f = 1;
+#endif
tv.tv_sec = 1;
tv.tv_usec = 0;
- if (select(1, &r, 0, 0, &tv))
+ if (select(1, &f, 0, 0, &tv))
exit(1);
exit(0);
}
@@ -393,8 +429,13 @@ char *son = "/tmp/conftest$$";
main()
{
- int s1, s2, s3, l;
+ int s1, s2, l;
struct sockaddr_un a;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
(void)alarm(5);
if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
@@ -419,8 +460,12 @@ main()
close(0);
if (accept(s1, &a, &l))
exit(1);
- l = 1;
- if (select(1, &l, 0, 0, 0) == -1)
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
+ f = 1;
+#endif
+ if (select(1, &f, 0, 0, 0) == -1)
exit(1);
exit(0);
}
@@ -510,7 +555,11 @@ char *nam = "/tmp/conftest$$";
main()
{
- int l;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
#ifdef __FreeBSD__
/* From Andrew A. Chernov (ache@astral.msk.su):
@@ -540,8 +589,13 @@ main()
main()
{
- int s1, s2, s3, l;
+ int s1, s2, l;
struct sockaddr_un a;
+#ifdef FD_SET
+ fd_set f;
+#else
+ int f;
+#endif
(void)alarm(5);
if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
@@ -569,20 +623,25 @@ main()
#endif
- l = 1;
- if (select(1, &l, 0, 0, 0) == -1)
+#ifdef FD_SET
+ FD_SET(0, &f);
+#else
+ f = 1;
+#endif
+ if (select(1, &f, 0, 0, 0) == -1)
exit(1);
- if (select(1, &l, &l, 0, 0) != 2)
+ if (select(1, &f, &f, 0, 0) != 2)
exit(1);
exit(0);
}
],AC_NOTE(- select is ok),
-AC_NOTE(- it is not usable) AC_DEFINE(SELECT_BROKEN))
+AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
dnl
dnl **** termcap or terminfo ****
dnl
AC_CHECKING(for tgetent)
+AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
olibs="$LIBS"
LIBS="-lcurses $olibs"
AC_CHECKING(libcurses)
@@ -602,7 +661,7 @@ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
LIBS="-lncurses $olibs"
AC_CHECKING(libncurses)
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
-AC_MSG_ERROR(!!! no tgetent - no screen)))))
+AC_MSG_ERROR(!!! no tgetent - no screen))))))
AC_TRY_RUN([
main()
@@ -625,6 +684,7 @@ AC_CHECKING(for SVR4 ptys)
if test -c /dev/ptmx ; then
AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],AC_DEFINE(HAVE_SVR4_PTYS))
fi
+
AC_CHECK_FUNCS(getpt)
AC_CHECKING(for ptyranges)
@@ -687,14 +747,47 @@ main()
],[
if test -f conftest_grp; then
ptygrp=`cat conftest_grp`
- AC_NOTE(- pty mode: 0620, group: $ptygrp)
+ AC_NOTE([- pty mode: 0620, group: $ptygrp])
AC_DEFINE(PTYMODE, 0620)
AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
else
AC_NOTE(- ptys are world accessable)
fi
-],
- AC_NOTE(- can't determine - assume ptys are world accessable)
+],[
+ WRITEPATH=''
+ XTERMPATH=''
+ AC_PATH_PROG(WRITEPATH, write)
+ AC_PATH_PROG(XTERMPATH, xterm)
+ found=
+ if test -n "$WRITEPATH$XTERMPATH"; then
+ findfollow=
+ lsfollow=
+ found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null`
+ if test -n "$found"; then
+ findfollow=-follow
+ lsfollow=L
+ fi
+ if test -n "$XTERMPATH"; then
+ ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'`
+ if test tty != "$ptygrpn"; then
+ XTERMPATH=
+ fi
+ fi
+ fi
+ if test -n "$WRITEPATH$XTERMPATH"; then
+ found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print`
+ if test -n "$found"; then
+ ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'`
+ AC_NOTE([- pty mode: 0620, group: $ptygrp])
+ AC_DEFINE(PTYMODE, 0620)
+ AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
+ else
+ AC_NOTE(- ptys are world accessable)
+ fi
+ else
+ AC_NOTE(- can't determine - assume ptys are world accessable)
+ fi
+ ]
)
rm -f conftest_grp
@@ -807,7 +900,8 @@ else
],AC_DEFINE(NLIST_DECLARED))
AC_CHECKING(for avenrun symbol)
- for av in avenrun _avenrun _Loadavg ; do
+ nlist64=
+ for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do
AC_TRY_RUN([
#include <sys/types.h>
#ifdef NLIST_STRUCT
@@ -816,11 +910,7 @@ else
#include <a.out.h>
#endif
-#ifdef __sgi
-# if _MIPS_SZLONG == 64 || (defined(_MIPS_ISA) && _MIPS_ISA > 2)
-# define nlist nlist64
-# endif
-#endif
+$nlist64
struct nlist nl[2];
@@ -841,12 +931,19 @@ main()
exit(0);
}
],avensym=$av;break)
+ if test "$av" = _Loadavg; then
+ nlist64='#define nlist nlist64'
+ fi
done
if test -z "$avensym" ; then
AC_NOTE(- no avenrun symbol found)
else
AC_NOTE(- using avenrun symbol '$avensym')
AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,"$avensym")
+ if test -n "$nlist64"; then
+ AC_NOTE(- used nlist64 to find it)
+ AC_DEFINE(LOADAV_USE_NLIST64)
+ fi
load=1
fi
else
@@ -865,7 +962,7 @@ AC_PROGRAM_SOURCE([
#include <sys/types.h>
#include <sys/param.h>
],[
-#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || !(defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
+#if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || (defined(SVR4) && !defined(__hpux)) || defined(sony_news) || (!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
loadtype=long
# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
loadscale=65536
@@ -991,7 +1088,7 @@ AC_CHECKING(syslog)
AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS"
LIBS="$LIBS -lbsd"
AC_CHECKING(syslog in libbsd.a)
-AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="oldlibs"
+AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="$oldlibs"
AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])])
AC_EGREP_CPP(yes,
@@ -1023,31 +1120,6 @@ fi
)
fi
-AC_SUBST(LIBPAM)
-AC_SUBST(USEPAM)
-if test "$with_libpam" = "yes"; then
- dnl AC_CHECK_LIB(pam, pam_start, AC_DEFINE(PAM) LIBPAM=-lpam)
- dnl the above doesn't work as there is no libpam.a (only .so)
- dnl XXX - libpam_misc is probably Linux-PAM specific
- LIBPAM="-lpam -lpam_misc -ldl"
- USEPAM="-DUSE_PAM"
- AC_DEFINE(PAM)
-# AC_CACHE_CHECK(whether pam_strerror needs two arguments,
-# ac_cv_pam_strerror_needs_two_args,
-# AC_TRY_COMPILE(
-# [#include <security/pam_appl.h>],
-# [ pam_handle_t *pamh; pam_strerror(pamh, PAM_SUCCESS);
-# ],
-# ac_cv_pam_strerror_needs_two_args=yes,
-# ac_cv_pam_strerror_needs_two_args=no
-# )
-# )
-# if test "$ac_cv_pam_strerror_needs_two_args" = "yes"; then
-# AC_DEFINE(PAM_STRERROR_NEEDS_TWO_ARGS)
-# fi
-fi
-
-
dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
AC_CHECKING(getspnam)
AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
@@ -1124,19 +1196,73 @@ AC_MSG_RESULT(no)
AC_MSG_CHECKING(for putenv)
AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)
))
+AC_MSG_CHECKING([for nl_langinfo(CODESET)])
+AC_TRY_LINK([
+#include <langinfo.h>
+],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
+
+AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime)
+
+AC_ARG_ENABLE(pam, [ --enable-pam enable PAM support])
+if test "$enable_pam" = "yes"; then
+ AC_MSG_CHECKING(for PAM support)
+ oldlibs="$LIBS"
+ LIBS="$LIBS -lpam"
+ AC_TRY_LINK([#include <security/pam_appl.h>], [
+ pam_start(0, 0, 0, 0);
+ pam_authenticate(0, 0);
+ pam_end(0,0);
+ ], AC_MSG_RESULT(yes);AC_DEFINE(USE_PAM),
+ AC_MSG_RESULT(no);LIBS="$oldlibs")
+fi
-AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd)
+AC_ARG_ENABLE(use_locale, [ --enable-locale use localized month/day names])
+if test "$enable_use_locale" = "yes"; then
+ AC_DEFINE(USE_LOCALE)
+fi
+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 ****
dnl
+if test -z "$old_CFLAGS"; then
+ if test "x$CFLAGS" = "x-g"; then
+ CFLAGS="-O"
+ fi
+fi
dnl Ptx bug workaround -- insert -lc after -ltermcap
test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
+
+ETCSCREENRC="\"/usr/local/etc/screenrc\""
if test -n "$prefix"; then
-AC_DEFINE_UNQUOTED(ETCSCREENRC,"/etc/screenrc")
+ETCSCREENRC="\"$prefix/etc/screenrc\""
+fi
+AC_MSG_CHECKING(for the global screenrc file)
+AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path where to put the global screenrc file], [ ETCSCREENRC="\"${withval}\"" ])
+AC_DEFINE_UNQUOTED(ETCSCREENRC,$ETCSCREENRC)
+AC_MSG_RESULT($ETCSCREENRC)
+
+SCREENENCODINGS="\"/usr/local/lib/screen/utf8encodings\""
+if test -n "$datadir"; then
+eval SCREENENCODINGS="$datadir/screen/utf8encodings"
+SCREENENCODINGS="\"$SCREENENCODINGS\""
fi
+AC_MSG_CHECKING(for the utf8-encodings location)
+AC_DEFINE_UNQUOTED(SCREENENCODINGS,$SCREENENCODINGS)
+AC_MSG_RESULT($SCREENENCODINGS)
AC_OUTPUT(Makefile doc/Makefile, [[
# a hook for preserving undef directive in config.h
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..e6c9f1b
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,53 @@
+$Id: README.Debian,v 1.5 2002/03/20 22:19:41 laz Exp $
+
+Screen Information
+------------------
+See the copyright file for information about where to get screen, licensing,
+and other assorted information.
+
+
+Debian Modifications
+--------------------
+ * added Debian package maintenance files
+ * Use /var/run/screen instead of /tmp/screens
+ * Make it set-gid "utmp" instead of setuid root
+
+
+Debian Screen Q&A
+-----------------
+
+Q: Screen sets my xterm titlebar. I don't like this, how do I make it stop?
+
+A: The titlebar setting is set in the /etc/screenrc by telling screen that some
+ of the GUI terminals have a hardstatus line and that it can be set by
+ sending the xterm escape sequences that set the title/icon.
+
+ # Set the hardstatus prop on gui terms to set the titlebar/icon title
+ termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
+
+ You can override this on a system wide basis by commenting out this line in
+ the /etc/screenrc or you can override it in your personal screenrc by adding
+ the following line:
+
+ termcapinfo xterm*|rxvt*|kterm*|Eterm* hs@
+
+
+Q: Why do I get #!$@#$@!% trailing spaces when I cut and paste from mutt
+ running within screen?
+Q: Why does the statusbar in my irc client extend to the end of the screen
+ in xterm but not in screen?
+
+A: This has to do with handling of the bce terminal attribute, or lack
+ thereof by default in screen. You can enable bce on a per-user by adding the
+ following to your .screenrc:
+
+ defbce on
+ term screen-bce
+
+ NOTE: if you do this your TERM will be screen-bce. When you login to
+ other machines they may not have a screen-bce terminal type, so you
+ will see errors. To fix this you must put the terminfo for screen-bce
+ on that remote machine. The screen terminfo is found in
+ /usr/share/doc/screen/terminfo/screeninfo.src and you can compile it
+ on the remote machine using tic(1).
+
diff --git a/debian/README.terminfo b/debian/README.terminfo
index 17068c2..d576c36 100644
--- a/debian/README.terminfo
+++ b/debian/README.terminfo
@@ -1,5 +1,5 @@
-Debian GNU/Linux uses ncurses/terminfo, not curses/termcap,
-so you really shouldn't need the screencap file in this directory.
+Debian uses ncurses/terminfo, not curses/termcap, so you really shouldn't need
+the screencap file in this directory.
The screeninfo.src file is installed by the `ncurses-term' package
-- it's here for reference, and to recover from stupid errors (like?).
diff --git a/debian/changelog b/debian/changelog
index 6baf456..75d81eb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,169 @@
+screen (3.9.11-5woody1) stable-security; urgency=high
+
+ * Non-maintainer upload by the Security Team
+ * Applied patch by Timo Sirainen <tss@iki.fi> to fix buffer integer
+ overflow (CAN-2003-0972)
+
+ -- Martin Schulze <joey@infodrom.org> Sun, 21 Dec 2003 19:46:24 +0100
+
+screen (3.9.11-5) unstable; urgency=high
+
+ * remove (%n.%t) from hardstatus string (closes: #137095)
+ * bump up max window title length to 60 (closes: #135391)
+ * debconf templates:
+ * add french translation (thanks Philippe Batailler) (closes: #141676)
+ * add russian translation (thanks Ilgiz Kalmetev) (closes: #137682)
+ * split translations out into their own files
+ * fix debconf prompt when upgrading from versions < 3.9.5-5 (closes: #137743)
+ * edit the long description a bit
+ * update README.Debian as to current state of screen-bce
+
+ -- Adam Lazur <zal@debian.org> Wed, 10 Apr 2002 22:01:46 -0400
+
+screen (3.9.11-4) unstable; urgency=low
+
+ * patches to fix Japanese support:
+ screen-3.9.11.hcGR-patch
+ screen-3.9.11.paste-patch
+ screen-3.9.11.encoding-patch (closes: #136740)
+ * add spanish debconf template translation (closes: #136447)
+
+ -- Adam Lazur <zal@debian.org> Thu, 7 Mar 2002 09:13:56 -0500
+
+screen (3.9.11-3) unstable; urgency=high
+
+ * Security Fix: override autoconf detected default group and mode on ptys
+ as it is not autodetected properly for buildd's that run
+ as cronjobs (closes: #135018)
+ * add note to README.Debian about setting xterm titlebar/icon and how to
+ override the default
+ * add note to README.Debian about mutt padding lines with whitespace (bce)
+ * add patchlevel.h (the real upstream changelog) to /usr/share/doc/screen
+
+ -- Adam Lazur <zal@debian.org> Thu, 21 Feb 2002 17:25:12 -0500
+
+screen (3.9.11-2) unstable; urgency=high
+
+ * Apply patch to fix non utf8 locales (closes: #134200)
+ * fix problems with screenrc changes that affected konsole (closes: #134198)
+ * remove line that was borking TERM=xterm
+ * re-add line which mods xterm initialization string
+ * Add screen-bce terminal type to screeninfo.src and add a note about it in
+ README.Debian
+
+ -- Adam Lazur <zal@debian.org> Sat, 16 Feb 2002 13:49:38 -0500
+
+screen (3.9.11-1) unstable; urgency=low
+
+ * New upstream release
+ * New commands: windowlist (bound to C-a "), source, eval, ignorecase,
+ deflogin, setsid
+ * Support for double-width utf-8 characters.
+ * bugfixes and other features, see /usr/share/doc/screen/NEWS.gz for more
+ info
+
+ * Removed patches:
+ * pam support, hurd fix, getpt fix: accepted upstream
+ * md5 password support: obsoleted by pam support
+ * bufferfile default change: screen is tmpfile safe
+
+ * Updates to /etc/screenrc:
+ * Bump up defscrollback from 100 (compiled in default) to 1024
+ (thanks to overfiend for pointing this out)
+ * Add examples of running programs at screen startup
+
+ * Add german template translation (closes: #126180)
+ * Now (ab)use upstream's makefile for most of the file installation
+ * compile with --enable-rxvt_osc to allow rxvt icon setting from within
+ screen (closes: #133333)
+
+ -- Adam Lazur <zal@debian.org> Fri, 15 Feb 2002 10:18:07 -0500
+
+screen (3.9.10-1) unstable; urgency=low
+
+ * New Maintainer
+ * migrate package build to debhelper
+ * debconfify prompt when upgrading from screen < 3.9.5-5
+
+ -- Adam Lazur <zal@debian.org> Sat, 15 Dec 2001 21:20:58 -0500
+
+screen (3.9.10-0.1) unstable; urgency=high
+
+ * NMU.
+ * New upstream version with security fix. (Closes: #111339)
+ (Thanks Adam Lazur <laz@clustermonkey.org>)
+
+ -- Eric Gillespie, Jr. <epg@debian.org> Wed, 12 Sep 2001 22:11:23 -0500
+
+screen (3.9.9-2) unstable; urgency=low
+
+ * New Standards-Version (3.5.4)
+ * Get rid of suidmanager, install screen setgid (closes: Bug#96858)
+
+ -- Juan Cespedes <cespedes@debian.org> Tue, 5 Jun 2001 23:50:42 +0200
+
+screen (3.9.9-1) unstable; urgency=low
+
+ * New upstream version
+ * Really fix Bug#80337 (thanks to Michael Schroeder <mls@suse.de>)
+
+ -- Juan Cespedes <cespedes@debian.org> Sat, 2 Jun 2001 19:40:37 +0200
+
+screen (3.9.8-6.1) unstable; urgency=HIGH
+
+ * Non-maintainer upload.
+ * Disable -DDEBUG which is a massive security hole, closes: #98839.
+
+ -- James Troup <james@nocrew.org> Sun, 27 May 2001 01:09:31 +0100
+
+screen (3.9.8-6) unstable; urgency=low
+
+ * Updated copyright file
+ * Applied patch from Ryan King <rking@caseta.com> to be
+ able to work correctly on many-lined terminals (closes: Bug#80337)
+
+ -- Juan Cespedes <cespedes@debian.org> Tue, 22 May 2001 00:23:00 +0200
+
+screen (3.9.8-5) unstable; urgency=low
+
+ * Fixed small typo in info file
+ * Clean up small lintian bugs
+ * Make commands related to bufferfile (readbuf, writebuf)
+ work again (Oops) (closes: Bug#45359, Bug#69275, Bug#83759)
+
+ -- Juan Cespedes <cespedes@debian.org> Sat, 19 May 2001 15:12:11 +0200
+
+screen (3.9.8-4) unstable; urgency=low
+
+ * Make /etc/pam.d/screen be a conffile (closes: Bug#58696)
+ * Remove option "autofixterm" from manual page (closes: Bug#97019)
+ * Applied patch to make screen work OK on Hurd (closes: Bug#97343)
+
+ -- Juan Cespedes <cespedes@debian.org> Mon, 14 May 2001 03:00:34 +0200
+
+screen (3.9.8-3) unstable; urgency=low
+
+ * Fixed small bug which caused `aterm' to display
+ everything underlined (closes: Bug#97327)
+
+ -- Juan Cespedes <cespedes@debian.org> Sun, 13 May 2001 15:39:19 +0200
+
+screen (3.9.8-2) unstable; urgency=low
+
+ * New version uploaded to unstable instead of "stable unstable" (sorry)
+
+ -- Juan Cespedes <cespedes@debian.org> Tue, 8 May 2001 22:28:35 +0200
+
+screen (3.9.8-1) stable unstable; urgency=medium
+
+ * New upstream version (closes: Bug#74310, Bug#89215)
+ * New Standards-Version (3.5.3)
+ * Applied patch to build cleanly on ia64 (closes: #91964)
+ * Fixed small bug regarding creation of sockets dir
+ when running as root
+
+ -- Juan Cespedes <cespedes@debian.org> Mon, 7 May 2001 23:26:40 +0200
+
screen (3.9.5-9) stable unstable; urgency=HIGH
* Fixed security bug (group utmp compromise)
@@ -220,7 +386,3 @@ screen (3.7.2-1) unstable; urgency=low
* converted to new source format
-- joost witteveen <joost@rulcmc.leidenuniv.nl> Sat, 4 Jan 1997 11:40:40 +0100
-
-Local variables:
-mode: debian-changelog
-End:
diff --git a/debian/conffiles b/debian/conffiles
deleted file mode 100644
index 7bd4f7e..0000000
--- a/debian/conffiles
+++ /dev/null
@@ -1 +0,0 @@
-/etc/screenrc
diff --git a/debian/config b/debian/config
new file mode 100644
index 0000000..1bcd393
--- /dev/null
+++ b/debian/config
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $Id: config,v 1.10 2002/04/09 03:21:13 laz Exp $
+# $Source: /home/laz/project/cvsroots/debian/screen/debian/config,v $
+#
+# config
+#
+
+set -e
+. /usr/share/debconf/confmodule
diff --git a/debian/control b/debian/control
index df81a92..e9dc79d 100644
--- a/debian/control
+++ b/debian/control
@@ -1,16 +1,21 @@
Source: screen
Section: misc
Priority: optional
-Maintainer: Juan Cespedes <cespedes@debian.org>
-Standards-Version: 3.1.1
-Build-Depends: libncurses5-dev, libpam0g-dev
+Maintainer: Adam Lazur <zal@debian.org>
+Standards-Version: 3.5.4
+Build-Depends: libncurses5-dev, texinfo, libpam0g-dev, base-passwd (>= 2.0.3.4), debhelper (>> 3.0.0)
Package: screen
Architecture: any
Depends: ${shlibs:Depends}, base-passwd (>= 2.0.3.4)
-Description: A screen manager with VT100/ANSI terminal emulation.
- screen is a terminal multiplexor that runs several separate "screens"
- on a single physical character-based terminal. Each virtual terminal
- emulates a DEC VT100 plus several ANSI X3.64 and ISO 2022 functions.
- Arbitrary keyboard input translation is also available. Sessions can
- be detached and resumed later on a different terminal.
+Pre-Depends: debconf (>= 0.2.17)
+Conflicts: suidmanager (<< 0.52)
+Description: A terminal multiplexor with VT100/ANSI terminal emulation.
+ screen is a terminal multiplexor that runs several separate "screens" on a
+ single physical character-based terminal. Each virtual terminal emulates a
+ DEC VT100 plus several ANSI X3.64 and ISO 2022 functions. Screen sessions
+ can be detached and resumed later on a different terminal.
+ .
+ Screen also supports a whole slew of other features. Some of these are:
+ configurable input and output translation, serial port support, configurable
+ logging, multi-user support, and utf8 charset support.
diff --git a/debian/copyright b/debian/copyright
index 579a8d6..998ea2c 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,17 +1,16 @@
-This is the Debian GNU/Linux prepackaged version of screen, a screen
-manager with VT100/ANSI terminal emulation.
+This is the Debian prepackaged version of screen, a screen manager with
+VT100/ANSI terminal emulation.
This package was put together from sources obtained from:
- ftp://ftp.uni-erlangen.de/pub/utilities/screen/screen-3.9.5.tar.gz
+ ftp://ftp.uni-erlangen.de/pub/utilities/screen
-Changes for Debian:
- * added Debian GNU/Linux package maintenance system files
- * ETCSCREENRC definition changed to "/etc/screenrc" in config.h.in
- * Used /var/run/screen instead of /tmp/screens
- * Added support for MD5-based passwords
- * Added PAM support
- * Make it set-gid "utmp" instead of setuid root
+See the info documentation for contact information for the upstream authors.
+You are free to distribute this software under the terms of the GNU
+General Public License version 2.
+
+On Debian systems, the complete text of the GNU General Public License can
+be found in /usr/share/common-licenses/GPL file.
Copyrights
----------
@@ -20,28 +19,9 @@ Copyright (C) 1991 Wayne Davidson
Copyright (C) 1993 Juergen Weigert <jnweiger@immd4.informatik.uni-erlangen.de>
Copyright (C) 1993 Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de>
-Modifications for Debian:
- Copyright (C) Ian Murdock <imurdock@debian.org>
+Debian Modifications:
+ Copyright (C) 1996 Ian Murdock <imurdock@debian.org>
Copyright (C) 1997 joost witteveen <joost@rulcmc.leidenuniv.nl>
- Copyright (C) 1997-1999 Juan Cespedes <cespedes@debian.org>
- PAM support: Copyright (C) 1999 "Pablo (Tombstone) Averbuj" <pablo@gos.nu>
-
-
-License
--------
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-A copy of the GNU General Public License is available as
-`/usr/doc/copyright/GPL' in the Debian GNU/Linux distribution or on
-the World Wide Web at `http://www.gnu.org/copyleft/gpl.html'. You can
-also obtain it by writing to the Free Software Foundation, Inc., 59
-Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Copyright (C) 1997-2001 Juan Cespedes <cespedes@debian.org>
+ Copyright (C) 2001-2002 Adam Lazur <zal@debian.org>
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..a0a9128
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,2 @@
+etc
+var/run/screen
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..645d9f9
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,10 @@
+NEWS
+README
+TODO
+doc/FAQ
+doc/fdpat.ps
+doc/window_to_display.ps
+etc/screenrc
+etc/etcscreenrc
+terminfo
+debian/README.Debian
diff --git a/debian/info b/debian/info
new file mode 100644
index 0000000..d5cfa46
--- /dev/null
+++ b/debian/info
@@ -0,0 +1,6 @@
+doc/screen.info
+doc/screen.info-1
+doc/screen.info-2
+doc/screen.info-3
+doc/screen.info-4
+doc/screen.info-5
diff --git a/debian/manpages b/debian/manpages
new file mode 100644
index 0000000..39b73be
--- /dev/null
+++ b/debian/manpages
@@ -0,0 +1 @@
+doc/screen.1
diff --git a/debian/pam.d-screen b/debian/pam.d-screen
deleted file mode 100644
index 60d5704..0000000
--- a/debian/pam.d-screen
+++ /dev/null
@@ -1 +0,0 @@
-auth required pam_unix.so
diff --git a/debian/postinst b/debian/postinst
index 2cdf80f..e5df4b1 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -1,4 +1,9 @@
-#!/bin/sh -e
+#!/bin/sh
+set -e
+
+# gotta source this b/c the package uses debconf and we don't want lintian to
+# whine about it...
+. /usr/share/debconf/confmodule
case "$1" in
configure) ;;
@@ -9,37 +14,9 @@ case "$1" in
exit 1 ;;
esac
-# FHS:
-if [ -d /usr/doc -a ! -e /usr/doc/screen -a -d /usr/share/doc/screen ]; then
- ln -sf ../share/doc/screen /usr/doc/screen
-fi
-
-install-info --quiet --section "General Commands" "General Commands" \
- /usr/share/info/screen.info.gz
-
-# the terminfo/termcap entries don't get installed now; it's done by
-# the `termcap-compat' and the `ncurses-term' packages
-
-# /var/run/screens was used in previous releases and should be removed now
-rm -rf /var/run/screens
-
-# if utmp group exists, use it
-if cut -d: -f1 < /etc/group | grep -qs utmp; then
- SCREEN_MODE=2755
- SCREEN_GROUP=utmp
- SCREENDIR_MODE=775
-else
- SCREEN_MODE=4755
- SCREEN_GROUP=root
- SCREENDIR_MODE=755
-fi
-
-if command -v suidregister > /dev/null 2>&1; then
- suidregister -s screen /usr/bin/screen root $SCREEN_GROUP $SCREEN_MODE
-else
- chown root.$SCREEN_GROUP /usr/bin/screen
- chmod $SCREEN_MODE /usr/bin/screen
+# /var/run/screens was used in previous releases and is now depricated
+if [ -d /var/run/screens ] ; then
+ rm -rf /var/run/screens
fi
-chown root.$SCREEN_GROUP /var/run/screen
-chmod $SCREENDIR_MODE /var/run/screen
+#DEBHELPER#
diff --git a/debian/postrm b/debian/postrm
index d3585a2..ccb0373 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -1,4 +1,5 @@
-#!/bin/sh -e
+#!/bin/sh
+set -e
case "$1" in
remove) ;;
@@ -10,10 +11,6 @@ case "$1" in
exit 1 ;;
esac
-install-info --quiet --remove screen
-
rm -rf /var/run/screen
-if command -v suidunregister > /dev/null 2>&1; then
- suidunregister -s screen /usr/bin/screen
-fi
+#DEBHELPER#
diff --git a/debian/preinst b/debian/preinst
index 4642773..ec44b9c 100644
--- a/debian/preinst
+++ b/debian/preinst
@@ -1,65 +1,58 @@
-#!/bin/sh -e
-
-# ask_user function by Philip Hands <phil@hands.com>
-# ask_user --- function prompts the user with y/n style prompt
+#!/bin/sh
#
-# It's behaviour is controlled via the parameters:
-# 1 - the initial prompt
-# 2 - default return value (set to 0, 1 or "none")
-# 3 - the patern match for acceptable Yes responses
-# 4 - the patern match for acceptable No responses
-# 5 - the error prompt, displayed when the user fails to provide valid input
+# $Id: preinst,v 1.15 2002/04/11 02:01:21 laz Exp $
#
-# e.g. ask_user "Foo, or Bar [fb] " none '[fF]*' '[bB]*' "try again"
-
-ask_user() {
- P=${1:-'Should I do this ? [yN] '}
- D=${2:-1}
- Y=${3:-'[yY]*'}
- N=${4:-'[nN]*'}
- E=${5:-'\nPlease enter either y)es or n)o, followed by <RETURN>\n'}
-
- while :
- do
- echo -ne "$P"
- read response
- case "$response" in
- ${Y} ) return 0 ;;
- ${N} ) return 1 ;;
- "" ) [ "$D" = 0 -o "$D" = 1 ] && return $D ;;
- esac
- echo -e $E
- done
-}
-
-if [ "$1" = "upgrade" ]
-then
- if dpkg --compare-versions $2 lt 3.9.5-5
- then
- if start-stop-daemon --stop --quiet --signal 0 --exec /usr/bin/screen
- then
- cat >&2 << EOF
-
-This version of "screen" is incompatible with all versions before 3.9.5-5;
-however, you have version $2 installed and some instances of it
-are running in this moment.
-If you continue with the installation, you will not be able to access
-your previous screen sessions
+set -e
+[ -n "$DEBUG" ] && set -vx
+
+action=$1
+version=$2
+
+# gimme da debconf
+set +vx
+. /usr/share/debconf/confmodule
+[ -n "$DEBUG" ] && set -vx
+
+if [ "$action" = "upgrade" ] ; then
+ # use procps' pgrep if possible
+ if which pgrep > /dev/null ; then
+ PGREP="pgrep -x "
+ else
+ # if not, manufacture our own pgrep using awk and ps... sucko
+ PGREP=screenmaint_pgrep
+
+ screenmaint_pgrep() {
+ ps auxww | awk "{
+ if (match(\$11,\"screen\")!=0 || match(\$11,\"SCREEN\")!=0) {
+ print \$2;
+ }
+ }"
+ }
-EOF
- if ask_user "Proceed anyway? [yN] " 1
- then
- :
- else
- cat >&2 << EOF
-
-Please exit from all the "screen" sessions before attempting
-to upgrade again
+ fi
-EOF
- exit 1
- fi
+ if dpkg --compare-versions "$version" lt "3.9.5-5" ; then
+ if [ ! -z "$($PGREP screen)" ] ; then
+ # if they're running an old version and there are screen processes
+ # running, then prompt
+
+ # reset these no matter what
+ db_reset screen/old_upgrade_prompt || true
+ db_fset screen/old_upgrade_prompt seen false || true
+
+ # then prompt
+ db_input high screen/old_upgrade_prompt || true
+ db_go || true
+
+ # and find out what they said
+ db_get screen/old_upgrade_prompt || true
+ if [ "$RET" = "false" ]; then
+ exit 1
+ fi
+ fi
fi
- fi
fi
+
+#DEBHELPER#
+
diff --git a/debian/prerm b/debian/prerm
deleted file mode 100644
index 52e9eaf..0000000
--- a/debian/prerm
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh -e
-
-if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/screen ]; then
- rm -f /usr/doc/screen
-fi
diff --git a/debian/rules b/debian/rules
index 3539b6c..dc75ed7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,62 +1,92 @@
#!/usr/bin/make -f
#
# Copyright (C) 1997 joost witteveen <joost@rulcmc.leidenuniv.nl>
-# Copyright (C) 1997-2000 Juan Cespedes <cespedes@debian.org>
-
-build: configure
- ./configure --prefix=/usr --with-libpam
- $(MAKE) CFLAGS='-O2 -g -Wall -DUSE_PAM'
- touch build
-
-configure: configure.in
- autoconf
-
-binary: binary-indep binary-arch
-
-binary-indep:
-
-binary-arch: build
- @test 0 = `id -u` || { echo "Error: not super-user"; exit 1; }
- rm -rf debian/tmp
- install -d -m 755 debian/tmp/DEBIAN debian/tmp/etc/pam.d
- install -d -m 755 debian/tmp/usr/share/info debian/tmp/usr/bin
- install -d -m 755 debian/tmp/usr/share/man/man1
- install -d -m 755 debian/tmp/usr/share/doc/screen
- install -d -m 755 debian/tmp/var/run/screen
- cp -a etc/etcscreenrc debian/tmp/etc/screenrc
- install -s -m 4755 screen debian/tmp/usr/bin/screen
- cp -a doc/screen.info* debian/tmp/usr/share/info
- cp -a doc/screen.1 debian/tmp/usr/share/man/man1/screen.1
- cp -a debian/pam.d-screen debian/tmp/etc/pam.d/screen
- cp -a debian/changelog debian/tmp/usr/share/doc/screen/changelog.Debian
- cp -a ChangeLog debian/tmp/usr/share/doc/screen/changelog
- cp -a README NEWS* TODO doc/FAQ doc/*.ps debian/tmp/usr/share/doc/screen
- rm -f debian/tmp/usr/share/info/screen.info*.gz
- gzip -9f debian/tmp/usr/share/info/screen.info* debian/tmp/usr/share/doc/screen/*
- gzip -9f debian/tmp/usr/share/man/man1/*
- install -d -m 755 debian/tmp/usr/share/doc/screen/terminfo
- cp -a terminfo/* debian/tmp/usr/share/doc/screen/terminfo
- gzip -9f debian/tmp/usr/share/doc/screen/terminfo/*
- cp -a debian/README.terminfo debian/tmp/usr/share/doc/screen/terminfo/README.Debian
- cp -a debian/copyright debian/tmp/usr/share/doc/screen/copyright
- cp -a debian/conffiles debian/tmp/DEBIAN/conffiles
- install -m 755 debian/preinst debian/tmp/DEBIAN/preinst
- install -m 755 debian/postinst debian/tmp/DEBIAN/postinst
- install -m 755 debian/prerm debian/tmp/DEBIAN/prerm
- install -m 755 debian/postrm debian/tmp/DEBIAN/postrm
-
- dpkg-shlibdeps screen
- dpkg-gencontrol
- chown -R root.root debian/tmp
- chmod -R u=rwX,go=rX debian/tmp
- dpkg --build debian/tmp ..
+# Copyright (C) 1997-2001 Juan Cespedes <cespedes@debian.org>
+# Copyright (C) 2001 Adam Lazur <zal@debian.org>
+
+# Uncomment me to turn on debugging
+#export DH_VERBOSE=1
+
+# the debhelper compatability version
+export DH_COMPAT=3
+
+package = screen
+
+ROOT = $$PWD/debian/$(package)
+
+# statically define this... sucko
+TTYGROUP = 5
+
+configure-stamp:
+ dh_testdir
+ ./configure --prefix=/usr \
+ --infodir='$$(prefix)/share/info' \
+ --mandir='$$(prefix)/share/man' \
+ --with-socket-dir=/var/run/screen \
+ --enable-pam \
+ --enable-rxvt_osc \
+ --with-sys-screenrc=/etc/screenrc
+# --enable-colors256
+ touch $@
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+ $(MAKE) CFLAGS='-O2 -g -Wall -DUSE_PAM -DPTYMODE=0620 -DPTYGROUP=$(TTYGROUP)'
+ touch $@
clean:
- rm -f build debian/files debian/substvars
- -$(MAKE) realclean
- rm -f config.log
- rm -f kmapdef.c
- rm -f osdef[012]*
- rm -rf debian/tmp
-
-.PHONY: binary binary-arch binary-indep clean
+ dh_testdir
+ dh_testroot
+ rm -f configure-stamp build-stamp
+ # clean up after the build process
+ -$(MAKE) clean
+ rm -rf config.status
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+ $(MAKE) prefix=$(ROOT)/usr SCREENENCODINGS='$$(prefix)/share/screen/utf8encodings' install
+ # install the debian screenrc to etc
+ install -m 644 debian/screenrc $(ROOT)/etc
+ # hack around the fact that the install target makes screen a symlink
+ # to screen-$(VERSION)
+ rm -f $(ROOT)/usr/bin/screen
+ mv -f $(ROOT)/usr/bin/screen* $(ROOT)/usr/bin/screen
+ # make it setgid utmp
+ chmod 2755 $(ROOT)/usr/bin/screen
+ chown root:utmp $(ROOT)/usr/bin/screen
+ chmod 775 $(ROOT)/var/run/screen
+ chown root:utmp $(ROOT)/var/run/screen
+ # lintian overrides for the setgid bin etc
+ install -m 755 -d $(ROOT)/usr/share/lintian/overrides
+ install -m 644 debian/screen.lintian.overrides $(ROOT)/usr/share/lintian/overrides/screen
+ # cheat a little here and copy the README.terminfo into the terminfo
+ # dir for dh_installdocs to pick up later
+ install -m 644 debian/README.terminfo terminfo
+
+binary: binary-arch
+
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installdebconf
+ dh_installdocs
+ dh_installexamples
+ dh_installpam
+ dh_installman || true
+ dh_installinfo
+ dh_installchangelogs -k patchlevel.h
+ dh_strip
+ dh_compress
+ dh_fixperms -X/usr/bin/screen -X/var/run/screen
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/screen.lintian.overrides b/debian/screen.lintian.overrides
new file mode 100644
index 0000000..e5883c1
--- /dev/null
+++ b/debian/screen.lintian.overrides
@@ -0,0 +1,2 @@
+screen: non-standard-dir-perm var/run/screen/ 0775 != 0755
+screen: setgid-binary usr/bin/screen 2755 root/utmp
diff --git a/debian/screen.pam b/debian/screen.pam
new file mode 100644
index 0000000..a14122a
--- /dev/null
+++ b/debian/screen.pam
@@ -0,0 +1,6 @@
+# $Id: screen.pam,v 1.1 2002/02/06 19:06:42 laz Exp $
+#
+# This is the PAM configuration file for screen(1)
+#
+
+auth required pam_unix.so
diff --git a/debian/screenrc b/debian/screenrc
new file mode 100644
index 0000000..6cf7caa
--- /dev/null
+++ b/debian/screenrc
@@ -0,0 +1,108 @@
+# $Id: screenrc,v 1.8 2002/03/20 22:20:21 laz Exp $
+#
+# /etc/screenrc
+#
+# This is the system wide screenrc.
+#
+# You can use this file to change the default behavior of screen system wide
+# or copy it to ~/.screenrc and use it as a starting point for your own
+# settings.
+#
+# Commands in this file are used to set options, bind screen functions to
+# keys, redefine terminal capabilities, and to automatically establish one or
+# more windows at the beginning of your screen session.
+#
+# This is not a comprehensive list of options, look at the screen manual for
+# details on everything that you can put in this file.
+#
+
+# ------------------------------------------------------------------------------
+# SCREEN SETTINGS
+# ------------------------------------------------------------------------------
+
+#startup_message off
+#nethack on
+
+#defflow on # will force screen to process ^S/^Q
+deflogin on
+#autodetach off
+
+# turn visual bell on
+vbell on
+vbell_msg " Wuff ---- Wuff!! "
+
+# define a bigger scrollback, default is 100 lines
+defscrollback 1024
+
+# ------------------------------------------------------------------------------
+# SCREEN KEYBINDINGS
+# ------------------------------------------------------------------------------
+
+# Remove some stupid / dangerous key bindings
+bind '^k'
+#bind 'L'
+bind '^\'
+# Make them better
+bind '\\' quit
+bind 'K' kill
+bind 'I' login on
+bind 'O' login off
+bind '}' history
+
+#bind 'R' colon "screen -ln rlogin faui -8^b^b^b"
+bind 'P' colon "^p"
+
+# An example of a "screen scraper" which will launch urlview on the current
+# screen window
+#
+#bind ^B eval "hardcopy_append off" "hardcopy -h $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview"
+
+# on Debian backspace should send char `\177':
+bindkey -k kb stuff "\177"
+
+# ------------------------------------------------------------------------------
+# TERMINAL SETTINGS
+# ------------------------------------------------------------------------------
+
+# The vt100 description does not mention "dl". *sigh*
+termcapinfo vt100 dl=5\E[M
+
+# turn sending of screen messages to hardstatus off
+hardstatus off
+# Set the hardstatus prop on gui terms to set the titlebar/icon title
+termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
+# use this for the hard status string
+hardstatus string "%h%? users: %u%?"
+
+# An alternative hardstatus to display a bar at the bottom listing the
+# windownames and highlighting the current windowname in blue. (This is only
+# enabled if there is no hardstatus setting for your terminal)
+#
+#hardstatus lastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
+
+# set these terminals up to be 'optimal' instead of vt100
+termcapinfo xterm*|linux*|rxvt*|Eterm* OP
+
+# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
+# (This fixes the "Aborted because of window size change" konsole symptoms found
+# in bug #134198)
+termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
+
+# Do not use xterms alternate window buffer (won't add lines to scrollback bfr)
+#termcapinfo xterm|xterms|xs ti=\E7\E[?47l
+
+# ------------------------------------------------------------------------------
+# STARTUP SCREENS
+# ------------------------------------------------------------------------------
+
+# Example of automatically running some programs in windows on screen startup.
+#
+# The following will open top in the first window, an ssh session to monkey
+# in the next window, and then open mutt and tail in windows 8 and 9
+# respectively.
+#
+# screen top
+# screen -t monkey ssh monkey
+# screen -t mail 8 mutt
+# screen -t daemon 9 tail -f /var/log/daemon.log
+
diff --git a/debian/templates b/debian/templates
new file mode 100644
index 0000000..575d56c
--- /dev/null
+++ b/debian/templates
@@ -0,0 +1,8 @@
+Template: screen/old_upgrade_prompt
+Type: boolean
+Default: false
+Description: You may lose currently running screen sessions. Continue the install?
+ This version of screen is incompatible with all versions before 3.9.5-5.
+ .
+ If you continue with the installation, you will not be able to access
+ currently running screen sessions.
diff --git a/debian/templates.de b/debian/templates.de
new file mode 100644
index 0000000..00bd0b9
--- /dev/null
+++ b/debian/templates.de
@@ -0,0 +1,13 @@
+Template: screen/old_upgrade_prompt
+Type: boolean
+Default: false
+Description: You may lose currently running screen sessions. Continue the install?
+ This version of screen is incompatible with all versions before 3.9.5-5.
+ .
+ If you continue with the installation, you will not be able to access
+ currently running screen sessions.
+Description-de: Sie k=F6nnten aktive Screen-Sitzungen verlieren. Installation fortsetzen?
+ Diese screen-Version ist inkompatibel mit allen Versionen vor 3.9.5-5.
+ .
+ Wenn Sie die Installation fortsetzen, dann werden Sie auf alle im Moment
+ aktiven screen-Sitzungen nicht mehr zugreifen k=F6nnen.
diff --git a/debian/templates.es b/debian/templates.es
new file mode 100644
index 0000000..9a3f90b
--- /dev/null
+++ b/debian/templates.es
@@ -0,0 +1,14 @@
+Template: screen/old_upgrade_prompt
+Type: boolean
+Default: false
+Description: You may lose currently running screen sessions. Continue the install?
+ This version of screen is incompatible with all versions before 3.9.5-5.
+ .
+ If you continue with the installation, you will not be able to access
+ currently running screen sessions.
+Description-es: Puede perder las sesiones de screen que tiene abiertas. ¿Continuar?
+ La versión que está instalando de screen es incompatible con todas las
+ versiones anteriores a la 3.9.5-5.
+ .
+ Si continúa con la instalación, no podrá acceder a las sesiones de screen
+ que tenga abiertas.
diff --git a/debian/templates.fr b/debian/templates.fr
new file mode 100644
index 0000000..bf85b77
--- /dev/null
+++ b/debian/templates.fr
@@ -0,0 +1,14 @@
+Template: screen/old_upgrade_prompt
+Type: boolean
+Default: false
+Description: You may lose currently running screen sessions. Continue the install?
+ This version of screen is incompatible with all versions before 3.9.5-5.
+ .
+ If you continue with the installation, you will not be able to access
+ currently running screen sessions.
+Description-fr: Vous pouvez perdre les sessions de screen en cours. Faut-il poursuivre l'installation ?
+ Cette version est incompatible avec toutes les versions antérieures à la
+ version 3.9.5-5.
+ .
+ Si vous continuez l'installation, vous ne pourrez plus accéder aux sessions
+ de screen en cours.
diff --git a/debian/templates.ru b/debian/templates.ru
new file mode 100644
index 0000000..f584fd2
--- /dev/null
+++ b/debian/templates.ru
@@ -0,0 +1,13 @@
+Template: screen/old_upgrade_prompt
+Type: boolean
+Default: false
+Description: You may lose currently running screen sessions. Continue the install?
+ This version of screen is incompatible with all versions before 3.9.5-5.
+ .
+ If you continue with the installation, you will not be able to access
+ currently running screen sessions.
+Description-ru: óÅÊÞÁÓ ×Ù ÍÏÖÅÔÅ ÐÏÔÅÒÑÔØ ÚÁÐÕÝÅÎÎÙÅ ÓÅÓÓÉÉ screen. ðÒÏÄÏÌÖÉÔØ ÕÓÔÁÎÏ×ËÕ?
+ üÔÁ ×ÅÒÓÉÑ screen ÎÅÓÏ×ÍÅÓÔÉÍÁ ÓÏ ×ÓÅÍÉ ×ÅÒÓÉÑÍÉ ÄÏ 3.9.5-5.
+ .
+ åÓÌÉ ×Ù ÐÒÏÄÏÌÖÉÔÅ ÕÓÔÁÎÏ×ËÕ, ÔÏ ×Ù ÌÉÛÉÔÅÓØ ÚÁÐÕÝÅÎÎÙÈ ÓÅÊÞÁÓ ÓÅÓÓÉÊ
+ screen.
diff --git a/display.c b/display.c
index 68133f0..a619c22 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -34,7 +34,7 @@ RCS_ID("$Id: display.c,v 1.16 1994/05/31 12:31:50 mlschroe Exp $ FAU")
#include "braille.h"
static int CountChars __P((int));
-static int PutChar __P((int));
+static int DoAddChar __P((int));
static int BlankResize __P((int, int));
static int CallRewrite __P((int, int, int, int));
static void FreeCanvas __P((struct canvas *));
@@ -47,8 +47,11 @@ static void cv_winid_fn __P((struct event *, char *));
static void disp_map_fn __P((struct event *, char *));
#endif
static void WriteLP __P((int, int));
-static void INSERTCHAR __P((int));
-static void RAW_PUTCHAR __P((int));
+static void INSERTCHAR __P((int));
+static void RAW_PUTCHAR __P((int));
+#ifdef COLOR
+static void SetBackColor __P((int));
+#endif
extern struct layer *flayer;
@@ -58,14 +61,17 @@ extern struct LayFuncs WinLf;
extern int use_hardstatus;
extern int MsgWait, MsgMinWait;
extern int Z0width, Z1width;
-extern char *blank, *null;
-extern struct mline mline_blank, mline_null;
+extern unsigned char *blank, *null;
+extern struct mline mline_blank, mline_null, mline_old;
extern struct mchar mchar_null, mchar_blank, mchar_so;
+extern struct NewWindow nwin_default;
/* XXX shouldn't be here */
extern char *hstatusstring;
extern char *captionstring;
+extern int pastefont;
+
/*
* tputs needs this to calculate the padding
*/
@@ -76,6 +82,10 @@ short ospeed;
struct display *display, *displays;
+#ifdef COLOR
+int attr2color[8];
+int nattr2color;
+#endif
#ifndef MULTI
struct display TheDisplay;
@@ -109,14 +119,14 @@ DefRedisplayLine(y, xs, xe, isblank)
int y, xs, xe, isblank;
{
if (isblank == 0 && y >= 0)
- DefClearLine(y, xs, xe);
+ DefClearLine(y, xs, xe, 0);
}
void
-DefClearLine(y, xs, xe)
-int y, xs, xe;
+DefClearLine(y, xs, xe, bce)
+int y, xs, xe, bce;
{
- LClearLine(flayer, y, xs, xe, (struct mline *)0);
+ LClearLine(flayer, y, xs, xe, bce, (struct mline *)0);
}
/*ARGSUSED*/
@@ -144,8 +154,9 @@ DefRestore()
LKeypadMode(flayer, 0);
LCursorkeysMode(flayer, 0);
LCursorVisibility(flayer, 0);
+ LMouseMode(flayer, 0);
LSetRendition(flayer, &mchar_null);
- LSetFlow(flayer, FLOW_NOW);
+ LSetFlow(flayer, nwin_default.flowflag & FLOW_NOW);
}
/*
@@ -186,7 +197,7 @@ char *uname, *utty, *term;
int fd, pid;
struct mode *Mode;
{
- struct user **u;
+ struct acluser **u;
struct baud_values *b;
if (!*(u = FindUserPtr(uname)) && UserAdd(uname, (char *)0, u))
@@ -198,6 +209,7 @@ struct mode *Mode;
#else
if (displays)
return 0;
+ bzero((char *)&TheDisplay, sizeof(TheDisplay));
display = &TheDisplay;
#endif
display->d_next = displays;
@@ -227,6 +239,7 @@ struct mode *Mode;
D_mapev.handler = disp_map_fn;
#endif
D_OldMode = *Mode;
+ D_status_obuffree = -1;
Resize_obuf(); /* Allocate memory for buffer */
D_obufmax = defobuflimit;
D_obuflenmax = D_obuflen - D_obufmax;
@@ -248,8 +261,8 @@ struct mode *Mode;
D_dospeed = (short)D_OldMode.m_ttyb.sg_ospeed;
# endif
#endif
-
debug1("New displays ospeed = %d\n", D_dospeed);
+
strncpy(D_usertty, utty, sizeof(D_usertty) - 1);
D_usertty[sizeof(D_usertty) - 1] = 0;
strncpy(D_termname, term, sizeof(D_termname) - 1);
@@ -275,6 +288,8 @@ FreeDisplay()
if (D_userfd >= 0)
{
Flush();
+ if (!display)
+ return;
SetTTY(D_userfd, &D_OldMode);
fcntl(D_userfd, F_SETFL, 0);
}
@@ -324,6 +339,8 @@ FreeDisplay()
{
if (p->w_pdisplay == display)
p->w_pdisplay = 0;
+ if (p->w_readev.condneg == &D_status || p->w_readev.condneg == &D_obuflenmax)
+ p->w_readev.condpos = p->w_readev.condneg = 0;
}
for (; cv; cv = cvp)
{
@@ -375,7 +392,7 @@ MakeDefaultCanvas()
return 0;
}
-void
+static void
FreeCanvas(cv)
struct canvas *cv;
{
@@ -645,27 +662,27 @@ int adapt;
ASSERT(display);
ASSERT(D_tcinited);
D_top = D_bot = -1;
- PutStr(D_TI);
- PutStr(D_IS);
+ AddCStr(D_TI);
+ AddCStr(D_IS);
/* Check for toggle */
if (D_IM && strcmp(D_IM, D_EI))
- PutStr(D_EI);
+ AddCStr(D_EI);
D_insert = 0;
#ifdef MAPKEYS
- PutStr(D_KS);
- PutStr(D_CCS);
+ AddCStr(D_KS);
+ AddCStr(D_CCS);
#else
/* Check for toggle */
if (D_KS && strcmp(D_KS, D_KE))
- PutStr(D_KE);
+ AddCStr(D_KE);
if (D_CCS && strcmp(D_CCS, D_CCE))
- PutStr(D_CCE);
+ AddCStr(D_CCE);
#endif
D_keypad = 0;
D_cursorkeys = 0;
- PutStr(D_ME);
- PutStr(D_EA);
- PutStr(D_CE0);
+ AddCStr(D_ME);
+ AddCStr(D_EA);
+ AddCStr(D_CE0);
D_rend = mchar_null;
D_atyp = 0;
if (adapt == 0)
@@ -673,7 +690,7 @@ int adapt;
ChangeScrollRegion(0, D_height - 1);
D_x = D_y = 0;
Flush();
- ClearDisplay();
+ ClearAll();
debug1("we %swant to adapt all our windows to the display\n",
(adapt) ? "" : "don't ");
/* In case the size was changed by a init sequence */
@@ -692,19 +709,23 @@ FinitTerm()
KeypadMode(0);
CursorkeysMode(0);
CursorVisibility(0);
+ MouseMode(0);
SetRendition(&mchar_null);
SetFlow(FLOW_NOW);
#ifdef MAPKEYS
- PutStr(D_KE);
- PutStr(D_CCE);
+ 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');
AddChar('\n');
- PutStr(D_TE);
+ AddCStr(D_TE);
}
Flush();
}
@@ -720,9 +741,9 @@ int c;
if (D_IC || D_CIC)
{
if (D_IC)
- PutStr(D_IC);
+ AddCStr(D_IC);
else
- CPutStr(D_CIC, 1);
+ AddCStr2(D_CIC, 1);
RAW_PUTCHAR(c);
return;
}
@@ -759,15 +780,25 @@ int c;
}
if (D_CLP || D_y != D_bot)
{
+ int y = D_y;
RAW_PUTCHAR(c);
+ if (D_AM && !D_CLP)
+ GotoPos(D_width - 1, y);
return;
}
+ debug("PUTCHARLP: lp_missing!\n");
D_lp_missing = 1;
D_rend.image = c;
D_lpchar = D_rend;
-#ifdef KANJI
- D_lp_mbcs = D_mbcs;
- D_mbcs = 0;
+#ifdef DW_CHARS
+ /* XXX -> PutChar ? */
+ if (D_mbcs)
+ {
+ D_lpchar.mbcs = c;
+ D_lpchar.image = D_mbcs;
+ D_mbcs = 0;
+ D_x--;
+ }
#endif
}
@@ -783,8 +814,31 @@ int c;
ASSERT(display);
#ifdef FONT
-# ifdef KANJI
- if (D_rend.font == KANJI)
+# ifdef UTF8
+ if (D_encoding == UTF8)
+ {
+ c = (c & 255) | (unsigned char)D_rend.font << 8;
+# ifdef DW_CHARS
+ if (D_mbcs)
+ {
+ c = D_mbcs;
+ if (D_x == D_width)
+ D_x += D_AM ? 1 : -1;
+ D_mbcs = 0;
+ }
+ else if (utf8_isdouble(c))
+ {
+ D_mbcs = c;
+ D_x++;
+ return;
+ }
+# endif
+ AddUtf8(c);
+ goto addedutf8;
+ }
+# endif
+# ifdef DW_CHARS
+ if (is_dw_font(D_rend.font))
{
int t = c;
if (D_mbcs == 0)
@@ -797,30 +851,14 @@ int c;
if (D_x == D_width - 1)
D_x += D_AM ? 1 : -1;
c = D_mbcs;
- c &= 0x7f;
- t &= 0x7f;
- if (D_kanji == EUC)
- {
- c |= 0x80;
- t |= 0x80;
- }
- else if (D_kanji == SJIS)
- {
- t += (c & 1) ? ((t <= 0x5f) ? 0x1f : 0x20) : 0x7e;
- c = (c - 0x21) / 2 + ((c < 0x5f) ? 0x81 : 0xc1);
- }
D_mbcs = t;
}
- else if (D_rend.font == KANA)
- {
- if (D_kanji == EUC)
- {
- AddChar(0x8e); /* SS2 */
- c |= 0x80;
- }
- else if (D_kanji == SJIS)
- c |= 0x80;
- }
+# 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])
@@ -831,6 +869,9 @@ int c;
AddChar(c);
#endif /* FONT */
+#ifdef UTF8
+addedutf8:
+#endif
if (++D_x >= D_width)
{
if (D_AM == 0)
@@ -842,7 +883,7 @@ int c;
D_y++;
}
}
-#ifdef KANJI
+#ifdef DW_CHARS
if (D_mbcs)
{
c = D_mbcs;
@@ -853,34 +894,34 @@ int c;
}
static int
-PutChar(c)
+DoAddChar(c)
int c;
{
- /* this PutChar for ESC-sequences only (AddChar is a macro) */
+ /* this is for ESC-sequences only (AddChar is a macro) */
AddChar(c);
return c;
}
void
-PutStr(s)
+AddCStr(s)
char *s;
{
- if (display && s)
+ if (display && s && *s)
{
ospeed = D_dospeed;
- tputs(s, 1, PutChar);
+ tputs(s, 1, DoAddChar);
}
}
void
-CPutStr(s, c)
+AddCStr2(s, c)
char *s;
int c;
{
- if (display && s)
+ if (display && s && *s)
{
ospeed = D_dospeed;
- tputs(tgoto(s, 0, c), 1, PutChar);
+ tputs(tgoto(s, 0, c), 1, DoAddChar);
}
}
@@ -895,9 +936,9 @@ int on;
{
D_insert = on;
if (on)
- PutStr(D_IM);
+ AddCStr(D_IM);
else
- PutStr(D_EI);
+ AddCStr(D_EI);
}
}
@@ -915,9 +956,9 @@ int on;
{
D_keypad = on;
if (on)
- PutStr(D_KS);
+ AddCStr(D_KS);
else
- PutStr(D_KE);
+ AddCStr(D_KE);
}
#endif
}
@@ -934,9 +975,9 @@ int on;
{
D_cursorkeys = on;
if (on)
- PutStr(D_CCS);
+ AddCStr(D_CCS);
else
- PutStr(D_CCE);
+ AddCStr(D_CCE);
}
#endif
}
@@ -949,9 +990,9 @@ int on;
{
D_revvid = on;
if (D_revvid)
- PutStr(D_CVR);
+ AddCStr(D_CVR);
else
- PutStr(D_CVN);
+ AddCStr(D_CVN);
}
}
@@ -962,18 +1003,34 @@ int v;
if (display && D_curvis != v)
{
if (D_curvis)
- PutStr(D_VE); /* do this always, just to be safe */
+ AddCStr(D_VE); /* do this always, just to be safe */
D_curvis = 0;
if (v == -1 && D_VI)
- PutStr(D_VI);
+ AddCStr(D_VI);
else if (v == 1 && D_VS)
- PutStr(D_VS);
+ AddCStr(D_VS);
else
return;
D_curvis = v;
}
}
+void
+MouseMode(mode)
+int mode;
+{
+ if (display && D_mouse != mode)
+ {
+ if (!D_CXT)
+ return;
+ if (D_mouse)
+ AddStr(D_mouse == 9 ? "\033[?9l" : "\033[?1000l");
+ if (mode)
+ AddStr(mode == 9 ? "\033[?9h" : "\033[?1000h");
+ D_mouse = mode;
+ }
+}
+
static int StrCost;
/* ARGSUSED */
@@ -1033,7 +1090,7 @@ int y, xs, xe, doit;
cvlnext = cv->c_lnext;
flayer->l_cvlist = cv;
cv->c_lnext = 0;
- Rewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 1);
+ LayRewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 1);
flayer->l_cvlist = cvlist;
cv->c_lnext = cvlnext;
flayer = oldflayer;
@@ -1047,10 +1104,14 @@ int y, xs, xe, 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);
- cost = Rewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 0);
+ cost = LayRewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 0);
flayer = oldflayer;
if (D_insert)
cost += D_EIcost + D_IMcost;
@@ -1098,13 +1159,20 @@ int x2, y2;
{
DoCM:
if (D_HO && !x2 && !y2)
- PutStr(D_HO);
+ AddCStr(D_HO);
else
- PutStr(tgoto(D_CM, x2, y2));
+ AddCStr(tgoto(D_CM, x2, y2));
D_x = x2;
D_y = y2;
return;
}
+
+ /* some scrollregion implementations don't allow movements
+ * away from the region. sigh.
+ */
+ if ((y1 > D_bot && y2 > y1) || (y1 < D_top && y2 < y1))
+ goto DoCM;
+
/* Calculate CMcost */
if (D_HO && !x2 && !y2)
s = D_HO;
@@ -1128,7 +1196,7 @@ int x2, y2;
costx = m;
xm = M_RI;
}
- /* Speedup: dx <= Rewrite() */
+ /* Speedup: dx <= LayRewrite() */
if (dx < costx && (m = CallRewrite(y1, x1, x2 - 1, 0)) < costx)
{
costx = m;
@@ -1151,7 +1219,7 @@ int x2, y2;
else
costx = 0;
}
- /* Speedup: Rewrite() >= x2 */
+ /* Speedup: LayRewrite() >= x2 */
if (x2 + D_CRcost < costx && (m = (x2 ? CallRewrite(y1, 0, x2 - 1, 0) : 0) + D_CRcost) < costx)
{
costx = m;
@@ -1201,20 +1269,20 @@ int x2, y2;
{
case M_LE:
while (dx++ < 0)
- PutStr(D_BC);
+ AddCStr(D_BC);
break;
case M_CLE:
- CPutStr(D_CLE, -dx);
+ AddCStr2(D_CLE, -dx);
break;
case M_RI:
while (dx-- > 0)
- PutStr(D_ND);
+ AddCStr(D_ND);
break;
case M_CRI:
- CPutStr(D_CRI, dx);
+ AddCStr2(D_CRI, dx);
break;
case M_CR:
- PutStr(D_CR);
+ AddCStr(D_CR);
D_x = 0;
x1 = 0;
/* FALLTHROUGH */
@@ -1230,18 +1298,18 @@ int x2, y2;
{
case M_UP:
while (dy++ < 0)
- PutStr(D_UP);
+ AddCStr(D_UP);
break;
case M_CUP:
- CPutStr(D_CUP, -dy);
+ AddCStr2(D_CUP, -dy);
break;
case M_DO:
s = (x2 == 0) ? D_NL : D_DO;
while (dy-- > 0)
- PutStr(s);
+ AddCStr(s);
break;
case M_CDO:
- CPutStr(D_CDO, dy);
+ AddCStr2(D_CDO, dy);
break;
default:
break;
@@ -1251,15 +1319,15 @@ int x2, y2;
}
void
-ClearDisplay()
+ClearAll()
{
ASSERT(display);
- Clear(0, 0, 0, D_width - 1, D_width - 1, D_height - 1, 0);
+ ClearArea(0, 0, 0, D_width - 1, D_width - 1, D_height - 1, 0, 0);
}
void
-Clear(x1, y1, xs, xe, x2, y2, uselayfn)
-int x1, y1, xs, xe, x2, y2, uselayfn;
+ClearArea(x1, y1, xs, xe, x2, y2, bce, uselayfn)
+int x1, y1, xs, xe, x2, y2, bce, uselayfn;
{
int y, xxe;
struct canvas *cv;
@@ -1267,20 +1335,29 @@ int x1, y1, xs, xe, x2, y2, uselayfn;
debug2("Clear %d,%d", x1, y1);
debug2(" %d-%d", xs, xe);
- debug3(" %d,%d uselayfn=%d\n", x2, y2, uselayfn);
+ debug2(" %d,%d", x2, y2);
+ debug2(" uselayfn=%d bce=%d\n", uselayfn, bce);
ASSERT(display);
if (x1 == D_width)
x1--;
if (x2 == D_width)
x2--;
+ if (xs == -1)
+ xs = x1;
+ if (xe == -1)
+ 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))
D_lp_missing = 0;
}
- if (x2 == D_width - 1 && (xs == 0 || y1 == y2) && xe == D_width - 1 && y2 == D_height - 1)
+ 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)
@@ -1288,7 +1365,7 @@ int x1, y1, xs, xe, x2, y2, uselayfn;
#endif
if (x1 == 0 && y1 == 0 && D_CL)
{
- PutStr(D_CL);
+ AddCStr(D_CL);
D_y = D_x = 0;
return;
}
@@ -1299,14 +1376,14 @@ int x1, y1, xs, xe, x2, y2, uselayfn;
if (D_CD && (y1 < y2 || !D_CE))
{
GotoPos(x1, y1);
- PutStr(D_CD);
+ AddCStr(D_CD);
return;
}
}
- if (x1 == 0 && xs == 0 && (xe == D_width - 1 || y1 == y2) && y1 == 0 && D_CCD)
+ if (x1 == 0 && xs == 0 && (xe == D_width - 1 || y1 == y2) && y1 == 0 && D_CCD && (!bce || D_BE))
{
GotoPos(x1, y1);
- PutStr(D_CCD);
+ AddCStr(D_CCD);
return;
}
xxe = xe;
@@ -1314,16 +1391,16 @@ int x1, y1, xs, xe, x2, y2, uselayfn;
{
if (y == y2)
xxe = x2;
- if (x1 == 0 && D_CB && (xxe != D_width - 1 || (D_x == xxe && D_y == y)))
+ if (x1 == 0 && D_CB && (xxe != D_width - 1 || (D_x == xxe && D_y == y)) && (!bce || D_BE))
{
GotoPos(xxe, y);
- PutStr(D_CB);
+ AddCStr(D_CB);
continue;
}
- if (xxe == D_width - 1 && D_CE)
+ if (xxe == D_width - 1 && D_CE && (!bce || D_BE))
{
GotoPos(x1, y);
- PutStr(D_CE);
+ AddCStr(D_CE);
continue;
}
if (uselayfn)
@@ -1350,14 +1427,14 @@ int x1, y1, xs, xe, x2, y2, uselayfn;
cvlnext = cv->c_lnext;
flayer->l_cvlist = cv;
cv->c_lnext = 0;
- ClearLine(y - vp->v_yoff, x1 - vp->v_xoff, xxe - vp->v_xoff);
+ LayClearLine(y - vp->v_yoff, x1 - vp->v_xoff, xxe - vp->v_xoff, bce);
flayer->l_cvlist = cvlist;
cv->c_lnext = cvlnext;
flayer = oldflayer;
continue;
}
}
- DisplayLine(&mline_null, &mline_blank, y, x1, xxe);
+ ClearLine((struct mline *)0, y, x1, xxe, bce);
}
}
@@ -1370,9 +1447,6 @@ void
Redisplay(cur_only)
int cur_only;
{
- register int i, stop;
- struct canvas *cv;
-
ASSERT(display);
/* XXX do em all? */
@@ -1381,30 +1455,20 @@ int cur_only;
KeypadMode(0);
CursorkeysMode(0);
CursorVisibility(0);
+ MouseMode(0);
SetRendition(&mchar_null);
SetFlow(FLOW_NOW);
- ClearDisplay();
- stop = D_height;
- i = 0;
+ ClearAll();
+#ifdef RXVT_OSC
+ RefreshXtermOSC();
+#endif
if (cur_only > 0 && D_fore)
- {
- i = stop = D_fore->w_y;
- stop++;
- }
+ RefreshArea(0, D_fore->w_y, D_width - 1, D_fore->w_y, 1);
else
- {
- debug("Signalling full refresh!\n");
- for (cv = D_cvlist; cv; cv = cv->c_next)
- {
- CV_CALL(cv, RedisplayLine(-1, -1, -1, 1));
- display = cv->c_display; /* just in case! */
- }
- }
- RefreshArea(0, i, D_width - 1, stop - 1, 1);
+ RefreshAll(1);
RefreshHStatus();
-
- CV_CALL(D_forecv, Restore();SetCursor());
+ CV_CALL(D_forecv, LayRestore();LaySetCursor());
}
void
@@ -1420,8 +1484,8 @@ int cur_only;
/* XXX: use oml! */
void
-ScrollH(y, xs, xe, n, oml)
-int y, xs, xe, n;
+ScrollH(y, xs, xe, n, bce, oml)
+int y, xs, xe, n, bce;
struct mline *oml;
{
int i;
@@ -1437,14 +1501,20 @@ 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)
+ n = xe - xs + 1;
if (D_CDC && !(n == 1 && D_DC))
- CPutStr(D_CDC, n);
+ AddCStr2(D_CDC, n);
else if (D_DC)
{
for (i = n; i--; )
- PutStr(D_DC);
+ AddCStr(D_DC);
}
else
{
@@ -1455,20 +1525,27 @@ struct mline *oml;
}
else
{
+ if (-n >= xe - xs + 1)
+ n = -(xe - xs + 1);
if (!D_insert)
{
if (D_CIC && !(n == -1 && D_IC))
- CPutStr(D_CIC, -n);
+ AddCStr2(D_CIC, -n);
else if (D_IC)
{
for (i = -n; i--; )
- PutStr(D_IC);
+ AddCStr(D_IC);
}
else if (D_IM)
{
InsertMode(1);
+ SetRendition(&mchar_null);
+#ifdef COLOR
+ SetBackColor(bce);
+#endif
for (i = -n; i--; )
INSERTCHAR(' ');
+ bce = 0; /* all done */
}
else
{
@@ -1479,10 +1556,22 @@ struct mline *oml;
}
else
{
+ SetRendition(&mchar_null);
+#ifdef COLOR
+ SetBackColor(bce);
+#endif
for (i = -n; i--; )
INSERTCHAR(' ');
+ bce = 0; /* all done */
}
}
+ if (bce && !D_BE)
+ {
+ if (n > 0)
+ ClearLine((struct mline *)0, y, xe - n + 1, xe, bce);
+ else
+ ClearLine((struct mline *)0, y, xs, xs - n - 1, bce);
+ }
if (D_lp_missing && y == D_bot)
{
if (n > 0)
@@ -1492,8 +1581,8 @@ struct mline *oml;
}
void
-ScrollV(xs, ys, xe, ye, n)
-int xs, ys, xe, ye, n;
+ScrollV(xs, ys, xe, ye, n, bce)
+int xs, ys, xe, ye, n, bce;
{
int i;
int up;
@@ -1506,7 +1595,7 @@ int xs, ys, xe, ye, n;
return;
if (n >= ye - ys + 1 || -n >= ye - ys + 1)
{
- Clear(xs, ys, xs, xe, xe, ye, 0);
+ ClearArea(xs, ys, xs, xe, xe, ye, bce, 0);
return;
}
if (xs > D_vpxmin || xe < D_vpxmax)
@@ -1557,28 +1646,35 @@ int xs, ys, xe, ye, n;
/* XXX
ChangeScrollRegion(oldtop, oldbot);
*/
+ if (bce && !D_BE)
+ ClearLine((struct mline *)0, ye, xs, xe, bce);
return;
}
}
}
- aldlfaster = (n > 1 && ys >= D_top && ye == D_bot && ((up && D_CDL) || (!up && D_CAL)));
-
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)));
+
if ((up || D_SR) && D_top == ys && D_bot == ye && !aldlfaster)
{
if (up)
{
GotoPos(0, ye);
- while (n-- > 0)
- PutStr(D_NL); /* was SF, I think NL is faster */
+ for(i = n; i-- > 0; )
+ AddCStr(D_NL); /* was SF, I think NL is faster */
}
else
{
GotoPos(0, ys);
- while (n-- > 0)
- PutStr(D_SR);
+ for(i = n; i-- > 0; )
+ AddCStr(D_SR);
}
}
else if (alok && dlok)
@@ -1587,19 +1683,19 @@ int xs, ys, xe, ye, n;
{
GotoPos(0, up ? ys : ye+1-n);
if (D_CDL && !(n == 1 && D_DL))
- CPutStr(D_CDL, n);
+ AddCStr2(D_CDL, n);
else
for(i = n; i--; )
- PutStr(D_DL);
+ AddCStr(D_DL);
}
if (!up || ye != D_bot)
{
GotoPos(0, up ? ye+1-n : ys);
if (D_CAL && !(n == 1 && D_AL))
- CPutStr(D_CAL, n);
+ AddCStr2(D_CAL, n);
else
for(i = n; i--; )
- PutStr(D_AL);
+ AddCStr(D_AL);
}
}
else
@@ -1607,6 +1703,13 @@ int xs, ys, xe, ye, n;
RefreshArea(xs, ys, xe, ye, 0);
return;
}
+ if (bce && !D_BE)
+ {
+ if (up)
+ ClearArea(xs, ye - n + 1, xs, xe, xe, ye, bce, 0);
+ else
+ ClearArea(xs, ys, xs, xe, xe, ys + n - 1, bce, 0);
+ }
if (D_lp_missing && missy != D_bot)
WriteLP(D_width - 1, missy);
/* XXX
@@ -1624,6 +1727,12 @@ 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)
{
@@ -1632,12 +1741,12 @@ register int new;
ospeed = D_dospeed;
tputs(tparm(D_SA, new & A_SO, new & A_US, new & A_RV, new & A_BL,
new & A_DI, new & A_BD, 0 , 0 ,
- 0), 1, PutChar);
+ 0), 1, DoAddChar);
D_rend.attr = new;
D_atyp = 0;
# ifdef COLOR
- if (D_CAF || D_CAB)
- D_rend.color = 0;
+ if (D_hascolor)
+ rend_setdefault(&D_rend);
# endif
return;
}
@@ -1646,16 +1755,26 @@ register int new;
if ((new & old) != old)
{
if ((typ & ATYP_U))
- PutStr(D_UE);
+ AddCStr(D_UE);
if ((typ & ATYP_S))
- PutStr(D_SE);
+ AddCStr(D_SE);
if ((typ & ATYP_M))
{
- PutStr(D_ME);
+ AddCStr(D_ME);
#ifdef COLOR
/* ansi attrib handling: \E[m resets color, too */
- if (D_CAF || D_CAB)
- D_rend.color = 0;
+ 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;
@@ -1669,7 +1788,7 @@ register int new;
old ^= j;
if (D_attrtab[i])
{
- PutStr(D_attrtab[i]);
+ AddCStr(D_attrtab[i]);
typ |= D_attrtyp[i];
}
}
@@ -1685,14 +1804,17 @@ int new;
if (!display || D_rend.font == new)
return;
D_rend.font = new;
-#ifdef KANJI
- if ((new == KANJI || new == KANA) && D_kanji)
- return; /* all done in RAW_PUTCHAR */
+#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])
{
- PutStr(D_xtable[(int)(unsigned char)new][256]);
+ AddCStr(D_xtable[(int)(unsigned char)new][256]);
return;
}
@@ -1700,54 +1822,188 @@ int new;
new = ASCII;
if (new == ASCII)
- PutStr(D_CE0);
-#ifdef KANJI
+ AddCStr(D_CE0);
+#ifdef DW_CHARS
else if (new < ' ')
{
AddStr("\033$");
+ if (new > 2)
+ AddChar('(');
AddChar(new + '@');
}
#endif
else
- CPutStr(D_CS0, new);
+ AddCStr2(D_CS0, new);
}
#endif
#ifdef COLOR
+
+int
+color256to16(jj)
+int jj;
+{
+ int min, max;
+ int r, g, b;
+
+ if (jj >= 232)
+ {
+ jj = (jj - 232) / 6;
+ jj = (jj & 1) << 3 | (jj & 2 ? 7 : 0);
+ }
+ else if (jj >= 16)
+ {
+ jj -= 16;
+ r = jj / 36;
+ g = (jj / 6) % 6;
+ b = jj % 6;
+ min = r < g ? (r < b ? r : b) : (g < b ? g : b);
+ max = r > g ? (r > b ? r : b) : (g > b ? g : b);
+ if (min == max)
+ jj = ((max + 1) & 2) << 2 | ((max + 1) & 4 ? 7 : 0);
+ else
+ jj = (b - min) / (max - min) << 2 | (g - min) / (max - min) << 1 | (r -
+min) / (max - min) | (max > 3 ? 8 : 0);
+ }
+ return jj;
+}
+
+#ifdef COLORS256
+int
+color256to88(jj)
+int jj;
+{
+ int r, g, b;
+
+ if (jj >= 232)
+ return (jj - 232) / 3 + 80;
+ if (jj >= 16)
+ {
+ jj -= 16;
+ r = jj / 36;
+ g = (jj / 6) % 6;
+ b = jj % 6;
+ return ((r + 1) / 2) * 16 + ((g + 1) / 2) * 4 + ((b + 1) / 2) + 16;
+ }
+ return jj;
+}
+#endif
+
void
-SetColor(new)
-int new;
+SetColor(f, b)
+int f, b;
{
- int of, ob, f, b;
+ int of, ob;
+ static unsigned char sftrans[8] = {0,4,2,6,1,5,3,7};
- if (!display || D_rend.color == new)
+ if (!display)
return;
- of = D_rend.color & 0xf;
- ob = (D_rend.color >> 4) & 0xf;
- f = new & 0xf;
- b = (new >> 4) & 0xf;
- if (!D_CAX && (D_CAF || D_CAB) && ((f == 0 && f != of) || (b == 0 && b != ob)))
- {
- int oattr;
+ of = rend_getfg(&D_rend);
+ ob = rend_getbg(&D_rend);
+
+ debug2("SetColor %d %d", coli2e(of), coli2e(ob));
+ debug2(" -> %d %d\n", coli2e(f), coli2e(b));
- oattr = D_rend.attr;
- AddStr("\033[m");
- D_rend.attr = 0;
- D_rend.color = 0;
+ if (!D_CAX && D_hascolor && ((f == 0 && f != of) || (b == 0 && b != ob)))
+ {
+ if (D_OP)
+ AddCStr(D_OP);
+ else
+ {
+ 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);
+ }
of = ob = 0;
- SetAttr(oattr);
}
- if (D_CAF || D_CAB)
+ 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)
{
- if (f != of)
- CPutStr(D_CAF, 9 - f);
- if (b != ob)
- CPutStr(D_CAB, 9 - b);
+ AddCStr2(D_CAF, f);
+ of = f;
+ }
+ if (b != ob && b > 15 && D_CCO != 256)
+ b = D_CCO == 88 && D_CAB ? color256to88(b) : color256to16(b);
+ if (b != ob && b > 15 && D_CAB)
+ {
+ AddCStr2(D_CAB, b);
+ ob = b;
}
- D_rend.color = new;
-}
#endif
+ if (f != of && f != (of | 8))
+ {
+ if (f == -1)
+ AddCStr("\033[39m"); /* works because AX is set */
+ else if (D_CAF)
+ AddCStr2(D_CAF, f & 7);
+ else if (D_CSF)
+ AddCStr2(D_CSF, sftrans[f & 7]);
+ }
+ if (b != ob && b != (ob | 8))
+ {
+ if (b == -1)
+ AddCStr("\033[49m"); /* works because AX is set */
+ else if (D_CAB)
+ AddCStr2(D_CAB, b & 7);
+ else if (D_CSB)
+ AddCStr2(D_CSB, sftrans[b & 7]);
+ }
+#ifdef COLORS16
+ if (f != of && D_CXT && (f & 8) != 0 && f != -1)
+ {
+# ifdef TERMINFO
+ AddCStr2("\033[9%p1%dm", f & 7);
+# else
+ AddCStr2("\033[9%dm", f & 7);
+# endif
+ }
+ if (b != ob && D_CXT && (b & 8) != 0 && b != -1)
+ {
+# ifdef TERMINFO
+ AddCStr2("\033[10%p1%dm", b & 7);
+# else
+ AddCStr2("\033[10%dm", b & 7);
+# endif
+ }
+#endif
+}
+
+static void
+SetBackColor(new)
+int new;
+{
+ if (!display)
+ return;
+ SetColor(rend_getfg(&D_rend), new);
+}
+#endif /* COLOR */
void
SetRendition(mc)
@@ -1755,11 +2011,39 @@ struct mchar *mc;
{
if (!display)
return;
- if (D_rend.attr != mc->attr)
+ if (nattr2color && D_hascolor && (mc->attr & nattr2color) != 0)
+ {
+ static struct mchar mmc;
+ int i;
+ mmc = *mc;
+ for (i = 0; i < 8; i++)
+ if (attr2color[i] && (mc->attr & (1 << i)) != 0)
+ ApplyAttrColor(attr2color[i], &mmc);
+ mc = &mmc;
+ debug2("SetRendition: mapped to %02x %02x\n", (unsigned char)mc->attr, 0x99 - (unsigned char)mc->color);
+ }
+ if (D_hascolor && D_CC8 && (mc->attr & (A_BFG|A_BBG)))
+ {
+ int a = mc->attr;
+ if ((mc->attr & A_BFG) && D_MD)
+ a |= A_BD;
+ if ((mc->attr & A_BBG) && D_MB)
+ a |= A_BL;
+ if (D_rend.attr != a)
+ SetAttr(a);
+ }
+ else if (D_rend.attr != mc->attr)
SetAttr(mc->attr);
#ifdef COLOR
- if (D_rend.color != mc->color)
- SetColor(mc->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)
@@ -1774,11 +2058,39 @@ int x;
{
if (!display)
return;
- if (D_rend.attr != ml->attr[x])
+ if (nattr2color && D_hascolor && (ml->attr[x] & nattr2color) != 0)
+ {
+ struct mchar mc;
+ copy_mline2mchar(&mc, ml, x);
+ SetRendition(&mc);
+ return;
+ }
+ if (D_hascolor && D_CC8 && (ml->attr[x] & (A_BFG|A_BBG)))
+ {
+ int a = ml->attr[x];
+ if ((ml->attr[x] & A_BFG) && D_MD)
+ a |= A_BD;
+ if ((ml->attr[x] & A_BBG) && D_MB)
+ a |= A_BL;
+ if (D_rend.attr != a)
+ SetAttr(a);
+ }
+ else if (D_rend.attr != ml->attr[x])
SetAttr(ml->attr[x]);
#ifdef COLOR
- if (D_rend.color != ml->color[x])
- SetColor(ml->color[x]);
+ 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])
@@ -1813,7 +2125,7 @@ char *msg;
max--;
}
else
- max = D_WS;
+ max = D_WS > 0 ? D_WS : (D_width - !D_CLP);
if (D_status)
{
/* same message? */
@@ -1827,13 +2139,13 @@ char *msg;
{
ti = time((time_t *)0) - D_status_time;
if (ti < MsgMinWait)
- sleep(MsgMinWait - ti);
+ DisplaySleep(MsgMinWait - ti, 0);
}
RemoveStatus();
}
for (s = t = msg; *s && t - msg < max; ++s)
if (*s == BELL)
- PutStr(D_BL);
+ AddCStr(D_BL);
else if ((unsigned char)*s >= ' ' && *s != 0177)
*t++ = *s;
*t = '\0';
@@ -1859,12 +2171,6 @@ char *msg;
D_status_lasty = D_y;
if (!use_hardstatus || D_has_hstatus == HSTATUS_IGNORE || D_has_hstatus == HSTATUS_MESSAGE)
{
- if (D_status_delayed != -1 && t - msg < D_status_buflen)
- {
- D_status_delayed = 1; /* not yet... */
- D_status = 0;
- return;
- }
D_status = STATUS_ON_WIN;
debug1("using STATLINE %d\n", STATLINE);
GotoPos(0, STATLINE);
@@ -1892,8 +2198,30 @@ char *msg;
D_status = STATUS_ON_HS;
ShowHStatus(msg);
}
- D_status_delayed = 0;
Flush();
+ if (!display)
+ return;
+ if (D_status == STATUS_ON_WIN)
+ {
+ struct display *olddisplay = display;
+ struct layer *oldflayer = flayer;
+
+ ASSERT(D_obuffree == D_obuflen);
+ /* this is copied over from RemoveStatus() */
+ D_status = 0;
+ GotoPos(0, STATLINE);
+ RefreshLine(STATLINE, 0, D_status_len - 1, 0);
+ GotoPos(D_status_lastx, D_status_lasty);
+ flayer = D_forecv ? D_forecv->c_layer : 0;
+ if (flayer)
+ LaySetCursor();
+ display = olddisplay;
+ flayer = oldflayer;
+ D_status_obuflen = D_obuflen;
+ D_status_obuffree = D_obuffree;
+ D_obuffree = D_obuflen = 0;
+ D_status = STATUS_ON_WIN;
+ }
(void) time(&D_status_time);
SetTimeout(&D_statusev, MsgWait * 1000);
evenq(&D_statusev);
@@ -1914,6 +2242,17 @@ RemoveStatus()
if (!(where = D_status))
return;
+ debug("RemoveStatus\n");
+ if (D_status_obuffree >= 0)
+ {
+ D_obuflen = D_status_obuflen;
+ D_obuffree = D_status_obuffree;
+ D_status_obuffree = -1;
+ D_status = 0;
+ D_status_bell = 0;
+ evdeq(&D_statusev);
+ return;
+ }
D_status = 0;
D_status_bell = 0;
evdeq(&D_statusev);
@@ -1927,9 +2266,9 @@ RemoveStatus()
}
else
RefreshHStatus();
- flayer = D_forecv->c_layer;
+ flayer = D_forecv ? D_forecv->c_layer : 0;
if (flayer)
- SetCursor();
+ LaySetCursor();
display = olddisplay;
flayer = oldflayer;
}
@@ -1939,7 +2278,7 @@ void
ShowHStatus(str)
char *str;
{
- int l, i, ox, oy;
+ int l, i, ox, oy, max;
if (D_status == STATUS_ON_WIN && D_has_hstatus == HSTATUS_LASTLINE && STATLINE == D_height-1)
return; /* sorry, in use */
@@ -1952,16 +2291,17 @@ char *str;
SetRendition(&mchar_null);
InsertMode(0);
if (D_hstatus)
- PutStr(D_DS);
+ AddCStr(D_DS);
D_hstatus = 0;
if (str == 0 || *str == 0)
return;
- CPutStr(D_TS, 0);
- if (strlen(str) > D_WS)
- AddStrn(str, D_WS);
+ AddCStr2(D_TS, 0);
+ max = D_WS > 0 ? D_WS : (D_width - !D_CLP);
+ if (strlen(str) > max)
+ AddStrn(str, max);
else
AddStr(str);
- PutStr(D_FS);
+ AddCStr(D_FS);
D_hstatus = 1;
}
else if (D_has_hstatus == HSTATUS_LASTLINE)
@@ -1975,13 +2315,14 @@ char *str;
l = D_width;
GotoPos(0, D_height - 1);
SetRendition(captionalways || D_cvlist == 0 || D_cvlist->c_next ? &mchar_null: &mchar_so);
- for (i = 0; i < l; i++)
- PUTCHARLP(str[i]);
+ if (!PutWinMsg(str, 0, l))
+ for (i = 0; i < l; i++)
+ PUTCHARLP(str[i]);
if (!captionalways && D_cvlist && !D_cvlist->c_next)
while (l++ < D_width)
PUTCHARLP(' ');
if (l < D_width)
- Clear(l, D_height - 1, l, D_width - 1, D_width - 1, D_height - 1, 0);
+ ClearArea(l, D_height - 1, l, D_width - 1, D_width - 1, D_height - 1, 0, 0);
if (ox != -1 && oy != -1)
GotoPos(ox, oy);
D_hstatus = *str ? 1 : 0;
@@ -2006,7 +2347,7 @@ RefreshHStatus()
evdeq(&D_hstatusev);
if (D_status == STATUS_ON_HS)
return;
- buf = MakeWinMsgEv(hstatusstring, D_fore, '%', &D_hstatusev);
+ buf = MakeWinMsgEv(hstatusstring, D_fore, '%', (D_HS && D_has_hstatus == HSTATUS_HS) ? D_WS : D_width - !D_CLP, &D_hstatusev);
if (buf && *buf)
{
ShowHStatus(buf);
@@ -2023,6 +2364,22 @@ RefreshHStatus()
*/
void
+RefreshAll(isblank)
+int isblank;
+{
+ struct canvas *cv;
+
+ ASSERT(display);
+ debug("Signalling full refresh!\n");
+ for (cv = D_cvlist; cv; cv = cv->c_next)
+ {
+ CV_CALL(cv, LayRedisplayLine(-1, -1, -1, isblank));
+ display = cv->c_display; /* just in case! */
+ }
+ RefreshArea(0, 0, D_width - 1, D_height - 1, isblank);
+}
+
+void
RefreshArea(xs, ys, xe, ye, isblank)
int xs, ys, xe, ye, isblank;
{
@@ -2032,7 +2389,7 @@ int xs, ys, xe, ye, isblank;
debug3(" - %d,%d (isblank=%d)\n", xe, ye, isblank);
if (!isblank && xs == 0 && xe == D_width - 1 && ye == D_height - 1 && (ys == 0 || D_CD))
{
- Clear(xs, ys, xs, xe, xe, ye, 0);
+ ClearArea(xs, ys, xs, xe, xe, ye, 0, 0);
isblank = 1;
}
for (y = ys; y <= ye; y++)
@@ -2061,9 +2418,9 @@ int y, from, to, isblank;
if (isblank == 0 && D_CE && to == D_width - 1 && from < to)
{
GotoPos(from, y);
- if (D_UT)
+ if (D_UT || D_BE)
SetRendition(&mchar_null);
- PutStr(D_CE);
+ AddCStr(D_CE);
isblank = 1;
}
while (from <= to)
@@ -2097,7 +2454,7 @@ int y, from, to, isblank;
from = lvp->v_xs;
}
- /* call RedisplayLine on canvas lcv viewport lvp */
+ /* call LayRedisplayLine on canvas lcv viewport lvp */
yy = y - lvp->v_yoff;
xx = to < lvp->v_xe ? to : lvp->v_xe;
@@ -2129,7 +2486,7 @@ int y, from, to, isblank;
cvlnext = lcv->c_lnext;
flayer->l_cvlist = lcv;
lcv->c_lnext = 0;
- RedisplayLine(yy, from - lvp->v_xoff, xx - lvp->v_xoff, isblank);
+ LayRedisplayLine(yy, from - lvp->v_xoff, xx - lvp->v_xoff, isblank);
flayer->l_cvlist = cvlist;
lcv->c_lnext = cvlnext;
flayer = oldflayer;
@@ -2156,16 +2513,21 @@ int y, from, to, isblank;
}
p = Layer2Window(cv->c_layer);
- buf = MakeWinMsgEv(captionstring, p, '%', &cv->c_captev);
+ buf = MakeWinMsgEv(captionstring, p, '%', D_width - !D_CLP, &cv->c_captev);
if (cv->c_captev.timeout.tv_sec)
evenq(&cv->c_captev);
xx = strlen(buf);
GotoPos(from, y);
SetRendition(&mchar_so);
- while (from <= to && from < xx)
+ if (PutWinMsg(buf, from, to + 1))
+ from = xx > to + 1 ? to + 1 : xx;
+ else
{
- PUTCHARLP(buf[from]);
- from++;
+ while (from <= to && from < xx)
+ {
+ PUTCHARLP(buf[from]);
+ from++;
+ }
}
while (from++ <= to)
PUTCHARLP(' ');
@@ -2185,18 +2547,76 @@ int x2, y2;
ASSERT(display);
ASSERT(D_lp_missing);
oldrend = D_rend;
-#ifdef KANJI
- if (D_lpchar.font == KANJI && (D_mbcs = D_lp_mbcs) != 0 && x2 > 0)
- x2--;
+ debug2("WriteLP(%d,%d)\n", x2, y2);
+#ifdef DW_CHARS
+ if (D_lpchar.mbcs)
+ {
+ if (x2 > 0)
+ x2--;
+ 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);
}
void
+ClearLine(oml, y, from, to, bce)
+struct mline *oml;
+int from, to, y, 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);
+ AddCStr(D_CB);
+ return;
+ }
+ if (to == D_width - 1 && D_CE && (!bce || D_BE))
+ {
+ GotoPos(from, y);
+ AddCStr(D_CE);
+ return;
+ }
+ if (oml == 0)
+ oml = &mline_null;
+#ifdef COLOR
+ if (!bce)
+ {
+ DisplayLine(oml, &mline_blank, y, from, to);
+ return;
+ }
+ bcechar = mchar_blank;
+ rend_setbg(&bcechar, 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
DisplayLine(oml, ml, y, from, to)
struct mline *oml, *ml;
int from, to, y;
@@ -2212,27 +2632,30 @@ int from, to, y;
{
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
{
- to -= 2;
last2flag = 1;
D_lp_missing = 0;
+ to--;
}
else
{
- to--;
- delete_lp = (D_CE || D_DC || D_CDC);
+ delete_lp = !cmp_mchar_mline(&mchar_blank, oml, to) && (D_CE || D_DC || D_CDC);
D_lp_missing = !cmp_mchar_mline(&mchar_blank, ml, to);
copy_mline2mchar(&D_lpchar, ml, to);
}
}
- else
- to--;
+ to--;
}
-#ifdef KANJI
+#ifdef DW_CHARS
if (D_mbcs)
{
- /* finish kanji (can happen after a wrap) */
+ /* finish dw-char (can happen after a wrap) */
+ debug("DisplayLine finishing kanji\n");
SetRenditionMline(ml, from);
PUTCHAR(ml->image[from]);
from++;
@@ -2249,21 +2672,21 @@ int from, to, y;
continue;
GotoPos(x, y);
}
-#ifdef KANJI
- if (badkanji(ml->font, x))
+#ifdef DW_CHARS
+ if (dw_right(ml, x, D_encoding))
{
x--;
- debug1("DisplayLine badkanji - x now %d\n", x);
+ debug1("DisplayLine on right side of dw char- x now %d\n", x);
GotoPos(x, y);
}
- if (ml->font[x] == KANJI && x == 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 KANJI
- if (ml->font[x] == KANJI)
- PUTCHAR(ml->image[++x]);
+#ifdef DW_CHARS
+ if (dw_left(ml, x, D_encoding))
+ PUTCHAR(ml->image[++x]);
#endif
}
#if 0 /* not needed any longer */
@@ -2285,12 +2708,32 @@ int from, to, y;
if (D_UT)
SetRendition(&mchar_null);
if (D_DC)
- PutStr(D_DC);
+ AddCStr(D_DC);
else if (D_CDC)
- CPutStr(D_CDC, 1);
+ AddCStr2(D_CDC, 1);
else if (D_CE)
- PutStr(D_CE);
+ AddCStr(D_CE);
+ }
+}
+
+void
+PutChar(c, x, y)
+struct mchar *c;
+int x, 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
@@ -2304,6 +2747,7 @@ struct mline *oml;
{
if (x == D_width - 1)
{
+ D_lp_missing = 1;
D_lpchar = *c;
return;
}
@@ -2312,10 +2756,8 @@ struct mline *oml;
}
if (x == xe)
{
- if (xe != D_width - 1)
- InsertMode(0);
SetRendition(c);
- RAW_PUTCHAR(c->image);
+ PUTCHARLP(c->image);
return;
}
if (!(D_IC || D_CIC || D_IM) || xe != D_width - 1)
@@ -2328,13 +2770,35 @@ struct mline *oml;
InsertMode(1);
if (!D_insert)
{
+#ifdef DW_CHARS
+ if (c->mbcs && D_IC)
+ AddCStr(D_IC);
if (D_IC)
- PutStr(D_IC);
+ AddCStr(D_IC);
else
- CPutStr(D_CIC, 1);
+ 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
@@ -2344,6 +2808,13 @@ int x, y;
int xs, ys, xe, 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);
@@ -2352,27 +2823,23 @@ int ins;
if (xs != 0 || x != D_width || !D_AM)
{
if (y == ye)
- ScrollV(xs, ys, xe, ye, 1);
+ ScrollV(xs, ys, xe, ye, 1, bce);
else if (y < D_height - 1)
y++;
- GotoPos(xs, y);
if (ins)
- {
- InsChar(c, xs, xe, y, 0);
- return;
- }
- SetRendition(c);
- RAW_PUTCHAR(c->image);
+ InsChar(c, xs, xe, y, 0);
+ else
+ PutChar(c, xs, y);
return;
}
if (y == ye) /* we have to scroll */
{
debug("- scrolling\n");
ChangeScrollRegion(ys, ye);
- if (D_bot != y)
+ if (D_bot != y || D_x != D_width || (!bce && !D_BE))
{
debug("- have to call ScrollV\n");
- ScrollV(xs, ys, xe, ye, 1);
+ ScrollV(xs, ys, xe, ye, 1, bce);
y--;
}
}
@@ -2380,13 +2847,13 @@ int ins;
ChangeScrollRegion(ys, ye); /* remove unusable region */
if (D_x != D_width || D_y != y)
{
- if (D_CLP && y >= 0) /* don't even try if !LP */
+ if (D_CLP) /* don't even try if !LP */
RefreshLine(y, D_width - 1, D_width - 1, 0);
debug2("- refresh last char -> x,y now %d,%d\n", D_x, D_y);
if (D_x != D_width || D_y != y) /* sorry, no bonus */
{
if (y == ye)
- ScrollV(xs, ys, xe, ye, 1);
+ ScrollV(xs, ys, xe, ye, 1, bce);
GotoPos(xs, y == ye || y == D_height - 1 ? y : y + 1);
}
}
@@ -2401,10 +2868,20 @@ int ins;
debug2(" -> done with insert (%d,%d)\n", D_x, D_y);
return;
}
- SetRendition(c);
D_y = y;
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);
}
@@ -2422,14 +2899,14 @@ int wi, he;
if (D_width != wi && (D_height == he || !D_CWS) && D_CZ0 && (wi == Z0width || wi == Z1width))
{
debug("ResizeDisplay: using Z0/Z1\n");
- PutStr(wi == Z0width ? D_CZ0 : D_CZ1);
+ AddCStr(wi == Z0width ? D_CZ0 : D_CZ1);
ChangeScreenSize(wi, D_height, 0);
return (he == D_height) ? 0 : -1;
}
if (D_CWS)
{
debug("ResizeDisplay: using WS\n");
- PutStr(tgoto(D_CWS, wi, he));
+ AddCStr(tgoto(D_CWS, wi, he));
ChangeScreenSize(wi, he, 0);
return 0;
}
@@ -2455,12 +2932,50 @@ int newtop, newbot;
if (D_top == newtop && D_bot == newbot)
return;
debug2("ChangeScrollRegion: (%d - %d)\n", newtop, newbot);
- PutStr(tgoto(D_CS, newbot, newtop));
+ AddCStr(tgoto(D_CS, newbot, newtop));
D_top = newtop;
D_bot = newbot;
D_y = D_x = -1; /* Just in case... */
}
+#ifdef RXVT_OSC
+void
+SetXtermOSC(i, s)
+int i;
+char *s;
+{
+ static char oscs[] = "1;\000\00020;\00039;\00049;\000";
+
+ ASSERT(display);
+ if (!D_CXT)
+ return;
+ if (!s)
+ s = "";
+ if (!D_xtermosc[i] && !*s)
+ return;
+ if (i == 0 && !*s)
+ s = "screen"; /* always set icon name */
+ if (i == 1 && !*s)
+ s = ""; /* no background */
+ if (i == 2 && !*s)
+ s = "black"; /* black text */
+ if (i == 3 && !*s)
+ s = "white"; /* on white background */
+ D_xtermosc[i] = 1;
+ AddStr("\033]");
+ AddStr(oscs + i * 4);
+ AddStr(s);
+ AddChar(7);
+}
+
+void
+ClearAllXtermOSC()
+{
+ int i;
+ for (i = 3; i >= 0; i--)
+ SetXtermOSC(i, 0);
+}
+#endif
/*
* Output buffering routines
@@ -2474,6 +2989,14 @@ char *str;
ASSERT(display);
+#ifdef UTF8
+ if (D_encoding == UTF8)
+ {
+ while ((c = *str++))
+ AddUtf8((unsigned char)c);
+ return;
+ }
+#endif
while ((c = *str++))
AddChar(c);
}
@@ -2486,6 +3009,14 @@ 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)
@@ -2501,9 +3032,9 @@ Flush()
ASSERT(display);
l = D_obufp - D_obuf;
debug1("Flush(): %d\n", l);
- ASSERT(l + D_obuffree == D_obuflen);
if (l == 0)
return;
+ ASSERT(l + D_obuffree == D_obuflen);
if (D_userfd < 0)
{
D_obuffree += l;
@@ -2524,6 +3055,8 @@ Flush()
debug1("Writing to display: %d\n", errno);
wr = l;
}
+ if (!display)
+ return;
D_obuffree += wr;
p += wr;
l -= wr;
@@ -2563,6 +3096,19 @@ Resize_obuf()
register int ind;
ASSERT(display);
+ if (D_status_obuffree >= 0)
+ {
+ ASSERT(D_obuffree == -1);
+ if (!D_status_bell)
+ {
+ int ti = time((time_t *)0) - D_status_time;
+ if (ti < MsgMinWait)
+ DisplaySleep(MsgMinWait - ti, 0);
+ }
+ RemoveStatus();
+ if (--D_obuffree > 0) /* redo AddChar decrement */
+ return;
+ }
if (D_obuflen && D_obuf)
{
ind = D_obufp - D_obuf;
@@ -2593,6 +3139,7 @@ NukePending()
struct mchar oldrend;
int oldkeypad = D_keypad, oldcursorkeys = D_cursorkeys;
int oldcurvis = D_curvis;
+ int oldmouse = D_mouse;
oldrend = D_rend;
len = D_obufp - D_obuf;
@@ -2610,81 +3157,64 @@ NukePending()
D_obufp = D_obuf;
D_obuffree += len;
D_top = D_bot = -1;
- PutStr(D_TI);
- PutStr(D_IS);
+ AddCStr(D_TI);
+ AddCStr(D_IS);
/* Turn off all attributes. (Tim MacKenzie) */
if (D_ME)
- PutStr(D_ME);
+ AddCStr(D_ME);
else
{
#ifdef COLOR
- if (D_CAF)
+ if (D_hascolor)
AddStr("\033[m"); /* why is D_ME not set? */
#endif
- PutStr(D_SE);
- PutStr(D_UE);
+ AddCStr(D_SE);
+ AddCStr(D_UE);
}
/* Check for toggle */
if (D_IM && strcmp(D_IM, D_EI))
- PutStr(D_EI);
+ AddCStr(D_EI);
D_insert = 0;
/* Check for toggle */
#ifdef MAPKEYS
if (D_KS && strcmp(D_KS, D_KE))
- PutStr(D_KS);
+ AddCStr(D_KS);
if (D_CCS && strcmp(D_CCS, D_CCE))
- PutStr(D_CCS);
+ AddCStr(D_CCS);
#else
if (D_KS && strcmp(D_KS, D_KE))
- PutStr(D_KE);
+ AddCStr(D_KE);
D_keypad = 0;
if (D_CCS && strcmp(D_CCS, D_CCE))
- PutStr(D_CCE);
+ AddCStr(D_CCE);
D_cursorkeys = 0;
#endif
- PutStr(D_CE0);
+ AddCStr(D_CE0);
D_rend = mchar_null;
D_atyp = 0;
- PutStr(D_DS);
+ AddCStr(D_DS);
D_hstatus = 0;
- PutStr(D_VE);
+ AddCStr(D_VE);
D_curvis = 0;
ChangeScrollRegion(oldtop, oldbot);
SetRendition(&oldrend);
KeypadMode(oldkeypad);
CursorkeysMode(oldcursorkeys);
CursorVisibility(oldcurvis);
+ MouseMode(oldmouse);
if (D_CWS)
{
debug("ResizeDisplay: using WS\n");
- PutStr(tgoto(D_CWS, D_width, D_height));
+ AddCStr(tgoto(D_CWS, D_width, D_height));
}
else if (D_CZ0 && (D_width == Z0width || D_width == Z1width))
{
debug("ResizeDisplay: using Z0/Z1\n");
- PutStr(D_width == Z0width ? D_CZ0 : D_CZ1);
+ AddCStr(D_width == Z0width ? D_CZ0 : D_CZ1);
}
}
#endif /* AUTO_NUKE */
-#ifdef KANJI
-int
-badkanji(f, x)
-char *f;
-int x;
-{
- int i, j;
-
- f += x;
- if (*f-- != KANJI)
- return 0;
- for (j = 0, i = x - 1; i >= 0; i--, j ^= 1)
- if (*f-- != KANJI)
- break;
- return j;
-}
-#endif
-
static void
disp_writeev_fn(ev, data)
struct event *ev;
@@ -2714,8 +3244,8 @@ char *data;
}
else
{
- if (errno != EINTR)
-# ifdef EWOULDBLOCK
+ if (errno != EINTR && errno != EAGAIN)
+# if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
if (errno != EWOULDBLOCK)
# endif
Msg(errno, "Error writing output to display");
@@ -2763,20 +3293,96 @@ char *data;
size = read(D_userfd, buf, size);
if (size < 0)
{
- if (errno == EINTR)
+ if (errno == EINTR || errno == EAGAIN)
+ return;
+#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
+ if (errno == EWOULDBLOCK)
return;
- debug1("Read error: %d - SigHup()ing!\n", errno);
- SigHup(SIGARG);
+#endif
+ debug1("Read error: %d - hangup!\n", errno);
+ Hangup();
sleep(1);
return;
}
else if (size == 0)
{
- debug("Found EOF - SigHup()ing!\n");
- SigHup(SIGARG);
+ debug("Found EOF - hangup!\n");
+ Hangup();
sleep(1);
return;
}
+ if (D_mouse && D_forecv)
+ {
+ unsigned char *bp = (unsigned char *)buf;
+ int x, y, i = size;
+
+ /* XXX this assumes that the string is read in as a whole... */
+ for (i = size; i > 0; i--, bp++)
+ {
+ if (i > 5 && bp[0] == 033 && bp[1] == '[' && bp[2] == 'M')
+ {
+ bp++;
+ i--;
+ }
+ else if (i < 5 || bp[0] != 0233 || bp[1] != 'M')
+ continue;
+ x = bp[3] - 33;
+ y = bp[4] - 33;
+ if (x >= D_forecv->c_xs && x <= D_forecv->c_xe && y >= D_forecv->c_ys && y <= D_forecv->c_ye)
+ {
+ x -= D_forecv->c_xoff;
+ y -= D_forecv->c_yoff;
+ if (x >= 0 && x < D_forecv->c_layer->l_width && y >= 0 && y < D_forecv->c_layer->l_height)
+ {
+ bp[3] = x + 33;
+ bp[4] = y + 33;
+ i -= 4;
+ bp += 4;
+ continue;
+ }
+ }
+ if (bp[0] == '[')
+ {
+ bcopy((char *)bp + 1, (char *)bp, i);
+ bp--;
+ size--;
+ }
+ if (i > 5)
+ bcopy((char *)bp + 5, (char *)bp, i - 5);
+ bp--;
+ i -= 4;
+ size -= 5;
+ }
+ }
+#ifdef ENCODINGS
+ if (D_encoding != (D_forecv ? D_forecv->c_layer->l_encoding : 0))
+ {
+ int i, j, c, enc;
+ char buf2[IOSIZE * 2 + 10];
+ enc = D_forecv ? D_forecv->c_layer->l_encoding : 0;
+ for (i = j = 0; i < size; i++)
+ {
+ c = ((unsigned char *)buf)[i];
+ c = DecodeChar(c, D_encoding, &D_decodestate);
+ if (c == -2)
+ i--; /* try char again */
+ if (c < 0)
+ continue;
+ if (pastefont)
+ {
+ int font = 0;
+ j += EncodeChar(buf2 + j, c, enc, &font);
+ j += EncodeChar(buf2 + j, -1, enc, &font);
+ }
+ else
+ j += EncodeChar(buf2 + j, c, enc, 0);
+ if (j > sizeof(buf2) - 10) /* just in case... */
+ break;
+ }
+ (*D_processinput)(buf2, j);
+ return;
+ }
+#endif
(*D_processinput)(buf, size);
}
@@ -2786,6 +3392,7 @@ struct event *ev;
char *data;
{
display = (struct display *)data;
+ debug1("disp_status_fn for display %x\n", (int)display);
if (D_status)
RemoveStatus();
}
@@ -2796,6 +3403,12 @@ struct event *ev;
char *data;
{
display = (struct display *)data;
+ if (D_status == STATUS_ON_HS)
+ {
+ SetTimeout(ev, 1);
+ evenq(ev);
+ return;
+ }
RefreshHStatus();
}
@@ -2808,6 +3421,12 @@ char *data;
struct canvas *cv = (struct canvas *)data;
display = cv->c_display;
+ if (D_status == STATUS_ON_WIN)
+ {
+ SetTimeout(ev, 1);
+ evenq(ev);
+ return;
+ }
ox = D_x;
oy = D_y;
if (cv->c_ye + 1 < D_height)
diff --git a/display.h b/display.h
index eef58b4..d1b7fb4 100644
--- a/display.h
+++ b/display.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -75,7 +75,7 @@ struct viewport
struct display
{
struct display *d_next; /* linked list */
- struct user *d_user; /* user who owns that display */
+ struct acluser *d_user; /* user who owns that display */
struct canvas *d_cvlist; /* the canvases of this display */
struct canvas *d_forecv; /* current input focus */
void (*d_processinput) __P((char *, int));
@@ -93,11 +93,15 @@ struct display
int d_top, d_bot; /* scrollregion start/end */
int d_x, d_y; /* cursor position */
struct mchar d_rend; /* current rendition */
+ int d_col16change; /* the 16col bits changed in attr */
char d_atyp; /* current attribute types */
-#ifdef KANJI
+#ifdef DW_CHARS
int d_mbcs; /* saved char for multibytes charset */
- int d_kanji; /* what kanji type the display is */
- int d_lp_mbcs; /* mbcs part of lp_missing */
+#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 */
@@ -107,6 +111,10 @@ struct display
int d_has_hstatus; /* display has hardstatus line */
int d_hstatus; /* hardstatus used */
int d_lp_missing; /* last character on bot line missing */
+ int d_mouse; /* mouse mode */
+#ifdef RXVT_OSC
+ int d_xtermosc[4]; /* osc used */
+#endif
struct mchar d_lpchar; /* missing char */
time_t d_status_time; /* time of status display */
int d_status; /* is status displayed? */
@@ -116,10 +124,12 @@ struct display
int d_status_buflen; /* last message buffer len */
int d_status_lastx; /* position of the cursor */
int d_status_lasty; /* before status was displayed */
- int d_status_delayed; /* status not displayed yet */
+ int d_status_obuflen; /* saved obuflen */
+ int d_status_obuffree; /* saved obuffree */
struct event d_statusev; /* timeout event */
struct event d_hstatusev; /* hstatus changed event */
- int d_ESCseen; /* Was the last char an ESC (^a) */
+ int d_kaablamm; /* display kaablamm msg */
+ struct action *d_ESCseen; /* Was the last char an ESC (^a) */
int d_userpid; /* pid of attacher */
char d_usertty[MAXPATHLEN]; /* tty we are attached to */
int d_userfd; /* fd of the tty */
@@ -128,6 +138,7 @@ struct display
struct mode d_OldMode; /* tty mode when screen was started */
struct mode d_NewMode; /* New tty mode */
int d_flow; /* tty's flow control on/off flag*/
+ int d_intrc; /* current intr when flow is on */
char *d_obuf; /* output buffer */
int d_obuflen; /* len of buffer */
int d_obufmax; /* len where we are blocking the pty */
@@ -149,6 +160,7 @@ struct display
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 */
@@ -197,10 +209,12 @@ extern struct display TheDisplay;
#define D_x DISPLAY(d_x)
#define D_y DISPLAY(d_y)
#define D_rend DISPLAY(d_rend)
+#define D_col16change DISPLAY(d_col16change)
#define D_atyp DISPLAY(d_atyp)
#define D_mbcs DISPLAY(d_mbcs)
-#define D_kanji DISPLAY(d_kanji)
-#define D_lp_mbcs DISPLAY(d_lp_mbcs)
+#define D_encoding DISPLAY(d_encoding)
+#define D_decodestate DISPLAY(d_decodestate)
+#define D_realfont DISPLAY(d_realfont)
#define D_insert DISPLAY(d_insert)
#define D_keypad DISPLAY(d_keypad)
#define D_cursorkeys DISPLAY(d_cursorkeys)
@@ -209,6 +223,8 @@ extern struct display TheDisplay;
#define D_has_hstatus DISPLAY(d_has_hstatus)
#define D_hstatus DISPLAY(d_hstatus)
#define D_lp_missing DISPLAY(d_lp_missing)
+#define D_mouse DISPLAY(d_mouse)
+#define D_xtermosc DISPLAY(d_xtermosc)
#define D_lpchar DISPLAY(d_lpchar)
#define D_status DISPLAY(d_status)
#define D_status_time DISPLAY(d_status_time)
@@ -218,9 +234,11 @@ extern struct display TheDisplay;
#define D_status_buflen DISPLAY(d_status_buflen)
#define D_status_lastx DISPLAY(d_status_lastx)
#define D_status_lasty DISPLAY(d_status_lasty)
-#define D_status_delayed DISPLAY(d_status_delayed)
+#define D_status_obuflen DISPLAY(d_status_obuflen)
+#define D_status_obuffree DISPLAY(d_status_obuffree)
#define D_statusev DISPLAY(d_statusev)
#define D_hstatusev DISPLAY(d_hstatusev)
+#define D_kaablamm DISPLAY(d_kaablamm)
#define D_ESCseen DISPLAY(d_ESCseen)
#define D_userpid DISPLAY(d_userpid)
#define D_usertty DISPLAY(d_usertty)
@@ -228,6 +246,7 @@ extern struct display TheDisplay;
#define D_OldMode DISPLAY(d_OldMode)
#define D_NewMode DISPLAY(d_NewMode)
#define D_flow DISPLAY(d_flow)
+#define D_intr DISPLAY(d_intr)
#define D_obuf DISPLAY(d_obuf)
#define D_obuflen DISPLAY(d_obuflen)
#define D_obufmax DISPLAY(d_obufmax)
@@ -244,6 +263,7 @@ extern struct display TheDisplay;
#define D_tcs DISPLAY(d_tcs)
#define D_attrtab DISPLAY(d_attrtab)
#define D_attrtyp DISPLAY(d_attrtyp)
+#define D_hascolor DISPLAY(d_hascolor)
#define D_dospeed DISPLAY(d_dospeed)
#define D_c0_tab DISPLAY(d_c0_tab)
#define D_xtable DISPLAY(d_xtable)
@@ -273,7 +293,7 @@ extern struct display TheDisplay;
#define AddChar(c) \
do \
{ \
- if (--D_obuffree == 0) \
+ if (--D_obuffree <= 0) \
Resize_obuf(); \
*D_obufp++ = (c); \
} \
diff --git a/doc/Makefile.in b/doc/Makefile.in
index f42a3ca..d3c42fe 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -3,6 +3,8 @@
srcdir = @srcdir@
VPATH = @srcdir@
+DESTDIR =
+
prefix = @prefix@
mandir = @mandir@
infodir = @infodir@
@@ -11,6 +13,7 @@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
+TEXI2PDF = texi2pdf
SHELL = /bin/sh
@@ -19,26 +22,30 @@ all: screen.info
dvi screen.dvi: screen.texinfo mostlyclean
$(TEXI2DVI) $(srcdir)/screen.texinfo
+pdf screen.pdf: screen.texinfo mostlyclean
+ $(TEXI2PDF) $(srcdir)/screen.texinfo
+
info screen.info: screen.texinfo
+ @rm -f screen.info*
$(MAKEINFO) $(srcdir)/screen.texinfo -o screen.info
install: installdirs
- $(INSTALL_DATA) $(srcdir)/screen.1 $(mandir)/man1/screen.1
+ $(INSTALL_DATA) $(srcdir)/screen.1 $(DESTDIR)$(mandir)/man1/screen.1
-$(MAKE) screen.info
-if test -f screen.info; then d=.; else d=$(srcdir); fi; \
if test -f $$d/screen.info; then \
- for f in $$d/screen.info*; do $(INSTALL_DATA) $$f $(infodir);done; \
+ for f in $$d/screen.info*; do $(INSTALL_DATA) $$f $(DESTDIR)$(infodir);done; \
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
- install-info --info-dir=$(infodir) $$d/screen.info; \
+ install-info --info-dir=$(DESTDIR)$(infodir) $$d/screen.info; \
else true; fi; \
fi
uninstall:
- rm -f $(mandir)/man1/screen.1
- rm -f $(infodir)/screen.info*
+ rm -f $(DESTDIR)$(mandir)/man1/screen.1
+ rm -f $(DESTDIR)$(infodir)/screen.info*
installdirs:
- $(srcdir)/../etc/mkinstalldirs $(mandir)/man1 $(infodir)
+ $(srcdir)/../etc/mkinstalldirs $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(infodir)
mostlyclean:
-rm -f *.cp *.cps *.fn *.fns *.ky *.kys *.pg *.tp *.vr
diff --git a/doc/screen.1 b/doc/screen.1
index 679c60f..03bd3c8 100644
--- a/doc/screen.1
+++ b/doc/screen.1
@@ -1,5 +1,5 @@
.\" vi:set wm=5
-.TH SCREEN 1 "10 Jun 1999"
+.TH SCREEN 1 "Jan 2002"
.if n .ds Q \&"
.if n .ds U \&"
.if t .ds Q ``
@@ -34,7 +34,7 @@ multiplexes a physical terminal between several processes (typically
interactive shells).
Each virtual terminal provides the functions
of a DEC VT100 terminal and, in addition, several control functions
-from the ISO 6492 (ECMA 48, ANSI X3.64) and ISO 2022 standards
+from the ISO 6429 (ECMA 48, ANSI X3.64) and ISO 2022 standards
(e.\|g. insert/delete line and support for multiple character sets).
There is a scrollback history buffer for each virtual terminal and a
copy-and-paste mechanism that allows moving text regions between
@@ -74,9 +74,7 @@ does not understand the prefix \*QC-\*U to mean control.
Please use the caret notation (\*Q^A\*U instead of \*QC-a\*U) as arguments
to e.g. the
.I escape
-command or the
-.I -e
-option.
+command or the \fI-e\fP option.
.I Screen
will also print out control characters in caret notation.
.PP
@@ -270,13 +268,13 @@ is called from within another
session or not. This flag has a special meaning in connection
with the `-d' option:
.TP 8
-.B \-m \-d
+.B \-d \-m
Start
.I screen
in \*Qdetached\*U mode. This creates a new session but doesn't
attach to it. This is useful for system startup scripts.
.TP 8
-.B \-m \-D
+.B \-D \-m
This also starts screen in \*Qdetached\*U mode, but doesn't fork
a new process. The command exits if the session terminates.
.TP 5
@@ -320,7 +318,7 @@ options, just as if
.B \-R
had not been specified. The option is set by default if
.I screen
-is run as a login-shell.
+is run as a login-shell (actually screen uses \*Q-xRR\*U in that case).
For combinations with the \fB\-d\fP/\fB\-D\fP option see there.
.TP 5
.B \-s
@@ -338,6 +336,11 @@ default [\fItty.host\fP] suffix.
sets the title (a.\|k.\|a.) for the default shell or specified program.
See also the \*Qshelltitle\*U .screenrc command.
.TP 5
+.B \-U
+Run screen in UTF-8 mode. This option tells screen that your terminal
+sends and understands UTF-8 encoded characters. It also sets the default
+encoding for new windows to `utf8'.
+.TP 5
.B \-v
Print version number.
.TP 5
@@ -352,6 +355,12 @@ See the \fB-r\fP flag for a description how to construct matches.
Attach to a not detached
.I screen
session. (Multi display mode).
+.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.
.SH "DEFAULT KEY BINDINGS"
@@ -368,11 +377,10 @@ of the command.
.PP
.TP 26n
The following table shows the default key bindings:
-.IP "\fBC-a '\fP"
-.PD 0
-.IP "\fBC-a ""\fP (select)"
-.PD
+.IP "\fBC-a '\fP (select)"
Prompt for a window name or number to switch to.
+.IP "\fBC-a ""\fP (windowlist -b)"
+Present a list of all windows for selection.
.IP "\fBC-a 0\fP (select 0)"
.PD 0
.IP "\fB ... \fP ..."
@@ -568,9 +576,7 @@ Show a listing of all currently attached displays.
.SH CUSTOMIZATION
The \*Qsocket directory\*U defaults either to $HOME/.screen or simply to
-/tmp/screens or preferably to /usr/local/screens chosen at
-compile-time. (/var/run/screen in Debian GNU/Linux)
-If
+/tmp/screens or preferably to /var/run/screen chosen at compile-time. If
.I screen
is installed setuid-root, then the administrator
should compile
@@ -691,6 +697,7 @@ If the second parameter is omitted all groups the user is in are listed.
.B aclumask
.RI [[ users ] +bits
.RI |[ users ] -bits " .... ]"
+.br
.B umask
.RI [[ users ] +bits
.RI |[ users ] -bits " .... ]"
@@ -775,6 +782,38 @@ a display is associated with the target windows. These commands may not work
correctly under \*Qat\*U looping over windows.
.sp
.ne 3
+.BI "attrcolor " attrib
+.RI [ "attribute/color-modifier" ]
+.PP
+This command can be used to highlight attributes by changing the color of
+the text. If the attribute
+.I attrib
+is in use, the specified attribute/color modifier is also applied. If no
+modifier is given, the current one is deleted. See the \*QSTRING ESCAPES\*U
+chapter for the syntax of the modifier. Screen understands two
+pseudo-attributes, \*Qi\*U stands for high-intensity foreground
+color and \*QI\*U for high-intensity background color.
+.sp
+Examples:
+.IP
+attrcolor b "R"
+.PP
+Change the color to bright red if bold text is to be printed.
+.IP
+attrcolor u "-u b"
+.PP
+Use blue text instead of underline.
+.IP
+attrcolor b "I"
+.PP
+Use bright colors for bold text. Most terminal emulators do this
+already.
+.IP
+attrcolor i "+b"
+.PP
+Make bright colored text also bold.
+.sp
+.ne 3
.BR "autodetach on" | off
.PP
Sets whether
@@ -788,14 +827,6 @@ When turned off, a hangup signal will terminate
and all the processes it contains. Autodetach is on by default.
.sp
.ne 3
-.BR "autofixterm on" | off
-.PP
-Sets whether
-.I screen
-will add missing capabilities to the termcap/info entry. It is on
-by default.
-.sp
-.ne 3
.BR "autonuke on" | off
.PP
Sets whether a clear screen sequence should nuke all the output
@@ -803,6 +834,14 @@ that has not been written to the terminal. See also
\*Qobuflimit\*U.
.sp
.ne 3
+.BR "bce " [ on | off ]
+.PP
+Change background-color-erase setting. If \*Qbce\*U is set to on, all
+characters cleared by an erase/insert/scroll/clear operation
+will be displayed in the current background color. Otherwise
+the default background color is used.
+.sp
+.ne 3
.B bell_msg
.RI [ message ]
.PP
@@ -823,7 +862,10 @@ output of a message line (bell_msg "").
Without parameter, the current message is shown.
.sp
.ne 3
-.BI "bind " key
+.BI "bind "
+.RB [ -c
+.IR class ]
+.I key
.RI [ command " [" args ]]
.PP
Bind a command to a key.
@@ -842,6 +884,11 @@ The argument can also be quoted, if you like.
If no further argument is given, any previously established binding
for this key is removed.
The \fIcommand\fP argument can be any command listed in this section.
+
+If a command class is specified via the \*Q-c\*U option, the key
+is bound for the specified class. Use the \*Qcommand\*U command
+to activate a class. Command classes can be used to create multiple
+command keys or multi-character bindings.
.PP
Some examples:
.PP
@@ -863,6 +910,24 @@ binds \*QC-f\*U to the command \*Qcreate a window with a TELNET
connection to foobar\*U, and bind \*Qescape\*U to the command
that creates an non-login window with a.\|k.\|a. \*Qroot\*U in slot #9, with
a superuser shell and a scrollback buffer of 1000 lines.
+.PP
+.nf
+ bind -c demo1 0 select 10
+ bind -c demo1 1 select 11
+ bind -c demo1 2 select 12
+ bindkey "^B" command -c demo1
+.fi
+.PP
+makes \*QC-b 0\*U select window 10, \*QC-b 1\*U window 11, etc.
+.PP
+.nf
+ bind -c demo2 0 select 10
+ bind -c demo2 1 select 11
+ bind -c demo2 2 select 12
+ bind - command -c demo2
+.fi
+.PP
+makes \*QC-a - 0\*U select window 10, \*QC-a - 1\*U window 11, etc.
.sp
.ne 3
.B bindkey
@@ -1031,7 +1096,7 @@ mapping. On every position a '.' may be used to indicate that
the corresponding charset/mapping should not be changed
(\fIset\fP is padded to six characters internally by appending '.'
chars). New windows have "BBBB02" as default charset, unless a
-\*Qkanji\*U command is active.
+\*Qencoding\*U command is active.
.br
The current setting can be viewed with the \*Qinfo\*U command.
.sp
@@ -1078,10 +1143,13 @@ you may regard \*QC-a esc\*U (copy mode) as its `Vi command mode'.
.sp
.ne 3
.B command
+.RB [ -c
+.IR class ]
.PP
This command has the same effect as typing the screen escape
character (^A). It is probably only useful for key bindings.
-See also \*Qbindkey\*U.
+If the \*Q-c\*U option is given, select the specified command
+class. See also \*Qbind\*U and \*Qbindkey\*U.
.sp
.ne 3
.BR "compacthist " [ on | off ]
@@ -1298,6 +1366,12 @@ Note that you can use the special `AN' terminal capability if you
want to have a dependency on the terminal type.
.sp
.ne 3
+.BR "defbce on" | off
+.PP
+Same as the \fBbce\fP command except that the default setting for new
+windows is changed. Initial setting is `off'.
+.sp
+.ne 3
.B defbreaktype
.RI [ tcsendbreak | TIOCSBRK
.RI | TCSBRK ]
@@ -1368,10 +1442,17 @@ is omitted, the current default string is displayed.
Per default the hardstatus line of new windows is empty.
.sp
.ne 3
-.BR "defkanji jis" | sjis | euc
+.BI "defencoding " enc
.PP
-Same as the \fBkanji\fP command except that the default setting for new
-windows is changed. Initial setting is `off', i.e. `jis'.
+Same as the \fBencoding\fP command except that the default setting for new
+windows is changed. Initial setting is the encoding taken from the
+terminal.
+.sp
+.ne 3
+.BR "deflog on" | off
+.PP
+Same as the \fBlog\fP command except that the default setting for new windows
+is changed. Initial setting is `off'.
.sp
.ne 3
.BR "deflogin on" | off
@@ -1423,6 +1504,13 @@ Same as the \fBslowpaste\fP command except that the default setting for new
windows is changed. Initial setting is 0 milliseconds, meaning `off'.
.sp
.ne 3
+.BR "defutf8 on" | off
+.PP
+Same as the \fButf8\fP command except that the default setting for new
+windows is changed. Initial setting is `on' if screen was started with
+\*Q-U\*U, otherwise `off'.
+.sp
+.ne 3
.BR "defwrap on" | off
.PP
Same as the \fBwrap\fP command except that the default setting for new
@@ -1443,6 +1531,7 @@ See there.
.sp
.ne 3
.B detach
+.RB [ -h ]
.PP
Detach the
.I screen
@@ -1455,7 +1544,16 @@ can be resumed by invoking
.I screen
with the
.B \-r
-option. (See also section \*QCOMMAND-LINE OPTIONS\*U.)
+option (see also section \*QCOMMAND-LINE OPTIONS\*U). The
+.B \-h
+option tells screen to immediately close the connection to the
+terminal (\*Qhangup\*U).
+.sp
+.ne 3
+.B dinfo
+.PP
+Show what screen thinks about your terminal. Useful if you want to know
+why features like color or the alternate charset don't work.
.sp
.ne 3
.B displays
@@ -1521,6 +1619,14 @@ by a second character, such as \*Q\e^\*U or \*Q\e\e\*U.
The default is \*Q^Aa\*U.
.sp
.ne 3
+.B eval
+.I command1
+.RI [ command2
+.IR ... ]
+.PP
+Parses and executes each argument as seperate command.
+.sp
+.ne 3
.B exec
.RI [[ fdpat ]
.IR "newcommand " [ "args ..." ]]
@@ -1629,10 +1735,19 @@ details and note, that this is subject to change in future releases.
Default is set by `defflow'.
.sp
.ne 3
-.B focus
+.BR "focus " [ up | down | top | bottom ]
.PP
Move the input focus to the next region. This is done in a cyclic
-way so that the top region is selected after the bottom one.
+way so that the top region is selected after the bottom one. If
+no subcommand is given it defaults to `down'. `up' cycles in the
+opposite order, `top' and `bottom' go to the top and bottom
+region respectively. Useful bindings are (j and k as in vi)
+.nf
+ bind j focus down
+ bind k focus up
+ bind t focus top
+ bind b focus bottom
+.fi
.sp
.ne 3
.BR "gr " [ on | off ]
@@ -1645,11 +1760,15 @@ otherwise the ISO88591 charset would not work.
.sp
.ne 3
.B hardcopy
+.RB [ -h ]
+.RI [ file ]
.PP
-Writes out the currently displayed image to a file \fIhardcopy.n\fP
-in the window's default directory, where \fIn\fP is the number
-of the current window.
+Writes out the currently displayed image to the file \fIfile\fP,
+or, if no filename is specified, to \fIhardcopy.n\fP in the
+default directory, where \fIn\fP is the number of the current window.
This either appends or overwrites the file if it exists. See below.
+If the option \fB-h\fP is specified, dump also the contents of the
+scrollback buffer.
.sp
.ne 3
.BR "hardcopy_append on" | off
@@ -1705,12 +1824,12 @@ If you prepend the word \*Qalways\*U to the type,
.I screen
will use the type even if the terminal supports a hardstatus.
.P
-The third form specifies the contents of the hardstatus line.
-'%h' is used as default string, i.e. the stored hardstatus of the
-current window (settable via \\E]0;^G or \\E_\\\\) is displayed.
-You can customize this to any string you like including
-the escapes from the \*QSTRING ESCAPES\*U chapter. If you leave
-out the argument
+The third form specifies the contents of the hardstatus line. '%h' is
+used as default string, i.e. the stored hardstatus of the current
+window (settable via \*QESC]0;<string>^G\*U or \*QESC_<string>ESC\e\*U)
+is displayed. You can customize this to any string you like including
+the escapes from the \*QSTRING ESCAPES\*U chapter. If you leave out
+the argument
.IR string ,
the current string is displayed.
.P
@@ -1718,13 +1837,24 @@ You can mix the second and third form by providing the string as
additional argument.
.sp
.ne 3
-.BR "height " [ \fIlines\fP ]
+.B height
+.RB [ -w | -d ]
+.RI [ lines " [" cols ]]
.PP
Set the display height to a specified number of lines. When no argument
-is given it toggles between 24 and 42 lines display.
+is given it toggles between 24 and 42 lines display. You can also
+specify a width if you want to change both values.
+The
+.B -w
+option tells screen to leave the display size unchanged and just set
+the window size,
+.B -d
+vice versa.
.sp
.ne 3
.B help
+.RB [ -c
+.IR class ]
.PP
Not really a online help, but
displays a help
@@ -1734,7 +1864,8 @@ The first pages list all the internal commands followed by their current
bindings.
Subsequent pages will display the custom commands, one command per key.
Press space when you're done reading each page, or return to exit early.
-All other characters are ignored.
+All other characters are ignored. If the \*Q-c\*U option is given,
+display all bound commands for the specified command class.
See also \*QDEFAULT KEY BINDINGS\*U section.
.sp
.ne 3
@@ -1758,6 +1889,12 @@ scrollback buffer).
Change the window's hardstatus line to the string \fIstatus\fP.
.sp
.ne 3
+.BR "ignorecase " [ on | off ]
+.PP
+Tell screen to ignore the case of caracters in searches. Default is
+`off'.
+.sp
+.ne 3
.B info
.PP
Uses the message line to display some information about the current window:
@@ -1784,7 +1921,8 @@ activity monitoring or partial redraw enabled.
The currently active character set (\fIG0\fP, \fIG1\fP, \fIG2\fP,
or \fIG3\fP) and in square brackets the terminal character sets that are
-currently designated as \fIG0\fP through \fIG3\fP is shown.
+currently designated as \fIG0\fP through \fIG3\fP is shown. If the window
+is in UTF-8 mode, the string \*QUTF-8\*U is shown instead.
Additional modes depending on the type of the window are displayed at the end of the status line (See also chapter \*QWINDOW TYPES\*U).
.br
@@ -1799,20 +1937,24 @@ For system information use the \*Qtime\*U command.
No longer exists, use \*Qpaste\*U instead.
.sp
.ne 3
-.B kanji
-.BR jis | euc | sjis
-.RB [ jis | euc | sjis\fR]
+.BI "encoding " enc
+.RI [ enc ]
.PP
Tell
.I screen
-how to process kanji input/output. The first argument
-sets the kanji type of the current window. Each window can emulate
-a different type. The optional second parameter tells
-.I screen
-how to write the kanji codes to the connected terminal. The preferred
-method of setting the display type is to use the \*QKJ\*U termcap
-entry.
-See also \*Qdefkanji\*U, which changes the default setting of a new
+how to interpret the input/output. The first argument
+sets the encoding of the current window. Each window can emulate
+a different encoding. The optional second parameter overwrites
+the encoding of the connected terminal. It should never be
+needed as screen uses the locale setting to detect the encoding.
+There is also a way to select a terminal encoding depending on
+the terminal type by using the \*QKJ\*U termcap entry.
+
+Supported encodings are eucJP, SJIS, eucKR, eucCN, Big5, KOI8-R,
+CP1251, UTF-8, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5, ISO8859-6,
+ISO8859-7, ISO8859-8, ISO8859-9, ISO8859-10, ISO8859-15, jis.
+
+See also \*Qdefencoding\*U, which changes the default setting of a new
window.
.sp
.ne 3
@@ -2210,12 +2352,19 @@ Use the empty bind command (as in \*Qbind '^\e'\*U) to remove a key binding.
.sp
.ne 3
.B readbuf
+.RB [ -e
+.IR encoding ]
+.RI [ filename ]
.PP
-Reads the contents of the current screen-exchange file into the paste buffer.
+Reads the contents of the specified file into the paste buffer.
+You can tell screen the encoding of the file via the \fB-e\fP option.
+If no file is specified, the screen-exchange filename is used.
See also \*Qbufferfile\*U command.
.sp
.ne 3
.B readreg
+.RB [ -e
+.IR encoding ]
.RI [ register " [" filename ]]
.PP
Does one of two things, dependent on number of arguments: with zero or one
@@ -2223,6 +2372,7 @@ arguments it it duplicates the paste buffer contents into the register specified
or entered at the prompt. With two arguments it reads the contents of the named
file into the register, just as \fIreadbuf\fP reads the screen-exchange file
into the paste buffer.
+You can tell screen the encoding of the file via the \fB-e\fP option.
The following example will paste the system's password file into
the
.I screen
@@ -2240,10 +2390,14 @@ Redisplay the current window. Needed to get a full redisplay when in
partial redraw mode.
.sp
.ne 3
-.BI "register " "key string"
+.B register
+.RB [ -e
+.IR encoding ]
+.I "key string"
.PP
-Save the specified \fIstring\fP to the register \fIkey\fP. See also the
-\*Qpaste\*U command.
+Save the specified \fIstring\fP to the register \fIkey\fP.
+The encoding of the string can be specified via the \fB-e\fP option.
+See also the \*Qpaste\*U command.
.sp
.ne 3
.B "remove"
@@ -2264,6 +2418,25 @@ settings (like scroll regions or graphics character set) are left over from
an application.
.sp
.ne 3
+.B "resize"
+.PP
+Resize the current region. The space will be removed from or added to
+the region below or if there's not enough space from the region above.
+.IP
+resize +N increase current region height by N
+.IP
+resize -N decrease current region height by N
+.IP
+resize N set current region height to N
+.IP
+resize = make all windows equally high
+.IP
+resize max maximize current region height
+.IP
+resize min minimize current region height
+.PP
+.sp
+.ne 3
.B "screen \fP[\fI-opts\fP] [\fIn\fP] [\fIcmd\fP [\fIargs\fP]]"
.PP
Establish a new window.
@@ -2343,6 +2516,16 @@ If no parameters are specified, the user will be prompted for both variable
and value. The environment is inherited by all subsequently forked shells.
.sp
.ne 3
+.BR "setsid " [ on | off ]
+.PP
+Normally screen uses different sessions and process groups for
+the windows. If setsid is turned \fIoff\fP, this is not done
+anymore and all windows will be in the same process group as the
+screen backend process. This also breaks job-control, so be careful.
+The default is \fIon\fP, of course. This command is probably useful
+only in rare circumstances.
+.sp
+.ne 3
.B "shell \fIcommand\fP"
.PP
Set the command to be used to create a new shell.
@@ -2396,23 +2579,27 @@ underlying system exposes flow control problems while pasting large amounts of
text.
.sp
.ne 3
+.BI "source " file
+.PP
+Read and execute commands from file \fIfile\fP. Source commands may
+be nested to a maximum recursion level of ten. If file is not an
+absolute path and screen already processes a source command, the
+parent directory of the running source command file is used to search
+for the new command file before screen's current directory.
+
+Note that termcap/terminfo/termcapinfo commands only work at
+startup and reattach time, so they must be reached via the
+default screenrc files to have an effect.
+.sp
+.ne 3
.B sorendition
.RB [ "\fIattr\fR " [ \fIcolor ]]
.PP
Change the way
.I screen
does highlighting for text marking and printing messages.
-.I Attr
-is a hexadecimal number and describes the attributes (inverse,
-underline, ...) the text will get.
-.I Color
-is a 2 digit number and changes the
-foreground/background of the highlighted text.
-Some knowledge of
-.IR screen 's
-internal character representation is
-needed to make the characters appear in the desired way. The default
-is currently 10 99 (standout, default colors).
+See the \*QSTRING ESCAPES\*U chapter for the syntax of the modifiers.
+The default is currently \*Q=s dd\*U (standout, default colors).
.sp
.ne 3
.B split
@@ -2585,10 +2772,15 @@ man page for more information on termcap definitions.
.sp
.ne 3
.B time
+.RI [ string ]
.PP
Uses the message line to display the time of day, the host name, and the load
averages over 1, 5, and 15 minutes (if this is available on your system).
For window specific information use \*Qinfo\*U.
+
+If a string is specified, it changes the format of the time report like it is
+described in the \*QSTRING ESCAPES\*U chapter. Screen uses a default of
+"%c:%s %M %d %H%? %l%?".
.sp
.ne 3
.BR "title " [ \fIwindowalias ]
@@ -2605,6 +2797,19 @@ releases.
Unset an environment variable.
.sp
.ne 3
+.B utf8
+.RB [ on | off
+.RB [ on | off ]]
+.PP
+Change the encoding used in the current window. If utf8 is enabled, the
+strings sent to the window will be UTF-8 encoded and vice versa. Omitting the
+parameter toggles the setting. If a second parameter is given, the display's
+encoding is also changed (this should rather be done with screen's \*Q-U\*U
+option).
+See also \*Qdefutf8\*U, which changes the default setting of a new
+window.
+.sp
+.ne 3
.B vbell
.RB [ on | off ]
.PP
@@ -2655,12 +2860,45 @@ Write a message to all displays. The message will appear in the terminal's
status line.
.sp
.ne 3
-.BR "width " [ \fInum ]
+.B width
+.RB [ -w | -d ]
+.RI [ cols " [" lines ]]
.PP
-Toggle the window width between 80 and 132 columns or set it to \fInum\fP
+Toggle the window width between 80 and 132 columns or set it to \fIcols\fP
columns if an argument is specified.
This requires a capable terminal and the termcap entries \*QZ0\*U and \*QZ1\*U.
-See the \*Qtermcap\*U command for more information.
+See the \*Qtermcap\*U command for more information. You can also specify
+a new height if you want to change both values.
+The
+.B -w
+option tells screen to leave the display size unchanged and just set
+the window size,
+.B -d
+vice versa.
+.sp
+.ne 3
+.B windowlist
+.RB [ -b "] |"
+.B string
+.RI [ string "] |"
+.B title
+.RI [ title ]
+.PP
+Display all windows in a table for visual window selection. The
+desired window can be selected via the standard movement keys (see
+the \*Qcopy\*U command) and activated via the return key.
+If the
+.B -b
+option is given, screen will switch to the blank window before
+presenting the list, so that the current window is also selectable.
+
+The table format can be changed with the \fBstring\fP and
+\fBtitle\fP option, the title is displayed as table heading, while
+the lines are made by using the string setting. The default
+setting is \*QNum Name%=Flags\*U for the title and \*Q%3n %t%=%f\*U
+for the lines.
+See the \*QSTRING ESCAPES\*U chapter for more codes (e.g. color
+settings).
.sp
.ne 3
.B windows
@@ -2692,11 +2930,16 @@ Default is `on'.
.sp
.ne 3
.B writebuf
+.RB [ -e
+.IR encoding ]
+.RI [ filename ]
.PP
-Writes the contents of the paste buffer to a public accessible screen-exchange
-file. This is thought of as a primitive means of communication between
+Writes the contents of the paste buffer to the specified file, or the public accessible screen-exchange
+file if no filename is given. This is thought of as a primitive means of communication between
.I screen
-users on the same host. The filename can be set with the \fIbufferfile\fP
+users on the same host. If an encoding is specified the paste buffer
+is recoded on the fly to match the encoding.
+The filename can be set with the \fIbufferfile\fP
command and defaults to \*Q/tmp/screen-exchange\*U.
.sp
.ne 3
@@ -2899,8 +3142,14 @@ current time HH:MM in 12h format
day number
.IP D
weekday name
+.IP f
+flags of the window
+.IP F
+sets %? to true if the window has the focus
.IP h
hardstatus of the window
+.IP H
+hostname of the system
.IP l
current load of the system
.IP m
@@ -2916,7 +3165,9 @@ window title
.IP u
all other users on this window
.IP w
-all window numbers and names
+all window numbers and names. With '-' quailifier: up to the current
+window; with '+' qualifier: starting with the window after the current
+one.
.IP W
all window numbers and names except the current one
.IP y
@@ -2928,12 +3179,122 @@ the part to the next '%?' is displayed only if an escape expands to an
nonempty string
.IP :
else part of '%?'
+.IP =
+pad the string to the display's width (like TeX's hfill). If a
+number is specified, pad to the percentage of the window's width.
+A '0' qualifier tells screen to treat the number as absolute position.
+You can specify to pad relative to the last absolute pad position
+by adding a '+' qualifier or to pad relative to the right margin
+by using '-'. The padding truncates the string if the specified
+position lies before the current position. Add the 'L' qualifier
+to change this.
+.IP <
+same as '%=' but just do truncation, do not fill with spaces
+.IP >
+mark the current text position for the next truncation. When
+screen needs to do truncation, it tries to do it in a way that
+the marked position gets moved to the specified percentage of
+the output area. (The area starts from the last absolute pad
+position and ends with the position specified by the truncation
+operator.) The 'L' qualifier tells screen to mark the truncated
+parts with '...'.
+.IP {
+attribute/color modifier string terminated by the next \*Q}\*U
.P
The 'c' and 'C' escape may be qualified with a '0' to make
.I screen
-use zero instead of space as fill character. The 'n' escape understands
-a length qualifier (e.g. '%3n').
-
+use zero instead of space as fill character. The '0' qualifier
+also makes the '=' escape use absolute positions. The 'n' and '='
+escapes understand
+a length qualifier (e.g. '%3n'), 'D' and 'M' can be prefixed with 'L'
+to generate long names, 'w' and 'W' also show the window flags
+if 'L' is given.
+.PP
+An attribute/color modifier is is used to change the attributes or the
+color settings. Its format
+is \*Q[attribute modifier] [color description]\*U. The attribute modifier
+must be prefixed by a change type indicator if it can be confused with
+a color desciption. The following change types are known:
+.IP +
+add the specified set to the current attributes
+.IP -
+remove the set from the current attributes
+.IP !
+invert the set in the current attributes
+.IP =
+change the current attributes to the specified set
+.PP
+The attribute set can either be specified as a hexadecimal number or
+a combination of the following letters:
+.IP u
+underline
+.PD 0
+.IP b
+bold
+.IP r
+reverse
+.IP s
+standout
+.IP B
+blinking
+.PD
+.PP
+Colors are coded either as a hexadecimal number or two letters specifying
+the desired background and foreground color (in that order). The following
+colors are known:
+.IP k
+black
+.PD 0
+.IP r
+red
+.IP g
+green
+.IP y
+yellow
+.IP b
+blue
+.IP m
+magenta
+.IP c
+cyan
+.IP w
+white
+.IP d
+default color
+.IP .
+leave color unchanged
+.PD
+.PP
+The capitalized versions of the letter specify bright colors. You can also
+use the pseudo-color 'i' to set just the brightness and leave the color
+unchanged.
+.br
+A one digit/letter color description is treated as foreground or
+background color dependant on the current attributes: if reverse mode is
+set, the background color is changed instead of the foreground color.
+If you don't like this, prefix the color with a \*Q.\*U. If you want
+the same behaviour for two-letter color descriptions, also prefix them
+with a \*Q.\*U.
+.br
+As a special case, \*Q%{-}\*U restores the attributes and colors that
+were set before the last change was made (i.e. pops one level of the
+color-change stack).
+.PP
+Examples:
+.IP "\*QG\*U"
+set color to bright green
+.IP "\*Q+b r\*U"
+use bold red
+.IP "\*Q= yd\*U"
+clear all attributes, write in default color on yellow background.
+.IP "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
+The available windows centered at the current window and truncated to
+the available width. The current window is displayed white on blue.
+This can be used with \*Qhardstatus alwayslastline\*U.
+.IP "%?%F%{.R.}%?%3n %t%? [%h]%?"
+The window number and title and the window's hardstatus, if one is set.
+Also use a red background if this is the active focus. Useful for
+\*Qcaption string\*U.
.SH "FLOW-CONTROL"
Each window has a flow-control setting that determines how
.I screen
@@ -2960,8 +3321,8 @@ Each window has an initial flow-control value set with either the
.B \-f
option or the \*Qdefflow\*U .screenrc command. Per default the windows
are set to automatic flow-switching.
-It can then be toggled between the three states 'fixed on', 'fixed off' and
-'automatic' interactively with the \*Qflow\*U command bound to "C-a f".
+It can then be toggled between the three states 'fixed on', 'fixed off'
+and 'automatic' interactively with the \*Qflow\*U command bound to "C-a f".
.PP
The automatic flow-switching mode deals with
flow control using the TIOCPKT mode (like \*Qrlogin\*U does). If
@@ -3349,9 +3710,15 @@ terminal without interpretation.
.BR "ESC _" " (A)"
Application Program Command (Hardstatus)
.TP 27
-.BR "ESC ]" " (A)"
+.BR "ESC ] 0 ; string ^G" " (A)"
Operating System Command (Hardstatus, xterm title hack)
.TP 27
+.BR "ESC ] 83 ; cmd ^G" " (A)"
+Execute screen command. This only works if multi-user support is
+compiled into screen. The pseudo-user \*Q:window:\*U is used to
+check the access control list. Use \*Qaddacl :window: -rwx #?\*U to
+create a user with no rights and allow only the needed commands.
+.TP 27
.BR "Control-N" " (A)"
Lock Shift G1 (SO)
.TP 27
@@ -3412,6 +3779,9 @@ From Beginning of Line to Cursor
\h'\w'ESC [ Pn = 'u'\fB2\fP
Entire Line
.TP 27
+.B "ESC [ \fPPn\fB X"
+Erase character
+.TP 27
.B "ESC [ \fPPn\fB A"
Cursor Up
.TP 27
@@ -3583,9 +3953,15 @@ Reverse Video
\h'\w'ESC [ Ps = 'u'\fB?7\fP (V)
\fIWrap\fP Mode
.TP 27
+\h'\w'ESC [ Ps = 'u'\fB?9\fP
+X10 mouse tracking
+.TP 27
\h'\w'ESC [ Ps = 'u'\fB?25\fP (V)
Visible Cursor
.TP 27
+\h'\w'ESC [ Ps = 'u'\fB?1000\fP (V)
+VT200 mouse tracking
+.TP 27
.BR "ESC [ 5 i" " (A)"
Start relay to printer (ANSI Media Copy)
.TP 27
@@ -3654,9 +4030,8 @@ Function key 7 k7 stuff \e033[18~
Function key 8 k8 stuff \e033[19~
Function key 9 k9 stuff \e033[20~
Function key 10 k; stuff \e033[21~
-Function key 11 F1 stuff \e033[22~
-Function key 12 F2 stuff \e033[23~
-Backspace kb stuff \e010
+Function key 11 F1 stuff \e033[23~
+Function key 12 F2 stuff \e033[24~
Home kh stuff \e033[1~
End kH stuff \e033[4~
Insert kI stuff \e033[2~
@@ -3763,8 +4138,8 @@ Turn on autonuke. See the 'autonuke' command for more details.
Set the output buffer limit. See the 'obuflimit' command for more details.
.TP 13
.BI KJ " (str)"
-Set the kanji type of the terminal. Valid strings are \*Qjis\*U,
-\*Qeuc\*U and \*Qsjis\*U.
+Set the encoding of the terminal. See the 'encoding' command for
+valid encodings.
.TP 13
.BI AF " (str)"
Change character foreground color in an ANSI conform way. This
@@ -3781,6 +4156,12 @@ Does understand ANSI set default fg/bg color (\eE[39m / \eE[49m).
Describe a translation of characters to strings depending on the
current font. More details follow in the next section.
.TP 13
+.BI XT " (bool)"
+Terminal understands special xterm sequences (OSC, mouse tracking).
+.TP 13
+.BI C8 " (bool)"
+Terminal needs bold to display high-intensity colors (e.g. Eterm).
+.TP 13
.BI TF " (bool)"
Add missing capabilities to the termcap/info entry. (Set by default).
@@ -3819,8 +4200,8 @@ Here is an example:
termcap hp700 'XC=B\eE(K%\eE(B,\e304[,\e326\e\e\e\e,\e334]'
-This tells .I
-screen
+This tells
+.I screen
how to translate ISOlatin1 (charset 'B')
upper case umlaut characters on a hp700 terminal that has a
german charset. '\e304' gets translated to '\eE(K[\eE(B' and so on.
@@ -3879,7 +4260,8 @@ Alternate system screenrc file.
Terminal name.
.IP TERMCAP
Terminal description.
-
+.IP WINDOW
+Window number of a window (at creation time).
.SH FILES
.PD 0
@@ -3896,11 +4278,15 @@ initialization commands
.IP $HOME/.screenrc
Read in after /etc/screenrc
.IP $SCREENDIR/S-<login>
-.IP /var/run/screens/S-<login>
-Socket directories (default for Debian GNU/Linux)
+.IP /var/run/screen/S-<login>
+Socket directories (default)
+.IP /usr/tmp/screens/S-<login>
+Alternate socket directories.
.IP "<socket directory>/.termcap"
Written by the "termcap" output function
-.IP $HOME/screen-exchange
+.IP /usr/tmp/screens/screen-exchange
+or
+.IP /tmp/screen-exchange
.I screen
`interprocess communication buffer'
.IP hardcopy.[0-9]
@@ -3927,7 +4313,7 @@ produced by Wayne Davison, Juergen Weigert and Michael Schroeder.
.SH COPYLEFT
.nf
-Copyright (C) 1999
+Copyright (C) 1993-2002
Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
Copyright (C) 1987 Oliver Laumann
@@ -3974,12 +4360,14 @@ E. Tye McQueen (tye%spillman.UUCP@uunet.uu.net),
Matthew Green (mrg@mame.mu.oz.au),
Christopher Williams (cgw@unt.edu),
Matt Mosley (mattm@access.digex.net),
-Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU).
+Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU),
+Johannes Zellner (johannes@zellner.org),
+Pablo Averbuj (pablo@averbuj.com).
.fi
.SH VERSION
-This is version 3.9 Its roots are a merge of a custom version
+This is version 3.9.9. Its roots are a merge of a custom version
2.3PR7 by Wayne Davison
and several enhancements to Oliver Laumann's version 2.0. Note that all versions
numbered 2.x are copyright by Oliver Laumann.
@@ -3987,11 +4375,11 @@ numbered 2.x are copyright by Oliver Laumann.
.SH AVAILABILITY
The latest official release of
.I screen
-available via anonymous ftp from prep.ai.mit.edu, nic.funet.fi or any other
+available via anonymous ftp from gnudist.gnu.org, nic.funet.fi or any other
.I GNU
distribution site. The home site of
.I screen
-is ftp.uni-erlangen.de (131.188.3.71), in the directory
+is ftp.uni-erlangen.de, in the directory
pub/utilities/screen. The subdirectory `private' contains the latest beta
testing release. If you want to help, send a note to
screen@uni-erlangen.de.
diff --git a/doc/screen.info b/doc/screen.info
index 11447c5..25800d8 100644
--- a/doc/screen.info
+++ b/doc/screen.info
@@ -1,9 +1,14 @@
-This is Info file screen.info, produced by Makeinfo-1.55 from the input
-file ./screen.texinfo.
+This is screen.info, produced by makeinfo version 4.0 from
+./screen.texinfo.
+
+INFO-DIR-SECTION General Commands
+START-INFO-DIR-ENTRY
+* Screen: (screen). Full-screen window manager.
+END-INFO-DIR-ENTRY
This file documents the `Screen' virtual terminal manager.
- Copyright (c) 1993-1995 Free Software Foundation, Inc.
+ Copyright (c) 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -21,161 +26,169 @@ translation approved by the Foundation.

Indirect:
-screen.info-1: 878
-screen.info-2: 50660
-screen.info-3: 100483
-screen.info-4: 150213
+screen.info-1: 995
+screen.info-2: 50933
+screen.info-3: 100453
+screen.info-4: 149266
+screen.info-5: 195279

Tag Table:
(Indirect)
-Node: Top878
-Node: Overview2886
-Node: Getting Started6518
-Node: Invoking Screen8276
-Node: Customization16304
-Node: Startup Files16791
-Node: Colon18437
-Node: Commands19059
-Node: Default Key Bindings20017
-Node: Command Summary25596
-Node: New Window37785
-Node: Chdir38617
-Node: Screen Command39588
-Node: Setenv41289
-Node: Shell41809
-Node: Term42575
-Node: Window Types43356
-Node: Selecting47674
-Node: Next and Previous48228
-Node: Other Window48754
-Node: Select49163
-Node: Session Management49831
-Node: Detach50660
-Node: Power Detach51945
-Node: Lock52584
-Node: Multiuser Session53470
-Node: Multiuser54432
-Node: Acladd54819
-Node: Aclchg55384
-Node: Acldel56790
-Node: Aclgrp57125
-Node: Displays57776
-Node: Umask58070
-Node: Wall59051
-Node: Writelock59288
-Node: Su60184
-Node: Session Name60984
-Node: Suspend61531
-Node: Quit61863
-Node: Regions62288
-Node: Split62773
-Node: Focus63063
-Node: Only63325
-Node: Remove63489
-Node: Caption63698
-Node: Window Settings64443
-Node: Naming Windows65178
-Node: Title Command66678
-Node: Dynamic Titles66952
-Node: Title Prompts68486
-Node: Title Screenrc69567
-Node: Console71206
-Node: Kill71649
-Node: Login72541
-Node: Mode73360
-Node: Monitor73759
-Node: Windows75172
-Node: Hardstatus76234
-Node: Virtual Terminal77427
-Node: Control Sequences78485
-Node: Input Translation85315
-Node: Digraph89831
-Node: Bell90623
-Node: Clear92502
-Node: Info92705
-Node: Redisplay94567
-Node: Wrap95698
-Node: Reset96449
-Node: Window Size96767
-Node: Character Processing97612
-Node: Copy and Paste100483
-Node: Copy101088
-Node: Line Termination101933
-Node: Scrollback102342
-Node: Copy Mode Keys103079
-Node: Movement103894
-Node: Marking105048
-Node: Repeat count105423
-Node: Searching105737
-Node: Specials105999
-Node: Paste107953
-Node: Registers110625
-Node: Screen-Exchange111631
-Node: History112714
-Node: Subprocess Execution113454
-Node: Exec113818
-Node: Using Exec115564
-Node: Key Binding117403
-Node: Bind118046
-Node: Bind Examples119033
-Node: Command Character119713
-Node: Help121254
-Node: Bindkey121767
-Node: Bindkey Examples123313
-Node: Bindkey Control124202
-Node: Flow Control124799
-Node: Flow Control Summary125375
-Node: Flow128309
-Node: XON/XOFF129083
-Node: Termcap129456
-Node: Window Termcap130313
-Node: Dump Termcap135556
-Node: Termcap Syntax136271
-Node: Termcap Examples138438
-Node: Special Capabilities140479
-Node: Autonuke143042
-Node: Obuflimit143692
-Node: Character Translation144521
-Node: Message Line147134
-Node: Privacy Message148045
-Node: Hardware Status Line148542
-Node: Last Message150213
-Node: Message Wait150640
-Node: Logging151066
-Node: Hardcopy151390
-Node: Log152186
-Node: Startup153802
-Node: echo154209
-Node: sleep154617
-Node: Startup Message154958
-Node: Miscellaneous155231
-Node: At156339
-Node: Break158333
-Node: Debug159980
-Node: License160457
-Node: Nethack160722
-Node: Nonblock161400
-Node: Number161854
-Node: Silence162224
-Node: Time163160
-Node: Verbose163534
-Node: Version163868
-Node: Zombie164077
-Node: Printcmd165131
-Node: Sorendition165837
-Node: String Escapes166489
-Node: Environment167814
-Node: Files168849
-Node: Credits169936
-Node: Bugs171849
-Node: Known Bugs172319
-Node: Reporting Bugs174413
-Node: Availability175179
-Node: Installation175723
-Node: Socket Directory176113
-Node: Compiling Screen176643
-Node: Concept Index178035
-Node: Command Index180092
-Node: Keystroke Index188392
+Node: Top995
+Node: Overview3004
+Node: Getting Started6634
+Node: Invoking Screen8389
+Node: Customization16916
+Node: Startup Files17462
+Node: Source19108
+Node: Colon19785
+Node: Commands20399
+Node: Default Key Bindings21356
+Node: Command Summary27035
+Node: New Window40444
+Node: Chdir41245
+Node: Screen Command42216
+Node: Setenv43917
+Node: Shell44437
+Node: Term45203
+Node: Window Types45984
+Node: Selecting50303
+Node: Next and Previous50933
+Node: Other Window51463
+Node: Select51871
+Node: Windowlist52549
+Node: Session Management53445
+Node: Detach54274
+Node: Power Detach55661
+Node: Lock56300
+Node: Multiuser Session57186
+Node: Multiuser58148
+Node: Acladd58535
+Node: Aclchg59100
+Node: Acldel60506
+Node: Aclgrp60841
+Node: Displays61492
+Node: Umask61786
+Node: Wall62735
+Node: Writelock62972
+Node: Su63868
+Node: Session Name64668
+Node: Suspend65215
+Node: Quit65547
+Node: Regions65971
+Node: Split66538
+Node: Focus66828
+Node: Only67406
+Node: Remove67570
+Node: Resize67778
+Node: Caption68426
+Node: Fit69183
+Node: Window Settings69485
+Node: Naming Windows70220
+Node: Title Command71721
+Node: Dynamic Titles71995
+Node: Title Prompts73531
+Node: Title Screenrc74612
+Node: Console76251
+Node: Kill76694
+Node: Login77583
+Node: Mode78400
+Node: Monitor78798
+Node: Windows80209
+Node: Hardstatus81269
+Node: Virtual Terminal82462
+Node: Control Sequences83520
+Node: Input Translation91007
+Node: Digraph95478
+Node: Bell96270
+Node: Clear98149
+Node: Info98352
+Node: Redisplay100453
+Node: Wrap101584
+Node: Reset102335
+Node: Window Size102653
+Node: Character Processing103506
+Node: Copy and Paste107824
+Node: Copy108429
+Node: Line Termination109276
+Node: Scrollback109685
+Node: Copy Mode Keys110422
+Node: Movement111236
+Node: Marking112390
+Node: Repeat count112765
+Node: Searching113079
+Node: Specials113470
+Node: Paste115424
+Node: Registers118182
+Node: Screen Exchange119274
+Node: History120679
+Node: Subprocess Execution121419
+Node: Exec121783
+Node: Using Exec123529
+Node: Key Binding125368
+Node: Bind126011
+Node: Bind Examples127255
+Node: Command Character128311
+Node: Help129946
+Node: Bindkey130554
+Node: Bindkey Examples132104
+Node: Bindkey Control132993
+Node: Flow Control133590
+Node: Flow Control Summary134166
+Node: Flow137100
+Node: XON/XOFF137874
+Node: Termcap138247
+Node: Window Termcap139104
+Node: Dump Termcap144345
+Node: Termcap Syntax145059
+Node: Termcap Examples147225
+Node: Special Capabilities149266
+Node: Autonuke152041
+Node: Obuflimit152691
+Node: Character Translation153520
+Node: Message Line156134
+Node: Privacy Message157045
+Node: Hardware Status Line157542
+Node: Last Message159215
+Node: Message Wait159642
+Node: Logging160068
+Node: Hardcopy160392
+Node: Log161327
+Node: Startup163104
+Node: echo163511
+Node: sleep163919
+Node: Startup Message164260
+Node: Miscellaneous164533
+Node: At165767
+Node: Break167761
+Node: Debug169407
+Node: License169884
+Node: Nethack170149
+Node: Nonblock170826
+Node: Number171280
+Node: Silence171650
+Node: Time172586
+Node: Verbose173178
+Node: Version173512
+Node: Zombie173721
+Node: Printcmd174775
+Node: Sorendition175481
+Node: Attrcolor175911
+Node: Setsid176960
+Node: Eval177477
+Node: String Escapes177671
+Node: Environment182807
+Node: Files183903
+Node: Credits184991
+Node: Bugs187001
+Node: Known Bugs187471
+Node: Reporting Bugs189565
+Node: Availability190331
+Node: Installation190875
+Node: Socket Directory191265
+Node: Compiling Screen191795
+Node: Concept Index193187
+Node: Command Index195279
+Node: Keystroke Index204113

End Tag Table
diff --git a/doc/screen.info-1 b/doc/screen.info-1
index a5d84d3..63a2c6a 100644
--- a/doc/screen.info-1
+++ b/doc/screen.info-1
@@ -1,9 +1,14 @@
-This is Info file screen.info, produced by Makeinfo-1.55 from the input
-file ./screen.texinfo.
+This is screen.info, produced by makeinfo version 4.0 from
+./screen.texinfo.
+
+INFO-DIR-SECTION General Commands
+START-INFO-DIR-ENTRY
+* Screen: (screen). Full-screen window manager.
+END-INFO-DIR-ENTRY
This file documents the `Screen' virtual terminal manager.
- Copyright (c) 1993-1995 Free Software Foundation, Inc.
+ Copyright (c) 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -26,7 +31,7 @@ Screen
******
This file documents the `Screen' virtual terminal manager, version
-3.9.0.
+3.9.11.
* Menu:
@@ -96,8 +101,8 @@ window. The only exception to this is the one keystroke that is used to
initiate a command to the window manager. By default, each command
begins with a control-a (abbreviated `C-a' from now on), and is
followed by one other keystroke. The command character (*note Command
-Character::.) and all the key bindings (*note Key Binding::.) can be
-fully customized to be anything you like, though they are always two
+Character::) and all the key bindings (*note Key Binding::) can be fully
+customized to be anything you like, though they are always two
characters in length.
`Screen' does not understand the prefix `C-' to mean control.
@@ -143,16 +148,16 @@ or just `set term=mytermtype', for example.)
If you're impatient and want to get started without doing a lot more
reading, you should remember this one command: `C-a ?' (*note Key
-Binding::.). Typing these two characters will display a list of the
+Binding::). Typing these two characters will display a list of the
available `screen' commands and their bindings. Each keystroke is
-discussed in the section on keystrokes (*note Default Key Bindings::.).
-Another section (*note Customization::.) deals with the contents of your
+discussed in the section on keystrokes (*note Default Key Bindings::).
+Another section (*note Customization::) deals with the contents of your
`.screenrc'.
If your terminal is a "true" auto-margin terminal (it doesn't allow
the last position on the screen to be updated without scrolling the
screen) consider to use a version of your terminal's termcap that has
-automatic margins turned *off*. This will ensure an accurate and
+automatic margins turned _off_. This will ensure an accurate and
optimal update of the screen in all circumstances. Most terminals
nowadays have "magic" margins (automatic margins plus usable last
column). This is the VT100 style type and perfectly suited for
@@ -175,7 +180,7 @@ Invoking `Screen'
Screen has the following command-line options:
`-a'
- Include *all* capabilities (with some minor exceptions) in each
+ Include _all_ capabilities (with some minor exceptions) in each
window's termcap, even if `screen' must redraw parts of the display
in order to implement a function.
@@ -192,7 +197,7 @@ Invoking `Screen'
`-d [PID.SESSIONNAME]'
`-D [PID.SESSIONNAME]'
Do not start `screen', but instead detach a `screen' session
- running elsewhere (*note Detach::.). `-d' has the same effect as
+ running elsewhere (*note Detach::). `-d' has the same effect as
typing `C-a d' from the controlling terminal for the session.
`-D' is the equivalent to the power detach key. If no session can
be detached, this option is ignored. In combination with the
@@ -222,7 +227,7 @@ Invoking `Screen'
`-D -RR'
Attach here and now. Whatever that means, just do it.
- *Note*: It is a good idea to check the status of your sessions
+ _Note_: It is a good idea to check the status of your sessions
with `screen -list' before using this option.
`-e XY'
@@ -235,35 +240,35 @@ Invoking `Screen'
an already running session, this option only changes the command
character of the attaching user. This option is equivalent to the
commands `defescape' or `escape' respectively. (*note Command
- Character::.).
+ Character::).
`-f'
`-fn'
`-fa'
Set flow-control to on, off, or automatic switching mode,
respectively. This option is equivalent to the `defflow' command
- (*note Flow Control::.).
+ (*note Flow Control::).
`-h NUM'
Set the history scrollback buffer to be NUM lines high.
- Equivalent to the `defscrollback' command (*note Copy::.).
+ Equivalent to the `defscrollback' command (*note Copy::).
`-i'
Cause the interrupt key (usually `C-c') to interrupt the display
immediately when flow control is on. This option is equivalent to
the `interrupt' argument to the `defflow' command (*note Flow
- Control::.). Its use is discouraged.
+ Control::). Its use is discouraged.
`-l'
`-ln'
Turn login mode on or off (for `/etc/utmp' updating). This option
- is equivalent to the `deflogin' command (*note Login::.).
+ is equivalent to the `deflogin' command (*note Login::).
`-ls [MATCH]'
`-list [MATCH]'
Do not start `screen', but instead print a list of session
identification strings (usually of the form PID.TTY.HOST; *note
- Session Name::.). Sessions marked `detached' can be resumed with
+ Session Name::). Sessions marked `detached' can be resumed with
`screen -r'. Those marked `attached' are running and have a
controlling terminal. If the session runs in multiuser mode, it
is marked `multi'. Sessions marked as `unreachable' either live
@@ -279,7 +284,7 @@ Invoking `Screen'
Tell `screen' that your auto-margin terminal allows programs to
write to the last column of the last row of the screen without
scrolling. This can also be set in your `.screenrc' by specifying
- `xn' in a `termcap' command (*note Termcap::.).
+ `xn' in a `termcap' command (*note Termcap::).
`-m'
Tell `screen' to ignore the `$STY' environment variable. When
@@ -287,13 +292,13 @@ Invoking `Screen'
regardless of whether `screen' is being called from within another
`screen' session or not. This flag has a special meaning in
connection with the `-d' option:
- `-m -d'
- Start `screen' in *detached* mode. This creates a new session
+ `-d -m'
+ Start `screen' in _detached_ mode. This creates a new session
but doesn't attach to it. This is useful for system startup
scripts.
- `-m -D'
- This also starts `screen' in *detached* mode, but doesn't fork
+ `-D -m'
+ This also starts `screen' in _detached_ mode, but doesn't fork
a new process. The command exits if the session terminates.
`-q'
@@ -310,7 +315,7 @@ Invoking `Screen'
`-r SESSIONOWNER/[PID.SESSIONNAME]'
Resume a detached `screen' session. No other options (except
combinations with `-d' or `-D') may be specified, though the
- session name (*note Session Name::.) may be needed to distinguish
+ session name (*note Session Name::) may be needed to distinguish
between multiple detached `screen' sessions. The second form is
used to connect to another user's screen session which runs in
multiuser mode. This indicates that screen should look for
@@ -321,26 +326,32 @@ Invoking `Screen'
successful, all other command-line options are ignored. If no
detached session exists, start a new session using the specified
options, just as if `-R' had not been specified. This option is
- set by default if screen is run as a login-shell. For combinations
- with the `-D'/`-d' option see there.
+ set by default if screen is run as a login-shell (actually screen
+ uses `-xRR' in that case). For combinations with the `-D'/`-d'
+ option see there.
`-s PROGRAM'
Set the default shell to be PROGRAM. By default, `screen' uses
the value of the environment variable `$SHELL', or `/bin/sh' if it
is not defined. This option is equivalent to the `shell' command
- (*note Shell::.).
+ (*note Shell::).
`-S SESSIONNAME'
Set the name of the new session to SESSIONNAME. This option can
be used to specify a meaningful name for the session in place of
the default TTY.HOST suffix. This name identifies the session for
the `screen -list' and `screen -r' commands. This option is
- equivalent to the `sessionname' command (*note Session Name::.).
+ equivalent to the `sessionname' command (*note Session Name::).
`-t NAME'
Set the title (name) for the default shell or specified program.
This option is equivalent to the `shelltitle' command (*note
- Shell::.).
+ Shell::).
+
+`-U'
+ Run screen in UTF-8 mode. This option tells screen that your
+ terminal sends and understands UTF-8 encoded characters. It also
+ sets the default encoding for new windows to `utf8'.
`-v'
Print the version number.
@@ -356,6 +367,12 @@ Invoking `Screen'
Attach to a session which is already attached elsewhere
(multi-display mode).
+`-X'
+ Send the specified command to a running screen session. You can use
+ the `-d' or `-r' option to tell screen to look only for attached
+ or detached screen sessions. Note that this command doesn't work
+ if the session is password protected.
+

File: screen.info, Node: Customization, Next: Commands, Prev: Invoking Screen, Up: Top
@@ -369,23 +386,24 @@ be executed at startup, or on the fly using the `colon' command.
* Menu:
* Startup Files:: The `.screenrc' file.
+* Source:: Read commands from a file.
* Colon:: Entering customization commands interactively.

-File: screen.info, Node: Startup Files, Next: Colon, Up: Customization
+File: screen.info, Node: Startup Files, Next: Source, Up: Customization
The `.screenrc' file
====================
When `screen' is invoked, it executes initialization commands from
the files `.screenrc' in the user's home directory and
-`/etc/screenrc'. These defaults can be overridden in the
+`/usr/local/etc/screenrc'. These defaults can be overridden in the
following ways: For the global screenrc file `screen' searches for the
environment variable `$SYSSCREENRC' (this override feature may be
disabled at compile-time). The user specific screenrc file is searched
for in `$SCREENRC', then ``$HOME'/.screenrc'. The command line option
-`-c' specifies which file to use (*note Invoking Screen::.. Commands
-in these files are used to set options, bind commands to keys, and to
+`-c' specifies which file to use (*note Invoking Screen::. Commands in
+these files are used to set options, bind commands to keys, and to
automatically establish one or more windows at the beginning of your
`screen' session. Commands are listed one per line, with empty lines
being ignored. A command's arguments are separated by tabs or spaces,
@@ -403,7 +421,25 @@ distribution: `etc/screenrc' and `etc/etcscreenrc'. They contain a
number of useful examples for various commands.

-File: screen.info, Node: Colon, Prev: Startup Files, Up: Customization
+File: screen.info, Node: Source, Next: Colon, Prev: Startup Files, Up: Customization
+
+Source
+======
+
+ - Command: source file
+ (none)
+ Read and execute commands from file FILE. Source commands may be
+ nested to a maximum recursion level of ten. If FILE is not an
+ absolute path and screen already processes a source command,
+ the parent directory of the running source command file is used to
+ search for the new command file before screen's current directory.
+
+ Note that termcap/terminfo/termcapinfo commands only work at
+ startup and reattach time, so they must be reached via the
+ default screenrc files to have an effect.
+
+
+File: screen.info, Node: Colon, Prev: Source, Up: Customization
Colon
=====
@@ -418,7 +454,7 @@ Colon
exists, as of version 3.3. Change default settings with commands
starting with `def'. You might think of this as the `ex' command
mode of `screen', with `copy' as its `vi' command mode (*note Copy
- and Paste::.).
+ and Paste::).

File: screen.info, Node: Commands, Next: New Window, Prev: Customization, Up: Top
@@ -428,7 +464,7 @@ Commands
A command in `screen' can either be bound to a key, invoked from a
screenrc file, or called from the `colon' prompt (*note
-Customization::.). As of version 3.3, all commands can be bound to
+Customization::). As of version 3.3, all commands can be bound to
keys, although some may be less useful than others. For a number of
real life working examples of the most important commands see the files
`etc/screenrc' and `etc/etcscreenrc' of your screen distribution.
@@ -463,16 +499,19 @@ Thus, both `C-a c' and `C-a C-c' can be used to create a window.
The following table shows the default key bindings:
`C-a ''
-`C-a "'
(select)
Prompt for a window identifier and switch. *Note Selecting::.
+`C-a "'
+ (windowlist -b)
+ Present a list of all windows for selection. *Note Selecting::.
+
`C-a 0...9, -'
(select 0...select 9, select -)
Switch to window number 0...9, or the blank window. *Note
Selecting::.
-`C-a Tab'
+`C-a <Tab>'
(focus)
Switch the input focus to the next region. *Note Regions::.
@@ -572,7 +611,7 @@ Thus, both `C-a c' and `C-a C-c' can be used to create a window.
(monitor) Toggle monitoring of the current window. *Note
Monitor::.
-`C-a SPC'
+`C-a <SPC>'
`C-a n'
`C-a C-n'
(next)
@@ -585,7 +624,7 @@ Thus, both `C-a c' and `C-a C-c' can be used to create a window.
`C-a p'
`C-a C-p'
`C-a C-h'
-`C-a BackSpace'
+`C-a <BackSpace>'
(prev)
Switch to the previous window (opposite of `C-a n'). *Note
Selecting::.
@@ -673,7 +712,7 @@ Thus, both `C-a c' and `C-a C-c' can be used to create a window.
`C-a ['
`C-a C-['
-`C-a ESC'
+`C-a <ESC>'
(copy)
Enter copy/scrollback mode. *Note Copy::.
@@ -691,16 +730,16 @@ Thus, both `C-a c' and `C-a C-c' can be used to create a window.
`C-a >'
(writebuf)
Write the paste buffer out to the screen-exchange file. *Note
- Screen-Exchange::.
+ Screen Exchange::.
`C-a <'
(readbuf)
- Read the screen-exchange file into the paste buffer. *Note
- Screen-Exchange::.
+ Read the screen-exchange file into the paste buffer. *Note Screen
+ Exchange::.
`C-a ='
(removebuf)
- Delete the screen-exchange file. *Note Screen-Exchange::.
+ Delete the screen-exchange file. *Note Screen Exchange::.
`C-a _'
(silence)
@@ -734,7 +773,7 @@ Command Summary
Inherit permissions granted to a group leader. *Note Multiuser
Session::.
-`aclumask [USERS]+\-BITS ...'
+`aclumask [USERS]+/-BITS ...'
Predefine access to new windows. *Note Umask::.
`activity MESSAGE'
@@ -746,9 +785,12 @@ Command Summary
`allpartial STATE'
Set all windows to partial refresh. *Note Redisplay::.
-`at [IDENT][`#'|`*'|`%'] COMMAND [ARGS]'
+`at [IDENT][#|*|%] COMMAND [ARGS]'
Execute a command at other displays or windows. *Note At::.
+`attrcolor ATTRIB [ATTRIBUTE/COLOR-MODIFIER]'
+ Map attributes to colors. *Note Attrcolor::.
+
`autodetach STATE'
Automatically detach the session on SIGHUP. *Note Detach::.
@@ -756,10 +798,13 @@ Command Summary
Enable a clear screen to discard unwritten output. *Note
Autonuke::.
+`bce [STATE]'
+ Change background color erase. *Note Character Processing::.
+
`bell_msg [MESSAGE]'
Set the bell notification message. *Note Bell::.
-`bind KEY [COMMAND [ARGS]]'
+`bind [-c CLASS] KEY [COMMAND [ARGS]]'
Bind a command to a key. *Note Bind::.
`bindkey [OPTS] [STRING [CMD ARGS]]'
@@ -772,7 +817,7 @@ Command Summary
Specify how to generate breaks. *Note Break::.
`bufferfile [EXCHANGE-FILE]'
- Select a file for screen-exchange. *Note Screen-Exchange::.
+ Select a file for screen-exchange. *Note Screen Exchange::.
`c1 [STATE]'
Change c1 code processing. *Note Character Processing::.
@@ -796,7 +841,7 @@ Command Summary
`colon'
Enter a `screen' command. *Note Colon::.
-`command'
+`command [-c CLASS]'
Simulate the screen escape key. *Note Command Character::.
`compacthist [STATE]'
@@ -820,6 +865,9 @@ Command Summary
`defautonuke STATE'
Select default autonuke behavior. *Note Autonuke::.
+`defbce STATE'
+ Select background color erase. *Note Character Processing::.
+
`defbreaktype [TCSENDBREAK | TCSBRK | TIOCSBRK]'
Specify the default for generating breaks. *Note Break::.
@@ -831,6 +879,9 @@ Command Summary
Change defaul character set slot designation. *Note Character
Processing::.
+`defencoding ENC'
+ Select default window encoding. *Note Character Processing::.
+
`defescape XY'
Set the default command and `meta' characters. *Note Command
Character::.
@@ -845,9 +896,8 @@ Command Summary
`defhstatus [STATUS]'
Select default window hardstatus line. *Note Hardstatus::.
-`defkanji WTYPE'
- Select default GR processing behavior. *Note Character
- Processing::.
+`deflog STATE'
+ Select default window logging behavior. *Note Log::.
`deflogin STATE'
Select default utmp logging behavior. *Note Login::.
@@ -874,6 +924,9 @@ Command Summary
Select the default inter-character timeout when pasting. *Note
Paste::.
+`defutf8 STATE'
+ Select default character encoding. *Note Character Processing::.
+
`defwrap STATE'
Set default line-wrapping behavior. *Note Wrap::.
@@ -883,12 +936,15 @@ Command Summary
`defzombie [KEYS]'
Keep dead windows. *Note Zombie::.
-`detach'
+`detach [-h]'
Disconnect `screen' from the terminal. *Note Detach::.
`digraph'
Enter digraph sequence. *Note Digraph::.
+`dinfo'
+ Display terminal information. *Note Info::.
+
`displays'
List currently active user interfaces. *Note Displays::.
@@ -898,9 +954,15 @@ Command Summary
`echo [-n] MESSAGE'
Display a message on startup. *Note Startup::.
+`encoding ENC [DENC]'
+ Set the encoding of a window. *Note Character Processing::.
+
`escape XY'
Set the command and `meta' characters. *Note Command Character::.
+`eval COMMAND1 [COMMAND2 ...]'
+ Parse and execute each argument. *Note Eval::.
+
`exec [[FDPAT] COMMAND [ARGS ...]]'
Run a subprocess (filter). *Note Exec::.
@@ -916,7 +978,7 @@ Command Summary
`gr [STATE]'
Change GR charset processing. *Note Character Processing::.
-`hardcopy'
+`hardcopy [-h] [FILE]'
Write out the contents of the current window. *Note Hardcopy::.
`hardcopy_append STATE'
@@ -928,10 +990,10 @@ Command Summary
`hardstatus [STATE]'
Use the hardware status line. *Note Hardware Status Line::.
-`height [LINES]'
+`height [LINES [COLS]]'
Set display height. *Note Window Size::.
-`help'
+`help [-c CLASS]'
Display current key bindings. *Note Help::.
`history'
@@ -940,15 +1002,15 @@ Command Summary
`hstatus STATUS'
Change the window's hardstatus line. *Note Hardstatus::.
+`ignorecase [STATE]'
+ Ignore character case in searches. *Note Searching::.
+
`info'
- Display terminal settings. *Note Info::.
+ Display window settings. *Note Info::.
`ins_reg [KEY]'
Removed, use `paste' instead. *Note Registers::.
-`kanji WTYPE [DTYPE]'
- Set the kanji type of a window. *Note Character Processing::.
-
`kill'
Destroy the current window. *Note Kill::.
@@ -1058,28 +1120,31 @@ Command Summary
`quit'
Kill all windows and exit. *Note Quit::.
-`readbuf'
- Read the paste buffer from the screen-exchange file. *Note
- Screen-Exchange::.
+`readbuf [-e ENCODING] [FILENAME]'
+ Read the paste buffer from the screen-exchange file. *Note Screen
+ Exchange::.
-`readreg [REG [FILE]]'
+`readreg [-e ENCODING] [REG [FILE]]'
Load a register from paste buffer or file. *Note Registers::.
`redisplay'
Redisplay the current window. *Note Redisplay::.
-`register KEY STRING'
+`register [-e ENCODING] KEY STRING'
Store a string to a register. *Note Registers::.
`remove'
Kill current region. *Note Regions::.
`removebuf'
- Delete the screen-exchange file. *Note Screen-Exchange::.
+ Delete the screen-exchange file. *Note Screen Exchange::.
`reset'
Reset the terminal settings for the window. *Note Reset::.
+`resize [(+/-)lines]'
+ Grow or shrink a region
+
`screen [OPTS] [N] [CMD [ARGS]]'
Create a new window. *Note Screen Command::.
@@ -1095,6 +1160,9 @@ Command Summary
`setenv [VAR [STRING]]'
Set an environment variable for new windows. *Note Setenv::.
+`setsid STATE'
+ Controll process group creation for windows. *Note Setsid::.
+
`shell COMMAND'
Set the default program for new windows. *Note Shell::.
@@ -1113,6 +1181,9 @@ Command Summary
`slowpaste MSEC'
Slow down pasting in windows. *Note Paste::.
+`source FILE'
+ Run commands from a file. *Note Source::.
+
`sorendition [ATTR [COLOR]]'
Change text highlighting. *Note Sorendition::.
@@ -1144,18 +1215,22 @@ Command Summary
`termcapinfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]'
Ditto, for both systems. *Note Termcap Syntax::.
-`time'
+`time [STRING]'
Display time and load average. *Note Time::.
`title [WINDOWTITLE]'
Set the name of the current window. *Note Title Command::.
-`umask [USERS]+\-BITS ...'
+`umask [USERS]+/-BITS ...'
Synonym to `aclumask'. *Note Umask::.
`unsetenv VAR'
Unset environment variable for new windows. *Note Setenv::.
+`utf8 [STATE [DSTATE]]'
+ Select character encoding of the current window. *Note Character
+ Processing::.
+
`vbell [STATE]'
Use visual bell. *Note Bell::.
@@ -1171,18 +1246,21 @@ Command Summary
`wall MESSAGE'
Write a message to all displays. *Note Multiuser Session::.
-`width [NUM]'
+`width [COLS [LINES]]'
Set the width of the window. *Note Window Size::.
+`windowlist [-b] | string [STRING] | title [TITLE]'
+ Present a list of all windows for selection. *Note Windowlist::.
+
`windows'
List active windows. *Note Windows::.
`wrap [STATE]'
Control line-wrap behavior. *Note Wrap::.
-`writebuf'
- Write paste buffer to screen-exchange file. *Note
- Screen-Exchange::.
+`writebuf [-e ENCODING] [FILENAME]'
+ Write paste buffer to screen-exchange file. *Note Screen
+ Exchange::.
`writelock ON|OFF|AUTO'
Grant exclusive write permission. *Note Multiuser Session::.
@@ -1204,9 +1282,8 @@ New Window
This section describes the commands for creating a new window for
running programs. When a new window is created, the first available
-number from the range 0...9 is assigned to it. There can be no more
-than 10 windows active at any one time unless `screen' was compiled
-with a higher MAXWIN setting.
+number from the range 0...9 is assigned to it. The number of windows
+is limited at compile-time by the MAXWIN configuration parameter.
* Menu:
@@ -1223,7 +1300,7 @@ File: screen.info, Node: Chdir, Next: Screen Command, Up: New Window
Chdir
=====
- - Command: chdir [DIRECTORY]
+ - Command: chdir [directory]
(none)
Change the current directory of `screen' to the specified directory
or, if called without an argument, to your home directory (the
@@ -1232,7 +1309,7 @@ Chdir
or by means of `C-a : screen ...' or `C-a c' use this as their
default directory. Without a `chdir' command, this would be the
directory from which `screen' was invoked. Hardcopy and log files
- are always written to the *window's* default directory, *not* the
+ are always written to the _window's_ default directory, _not_ the
current directory of the process running in the window. You can
use this command multiple times in your `.screenrc' to start
various windows in different default directories, but the last
@@ -1244,7 +1321,7 @@ File: screen.info, Node: Screen Command, Next: Setenv, Prev: Chdir, Up: New
Screen Command
==============
- - Command: screen [OPTS] [N] [CMD [ARGS]]
+ - Command: screen [opts] [n] [cmd [args]]
(`C-a c', `C-a C-c')
Establish a new window. The flow-control options (`-f', `-fn' and
`-fa'), title option (`-t'), login options (`-l' and `-ln') ,
@@ -1282,7 +1359,7 @@ File: screen.info, Node: Setenv, Next: Shell, Prev: Screen Command, Up: New
Setenv
======
- - Command: setenv VAR STRING
+ - Command: setenv var string
(none)
Set the environment variable VAR to value STRING. If only VAR is
specified, the user will be prompted to enter a value. If no
@@ -1290,7 +1367,7 @@ Setenv
variable and value. The environment is inherited by all
subsequently forked shells.
- - Command: unsetenv VAR
+ - Command: unsetenv var
(none)
Unset an environment variable.
@@ -1300,8 +1377,8 @@ File: screen.info, Node: Shell, Next: Term, Prev: Setenv, Up: New Window
Shell
=====
- - Command: shell COMMAND
- - Command: defshell COMMAND
+ - Command: shell command
+ - Command: defshell command
(none)
Set the command to be used to create a new shell. This overrides
the value of the environment variable `$SHELL'. This is useful if
@@ -1311,7 +1388,7 @@ Shell
`defshell' is currently a synonym to the `shell' command.
- - Command: shelltitle TITLE
+ - Command: shelltitle title
(none)
Set the title for all shells created during startup or by the C-a
C-c command. *Note Naming Windows::, for details about what
@@ -1323,7 +1400,7 @@ File: screen.info, Node: Term, Next: Window Types, Prev: Shell, Up: New Wind
Term
====
- - Command: term TERM
+ - Command: term term
(none)
In each window `screen' opens, it sets the `$TERM' variable to
`screen' by default, unless no description for `screen' is
@@ -1343,7 +1420,7 @@ Window Types
============
Screen provides three different window types. New windows are created
-with `screen''s `screen' command (*note Screen Command::.). The first
+with `screen''s `screen' command (*note Screen Command::). The first
parameter to the `screen' command defines which type of window is
created. The different window types are all special cases of the normal
type. They have been added in order to allow `screen' to be used
@@ -1432,12 +1509,13 @@ efficiently as a console with 100 or more windows.
`f'
LFLOW. The remote host will send flow control information.
- (Ignored at the moment.) Additional flags for debugging are
+ (Ignored at the moment.) Additional flags for debugging are
`x', `t' and `n' (XDISPLOC, TSPEED and NEWENV).
For telnet windows, the command `break' sends the telnet code `IAC
BREAK' (decimal 243) to the remote host.
+

File: screen.info, Node: Selecting, Next: Session Management, Prev: New Window, Up: Top
@@ -1446,79 +1524,12 @@ Selecting a Window
This section describes the commands for switching between windows in
an `screen' session. The windows are numbered from 0 to 9, and are
-created in that order by default (*note New Window::.).
+created in that order by default (*note New Window::).
* Menu:
* Next and Previous:: Forward or back one window.
* Other Window:: Switch back and forth between two windows.
* Select:: Switch to a window (and to one after `kill').
-
-
-File: screen.info, Node: Next and Previous, Next: Other Window, Up: Selecting
-
-Moving Back and Forth
-=====================
-
- - Command: next
- (`C-a SPC', `C-a n', `C-a C-n')
- Switch to the next window. This command can be used repeatedly to
- cycle through the list of windows. (On some terminals, C-SPC
- generates a NUL character, so you must release the control key
- before pressing space.)
-
- - Command: prev
- (`C-a p', `C-a C-p')
- Switch to the previous window (the opposite of `C-a n').
-
-
-File: screen.info, Node: Other Window, Next: Select, Prev: Next and Previous, Up: Selecting
-
-Other Window
-============
-
- - Command: other
- (`C-a C-a')
- Switch to the last window displayed. Note that this command
- defaults to the command character typed twice, unless overridden.
- For instance, if you use the option `-e]x', this command becomes
- `]]' (*note Command Character::.).
-
-
-File: screen.info, Node: Select, Prev: Other Window, Up: Selecting
-
-Select
-======
-
- - Command: select [N]
- (`C-a N', `C-a '', `C-a "')
- Switch to the window with the number N. If no window number is
- specified, you get prompted for an identifier. This can be a
- window name (title) or a number. When a new window is
- established, the lowest available number is assigned to this
- window. Thus, the first window can be activated by `select 0';
- there can be no more than 10 windows present simultaneously
- (unless screen is compiled with a higher MAXWIN setting). The
- special command `select -' switches to a blank window.
-
-
-File: screen.info, Node: Session Management, Next: Regions, Prev: Selecting, Up: Top
-
-Session Management Commands
-***************************
-
- Perhaps the most useful feature of `screen' is the way it allows the
-user to move a session between terminals, by detaching and reattaching.
-This also makes life easier for modem users who have to deal with
-unexpected loss of carrier.
-
-* Menu:
-
-* Detach:: Disconnect `screen' from your terminal.
-* Power Detach:: Detach and log out.
-* Lock:: Lock your terminal temporarily.
-* Multiuser Session:: Changing number of allowed users.
-* Session Name:: Rename your session for later reattachment.
-* Suspend:: Suspend your session.
-* Quit:: Terminate your session.
+* Windowlist:: Present a list of all windows for selection.
diff --git a/doc/screen.info-2 b/doc/screen.info-2
index 2995343..21dfb8d 100644
--- a/doc/screen.info-2
+++ b/doc/screen.info-2
@@ -1,9 +1,14 @@
-This is Info file screen.info, produced by Makeinfo-1.55 from the input
-file ./screen.texinfo.
+This is screen.info, produced by makeinfo version 4.0 from
+./screen.texinfo.
+
+INFO-DIR-SECTION General Commands
+START-INFO-DIR-ENTRY
+* Screen: (screen). Full-screen window manager.
+END-INFO-DIR-ENTRY
This file documents the `Screen' virtual terminal manager.
- Copyright (c) 1993-1995 Free Software Foundation, Inc.
+ Copyright (c) 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -20,12 +25,102 @@ versions, except that this permission notice may be stated in a
translation approved by the Foundation.

+File: screen.info, Node: Next and Previous, Next: Other Window, Up: Selecting
+
+Moving Back and Forth
+=====================
+
+ - Command: next
+ (`C-a <SPC>', `C-a n', `C-a C-n')
+ Switch to the next window. This command can be used repeatedly to
+ cycle through the list of windows. (On some terminals, C-<SPC>
+ generates a NUL character, so you must release the control key
+ before pressing space.)
+
+ - Command: prev
+ (`C-a p', `C-a C-p')
+ Switch to the previous window (the opposite of `C-a n').
+
+
+File: screen.info, Node: Other Window, Next: Select, Prev: Next and Previous, Up: Selecting
+
+Other Window
+============
+
+ - Command: other
+ (`C-a C-a')
+ Switch to the last window displayed. Note that this command
+ defaults to the command character typed twice, unless overridden.
+ For instance, if you use the option `-e]x', this command becomes
+ `]]' (*note Command Character::).
+
+
+File: screen.info, Node: Select, Next: Windowlist, Prev: Other Window, Up: Selecting
+
+Select
+======
+
+ - Command: select [n]
+ (`C-a N', `C-a '')
+ Switch to the window with the number N. If no window number is
+ specified, you get prompted for an identifier. This can be a
+ window name (title) or a number. When a new window is
+ established, the lowest available number is assigned to this
+ window. Thus, the first window can be activated by `select 0';
+ there can be no more than 10 windows present simultaneously
+ (unless screen is compiled with a higher MAXWIN setting). The
+ special command `select -' switches to a blank window.
+
+
+File: screen.info, Node: Windowlist, Prev: Select, Up: Selecting
+
+Windowlist
+==========
+
+ - Command: windowlist [-b] | string [STRING] | title [TITLE]
+ (`C-a "')
+ Display all windows in a table for visual window selection. The
+ desired window can be selected via the standard movement keys
+ (*note Movement::) and activated via the return key. If the `-b'
+ option is given, screen will switch to the blank window before
+ presenting the list, so that the current window is also selectable.
+
+ The table format can be changed with the string and title option,
+ the title is displayed as table heading, while the lines are made
+ by using the string setting. The default setting is `Num
+ Name%=Flags' for the title and `%3n %t%=%f' for the lines. See the
+ string escapes chapter (*note String Escapes::) for more codes
+ (e.g. color settings).
+
+
+
+File: screen.info, Node: Session Management, Next: Regions, Prev: Selecting, Up: Top
+
+Session Management Commands
+***************************
+
+ Perhaps the most useful feature of `screen' is the way it allows the
+user to move a session between terminals, by detaching and reattaching.
+This also makes life easier for modem users who have to deal with
+unexpected loss of carrier.
+
+* Menu:
+
+* Detach:: Disconnect `screen' from your terminal.
+* Power Detach:: Detach and log out.
+* Lock:: Lock your terminal temporarily.
+* Multiuser Session:: Changing number of allowed users.
+* Session Name:: Rename your session for later reattachment.
+* Suspend:: Suspend your session.
+* Quit:: Terminate your session.
+
+
File: screen.info, Node: Detach, Next: Power Detach, Up: Session Management
Detach
======
- - Command: autodetach STATE
+ - Command: autodetach state
(none)
Sets whether `screen' will automatically detach upon hangup, which
saves all your running programs until they are resumed with a
@@ -37,9 +132,11 @@ Detach
(`C-a d', `C-a C-d')
Detach the `screen' session (disconnect it from the terminal and
put it into the background). A detached `screen' can be resumed by
- invoking `screen' with the `-r' option. (*note Invoking Screen::.)
+ invoking `screen' with the `-r' option (*note Invoking Screen::).
+ The `-h' option tells screen to immediately close the connection
+ to the terminal (`hangup').
- - Command: password [CRYPTED_PW]
+ - Command: password [crypted_pw]
(none)
Present a crypted password in your `.screenrc' file and screen will
ask for it, whenever someone attempts to resume a detached
@@ -60,10 +157,10 @@ Power Detach
(`C-a D')
Mainly the same as `detach', but also sends a HANGUP signal to the
parent process of `screen'.
- *Caution*: This will result in a logout if `screen' was started
+ _Caution_: This will result in a logout if `screen' was started
from your login shell.
- - Command: pow_detach_msg [MESSAGE]
+ - Command: pow_detach_msg [message]
(none)
The MESSAGE specified here is output whenever a power detach is
performed. It may be used as a replacement for a logout message or
@@ -219,8 +316,8 @@ File: screen.info, Node: Umask, Next: Wall, Prev: Displays, Up: Multiuser Se
aclumask
--------
- - Command: aclumask [[USERS]+BITS |[USERS]-BITS .... ]
- - Command: umask [[USERS]+BITS |[USERS]-BITS .... ]
+ - Command: aclumask [USERS]+/-BITS ...
+ - Command: umask [USERS]+/-BITS ...
(none)
This specifies the access other users have to windows that will
be created by the caller of the command. USERS may be no, one
@@ -298,7 +395,7 @@ Session Name
Rename the current session. Note that for `screen -list' the name
shows up with the process-id prepended. If the argument NAME is
omitted, the name of this session is displayed.
- *Caution*: The `$STY' environment variable still reflects the old
+ _Caution_: The `$STY' environment variable still reflects the old
name. This may result in confusion. The default is constructed
from the tty and host names.
@@ -326,7 +423,7 @@ Quit
terminals the keys `C-4' and `C-\' are identical. So be careful
not to type `C-a C-4' when selecting window no. 4. Use the empty
bind command (as in `bind "^\"') to remove a key binding (*note
- Key Binding::.).
+ Key Binding::).

File: screen.info, Node: Regions, Next: Window Settings, Prev: Session Management, Up: Top
@@ -344,7 +441,9 @@ contain different windows.
* Focus:: Change to the next region
* Only:: Delete all other regions
* Remove:: Delete the current region
+* Resize:: Grow or shrink a region
* Caption:: Control the window's caption
+* Fit:: Resize a window to fit the region

File: screen.info, Node: Split, Next: Focus, Up: Regions
@@ -365,9 +464,16 @@ Focus
=====
- Command: focus
- (`C-a Tab')
+ (`C-a <Tab>')
Move the input focus to the next region. This is done in a cyclic
- way so that the top region is selected after the bottom one.
+ way so that the top region is selected after the bottom one. If no
+ subcommand is given it defaults to `down'. `up' cycles in the
+ opposite order, `top' and `bottom' go to the top and bottom region
+ respectively. Useful bindings are (j and k as in vi)
+ bind j focus down
+ bind k focus up
+ bind t focus top
+ bind b focus bottom

File: screen.info, Node: Only, Next: Remove, Prev: Focus, Up: Regions
@@ -380,7 +486,7 @@ Only
Kill all regions but the current one.

-File: screen.info, Node: Remove, Next: Caption, Prev: Only, Up: Regions
+File: screen.info, Node: Remove, Next: Resize, Prev: Only, Up: Regions
Remove
======
@@ -391,13 +497,31 @@ Remove
region.

-File: screen.info, Node: Caption, Prev: Remove, Up: Regions
+File: screen.info, Node: Resize, Next: Caption, Prev: Remove, Up: Regions
+
+Resize
+======
+
+ - Command: resize [(+/-)LINES]
+ (none)
+ Resize the current region. The space will be removed from or added
+ to the region below or if there's not enough space from the region
+ above.
+ resize +N increase current region height by N
+ resize -N decrease current region height by N
+ resize N set current region height to N
+ resize = make all windows equally high
+ resize max maximize current region height
+ resize min minimize current region height
+
+
+File: screen.info, Node: Caption, Next: Fit, Prev: Resize, Up: Regions
Caption
=======
- - Command: caption `always'|`splitonly' [STRING]
- - Command: caption `string' [STRING]
+ - Command: caption `always'|`splitonly' [string]
+ - Command: caption `string' [string]
(none)
This command controls the display of the window captions. Normally
a caption is only used if more than one window is shown on the
@@ -406,13 +530,25 @@ Caption
default is `splitonly'.
The second form changes the text used for the caption. You can use
- all string escapes (*Note String Escapes::). `Screen' uses a
+ all string escapes (*note String Escapes::). `Screen' uses a
default of `%3n %t'.
You can mix both forms by providing the string as an additional
argument.

+File: screen.info, Node: Fit, Prev: Caption, Up: Regions
+
+Fit
+===
+
+ - Command: fit
+ (`C-a F')
+ Change the window size to the size of the current region. This
+ command is needed because screen doesn't adapt the window size
+ automatically if the window is displayed more than once.
+
+
File: screen.info, Node: Window Settings, Next: Virtual Terminal, Prev: Regions, Up: Top
Window Settings
@@ -440,19 +576,19 @@ Naming Windows (Titles)
=======================
You can customize each window's name in the window display (viewed
-with the `windows' command (*note Windows::.) by setting it with one of
+with the `windows' command (*note Windows::) by setting it with one of
the title commands. Normally the name displayed is the actual command
name of the program created in the window. However, it is sometimes
useful to distinguish various programs of the same name or to change
the name on-the-fly to reflect the current state of the window.
The default name for all shell windows can be set with the
-`shelltitle' command (*note Shell::.). You can specify the name you
+`shelltitle' command (*note Shell::). You can specify the name you
want for a window with the `-t' option to the `screen' command when the
-window is created (*note Screen Command::.). To change the name after
+window is created (*note Screen Command::). To change the name after
the window has been created you can use the title-string escape-sequence
-(`ESC k NAME ESC \') and the `title' command (C-a A). The former can
-be output from an application to control the window's name under
+(`<ESC> k NAME <ESC> \') and the `title' command (C-a A). The former
+can be output from an application to control the window's name under
software control, and the latter will prompt for a name when typed.
You can also bind predefined names to keys with the `title' command to
set things quickly without prompting.
@@ -470,7 +606,7 @@ File: screen.info, Node: Title Command, Next: Dynamic Titles, Up: Naming Wind
Title Command
-------------
- - Command: title [WINDOWTITLE]
+ - Command: title [windowtitle]
(`C-a A')
Set the name of the current window to WINDOWALIAS. If no name is
specified, screen prompts for one.
@@ -492,16 +628,16 @@ Otherwise the current command name supersedes the shell name while it
is running.
Here's how it works: you must modify your shell prompt to output a
-null title-escape-sequence (ESC k ESC \) as a part of your prompt. The
-last part of your prompt must be the same as the string you specified
-for the SEARCH portion of the title. Once this is set up, `screen'
-will use the title-escape-sequence to clear the previous command name
-and get ready for the next command. Then, when a newline is received
-from the shell, a search is made for the end of the prompt. If found,
-it will grab the first word after the matched string and use it as the
-command name. If the command name begins with `!', `%', or `^',
-`screen' will use the first word on the following line (if found) in
-preference to the just-found name. This helps csh users get more
+null title-escape-sequence (<ESC> k <ESC> \) as a part of your prompt.
+The last part of your prompt must be the same as the string you
+specified for the SEARCH portion of the title. Once this is set up,
+`screen' will use the title-escape-sequence to clear the previous
+command name and get ready for the next command. Then, when a newline
+is received from the shell, a search is made for the end of the prompt.
+If found, it will grab the first word after the matched string and use
+it as the command name. If the command name begins with `!', `%', or
+`^', `screen' will use the first word on the following line (if found)
+in preference to the just-found name. This helps csh users get more
accurate titles when using job control or history recall commands.

@@ -593,7 +729,7 @@ Console
- Command: console [STATE]
(none)
Grabs or un-grabs the machines console output to a window. When
- the argument is omitted the current state is displayed. *Note*:
+ the argument is omitted the current state is displayed. _Note_:
Only the owner of `/dev/console' can grab the console output. This
command is only available if the host supports the ioctl
`TIOCCONS'.
@@ -607,17 +743,17 @@ Kill
- Command: kill
(`C-a k', `C-a C-k')
Kill the current window.
- If there is an `exec' command running (*note Exec::.) then it is
+ If there is an `exec' command running (*note Exec::) then it is
killed. Otherwise the process (e.g. shell) running in the window
receives a `HANGUP' condition, the window structure is removed and
screen (your display) switches to another window. When the last
window is destroyed, `screen' exits. After a kill screen switches
to the previously displayed window.
- *Caution*: `emacs' users may find themselves killing their `emacs'
+ _Caution_: `emacs' users may find themselves killing their `emacs'
session when trying to delete the current line. For this reason,
it is probably wise to use a different command character (*note
- Command Character::.) or rebind `kill' to another key sequence,
- such as `C-a K' (*note Key Binding::.).
+ Command Character::) or rebind `kill' to another key sequence,
+ such as `C-a K' (*note Key Binding::).

File: screen.info, Node: Login, Next: Mode, Prev: Kill, Up: Window Settings
@@ -625,21 +761,21 @@ File: screen.info, Node: Login, Next: Mode, Prev: Kill, Up: Window Settings
Login
=====
- - Command: deflogin STATE
+ - Command: deflogin state
(none)
Same as the `login' command except that the default setting for new
windows is changed. This defaults to `on' unless otherwise
- specified at compile time (*note Installation::.). Both commands
+ specified at compile time (*note Installation::). Both commands
are only present when `screen' has been compiled with utmp support.
- - Command: login [STATE]
+ - Command: login [state]
(`C-a L')
Adds or removes the entry in `/etc/utmp' for the current window.
This controls whether or not the window is "logged in". In
addition to this toggle, it is convenient to have "log in" and
"log out" keys. For instance, `bind I login on' and `bind O login
off' will map these keys to be `C-a I' and `C-a O' (*note Key
- Binding::.).
+ Binding::).

File: screen.info, Node: Mode, Next: Monitor, Prev: Login, Up: Window Settings
@@ -647,12 +783,12 @@ File: screen.info, Node: Mode, Next: Monitor, Prev: Login, Up: Window Settin
Mode
====
- - Command: defmode MODE
+ - Command: defmode mode
(none)
The mode of each newly allocated pseudo-tty is set to MODE. MODE
is an octal number as used by chmod(1). Defaults to 0622 for
windows which are logged in, 0600 for others (e.g. when `-ln' was
- specified for creation. *note Screen Command::.).
+ specified for creation, *note Screen Command::).

File: screen.info, Node: Monitor, Next: Windows, Prev: Mode, Up: Window Settings
@@ -660,7 +796,7 @@ File: screen.info, Node: Monitor, Next: Windows, Prev: Mode, Up: Window Sett
Monitoring
==========
- - Command: activity MESSAGE
+ - Command: activity message
(none)
When any activity occurs in a background window that is being
monitored, `screen' displays a notification in the message line.
@@ -675,19 +811,19 @@ Monitoring
Note that monitoring is off for all windows by default, but can be
altered by use of the `monitor' command (`C-a M').
- - Command: defmonitor STATE
+ - Command: defmonitor state
(none)
Same as the `monitor' command except that the default setting for
new windows is changed. Initial setting is `off'.
- - Command: monitor [STATE]
+ - Command: monitor [state]
(`C-a M')
Toggles monitoring of the current window. When monitoring is
turned on and the affected window is switched into the background,
the activity notification message will be displayed in the status
line at the first sign of output, and the window will also be
- marked with an `@' in the window-status display (*note
- Windows::.). Monitoring defaults to `off' for all windows.
+ marked with an `@' in the window-status display (*note Windows::).
+ Monitoring defaults to `off' for all windows.

File: screen.info, Node: Windows, Next: Hardstatus, Prev: Monitor, Up: Window Settings
@@ -703,10 +839,10 @@ Windows
The current window is marked with a `*'; the previous window is
marked with a `-'; all the windows that are logged in are marked
- with a `$' (*note Login::.); a background window that has received
+ with a `$' (*note Login::); a background window that has received
a bell is marked with a `!'; a background window that is being
monitored and has had activity occur is marked with an `@' (*note
- Monitor::.); a window which has output logging turned on is marked
+ Monitor::); a window which has output logging turned on is marked
with `(L)'; windows occupied by other users are marked with `&' or
`&&' if the window is shared by other users; windows in the zombie
state are marked with `Z'.
@@ -727,7 +863,7 @@ ANSI Application Program Command (APC): `ESC_<string>ESC\'. As a
convenience for xterm users the sequence `ESC]0..2;<string>^G' is also
accepted.
- - Command: defhstatus [STATUS]
+ - Command: defhstatus [status]
(none)
The hardstatus line that all new windows will get is set to STATUS.
This command is useful to make the hardstatus of every window
@@ -739,7 +875,7 @@ accepted.
the current default string is displayed. Per default the
hardstatus line of new windows is empty.
- - Command: hstatus STATUS
+ - Command: hstatus status
(none)
Changes the current window's hardstatus line to STATUS.
@@ -803,8 +939,14 @@ functions, respectively.
Outputs a string directly to the host
terminal without interpretation.
ESC _ (A) Application Program Command (Hardstatus)
- ESC ] (A) Operating System Command (Hardstatus, xterm
+ ESC ] 0 ; string ^G (A) Operating System Command (Hardstatus, xterm
title hack)
+ ESC ] 83 ; cmd ^G (A) Execute screen command. This only works if
+ multi-user support is compiled into screen.
+ The pseudo-user ":window:" is used to check
+ the access control list. Use "addacl :window:
+ -rwx #?" to create a user with no rights and
+ allow only the needed commands.
Control-N (A) Lock Shift G1 (SO)
Control-O (A) Lock Shift G0 (SI)
ESC n (A) Lock Shift G2
@@ -825,6 +967,7 @@ functions, respectively.
Pn = None or 0 From Cursor to End of Line
1 From Beginning of Line to Cursor
2 Entire Line
+ ESC [ Pn X Erase character
ESC [ Pn A Cursor Up
ESC [ Pn B Cursor Down
ESC [ Pn C Cursor Right
@@ -857,8 +1000,8 @@ functions, respectively.
37 (A) Foreground White
39 (A) Foreground Default
40 (A) Background Black
- ... ...
- 49 (A) Background Default
+ ... ...
+ 49 (A) Background Default
ESC [ Pn g Tab Clear
Pn = None or 0 Clear Tab at Current Position
3 Clear All Tabs
@@ -882,7 +1025,9 @@ functions, respectively.
?5 (V) Reverse Video
?6 (V) `Origin' Mode
?7 (V) `Wrap' Mode
+ ?9 X10 mouse tracking
?25 (V) Visible Cursor
+ ?1000 (V) VT200 mouse tracking
ESC [ 5 i (A) Start relay to printer (ANSI Media Copy)
ESC [ 4 i (A) Stop relay to printer (ANSI Media Copy)
ESC [ 8 ; Ph ; Pw t Resize the window to `Ph' lines and
@@ -904,11 +1049,11 @@ on the user's keyboard and insert the VT100 style escape sequence.
`Screen' has a very flexible way of doing this by making it possible to
map arbitrary commands on arbitrary sequences of characters. For
standard VT100 emulation the command will always insert a string in the
-input buffer of the window (see also command `stuff', *note Paste::.).
+input buffer of the window (see also command `stuff', *note Paste::).
Because the sequences generated by a keypress can change after a
reattach from a different terminal type, it is possible to bind
commands to the termcap name of the keys. `Screen' will insert the
-correct binding after each reattach. *Note Bindkey:: for further
+correct binding after each reattach. See *Note Bindkey:: for further
details on the syntax and examples.
Here is the table of the default key bindings. (A) means that the
@@ -935,9 +1080,8 @@ command is executed if the keyboard is switched into application mode.
Function key 8 k8 stuff \033[19~
Function key 9 k9 stuff \033[20~
Function key 10 k; stuff \033[21~
- Function key 11 F1 stuff \033[22~
- Function key 12 F2 stuff \033[23~
- Backspace kb stuff \010
+ Function key 11 F1 stuff \033[23~
+ Function key 12 F2 stuff \033[24~
Home kh stuff \033[1~
End kH stuff \033[4~
Insert kI stuff \033[2~
@@ -987,7 +1131,7 @@ File: screen.info, Node: Digraph, Next: Bell, Prev: Input Translation, Up: V
Digraph
=======
- - Command: digraph [PRESET]
+ - Command: digraph [preset]
(none)
This command prompts the user for a digraph sequence. The next two
characters typed are looked up in a builtin table and the
@@ -1006,7 +1150,7 @@ File: screen.info, Node: Bell, Next: Clear, Prev: Digraph, Up: Virtual Termi
Bell
====
- - Command: bell_msg [MESSAGE]
+ - Command: bell_msg [message]
(none)
When a bell character is sent to a background window, `screen'
displays a notification in the message line. The notification
@@ -1022,7 +1166,7 @@ Bell
suppress output of a message line (`bell_msg ""'). Without
parameter, the current message is shown.
- - Command: vbell [STATE]
+ - Command: vbell [state]
(`C-a C-g')
Sets or toggles the visual bell setting for the current window. If
`vbell' is switched to `on', but your terminal does not support a
@@ -1034,7 +1178,7 @@ Bell
Per default, `vbell' is `off', thus the audible bell is used.
- - Command: vbell_msg [MESSAGE]
+ - Command: vbell_msg [message]
(none)
Sets the visual bell message. MESSAGE is printed to the status
line if the window receives a bell character (^G), `vbell' is set
@@ -1042,7 +1186,7 @@ Bell
default message is `Wuff, Wuff!!'. Without parameter, the current
message is shown.
- - Command: vbellwait SEC
+ - Command: vbellwait sec
(none)
Define a delay in seconds after each display of `screen' 's visual
bell message. The default is 1 second.
@@ -1069,8 +1213,8 @@ Info
window: the cursor position in the form `(COLUMN,ROW)' starting
with `(1,1)', the terminal width and height plus the size of the
scrollback buffer in lines, like in `(80,24)+50', the current
- state of window XON/XOFF flow control is shown like this (see also
- *Note Flow Control::):
+ state of window XON/XOFF flow control is shown like this (*note
+ Flow Control::):
+flow automatic flow control, currently on.
-flow automatic flow control, currently off.
+(+)flow flow control enabled. Agrees with automatic control.
@@ -1087,9 +1231,10 @@ Info
The currently active character set (`G0', `G1', `G2', or `G3'),
and in square brackets the terminal character sets that are
- currently designated as `G0' through `G3'. Additional modes
+ currently designated as `G0' through `G3'. If the window is in
+ UTF-8 mode, the string `UTF-8' is shown instead. Additional modes
depending on the type of the window are displayed at the end of
- the status line (*note Window Types::.).
+ the status line (*note Window Types::).
If the state machine of the terminal emulator is in a non-default
state, the info line is started with a string identifying the
@@ -1097,159 +1242,8 @@ Info
For system information use `time'.
-
-File: screen.info, Node: Redisplay, Next: Wrap, Prev: Info, Up: Virtual Terminal
-
-Redisplay
-=========
-
- - Command: allpartial STATE
- (none)
- If set to on, only the current cursor line is refreshed on window
- change. This affects all windows and is useful for slow terminal
- lines. The previous setting of full/partial refresh for each
- window is restored with `allpartial off'. This is a global flag
- that immediately takes effect on all windows overriding the
- `partial' settings. It does not change the default redraw behavior
- of newly created windows.
-
- - Command: partial STATE
- (none)
- Defines whether the display should be refreshed (as with
- `redisplay') after switching to the current window. This command
- only affects the current window. To immediately affect all
- windows use the `allpartial' command. Default is `off', of
- course. This default is fixed, as there is currently no
- `defpartial' command.
-
- - Command: redisplay
- (`C-a l', `C-a C-l')
- Redisplay the current window. Needed to get a full redisplay in
- partial redraw mode.
-
-
-File: screen.info, Node: Wrap, Next: Reset, Prev: Redisplay, Up: Virtual Terminal
-
-Wrap
-====
-
- - Command: wrap STATE
- (`C-a r', `C-a C-r')
- Sets the line-wrap setting for the current window. When line-wrap
- is on, the second consecutive printable character output at the
- last column of a line will wrap to the start of the following
- line. As an added feature, backspace (^H) will also wrap through
- the left margin to the previous line. Default is `on'.
-
- - Command: defwrap STATE
+ - Command: dinfo
(none)
- Same as the `wrap' command except that the default setting for new
- windows is changed. Initially line-wrap is on and can be toggled
- with the `wrap' command (`C-a r') or by means of "C-a : wrap
- on|off".
-
-
-File: screen.info, Node: Reset, Next: Window Size, Prev: Wrap, Up: Virtual Terminal
-
-Reset
-=====
-
- - Command: reset
- (`C-a Z')
- Reset the virtual terminal to its "power-on" values. Useful when
- strange settings (like scroll regions or graphics character set)
- are left over from an application.
-
-
-File: screen.info, Node: Window Size, Next: Character Processing, Prev: Reset, Up: Virtual Terminal
-
-Window Size
-===========
-
- - Command: width [NUM]
- (`C-a W')
- Toggle the window width between 80 and 132 columns, or set it to
- NUM columns if an argument is specified. This requires a capable
- terminal and the termcap entries `Z0' and `Z1'. See the `termcap'
- command (*note Termcap::.), for more information.
-
- - Command: height [LINES]
- (none)
- Set the display height to a specified number of lines. When no
- argument is given it toggles between 24 and 42 lines display.
-
- - Command: fit
- (`C-a F')
- Change the window size to the size of the current region. This
- command is needed because screen doesn't adapt the window size
- automatically if the window is displayed more than once.
-
-
-File: screen.info, Node: Character Processing, Prev: Window Size, Up: Virtual Terminal
-
-Character Processing
-====================
-
- - Command: c1 [STATE]
- (none)
- Change c1 code processing. `c1 on' tells screen to treat the input
- characters between 128 and 159 as control functions. Such an
- 8-bit code is normally the same as ESC followed by the
- corresponding 7-bit code. The default setting is to process c1
- codes and can be changed with the `defc1' command. Users with
- fonts that have usable characters in the c1 positions may want to
- turn this off.
-
-
- - Command: gr [STATE]
- (none)
- Turn GR charset switching on/off. Whenever screen sees an input
- char with an 8th bit set, it will use the charset stored in the GR
- slot and print the character with the 8th bit stripped. The
- default (see also `defgr') is not to process GR switching because
- otherwise the ISO88591 charset would not work.
-
- - Command: kanji WTYPE [DTYPE]
- (none)
- Tell screen how to process kanji input/output. WTYPE and DTYPE
- must be one of the strings `jis', `euc' or `sjis'. The first
- argument sets the kanji type of the current window. Each window
- can emulate a different type. The optional second parameter tells
- screen how to write the kanji codes to the connected terminal. The
- preferred method of setting the display type is to use the `KJ'
- termcap entry. *Note Special Capabilities::. See also `defkanji',
- which changes the default setting of a new window.
-
- - Command: charset SET
- (none)
- Change the current character set slot designation and charset
- mapping. The first four character of SET are treated as charset
- designators while the fifth and sixth character must be in range
- `0' to `3' and set the GL/GR charset mapping. On every position a
- `.' may be used to indicate that the corresponding charset/mapping
- should not be changed (SET is padded to six characters internally
- by appending `.' chars). New windows have `BBBB02' as default
- charset, unless a `kanji' command is active.
-
- The current setting can be viewed with the *Note Info:: command.
-
- - Command: defc1 STATE
- (none)
- Same as the `c1' command except that the default setting for new
- windows is changed. Initial setting is `on'.
-
- - Command: defgr STATE
- (none)
- Same as the `gr' command except that the default setting for new
- windows is changed. Initial setting is `off'.
-
- - Command: defkanji WTYPE
- (none)
- Same as the `kanji' command except that the default setting for
- new windows is changed. Initial setting is `off', i.e. `jis'.
-
- - Command: defcharset [SET]
- Like the `charset' command except that the default setting for new
- windows is changed. Shows current default if called without
- argument.
+ Show what screen thinks about your terminal. Useful if you want to
+ know why features like color or the alternate charset don't work.
diff --git a/doc/screen.info-3 b/doc/screen.info-3
index 809a4e8..298f9e3 100644
--- a/doc/screen.info-3
+++ b/doc/screen.info-3
@@ -1,9 +1,14 @@
-This is Info file screen.info, produced by Makeinfo-1.55 from the input
-file ./screen.texinfo.
+This is screen.info, produced by makeinfo version 4.0 from
+./screen.texinfo.
+
+INFO-DIR-SECTION General Commands
+START-INFO-DIR-ENTRY
+* Screen: (screen). Full-screen window manager.
+END-INFO-DIR-ENTRY
This file documents the `Screen' virtual terminal manager.
- Copyright (c) 1993-1995 Free Software Foundation, Inc.
+ Copyright (c) 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -20,6 +25,194 @@ versions, except that this permission notice may be stated in a
translation approved by the Foundation.

+File: screen.info, Node: Redisplay, Next: Wrap, Prev: Info, Up: Virtual Terminal
+
+Redisplay
+=========
+
+ - Command: allpartial state
+ (none)
+ If set to on, only the current cursor line is refreshed on window
+ change. This affects all windows and is useful for slow terminal
+ lines. The previous setting of full/partial refresh for each
+ window is restored with `allpartial off'. This is a global flag
+ that immediately takes effect on all windows overriding the
+ `partial' settings. It does not change the default redraw behavior
+ of newly created windows.
+
+ - Command: partial state
+ (none)
+ Defines whether the display should be refreshed (as with
+ `redisplay') after switching to the current window. This command
+ only affects the current window. To immediately affect all
+ windows use the `allpartial' command. Default is `off', of
+ course. This default is fixed, as there is currently no
+ `defpartial' command.
+
+ - Command: redisplay
+ (`C-a l', `C-a C-l')
+ Redisplay the current window. Needed to get a full redisplay in
+ partial redraw mode.
+
+
+File: screen.info, Node: Wrap, Next: Reset, Prev: Redisplay, Up: Virtual Terminal
+
+Wrap
+====
+
+ - Command: wrap state
+ (`C-a r', `C-a C-r')
+ Sets the line-wrap setting for the current window. When line-wrap
+ is on, the second consecutive printable character output at the
+ last column of a line will wrap to the start of the following
+ line. As an added feature, backspace (^H) will also wrap through
+ the left margin to the previous line. Default is `on'.
+
+ - Command: defwrap state
+ (none)
+ Same as the `wrap' command except that the default setting for new
+ windows is changed. Initially line-wrap is on and can be toggled
+ with the `wrap' command (`C-a r') or by means of "C-a : wrap
+ on|off".
+
+
+File: screen.info, Node: Reset, Next: Window Size, Prev: Wrap, Up: Virtual Terminal
+
+Reset
+=====
+
+ - Command: reset
+ (`C-a Z')
+ Reset the virtual terminal to its "power-on" values. Useful when
+ strange settings (like scroll regions or graphics character set)
+ are left over from an application.
+
+
+File: screen.info, Node: Window Size, Next: Character Processing, Prev: Reset, Up: Virtual Terminal
+
+Window Size
+===========
+
+ - Command: width [`-w'|`-d'] [cols [lines]]
+ (`C-a W')
+ Toggle the window width between 80 and 132 columns, or set it to
+ COLS columns if an argument is specified. This requires a capable
+ terminal and the termcap entries `Z0' and `Z1'. See the `termcap'
+ command (*note Termcap::), for more information. You can also
+ specify a height if you want to change both values. The `-w'
+ option tells screen to leave the display size unchanged and just
+ set the window size, `-d' vice versa.
+
+ - Command: height [`-w'|`-d'] [lines [cols]]
+ (none)
+ Set the display height to a specified number of lines. When no
+ argument is given it toggles between 24 and 42 lines display.
+
+
+File: screen.info, Node: Character Processing, Prev: Window Size, Up: Virtual Terminal
+
+Character Processing
+====================
+
+ - Command: c1 [state]
+ (none)
+ Change c1 code processing. `c1 on' tells screen to treat the input
+ characters between 128 and 159 as control functions. Such an
+ 8-bit code is normally the same as ESC followed by the
+ corresponding 7-bit code. The default setting is to process c1
+ codes and can be changed with the `defc1' command. Users with
+ fonts that have usable characters in the c1 positions may want to
+ turn this off.
+
+
+ - Command: gr [state]
+ (none)
+ Turn GR charset switching on/off. Whenever screen sees an input
+ char with an 8th bit set, it will use the charset stored in the GR
+ slot and print the character with the 8th bit stripped. The
+ default (see also `defgr') is not to process GR switching because
+ otherwise the ISO88591 charset would not work.
+
+ - Command: bce [state]
+ (none)
+ Change background-color-erase setting. If `bce' is set to on, all
+ characters cleared by an erase/insert/scroll/clear operation will
+ be displayed in the current background color. Otherwise the
+ default background color is used.
+
+ - Command: encoding enc [denc]
+ (none)
+ Tell screen how to interpret the input/output. The first argument
+ sets the encoding of the current window. Each window can emulate
+ a different encoding. The optional second parameter overwrites the
+ encoding of the connected terminal. It should never be needed as
+ screen uses the locale setting to detect the encoding. There is
+ also a way to select a terminal encoding depending on the terminal
+ type by using the `KJ' termcap entry. *Note Special Capabilities::.
+
+ Supported encodings are `eucJP', `SJIS', `eucKR', `eucCN', `Big5',
+ `KOI8-R', `CP1251', `UTF-8', `ISO8859-2', `ISO8859-3',
+ `ISO8859-4', `ISO8859-5', `ISO8859-6', `ISO8859-7', `ISO8859-8',
+ `ISO8859-9', `ISO8859-10', `ISO8859-15', `jis'.
+
+ See also `defencoding', which changes the default setting of a new
+ window.
+
+ - Command: charset set
+ (none)
+ Change the current character set slot designation and charset
+ mapping. The first four character of SET are treated as charset
+ designators while the fifth and sixth character must be in range
+ `0' to `3' and set the GL/GR charset mapping. On every position a
+ `.' may be used to indicate that the corresponding charset/mapping
+ should not be changed (SET is padded to six characters internally
+ by appending `.' chars). New windows have `BBBB02' as default
+ charset, unless a `encoding' command is active.
+
+ The current setting can be viewed with the *Note Info:: command.
+
+ - Command: utf8 [state [dstate]]
+ (none)
+ Change the encoding used in the current window. If utf8 is
+ enabled, the strings sent to the window will be UTF-8 encoded and
+ vice versa. Omitting the parameter toggles the setting. If a
+ second parameter is given, the display's encoding is also changed
+ (this should rather be done with screen's `-U' option). See also
+ `defutf8', which changes the default setting of a new window.
+
+ - Command: defc1 state
+ (none)
+ Same as the `c1' command except that the default setting for new
+ windows is changed. Initial setting is `on'.
+
+ - Command: defgr state
+ (none)
+ Same as the `gr' command except that the default setting for new
+ windows is changed. Initial setting is `off'.
+
+ - Command: defbce state
+ (none)
+ Same as the `bce' command except that the default setting for new
+ windows is changed. Initial setting is `off'.
+
+ - Command: defencoding enc
+ (none)
+ Same as the `encoding' command except that the default setting for
+ new windows is changed. Initial setting is the encoding taken from
+ the terminal.
+
+ - Command: defcharset [set]
+ Like the `charset' command except that the default setting for new
+ windows is changed. Shows current default if called without
+ argument.
+
+ - Command: defutf8 state
+ (none)
+ Same as the `utf8' command except that the default setting for new
+ windows is changed. Initial setting is `on' if screen was started
+ with `-U', otherwise `off'.
+
+
File: screen.info, Node: Copy and Paste, Next: Subprocess Execution, Prev: Virtual Terminal, Up: Top
Copy and Paste
@@ -34,7 +227,7 @@ windowing systems.
* Copy:: Copy from scrollback to buffer
* Paste:: Paste from buffer into window
* Registers:: Longer-term storage
-* Screen-Exchange:: Sharing data between screen users
+* Screen Exchange:: Sharing data between screen users
* History:: Recalling previous input

@@ -44,7 +237,7 @@ Copying
=======
- Command: copy
- (`C-a [', `C-a C-[', `C-a ESC')
+ (`C-a [', `C-a C-[', `C-a <ESC>')
Enter copy/scrollback mode. This allows you to copy text from the
current window and its history into the paste buffer. In this mode
a `vi'-like full screen editor is active, with controls as
@@ -67,7 +260,7 @@ File: screen.info, Node: Line Termination, Next: Scrollback, Up: Copy
CR/LF
-----
- - Command: crlf [STATE]
+ - Command: crlf [state]
(none)
This affects the copying of text regions with the `C-a [' command.
If it is set to `on', lines will be separated by the two character
@@ -80,18 +273,18 @@ File: screen.info, Node: Scrollback, Next: Copy Mode Keys, Prev: Line Termina
Scrollback
----------
- - Command: defscrollback NUM
+ - Command: defscrollback num
(none)
Same as the `scrollback' command except that the default setting
for new windows is changed. Defaults to 100.
- - Command: scrollback NUM
+ - Command: scrollback num
(none)
Set the size of the scrollback buffer for the current window to
NUM lines. The default scrollback is 100 lines. Use `C-a i' to
view the current setting.
- - Command: compacthist [STATE]
+ - Command: compacthist [state]
(none)
This tells screen weather to suppress trailing blank lines when
scrolling up text into the history buffer. Turn compacting `on' to
@@ -103,7 +296,7 @@ File: screen.info, Node: Copy Mode Keys, Next: Movement, Prev: Scrollback, U
markkeys
--------
- - Command: markkeys STRING
+ - Command: markkeys string
(none)
This is a method of changing the keymap used for copy/history
mode. The string is made up of OLDCHAR=NEWCHAR pairs which are
@@ -111,7 +304,7 @@ markkeys
would set some keys to be more familiar to `emacs' users. If your
terminal sends characters, that cause you to abort copy mode, then
this command may help by binding these characters to do nothing.
- The no-op character is `' and is used like this: `markkeys @=L=H'
+ The no-op character is `a'nd is used like this: `markkeys @=L=H'
if you do not want to use the `H' or `L' commands any longer. As
shown in this example, multiple keys can be assigned to one
function in a single statement.
@@ -192,6 +385,11 @@ Searching
`C-r' `emacs' style reverse i-search.
+ - Command: ignorecase [state]
+ (none)
+ Tell screen to ignore the case of caracters in searches. Default is
+ `off'.
+

File: screen.info, Node: Specials, Prev: Searching, Up: Copy
@@ -231,7 +429,7 @@ of the paste buffer will not be overwritten, but appended to.
`>' sets the (second) mark and writes the contents of the paste buffer
to the screen-exchange file (`/tmp/screen-exchange' per default) once
-copy-mode is finished. *Note Screen-Exchange::.
+copy-mode is finished. *Note Screen Exchange::.
This example demonstrates how to dump the whole scrollback buffer to
that file:
`C-a [ g SPACE G $ >'.
@@ -251,7 +449,7 @@ File: screen.info, Node: Paste, Next: Registers, Prev: Copy, Up: Copy and Pa
Paste
=====
- - Command: paste [REGISTERS [DESTINATION]]
+ - Command: paste [registers [destination]]
(`C-a ]', `C-a C-]')
Write the (concatenated) contents of the specified registers to
the stdin stream of the current window. The register `.' is
@@ -271,13 +469,13 @@ Paste
attached), as the registers are a global resource. The paste
buffer exists once for every user.
- - Command: pastefont [STATE]
+ - Command: pastefont [state]
Tell screen to include font information in the paste buffer. The
default is not to do so. This command is especially usefull for
multi character fonts like kanji.
- - Command: slowpaste MSEC
- - Command: defslowpaste MSEC
+ - Command: slowpaste msec
+ - Command: defslowpaste msec
(none)
Define the speed text is inserted in the current window by the
`paste' command. If the slowpaste value is nonzero text is written
@@ -287,35 +485,36 @@ Paste
control problems while pasting large amounts of text.
`defslowpaste' specifies the default for new windows.
- - Command: readreg [REGISTER [FILENAME]]
+ - Command: readreg [-e encoding] [register [filename]]
(none)
Does one of two things, dependent on number of arguments: with
zero or one arguments it it duplicates the paste buffer contents
into the register specified or entered at the prompt. With two
arguments it reads the contents of the named file into the
register, just as `readbuf' reads the screen-exchange file into
- the paste buffer. The following example will paste the system's
- password file into the screen window (using register p, where a
- copy remains):
+ the paste buffer. You can tell screen the encoding of the file
+ via the `-e' option. The following example will paste the
+ system's password file into the screen window (using register p,
+ where a copy remains):
C-a : readreg p /etc/passwd
C-a : paste p

-File: screen.info, Node: Registers, Next: Screen-Exchange, Prev: Paste, Up: Copy and Paste
+File: screen.info, Node: Registers, Next: Screen Exchange, Prev: Paste, Up: Copy and Paste
Registers
=========
- - Command: copy_reg [KEY]
+ - Command: copy_reg [key]
(none)
Removed. Use `readreg' instead.
- - Command: ins_reg [KEY]
+ - Command: ins_reg [key]
(none)
Removed. Use `paste' instead.
- - Command: process [KEY]
+ - Command: process [key]
(none)
Stuff the contents of the specified register into the `screen'
input queue. If no argument is given you are prompted for a
@@ -323,22 +522,23 @@ Registers
the user's keyboard. This command can be used to bind multiple
actions to a single key.
- - Command: register KEY STRING
+ - Command: register [-e encoding] key string
(none)
- Save the specified STRING to the register KEY.
+ Save the specified STRING to the register KEY. The encoding of
+ the string can be specified via the `-e' option.
- - Command: stuff STRING
+ - Command: stuff string
(none)
Stuff the string STRING in the input buffer of the current window.
This is like the `paste' command, but with much less overhead.
You cannot paste large buffers with the `stuff' command. It is most
- useful for key bindings. *Note Bindkey::
+ useful for key bindings. *Note Bindkey::.

-File: screen.info, Node: Screen-Exchange, Next: History, Prev: Registers, Up: Copy and Paste
+File: screen.info, Node: Screen Exchange, Next: History, Prev: Registers, Up: Copy and Paste
-Screen-Exchange
+Screen Exchange
===============
- Command: bufferfile [EXCHANGE-FILE]
@@ -353,24 +553,27 @@ Screen-Exchange
C-a < C-a ]
C-a : bufferfile
- - Command: readbuf
+ - Command: readbuf [-e ENCODING] [FILENAME]
(`C-a <')
- Reads the contents of the current screen-exchange file into the
- paste buffer.
+ Reads the contents of the specified file into the paste buffer.
+ You can tell screen the encoding of the file via the `-e' option.
+ If no file is specified, the screen-exchange filename is used.
- Command: removebuf
(`C-a =')
Unlinks the screen-exchange file.
- - Command: writebuf
+ - Command: writebuf [-e ENCODING] [FILENAME]
(`C-a >')
- Writes the contents of the paste buffer to a public accessible
- screen-exchange file. This is thought of as a primitive means of
- communication between `screen' users on the same host. See also
- `C-a ESC' (*note Copy::.).
+ Writes the contents of the paste buffer to the specified file, or
+ the public accessible screen-exchange file if no filename is given.
+ This is thought of as a primitive means of communication between
+ `screen' users on the same host. If an encoding is specified the
+ paste buffer is recoded on the fly to match the encoding. See also
+ `C-a <ESC>' (*note Copy::).

-File: screen.info, Node: History, Prev: Screen-Exchange, Up: Copy and Paste
+File: screen.info, Node: History, Prev: Screen Exchange, Up: Copy and Paste
History
=======
@@ -513,7 +716,7 @@ File: screen.info, Node: Bind, Next: Bind Examples, Up: Key Binding
The `bind' command
==================
- - Command: bind KEY [COMMAND [ARGS]]
+ - Command: bind [-c class] key [command [args]]
(none)
Bind a command to a key. The KEY argument is either a single
character, a two-character sequence of the form `^x' (meaning
@@ -522,13 +725,17 @@ The `bind' command
character, such as `\^' or `\\'. The argument can also be quoted,
if you like. If no further argument is given, any previously
established binding for this key is removed. The COMMAND argument
- can be any command (*note Command Index::.).
+ can be any command (*note Command Index::).
+
+ If a command class is specified via the `-c' option, the key is
+ bound for the specified class. Use the `command' command to
+ activate a class. Command classes can be used to create multiple
+ command keys or multi-character bindings.
By default, most suitable commands are bound to one or more keys
- (*note Default Key Bindings::.; for instance, the command to
- create a new window is bound to `C-c' and `c'. The `bind' command
- can be used to redefine the key bindings and to define new
- bindings.
+ (*note Default Key Bindings::; for instance, the command to create
+ a new window is bound to `C-c' and `c'. The `bind' command can be
+ used to redefine the key bindings and to define new bindings.

File: screen.info, Node: Bind Examples, Next: Command Character, Prev: Bind, Up: Key Binding
@@ -545,17 +752,29 @@ Some examples:
would bind the space key to the command that displays a list of windows
(so that the command usually invoked by `C-a C-w' would also be
available as `C-a space'), bind `C-f' to the command "create a window
-with a TELNET connection to foobar", and bind ESC to the command that
+with a TELNET connection to foobar", and bind <ESC> to the command that
creates an non-login window with title `root' in slot #9, with a
superuser shell and a scrollback buffer of 1000 lines.
+ bind -c demo1 0 select 10
+ bind -c demo1 1 select 11
+ bind -c demo1 2 select 12
+ bindkey "^B" command -c demo1
+ makes `C-b 0' select window 10, `C-b 1' window 11, etc.
+
+ bind -c demo2 0 select 10
+ bind -c demo2 1 select 11
+ bind -c demo2 2 select 12
+ bind - command -c demo2
+ makes `C-a - 0' select window 10, `C-a - 1' window 11, etc.
+

File: screen.info, Node: Command Character, Next: Help, Prev: Bind Examples, Up: Key Binding
Command Character
=================
- - Command: escape XY
+ - Command: escape xy
(none)
Set the command character to X and the character generating a
literal command character (by triggering the `meta' command) to Y
@@ -566,7 +785,7 @@ Command Character
character, such as `\^' or `\\'. The default is `^Aa', but ```'
is recommended by one of the authors.
- - Command: defescape XY
+ - Command: defescape xy
(none)
Set the default command characters. This is equivalent to the
command `escape' except that it is useful for multiuser sessions
@@ -578,14 +797,15 @@ Command Character
(`C-a a')
Send the command character (`C-a') to the process in the current
window. The keystroke for this command is the second parameter to
- the `-e' command line switch (*note Invoking Screen::.), or the
+ the `-e' command line switch (*note Invoking Screen::), or the
`escape' .screenrc directive.
- - Command: command
+ - Command: command [-c CLASS]
(none)
This command has the same effect as typing the screen escape
character (`C-a'). It is probably only useful for key bindings.
- *Note Bindkey::.
+ If the `-c' option is given, select the specified command class.
+ *Note Bind::, *Note Bindkey::.

File: screen.info, Node: Help, Next: Bindkey, Prev: Command Character, Up: Key Binding
@@ -599,8 +819,9 @@ Help
pages list all the internal commands followed by their bindings.
Subsequent pages will display the custom commands, one command per
key. Press space when you're done reading each page, or return to
- exit early. All other characters are ignored. *Note Default Key
- Bindings::.
+ exit early. All other characters are ignored. If the `-c' option
+ is given, display all bound commands for the specified command
+ class. *Note Default Key Bindings::.

File: screen.info, Node: Bindkey, Next: Bindkey Examples, Prev: Help, Up: Key Binding
@@ -615,8 +836,8 @@ Bindkey
sequence of characters is encountered. There are three tables: one
that should contain actions programmed by the user, one for the
default actions used for terminal emulation and one for screen's
- copy mode to do cursor movement. *Note Input Translation:: for a
- list of default key bindings.
+ copy mode to do cursor movement. See *Note Input Translation:: for
+ a list of default key bindings.
If the `-d' option is given, bindkey modifies the default table,
`-m' changes the copy mode table and with neither option the user
@@ -685,7 +906,7 @@ Bindkey Control
(none)
Like mapdefault, but don't even look in the default bindkey table.
- - Command: maptimeout TIMO
+ - Command: maptimeout timo
(none)
Set the intercharacter timer for input sequence detection to a
timeout of TIMO ms. The default timeout is 300ms. Maptimeout with
@@ -766,7 +987,7 @@ File: screen.info, Node: Flow, Next: XON/XOFF, Prev: Flow Control Summary, U
Flow
====
- - Command: defflow FSTATE [INTERRUPT]
+ - Command: defflow fstate [interrupt]
(none)
Same as the `flow' command except that the default setting for new
windows is changed. Initial setting is `auto'. Specifying `flow
@@ -774,7 +995,7 @@ Flow
`-fa' and `-i'. Note that if `interrupt' is enabled, all existing
displays are changed immediately to forward interrupt signals.
- - Command: flow [FSTATE]
+ - Command: flow [fstate]
(`C-a f', `C-a C-f')
Sets the flow-control mode for this window to FSTATE, which can be
`on', `off' or `auto'. Without parameters it cycles the current
@@ -872,7 +1093,7 @@ the full terminal definition, or a filename where the terminal `screen'
Note that `screen' honors the `terminfo' command if the system uses
the terminfo database rather than termcap. On such machines the
`$TERMCAP' variable has no effect and you must use the `dumptermcap'
-command (*note Dump Termcap::.) and the `tic' program to generate
+command (*note Dump Termcap::) and the `tic' program to generate
terminfo entries for `screen' windows.
When the boolean `G0' capability is present in the termcap entry for
@@ -910,7 +1131,7 @@ or scrolling regions. Note that this may provoke confusion, when the
session is reattached on a different terminal, as the value of
`$TERMCAP' cannot be modified by parent processes. You can force
`screen' to include all capabilities in `$TERMCAP' with the `-a'
-command-line option (*note Invoking Screen::.).
+command-line option (*note Invoking Screen::).

File: screen.info, Node: Dump Termcap, Next: Termcap Syntax, Prev: Window Termcap, Up: Termcap
@@ -923,7 +1144,7 @@ Write out the window's termcap entry
Write the termcap entry for the virtual terminal optimized for the
currently active window to the file `.termcap' in the user's
`$HOME/.screen' directory (or wherever `screen' stores its
- sockets. *note Files::.). This termcap entry is identical to the
+ sockets. *note Files::). This termcap entry is identical to the
value of the environment variable `$TERMCAP' that is set up by
`screen' for each window. For terminfo based systems you will need
to run a converter like `captoinfo' and then compile the entry with
@@ -935,9 +1156,9 @@ File: screen.info, Node: Termcap Syntax, Next: Termcap Examples, Prev: Dump T
The `termcap' command
=====================
- - Command: termcap TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]
- - Command: terminfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]
- - Command: termcapinfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]
+ - Command: termcap term terminal-tweaks [window-tweaks]
+ - Command: terminfo term terminal-tweaks [window-tweaks]
+ - Command: termcapinfo term terminal-tweaks [window-tweaks]
(none)
Use this command to modify your terminal's termcap entry without
going through all the hassles involved in creating a custom
@@ -971,7 +1192,7 @@ your terminal's termcap, and contains definitions that your terminal
uses to perform certain functions. Specify a null string to leave this
unchanged (e.g. ""). The second (optional) tweak modifies all the
window termcaps, and should contain definitions that screen understands
-(*note Virtual Terminal::.).
+(*note Virtual Terminal::).

File: screen.info, Node: Termcap Examples, Next: Special Capabilities, Prev: Termcap Syntax, Up: Termcap
@@ -1022,274 +1243,3 @@ should instead set the `$SCREENCAP' variable prior to running `screen'.
emulation. *Note Termcap: (termcap)Top, for more information on
termcap definitions.
-
-File: screen.info, Node: Special Capabilities, Next: Autonuke, Prev: Termcap Examples, Up: Termcap
-
-Special Terminal Capabilities
-=============================
-
- The following table describes all terminal capabilities that are
-recognized by `screen' and are not in the termcap manual (*note
-Termcap: (termcap)Top.). You can place these capabilities in your
-termcap entries (in `/etc/termcap') or use them with the commands
-`termcap', `terminfo' and `termcapinfo' in your `screenrc' files. It is
-often not possible to place these capabilities in the terminfo database.
-`LP'
- (bool)
- Terminal has VT100 style margins (`magic margins'). Note that this
- capability is obsolete -- `screen' now uses the standard `xn'
- instead.
-
-`Z0'
- (str)
- Change width to 132 columns.
-
-`Z1'
- (str)
- Change width to 80 columns.
-
-`WS'
- (str)
- Resize display. This capability has the desired width and height as
- arguments. SunView(tm) example: `\E[8;%d;%dt'.
-
-`NF'
- (bool)
- Terminal doesn't need flow control. Send ^S and ^Q direct to the
- application. Same as `flow off'. The opposite of this capability
- is `nx'.
-
-`G0'
- (bool)
- Terminal can deal with ISO 2022 font selection sequences.
-
-`S0'
- (str)
- Switch charset `G0' to the specified charset. Default is `\E(%.'.
-
-`E0'
- (str)
- Switch charset `G0' back to standard charset. Default is `\E(B'.
-
-`C0'
- (str)
- Use the string as a conversion table for font 0. See the `ac'
- capability for more details.
-
-`CS'
- (str)
- Switch cursor-keys to application mode.
-
-`CE'
- (str)
- Switch cursor-keys to cursor mode.
-
-`AN'
- (bool)
- Enable autonuke for displays of this terminal type. (*note
- Autonuke::.).
-
-`OL'
- (num)
- Set the output buffer limit. See the `obuflimit' command (*note
- Obuflimit::.) for more details.
-
-`KJ'
- (str)
- Set the kanji type of the terminal. Valid strings are `jis', `euc'
- and `sjis'.
-
-`AF'
- (str)
- Change character foreground color in an ANSI conform way. This
- capability will almost always be set to `\E[3%dm' (`\E[3%p1%dm' on
- terminfo machines).
-
-`AB'
- (str)
- Same as `AF', but change background color.
-
-`AX'
- (bool)
- Does understand ANSI set default fg/bg color (`\E[39m / \E[49m').
-
-`XC'
- (str)
- Describe a translation of characters to strings depending on the
- current font. (*note Character Translation::.).
-
-`TF'
- (bool)
- Add missing capabilities to the termcap/info entry. (Set by
- default).
-
-
-File: screen.info, Node: Autonuke, Next: Obuflimit, Prev: Special Capabilities, Up: Termcap
-
-Autonuke
-========
-
- - Command: autonuke STATE
- (none)
- Sets whether a clear screen sequence should nuke all the output
- that has not been written to the terminal. *Note Obuflimit::.
- This property is set per display, not per window.
-
- - Command: defautonuke STATE
- (none)
- Same as the `autonuke' command except that the default setting for
- new displays is also changed. Initial setting is `off'. Note that
- you can use the special `AN' terminal capability if you want to
- have a terminal type dependent setting.
-
-
-File: screen.info, Node: Obuflimit, Next: Character Translation, Prev: Autonuke, Up: Termcap
-
-Obuflimit
-=========
-
- - Command: obuflimit [LIMIT]
- (none)
- If the output buffer contains more bytes than the specified limit,
- no more data will be read from the windows. The default value is
- 256. If you have a fast display (like `xterm'), you can set it to
- some higher value. If no argument is specified, the current
- setting is displayed. This property is set per display, not per
- window.
-
- - Command: defobuflimit LIMIT
- (none)
- Same as the `obuflimit' command except that the default setting
- for new displays is also changed. Initial setting is 256 bytes.
- Note that you can use the special `OL' terminal capability if you
- want to have a terminal type dependent limit.
-
-
-File: screen.info, Node: Character Translation, Prev: Obuflimit, Up: Termcap
-
-Character Translation
-=====================
-
- `Screen' has a powerful mechanism to translate characters to
-arbitrary strings depending on the current font and terminal type. Use
-this feature if you want to work with a common standard character set
-(say ISO8851-latin1) even on terminals that scatter the more unusual
-characters over several national language font pages.
-
- Syntax:
-
- XC=<CHARSET-MAPPING>{,,<CHARSET-MAPPING>}
- <CHARSET-MAPPING> := <DESIGNATOR><TEMPLATE>{,<MAPPING>}
- <MAPPING> := <CHAR-TO-BE-MAPPED><TEMPLATE-ARG>
-
- The things in braces may be repeated any number of times.
-
- A <CHARSET-MAPPING> tells screen how to map characters in font
-<DESIGNATOR> (`B': Ascii, `A': UK, `K': german, etc.) to strings. Every
-<MAPPING> describes to what string a single character will be
-translated. A template mechanism is used, as most of the time the codes
-have a lot in common (for example strings to switch to and from another
-charset). Each occurrence of `%' in <TEMPLATE> gets substituted with the
-TEMPLATE-ARG specified together with the character. If your strings are
-not similar at all, then use `%' as a template and place the full
-string in <TEMPLATE-ARG>. A quoting mechanism was added to make it
-possible to use a real `%'. The `\' character quotes the special
-characters `\', `%', and `,'.
-
- Here is an example:
-
- termcap hp700 'XC=B\E(K%\E(B,\304[,\326\\\\,\334]'
-
- This tells `screen', how to translate ISOlatin1 (charset `B') upper
-case umlaut characters on a `hp700' terminal that has a german charset.
-`\304' gets translated to `\E(K[\E(B' and so on. Note that this line
-gets parsed *three* times before the internal lookup table is built,
-therefore a lot of quoting is needed to create a single `\'.
-
- Another extension was added to allow more emulation: If a mapping
-translates the unquoted `%' char, it will be sent to the terminal
-whenever screen switches to the corresponding <DESIGNATOR>. In this
-special case the template is assumed to be just `%' because the charset
-switch sequence and the character mappings normally haven't much in
-common.
-
- This example shows one use of the extension:
- termcap xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334'
-
- Here, a part of the german (`K') charset is emulated on an xterm.
-If screen has to change to the `K' charset, `\E(B' will be sent to the
-terminal, i.e. the ASCII charset is used instead. The template is just
-`%', so the mapping is straightforward: `[' to `\304', `\' to `\326',
-and `]' to `\334'.
-
-
-File: screen.info, Node: Message Line, Next: Logging, Prev: Termcap, Up: Top
-
-The Message Line
-****************
-
- `screen' displays informational messages and other diagnostics in a
-"message line" at the bottom of the screen. If your terminal has a
-status line defined in its termcap, screen will use this for displaying
-its messages, otherwise the last line of the screen will be temporarily
-overwritten and output will be momentarily interrupted. The message
-line is automatically removed after a few seconds delay, but it can also
-be removed early (on terminals without a status line) by beginning to
-type.
-
-* Menu:
-
-* Privacy Message:: Using the message line from your program.
-* Hardware Status Line:: Use the terminal's hardware status line.
-* Last Message:: Redisplay the last message.
-* Message Wait:: Control how long messages are displayed.
-
-
-File: screen.info, Node: Privacy Message, Next: Hardware Status Line, Up: Message Line
-
-Using the message line from your program
-========================================
-
- The message line facility can be used by an application running in
-the current window by means of the ANSI "Privacy message" control
-sequence. For instance, from within the shell, try something like:
-
- echo "^Hello world from window $WINDOW\"
-
- where `' is ASCII ESC and `^' is a literal caret or up-arrow.
-
-
-File: screen.info, Node: Hardware Status Line, Next: Last Message, Prev: Privacy Message, Up: Message Line
-
-Hardware Status Line
-====================
-
- - Command: hardstatus [STATE]
- - Command: hardstatus [`always']`lastline'|`message'|`ignore' [STRING]
- - Command: hardstatus `string' [STRING]
- (none)
- This command configures the use and emulation of the terminal's
- hardstatus line. The first form toggles whether `screen' will use
- the hardware status line to display messages. If the flag is set
- to `off', these messages are overlaid in reverse video mode at the
- display line. The default setting is `on'.
-
- The second form tells screen what to do if the terminal doesn't
- have a hardstatus line (i.e. the termcap/terminfo capabilities
- "hs", "ts", "fs" and "ds" are not set). If the type `lastline' is
- used, screen will reserve the last line of the display for the
- hardstatus. `message' uses `screen''s message mechanism and
- `ignore' tells `screen' never to display the hardstatus. If you
- prepend the word `always' to the type, `screen' will use the type
- even if the terminal supports a hardstatus line.
-
- The third form specifies the contents of the hardstatus line.
- `%h' is used as default string, i.e. the stored hardstatus of the
- current window (settable via `\E]0;^G' or `\E_\\') is displayed.
- You can customize this to any string you like including string
- escapes (*Note String Escapes::). If you leave out the argument
- STRING, the current string is displayed.
-
- You can mix the second and third form by providing the string as
- additional argument.
-
diff --git a/doc/screen.info-4 b/doc/screen.info-4
index f013ffe..300a2ba 100644
--- a/doc/screen.info-4
+++ b/doc/screen.info-4
@@ -1,9 +1,14 @@
-This is Info file screen.info, produced by Makeinfo-1.55 from the input
-file ./screen.texinfo.
+This is screen.info, produced by makeinfo version 4.0 from
+./screen.texinfo.
+
+INFO-DIR-SECTION General Commands
+START-INFO-DIR-ENTRY
+* Screen: (screen). Full-screen window manager.
+END-INFO-DIR-ENTRY
This file documents the `Screen' virtual terminal manager.
- Copyright (c) 1993-1995 Free Software Foundation, Inc.
+ Copyright (c) 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -20,6 +25,285 @@ versions, except that this permission notice may be stated in a
translation approved by the Foundation.

+File: screen.info, Node: Special Capabilities, Next: Autonuke, Prev: Termcap Examples, Up: Termcap
+
+Special Terminal Capabilities
+=============================
+
+ The following table describes all terminal capabilities that are
+recognized by `screen' and are not in the termcap manual (*note
+Termcap: (termcap)Top.). You can place these capabilities in your
+termcap entries (in `/etc/termcap') or use them with the commands
+`termcap', `terminfo' and `termcapinfo' in your `screenrc' files. It is
+often not possible to place these capabilities in the terminfo database.
+`LP'
+ (bool)
+ Terminal has VT100 style margins (`magic margins'). Note that this
+ capability is obsolete -- `screen' now uses the standard `xn'
+ instead.
+
+`Z0'
+ (str)
+ Change width to 132 columns.
+
+`Z1'
+ (str)
+ Change width to 80 columns.
+
+`WS'
+ (str)
+ Resize display. This capability has the desired width and height as
+ arguments. SunView(tm) example: `\E[8;%d;%dt'.
+
+`NF'
+ (bool)
+ Terminal doesn't need flow control. Send ^S and ^Q direct to the
+ application. Same as `flow off'. The opposite of this capability
+ is `nx'.
+
+`G0'
+ (bool)
+ Terminal can deal with ISO 2022 font selection sequences.
+
+`S0'
+ (str)
+ Switch charset `G0' to the specified charset. Default is `\E(%.'.
+
+`E0'
+ (str)
+ Switch charset `G0' back to standard charset. Default is `\E(B'.
+
+`C0'
+ (str)
+ Use the string as a conversion table for font 0. See the `ac'
+ capability for more details.
+
+`CS'
+ (str)
+ Switch cursor-keys to application mode.
+
+`CE'
+ (str)
+ Switch cursor-keys to cursor mode.
+
+`AN'
+ (bool)
+ Enable autonuke for displays of this terminal type. (*note
+ Autonuke::).
+
+`OL'
+ (num)
+ Set the output buffer limit. See the `obuflimit' command (*note
+ Obuflimit::) for more details.
+
+`KJ'
+ (str)
+ Set the encoding of the terminal. See the `encoding' command
+ (*note Character Processing::) for valid encodings.
+
+`AF'
+ (str)
+ Change character foreground color in an ANSI conform way. This
+ capability will almost always be set to `\E[3%dm' (`\E[3%p1%dm' on
+ terminfo machines).
+
+`AB'
+ (str)
+ Same as `AF', but change background color.
+
+`AX'
+ (bool)
+ Does understand ANSI set default fg/bg color (`\E[39m / \E[49m').
+
+`XC'
+ (str)
+ Describe a translation of characters to strings depending on the
+ current font. (*note Character Translation::).
+
+`XT'
+ (bool)
+ Terminal understands special xterm sequences (OSC, mouse tracking).
+
+`C8'
+ (bool)
+ Terminal needs bold to display high-intensity colors (e.g. Eterm).
+
+`TF'
+ (bool)
+ Add missing capabilities to the termcap/info entry. (Set by
+ default).
+
+
+File: screen.info, Node: Autonuke, Next: Obuflimit, Prev: Special Capabilities, Up: Termcap
+
+Autonuke
+========
+
+ - Command: autonuke STATE
+ (none)
+ Sets whether a clear screen sequence should nuke all the output
+ that has not been written to the terminal. *Note Obuflimit::.
+ This property is set per display, not per window.
+
+ - Command: defautonuke STATE
+ (none)
+ Same as the `autonuke' command except that the default setting for
+ new displays is also changed. Initial setting is `off'. Note that
+ you can use the special `AN' terminal capability if you want to
+ have a terminal type dependent setting.
+
+
+File: screen.info, Node: Obuflimit, Next: Character Translation, Prev: Autonuke, Up: Termcap
+
+Obuflimit
+=========
+
+ - Command: obuflimit [LIMIT]
+ (none)
+ If the output buffer contains more bytes than the specified limit,
+ no more data will be read from the windows. The default value is
+ 256. If you have a fast display (like `xterm'), you can set it to
+ some higher value. If no argument is specified, the current
+ setting is displayed. This property is set per display, not per
+ window.
+
+ - Command: defobuflimit LIMIT
+ (none)
+ Same as the `obuflimit' command except that the default setting
+ for new displays is also changed. Initial setting is 256 bytes.
+ Note that you can use the special `OL' terminal capability if you
+ want to have a terminal type dependent limit.
+
+
+File: screen.info, Node: Character Translation, Prev: Obuflimit, Up: Termcap
+
+Character Translation
+=====================
+
+ `Screen' has a powerful mechanism to translate characters to
+arbitrary strings depending on the current font and terminal type. Use
+this feature if you want to work with a common standard character set
+(say ISO8851-latin1) even on terminals that scatter the more unusual
+characters over several national language font pages.
+
+ Syntax:
+
+ XC=<CHARSET-MAPPING>{,,<CHARSET-MAPPING>}
+ <CHARSET-MAPPING> := <DESIGNATOR><TEMPLATE>{,<MAPPING>}
+ <MAPPING> := <CHAR-TO-BE-MAPPED><TEMPLATE-ARG>
+
+ The things in braces may be repeated any number of times.
+
+ A <CHARSET-MAPPING> tells screen how to map characters in font
+<DESIGNATOR> (`B': Ascii, `A': UK, `K': german, etc.) to strings.
+Every <MAPPING> describes to what string a single character will be
+translated. A template mechanism is used, as most of the time the codes
+have a lot in common (for example strings to switch to and from another
+charset). Each occurrence of `%' in <TEMPLATE> gets substituted with the
+TEMPLATE-ARG specified together with the character. If your strings are
+not similar at all, then use `%' as a template and place the full
+string in <TEMPLATE-ARG>. A quoting mechanism was added to make it
+possible to use a real `%'. The `\' character quotes the special
+characters `\', `%', and `,'.
+
+ Here is an example:
+
+ termcap hp700 'XC=B\E(K%\E(B,\304[,\326\\\\,\334]'
+
+ This tells `screen', how to translate ISOlatin1 (charset `B') upper
+case umlaut characters on a `hp700' terminal that has a german charset.
+`\304' gets translated to `\E(K[\E(B' and so on. Note that this line
+gets parsed *three* times before the internal lookup table is built,
+therefore a lot of quoting is needed to create a single `\'.
+
+ Another extension was added to allow more emulation: If a mapping
+translates the unquoted `%' char, it will be sent to the terminal
+whenever screen switches to the corresponding <DESIGNATOR>. In this
+special case the template is assumed to be just `%' because the charset
+switch sequence and the character mappings normally haven't much in
+common.
+
+ This example shows one use of the extension:
+ termcap xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334'
+
+ Here, a part of the german (`K') charset is emulated on an xterm.
+If screen has to change to the `K' charset, `\E(B' will be sent to the
+terminal, i.e. the ASCII charset is used instead. The template is just
+`%', so the mapping is straightforward: `[' to `\304', `\' to `\326',
+and `]' to `\334'.
+
+
+File: screen.info, Node: Message Line, Next: Logging, Prev: Termcap, Up: Top
+
+The Message Line
+****************
+
+ `screen' displays informational messages and other diagnostics in a
+"message line" at the bottom of the screen. If your terminal has a
+status line defined in its termcap, screen will use this for displaying
+its messages, otherwise the last line of the screen will be temporarily
+overwritten and output will be momentarily interrupted. The message
+line is automatically removed after a few seconds delay, but it can also
+be removed early (on terminals without a status line) by beginning to
+type.
+
+* Menu:
+
+* Privacy Message:: Using the message line from your program.
+* Hardware Status Line:: Use the terminal's hardware status line.
+* Last Message:: Redisplay the last message.
+* Message Wait:: Control how long messages are displayed.
+
+
+File: screen.info, Node: Privacy Message, Next: Hardware Status Line, Up: Message Line
+
+Using the message line from your program
+========================================
+
+ The message line facility can be used by an application running in
+the current window by means of the ANSI "Privacy message" control
+sequence. For instance, from within the shell, try something like:
+
+ echo "^Hello world from window $WINDOW\"
+
+ where `' is ASCII ESC and `^' is a literal caret or up-arrow.
+
+
+File: screen.info, Node: Hardware Status Line, Next: Last Message, Prev: Privacy Message, Up: Message Line
+
+Hardware Status Line
+====================
+
+ - Command: hardstatus [state]
+ - Command: hardstatus [`always']`lastline'|`message'|`ignore' [string]
+ - Command: hardstatus `string' [string]
+ (none)
+ This command configures the use and emulation of the terminal's
+ hardstatus line. The first form toggles whether `screen' will use
+ the hardware status line to display messages. If the flag is set
+ to `off', these messages are overlaid in reverse video mode at the
+ display line. The default setting is `on'.
+
+ The second form tells screen what to do if the terminal doesn't
+ have a hardstatus line (i.e. the termcap/terminfo capabilities
+ "hs", "ts", "fs" and "ds" are not set). If the type `lastline' is
+ used, screen will reserve the last line of the display for the
+ hardstatus. `message' uses `screen''s message mechanism and
+ `ignore' tells `screen' never to display the hardstatus. If you
+ prepend the word `always' to the type, `screen' will use the type
+ even if the terminal supports a hardstatus line.
+
+ The third form specifies the contents of the hardstatus line.
+ `%h' is used as default string, i.e. the stored hardstatus of the
+ current window (settable via `ESC]0;^G' or `ESC_\\') is displayed.
+ You can customize this to any string you like including string
+ escapes (*note String Escapes::). If you leave out the argument
+ STRING, the current string is displayed.
+
+ You can mix the second and third form by providing the string as
+ additional argument.
+
+
File: screen.info, Node: Last Message, Next: Message Wait, Prev: Hardware Status Line, Up: Message Line
Display Last Message
@@ -38,12 +322,12 @@ File: screen.info, Node: Message Wait, Prev: Last Message, Up: Message Line
Message Wait
============
- - Command: msgminwait SEC
+ - Command: msgminwait sec
(none)
Defines the time `screen' delays a new message when another is
currently displayed. Defaults to 1 second.
- - Command: msgwait SEC
+ - Command: msgwait sec
(none)
Defines the time a message is displayed, if `screen' is not
disturbed by other activity. Defaults to 5 seconds.
@@ -68,20 +352,22 @@ File: screen.info, Node: Hardcopy, Next: Log, Up: Logging
hardcopy
========
- - Command: hardcopy
+ - Command: hardcopy [-h] [FILE]
(`C-a h', `C-a C-h')
- Writes out the current display contents to the file `hardcopy.N'
- in the window's default directory, where N is the number of the
- current window. This either appends or overwrites the file if it
- exists, as determined by the `hardcopy_append' command.
-
- - Command: hardcopy_append STATE
+ Writes out the currently displayed image to the file FILE, or, if
+ no filename is specified, to `hardcopy.N' in the default
+ directory, where N is the number of the current window. This
+ either appends or overwrites the file if it exists, as determined
+ by the `hardcopy_append' command. If the option `-h' is
+ specified, dump also the contents of the scrollback buffer.
+
+ - Command: hardcopy_append state
(none)
If set to `on', `screen' will append to the `hardcopy.N' files
created by the command `hardcopy'; otherwise, these files are
overwritten each time.
- - Command: hardcopydir DIRECTORY
+ - Command: hardcopydir directory
(none)
Defines a directory where hardcopy files will be placed. If unset
hardcopys are dumped in screen's current working directory.
@@ -92,7 +378,12 @@ File: screen.info, Node: Log, Prev: Hardcopy, Up: Logging
log
===
- - Command: log [STATE]
+ - Command: deflog state
+ (none)
+ Same as the `log' command except that the default setting for new
+ windows is changed. Initial setting is `off'.
+
+ - Command: log [state]
(`C-a H')
Begins/ends logging of the current window to the file
`screenlog.N' in the window's default directory, where N is the
@@ -103,17 +394,17 @@ log
and the contents of the scrollback history are not included in the
session log. Default is `off'.
- - Command: logfile FILENAME
- - Command: logfile FLUSH SECS
+ - Command: logfile filename
+ - Command: logfile flush secs
(none)
Defines the name the logfiles will get. The default is
`screenlog.%n'. The second form changes the number of seconds
`screen' will wait before flushing the logfile buffer to the
file-system. The default value is 10 seconds.
- - Command: logtstamp [STATE]
- - Command: logtstamp `after' SECS
- - Command: logtstamp `string' STRING
+ - Command: logtstamp [state]
+ - Command: logtstamp `after' secs
+ - Command: logtstamp `string' string
(none)
This command controls logfile time-stamp mechanism of screen. If
time-stamps are turned `on', screen adds a string containing the
@@ -145,7 +436,7 @@ File: screen.info, Node: echo, Next: sleep, Up: Startup
echo
====
- - Command: echo [`-n'] MESSAGE
+ - Command: echo [`-n'] message
(none)
The echo command may be used to annoy `screen' users with a
'message of the day'. Typically installed in a global screenrc.
@@ -159,7 +450,7 @@ File: screen.info, Node: sleep, Next: Startup Message, Prev: echo, Up: Start
sleep
=====
- - Command: sleep NUM
+ - Command: sleep num
(none)
This command will pause the execution of a .screenrc file for NUM
seconds. Keyboard activity will end the sleep. It may be used to
@@ -171,7 +462,7 @@ File: screen.info, Node: Startup Message, Prev: sleep, Up: Startup
Startup Message
===============
- - Command: startup_message STATE
+ - Command: startup_message state
(none)
Select whether you want to see the copyright notice during startup.
Default is `on', as you probably noticed.
@@ -201,6 +492,9 @@ categories.
* Zombie:: Keep dead windows.
* Printcmd:: Set command for VT100 printer port emulation.
* Sorendition:: Change the text highlighting method.
+* Attrcolor:: Map attributes to colors.
+* Setsid:: Change process group management
+* Eval:: Parse and execute arguments

File: screen.info, Node: At, Next: Break, Up: Miscellaneous
@@ -208,7 +502,7 @@ File: screen.info, Node: At, Next: Break, Up: Miscellaneous
At
==
- - Command: at [IDENTIFIER][#|*|%] COMMAND [ARGS]
+ - Command: at [identifier][#|*|%] command [args]
(none)
Execute a command at other displays or windows as if it had been
entered there. `At' changes the context (the `current window' or
@@ -245,19 +539,19 @@ File: screen.info, Node: Break, Next: Debug, Prev: At, Up: Miscellaneous
Break
=====
- - Command: break [DURATION]
+ - Command: break [duration]
(none)
Send a break signal for DURATION*0.25 seconds to this window. For
non-Posix systems the time interval is rounded up to full seconds.
Most useful if a character device is attached to the window rather
- than a shell process (*note Window Types::.). The maximum duration
+ than a shell process (*note Window Types::). The maximum duration
of a break signal is limited to 15 seconds.
- Command: pow_break
(none)
Reopen the window's terminal line and send a break condition.
- - Command: breaktype [TCSENDBREAK|TIOCSBRK|TCSBRK]
+ - Command: breaktype [tcsendbreak|TIOCSBRK|TCSBRK]
(none)
Choose one of the available methods of generating a break signal
for terminal devices. This command should affect the current
@@ -265,7 +559,7 @@ Break
This will be changed in the future. Calling `breaktype' with no
parameter displays the break setting for the current window.
- - Command: defbreaktype [TCSENDBREAK|TIOCSBRK|TCSBRK]
+ - Command: defbreaktype [tcsendbreak|TIOCSBRK|TCSBRK]
(none)
Choose one of the available methods of generating a break signal
for terminal devices opened afterwards. The preferred methods are
@@ -283,7 +577,7 @@ File: screen.info, Node: Debug, Next: License, Prev: Break, Up: Miscellaneou
Debug
=====
- - Command: debug [ON|OFF]
+ - Command: debug [on|off]
(none)
Turns runtime debugging on or off. If `screen' has been compiled
with option `-DDEBUG' debugging is available and is turned on per
@@ -308,7 +602,7 @@ File: screen.info, Node: Nethack, Next: Nonblock, Prev: License, Up: Miscell
Nethack
=======
- - Command: nethack STATE
+ - Command: nethack state
(none)
Changes the kind of error messages used by `screen'. When you are
familiar with the game `nethack', you may enjoy the nethack-style
@@ -317,7 +611,7 @@ Nethack
unclear as well.
This option is only available if `screen' was compiled with the
- NETHACK flag defined (*note Installation::.). The default setting
+ NETHACK flag defined (*note Installation::). The default setting
is then determined by the presence of the environment variable
`$NETHACKOPTIONS'.
@@ -363,7 +657,7 @@ Silence
number of seconds instead of `on' or `off'. Silence is initially
off for all windows.
- - Command: defsilence STATE
+ - Command: defsilence state
(none)
Same as the `silence' command except that the default setting for
new windows is changed. Initial setting is `off'.
@@ -379,12 +673,15 @@ File: screen.info, Node: Time, Next: Verbose, Prev: Silence, Up: Miscellaneo
Time
====
- - Command: time
+ - Command: time [STRING]
(`C-a t', `C-a C-t')
Uses the message line to display the time of day, the host name,
and the load averages over 1, 5, and 15 minutes (if this is
available on your system). For window-specific information use
- `info' (*note Info::.).
+ `info' (*note Info::). If a STRING is specified, it changes the
+ format of the time report like it is described in the string
+ escapes chapter (*note String Escapes::). Screen uses a default of
+ `%c:%s %M %d %H%? %l%?'.

File: screen.info, Node: Verbose, Next: Version, Prev: Time, Up: Miscellaneous
@@ -392,7 +689,7 @@ File: screen.info, Node: Verbose, Next: Version, Prev: Time, Up: Miscellaneo
Verbose
=======
- - Command: verbose [ON|OFF]
+ - Command: verbose [on|off]
If verbose is switched on, the command name is echoed, whenever a
window is created (or resurrected from zombie state). Default is
off. Without parameter, the current setting is shown.
@@ -452,7 +749,7 @@ Printcmd
commands.

-File: screen.info, Node: Sorendition, Prev: Printcmd, Up: Miscellaneous
+File: screen.info, Node: Sorendition, Next: Attrcolor, Prev: Printcmd, Up: Miscellaneous
Sorendition
===========
@@ -460,13 +757,65 @@ Sorendition
- Command: sorendition [ATTR [COLOR]]
(none)
Change the way screen does highlighting for text marking and
- printing messages. ATTR is a hexadecimal number and describes the
- attributes (inverse, underline, ...) the text will get. COLOR is
- a 2 digit number and changes the foreground/background of the
- highlighted text. Some knowledge of screen's internal character
- representation is needed to make the characters appear in the
- desired way. The default is currently `10 99' (standout, default
- colors).
+ printing messages. See the chapter about string escapes (*note
+ String Escapes::) for the syntax of the modifiers. The default is
+ currently `=s dd' (standout, default colors).
+
+
+File: screen.info, Node: Attrcolor, Next: Setsid, Prev: Sorendition, Up: Miscellaneous
+
+Attrcolor
+=========
+
+ - Command: attrcolor ATTRIB [ATTRIBUTE/COLOR-MODIFIER]
+ (none)
+ This command can be used to highlight attributes by changing the
+ color of the text. If the attribute ATTRIB is in use, the
+ specified attribute/color modifier is also applied. If no modifier
+ is given, the current one is deleted. See the chapter about string
+ escapes (*note String Escapes::) for the syntax of the modifier.
+ Screen understands two pseudo-attributes, `i' stands for
+ high-intensity foreground color and `I' for high-intensity
+ background color.
+
+ Examples:
+ `attrcolor b "R"'
+ Change the color to bright red if bold text is to be printed.
+
+ `attrcolor u "-u b"'
+ Use blue text instead of underline.
+
+ `attrcolor b "I"'
+ Use bright colors for bold text. Most terminal emulators do
+ this already.
+
+ `attrcolor i "+b"'
+ Make bright colored text also bold.
+
+
+File: screen.info, Node: Setsid, Next: Eval, Prev: Attrcolor, Up: Miscellaneous
+
+Setsid
+======
+
+ - Command: setsid state
+ (none)
+ Normally screen uses different sessions and process groups for the
+ windows. If setsid is turned `off', this is not done anymore and
+ all windows will be in the same process group as the screen
+ backend process. This also breaks job-control, so be careful. The
+ default is `on', of course. This command is probably useful only
+ in rare circumstances.
+
+
+File: screen.info, Node: Eval, Prev: Setsid, Up: Miscellaneous
+
+Eval
+====
+
+ - Command: eval COMMAND1 [COMMAND2 ...]
+ (none)
+ Parses and executes each argument as seperate command.

File: screen.info, Node: String Escapes, Next: Environment, Prev: Miscellaneous, Up: Top
@@ -502,9 +851,18 @@ instead.
`D'
weekday name
+`f'
+ flags of the window
+
+`F'
+ sets %? to true if the window has the focus
+
`h'
hardstatus of the window
+`H'
+ hostname of the system
+
`l'
current load of the system
@@ -527,7 +885,9 @@ instead.
all other users on this window
`w'
- all window numbers and names
+ all window numbers and names. With `-' quailifier: up to the
+ current window; with `+' qualifier: starting with the window after
+ the current one.
`W'
all window numbers and names except the current one
@@ -543,9 +903,134 @@ instead.
to an nonempty string
`:'
- else part of `%?' The `c' and `C' escape may be qualified with a
-`0' to make screen use zero instead of space as fill character. The `n'
-escape understands a length qualifier (e.g. `%3n').
+ else part of `%?'
+
+`='
+ pad the string to the display's width (like TeX's hfill). If a
+ number is specified, pad to the percentage of the window's width.
+ A `0' qualifier tells screen to treat the number as absolute
+ position. You can specify to pad relative to the last absolute
+ pad position by adding a `+' qualifier or to pad relative to the
+ right margin by using `-'. The padding truncates the string if the
+ specified position lies before the current position. Add the `L'
+ qualifier to change this.
+
+`<'
+ same as `%=' but just do truncation, do not fill with spaces
+
+`>'
+ mark the current text position for the next truncation. When
+ screen needs to do truncation, it tries to do it in a way that the
+ marked position gets moved to the specified percentage of the
+ output area. (The area starts from the last absolute pad position
+ and ends with the position specified by the truncation operator.)
+ The `L' qualifier tells screen to mark the truncated parts with
+ `...'.
+
+`{'
+ attribute/color modifier string terminated by the next `}' The `c'
+and `C' escape may be qualified with a `0' to make screen use zero
+instead of space as fill character. The `n' and `=' escapes understand
+a length qualifier (e.g. `%3n'), `D' and `M' can be prefixed with `L'
+to generate long names, `w' and `W' also show the window flags if `L'
+is given.
+
+ An attribute/color modifier is is used to change the attributes or
+the color settings. Its format is `[attribute modifier] [color
+description]'. The attribute modifier must be prefixed by a change type
+indicator if it can be confused with a color desciption. The following
+change types are known:
+`+'
+ add the specified set to the current attributes
+
+`-'
+ remove the set from the current attributes
+
+`!'
+ invert the set in the current attributes
+
+`='
+ change the current attributes to the specified set The attribute
+set can either be specified as a hexadecimal number or a combination of
+the following letters:
+`u'
+ underline
+
+`b'
+ bold
+
+`r'
+ reverse
+
+`s'
+ standout
+
+`B'
+ blinking Colors are coded either as a hexadecimal number or two
+letters specifying the desired background and foreground color (in that
+order). The following colors are known:
+`k'
+ black
+
+`r'
+ red
+
+`g'
+ green
+
+`y'
+ yellow
+
+`b'
+ blue
+
+`m'
+ magenta
+
+`c'
+ cyan
+
+`w'
+ white
+
+`d'
+ default color
+
+`.'
+ leave color unchanged The capitalized versions of the letter
+specify bright colors. You can also use the pseudo-color `i' to set
+just the brightness and leave the color unchanged.
+
+ A one digit/letter color description is treated as foreground or
+background color dependant on the current attributes: if reverse mode is
+set, the background color is changed instead of the foreground color.
+If you don't like this, prefix the color with a `.'. If you want the
+same behaviour for two-letter color descriptions, also prefix them with
+a `.'.
+
+ As a special case, `%{-}' restores the attributes and colors that
+were set before the last change was made (i.e. pops one level of the
+color-change stack).
+
+Examples:
+`G'
+ set color to bright green
+
+`+b r'
+ use bold red
+
+`= yd'
+ clear all attributes, write in default color on yellow background.
+
+`%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<'
+ The available windows centered at the current win dow and
+ truncated to the available width. The current window is displayed
+ white on blue. This can be used with `hardstatus alwayslastline'.
+
+`%?%F%{.R.}%?%3n %t%? [%h]%?'
+ The window number and title and the window's hardstatus, if one is
+ set. Also use a red background if this is the active focus.
+ Useful for `caption string'.

File: screen.info, Node: Environment, Next: Files, Prev: String Escapes, Up: Top
@@ -597,6 +1082,9 @@ Environment Variables
`TERMCAP'
Terminal description.
+`WINDOW'
+ Window number of a window (at creation time).
+

File: screen.info, Node: Files, Next: Credits, Prev: Environment, Up: Top
@@ -609,17 +1097,21 @@ Files Referenced
global initialization files.
``$SYSSCREENRC''
-`/etc/screenrc'
+`/local/etc/screenrc'
`screen' initialization commands
``$SCREENRC''
``$HOME'/.iscreenrc'
``$HOME'/.screenrc'
- Read in after /etc/screenrc
+ Read in after /local/etc/screenrc
``$SCREENDIR'/S-LOGIN'
-`/var/run/screens/S-LOGIN'
- Socket directories (default for Debian GNU/Linux)
+
+`/local/screens/S-LOGIN'
+ Socket directories (default)
+
+`/usr/tmp/screens/S-LOGIN'
+ Alternate socket directories.
`SOCKET DIRECTORY/.termcap'
Written by the `dumptermcap' command
@@ -684,12 +1176,14 @@ Contributors
Christopher Williams (cgw@unt.edu),
Matt Mosley (mattm@access.digex.net),
Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU),
- Jason Merrill (jason@jarthur.Claremont.EDU).
+ Jason Merrill (jason@jarthur.Claremont.EDU),
+ Johannes Zellner (johannes@zellner.org),
+ Pablo Averbuj (pablo@averbuj.com).
Version
=======
- This manual describes version 3.9.0 of the `screen' program. Its
+ This manual describes version 3.9.11 of the `screen' program. Its
roots are a merge of a custom version 2.3PR7 by Wayne Davison and
several enhancements to Oliver Laumann's version 2.0. Note that all
versions numbered 2.x are copyright by Oliver Laumann.
@@ -820,11 +1314,10 @@ Socket Directory
The socket directory defaults either to `$HOME/.screen' or simply to
`/tmp/screens' or preferably to `/usr/local/screens' chosen at
-compile-time. (`/var/run/screen for Debian GNU/Linux). If `screen' is
-installed setuid root, then the administrator should compile screen
-with an adequate (not NFS mounted) `SOCKDIR'. If `screen' is not
-running setuid-root, the user can specify any mode 700 directory in the
-environment variable `$SCREENDIR'.
+compile-time. If `screen' is installed setuid root, then the
+administrator should compile screen with an adequate (not NFS mounted)
+`SOCKDIR'. If `screen' is not running setuid-root, the user can specify
+any mode 700 directory in the environment variable `$SCREENDIR'.

File: screen.info, Node: Compiling Screen, Prev: Socket Directory, Up: Installation
@@ -868,296 +1361,39 @@ Concept Index
* Menu:
-* .screenrc: Startup Files.
-* availability: Availability.
-* binding: Key Binding.
-* bug report: Reporting Bugs.
-* bugs: Bugs.
-* capabilities: Special Capabilities.
-* command character: Command Character.
-* command line options: Invoking Screen.
-* command summary: Command Summary.
-* compiling screen: Compiling Screen.
-* control sequences: Control Sequences.
-* copy and paste: Copy and Paste.
-* customization: Customization.
-* environment: Environment.
-* escape character: Command Character.
-* files: Files.
-* flow control: Flow Control.
-* input translation: Input Translation.
-* installation: Installation.
-* introduction: Getting Started.
-* invoking: Invoking Screen.
-* key binding: Key Binding.
-* marking: Copy.
-* message line: Message Line.
-* multiuser session: Multiuser Session.
-* options: Invoking Screen.
-* overview: Overview.
-* regions: Regions.
-* screenrc: Startup Files.
-* scrollback: Copy.
-* socket directory: Socket Directory.
-* string escapes: String Escapes.
-* terminal capabilities: Special Capabilities.
-* title: Naming Windows.
-* window types: Window Types.
-
-
-File: screen.info, Node: Command Index, Next: Keystroke Index, Prev: Concept Index, Up: Top
-
-Command Index
-*************
-
- This is a list of all the commands supported by `screen'.
-
-* Menu:
-
-* acladd: Acladd.
-* aclchg: Aclchg.
-* acldel: Acldel.
-* aclgrp: Aclgrp.
-* aclumask: Umask.
-* activity: Monitor.
-* addacl: Acladd.
-* allpartial: Redisplay.
-* at: At.
-* autodetach: Detach.
-* autonuke: Autonuke.
-* bell_msg: Bell.
-* bind: Bind.
-* bindkey: Bindkey.
-* break: Break.
-* breaktype: Break.
-* bufferfile: Screen-Exchange.
-* c1: Character Processing.
-* caption: Caption.
-* caption: Caption.
-* chacl: Aclchg.
-* charset: Character Processing.
-* chdir: Chdir.
-* clear: Clear.
-* colon: Colon.
-* command: Command Character.
-* compacthist: Scrollback.
-* console: Console.
-* copy: Copy.
-* copy_reg: Registers.
-* crlf: Line Termination.
-* debug: Debug.
-* defautonuke: Autonuke.
-* defbreaktype: Break.
-* defc1: Character Processing.
-* defcharset: Character Processing.
-* defescape: Command Character.
-* defflow: Flow.
-* defgr: Character Processing.
-* defhstatus: Hardstatus.
-* defkanji: Character Processing.
-* deflogin: Login.
-* defmode: Mode.
-* defmonitor: Monitor.
-* defobuflimit: Obuflimit.
-* defscrollback: Scrollback.
-* defshell: Shell.
-* defsilence: Silence.
-* defslowpaste: Paste.
-* defwrap: Wrap.
-* defwritelock: Writelock.
-* defzombie: Zombie.
-* detach: Detach.
-* digraph: Digraph.
-* displays: Displays.
-* dumptermcap: Dump Termcap.
-* echo: echo.
-* escape: Command Character.
-* exec: Exec.
-* fit: Window Size.
-* flow: Flow.
-* focus: Focus.
-* gr: Character Processing.
-* hardcopy: Hardcopy.
-* hardcopydir: Hardcopy.
-* hardcopy_append: Hardcopy.
-* hardstatus: Hardware Status Line.
-* hardstatus: Hardware Status Line.
-* hardstatus: Hardware Status Line.
-* height: Window Size.
-* help: Help.
-* history: History.
-* hstatus: Hardstatus.
-* info: Info.
-* ins_reg: Registers.
-* kanji: Character Processing.
-* kill: Kill.
-* lastmsg: Last Message.
-* license: License.
-* lockscreen: Lock.
-* log: Log.
-* logfile: Log.
-* logfile: Log.
-* login: Login.
-* logtstamp: Log.
-* logtstamp: Log.
-* logtstamp: Log.
-* mapdefault: Bindkey Control.
-* mapnotnext: Bindkey Control.
-* maptimeout: Bindkey Control.
-* markkeys: Copy Mode Keys.
-* meta: Command Character.
-* monitor: Monitor.
-* msgminwait: Message Wait.
-* msgwait: Message Wait.
-* multiuser: Multiuser.
-* nethack: Nethack.
-* next: Next and Previous.
-* nonblock: Nonblock.
-* number: Number.
-* obuflimit: Obuflimit.
-* only: Only.
-* other: Other Window.
-* partial: Redisplay.
-* password: Detach.
-* paste: Paste.
-* pastefont: Paste.
-* pow_break: Break.
-* pow_detach: Power Detach.
-* pow_detach_msg: Power Detach.
-* prev: Next and Previous.
-* printcmd: Printcmd.
-* process: Registers.
-* quit: Quit.
-* readbuf: Screen-Exchange.
-* readreg: Paste.
-* redisplay: Redisplay.
-* register: Registers.
-* remove: Remove.
-* removebuf: Screen-Exchange.
-* reset: Reset.
-* screen: Screen Command.
-* scrollback: Scrollback.
-* select: Select.
-* sessionname: Session Name.
-* setenv: Setenv.
-* shell: Shell.
-* shelltitle: Shell.
-* silence: Silence.
-* silencewait: Silence.
-* sleep: sleep.
-* slowpaste: Paste.
-* sorendition: Sorendition.
-* split: Split.
-* startup_message: Startup Message.
-* stuff: Registers.
-* su: Su.
-* suspend: Suspend.
-* term: Term.
-* termcap: Termcap Syntax.
-* termcapinfo: Termcap Syntax.
-* terminfo: Termcap Syntax.
-* time: Time.
-* title: Title Command.
-* umask: Umask.
-* unsetenv: Setenv.
-* vbell: Bell.
-* vbellwait: Bell.
-* vbell_msg: Bell.
-* verbose: Verbose.
-* version: Version.
-* wall: Wall.
-* width: Window Size.
-* windows: Windows.
-* wrap: Wrap.
-* writebuf: Screen-Exchange.
-* writelock: Writelock.
-* xoff: XON/XOFF.
-* xon: XON/XOFF.
-* zombie: Zombie.
-
-
-File: screen.info, Node: Keystroke Index, Prev: Command Index, Up: Top
-
-Keystroke Index
-***************
-
- This is a list of the default key bindings.
-
- The leading escape character (*note Command Character::.) has been
-omitted from the key sequences, since it is the same for all bindings.
-
-* Menu:
-
-* ": Select.
-* ': Select.
-* *: Displays.
-* .: Dump Termcap.
-* 0...9: Select.
-* :: Colon.
-* <: Screen-Exchange.
-* =: Screen-Exchange.
-* >: Screen-Exchange.
-* ?: Help.
-* {: History.
-* A: Title Command.
-* a: Command Character.
-* c: Screen Command.
-* C: Clear.
-* C-a: Other Window.
-* C-c: Screen Command.
-* C-d: Detach.
-* C-f: Flow.
-* C-g: Bell.
-* C-h: Hardcopy.
-* C-i: Info.
-* C-k: Kill.
-* C-l: Redisplay.
-* C-m: Last Message.
-* C-n: Next and Previous.
-* C-p: Next and Previous.
-* C-q: XON/XOFF.
-* C-r: Wrap.
-* C-s: XON/XOFF.
-* C-t: Time.
-* C-v: Digraph.
-* C-w: Windows.
-* C-x: Lock.
-* C-z: Suspend.
-* C-[: Copy.
-* C-\: Quit.
-* C-]: Paste.
-* D: Power Detach.
-* d: Detach.
-* ESC: Copy.
-* F: Window Size.
-* f: Flow.
-* H: Log.
-* h: Hardcopy.
-* i: Info.
-* k: Kill.
-* l: Redisplay.
-* L: Login.
-* m: Last Message.
-* M: Monitor.
-* N: Number.
-* n: Next and Previous.
-* p: Next and Previous.
-* q: XON/XOFF.
-* Q: Only.
-* r: Wrap.
-* S: Split.
-* s: XON/XOFF.
-* SPC: Next and Previous.
-* t: Time.
-* TAB: Focus.
-* v: Version.
-* w: Windows.
-* W: Window Size.
-* x: Lock.
-* X: Remove.
-* z: Suspend.
-* Z: Reset.
-* [: Copy.
-* ]: Paste.
-
+* .screenrc: Startup Files.
+* availability: Availability.
+* binding: Key Binding.
+* bug report: Reporting Bugs.
+* bugs: Bugs.
+* capabilities: Special Capabilities.
+* command character: Command Character.
+* command line options: Invoking Screen.
+* command summary: Command Summary.
+* compiling screen: Compiling Screen.
+* control sequences: Control Sequences.
+* copy and paste: Copy and Paste.
+* customization: Customization.
+* environment: Environment.
+* escape character: Command Character.
+* files: Files.
+* flow control: Flow Control.
+* input translation: Input Translation.
+* installation: Installation.
+* introduction: Getting Started.
+* invoking: Invoking Screen.
+* key binding: Key Binding.
+* marking: Copy.
+* message line: Message Line.
+* multiuser session: Multiuser Session.
+* options: Invoking Screen.
+* overview: Overview.
+* regions: Regions.
+* screenrc: Startup Files.
+* scrollback: Copy.
+* socket directory: Socket Directory.
+* string escapes: String Escapes.
+* terminal capabilities: Special Capabilities.
+* title: Naming Windows.
+* window types: Window Types.
diff --git a/doc/screen.info-5 b/doc/screen.info-5
index 7975212..d33ae08 100644
--- a/doc/screen.info-5
+++ b/doc/screen.info-5
@@ -1,9 +1,14 @@
-This is Info file screen.info, produced by Makeinfo-1.55 from the input
-file ./screen.texinfo.
+This is screen.info, produced by makeinfo version 4.0 from
+./screen.texinfo.
+
+INFO-DIR-SECTION General Commands
+START-INFO-DIR-ENTRY
+* Screen: (screen). Full-screen window manager.
+END-INFO-DIR-ENTRY
This file documents the `Screen' virtual terminal manager.
- Copyright (c) 1993-1995 Free Software Foundation, Inc.
+ Copyright (c) 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -20,527 +25,266 @@ versions, except that this permission notice may be stated in a
translation approved by the Foundation.

-File: screen.info, Node: Credits, Next: Bugs, Prev: Files, Up: Top
-
-Credits
-*******
-
- Authors
- =======
-
- Originally created by Oliver Laumann, this
-latest version was produced by Wayne Davison, Juergen Weigert and
-Michael Schroeder.
-
- Contributors
- ============
-
- Ken Beal (kbeal@amber.ssd.csd.harris.com),
- Rudolf Koenig (rfkoenig@informatik.uni-erlangen.de),
- Toerless Eckert (eckert@informatik.uni-erlangen.de),
- Wayne Davison (davison@borland.com),
- Patrick Wolfe (pat@kai.com, kailand!pat),
- Bart Schaefer (schaefer@cse.ogi.edu),
- Nathan Glasser (nathan@brokaw.lcs.mit.edu),
- Larry W. Virden (lvirden@cas.org),
- Howard Chu (hyc@hanauma.jpl.nasa.gov),
- Tim MacKenzie (tym@dibbler.cs.monash.edu.au),
- Markku Jarvinen (mta@{cc,cs,ee}.tut.fi),
- Marc Boucher (marc@CAM.ORG),
- Doug Siebert (dsiebert@isca.uiowa.edu),
- Ken Stillson (stillson@tsfsrv.mitre.org),
- Ian Frechett (frechett@spot.Colorado.EDU),
- Brian Koehmstedt (bpk@gnu.ai.mit.edu),
- Don Smith (djs6015@ultb.isc.rit.edu),
- Frank van der Linden (vdlinden@fwi.uva.nl),
- Martin Schweikert (schweik@cpp.ob.open.de),
- David Vrona (dave@sashimi.lcu.com),
- E. Tye McQueen (tye%spillman.UUCP@uunet.uu.net),
- Matthew Green (mrg@mame.mu.oz.au),
- Christopher Williams (cgw@unt.edu),
- Matt Mosley (mattm@access.digex.net),
- Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU),
- Jason Merrill (jason@jarthur.Claremont.EDU).
-
- Version
- =======
-
- This manual describes version 3.8.0 of the
-`screen' program. Its roots are a merge of a custom version 2.3PR7 by
-Wayne Davison and several enhancements to Oliver Laumann's version 2.0.
-Note that all versions numbered 2.x are copyright by Oliver Laumann.
-
- See also *Note Availability::.
-
-
-File: screen.info, Node: Bugs, Next: Installation, Prev: Credits, Up: Top
-
-Bugs
-****
-
- Just like any other significant piece of
-software, `screen' has a few bugs and missing features. Please send in
-a bug report if you have found a bug not mentioned here.
-
- * Menu:
-
- * Known Bugs:: Problems we know about.
- * Reporting Bugs:: How to contact the maintainers.
- * Availability:: Where to find the lastest screen version.
-
-
-File: screen.info, Node: Known Bugs, Next: Reporting Bugs, Up: Bugs
-
-Known Bugs
-==========
-
- * `dm' (delete mode) and `xs' are not handled
- correctly (they are ignored). `xn' is treated
- as a magic-margin indicator.
-
- * `screen' has no clue about double-high or
- double-wide characters. But this is the only
- area where `vttest' is allowed to fail.
-
- * It is not possible to change the environment
- variable `$TERMCAP' when reattaching under a
- different terminal type.
-
- * The support of terminfo based systems is very
- limited. Adding extra capabilities to
- `$TERMCAP' may not have any effects.
-
- * `screen' does not make use of hardware tabs.
-
- * `screen' must be installed setuid root in
- order to be able to correctly change the owner
- of the tty device file for each window.
- Special permission may also be required to
- write the file `/etc/utmp'.
-
- * Entries in `/etc/utmp' are not removed when
- `screen' is killed with SIGKILL. This will
- cause some programs (like "w" or "rwho") to
- advertise that a user is logged on who really
- isn't.
-
- * `screen' may give a strange warning when your
- tty has no utmp entry.
-
- * When the modem line was hung up, `screen' may
- not automatically detach (or quit) unless the
- device driver sends a HANGUP signal. To detach
- such a `screen' session use the -D or -d
- command line option.
-
- * If a password is set, the command line options
- -d and -D still detach a session without
- asking.
-
- * Read permission on windows is never checked
- for. All users that can attach to the session
- can read window contents.
-
- * Both `breaktype' and `defbreaktype' change the
- break generating method used by all terminal
- devices. The first should change a window
- specific setting, where the latter should
- change only the default for new windows.
-
- * When attaching to a multiuser session, the
- user's `.screenrc' file is not sourced. Each
- users personal settings have to be included in
- the `.screenrc' file from which the session is
- booted, or have to be changed manually.
-
- * A weird imagination is most useful to gain
- full advantage of all the features.
-
-
-File: screen.info, Node: Reporting Bugs, Next: Availability, Prev: Known Bugs, Up: Bugs
-
-Reporting Bugs
-==============
-
- If you find a bug in `Screen', please send
-electronic mail to `screen@uni-erlangen.de', and also to
-`bug-gnu-utils@prep.ai.mit.edu'. Include the version number of
-`Screen' which you are using. Also include in your message the
-hardware and operating system, the compiler used to compile, a
-description of the bug behavior, and the conditions that triggered the
-bug. Please recompile `screen' with the `-DDEBUG -DTMPTEST' options
-enabled, reproduce the bug, and have a look at the debug output written
-to the directory `/tmp/debug'. If necessary quote suspect passages from
-the debug output and show the contents of your `config.h' if it matters.
-
-
-File: screen.info, Node: Availability, Prev: Reporting Bugs, Up: Bugs
-
-Availability
-============
-
- `Screen' is available under the `GNU' copyleft.
-
- The latest official release of `screen'
-available via anonymous ftp from `prep.ai.mit.edu', `nic.funet.fi' or
-any other `GNU' distribution site. The home site of `screen' is
-`ftp.uni-erlangen.de (131.188.1.43)', in the directory
-`pub/utilities/screen'. The subdirectory `private' contains the latest
-beta testing release. If you want to help, send a note to
-screen@uni-erlangen.de.
-
-
-File: screen.info, Node: Installation, Next: Concept Index, Prev: Bugs, Up: Top
-
-Installation
-************
-
- Since `screen' uses pseudo-ttys, the select
-system call, and UNIX-domain sockets/named pipes, it will not run under
-a system that does not include these features of 4.2 and 4.3 BSD UNIX.
-
- * Menu:
-
- * Socket Directory:: Where screen stores its handle.
- * Compiling Screen::
-
-
-File: screen.info, Node: Socket Directory, Next: Compiling Screen, Up: Installation
-
-Socket Directory
-================
-
- The socket directory defaults either to
-`$HOME/.screen' or simply to `/tmp/screens' or preferably to
-`/usr/local/screens' chosen at compile-time. (`/var/run/screen'
-for Debian GNU/Linux). If `screen' is installed setuid root,
-then the administrator should compile screen with an adequate
-(not NFS mounted) `SOCKDIR'. If `screen' is not running
-setuid-root, the user can specify any mode 700 directory in the
-environment variable `$SCREENDIR'.
-
-
-File: screen.info, Node: Compiling Screen, Prev: Socket Directory, Up: Installation
-
-Compiling Screen
-================
-
- To compile and install screen:
-
- The `screen' package comes with a `GNU Autoconf'
-configuration script. Before you compile the package run
-
- `sh ./configure'
-
- This will create a `config.h' and `Makefile' for
-your machine. If `configure' fails for some reason, then look at the
-examples and comments found in the `Makefile.in' and `config.h.in'
-templates. Rename `config.status' to `config.status.MACHINE' when you
-want to keep configuration data for multiple architectures. Running `sh
-./config.status.MACHINE' recreates your configuration significantly
-faster than rerunning `configure'.
- Read through the "User Configuration" section of
-`config.h', and verify that it suits your needs. A comment near the
-top of this section explains why it's best to install screen setuid to
-root. Check for the place for the global `screenrc'-file and for the
-socket directory.
- Check the compiler used in `Makefile', the prefix
-path where to install `screen'. Then run
-
- `make'
-
- If `make' fails to produce one of the files
-`term.h', `comm.h' or `tty.c', then use `FILENAME.X.dist' instead. For
-additional information about installation of `screen' refer to the file
-`INSTALLATION', coming with this package.
-
-
-File: screen.info, Node: Concept Index, Next: Command Index, Prev: Installation, Up: Top
-
-Concept Index
-*************
-
- * Menu:
-
- * .screenrc: Startup Files.
- * availability: Availability.
- * binding: Key Binding.
- * bug report: Reporting Bugs.
- * bugs: Bugs.
- * capabilities: Special Capabilities.
- * Command Character: Command Character.
- * command line options: Invoking Screen.
- * command summary: Command Summary.
- * compiling screen: Compiling Screen.
- * control sequences: Control Sequences.
- * copy and paste: Copy and Paste.
- * customization: Customization.
- * environment: Environment.
- * Escape Character: Command Character.
- * files: Files.
- * flow control: Flow Control.
- * input translation: Input Translation.
- * installation: Installation.
- * introduction: Getting Started.
- * invoking: Invoking Screen.
- * key binding: Key Binding.
- * marking: Copy.
- * message line: Message Line.
- * multiuser session: Multiuser Session.
- * options: Invoking Screen.
- * overview: Overview.
- * regions: Regions.
- * screenrc: Startup Files.
- * scrollback: Copy.
- * socket directory: Socket Directory.
- * terminal capabilities: Special Capabilities.
- * title: Naming Windows.
-
-
File: screen.info, Node: Command Index, Next: Keystroke Index, Prev: Concept Index, Up: Top
Command Index
*************
- This is a list of all the commands supported by
-`screen'.
+ This is a list of all the commands supported by `screen'.
+
+* Menu:
+
+* acladd: Acladd.
+* aclchg: Aclchg.
+* acldel: Acldel.
+* aclgrp: Aclgrp.
+* aclumask: Umask.
+* activity: Monitor.
+* addacl: Acladd.
+* allpartial: Redisplay.
+* at: At.
+* attrcolor: Attrcolor.
+* autodetach: Detach.
+* autonuke: Autonuke.
+* bce: Character Processing.
+* bell_msg: Bell.
+* bind: Bind.
+* bindkey: Bindkey.
+* break: Break.
+* breaktype: Break.
+* bufferfile: Screen Exchange.
+* c1: Character Processing.
+* caption: Caption.
+* chacl: Aclchg.
+* charset: Character Processing.
+* chdir: Chdir.
+* clear: Clear.
+* colon: Colon.
+* command: Command Character.
+* compacthist: Scrollback.
+* console: Console.
+* copy: Copy.
+* copy_reg: Registers.
+* crlf: Line Termination.
+* debug: Debug.
+* defautonuke: Autonuke.
+* defbce: Character Processing.
+* defbreaktype: Break.
+* defc1: Character Processing.
+* defcharset: Character Processing.
+* defencoding: Character Processing.
+* defescape: Command Character.
+* defflow: Flow.
+* defgr: Character Processing.
+* defhstatus: Hardstatus.
+* deflog: Log.
+* deflogin: Login.
+* defmode: Mode.
+* defmonitor: Monitor.
+* defobuflimit: Obuflimit.
+* defscrollback: Scrollback.
+* defshell: Shell.
+* defsilence: Silence.
+* defslowpaste: Paste.
+* defutf8: Character Processing.
+* defwrap: Wrap.
+* defwritelock: Writelock.
+* defzombie: Zombie.
+* detach: Detach.
+* digraph: Digraph.
+* dinfo: Info.
+* displays: Displays.
+* dumptermcap: Dump Termcap.
+* echo: echo.
+* encoding: Character Processing.
+* escape: Command Character.
+* eval: Eval.
+* exec: Exec.
+* fit: Fit.
+* flow: Flow.
+* focus: Focus.
+* gr: Character Processing.
+* hardcopy: Hardcopy.
+* hardcopy_append: Hardcopy.
+* hardcopydir: Hardcopy.
+* hardstatus: Hardware Status Line.
+* height: Window Size.
+* help: Help.
+* history: History.
+* hstatus: Hardstatus.
+* ignorecase: Searching.
+* info: Info.
+* ins_reg: Registers.
+* kill: Kill.
+* lastmsg: Last Message.
+* license: License.
+* lockscreen: Lock.
+* log: Log.
+* logfile: Log.
+* login: Login.
+* logtstamp: Log.
+* mapdefault: Bindkey Control.
+* mapnotnext: Bindkey Control.
+* maptimeout: Bindkey Control.
+* markkeys: Copy Mode Keys.
+* meta: Command Character.
+* monitor: Monitor.
+* msgminwait: Message Wait.
+* msgwait: Message Wait.
+* multiuser: Multiuser.
+* nethack: Nethack.
+* next: Next and Previous.
+* nonblock: Nonblock.
+* number: Number.
+* obuflimit: Obuflimit.
+* only: Only.
+* other: Other Window.
+* partial: Redisplay.
+* password: Detach.
+* paste: Paste.
+* pastefont: Paste.
+* pow_break: Break.
+* pow_detach: Power Detach.
+* pow_detach_msg: Power Detach.
+* prev: Next and Previous.
+* printcmd: Printcmd.
+* process: Registers.
+* quit: Quit.
+* readbuf: Screen Exchange.
+* readreg: Paste.
+* redisplay: Redisplay.
+* register: Registers.
+* remove: Remove.
+* removebuf: Screen Exchange.
+* reset: Reset.
+* resize: Resize.
+* screen: Screen Command.
+* scrollback: Scrollback.
+* select: Select.
+* sessionname: Session Name.
+* setenv: Setenv.
+* setsid: Setsid.
+* shell: Shell.
+* shelltitle: Shell.
+* silence: Silence.
+* silencewait: Silence.
+* sleep: sleep.
+* slowpaste: Paste.
+* sorendition: Sorendition.
+* source: Source.
+* split: Split.
+* startup_message: Startup Message.
+* stuff: Registers.
+* su: Su.
+* suspend: Suspend.
+* term: Term.
+* termcap: Termcap Syntax.
+* termcapinfo: Termcap Syntax.
+* terminfo: Termcap Syntax.
+* time: Time.
+* title: Title Command.
+* umask: Umask.
+* unsetenv: Setenv.
+* utf8: Character Processing.
+* vbell: Bell.
+* vbell_msg: Bell.
+* vbellwait: Bell.
+* verbose: Verbose.
+* version: Version.
+* wall: Wall.
+* width: Window Size.
+* windowlist: Windowlist.
+* windows: Windows.
+* wrap: Wrap.
+* writebuf: Screen Exchange.
+* writelock: Writelock.
+* xoff: XON/XOFF.
+* xon: XON/XOFF.
+* zombie: Zombie.
- * Menu:
-
- * acladd: Acladd.
- * aclchg: Aclchg.
- * acldel: Acldel.
- * aclgrp: Aclgrp.
- * aclumask: Umask.
- * activity: Monitor.
- * addacl: Acladd.
- * allpartial: Redisplay.
- * at: At.
- * autodetach: Detach.
- * autonuke: Autonuke.
- * bell_msg: Bell.
- * bind: Bind.
- * bindkey: Bindkey.
- * break: Break.
- * breaktype: Break.
- * bufferfile: Screen-Exchange.
- * c1: Character Processing.
- * chacl: Aclchg.
- * charset: Character Processing.
- * chdir: Chdir.
- * clear: Clear.
- * colon: Colon.
- * command: Command Character.
- * console: Console.
- * copy: Copy.
- * copy_reg: Registers.
- * crlf: Line Termination.
- * debug: Debug.
- * defautonuke: Autonuke.
- * defbreaktype: Break.
- * defc1: Character Processing.
- * defcharset: Character Processing.
- * defescape: Command Character.
- * defflow: Flow.
- * defgr: Character Processing.
- * defhstatus: Hardstatus.
- * defkanji: Character Processing.
- * deflogin: Login.
- * defmode: Mode.
- * defmonitor: Monitor.
- * defobuflimit: Obuflimit.
- * defscrollback: Scrollback.
- * defshell: Shell.
- * defsilence: Silence.
- * defslowpaste: Paste.
- * defwrap: Wrap.
- * defwritelock: Writelock.
- * defzombie: Zombie.
- * detach: Detach.
- * digraph: Digraph.
- * displays: Displays.
- * dumptermcap: Dump Termcap.
- * echo: echo.
- * escape: Command Character.
- * exec: Exec.
- * flow: Flow.
- * focus: Focus.
- * gr: Character Processing.
- * hardcopy: Hardcopy.
- * hardcopydir: Hardcopy.
- * hardcopy_append: Hardcopy.
- * hardstatus: Hardware Status Line.
- * height: Window Size.
- * help: Help.
- * history: History.
- * info: Info.
- * ins_reg: Registers.
- * kanji: Character Processing.
- * kill: Kill.
- * lastmsg: Last Message.
- * license: License.
- * lockscreen: Lock.
- * log: Log.
- * logfile: Log.
- * login: Login.
- * mapdefault: Bindkey Control.
- * mapnotnext: Bindkey Control.
- * maptimeout: Bindkey Control.
- * markkeys: Copy Mode Keys.
- * meta: Command Character.
- * monitor: Monitor.
- * msgminwait: Message Wait.
- * msgwait: Message Wait.
- * multiuser: Multiuser.
- * nethack: Nethack.
- * next: Next and Previous.
- * nonblock: Nonblock.
- * number: Number.
- * obuflimit: Obuflimit.
- * one: One.
- * other: Other Window.
- * partial: Redisplay.
- * password: Detach.
- * paste: Paste.
- * pastefont: Paste.
- * pow_break: Break.
- * pow_detach: Power Detach.
- * pow_detach_msg: Power Detach.
- * preselect: Select.
- * prev: Next and Previous.
- * printcmd: Printcmd.
- * process: Registers.
- * quit: Quit.
- * readbuf: Screen-Exchange.
- * readreg: Paste.
- * redisplay: Redisplay.
- * register: Registers.
- * remove: Remove.
- * removebuf: Screen-Exchange.
- * reset: Reset.
- * screen: Screen Command.
- * scrollback: Scrollback.
- * select: Select.
- * sessionname: Session Name.
- * setenv: Setenv.
- * shell: Shell.
- * shelltitle: Shell.
- * silence: Silence.
- * silencewait: Silence.
- * sleep: sleep.
- * slowpaste: Paste.
- * sorendition: Sorendition.
- * split: Split.
- * startup_message: Startup Message.
- * stuff: Registers.
- * su: Su.
- * suspend: Suspend.
- * term: Term.
- * termcap: Termcap Syntax.
- * termcapinfo: Termcap Syntax.
- * terminfo: Termcap Syntax.
- * time: Time.
- * title: Title Command.
- * umask: Umask.
- * unsetenv: Setenv.
- * vbell: Bell.
- * vbellwait: Bell.
- * vbell_msg: Bell.
- * verbose: Verbose.
- * version: Version.
- * wall: Wall.
- * width: Window Size.
- * windows: Windows.
- * wrap: Wrap.
- * writebuf: Screen-Exchange.
- * writelock: Writelock.
- * xoff: XON/XOFF.
- * xon: XON/XOFF.
- * zombie: Zombie.
-

File: screen.info, Node: Keystroke Index, Prev: Command Index, Up: Top
Keystroke Index
***************
- This is a list of the default key bindings.
-
- The leading escape character (*note Command
-Character::.) has been omitted from the key sequences, since it is the
-same for all bindings.
+ This is a list of the default key bindings.
+
+ The leading escape character (*note Command Character::) has been
+omitted from the key sequences, since it is the same for all bindings.
+
+* Menu:
+
+* ": Windowlist.
+* ': Select.
+* *: Displays.
+* .: Dump Termcap.
+* 0...9: Select.
+* :: Colon.
+* <: Screen Exchange.
+* =: Screen Exchange.
+* >: Screen Exchange.
+* ?: Help.
+* [: Copy.
+* ]: Paste.
+* a: Command Character.
+* A: Title Command.
+* C: Clear.
+* c: Screen Command.
+* C-[: Copy.
+* C-\: Quit.
+* C-]: Paste.
+* C-a: Other Window.
+* C-c: Screen Command.
+* C-d: Detach.
+* C-f: Flow.
+* C-g: Bell.
+* C-h: Hardcopy.
+* C-i: Info.
+* C-k: Kill.
+* C-l: Redisplay.
+* C-m: Last Message.
+* C-n: Next and Previous.
+* C-p: Next and Previous.
+* C-q: XON/XOFF.
+* C-r: Wrap.
+* C-s: XON/XOFF.
+* C-t: Time.
+* C-v: Digraph.
+* C-w: Windows.
+* C-x: Lock.
+* C-z: Suspend.
+* D: Power Detach.
+* d: Detach.
+* ESC: Copy.
+* f: Flow.
+* F: Fit.
+* H: Log.
+* h: Hardcopy.
+* i: Info.
+* k: Kill.
+* l: Redisplay.
+* L: Login.
+* m: Last Message.
+* M: Monitor.
+* N: Number.
+* n: Next and Previous.
+* p: Next and Previous.
+* q: XON/XOFF.
+* Q: Only.
+* r: Wrap.
+* s: XON/XOFF.
+* S: Split.
+* SPC: Next and Previous.
+* t: Time.
+* TAB: Focus.
+* v: Version.
+* W: Window Size.
+* w: Windows.
+* X: Remove.
+* x: Lock.
+* Z: Reset.
+* z: Suspend.
+* {: History.
- * Menu:
-
- * ": Select.
- * ': Select.
- * *: Displays.
- * .: Dump Termcap.
- * 0...9: Select.
- * :: Colon.
- * <: Screen-Exchange.
- * =: Screen-Exchange.
- * >: Screen-Exchange.
- * ?: Help.
- * {: History.
- * A: Title Command.
- * a: Command Character.
- * C: Clear.
- * c: Screen Command.
- * C-a: Other Window.
- * C-c: Screen Command.
- * C-d: Detach.
- * C-f: Flow.
- * C-g: Bell.
- * C-h: Hardcopy.
- * C-i: Info.
- * C-k: Kill.
- * C-l: Redisplay.
- * C-m: Last Message.
- * C-n: Next and Previous.
- * C-p: Next and Previous.
- * C-q: XON/XOFF.
- * C-r: Wrap.
- * C-s: XON/XOFF.
- * C-t: Time.
- * C-v: Digraph.
- * C-w: Windows.
- * C-x: Lock.
- * C-z: Suspend.
- * C-[: Copy.
- * C-\: Quit.
- * C-]: Paste.
- * d: Detach.
- * D: Power Detach.
- * ESC: Copy.
- * F: Focus.
- * f: Flow.
- * h: Hardcopy.
- * H: Log.
- * i: Info.
- * k: Kill.
- * L: Login.
- * l: Redisplay.
- * M: Monitor.
- * m: Last Message.
- * n: Next and Previous.
- * N: Number.
- * p: Next and Previous.
- * q: XON/XOFF.
- * Q: One.
- * r: Wrap.
- * s: XON/XOFF.
- * S: Split.
- * SPC: Next and Previous.
- * t: Time.
- * v: Version.
- * W: Window Size.
- * w: Windows.
- * x: Lock.
- * X: Remove.
- * z: Suspend.
- * Z: Reset.
- * [: Copy.
- * ]: Paste.
-
diff --git a/doc/screen.texinfo b/doc/screen.texinfo
index 3d9a40e..56576b1 100644
--- a/doc/screen.texinfo
+++ b/doc/screen.texinfo
@@ -3,10 +3,15 @@
@c vi:set wm=5
@setfilename screen.info
@settitle Screen User's Manual
+@dircategory General Commands
@finalout
@setchapternewpage odd
@c %**end of header
-@set version 3.9.0
+@set version 3.9.11
+
+@direntry
+* Screen: (screen). Full-screen window manager.
+@end direntry
@c For examples, use a literal escape in info.
@ifinfo
@@ -19,7 +24,7 @@
@ifinfo
This file documents the @code{Screen} virtual terminal manager.
-Copyright (c) 1993-1995 Free Software Foundation, Inc.
+Copyright (c) 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -47,11 +52,11 @@ by the Foundation.
@title Screen
@subtitle The virtual terminal manager
@subtitle for Version @value{version}
-@subtitle Jul 1999
+@subtitle Jan 2002
@page
@vskip 0pt plus 1filll
-Copyright @copyright{} 1993-1995 Free Software Foundation, Inc.
+Copyright @copyright{} 1993-2002 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -171,7 +176,7 @@ name and its arguments to the window manager (specified in the $STY environment
variable) who will use it to create the new window. The above example would
start the @code{emacs} editor (editing @file{prog.c}) and switch to its window.
-If @file{/etc/utmp} is writable by @code{screen}, an appropriate record
+If @file{/var/run/utmp} is writable by @code{screen}, an appropriate record
will be written to this file for each window, and removed when the
window is closed. This is useful for working with @code{talk},
@code{script}, @code{shutdown}, @code{rsend}, @code{sccs} and other
@@ -300,7 +305,7 @@ Control}). Its use is discouraged.
@item -l
@itemx -ln
-Turn login mode on or off (for @file{/etc/utmp} updating). This option
+Turn login mode on or off (for @file{/var/run/utmp} updating). This option
is equivalent to the @code{deflogin} command (@pxref{Login}).
@item -ls [@var{match}]
@@ -332,11 +337,11 @@ whether @code{screen} is being called from within another @code{screen}
session or not. This flag has a special meaning in connection
with the @samp{-d} option:
@table @code
-@item -m -d
+@item -d -m
Start @code{screen} in @emph{detached} mode. This creates a new
session but doesn't attach to it. This is useful for system startup
scripts.
-@item -m -D
+@item -D -m
This also starts @code{screen} in @emph{detached} mode, but doesn't fork
a new process. The command exits if the session terminates.
@end table
@@ -352,7 +357,7 @@ more) sessions to resume and you should specify which one to choose.
In all other cases @samp{-q} has no effect.
@item -r [@var{pid.sessionname}]
-@itemx -r @var{sessionowner/[pid.sessionname]}
+@itemx -r @var{sessionowner}/[@var{pid.sessionname}]
Resume a detached @code{screen} session. No other options (except
combinations with @samp{-d} or @samp{-D}) may be specified, though
the session name
@@ -367,7 +372,9 @@ Resume the first appropriate detached @code{screen} session. If
successful, all other command-line options are ignored. If no detached
session exists, start a new session using the specified options, just as
if @samp{-R} had not been specified. This option is set by default if
-screen is run as a login-shell. For combinations with the
+screen is run as a login-shell (actually screen uses @samp{-xRR} in
+that case).
+For combinations with the
@samp{-D}/@samp{-d} option see there.
@item -s @var{program}
@@ -388,6 +395,11 @@ Set the title (name) for the default shell or specified program.
This option is equivalent to the @code{shelltitle} command
(@pxref{Shell}).
+@item -U
+Run screen in UTF-8 mode. This option tells screen that your terminal
+sends and understands UTF-8 encoded characters. It also sets the default
+encoding for new windows to @samp{utf8}.
+
@item -v
Print the version number.
@@ -401,6 +413,13 @@ See the @code{-r} flag for a description how to construct matches.
@item -x
Attach to a session which is already attached elsewhere (multi-display
mode).
+
+@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.
+
@end table
@node Customization, Commands, Invoking Screen, Top
@@ -413,10 +432,11 @@ to be executed at startup, or on the fly using the @code{colon} command.
@menu
* Startup Files:: The @file{.screenrc} file.
+* Source:: Read commands from a file.
* Colon:: Entering customization commands interactively.
@end menu
-@node Startup Files, Colon, , Customization
+@node Startup Files, Source, , Customization
@section The @file{.screenrc} file
@cindex .screenrc
@cindex screenrc
@@ -447,7 +467,23 @@ Two configuration files are shipped as examples with your screen
distribution: @file{etc/screenrc} and @file{etc/etcscreenrc}. They
contain a number of useful examples for various commands.
-@node Colon, , Startup Files, Customization
+@node Source, Colon, Startup Files, Customization
+@section Source
+@deffn Command source file
+(none)@*
+Read and execute commands from file @var{file}. Source commands
+may be nested to a maximum recursion level of ten. If @var{file}
+is not an absolute path and screen already processes a
+source command, the parent directory of the running source
+command file is used to search for the new command file before
+screen's current directory.
+
+Note that termcap/terminfo/termcapinfo commands only work
+at startup and reattach time, so they must be reached via
+the default screenrc files to have an effect.
+@end deffn
+
+@node Colon, , Source, Customization
@section Colon
Customization can also be done online, with this command:
@@ -505,11 +541,15 @@ The following table shows the default key bindings:
@table @asis
@item @kbd{C-a '}
-@itemx @kbd{C-a "}
(select)@*
Prompt for a window identifier and switch.
@xref{Selecting}.
+@item @kbd{C-a "}
+(windowlist -b)@*
+Present a list of all windows for selection.
+@xref{Selecting}.
+
@item @kbd{C-a 0@dots{}9, -}
(select 0@dots{}select 9, select -)@*
Switch to window number 0@dots{}9, or the blank window.
@@ -736,16 +776,16 @@ Copy and paste a previous (command) line. @xref{History}.
@item @kbd{C-a >}
(writebuf)@*
Write the paste buffer out to the screen-exchange file.
-@xref{Screen-Exchange}.
+@xref{Screen Exchange}.
@item @kbd{C-a <}
(readbuf)@*
Read the screen-exchange file into the paste buffer.
-@xref{Screen-Exchange}.
+@xref{Screen Exchange}.
@item @kbd{C-a =}
(removebuf)@*
-Delete the screen-exchange file. @xref{Screen-Exchange}.
+Delete the screen-exchange file. @xref{Screen Exchange}.
@item @kbd{C-a _}
(silence)@*
@@ -771,9 +811,9 @@ Allow other users in this session. @xref{Multiuser Session}.
Change a user's permissions. @xref{Multiuser Session}.
@item acldel @var{username}
Disallow other user in this session. @xref{Multiuser Session}.
-@item aclgrp @var{usrname [groupname]}
+@item aclgrp @var{usrname} [@var{groupname}]
Inherit permissions granted to a group leader. @xref{Multiuser Session}.
-@item aclumask @var{[users]+\-bits ...}
+@item aclumask [@var{users}]+/-@var{bits} ...
Predefine access to new windows. @xref{Umask}.
@item activity @var{message}
Set the activity notification message. @xref{Monitor}.
@@ -781,47 +821,51 @@ Set the activity notification message. @xref{Monitor}.
Synonym to @code{acladd}. @xref{Multiuser Session}.
@item allpartial @var{state}
Set all windows to partial refresh. @xref{Redisplay}.
-@item at @var{[ident][@kbd{#}@var{|}@kbd{*}@var{|}@kbd{%}] command [args]}
+@item at [@var{ident}][@kbd{#}@var{|}@kbd{*}@var{|}@kbd{%}] @var{command} [@var{args}]
Execute a command at other displays or windows. @xref{At}.
+@item attrcolor @var{attrib} [@var{attribute/color-modifier}]
+Map attributes to colors. @xref{Attrcolor}.
@item autodetach @var{state}
Automatically detach the session on SIGHUP. @xref{Detach}.
@item autonuke @var{state}
Enable a clear screen to discard unwritten output. @xref{Autonuke}.
-@item bell_msg @var{[message]}
+@item bce [@var{state}]
+Change background color erase. @xref{Character Processing}.
+@item bell_msg [@var{message}]
Set the bell notification message. @xref{Bell}.
-@item bind @var{key [command [args]]}
+@item bind [-c @var{class}] @var{key} [@var{command} [@var{args}]]
Bind a command to a key. @xref{Bind}.
-@item bindkey @var{[opts] [string [cmd args]]}
+@item bindkey [@var{opts}] [@var{string} [@var{cmd args}]]
Bind a string to a series of keystrokes. @xref{Bindkey}.
-@item break @var{[duration]}
+@item break [@var{duration}]
Send a break signal to the current window. @xref{Break}.
-@item breaktype @var{[tcsendbreak | TCSBRK | TIOCSBRK]}
+@item breaktype [@var{tcsendbreak} | @var{TCSBRK} | @var{TIOCSBRK}]
Specify how to generate breaks. @xref{Break}.
-@item bufferfile @var{[exchange-file]}
-Select a file for screen-exchange. @xref{Screen-Exchange}.
-@item c1 @var{[state]}
+@item bufferfile [@var{exchange-file}]
+Select a file for screen-exchange. @xref{Screen Exchange}.
+@item c1 [@var{state}]
Change c1 code processing. @xref{Character Processing}.
-@item caption @var{mode} @var{[string]}
+@item caption @var{mode} [@var{string}]
Change caption mode and string. @xref{Regions}.
@item chacl @var{usernames permbits list}
Synonym to @code{aclchg}. @xref{Multiuser Session}.
@item charset @var{set}
Change character set slot designation. @xref{Character Processing}.
-@item chdir @var{[directory]}
+@item chdir [@var{directory}]
Change the current directory for future windows. @xref{Chdir}.
@item clear
Clear the window screen. @xref{Clear}.
@item colon
Enter a @code{screen} command. @xref{Colon}.
-@item command
+@item command [-c @var{class}]
Simulate the screen escape key. @xref{Command Character}.
-@item compacthist @var{[state]}
+@item compacthist [@var{state}]
Selects compaction of trailing empty lines. @xref{Scrollback}.
-@item console @var{[state]}
+@item console [@var{state}]
Grab or ungrab console output. @xref{Console}.
@item copy
Enter copy mode. @xref{Copy}.
-@item copy_reg @var{[key]}
+@item copy_reg [@var{key}]
Removed. Use @code{paste} instead. @xref{Registers}.
@item crlf @var{state}
Select line break behavior for copying. @xref{Line Termination}.
@@ -829,22 +873,26 @@ Select line break behavior for copying. @xref{Line Termination}.
Suppress/allow debugging output. @xref{Debug}.
@item defautonuke @var{state}
Select default autonuke behavior. @xref{Autonuke}.
-@item defbreaktype @var{[tcsendbreak | TCSBRK | TIOCSBRK]}
+@item defbce @var{state}
+Select background color erase. @xref{Character Processing}.
+@item defbreaktype [@var{tcsendbreak} | @var{TCSBRK} | @var{TIOCSBRK}]
Specify the default for generating breaks. @xref{Break}.
@item defc1 @var{state}
Select default c1 processing behavior. @xref{Character Processing}.
-@item defcharset @var{[set]}
+@item defcharset [@var{set}]
Change defaul character set slot designation. @xref{Character Processing}.
+@item defencoding @var{enc}
+Select default window encoding. @xref{Character Processing}.
@item defescape @var{xy}
Set the default command and @code{meta} characters. @xref{Command Character}.
@item defflow @var{fstate}
Select default flow control behavior. @xref{Flow}.
@item defgr @var{state}
Select default GR processing behavior. @xref{Character Processing}.
-@item defhstatus @var{[status]}
+@item defhstatus [@var{status}]
Select default window hardstatus line. @xref{Hardstatus}.
-@item defkanji @var{wtype}
-Select default GR processing behavior. @xref{Character Processing}.
+@item deflog @var{state}
+Select default window logging behavior. @xref{Log}.
@item deflogin @var{state}
Select default utmp logging behavior. @xref{Login}.
@item defmode @var{mode}
@@ -861,56 +909,64 @@ Set the default program for new windows. @xref{Shell}.
Select default idle monitoring behavior. @xref{Silence}.
@item defslowpaste @var{msec}
Select the default inter-character timeout when pasting. @xref{Paste}.
+@item defutf8 @var{state}
+Select default character encoding. @xref{Character Processing}.
@item defwrap @var{state}
Set default line-wrapping behavior. @xref{Wrap}.
@item defwritelock @var{on|off|auto}
Set default writelock behavior. @xref{Multiuser Session}.
-@item defzombie @var{[keys]}
+@item defzombie [@var{keys}]
Keep dead windows. @xref{Zombie}.
-@item detach
+@item detach [-h]
Disconnect @code{screen} from the terminal. @xref{Detach}.
@item digraph
Enter digraph sequence. @xref{Digraph}.
+@item dinfo
+Display terminal information. @xref{Info}.
@item displays
List currently active user interfaces. @xref{Displays}.
@item dumptermcap
Write the window's termcap entry to a file. @xref{Dump Termcap}.
@item echo [-n] @var{message}
Display a message on startup. @xref{Startup}.
+@item encoding @var{enc} [@var{denc}]
+Set the encoding of a window. @xref{Character Processing}.
@item escape @var{xy}
Set the command and @code{meta} characters. @xref{Command Character}.
-@item exec @var{[[fdpat] command [args ...]]}
+@item eval @var{command1} [@var{command2} ...]
+Parse and execute each argument. @xref{Eval}.
+@item exec [[@var{fdpat}] @var{command} [@var{args} ...]]
Run a subprocess (filter). @xref{Exec}.
@item fit
Change window size to current display size. @xref{Window Size}.
-@item flow @var{[fstate]}
+@item flow [@var{fstate}]
Set flow control behavior. @xref{Flow}.
@item focus
Move focus to next region. @xref{Regions}.
-@item gr @var{[state]}
+@item gr [@var{state}]
Change GR charset processing. @xref{Character Processing}.
-@item hardcopy
+@item hardcopy [-h] [@var{file}]
Write out the contents of the current window. @xref{Hardcopy}.
@item hardcopy_append @var{state}
Append to hardcopy files. @xref{Hardcopy}.
@item hardcopydir @var{directory}
Place, where to dump hardcopy files. @xref{Hardcopy}.
-@item hardstatus @var{[state]}
+@item hardstatus [@var{state}]
Use the hardware status line. @xref{Hardware Status Line}.
-@item height @var{[lines]}
+@item height [@var{lines} [@var{cols}]]
Set display height. @xref{Window Size}.
-@item help
+@item help [-c @var{class}]
Display current key bindings. @xref{Help}.
@item history
Find previous command beginning @dots{}. @xref{History}.
@item hstatus @var{status}
Change the window's hardstatus line. @xref{Hardstatus}.
+@item ignorecase [@var{state}]
+Ignore character case in searches. @xref{Searching}.
@item info
-Display terminal settings. @xref{Info}.
-@item ins_reg @var{[key]}
+Display window settings. @xref{Info}.
+@item ins_reg [@var{key}]
Removed, use @code{paste} instead. @xref{Registers}.
-@item kanji @var{wtype [dtype]}
-Set the kanji type of a window. @xref{Character Processing}.
@item kill
Destroy the current window. @xref{Kill}.
@item lastmsg
@@ -919,13 +975,13 @@ Redisplay the last message. @xref{Last Message}.
Display licensing information. @xref{Startup}.
@item lockscreen
Lock the controlling terminal. @xref{Lock}.
-@item log @var{[state]}
+@item log [@var{state}]
Log all output in the current window. @xref{Log}.
@item logfile @var{filename}
Place where to collect logfiles. @xref{Log}.
-@item login @var{[state]}
-Log the window in @file{/etc/utmp}. @xref{Login}.
-@item logtstamp @var{[state]}
+@item login [@var{state}]
+Log the window in @file{/var/run/utmp}. @xref{Login}.
+@item logtstamp [@var{state}]
Configure logfile time-stamps. @xref{Log}.
@item mapdefault
Use only the default mapping table for the next keystroke. @xref{Bindkey Control}.
@@ -937,7 +993,7 @@ Set the inter-character timeout used for keymapping. @xref{Bindkey Control}.
Rebind keys in copy mode. @xref{Copy Mode Keys}.
@item meta
Insert the command character. @xref{Command Character}.
-@item monitor @var{[state]}
+@item monitor [@var{state}]
Monitor activity in window. @xref{Monitor}.
@item msgminwait @var{sec}
Set minimum message wait. @xref{Message Wait}.
@@ -951,9 +1007,9 @@ Use @code{nethack}-like error messages. @xref{Nethack}.
Switch to the next window. @xref{Selecting}.
@item nonblock @var{state}
Disable flow control to the current display. @xref{Nonblock}.
-@item number @var{[n]}
+@item number [@var{n}]
Change/display the current window's number. @xref{Number}.
-@item obuflimit @var{[limit]}
+@item obuflimit [@var{limit}]
Select output buffer limit. @xref{Obuflimit}.
@item only
Kill all other regions. @xref{Regions}.
@@ -961,55 +1017,59 @@ Kill all other regions. @xref{Regions}.
Switch to the window you were in last. @xref{Selecting}.
@item partial @var{state}
Set window to partial refresh. @xref{Redisplay}.
-@item password @var{[crypted_pw]}
+@item password [@var{crypted_pw}]
Set reattach password. @xref{Detach}.
-@item paste @var{[src_regs [dest_reg]]}
+@item paste [@var{src_regs} [@var{dest_reg}]]
Paste contents of paste buffer or registers somewhere. @xref{Paste}.
-@item pastefont @var{[state]}
+@item pastefont [@var{state}]
Include font information in the paste buffer. @xref{Paste}.
@item pow_break
Close and Reopen the window's terminal. @xref{Break}.
@item pow_detach
Detach and hang up. @xref{Power Detach}.
-@item pow_detach_msg @var{[message]}
+@item pow_detach_msg [@var{message}]
Set message displayed on @code{pow_detach}. @xref{Power Detach}.
@item prev
Switch to the previous window. @xref{Selecting}.
-@item printcmd @var{[cmd]}
+@item printcmd [@var{cmd}]
Set a command for VT100 printer port emulation. @xref{Printcmd}.
-@item process @var{[key]}
+@item process [@var{key}]
Treat a register as input to @code{screen}. @xref{Registers}.
@item quit
Kill all windows and exit. @xref{Quit}.
-@item readbuf
-Read the paste buffer from the screen-exchange file. @xref{Screen-Exchange}.
-@item readreg @var{[reg [file]]}
+@item readbuf [-e @var{encoding}] [@var{filename}]
+Read the paste buffer from the screen-exchange file. @xref{Screen Exchange}.
+@item readreg [-e @var{encoding}] [@var{reg} [@var{file}]]
Load a register from paste buffer or file. @xref{Registers}.
@item redisplay
Redisplay the current window. @xref{Redisplay}.
-@item register @var{key string}
+@item register [-e @var{encoding}] @var{key} @var{string}
Store a string to a register. @xref{Registers}.
@item remove
Kill current region. @xref{Regions}.
@item removebuf
-Delete the screen-exchange file. @xref{Screen-Exchange}.
+Delete the screen-exchange file. @xref{Screen Exchange}.
@item reset
Reset the terminal settings for the window. @xref{Reset}.
-@item screen @var{[opts] [n] [cmd [args]]}
+@item resize [(+/-)lines]
+Grow or shrink a region
+@item screen [@var{opts}] [@var{n}] [@var{cmd} [@var{args}]]
Create a new window. @xref{Screen Command}.
@item scrollback @var{num}
Set size of scrollback buffer. @xref{Scrollback}.
-@item select @var{[n]}
+@item select [@var{n}]
Switch to a specified window. @xref{Selecting}.
-@item sessionname @var{[name]}
+@item sessionname [@var{name}]
Name this session. @xref{Session Name}.
-@item setenv @var{[var [string]]}
+@item setenv [@var{var} [@var{string}]]
Set an environment variable for new windows. @xref{Setenv}.
+@item setsid @var{state}
+Controll process group creation for windows. @xref{Setsid}.
@item shell @var{command}
Set the default program for new windows. @xref{Shell}.
@item shelltitle @var{title}
Set the default name for new windows. @xref{Shell}.
-@item silence @var{[state|seconds]}
+@item silence [@var{state}|@var{seconds}]
Monitor a window for inactivity. @xref{Silence}.
@item silencewait @var{seconds}
Default timeout to trigger an inactivity notify. @xref{Silence}.
@@ -1017,7 +1077,9 @@ Default timeout to trigger an inactivity notify. @xref{Silence}.
Pause during startup. @xref{Startup}.
@item slowpaste @var{msec}
Slow down pasting in windows. @xref{Paste}.
-@item sorendition @var{[attr [color]]}
+@item source @var{file}
+Run commands from a file. @xref{Source}.
+@item sorendition [@var{attr} [@var{color}]]
Change text highlighting. @xref{Sorendition}.
@item split
Split region into two parts. @xref{Regions}.
@@ -1025,29 +1087,31 @@ Split region into two parts. @xref{Regions}.
Display copyright notice on startup. @xref{Startup}.
@item stuff @var{string}
Stuff a string in the input buffer of a window. @xref{Paste}.
-@item su @var{[username [password [password2]]]}
+@item su [@var{username} [@var{password} [@var{password2}]]]
Identify a user. @xref{Multiuser Session}.
@item suspend
Put session in background. @xref{Suspend}.
@item term @var{term}
Set @code{$TERM} for new windows. @xref{Term}.
-@item termcap @var{term terminal-tweaks [window-tweaks]}
+@item termcap @var{term} @var{terminal-tweaks} [@var{window-tweaks}]
Tweak termcap entries for best performance. @xref{Termcap Syntax}.
-@item terminfo @var{term terminal-tweaks [window-tweaks]}
+@item terminfo @var{term} @var{terminal-tweaks} [@var{window-tweaks}]
Ditto, for terminfo systems. @xref{Termcap Syntax}.
-@item termcapinfo @var{term terminal-tweaks [window-tweaks]}
+@item termcapinfo @var{term} @var{terminal-tweaks} [@var{window-tweaks}]
Ditto, for both systems. @xref{Termcap Syntax}.
-@item time
+@item time [@var{string}]
Display time and load average. @xref{Time}.
-@item title @var{[windowtitle]}
+@item title [@var{windowtitle}]
Set the name of the current window. @xref{Title Command}.
-@item umask @var{[users]+\-bits ...}
+@item umask [@var{users}]+/-@var{bits} ...
Synonym to @code{aclumask}. @xref{Umask}.
@item unsetenv @var{var}
Unset environment variable for new windows. @xref{Setenv}.
-@item vbell @var{[state]}
+@item utf8 [@var{state} [@var{dstate}]]
+Select character encoding of the current window. @xref{Character Processing}.
+@item vbell [@var{state}]
Use visual bell. @xref{Bell}.
-@item vbell_msg @var{[message]}
+@item vbell_msg [@var{message}]
Set vbell message. @xref{Bell}.
@item vbellwait @var{sec}
Set delay for vbell message. @xref{Bell}.
@@ -1055,21 +1119,23 @@ Set delay for vbell message. @xref{Bell}.
Display @code{screen} version. @xref{Version}.
@item wall @var{message}
Write a message to all displays. @xref{Multiuser Session}.
-@item width @var{[num]}
+@item width [@var{cols} [@var{lines}]]
Set the width of the window. @xref{Window Size}.
+@item windowlist [-b] | string [@var{string}] | title [@var{title}]
+Present a list of all windows for selection. @xref{Windowlist}.
@item windows
List active windows. @xref{Windows}.
-@item wrap @var{[state]}
+@item wrap [@var{state}]
Control line-wrap behavior. @xref{Wrap}.
-@item writebuf
-Write paste buffer to screen-exchange file. @xref{Screen-Exchange}.
-@item writelock @var{on|off|auto}
+@item writebuf [-e @var{encoding}] [@var{filename}]
+Write paste buffer to screen-exchange file. @xref{Screen Exchange}.
+@item writelock @var{on}|@var{off}|@var{auto}
Grant exclusive write permission. @xref{Multiuser Session}.
@item xoff
Send an XOFF character. @xref{XON/XOFF}.
@item xon
Send an XON character. @xref{XON/XOFF}.
-@item zombie @var{[keys]}
+@item zombie [@var{keys}]
Keep dead windows. @xref{Zombie}.
@end table
@@ -1313,6 +1379,7 @@ in that order by default (@pxref{New Window}).
* Next and Previous:: Forward or back one window.
* Other Window:: Switch back and forth between two windows.
* Select:: Switch to a window (and to one after @code{kill}).
+* Windowlist:: Present a list of all windows for selection.
@end menu
@node Next and Previous, Other Window, , Selecting
@@ -1346,13 +1413,12 @@ For instance, if you use the option @samp{-e]x},
this command becomes @kbd{]]} (@pxref{Command Character}).
@end deffn
-@node Select, , Other Window, Selecting
+@node Select, Windowlist, Other Window, Selecting
@section Select
@kindex 0@dots{}9
@kindex '
-@kindex "
@deffn Command select [n]
-(@kbd{C-a @var{n}}, @kbd{C-a '}, @kbd{C-a "})@*
+(@kbd{C-a @var{n}}, @kbd{C-a '})@*
Switch to the window with the number @var{n}.
If no window number is specified, you get prompted for an
identifier. This can be a window name (title) or a number.
@@ -1364,6 +1430,27 @@ compiled with a higher MAXWIN setting).
The special command @code{select -} switches to a blank window.
@end deffn
+@node Windowlist, , Select, Selecting
+@section Windowlist
+@kindex "
+@deffn Command windowlist [-b] | string [@var{string}] | title [@var{title}]
+(@kbd{C-a "})@*
+Display all windows in a table for visual window selection.
+The desired window can be selected via the standard
+movement keys (@pxref{Movement}) and activated via
+the return key. If the @code{-b} option is given, screen will
+switch to the blank window before presenting the list, so
+that the current window is also selectable.
+
+The table format can be changed with the string and title
+option, the title is displayed as table heading, while the
+lines are made by using the string setting. The default
+setting is @samp{Num Name%=Flags} for the title and
+@samp{%3n %t%=%f} for the lines. See the string escapes chapter
+(@pxref{String Escapes}) for more codes (e.g. color settings).
+
+@end deffn
+
@node Session Management, Regions, Selecting, Top
@chapter Session Management Commands
@@ -1400,8 +1487,10 @@ on by default.
(@kbd{C-a d}, @kbd{C-a C-d})@*
Detach the @code{screen} session (disconnect it from the terminal and
put it into the background). A detached @code{screen} can be resumed by
-invoking @code{screen} with the @code{-r} option. (@pxref{Invoking
-Screen})
+invoking @code{screen} with the @code{-r} option (@pxref{Invoking
+Screen}).
+The @code{-h} option tells screen to immediately close the connection
+to the terminal (@samp{hangup}).
@end deffn
@deffn Command password [crypted_pw]
@@ -1540,7 +1629,7 @@ Multi-user mode only.
@node Aclgrp, Displays, Acldel, Multiuser Session
@subsection Aclgrp
-@deffn Command aclgrp @var{username [groupname]}
+@deffn Command aclgrp @var{username} [@var{groupname}]
(none)@*
Creates groups of users that share common access rights. The
name of the group is the username of the group leader. Each
@@ -1564,8 +1653,8 @@ sessions.
@node Umask, Wall, Displays, Multiuser Session
@subsection aclumask
-@deffn Command aclumask @var{[[users]+bits |[users]-bits .... ]}
-@deffnx Command umask @var{[[users]+bits |[users]-bits .... ]}
+@deffn Command aclumask [@var{users}]+/-@var{bits} ...
+@deffnx Command umask [@var{users}]+/-@var{bits} ...
(none)@*
This specifies the access other users have to windows that
will be created by the caller of the command. @var{Users} may be no,
@@ -1612,7 +1701,7 @@ will be created with no writelocks.
@node Su, , Writelock, Multiuser Session
@subsection Su
-@deffn Command su @var{[username [password [password2]]]}
+@deffn Command su [@var{username} [@var{password} [@var{password2}]]]
(none)@*
Substitute the user of a display. The command prompts for
all parameters that are omitted. If passwords are specified
@@ -1630,7 +1719,7 @@ access to the commands available for user @samp{nobody}. These are
@node Session Name, Suspend, Multiuser Session, Session Management
@section Session Name
-@deffn Command sessionname @var{[name]}
+@deffn Command sessionname [@var{name}]
(none)@*
Rename the current session. Note that for @code{screen -list} the name
shows up with the process-id prepended. If the argument @var{name} is
@@ -1675,7 +1764,9 @@ which can contain different windows.
* Focus:: Change to the next region
* Only:: Delete all other regions
* Remove:: Delete the current region
+* Resize:: Grow or shrink a region
* Caption:: Control the window's caption
+* Fit:: Resize a window to fit the region
@end menu
@node Split, Focus, , Regions
@@ -1694,7 +1785,16 @@ window is displayed on the new region.
@deffn Command focus
(@kbd{C-a @key{Tab}})@*
Move the input focus to the next region. This is done in a cyclic
-way so that the top region is selected after the bottom one.
+way so that the top region is selected after the bottom one. If
+no subcommand is given it defaults to `down'. `up' cycles in the
+opposite order, `top' and `bottom' go to the top and bottom
+region respectively. Useful bindings are (j and k as in vi)
+@example
+bind j focus down
+bind k focus up
+bind t focus top
+bind b focus bottom
+@end example
@end deffn
@node Only, Remove, Focus, Regions
@@ -1705,7 +1805,7 @@ way so that the top region is selected after the bottom one.
Kill all regions but the current one.
@end deffn
-@node Remove, Caption, Only, Regions
+@node Remove, Resize, Only, Regions
@section Remove
@kindex X
@deffn Command remove
@@ -1713,7 +1813,23 @@ Kill all regions but the current one.
Kill the current region. This is a no-op if there is only one region.
@end deffn
-@node Caption, , Remove, Regions
+@node Resize, Caption, Remove, Regions
+@section Resize
+@deffn Command resize [(+/-)@var{lines}]
+(none)@*
+Resize the current region. The space will be removed from or added to
+the region below or if there's not enough space from the region above.
+@example
+resize +N increase current region height by N
+resize -N decrease current region height by N
+resize N set current region height to N
+resize = make all windows equally high
+resize max maximize current region height
+resize min minimize current region height
+@end example
+@end deffn
+
+@node Caption, Fit, Resize, Regions
@section Caption
@deffn Command caption @code{always}|@code{splitonly} [string]
@deffnx Command caption @code{string} [string]
@@ -1726,13 +1842,23 @@ even if only one window is displayed. The default
is @samp{splitonly}.
The second form changes the text used for the caption. You can use
-all string escapes (@xref{String Escapes}). @code{Screen} uses
+all string escapes (@pxref{String Escapes}). @code{Screen} uses
a default of @samp{%3n %t}.
You can mix both forms by providing the string as an additional
argument.
@end deffn
+@node Fit, , Caption, Regions
+@section Fit
+@kindex F
+@deffn Command fit
+(@kbd{C-a F})@*
+Change the window size to the size of the current region. This
+command is needed because screen doesn't adapt the window size
+automatically if the window is displayed more than once.
+@end deffn
+
@node Window Settings, Virtual Terminal, Regions, Top
@chapter Window Settings
@@ -1744,7 +1870,7 @@ terminal emulation itself.
* Naming Windows:: Control the name of the window
* Console:: See the host's console messages
* Kill:: Destroy an unwanted window
-* Login:: Control @file{/etc/utmp} logging
+* Login:: Control @file{/var/run/utmp} logging
* Mode:: Control the file mode of the pty
* Monitor:: Watch for activity in a window
* Windows:: List the active windows
@@ -1908,7 +2034,7 @@ current window's title to @samp{(unknown)} (C-a u).
@node Console, Kill, Naming Windows, Window Settings
@section Console
-@deffn Command console @var{[state]}
+@deffn Command console [@var{state}]
(none)@*
Grabs or un-grabs the machines console output to a window. When the argument
is omitted the current state is displayed.
@@ -1953,7 +2079,7 @@ compile time (@pxref{Installation}). Both commands are only present when
@kindex L
@deffn Command login [state]
(@kbd{C-a L})@*
-Adds or removes the entry in @file{/etc/utmp} for the current window.
+Adds or removes the entry in @file{/var/run/utmp} for the current window.
This controls whether or not the window is @dfn{logged in}. In addition
to this toggle, it is convenient to have ``log in'' and ``log out''
keys. For instance, @code{bind I login on} and @code{bind O
@@ -1968,7 +2094,7 @@ login off} will map these keys to be @kbd{C-a I} and @kbd{C-a O}
The mode of each newly allocated pseudo-tty is set to @var{mode}.
@var{mode} is an octal number as used by chmod(1). Defaults to 0622 for
windows which are logged in, 0600 for others (e.g. when @code{-ln} was
-specified for creation. @pxref{Screen Command}).
+specified for creation, @pxref{Screen Command}).
@end deffn
@node Monitor, Windows, Mode, Window Settings
@@ -2120,8 +2246,14 @@ ESC P (A) Device Control String
Outputs a string directly to the host
terminal without interpretation.
ESC _ (A) Application Program Command (Hardstatus)
-ESC ] (A) Operating System Command (Hardstatus, xterm
+ESC ] 0 ; string ^G (A) Operating System Command (Hardstatus, xterm
title hack)
+ESC ] 83 ; cmd ^G (A) Execute screen command. This only works if
+ multi-user support is compiled into screen.
+ The pseudo-user ":window:" is used to check
+ the access control list. Use "addacl :window:
+ -rwx #?" to create a user with no rights and
+ allow only the needed commands.
Control-N (A) Lock Shift G1 (SO)
Control-O (A) Lock Shift G0 (SI)
ESC n (A) Lock Shift G2
@@ -2142,6 +2274,7 @@ ESC [ Pn K Erase in Line
Pn = None or 0 From Cursor to End of Line
1 From Beginning of Line to Cursor
2 Entire Line
+ESC [ Pn X Erase character
ESC [ Pn A Cursor Up
ESC [ Pn B Cursor Down
ESC [ Pn C Cursor Right
@@ -2174,8 +2307,8 @@ ESC [ Ps ;...; Ps m Select Graphic Rendition
37 (A) Foreground White
39 (A) Foreground Default
40 (A) Background Black
- ... ...
- 49 (A) Background Default
+ ... ...
+ 49 (A) Background Default
ESC [ Pn g Tab Clear
Pn = None or 0 Clear Tab at Current Position
3 Clear All Tabs
@@ -2199,7 +2332,9 @@ ESC [ Ps ;...; Ps l Reset Mode
?5 (V) Reverse Video
?6 (V) @samp{Origin} Mode
?7 (V) @samp{Wrap} Mode
+ ?9 X10 mouse tracking
?25 (V) Visible Cursor
+ ?1000 (V) VT200 mouse tracking
ESC [ 5 i (A) Start relay to printer (ANSI Media Copy)
ESC [ 4 i (A) Stop relay to printer (ANSI Media Copy)
ESC [ 8 ; Ph ; Pw t Resize the window to @samp{Ph} lines and
@@ -2227,7 +2362,7 @@ Because the sequences generated by a keypress can
change after a reattach from a different terminal type, it is
possible to bind commands to the termcap name of the keys.
@code{Screen} will insert the correct binding after each
-reattach. @xref{Bindkey} for further details on the syntax and examples.
+reattach. See @ref{Bindkey} for further details on the syntax and examples.
Here is the table of the default key bindings. (A) means that the
command is executed if the keyboard is switched into application
@@ -2255,9 +2390,8 @@ Function key 7 k7 stuff \033[18~
Function key 8 k8 stuff \033[19~
Function key 9 k9 stuff \033[20~
Function key 10 k; stuff \033[21~
-Function key 11 F1 stuff \033[22~
-Function key 12 F2 stuff \033[23~
-Backspace kb stuff \010
+Function key 11 F1 stuff \033[23~
+Function key 12 F2 stuff \033[24~
Home kh stuff \033[1~
End kH stuff \033[4~
Insert kI stuff \033[2~
@@ -2391,7 +2525,7 @@ window: the cursor position in the form @samp{(@var{column},@var{row})}
starting with @samp{(1,1)}, the terminal width and height plus the size
of the scrollback buffer in lines, like in @samp{(80,24)+50},
the current state of window XON/XOFF flow control is shown like this
-(see also @xref{Flow Control}):
+(@pxref{Flow Control}):
@example
+flow automatic flow control, currently on.
-flow automatic flow control, currently off.
@@ -2412,6 +2546,7 @@ The currently active
character set (@samp{G0}, @samp{G1}, @samp{G2}, or @samp{G3}), and in
square brackets the terminal character sets that are currently
designated as @samp{G0} through @samp{G3}.
+If the window is in UTF-8 mode, the string @samp{UTF-8} is shown instead.
Additional modes depending on the type of the window are displayed at
the end of the status line (@pxref{Window Types}).
@@ -2421,6 +2556,12 @@ the info line is started with a string identifying the current state.
For system information use @code{time}.
@end deffn
+@deffn Command dinfo
+(none)@*
+Show what screen thinks about your terminal. Useful if you want to know
+why features like color or the alternate charset don't work.
+@end deffn
+
@node Redisplay, Wrap, Info, Virtual Terminal
@section Redisplay
@@ -2485,28 +2626,24 @@ an application.
@node Window Size, Character Processing, Reset, Virtual Terminal
@section Window Size
@kindex W
-@deffn Command width [num]
+@deffn Command width [@code{-w}|@code{-d}] [cols [lines]]
(@kbd{C-a W})@*
Toggle the window width between 80 and 132 columns, or set it to
-@var{num} columns if an argument is specified. This requires a
+@var{cols} columns if an argument is specified. This requires a
capable terminal and the termcap entries @samp{Z0} and @samp{Z1}. See
the @code{termcap} command (@pxref{Termcap}), for more information.
+You can also specify a height if you want to
+change both values. The @code{-w} option tells screen to leave
+the display size unchanged and just set the window size,
+@code{-d} vice versa.
@end deffn
-@deffn Command height @var{[lines]}
+@deffn Command height [@code{-w}|@code{-d}] [lines [cols]]
(none)@*
Set the display height to a specified number of lines. When no
argument is given it toggles between 24 and 42 lines display.
@end deffn
-@kindex F
-@deffn Command fit
-(@kbd{C-a F})@*
-Change the window size to the size of the current region. This
-command is needed because screen doesn't adapt the window size
-automatically if the window is displayed more than once.
-@end deffn
-
@node Character Processing, ,Window Size, Virtual Terminal
@section Character Processing
@@ -2530,16 +2667,34 @@ default (see also @samp{defgr}) is not to process GR switching because
otherwise the ISO88591 charset would not work.
@end deffn
-@deffn Command kanji wtype [dtype]
+@deffn Command bce [state]
(none)@*
-Tell screen how to process kanji input/output. @var{wtype} and
-@var{dtype} must be one of the strings @samp{jis}, @samp{euc} or
-@samp{sjis}. The first argument sets the kanji type of the current
-window. Each window can emulate a different type. The optional second
-parameter tells screen how to write the kanji codes to the
-connected terminal. The preferred method of setting the display type
-is to use the @samp{KJ} termcap entry. @xref{Special Capabilities}.
-See also @samp{defkanji}, which changes the default setting of a new
+Change background-color-erase setting. If @samp{bce} is set to
+on, all characters cleared by an erase/insert/scroll/clear
+operation will be displayed in the current background color.
+Otherwise the default background color is used.
+@end deffn
+
+@deffn Command encoding enc [denc]
+(none)@*
+Tell screen how to interpret the input/output. The first argument
+sets the encoding of the current window.
+Each window can emulate a different encoding. The optional second
+parameter overwrites the encoding of the connected terminal.
+It should never be needed as screen uses the locale setting to detect
+the encoding.
+There is also a way to select a terminal encoding depending on
+the terminal type by using the @samp{KJ} termcap entry. @xref{Special Capabilities}.
+
+Supported encodings are
+@code{eucJP}, @code{SJIS}, @code{eucKR},
+@code{eucCN}, @code{Big5}, @code{KOI8-R}, @code{CP1251},
+@code{UTF-8}, @code{ISO8859-2}, @code{ISO8859-3},
+@code{ISO8859-4}, @code{ISO8859-5}, @code{ISO8859-6},
+@code{ISO8859-7}, @code{ISO8859-8}, @code{ISO8859-9},
+@code{ISO8859-10}, @code{ISO8859-15}, @code{jis}.
+
+See also @samp{defencoding}, which changes the default setting of a new
window.
@end deffn
@@ -2553,9 +2708,22 @@ charset mapping. On every position a @samp{.} may be used to indicate
that the corresponding charset/mapping should not be changed
(@var{set} is padded to six characters internally by appending
@samp{.} chars). New windows have @samp{BBBB02} as default
-charset, unless a @samp{kanji} command is active.
+charset, unless a @samp{encoding} command is active.
-The current setting can be viewed with the @xref{Info} command.
+The current setting can be viewed with the @ref{Info} command.
+@end deffn
+
+@deffn Command utf8 [state [dstate]]
+(none)@*
+Change the encoding used in the current window. If utf8 is enabled, the
+strings sent to the window will be UTF-8 encoded and vice versa.
+Omitting the
+parameter toggles the setting. If a second parameter is given, the
+display's
+encoding is also changed (this should rather be done with screen's
+@samp{-U} option).
+See also @samp{defutf8}, which changes the default setting of a new
+window.
@end deffn
@deffn Command defc1 state
@@ -2570,10 +2738,17 @@ Same as the @samp{gr} command except that the default setting for
new windows is changed. Initial setting is @samp{off}.
@end deffn
-@deffn Command defkanji wtype
+@deffn Command defbce state
+(none)@*
+Same as the @samp{bce} command except that the default setting for
+new windows is changed. Initial setting is @samp{off}.
+@end deffn
+
+@deffn Command defencoding enc
(none)@*
-Same as the @samp{kanji} command except that the default setting for
-new windows is changed. Initial setting is @samp{off}, i.e. @samp{jis}.
+Same as the @samp{encoding} command except that the default setting for
+new windows is changed. Initial setting is the encoding taken from the
+terminal.
@end deffn
@deffn Command defcharset [set]
@@ -2582,6 +2757,13 @@ new windows is changed. Shows current default if called without
argument.
@end deffn
+@deffn Command defutf8 state
+(none)@*
+Same as the @samp{utf8} command except that the default setting for new
+windows is changed. Initial setting is @code{on} if screen was started
+with @samp{-U}, otherwise @code{off}.
+@end deffn
+
@node Copy and Paste, Subprocess Execution, Virtual Terminal, Top
@chapter Copy and Paste
@cindex copy and paste
@@ -2594,7 +2776,7 @@ systems.
* Copy:: Copy from scrollback to buffer
* Paste:: Paste from buffer into window
* Registers:: Longer-term storage
-* Screen-Exchange:: Sharing data between screen users
+* Screen Exchange:: Sharing data between screen users
* History:: Recalling previous input
@end menu
@@ -2756,6 +2938,12 @@ digits @kbd{0@dots{}9}) which is taken as a repeat count. Example:
@noindent
@kbd{C-r} @code{emacs} style reverse i-search.
+@deffn Command ignorecase [state]
+(none)@*
+Tell screen to ignore the case of caracters in searches. Default is
+@code{off}.
+@end deffn
+
@node Specials, , Searching, Copy
@subsection Specials
@@ -2800,7 +2988,7 @@ the contents of the paste buffer will not be overwritten, but appended to.
@noindent
@kbd{>} sets the (second) mark and writes the contents of the paste buffer
to the screen-exchange file (@file{/tmp/screen-exchange} per default)
-once copy-mode is finished. @xref{Screen-Exchange}.@*
+once copy-mode is finished. @xref{Screen Exchange}.@*
This example demonstrates how to dump the
whole scrollback buffer to that file: @*@kbd{C-a [ g SPACE G $ >}.
@@ -2863,13 +3051,14 @@ amounts of text.
@code{defslowpaste} specifies the default for new windows.
@end deffn
-@deffn Command readreg [register [filename]]
+@deffn Command readreg [-e encoding] [register [filename]]
(none)@*
Does one of two things, dependent on number of arguments: with zero or one
arguments it it duplicates the paste buffer contents into the register specified
or entered at the prompt. With two arguments it reads the contents of the named
file into the register, just as @code{readbuf} reads the screen-exchange file
into the paste buffer.
+You can tell screen the encoding of the file via the @code{-e} option.
The following example will paste the system's password file into
the screen window (using register p, where a copy remains):
@@ -2879,7 +3068,7 @@ C-a : paste p
@end example
@end deffn
-@node Registers, Screen-Exchange, Paste, Copy and Paste
+@node Registers, Screen Exchange, Paste, Copy and Paste
@section Registers
@deffn Command copy_reg [key]
@@ -2900,9 +3089,10 @@ register name. The text is parsed as if it had been typed in from the user's
keyboard. This command can be used to bind multiple actions to a single key.
@end deffn
-@deffn Command register key string
+@deffn Command register [-e encoding] key string
(none)@*
Save the specified @var{string} to the register @var{key}.
+The encoding of the string can be specified via the @code{-e} option.
@end deffn
@deffn Command stuff string
@@ -2910,14 +3100,14 @@ Save the specified @var{string} to the register @var{key}.
Stuff the string @var{string} in the input buffer of the current window.
This is like the @code{paste} command, but with much less overhead.
You cannot paste large buffers with the @code{stuff} command. It is most
-useful for key bindings. @xref{Bindkey}
+useful for key bindings. @xref{Bindkey}.
@end deffn
-@node Screen-Exchange, History, Registers, Copy and Paste
-@section Screen-Exchange
+@node Screen Exchange, History, Registers, Copy and Paste
+@section Screen Exchange
-@deffn Command bufferfile [exchange-file]
+@deffn Command bufferfile [@var{exchange-file}]
(none)@*
Change the filename used for reading and writing with the paste buffer.
If the @var{exchange-file} parameter is omitted, @code{screen} reverts
@@ -2933,9 +3123,11 @@ C-a : bufferfile
@end deffn
@kindex <
-@deffn Command readbuf
+@deffn Command readbuf [-e @var{encoding}] [@var{filename}]
(@kbd{C-a <})@*
-Reads the contents of the current screen-exchange file into the paste buffer.
+Reads the contents of the specified file into the paste buffer.
+You can tell screen the encoding of the file via the @code{-e} option.
+If no file is specified, the screen-exchange filename is used.
@end deffn
@kindex =
@@ -2945,15 +3137,19 @@ Unlinks the screen-exchange file.
@end deffn
@kindex >
-@deffn Command writebuf
+@deffn Command writebuf [-e @var{encoding}] [@var{filename}]
(@kbd{C-a >})@*
-Writes the contents of the paste buffer to a public accessible
-screen-exchange file. This is thought of as a primitive means of
-communication between @code{screen} users on the same host. See also
+Writes the contents of the paste buffer to the specified file, or the
+public accessible screen-exchange file if no filename is given.
+This is thought of as a primitive means of
+communication between @code{screen} users on the same host.
+If an encoding is specified the paste buffer is recoded on the fly to
+match the encoding.
+See also
@kbd{C-a @key{ESC}} (@pxref{Copy}).
@end deffn
-@node History, , Screen-Exchange, Copy and Paste
+@node History, , Screen Exchange, Copy and Paste
@section History
@kindex @{
@@ -2982,7 +3178,7 @@ Use with care!
@node Exec, Using Exec, , Subprocess Execution
@section Exec
-@deffn Command exec @var{[[fdpat] newcommand [args ... ]]}
+@deffn Command exec [[@var{fdpat}] @var{newcommand} [@var{args} ... ]]
(none)@*
Run a unix subprocess (specified by an executable path @var{newcommand} and
its optional arguments) in the current window. The flow of data between
@@ -3095,7 +3291,7 @@ preferences.
@node Bind, Bind Examples, , Key Binding
@section The @code{bind} command
-@deffn Command bind key [command [args]]
+@deffn Command bind [-c class] key [command [args]]
(none)@*
Bind a command to a key. The @var{key} argument is either a single
character, a two-character sequence of the form @samp{^x} (meaning
@@ -3106,6 +3302,11 @@ quoted, if you like. If no further argument is given, any previously
established binding for this key is removed. The @var{command}
argument can be any command (@pxref{Command Index}).
+If a command class is specified via the @code{-c} option, the
+key is bound for the specified class. Use the @code{command}
+command to activate a class. Command classes can be used
+to create multiple command keys or multi-character bindings.
+
By default, most suitable commands are bound to one or more keys
(@pxref{Default Key Bindings}; for instance, the command to create a
new window is bound to @kbd{C-c} and @kbd{c}. The @code{bind} command
@@ -3132,6 +3333,22 @@ available as @kbd{C-a space}), bind @kbd{C-f} to the command
@samp{root} in slot #9, with a superuser shell and a scrollback buffer
of 1000 lines.
+@example
+bind -c demo1 0 select 10
+bind -c demo1 1 select 11
+bind -c demo1 2 select 12
+bindkey "^B" command -c demo1
+@end example
+makes @kbd{C-b 0} select window 10, @kbd{C-b 1} window 11, etc.
+
+@example
+bind -c demo2 0 select 10
+bind -c demo2 1 select 11
+bind -c demo2 2 select 12
+bind - command -c demo2
+@end example
+makes @kbd{C-a - 0} select window 10, @kbd{C-a - 1} window 11, etc.
+
@node Command Character, Help, Bind Examples, Key Binding
@cindex escape character
@cindex command character
@@ -3169,11 +3386,12 @@ window. The keystroke for this command is the second parameter to the
@code{escape} .screenrc directive.
@end deffn
-@deffn Command command
+@deffn Command command [-c @var{class}]
(none)@*
This command has the same effect as typing the screen escape character
(@kbd{C-a}). It is probably only useful for key bindings.
-@xref{Bindkey}.
+If the @samp{-c} option is given, select the specified command class.
+@xref{Bind}, @xref{Bindkey}.
@end deffn
@node Help, Bindkey, Command Character, Key Binding
@@ -3186,19 +3404,21 @@ pages list all the internal commands followed by their bindings.
Subsequent pages will display the custom commands, one command per key.
Press space when you're done reading each page, or return to exit early.
All other characters are ignored.
+If the @samp{-c} option is given, display all bound commands for the
+specified command class.
@xref{Default Key Bindings}.
@end deffn
@node Bindkey, Bindkey Examples, Help, Key Binding
@section Bindkey
-@deffn Command bindkey @var{[opts] [string [cmd args]]}
+@deffn Command bindkey [@var{opts}] [@var{string} [@var{cmd} @var{args}]]
(none)@*
This command manages screen's input translation tables. Every
entry in one of the tables tells screen how to react if a certain
sequence of characters is encountered. There are three tables:
one that should contain actions programmed by the user, one for
the default actions used for terminal emulation and one for
-screen's copy mode to do cursor movement. @xref{Input Translation}
+screen's copy mode to do cursor movement. See @ref{Input Translation}
for a list of default key bindings.
If the @samp{-d}
@@ -3686,8 +3906,8 @@ Set the output buffer limit. See the @samp{obuflimit} command
@item KJ
(str)@*
-Set the kanji type of the terminal. Valid strings are @samp{jis},
-@samp{euc} and @samp{sjis}.
+Set the encoding of the terminal. See the @samp{encoding} command
+(@pxref{Character Processing}) for valid encodings.
@item AF
(str)@*
@@ -3708,6 +3928,14 @@ Does understand ANSI set default fg/bg color (@samp{\E[39m / \E[49m}).
Describe a translation of characters to strings depending on the
current font. (@pxref{Character Translation}).
+@item XT
+(bool)@*
+Terminal understands special xterm sequences (OSC, mouse tracking).
+
+@item C8
+(bool)@*
+Terminal needs bold to display high-intensity colors (e.g. Eterm).
+
@item TF
(bool)@*
Add missing capabilities to the termcap/info entry. (Set by default).
@@ -3732,7 +3960,7 @@ want to have a terminal type dependent setting.
@node Obuflimit, Character Translation, Autonuke, Termcap
@section Obuflimit
-@deffn Command obuflimit @var{[limit]}
+@deffn Command obuflimit [@var{limit}]
(none)@*
If the output buffer contains more bytes than the specified limit, no
more data will be read from the windows. The default value is 256. If
@@ -3875,10 +4103,10 @@ the type even if the terminal supports a hardstatus line.
The third form specifies the contents of the hardstatus line.
@code{%h} is used as default string, i.e. the stored hardstatus of the
-current window (settable via @samp{\E]0;^G} or @samp{\E_\\}) is
+current window (settable via @samp{ESC]0;^G} or @samp{ESC_\\}) is
displayed.
You can customize this to any string you like including
-string escapes (@xref{String Escapes}).
+string escapes (@pxref{String Escapes}).
If you leave
out the argument @var{string}, the current string is displayed.
@@ -3925,12 +4153,15 @@ This section describes the commands for keeping a record of your session.
@section hardcopy
@kindex h
@kindex C-h
-@deffn Command hardcopy
+@deffn Command hardcopy [-h] [@var{file}]
(@kbd{C-a h}, @kbd{C-a C-h})@*
-Writes out the current display contents to the file @file{hardcopy.@var{n}}
-in the window's default directory, where @var{n} is the number of the
+Writes out the currently displayed image to the file @var{file}, or,
+if no filename is specified, to @file{hardcopy.@var{n}}
+in the default directory, where @var{n} is the number of the
current window. This either appends or overwrites the file if it
exists, as determined by the @code{hardcopy_append} command.
+If the option @code{-h} is specified, dump also the
+contents of the scrollback buffer.
@end deffn
@deffn Command hardcopy_append state
@@ -3949,6 +4180,13 @@ directory.
@node Log, , Hardcopy, Logging
@section log
+
+@deffn Command deflog state
+(none)@*
+Same as the @code{log} command except that the default setting for new
+windows is changed. Initial setting is `off'.
+@end deffn
+
@kindex H
@deffn Command log [state]
(@kbd{C-a H})@*
@@ -4048,6 +4286,9 @@ categories.
* Zombie:: Keep dead windows.
* Printcmd:: Set command for VT100 printer port emulation.
* Sorendition:: Change the text highlighting method.
+* Attrcolor:: Map attributes to colors.
+* Setsid:: Change process group management
+* Eval:: Parse and execute arguments
@end menu
@node At, Break, , Miscellaneous
@@ -4170,7 +4411,7 @@ may be helpful when multiple displays show the same window.
@node Number, Silence, Nonblock, Miscellaneous
@section Number
@kindex N
-@deffn Command number @var{[n]}
+@deffn Command number [@var{n}]
(@kbd{C-a N})@*
Change the current window's number. If the given number @var{n} is already
used by another window, both windows exchange their numbers. If no argument is
@@ -4179,7 +4420,7 @@ specified, the current window number (and title) is shown.
@node Silence, Time, Number, Miscellaneous
@section Silence
-@deffn Command silence @var{[state|sec]}
+@deffn Command silence [@var{state}|@var{sec}]
(none)@*
Toggles silence monitoring of windows. When silence is turned on and an
affected window is switched into the background, you will receive the
@@ -4205,11 +4446,13 @@ before displaying a message. Default is 30 seconds.
@section Time
@kindex t
@kindex C-t
-@deffn Command time
+@deffn Command time [@var{string}]
(@kbd{C-a t}, @kbd{C-a C-t})@*
Uses the message line to display the time of day, the host name, and the
load averages over 1, 5, and 15 minutes (if this is available on your
system). For window-specific information use @code{info} (@pxref{Info}).
+If a @var{string} is specified, it changes the format of the time report
+like it is described in the string escapes chapter (@pxref{String Escapes}). Screen uses a default of @samp{%c:%s %M %d %H%? %l%?}.
@end deffn
@node Verbose, Version, Time, Miscellaneous
@@ -4230,8 +4473,8 @@ Display the version and modification date in the message line.
@node Zombie, Printcmd, Version, Miscellaneous
@section Zombie
-@deffn Command zombie @var{[keys]}
-@deffnx Command defzombie @var{[keys]}
+@deffn Command zombie [@var{keys}]
+@deffnx Command defzombie [@var{keys}]
(none)@*
Per default windows are removed from the window list as soon as the
windows process (e.g. shell) exits. When a string of two keys is
@@ -4250,7 +4493,7 @@ setting, the commands @code{zombie} and @code{defzombie} are synonymous.
@node Printcmd, Sorendition, Zombie, Miscellaneous
@section Printcmd
-@deffn Command printcmd @var{[cmd]}
+@deffn Command printcmd [@var{cmd}]
(none)@*
If @var{cmd} is not an empty string, screen will not use the terminal
capabilities @code{po/pf} for printing if it detects an ansi print
@@ -4264,19 +4507,64 @@ Warning: Be careful with this command! If other user have write
access to your terminal, they will be able to fire off print commands.
@end deffn
-@node Sorendition, , Printcmd, Miscellaneous
+@node Sorendition, Attrcolor, Printcmd, Miscellaneous
@section Sorendition
-@deffn Command sorendition @var{[attr [color]]}
+@deffn Command sorendition [@var{attr} [@var{color}]]
(none)@*
Change the way screen does highlighting for text marking and printing
messages.
-@var{attr} is a hexadecimal number and describes the attributes
-(inverse, underline, ...) the text will get. @var{color}
-is a 2 digit number and changes the
-foreground/background of the highlighted text.
-Some knowledge of screen's internal character representation is
-needed to make the characters appear in the desired way. The default
-is currently @samp{10 99} (standout, default colors).
+See the chapter
+about string escapes (@pxref{String Escapes}) for the syntax of
+the modifiers. The default is currently @samp{=s dd} (standout,
+default colors).
+@end deffn
+
+@node Attrcolor, Setsid, Sorendition, Miscellaneous
+@section Attrcolor
+@deffn Command attrcolor @var{attrib} [@var{attribute/color-modifier}]
+(none)@*
+This command can be used to highlight attributes by changing the color of
+the text. If the attribute
+@var{attrib}
+is in use, the specified attribute/color modifier is also applied. If no
+modifier is given, the current one is deleted. See the chapter
+about string escapes (@pxref{String Escapes}) for the syntax of
+the modifier. Screen understands two pseudo-attributes, @code{i}
+stands for high-intensity foreground color and @code{I} for
+high-intensity background color.
+
+@noindent
+Examples:
+@table @code
+@item attrcolor b "R"
+Change the color to bright red if bold text is to be printed.
+@item attrcolor u "-u b"
+Use blue text instead of underline.
+@item attrcolor b "I"
+Use bright colors for bold text. Most terminal emulators do this
+already.
+@item attrcolor i "+b"
+Make bright colored text also bold.
+@end table
+@end deffn
+
+@node Setsid, Eval, Attrcolor, Miscellaneous
+@section Setsid
+@deffn Command setsid state
+(none)@*
+Normally screen uses different sessions and process groups for
+the windows. If setsid is turned @code{off}, this is not done
+anymore and all windows will be in the same process group as the
+screen backend process. This also breaks job-control, so be careful.
+The default is @code{on}, of course. This command is probably useful
+only in rare circumstances.
+@end deffn
+
+@node Eval, , Setsid, Miscellaneous
+@section Eval
+@deffn Command eval @var{command1} [@var{command2} ...]
+(none)@*
+Parses and executes each argument as seperate command.
@end deffn
@node String Escapes, Environment, Miscellaneous, Top
@@ -4304,8 +4592,14 @@ current time @code{HH:MM} in 12h format
day number
@item D
weekday name
+@item f
+flags of the window
+@item F
+sets %? to true if the window has the focus
@item h
hardstatus of the window
+@item H
+hostname of the system
@item l
current load of the system
@item m
@@ -4321,7 +4615,9 @@ window title
@item u
all other users on this window
@item w
-all window numbers and names
+all window numbers and names. With @code{-} quailifier: up to the current
+window; with @code{+} qualifier: starting with the window after the current
+one.
@item W
all window numbers and names except the current one
@item y
@@ -4333,11 +4629,125 @@ the part to the next @code{%?} is displayed only if an escape expands
to an nonempty string
@item :
else part of @code{%?}
+@item =
+pad the string to the display's width (like TeX's hfill). If a
+number is specified, pad to the percentage of the window's width.
+A @code{0} qualifier tells screen to treat the number as absolute position.
+You can specify to pad relative to the last absolute pad position
+by adding a @code{+} qualifier or to pad relative to the right margin
+by using @code{-}. The padding truncates the string if the specified
+position lies before the current position. Add the @code{L} qualifier
+to change this.
+@item <
+same as @code{%=} but just do truncation, do not fill with spaces
+@item >
+mark the current text position for the next truncation. When
+screen needs to do truncation, it tries to do it in a way that
+the marked position gets moved to the specified percentage of
+the output area. (The area starts from the last absolute pad
+position and ends with the position specified by the truncation
+operator.) The @code{L} qualifier tells screen to mark the truncated
+parts with @samp{...}.
+@item @{
+attribute/color modifier string terminated by the next @code{@}}
@end table
The @code{c} and @code{C} escape may be qualified with a @code{0} to
make screen use
-zero instead of space as fill character. The @code{n} escape understands
-a length qualifier (e.g. @code{%3n}).
+zero instead of space as fill character.
+The @code{n} and
+@code{=} escapes understand
+a length qualifier (e.g. @code{%3n}), @code{D} and @code{M} can be
+prefixed with @code{L} to generate long names, @code{w} and
+@code{W} also show the window flags if @code{L} is given.
+
+An attribute/color modifier is is used to change the attributes or the
+color settings. Its format
+is @samp{[attribute modifier] [color description]}. The attribute modifier
+must be prefixed by a change type indicator if it can be confused with
+a color desciption. The following change types are known:
+@table @code
+@item +
+add the specified set to the current attributes
+@item -
+remove the set from the current attributes
+@item !
+invert the set in the current attributes
+@item =
+change the current attributes to the specified set
+@end table
+The attribute set can either be specified as a hexadecimal number or
+a combination of the following letters:
+@table @code
+@item u
+underline
+@item b
+bold
+@item r
+reverse
+@item s
+standout
+@item B
+blinking
+@end table
+Colors are coded either as a hexadecimal number or two letters specifying
+the desired background and foreground color (in that order). The following
+colors are known:
+@table @code
+@item k
+black
+@item r
+red
+@item g
+green
+@item y
+yellow
+@item b
+blue
+@item m
+magenta
+@item c
+cyan
+@item w
+white
+@item d
+default color
+@item .
+leave color unchanged
+@end table
+The capitalized versions of the letter specify bright colors. You can also
+use the pseudo-color @samp{i} to set just the brightness and leave the color
+unchanged.
+
+A one digit/letter color description is treated as foreground or
+background color dependant on the current attributes: if reverse mode is
+set, the background color is changed instead of the foreground color.
+If you don't like this, prefix the color with a @samp{.}. If you want
+the same behaviour for two-letter color descriptions, also prefix them
+with a @samp{.}.
+
+As a special case, @samp{%@{-@}} restores the attributes and colors that
+were set before the last change was made (i.e. pops one level of the
+color-change stack).
+
+@noindent
+Examples:
+@table @samp
+@item G
+set color to bright green
+@item +b r
+use bold red
+@item = yd
+clear all attributes, write in default color on yellow background.
+@item %-Lw%@{= BW@}%50>%n%f* %t%@{-@}%+Lw%<
+The available windows centered at the current win dow and truncated to
+the available width. The current window is displayed white on blue.
+This can be used with @samp{hardstatus alwayslastline}.
+@item %?%F%@{.R.@}%?%3n %t%? [%h]%?
+The window number and title and the window's hardstatus, if one is set.
+Also use a red background if this is the active focus.
+Useful for @samp{caption string}.
+@end table
+
@node Environment, Files, String Escapes, Top
@chapter Environment Variables
@@ -4387,6 +4797,9 @@ Terminal name.
@item TERMCAP
Terminal description.
+
+@item WINDOW
+Window number of a window (at creation time).
@end table
@node Files, Credits, Environment, Top
@@ -4411,7 +4824,10 @@ Read in after /etc/screenrc
@item @code{$SCREENDIR}/S-@var{login}
@item /var/run/screen/S-@var{login}
-Socket directories (default for Debian GNU/Linux)
+Socket directories (default)
+
+@item /usr/tmp/screens/S-@var{login}
+Alternate socket directories.
@item @var{socket directory}/.termcap
Written by the @code{dumptermcap} command
@@ -4430,7 +4846,7 @@ Output log files created by the log command
@itemx /etc/termcap
Terminal capability databases
-@item /etc/utmp
+@item /var/run/utmp
Login records
@item @code{$LOCKPRG}
@@ -4477,7 +4893,9 @@ Contributors @*
Christopher Williams (cgw@@unt.edu),
Matt Mosley (mattm@@access.digex.net),
Gregory Neil Shapiro (gshapiro@@wpi.WPI.EDU),
- Jason Merrill (jason@@jarthur.Claremont.EDU).
+ Jason Merrill (jason@@jarthur.Claremont.EDU),
+ Johannes Zellner (johannes@@zellner.org),
+ Pablo Averbuj (pablo@@averbuj.com).
@end example
@noindent
@@ -4533,10 +4951,10 @@ capabilities to @code{$TERMCAP} may not have any effects.
in order to be able to
correctly change the owner of the tty device file for each window.
Special permission may also be required to write the file
-@file{/etc/utmp}.
+@file{/var/run/utmp}.
@item
-Entries in @file{/etc/utmp} are not removed when @code{screen} is killed
+Entries in @file{/var/run/utmp} are not removed when @code{screen} is killed
with SIGKILL. This will cause some programs (like "w" or "rwho") to
advertise that a user is logged on who really isn't.
@@ -4617,9 +5035,8 @@ does not include these features of 4.2 and 4.3 BSD UNIX.
@cindex socket directory
The socket directory defaults either to @file{$HOME/.screen} or simply to
-@file{/tmp/screens} or preferably to @file{/usr/local/screens} chosen at
-compile-time. (@file{/var/run/screen} for Debian GNU/Linux).
-If @code{screen} is installed
+@file{/tmp/screens} or preferably to @file{/var/run/screen} chosen at
+compile-time. If @code{screen} is installed
setuid root, then the administrator should compile screen with an
adequate (not NFS mounted) @code{SOCKDIR}. If @code{screen} is not
running setuid-root, the user can specify any mode 700 directory in the
diff --git a/encoding.c b/encoding.c
new file mode 100644
index 0000000..bf99dca
--- /dev/null
+++ b/encoding.c
@@ -0,0 +1,1502 @@
+/* Copyright (c) 1993-2002
+ * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
+ * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
+ * Copyright (c) 1987 Oliver Laumann
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING); if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ ****************************************************************
+ */
+
+#include "rcs.h"
+RCS_ID("$Id: utf8.c,v 1.5 2001/04/25 12:32:47 mlschroe Exp $ FAU")
+
+#include <sys/types.h>
+
+#include "config.h"
+#include "screen.h"
+#include "extern.h"
+
+#ifdef ENCODINGS
+
+extern unsigned char *null;
+extern struct display *display, *displays;
+extern struct layer *flayer;
+
+extern char *screenencodings;
+
+static int encmatch __P((char *, char *));
+
+struct encoding {
+ char *name;
+ char *charsets;
+ int deffont;
+ int usegr;
+ int noc1;
+ char *fontlist;
+};
+
+/* big5 font: ^X */
+/* KOI8-R font: 96 ! */
+/* CP1251 font: 96 ? */
+
+struct encoding encodings[] = {
+ { "C", 0, 0, 0, 0, 0 },
+ { "eucJP", "B\002I\004\00204",0, 1, 0, "\002\004I" },
+ { "SJIS", "BIBBI04", 0, 1, 1, "\002I" },
+ { "eucKR", "B\003BB\00304",0, 1, 0, "\003" },
+ { "eucCN", "B\001BB\00104",0, 1, 0, "\001" },
+ { "Big5", "B\030BB\03004",0, 1, 0, "\030" },
+ { "KOI8-R", 0, 0x80|'!', 0, 1, 0 },
+ { "CP1251", 0, 0x80|'?', 0, 1, 0 },
+ { "UTF-8", 0, -1, 0, 0, 0 },
+ { "ISO8859-2", 0, 0x80|'B', 0, 0, 0 },
+ { "ISO8859-3", 0, 0x80|'C', 0, 0, 0 },
+ { "ISO8859-4", 0, 0x80|'D', 0, 0, 0 },
+ { "ISO8859-5", 0, 0x80|'L', 0, 0, 0 },
+ { "ISO8859-6", 0, 0x80|'G', 0, 0, 0 },
+ { "ISO8859-7", 0, 0x80|'F', 0, 0, 0 },
+ { "ISO8859-8", 0, 0x80|'H', 0, 0, 0 },
+ { "ISO8859-9", 0, 0x80|'M', 0, 0, 0 },
+ { "ISO8859-10", 0, 0x80|'V', 0, 0, 0 },
+ { "ISO8859-15", 0, 0x80|'b', 0, 0, 0 },
+ { "jis", 0, 0, 0, 0, "\002\004I" },
+};
+
+#ifdef UTF8
+
+static unsigned short builtin_tabs[][2] = {
+ { 0x30, 0 }, /* 0: special graphics (line drawing) */
+ { 0x005f, 0x25AE },
+ { 0x0060, 0x25C6 },
+ { 0x0061, 0x2592 },
+ { 0x0062, 0x2409 },
+ { 0x0063, 0x240C },
+ { 0x0064, 0x240D },
+ { 0x0065, 0x240A },
+ { 0x0066, 0x00B0 },
+ { 0x0067, 0x00B1 },
+ { 0x0068, 0x2424 },
+ { 0x0069, 0x240B },
+ { 0x006a, 0x2518 },
+ { 0x006b, 0x2510 },
+ { 0x006c, 0x250C },
+ { 0x006d, 0x2514 },
+ { 0x006e, 0x253C },
+ { 0x006f, 0x23BA },
+ { 0x0070, 0x23BB },
+ { 0x0071, 0x2500 },
+ { 0x0072, 0x23BC },
+ { 0x0073, 0x23BD },
+ { 0x0074, 0x251C },
+ { 0x0075, 0x2524 },
+ { 0x0076, 0x2534 },
+ { 0x0077, 0x252C },
+ { 0x0078, 0x2502 },
+ { 0x0079, 0x2264 },
+ { 0x007a, 0x2265 },
+ { 0x007b, 0x03C0 },
+ { 0x007c, 0x2260 },
+ { 0x007d, 0x00A3 },
+ { 0x007e, 0x00B7 },
+ { 0, 0},
+
+ { 0x34, 0 }, /* 4: Dutch */
+ { 0x0023, 0x00a3 },
+ { 0x0040, 0x00be },
+ { 0x005b, 0x00ff },
+ { 0x005c, 0x00bd },
+ { 0x005d, 0x007c },
+ { 0x007b, 0x00a8 },
+ { 0x007c, 0x0066 },
+ { 0x007d, 0x00bc },
+ { 0x007e, 0x00b4 },
+ { 0, 0},
+
+ { 0x35, 0 }, /* 5: Finnish */
+ { 0x005b, 0x00c4 },
+ { 0x005c, 0x00d6 },
+ { 0x005d, 0x00c5 },
+ { 0x005e, 0x00dc },
+ { 0x0060, 0x00e9 },
+ { 0x007b, 0x00e4 },
+ { 0x007c, 0x00f6 },
+ { 0x007d, 0x00e5 },
+ { 0x007e, 0x00fc },
+ { 0, 0},
+
+ { 0x36, 0 }, /* 6: Norwegian/Danish */
+ { 0x0040, 0x00c4 },
+ { 0x005b, 0x00c6 },
+ { 0x005c, 0x00d8 },
+ { 0x005d, 0x00c5 },
+ { 0x005e, 0x00dc },
+ { 0x0060, 0x00e4 },
+ { 0x007b, 0x00e6 },
+ { 0x007c, 0x00f8 },
+ { 0x007d, 0x00e5 },
+ { 0x007e, 0x00fc },
+ { 0, 0},
+
+ { 0x37, 0 }, /* 7: Swedish */
+ { 0x0040, 0x00c9 },
+ { 0x005b, 0x00c4 },
+ { 0x005c, 0x00d6 },
+ { 0x005d, 0x00c5 },
+ { 0x005e, 0x00dc },
+ { 0x0060, 0x00e9 },
+ { 0x007b, 0x00e4 },
+ { 0x007c, 0x00f6 },
+ { 0x007d, 0x00e5 },
+ { 0x007e, 0x00fc },
+ { 0, 0},
+
+ { 0x3d, 0}, /* =: Swiss */
+ { 0x0023, 0x00f9 },
+ { 0x0040, 0x00e0 },
+ { 0x005b, 0x00e9 },
+ { 0x005c, 0x00e7 },
+ { 0x005d, 0x00ea },
+ { 0x005e, 0x00ee },
+ { 0x005f, 0x00e8 },
+ { 0x0060, 0x00f4 },
+ { 0x007b, 0x00e4 },
+ { 0x007c, 0x00f6 },
+ { 0x007d, 0x00fc },
+ { 0x007e, 0x00fb },
+ { 0, 0},
+
+ { 0x41, 0}, /* A: UK */
+ { 0x0023, 0x00a3 },
+ { 0, 0},
+
+ { 0x4b, 0}, /* K: German */
+ { 0x0040, 0x00a7 },
+ { 0x005b, 0x00c4 },
+ { 0x005c, 0x00d6 },
+ { 0x005d, 0x00dc },
+ { 0x007b, 0x00e4 },
+ { 0x007c, 0x00f6 },
+ { 0x007d, 0x00fc },
+ { 0x007e, 0x00df },
+ { 0, 0},
+
+ { 0x51, 0}, /* Q: French Canadian */
+ { 0x0040, 0x00e0 },
+ { 0x005b, 0x00e2 },
+ { 0x005c, 0x00e7 },
+ { 0x005d, 0x00ea },
+ { 0x005e, 0x00ee },
+ { 0x0060, 0x00f4 },
+ { 0x007b, 0x00e9 },
+ { 0x007c, 0x00f9 },
+ { 0x007d, 0x00e8 },
+ { 0x007e, 0x00fb },
+ { 0, 0},
+
+ { 0x52, 0}, /* R: French */
+ { 0x0023, 0x00a3 },
+ { 0x0040, 0x00e0 },
+ { 0x005b, 0x00b0 },
+ { 0x005c, 0x00e7 },
+ { 0x005d, 0x00a7 },
+ { 0x007b, 0x00e9 },
+ { 0x007c, 0x00f9 },
+ { 0x007d, 0x00e8 },
+ { 0x007e, 0x00a8 },
+ { 0, 0},
+
+ { 0x59, 0}, /* Y: Italian */
+ { 0x0023, 0x00a3 },
+ { 0x0040, 0x00a7 },
+ { 0x005b, 0x00b0 },
+ { 0x005c, 0x00e7 },
+ { 0x005d, 0x00e9 },
+ { 0x0060, 0x00f9 },
+ { 0x007b, 0x00e0 },
+ { 0x007c, 0x00f2 },
+ { 0x007d, 0x00e8 },
+ { 0x007e, 0x00ec },
+ { 0, 0},
+
+ { 0x5a, 0}, /* Z: Spanish */
+ { 0x0023, 0x00a3 },
+ { 0x0040, 0x00a7 },
+ { 0x005b, 0x00a1 },
+ { 0x005c, 0x00d1 },
+ { 0x005d, 0x00bf },
+ { 0x007b, 0x00b0 },
+ { 0x007c, 0x00f1 },
+ { 0x007d, 0x00e7 },
+ { 0, 0},
+
+ { 0xe2, 0}, /* 96-b: ISO-8859-15*/
+ { 0x00a4, 0x20ac },
+ { 0x00a6, 0x0160 },
+ { 0x00a8, 0x0161 },
+ { 0x00b4, 0x017D },
+ { 0x00b8, 0x017E },
+ { 0x00bc, 0x0152 },
+ { 0x00bd, 0x0153 },
+ { 0x00be, 0x0178 },
+ { 0, 0},
+
+ { 0x4a, 0}, /* J: JIS 0201 Roman */
+ { 0x005c, 0x00a5 },
+ { 0x007e, 0x203e },
+ { 0, 0},
+
+ { 0x49, 0}, /* I: halfwidth katakana */
+ { 0x0021, 0xff61 },
+ { 0x005f|0x8000, 0xff9f },
+ { 0, 0},
+
+ { 0, 0}
+};
+
+struct recodetab
+{
+ unsigned short (*tab)[2];
+ int flags;
+};
+
+#define RECODETAB_ALLOCED 1
+#define RECODETAB_BUILTIN 2
+#define RECODETAB_TRIED 4
+
+static struct recodetab recodetabs[256];
+
+void
+InitBuiltinTabs()
+{
+ unsigned short (*p)[2];
+ for (p = builtin_tabs; (*p)[0]; p++)
+ {
+ recodetabs[(*p)[0]].flags = RECODETAB_BUILTIN;
+ recodetabs[(*p)[0]].tab = p + 1;
+ p++;
+ while((*p)[0])
+ p++;
+ }
+}
+
+int
+recode_char(c, to_utf, font)
+int c, to_utf, font;
+{
+ int f;
+ unsigned short (*p)[2];
+
+ if (c < 256)
+ return c;
+ if (to_utf)
+ {
+ f = (c >> 8) & 0xff;
+ c &= 0xff;
+ /* map aliases to keep the table small */
+ switch (c >> 8)
+ {
+ case 'C':
+ f ^= ('C' ^ '5');
+ break;
+ case 'E':
+ f ^= ('E' ^ '6');
+ break;
+ case 'H':
+ f ^= ('H' ^ '7');
+ break;
+ default:
+ break;
+ }
+ p = recodetabs[f].tab;
+ if (p == 0 && recodetabs[f].flags == 0)
+ {
+ LoadFontTranslation(f, 0);
+ p = recodetabs[f].tab;
+ }
+ if (p)
+ for (; (*p)[0]; p++)
+ {
+ if ((p[0][0] & 0x8000) && (c <= (p[0][0] & 0x7fff)) && c >= p[-1][0])
+ return c - p[-1][0] + p[-1][1];
+ if ((*p)[0] == c)
+ return (*p)[1];
+ }
+ return c & 0xff; /* map to latin1 */
+ }
+ if (font == -1)
+ {
+ for (font = 32; font < 256; font++)
+ {
+ p = recodetabs[font].tab;
+ if (p)
+ for (; (*p)[1]; p++)
+ {
+ if ((p[0][0] & 0x8000) && c <= p[0][1] && c >= p[-1][1])
+ return c - p[-1][1] + p[-1][0];
+ if ((*p)[1] == c)
+ return (*p)[0];
+ }
+ }
+ return '?';
+ }
+ if (font >= 32)
+ {
+ p = recodetabs[font].tab;
+ if (p == 0 && recodetabs[font].flags == 0)
+ {
+ LoadFontTranslation(font, 0);
+ p = recodetabs[font].tab;
+ }
+ if (p)
+ for (; (*p)[1]; p++)
+ if ((*p)[1] == c)
+ return (*p)[0];
+ }
+ return -1;
+}
+
+
+#ifdef DW_CHARS
+int
+recode_char_dw(c, c2p, to_utf, font)
+int c, *c2p, to_utf, font;
+{
+ int f;
+ unsigned short (*p)[2];
+
+ if (to_utf)
+ {
+ f = (c >> 8) & 0xff;
+ c = (c & 255) << 8 | (*c2p & 255);
+ *c2p = 0xffff;
+ p = recodetabs[f].tab;
+ if (p == 0 && recodetabs[f].flags == 0)
+ {
+ LoadFontTranslation(f, 0);
+ p = recodetabs[f].tab;
+ }
+ if (p)
+ for (; (*p)[0]; p++)
+ if ((*p)[0] == c)
+ {
+#ifdef DW_CHARS
+ if (!utf8_isdouble((*p)[1]))
+ *c2p = ' ';
+#endif
+ return (*p)[1];
+ }
+ return UCS_REPL_DW;
+ }
+ if (font == -1)
+ {
+ for (font = 0; font < 32; font++)
+ {
+ p = recodetabs[font].tab;
+ if (p)
+ for (; (*p)[1]; p++)
+ if ((*p)[1] == c)
+ {
+ *c2p = ((*p)[0] & 255) | font << 8 | 0x8000;
+ return ((*p)[0] >> 8) | font << 8;
+ }
+ }
+ *c2p = '?';
+ return '?';
+ }
+ if (font < 32)
+ {
+ p = recodetabs[font].tab;
+ if (p == 0 && recodetabs[font].flags == 0)
+ {
+ LoadFontTranslation(font, 0);
+ p = recodetabs[font].tab;
+ }
+ if (p)
+ for (; (*p)[1]; p++)
+ if ((*p)[1] == c)
+ {
+ *c2p = ((*p)[0] & 255) | font << 8 | 0x8000;
+ return ((*p)[0] >> 8) | font << 8;
+ }
+ }
+ return -1;
+}
+#endif
+
+int
+recode_char_to_encoding(c, encoding)
+int c, encoding;
+{
+ char *fp;
+ int x;
+
+ if (encoding == UTF8)
+ return recode_char(c, 1, -1);
+ if ((fp = encodings[encoding].fontlist) != 0)
+ while(*fp)
+ if ((x = recode_char(c, 0, (unsigned char)*fp++)) != -1)
+ return x;
+ if (encodings[encoding].deffont)
+ if ((x = recode_char(c, 0, encodings[encoding].deffont)) != -1)
+ return x;
+ return recode_char(c, 0, -1);
+}
+
+#ifdef DW_CHARS
+int
+recode_char_dw_to_encoding(c, c2p, encoding)
+int c, *c2p, encoding;
+{
+ char *fp;
+ int x;
+
+ if (encoding == UTF8)
+ return recode_char_dw(c, c2p, 1, -1);
+ if ((fp = encodings[encoding].fontlist) != 0)
+ while(*fp)
+ if ((x = recode_char_dw(c, c2p, 0, (unsigned char)*fp++)) != -1)
+ return x;
+ if (encodings[encoding].deffont)
+ if ((x = recode_char_dw(c, c2p, 0, encodings[encoding].deffont)) != -1)
+ return x;
+ return recode_char_dw(c, c2p, 0, -1);
+}
+#endif
+
+
+struct mchar *
+recode_mchar(mc, from, to)
+struct mchar *mc;
+int from, to;
+{
+ static struct mchar rmc;
+ int c;
+
+ debug3("recode_mchar %02x from %d to %d\n", mc->image, from, to);
+ if (from == to || (from != UTF8 && to != UTF8))
+ return mc;
+ rmc = *mc;
+ if (rmc.font == 0 && from != UTF8)
+ rmc.font = encodings[from].deffont;
+ if (rmc.font == 0) /* latin1 is the same in unicode */
+ return mc;
+ c = rmc.image | (rmc.font << 8);
+#ifdef DW_CHARS
+ if (rmc.mbcs)
+ {
+ int c2 = rmc.mbcs;
+ c = recode_char_dw_to_encoding(c, &c2, to);
+ rmc.mbcs = c2;
+ }
+ else
+#endif
+ c = recode_char_to_encoding(c, to);
+ rmc.image = c & 255;
+ rmc.font = c >> 8 & 255;
+ return &rmc;
+}
+
+struct mline *
+recode_mline(ml, w, from, to)
+struct mline *ml;
+int w;
+int from, to;
+{
+ static int maxlen;
+ static int last;
+ static struct mline rml[2], *rl;
+ int i, c;
+
+ if (from == to || (from != UTF8 && to != UTF8) || w == 0)
+ return ml;
+ if (ml->font == null && encodings[from].deffont == 0)
+ return ml;
+ if (w > maxlen)
+ {
+ for (i = 0; i < 2; i++)
+ {
+ if (rml[i].image == 0)
+ rml[i].image = malloc(w);
+ else
+ rml[i].image = realloc(rml[i].image, w);
+ if (rml[i].font == 0)
+ rml[i].font = malloc(w);
+ else
+ rml[i].font = realloc(rml[i].font, w);
+ if (rml[i].image == 0 || rml[i].font == 0)
+ {
+ maxlen = 0;
+ return ml; /* sorry */
+ }
+ }
+ maxlen = w;
+ }
+
+ debug("recode_mline: from\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(ml->image[i] >> 4) & 15]);
+ debug("\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(ml->image[i] ) & 15]);
+ debug("\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(ml->font[i] >> 4) & 15]);
+ debug("\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(ml->font[i] ) & 15]);
+ debug("\n");
+
+ rl = rml + last;
+ rl->attr = ml->attr;
+#ifdef COLOR
+ rl->color = ml->color;
+# ifdef COLORS256
+ rl->colorx = ml->colorx;
+# endif
+#endif
+ for (i = 0; i < w; i++)
+ {
+ c = ml->image[i] | (ml->font[i] << 8);
+ if (from != UTF8 && c < 256)
+ c |= encodings[from].deffont << 8;
+#ifdef DW_CHARS
+ if ((from != UTF8 && (c & 0x1f00) != 0 && (c & 0xe000) == 0) || (from == UTF8 && utf8_isdouble(c)))
+ {
+ if (i + 1 == w)
+ c = '?';
+ else
+ {
+ int c2;
+ i++;
+ c2 = ml->image[i] | (ml->font[i] << 8);
+ c = recode_char_dw_to_encoding(c, &c2, to);
+ rl->font[i - 1] = c >> 8 & 255;
+ rl->image[i - 1] = c & 255;
+ c = c2;
+ }
+ }
+ else
+#endif
+ c = recode_char_to_encoding(c, to);
+ rl->image[i] = c & 255;
+ rl->font[i] = c >> 8 & 255;
+ }
+ last ^= 1;
+ debug("recode_mline: to\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(rl->image[i] >> 4) & 15]);
+ debug("\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(rl->image[i] ) & 15]);
+ debug("\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(rl->font[i] >> 4) & 15]);
+ debug("\n");
+ for (i = 0; i < w; i++)
+ debug1("%c", "0123456789abcdef"[(rl->font[i] ) & 15]);
+ debug("\n");
+ return rl;
+}
+
+void
+AddUtf8(c)
+int c;
+{
+ ASSERT(D_encoding == UTF8);
+ if (c >= 0x800)
+ {
+ AddChar((c & 0xf000) >> 12 | 0xe0);
+ c = (c & 0x0fff) | 0x1000;
+ }
+ if (c >= 0x80)
+ {
+ AddChar((c & 0x1fc0) >> 6 ^ 0xc0);
+ c = (c & 0x3f) | 0x80;
+ }
+ AddChar(c);
+}
+
+int
+ToUtf8(p, c)
+char *p;
+int c;
+{
+ int l = 1;
+ if (c >= 0x800)
+ {
+ if (p)
+ *p++ = (c & 0xf000) >> 12 | 0xe0;
+ l++;
+ c = (c & 0x0fff) | 0x1000;
+ }
+ if (c >= 0x80)
+ {
+ if (p)
+ *p++ = (c & 0x1fc0) >> 6 ^ 0xc0;
+ l++;
+ c = (c & 0x3f) | 0x80;
+ }
+ if (p)
+ *p++ = c;
+ return l;
+}
+
+/*
+ * returns:
+ * -1: need more bytes, sequence not finished
+ * -2: corrupt sequence found, redo last char
+ * >= 0: decoded character
+ */
+int
+FromUtf8(c, utf8charp)
+int c, *utf8charp;
+{
+ int utf8char = *utf8charp;
+ if (utf8char)
+ {
+ if ((c & 0xc0) != 0x80)
+ {
+ *utf8charp = 0;
+ return -2; /* corrupt sequence! */
+ }
+ else
+ c = (c & 0x3f) | (utf8char << 6);
+ if (!(utf8char & 0x40000000))
+ {
+ /* check for overlong sequences */
+ if ((c & 0x820823e0) == 0x80000000)
+ c = 0xfdffffff;
+ else if ((c & 0x020821f0) == 0x02000000)
+ c = 0xfff7ffff;
+ else if ((c & 0x000820f8) == 0x00080000)
+ c = 0xffffd000;
+ else if ((c & 0x0000207c) == 0x00002000)
+ c = 0xffffff70;
+ }
+ }
+ else
+ {
+ /* new sequence */
+ if (c >= 0xfe)
+ c = UCS_REPL;
+ else if (c >= 0xfc)
+ c = (c & 0x01) | 0xbffffffc; /* 5 bytes to follow */
+ else if (c >= 0xf8)
+ c = (c & 0x03) | 0xbfffff00; /* 4 */
+ else if (c >= 0xf0)
+ c = (c & 0x07) | 0xbfffc000; /* 3 */
+ else if (c >= 0xe0)
+ c = (c & 0x0f) | 0xbff00000; /* 2 */
+ else if (c >= 0xc2)
+ c = (c & 0x1f) | 0xfc000000; /* 1 */
+ else if (c >= 0xc0)
+ c = 0xfdffffff; /* overlong */
+ else if (c >= 0x80)
+ c = UCS_REPL;
+ }
+ *utf8charp = utf8char = (c & 0x80000000) ? c : 0;
+ if (utf8char)
+ return -1;
+ if (c & 0xffff0000)
+ c = UCS_REPL; /* sorry, only know 16bit Unicode */
+ if (c >= 0xd800 && (c <= 0xdfff || c == 0xfffe || c == 0xffff))
+ c = UCS_REPL; /* illegal code */
+ return c;
+}
+
+
+void
+WinSwitchEncoding(p, encoding)
+struct win *p;
+int encoding;
+{
+ int i, j, c;
+ struct mline *ml;
+ struct display *d;
+ struct canvas *cv;
+ struct layer *oldflayer;
+
+ if ((p->w_encoding == UTF8) == (encoding == UTF8))
+ {
+ p->w_encoding = encoding;
+ return;
+ }
+ oldflayer = flayer;
+ for (d = displays; d; d = d->d_next)
+ for (cv = d->d_cvlist; cv; cv = cv->c_next)
+ if (p == Layer2Window(cv->c_layer))
+ {
+ flayer = cv->c_layer;
+ while(flayer->l_next)
+ {
+ if (oldflayer == flayer)
+ oldflayer = flayer->l_next;
+ ExitOverlayPage();
+ }
+ }
+ flayer = oldflayer;
+ for (j = 0; j < p->w_height + p->w_histheight; j++)
+ {
+#ifdef COPY_PASTE
+ ml = j < p->w_height ? &p->w_mlines[j] : &p->w_hlines[j - p->w_height];
+#else
+ ml = &p->w_mlines[j];
+#endif
+ if (ml->font == null && 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 < 256)
+ c |= encodings[p->w_encoding].deffont << 8;
+ if (c < 256)
+ continue;
+ if (ml->font == null)
+ {
+ if ((ml->font = (unsigned char *)malloc(p->w_width + 1)) == 0)
+ {
+ ml->font = null;
+ break;
+ }
+ bzero(ml->font, p->w_width + 1);
+ }
+#ifdef DW_CHARS
+ if ((p->w_encoding != UTF8 && (c & 0x1f00) != 0 && (c & 0xe000) == 0) || (p->w_encoding == UTF8 && utf8_isdouble(c)))
+ {
+ if (i + 1 == p->w_width)
+ c = '?';
+ else
+ {
+ int c2;
+ i++;
+ c2 = ml->image[i] | (ml->font[i] << 8);
+ c = recode_char_dw_to_encoding(c, &c2, encoding);
+ ml->font[i - 1] = c >> 8 & 255;
+ ml->image[i - 1] = c & 255;
+ c = c2;
+ }
+ }
+ else
+#endif
+ c = recode_char_to_encoding(c, encoding);
+ ml->image[i] = c & 255;
+ ml->font[i] = c >> 8 & 255;
+ }
+ }
+ p->w_encoding = encoding;
+ return;
+}
+
+#ifdef DW_CHARS
+int
+utf8_isdouble(c)
+int c;
+{
+ return
+ (c >= 0x1100 &&
+ (c <= 0x115f || /* Hangul Jamo init. consonants */
+ (c >= 0x2e80 && c <= 0xa4cf && (c & ~0x0011) != 0x300a &&
+ c != 0x303f) || /* CJK ... Yi */
+ (c >= 0xac00 && c <= 0xd7a3) || /* Hangul Syllables */
+ (c >= 0xf900 && c <= 0xfaff) || /* CJK Compatibility Ideographs */
+ (c >= 0xfe30 && c <= 0xfe6f) || /* CJK Compatibility Forms */
+ (c >= 0xff00 && c <= 0xff5f) || /* Fullwidth Forms */
+ (c >= 0xffe0 && c <= 0xffe6) ||
+ (c >= 0x20000 && c <= 0x2ffff)));
+}
+#endif
+
+#else /* !UTF8 */
+
+void
+WinSwitchEncoding(p, encoding)
+struct win *p;
+int encoding;
+{
+ p->w_encoding = encoding;
+ return;
+}
+
+#endif /* UTF8 */
+
+static int
+encmatch(s1, s2)
+char *s1;
+char *s2;
+{
+ int c1, c2;
+ do
+ {
+ c1 = (unsigned char)*s1;
+ if (c1 >= 'A' && c1 <= 'Z')
+ c1 += 'a' - 'A';
+ if (!(c1 >= 'a' && c1 <= 'z') && !(c1 >= '0' && c1 <= '9'))
+ {
+ s1++;
+ continue;
+ }
+ c2 = (unsigned char)*s2;
+ if (c2 >= 'A' && c2 <= 'Z')
+ c2 += 'a' - 'A';
+ if (!(c2 >= 'a' && c2 <= 'z') && !(c2 >= '0' && c2 <= '9'))
+ {
+ s2++;
+ continue;
+ }
+ if (c1 != c2)
+ return 0;
+ s1++;
+ s2++;
+ }
+ while(c1);
+ return 1;
+}
+
+int
+FindEncoding(name)
+char *name;
+{
+ int encoding;
+
+ if (name == 0 || *name == 0)
+ return 0;
+ if (encmatch(name, "euc"))
+ name = "eucJP";
+ if (encmatch(name, "off") || encmatch(name, "iso8859-1"))
+ return 0;
+#ifndef UTF8
+ if (encmatch(name, "UTF-8"))
+ return -1;
+#endif
+ for (encoding = 0; encoding < sizeof(encodings)/sizeof(*encodings); encoding++)
+ if (encmatch(name, encodings[encoding].name))
+ {
+#ifdef UTF8
+ LoadFontTranslationsForEncoding(encoding);
+#endif
+ return encoding;
+ }
+ return -1;
+}
+
+char *
+EncodingName(encoding)
+int encoding;
+{
+ if (encoding >= sizeof(encodings)/sizeof(*encodings))
+ return 0;
+ return encodings[encoding].name;
+}
+
+int
+EncodingDefFont(encoding)
+int encoding;
+{
+ return encodings[encoding].deffont;
+}
+
+void
+ResetEncoding(p)
+struct win *p;
+{
+ char *c;
+ int encoding = p->w_encoding;
+
+ c = encodings[encoding].charsets;
+ if (c)
+ SetCharsets(p, c);
+#ifdef UTF8
+ LoadFontTranslationsForEncoding(encoding);
+#endif
+ if (encodings[encoding].usegr)
+ p->w_gr = 1;
+ if (encodings[encoding].noc1)
+ p->w_c1 = 0;
+}
+
+int
+DecodeChar(c, encoding, statep)
+int c;
+int encoding;
+int *statep;
+{
+ int t;
+
+ debug2("Decoding char %02x for encoding %d\n", c, encoding);
+#ifdef UTF8
+ if (encoding == UTF8)
+ return FromUtf8(c, statep);
+#endif
+ if (encoding == SJIS)
+ {
+ if (!*statep)
+ {
+ if ((0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xef))
+ {
+ *statep = c;
+ return -1;
+ }
+ return c | (KANA << 16);
+ }
+ t = c;
+ c = *statep;
+ *statep = 0;
+ if (0x40 <= t && t <= 0xfc && t != 0x7f)
+ {
+ if (c <= 0x9f) c = (c - 0x81) * 2 + 0x21;
+ else c = (c - 0xc1) * 2 + 0x21;
+ if (t <= 0x7e) t -= 0x1f;
+ else if (t <= 0x9e) t -= 0x20;
+ else t -= 0x7e, c++;
+ return (c << 8) | t | (KANJI << 16);
+ }
+ return t;
+ }
+ if (encoding == EUC_JP || encoding == EUC_KR || encoding == EUC_CN)
+ {
+ if (!*statep)
+ {
+ if (c & 0x80)
+ {
+ *statep = c;
+ return -1;
+ }
+ return c;
+ }
+ t = c;
+ c = *statep;
+ *statep = 0;
+ if (encoding == EUC_JP)
+ {
+ if (c == 0x8e)
+ return t | (KANA << 16);
+ if (c == 0x8f)
+ {
+ *statep = t | (KANJI0212 << 8);
+ return -1;
+ }
+ }
+ c &= 0xff7f;
+ t &= 0x7f;
+ c = c << 8 | t;
+ if (encoding == EUC_KR)
+ return c | (3 << 16);
+ if (encoding == EUC_CN)
+ return c | (1 << 16);
+ if (c & (KANJI0212 << 16))
+ return c;
+ else
+ return c | (KANJI << 16);
+ }
+ if (encoding == BIG5)
+ {
+ if (!*statep)
+ {
+ if (c & 0x80)
+ {
+ *statep = c;
+ return -1;
+ }
+ return c;
+ }
+ t = c;
+ c = *statep;
+ *statep = 0;
+ c &= 0x7f;
+ return c << 8 | t | (030 << 16);
+ }
+ return c | (encodings[encoding].deffont << 16);
+}
+
+int
+EncodeChar(bp, c, encoding, fontp)
+char *bp;
+int c;
+int encoding;
+int *fontp;
+{
+ int t, f, l;
+
+ debug2("Encoding char %02x for encoding %d\n", c, encoding);
+ if (c == -1 && fontp)
+ {
+ if (*fontp == 0)
+ return 0;
+ if (bp)
+ {
+ *bp++ = 033;
+ *bp++ = '(';
+ *bp++ = 'B';
+ }
+ return 3;
+ }
+ f = c >> 16;
+
+#ifdef UTF8
+ if (encoding == UTF8)
+ {
+ if (f)
+ {
+# ifdef DW_CHARS
+ if (is_dw_font(f))
+ {
+ int c2 = c >> 8 & 0xff;
+ c = (c & 0xff) | (f << 8);
+ c = recode_char_dw_to_encoding(c, &c2, encoding);
+ }
+ else
+# endif
+ {
+ c = (c & 0xff) | (f << 8);
+ c = recode_char_to_encoding(c, encoding);
+ }
+ }
+ return ToUtf8(bp, c);
+ }
+ if ((c & 0xff00) && f == 0)
+ {
+# ifdef DW_CHARS
+ if (utf8_isdouble(c))
+ {
+ int c2 = 0xffff;
+ c = recode_char_dw_to_encoding(c, &c2, encoding);
+ c = (c << 8) | (c2 & 0xff);
+ }
+ else
+# endif
+ {
+ c = recode_char_to_encoding(c, encoding);
+ c = ((c & 0xff00) << 8) | (c & 0xff);
+ }
+ debug1("Encode: char mapped from utf8 to %x\n", c);
+ f = c >> 16;
+ }
+#endif
+
+ if (f & 0x80) /* map special 96-fonts to latin1 */
+ f = 0;
+
+ if (encoding == SJIS)
+ {
+ if (f == KANA)
+ c = (c & 0xff) | 0x80;
+ else if (f == KANJI)
+ {
+ if (!bp)
+ return 2;
+ t = c & 0xff;
+ c = (c >> 8) & 0xff;
+ t += (c & 1) ? ((t <= 0x5f) ? 0x1f : 0x20) : 0x7e;
+ c = (c - 0x21) / 2 + ((c < 0x5f) ? 0x81 : 0xc1);
+ *bp++ = c;
+ *bp++ = t;
+ return 2;
+ }
+ }
+ if (encoding == EUC)
+ {
+ if (f == KANA)
+ {
+ if (bp)
+ {
+ *bp++ = 0x8e;
+ *bp++ = c;
+ }
+ return 2;
+ }
+ if (f == KANJI)
+ {
+ if (bp)
+ {
+ *bp++ = (c >> 8) | 0x80;
+ *bp++ = c | 0x80;
+ }
+ return 2;
+ }
+ if (f == KANJI0212)
+ {
+ if (bp)
+ {
+ *bp++ = 0x8f;
+ *bp++ = c >> 8;
+ *bp++ = c;
+ }
+ return 3;
+ }
+ }
+ if ((encoding == EUC_KR && f == 3) || (encoding == EUC_CN && f == 1))
+ {
+ if (bp)
+ {
+ *bp++ = (c >> 8) | 0x80;
+ *bp++ = c | 0x80;
+ }
+ return 2;
+ }
+ if (encoding == BIG5 && f == 030)
+ {
+ if (bp)
+ {
+ *bp++ = (c >> 8) | 0x80;
+ *bp++ = c;
+ }
+ return 2;
+ }
+
+ l = 0;
+ if (fontp && f != *fontp)
+ {
+ *fontp = f;
+ if (f && f < ' ')
+ {
+ if (bp)
+ {
+ *bp++ = 033;
+ *bp++ = '$';
+ if (f > 2)
+ *bp++ = '(';
+ *bp++ = '@' + f;
+ }
+ l += f > 2 ? 4 : 3;
+ }
+ else if (f < 128)
+ {
+ if (f == 0)
+ f = 'B';
+ if (bp)
+ {
+ *bp++ = 033;
+ *bp++ = '(';
+ *bp++ = f;
+ }
+ l += 3;
+ }
+ }
+ if (c & 0xff00)
+ {
+ if (bp)
+ *bp++ = c >> 8;
+ l++;
+ }
+ if (bp)
+ *bp++ = c;
+ return l + 1;
+}
+
+int
+CanEncodeFont(encoding, f)
+int encoding, f;
+{
+ switch(encoding)
+ {
+#ifdef UTF8
+ case UTF8:
+ return 1;
+#endif
+ case SJIS:
+ return f == KANJI || f == KANA;
+ case EUC:
+ return f == KANJI || f == KANA || f == KANJI0212;
+ case EUC_KR:
+ return f == 3;
+ case EUC_CN:
+ return f == 1;
+ case BIG5:
+ return f == 030;
+ default:
+ break;
+ }
+ return 0;
+}
+
+#ifdef DW_CHARS
+int
+PrepareEncodedChar(c)
+int c;
+{
+ int encoding;
+ int t = 0;
+ int f;
+
+ encoding = D_encoding;
+ f = D_rend.font;
+ t = D_mbcs;
+ if (encoding == SJIS)
+ {
+ if (f == KANA)
+ return c | 0x80;
+ else if (f == KANJI)
+ {
+ t += (c & 1) ? ((t <= 0x5f) ? 0x1f : 0x20) : 0x7e;
+ c = (c - 0x21) / 2 + ((c < 0x5f) ? 0x81 : 0xc1);
+ D_mbcs = t;
+ }
+ return c;
+ }
+ if (encoding == EUC)
+ {
+ if (f == KANA)
+ {
+ AddChar(0x8e);
+ return c | 0x80;
+ }
+ if (f == KANJI)
+ {
+ D_mbcs = t | 0x80;
+ return c | 0x80;
+ }
+ if (f == KANJI0212)
+ {
+ AddChar(0x8f);
+ D_mbcs = t | 0x80;
+ return c | 0x80;
+ }
+ }
+ if ((encoding == EUC_KR && f == 3) || (encoding == EUC_CN && f == 1))
+ {
+ D_mbcs = t | 0x80;
+ return c | 0x80;
+ }
+ if (encoding == BIG5 && f == 030)
+ return c | 0x80;
+ return c;
+}
+#endif
+
+int
+RecodeBuf(fbuf, flen, fenc, tenc, tbuf)
+unsigned char *fbuf;
+int flen;
+int fenc, tenc;
+unsigned char *tbuf;
+{
+ int c, i, j;
+ int decstate = 0, font = 0;
+
+ for (i = j = 0; i < flen; i++)
+ {
+ c = fbuf[i];
+ c = DecodeChar(c, fenc, &decstate);
+ if (c == -2)
+ i--;
+ if (c < 0)
+ continue;
+ j += EncodeChar(tbuf ? (char *)tbuf + j : 0, c, tenc, &font);
+ }
+ j += EncodeChar(tbuf ? (char *)tbuf + j : 0, -1, tenc, &font);
+ return j;
+}
+
+#ifdef UTF8
+int
+ContainsSpecialDeffont(ml, xs, xe, encoding)
+struct mline *ml;
+int xs, xe;
+int encoding;
+{
+ unsigned char *f, *i;
+ int c, x, dx;
+
+ if (encoding == UTF8 || encodings[encoding].deffont == 0)
+ return 0;
+ i = ml->image + xs;
+ f = ml->font + xs;
+ dx = xe - xs + 1;
+ while (dx-- > 0)
+ {
+ if (*f++)
+ continue;
+ c = *i++;
+ x = recode_char_to_encoding(c | (encodings[encoding].deffont << 8), UTF8);
+ if (c != x)
+ {
+ debug2("ContainsSpecialDeffont: yes %02x != %02x\n", c, x);
+ return 1;
+ }
+ }
+ debug("ContainsSpecialDeffont: no\n");
+ return 0;
+}
+
+
+int
+LoadFontTranslation(font, file)
+int font;
+char *file;
+{
+ char buf[1024], *myfile;
+ FILE *f;
+ int i;
+ int fo;
+ int x, u, c, ok;
+ unsigned short (*p)[2], (*tab)[2];
+
+ myfile = file;
+ if (myfile == 0)
+ {
+ if (font == 0 || screenencodings == 0)
+ return -1;
+ if (strlen(screenencodings) > sizeof(buf) - 10)
+ return -1;
+ sprintf(buf, "%s/%02x", screenencodings, font & 0xff);
+ myfile = buf;
+ }
+ debug1("LoadFontTranslation: trying %s\n", myfile);
+ if ((f = secfopen(myfile, "r")) == 0)
+ return -1;
+ i = ok = 0;
+ for (;;)
+ {
+ for(; i < 12; i++)
+ if (getc(f) != "ScreenI2UTF8"[i])
+ break;
+ if (getc(f) != 0) /* format */
+ break;
+ fo = getc(f); /* id */
+ if (fo == EOF)
+ break;
+ if (font != -1 && font != fo)
+ break;
+ i = getc(f);
+ x = getc(f);
+ if (x == EOF)
+ break;
+ i = i << 8 | x;
+ getc(f);
+ while ((x = getc(f)) && x != EOF)
+ getc(f); /* skip font name (padded to 2 bytes) */
+ if ((p = malloc(sizeof(*p) * (i + 1))) == 0)
+ break;
+ tab = p;
+ while(i > 0)
+ {
+ x = getc(f);
+ x = x << 8 | getc(f);
+ u = getc(f);
+ c = getc(f);
+ u = u << 8 | c;
+ if (c == EOF)
+ break;
+ (*p)[0] = x;
+ (*p)[1] = u;
+ p++;
+ i--;
+ }
+ (*p)[0] = 0;
+ (*p)[1] = 0;
+ if (i || (tab[0][0] & 0x8000))
+ {
+ free(tab);
+ break;
+ }
+ if (recodetabs[fo].tab && (recodetabs[fo].flags & RECODETAB_ALLOCED) != 0)
+ free(recodetabs[fo].tab);
+ recodetabs[fo].tab = tab;
+ recodetabs[fo].flags = RECODETAB_ALLOCED;
+ debug1("Successful load of recodetab %02x\n", fo);
+ c = getc(f);
+ if (c == EOF)
+ {
+ ok = 1;
+ break;
+ }
+ if (c != 'S')
+ break;
+ i = 1;
+ }
+ fclose(f);
+ if (font != -1 && file == 0 && recodetabs[font].flags == 0)
+ recodetabs[font].flags = RECODETAB_TRIED;
+ return ok ? 0 : -1;
+}
+
+void
+LoadFontTranslationsForEncoding(encoding)
+int encoding;
+{
+ char *c;
+ int f;
+
+ debug1("LoadFontTranslationsForEncoding: encoding %d\n", encoding);
+ if ((c = encodings[encoding].fontlist) != 0)
+ while ((f = (unsigned char)*c++) != 0)
+ if (recodetabs[f].flags == 0)
+ LoadFontTranslation(f, 0);
+ f = encodings[encoding].deffont;
+ if (f > 0 && recodetabs[f].flags == 0)
+ LoadFontTranslation(f, 0);
+}
+
+#endif /* UTF8 */
+
+#else /* !ENCODINGS */
+
+/* Simple version of EncodeChar to encode font changes for
+ * copy/paste mode
+ */
+int
+EncodeChar(bp, c, encoding, fontp)
+char *bp;
+int c;
+int encoding;
+int *fontp;
+{
+ int f, l;
+ f = (c == -1) ? 0 : c >> 16;
+ l = 0;
+ if (fontp && f != *fontp)
+ {
+ *fontp = f;
+ if (f && f < ' ')
+ {
+ if (bp)
+ {
+ *bp++ = 033;
+ *bp++ = '$';
+ if (f > 2)
+ *bp++ = '(';
+ *bp++ = '@' + f;
+ }
+ l += f > 2 ? 4 : 3;
+ }
+ else if (f < 128)
+ {
+ if (f == 0)
+ f = 'B';
+ if (bp)
+ {
+ *bp++ = 033;
+ *bp++ = '(';
+ *bp++ = f;
+ }
+ l += 3;
+ }
+ }
+ if (c == -1)
+ return l;
+ if (c & 0xff00)
+ {
+ if (bp)
+ *bp++ = c >> 8;
+ l++;
+ }
+ if (bp)
+ *bp++ = c;
+ return l + 1;
+}
+
+#endif /* ENCODINGS */
diff --git a/etc/ccdefs b/etc/ccdefs
index 2358fcd..2fc98ff 100755
--- a/etc/ccdefs
+++ b/etc/ccdefs
@@ -3,7 +3,8 @@ cd /tmp
umask 022
CC=cc
-CPP=/lib/cpp
+CPP=cpp
+PATH="$PATH:/lib"
TEMP=def$$
trap 'rm -f ${TEMP}*; trap 0; exit' 0 1 2 3 15
diff --git a/etc/completer.zsh b/etc/completer.zsh
new file mode 100644
index 0000000..f8f0c96
--- /dev/null
+++ b/etc/completer.zsh
@@ -0,0 +1,53 @@
+#compdef screen
+#Generated by
+# help2simple.pl -c screen -p -f
+# simple2long.xsl
+# args.xsl
+# For details see:
+# http://www.geocities.com/f_rosencrantz/xml_completion.htm
+
+ local context state line
+ typeset -A opt_args
+ _arguments \
+ "-a[Force all capabilities into each window's termcap.]" \
+ '-A:Adapt all windows to the new display width & height.' \
+ "-c:Read configuration file instead of '.screenrc'.:_files -/" \
+ '-d:Detach the elsewhere running screen (with -r: reattach here).:->sessionname' \
+ '-dmS:Start as daemon: Screen session in detached mode.' \
+ '-D:Detach and logout remote (with -r: reattach here).' \
+ '-e:Change command characters.' \
+ '-f-:Flow control on, -fn = off, -fa = auto.:((n\:Flow\ conrol\ off a\:Flow\ conrol\ auto))' \
+ '-h:Set the size of the scrollback history buffer.' \
+ '-i[Interrupt output sooner when flow control is on.]' \
+ '-l[Login mode on (update /var/run/utmp), -ln = off.]' \
+ '-list[Do nothing, just list our SockDir.]' \
+ '-ls[Do nothing, just list our SockDir.]' \
+ "-L[Terminal's last character can be safely updated.]" \
+ '-m[ignore $STY variable, do create a new screen session.]' \
+ '-O[Choose optimal output rather than exact vt100 emulation.]' \
+ '-p:Preselect the named window if it exists.' \
+ '-q[Quiet startup. Exits with non-zero return code if unsuccessful.]' \
+ '-r[Reattach to a detached screen process.]:Handling Tag sessionname:->sessionname' \
+ '-R[Reattach if possible, otherwise start a new session.]' \
+ '-s:Shell to execute rather than $SHELL.' \
+ '-S:Name this session <pid>.sockname instead of <pid>.<tty>.<host>.' \
+ "-t:Set title. (window's name)." \
+ '-T:Use term as $TERM for windows, rather than "screen".' \
+ '-U[Tell screen to use UTF-8 encoding.]' \
+ '-v[Print "Screen version 3.09.11beta (FAU) 11-Oct-01".]' \
+ '-wipe[Do nothing, just clean up SockDir.]' \
+ '-x[Attach to a not detached screen. (Multi display mode).]' \
+ '-X[Execute <cmd> as a screen command in the specified session.]:Handling Tag screencmd:( acladd addacl aclchg acldel aclgrp aclumask activity allpartial at attrcolor autodetach autonuke bce bell_msg bind bindkey break breaktype bufferfile c1 caption charset chdir clear colon command compacthist console copy copy_reg crlf debug defc1 defautonuke defbce defbreaktype defcharset defescape defflow defgr defhstatus defkanji deflogin defmode defmonitor defobuflimit defscrollback defshell defsilence defslowpaste defutf8 defwrap defwritelock defzombie detach dinfo displays digraph dumptermcap echo escape exec fit flow focus gr hardcopy hardcopy_append hardcopydir hardstatus height help history hstatus info ins_reg kill lastmsg license lockscreen log logfile login logtstamp mapdefault mapnotnext maptimeout markkeys meta monitor msgminwait msgwait multiuser nethack next nonblock number obu!
+!
+flimit only other partial password paste pastefont pow_break pow_detach pow_detach_msg prev printcmd process quit readbuf readreg redisplay register remove removebuf reset resize screen scrollback select sessionname setenv shell shelltitle silence silencewait sleep slowpaste sorendition split startup_message stuff su term termcap terminfo termcapinfo time title unsetenv utf8 vbell vbell_msg vbellwait verbose version wall width windows wrap writebuf writelock xoff xon zombie defzombie)'
+case $state in
+ "sessionname")
+ # Complete folder names.
+ local screendir
+
+ screendir=(`screen -ls | grep Socket | tail -1 | sed -e 's/\.$//' | awk '{print $NF;}'`)
+
+ _wanted files expl 'screen process' _path_files -W screendir
+;;
+esac
+ \ No newline at end of file
diff --git a/etc/etcscreenrc b/etc/etcscreenrc
index 6021d5f..83a4a41 100644
--- a/etc/etcscreenrc
+++ b/etc/etcscreenrc
@@ -1,11 +1,9 @@
-#3.3
-# This is a global screenrc file
-# Install this file as /etc/screenrc. See config.h
+#
+# This is an example for the global screenrc file.
+# You may want to install this file as /usr/local/etc/screenrc.
+# Check config.h for the exact location.
#
# Flaws of termcap and standard settings are done here.
-# Note: This file should not be shared between different hosts.
-# The 'termcap' lines are written in termcap syntax.
-# The syntax for a terminfo based host is slightly different.
#
#startup_message off
@@ -94,9 +92,3 @@ bind 'I' login on
bind 'O' login off
bind '}' history
-# colon takes a parameter since screen-3.8.6
-bind 'R' colon "screen -ln rlogin faui -8^b^b^b"
-bind 'P' colon "^p"
-
-# On Debian GNU/Linux, `<--' (Backspace key) should send char `\177':
-bindkey -k kb stuff "\177"
diff --git a/etc/screenrc b/etc/screenrc
index c718364..716d86f 100644
--- a/etc/screenrc
+++ b/etc/screenrc
@@ -51,13 +51,14 @@ terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
# Make the output buffer large for (fast) xterms.
-termcapinfo xterm* OL=10000
+#termcapinfo xterm* OL=10000
+termcapinfo xterm* OL=100
# tell screen that xterm can switch to dark background and has function
# keys.
termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l'
termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
-termcapinfo xterm 'kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:kP=\E[H:kN=\E[6~'
+termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'
# special xterm hardstatus: use the window title.
termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
@@ -70,7 +71,7 @@ termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'
# xterm-52 tweaks:
# - uses background color for delete operations
-termcapinfo xterm ut
+termcapinfo xterm* be
################
#
@@ -89,12 +90,15 @@ termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb
# other terminals
#
-#make hp700 termcap/info better
+# make hp700 termcap/info better
termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
# Extend the vt100 desciption by some sequences.
termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC
terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
+termcapinfo linux C8
+# old rxvt versions also need this
+# termcapinfo rxvt C8
################
@@ -132,7 +136,14 @@ bind ^] paste [.]
# screen -t mail 1 elm
# screen -t 40 2 rlogin faui40
-# caption always "%3n %t%? @%u%?%? [%h]%?"
+# caption always "%3n %t%? @%u%?%? [%h]%?%=%c"
# hardstatus alwaysignore
-# hardstatus alwayslastline "%w"
+# hardstatus alwayslastline "%Lw"
+# bind = resize =
+# bind + resize +1
+# bind - resize -1
+# bind _ resize max
+#
+# attrcolor u "-u b"
+# attrcolor b "R"
diff --git a/etc/toolcheck b/etc/toolcheck
index 8fa214f..747e9a0 100755
--- a/etc/toolcheck
+++ b/etc/toolcheck
@@ -5,33 +5,33 @@
# 24.7.95 jw.
retval=0
-reply="`sh -version 2>&1 < /dev/null`"
+reply="`sh -version 2>&1 < /dev/null | head -1`"
case "$reply" in
GNU*1.14.3*)
- echo "- sh is '$reply'";
+ echo "- sh is '$reply'";
echo " CAUTION: This shell has a buggy 'trap' command.";
echo " The configure script may fail silently.";
retval=1;
;;
GNU*1.14.2*|GNU*1.14.4*|GNU*1.13.*)
- echo "- sh is '$reply' - good.";
+ echo "- sh is '$reply' - good.";
;;
- GNU*) echo "- sh is '$reply' - (buggy again shell?).";
+ GNU*) echo "- sh is '$reply'.";
;;
*) ;;
esac
-reply="`sed --version 2>&1 < /dev/null`"
+reply="`sed --version 2>&1 < /dev/null | head -1`"
case "$reply" in
GNU\ sed\ version\ 2.0[34])
- echo "- sed is '$reply'";
+ echo "- sed is '$reply'";
echo " CAUTION: This sed cannot configure screen properly."
retval=1;
;;
GNU\ sed\ version\ 2.05|GNU\ sed\ version\ 2.03\ kevin)
- echo "- sed is '$reply' - good.";
+ echo "- sed is '$reply' - good.";
;;
- GNU*) echo "- sed is '$reply'.";
+ GNU*) echo "- sed is '$reply'.";
;;
*) ;;
esac
diff --git a/extern.h b/extern.h
index 6663ad0..11663aa 100644
--- a/extern.h
+++ b/extern.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -32,6 +32,7 @@ extern int main __P((int, char **));
extern sigret_t SigHup __P(SIGPROTOARG);
extern void eexit __P((int));
extern void Detach __P((int));
+extern void Hangup __P((void));
extern void Kill __P((int, int));
#ifdef USEVARARGS
extern void Msg __P((int, char *, ...)) __attribute__((format(printf, 2, 3)));
@@ -40,11 +41,12 @@ extern void Panic __P((int, char *, ...)) __attribute__((format(printf, 2, 3)))
extern void Msg __P(());
extern void Panic __P(());
#endif
-extern void DisplaySleep __P((int));
+extern void DisplaySleep __P((int, int));
extern void Finit __P((int));
extern void MakeNewEnv __P((void));
extern char *MakeWinMsg __P((char *, struct win *, int));
-extern char *MakeWinMsgEv __P((char *, struct win *, int, struct event *));
+extern char *MakeWinMsgEv __P((char *, struct win *, int, int, struct event *));
+extern int PutWinMsg __P((char *, int, int));
extern void WindowDied __P((struct win *));
/* ansi.c */
@@ -52,11 +54,11 @@ extern void ResetAnsiState __P((struct win *));
extern void ResetWindow __P((struct win *));
extern void ResetCharsets __P((struct win *));
extern void WriteString __P((struct win *, char *, int));
-extern void NewAutoFlow __P((struct win *, int));
-extern void WBell __P((struct win *, int));
extern void ChangeAKA __P((struct win *, char *, int));
extern void SetCharsets __P((struct win *, char *));
extern int GetAnsiStatus __P((struct win *, char *));
+extern void WNewAutoFlow __P((struct win *, int));
+extern void WBell __P((struct win *, int));
extern void WMsg __P((struct win *, int, char *));
extern void WChangeSize __P((struct win *, int, int));
extern void WindowChanged __P((struct win *, int));
@@ -68,10 +70,11 @@ extern void FinishRc __P((char *));
extern void RcLine __P((char *));
extern FILE *secfopen __P((char *, char *));
extern int secopen __P((char *, int, int));
-extern void WriteFile __P((int));
+extern void WriteFile __P((struct acluser *, char *, int));
extern char *ReadFile __P((char *, int *));
extern void KillBuffers __P((void));
extern int printpipe __P((struct win *, char *));
+extern void do_source __P((char *));
/* tty.c */
extern int OpenTTY __P((char *, char *));
@@ -113,10 +116,13 @@ extern int InInput __P((void));
/* help.c */
extern void exit_with_usage __P((char *, char *, char *));
-extern void display_help __P((void));
+extern void display_help __P((char *, struct action *));
extern void display_copyright __P((void));
extern void display_displays __P((void));
extern void display_bindkey __P((char *, struct action *));
+extern void display_wlist __P((int));
+extern int InWList __P((void));
+extern void WListUpdatecv __P((struct canvas *, struct win *));
/* window.c */
extern int MakeWindow __P((struct NewWindow *));
@@ -131,7 +137,6 @@ extern int DoStartLog __P((struct win *, char *, int));
extern int ReleaseAutoWritelock __P((struct display *, struct win *));
extern int ObtainAutoWritelock __P((struct display *, struct win *));
extern void CloseDevice __P((struct win *));
-extern void paste_rethink __P((struct win *));
/* utmp.c */
@@ -177,17 +182,27 @@ extern void Activate __P((int));
extern void KillWindow __P((struct win *));
extern void SetForeWindow __P((struct win *));
extern int Parse __P((char *, char **));
-extern int ParseEscape __P((struct user *, char *));
+extern int ParseEscape __P((struct acluser *, char *));
extern void DoScreen __P((char *, char **));
extern int IsNumColon __P((char *, int, char *, int));
extern void ShowWindows __P((int));
extern char *AddWindows __P((char *, int, int, int));
+extern char *AddWindowFlags __P((char *, int, struct win *));
extern char *AddOtherUsers __P((char *, int, struct win *));
extern int WindowByNoN __P((char *));
extern struct win *FindNiceWindow __P((struct win *, char *));
#ifdef COPY_PASTE
extern int CompileKeys __P((char *, unsigned char *));
#endif
+#ifdef RXVT_OSC
+extern void RefreshXtermOSC __P((void));
+#endif
+extern int ParseSaveStr __P((struct action *act, char **));
+extern int ParseNum __P((struct action *act, int *));
+extern int ParseSwitch __P((struct action *, int *));
+extern int ParseAttrColor __P((char *, char *, int));
+extern void ApplyAttrColor __P((int, struct mchar *));
+extern void SwitchWindow __P((int));
/* termcap.c */
extern int InitTermcap __P((int, int));
@@ -204,35 +219,39 @@ extern void FreeTransTable __P((void));
extern int Attach __P((int));
extern void Attacher __P((void));
extern sigret_t AttacherFinit __P(SIGPROTOARG);
+extern void SendCmdMessage __P((char *, char *, char **));
/* display.c */
extern struct display *MakeDisplay __P((char *, char *, char *, int, int, struct mode *));
extern void FreeDisplay __P((void));
extern void DefProcess __P((char **, int *));
extern void DefRedisplayLine __P((int, int, int, int));
-extern void DefClearLine __P((int, int, int));
+extern void DefClearLine __P((int, int, int, int));
extern int DefRewrite __P((int, int, int, struct mchar *, int));
extern int DefResize __P((int, int));
extern void DefRestore __P((void));
-extern void PutStr __P((char *));
-extern void CPutStr __P((char *, int));
+extern void AddCStr __P((char *));
+extern void AddCStr2 __P((char *, int));
extern void InitTerm __P((int));
extern void FinitTerm __P((void));
extern void PUTCHAR __P((int));
extern void PUTCHARLP __P((int));
-extern void ClearDisplay __P((void));
-extern void Clear __P((int, int, int, int, int, int, int));
-extern void Redisplay __P((int));
-extern void RedisplayDisplays __P((int));
+extern void ClearAll __P((void));
+extern void ClearArea __P((int, int, int, int, int, int, int, int));
+extern void ClearLine __P((struct mline *, int, int, int, int));
+extern void RefreshAll __P((int));
extern void RefreshArea __P((int, int, int, int, int));
extern void RefreshLine __P((int, int, int, int));
+extern void Redisplay __P((int));
+extern void RedisplayDisplays __P((int));
extern void ShowHStatus __P((char *));
extern void RefreshHStatus __P((void));
extern void DisplayLine __P((struct mline *, struct mline *, int, int, int));
extern void GotoPos __P((int, int));
extern int CalcCost __P((char *));
-extern void ScrollH __P((int, int, int, int, struct mline *));
-extern void ScrollV __P((int, int, int, int, int));
+extern void ScrollH __P((int, int, int, int, int, struct mline *));
+extern void ScrollV __P((int, int, int, int, int, int));
+extern void PutChar __P((struct mchar *, int, int));
extern void InsChar __P((struct mchar *, int, int, int, struct mline *));
extern void WrapChar __P((struct mchar *, int, int, int, int, int, int, int));
extern void ChangeScrollRegion __P((int, int));
@@ -241,9 +260,10 @@ extern void KeypadMode __P((int));
extern void CursorkeysMode __P((int));
extern void ReverseVideo __P((int));
extern void CursorVisibility __P((int));
+extern void MouseMode __P((int));
extern void SetFont __P((int));
extern void SetAttr __P((int));
-extern void SetColor __P((int));
+extern void SetColor __P((int, int));
extern void SetRendition __P((struct mchar *));
extern void SetRenditionMline __P((struct mline *, int));
extern void MakeStatus __P((char *));
@@ -257,9 +277,6 @@ extern void Resize_obuf __P((void));
#ifdef AUTO_NUKE
extern void NukePending __P((void));
#endif
-#ifdef KANJI
-extern int badkanji __P((char *, int));
-#endif
extern void SetCanvasWindow __P((struct canvas *, struct win *));
extern int MakeDefaultCanvas __P((void));
extern int AddCanvas __P((void));
@@ -267,12 +284,21 @@ extern void RemCanvas __P((void));
extern void OneCanvas __P((void));
extern int RethinkDisplayViewports __P((void));
extern void RethinkViewportOffsets __P((struct canvas *));
+#ifdef RXVT_OSC
+extern void ClearAllXtermOSC __P((void));
+extern void SetXtermOSC __P((int, char *));
+#endif
+#ifdef COLOR
+extern int color256to16 __P((int));
+# ifdef COLORS256
+extern int color256to88 __P((int));
+# endif
+#endif
/* resize.c */
extern int ChangeWindowSize __P((struct win *, int, int, int));
extern void ChangeScreenSize __P((int, int, int));
extern void CheckScreenSize __P((int));
-extern void DoResize __P((int, int));
extern char *xrealloc __P((char *, int));
extern void ResizeLayersToCanvases __P((void));
extern void ResizeLayer __P((struct layer *, int, int, struct display *));
@@ -341,29 +367,25 @@ extern int xsnprintf __P(());
/* acl.c */
#ifdef MULTIUSER
-extern int AclInit __P((char *));
-extern int AclSetPass __P((char *, char *));
-extern int AclDelUser __P((char *));
-extern int AclCheckPermWin __P((struct user *, int, struct win *));
-extern int AclCheckPermCmd __P((struct user *, int, struct comm *));
-extern int AclSetPerm __P((struct user *, struct user *, char *, char *));
-extern int AclUmask __P((struct user *, char *, char **));
-extern int UsersAcl __P((struct user *, int, char **));
+extern int AclCheckPermWin __P((struct acluser *, int, struct win *));
+extern int AclCheckPermCmd __P((struct acluser *, int, struct comm *));
+extern int AclSetPerm __P((struct acluser *, struct acluser *, char *, char *));
+extern int AclUmask __P((struct acluser *, char *, char **));
+extern int UsersAcl __P((struct acluser *, int, char **));
extern void AclWinSwap __P((int, int));
-extern int NewWindowAcl __P((struct win *, struct user *));
+extern int NewWindowAcl __P((struct win *, struct acluser *));
extern void FreeWindowAcl __P((struct win *));
-extern char *DoSu __P((struct user **, char *, char *, char *));
+extern char *DoSu __P((struct acluser **, char *, char *, char *));
extern int AclLinkUser __P((char *, char *));
#endif /* MULTIUSER */
-extern int UserFreeCopyBuffer __P((struct user *));
-extern struct user **FindUserPtr __P((char *));
-extern int UserAdd __P((char *, char *, struct user **));
-extern int UserDel __P((char *, struct user **));
-
-
-
+extern int UserFreeCopyBuffer __P((struct acluser *));
+extern struct acluser **FindUserPtr __P((char *));
+extern int UserAdd __P((char *, char *, struct acluser **));
+extern int UserDel __P((char *, struct acluser **));
+/* braile.c */
+#ifdef HAVE_BRAILLE
extern void InitBraille __P((void));
extern void RefreshBraille __P((void));
extern void DoBrailleAction __P((struct action *, int));
@@ -371,11 +393,9 @@ extern void BGotoPos __P((struct layer *, int, int));
extern void BPutChar __P((struct layer *, struct mchar *, int, int));
extern void BPutStr __P((struct layer *, char *, int, struct mchar *, int, int));
extern void BCDisplayLine __P((struct layer *, struct mline *, int, int, int, int));
+#endif
-extern int ParseSaveStr __P((struct action *act, char **));
-extern int ParseNum __P((struct action *act, int *));
-extern int ParseSwitch __P((struct action *, int *));
/* layer.c */
@@ -383,30 +403,33 @@ extern void LGotoPos __P((struct layer *, int, int));
extern void LPutChar __P((struct layer *, struct mchar *, int, int));
extern void LInsChar __P((struct layer *, struct mchar *, int, int, struct mline *));
extern void LPutStr __P((struct layer *, char *, int, struct mchar *, int, int));
-extern void LScrollH __P((struct layer *, int, int, int, int, struct mline *));
-extern void LScrollV __P((struct layer *, int, int, int));
-extern void LClear __P((struct layer *, int, int, int, int, int));
-extern void LClearLine __P((struct layer *, int, int, int, struct mline *));
+extern void LPutWinMsg __P((struct layer *, char *, int, struct mchar *, int, int));
+extern void LScrollH __P((struct layer *, int, int, int, int, int, struct mline *));
+extern void LScrollV __P((struct layer *, int, int, int, int));
+extern void LClearAll __P((struct layer *, int));
+extern void LClearArea __P((struct layer *, int, int, int, int, int, int));
+extern void LClearLine __P((struct layer *, int, int, int, int, struct mline *));
+extern void LRefreshAll __P((struct layer *, int));
extern void LCDisplayLine __P((struct layer *, struct mline *, int, int, int, int));
+extern void LCDisplayLineWrap __P((struct layer *, struct mline *, int, int, int, int));
extern void LSetRendition __P((struct layer *, struct mchar *));
extern void LWrapChar __P((struct layer *, struct mchar *, int, int, int, int));
extern void LCursorVisibility __P((struct layer *, int));
extern void LSetFlow __P((struct layer *, int));
extern void LKeypadMode __P((struct layer *, int));
extern void LCursorkeysMode __P((struct layer *, int));
-
+extern void LMouseMode __P((struct layer *, int));
#ifdef USEVARARGS
extern void LMsg __P((int, char *, ...)) __attribute__((format(printf, 2, 3)));
#else
extern void LMsg __P(());
#endif
-extern void ClearLayer __P((struct layer *, int));
-extern void RedisplayLayer __P((struct layer *, int));
extern void KillLayerChain __P((struct layer *));
extern int InitOverlayPage __P((int, struct LayFuncs *, int));
extern void ExitOverlayPage __P((void));
/* teln.c */
+#ifdef BUILTIN_TELNET
extern int TelOpen __P((char **));
extern int TelConnect __P((struct win *));
extern int TelIsline __P((struct win *p));
@@ -416,6 +439,41 @@ extern int TelIn __P((struct win *, char *, int, int));
extern void TelBreak __P((struct win *));
extern void TelWindowSize __P((struct win *));
extern void TelStatus __P((struct win *, char *, int));
+#endif
/* nethack.c */
extern char *DoNLS __P((char *));
+
+/* encoding.c */
+#ifdef ENCODINGS
+# ifdef UTF8
+extern void InitBuiltinTabs __P((void));
+extern int recode_char __P((int, int, int));
+extern int recode_char_to_encoding __P((int, int));
+# ifdef DW_CHARS
+extern int recode_char_dw __P((int, int *, int, int));
+extern int recode_char_dw_to_encoding __P((int, int *, int));
+# endif
+extern struct mchar *recode_mchar __P((struct mchar *, int, int));
+extern struct mline *recode_mline __P((struct mline *, int, int, int));
+extern int FromUtf8 __P((int, int *));
+extern void AddUtf8 __P((int));
+extern int ToUtf8 __P((char *, int));
+extern int utf8_isdouble __P((int));
+extern int ContainsSpecialDeffont __P((struct mline *, int, int, int));
+extern int LoadFontTranslation __P((int, char *));
+extern void LoadFontTranslationsForEncoding __P((int));
+# endif /* UTF8 */
+extern void WinSwitchEncoding __P((struct win *, int));
+extern int FindEncoding __P((char *));
+extern char *EncodingName __P((int));
+extern int EncodingDefFont __P((int));
+extern void ResetEncoding __P((struct win *));
+extern int CanEncodeFont __P((int, int));
+extern int DecodeChar __P((int, int, int *));
+extern int RecodeBuf __P((unsigned char *, int, int, int, unsigned char *));
+# ifdef DW_CHARS
+extern int PrepareEncodedChar __P((int));
+# endif
+#endif
+extern int EncodeChar __P((char *, int, int, int *));
diff --git a/fileio.c b/fileio.c
index 6ad9f88..193e3ff 100644
--- a/fileio.c
+++ b/fileio.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -39,6 +39,7 @@ RCS_ID("$Id: fileio.c,v 1.10 1994/05/31 12:32:01 mlschroe Exp $ FAU")
extern struct display *display, *displays;
extern struct win *fore;
+extern struct layer *flayer;
extern int real_uid, eff_uid;
extern int real_gid, eff_gid;
extern char *extra_incap, *extra_outcap;
@@ -54,8 +55,8 @@ static char *CatExtra __P((char *, char *));
static char *findrcfile __P((char *));
-static FILE *fp = NULL;
-char *rc_name;
+char *rc_name = "";
+int rc_recursion = 0;
static char *
CatExtra(str1, str2)
@@ -94,32 +95,36 @@ static char *
findrcfile(rcfile)
char *rcfile;
{
- static char buf[256];
- char *rc, *p;
+ char buf[256];
+ char *p;
if (rcfile)
{
- rc = SaveStr(rcfile);
+ char *rcend = rindex(rc_name, '/');
+ if (*rcfile != '/' && rcend && (rcend - rc_name) + strlen(rcfile) + 2 < sizeof(buf))
+ {
+ strncpy(buf, rc_name, rcend - rc_name + 1);
+ strcpy(buf + (rcend - rc_name) + 1, rcfile);
+ if (access(buf, R_OK) == 0)
+ return SaveStr(buf);
+ }
debug1("findrcfile: you specified '%s'\n", rcfile);
+ return SaveStr(rcfile);
+ }
+ debug("findrcfile: you specified nothing...\n");
+ if ((p = getenv("SCREENRC")) != NULL && *p != '\0')
+ {
+ debug1(" $SCREENRC has: '%s'\n", p);
+ return SaveStr(p);
}
else
{
- debug("findrcfile: you specified nothing...\n");
- if ((p = getenv("SCREENRC")) != NULL && *p != '\0')
- {
- debug1(" $SCREENRC has: '%s'\n", p);
- rc = SaveStr(p);
- }
- else
- {
- debug(" ...nothing in $SCREENRC, defaulting $HOME/.screenrc\n");
- if (strlen(home) > sizeof(buf) - 12)
- Panic(0, "Rc: home too large");
- sprintf(buf, "%s/.screenrc", home);
- rc = SaveStr(buf);
- }
+ debug(" ...nothing in $SCREENRC, defaulting $HOME/.screenrc\n");
+ if (strlen(home) > sizeof(buf) - 12)
+ Panic(0, "Rc: home too large");
+ sprintf(buf, "%s/.screenrc", home);
+ return SaveStr(buf);
}
- return rc;
}
/*
@@ -135,6 +140,8 @@ char *rcfilename;
register char *p, *cp;
char buf[2048];
char *args[MAXARGS];
+ FILE *fp;
+ char *oldrc_name = rc_name;
/* always fix termcap/info capabilities */
extra_incap = CatExtra("TF", extra_incap);
@@ -147,7 +154,7 @@ char *rcfilename;
if ((fp = secfopen(rc_name, "r")) == NULL)
{
- if (RcFileName && strcmp(RcFileName, rc_name) == 0)
+ if (!rc_recursion && RcFileName && !strcmp(RcFileName, rc_name))
{
/*
* User explicitly gave us that name,
@@ -160,7 +167,7 @@ char *rcfilename;
}
debug1("StartRc: '%s' no good. ignored\n", rc_name);
Free(rc_name);
- rc_name = "";
+ rc_name = oldrc_name;
return;
}
while (fgets(buf, sizeof buf, fp) != NULL)
@@ -195,7 +202,7 @@ char *rcfilename;
Msg(0, "%s: sleep: one numeric argument expected.", rc_name);
continue;
}
- DisplaySleep(atoi(args[1]));
+ DisplaySleep(atoi(args[1]), 1);
}
#ifdef TERMINFO
else if (!strcmp(args[0], "termcapinfo") || !strcmp(args[0], "terminfo"))
@@ -229,10 +236,19 @@ char *rcfilename;
if (argc == 4)
extra_outcap = CatExtra(args[3], extra_outcap);
}
+ else if (!strcmp(args[0], "source"))
+ {
+ if (rc_recursion <= 10)
+ {
+ rc_recursion++;
+ StartRc(args[1]);
+ rc_recursion--;
+ }
+ }
}
fclose(fp);
Free(rc_name);
- rc_name = "";
+ rc_name = oldrc_name;
}
void
@@ -240,12 +256,16 @@ FinishRc(rcfilename)
char *rcfilename;
{
char buf[2048];
+ FILE *fp;
+ char *oldrc_name = rc_name;
rc_name = findrcfile(rcfilename);
if ((fp = secfopen(rc_name, "r")) == NULL)
{
- if (RcFileName && strcmp(RcFileName, rc_name) == 0)
+ if (rc_recursion)
+ Msg(errno, "%s: source %s", oldrc_name, rc_name);
+ else if (RcFileName && !strcmp(RcFileName, rc_name))
{
/*
* User explicitly gave us that name,
@@ -258,7 +278,7 @@ char *rcfilename;
}
debug1("FinishRc: '%s' no good. ignored\n", rc_name);
Free(rc_name);
- rc_name = "";
+ rc_name = oldrc_name;
return;
}
@@ -267,9 +287,24 @@ char *rcfilename;
RcLine(buf);
(void) fclose(fp);
Free(rc_name);
- rc_name = "";
+ rc_name = oldrc_name;
+}
+
+void
+do_source(rcfilename)
+char *rcfilename;
+{
+ if (rc_recursion > 10)
+ {
+ Msg(0, "%s: source: recursion limit reached", rc_name);
+ return;
+ }
+ rc_recursion++;
+ FinishRc(rcfilename);
+ rc_recursion--;
}
+
/*
* Running a Command Line in the environment determined by the display.
* The fore window is taken from the display as well as the user.
@@ -281,12 +316,17 @@ char *ubuf;
{
char *args[MAXARGS], *buf;
#ifdef MULTIUSER
- extern struct user *EffectiveAclUser; /* acl.c */
- extern struct user *users; /* acl.c */
+ extern struct acluser *EffectiveAclUser; /* acl.c */
+ extern struct acluser *users; /* acl.c */
#endif
if (display)
- fore = D_fore;
+ {
+ fore = D_fore;
+ flayer = D_forecv->c_layer;
+ }
+ else
+ flayer = fore ? fore->w_savelayer : 0;
buf = expand_vars(ubuf, display);
if (Parse(buf, args) <= 0)
return;
@@ -309,7 +349,9 @@ char *ubuf;
* needs display for copybuffer access and termcap dumping
*/
void
-WriteFile(dump)
+WriteFile(user, fn, dump)
+struct acluser *user;
+char *fn;
int dump;
{
/* dump==0: create .termcap,
@@ -317,11 +359,12 @@ int dump;
* #ifdef COPY_PASTE
* dump==2: BUFFERFILE
* #endif COPY_PASTE
+ * dump==1: scrollback,
*/
register int i, j, k;
register char *p;
register FILE *f;
- char fn[1024];
+ char fnbuf[1024];
char *mode = "w";
#ifdef COPY_PASTE
int public = 0;
@@ -339,25 +382,40 @@ int dump;
switch (dump)
{
case DUMP_TERMCAP:
- i = SockName - SockPath;
- if (i > sizeof(fn) - 9)
- i = 0;
- strncpy(fn, SockPath, i);
- strcpy(fn + i, ".termcap");
+ if (fn == 0)
+ {
+ i = SockName - SockPath;
+ if (i > sizeof(fnbuf) - 9)
+ i = 0;
+ strncpy(fnbuf, SockPath, i);
+ strcpy(fnbuf + i, ".termcap");
+ fn = fnbuf;
+ }
break;
case DUMP_HARDCOPY:
- if (hardcopydir && strlen(hardcopydir) < sizeof(fn) - 21)
- sprintf(fn, "%s/hardcopy.%d", hardcopydir, fore->w_number);
- else
- sprintf(fn, "hardcopy.%d", fore->w_number);
+ case DUMP_SCROLLBACK:
+ if (fn == 0)
+ {
+ if (fore == 0)
+ return;
+ if (hardcopydir && *hardcopydir && strlen(hardcopydir) < sizeof(fnbuf) - 21)
+ sprintf(fnbuf, "%s/hardcopy.%d", hardcopydir, fore->w_number);
+ else
+ sprintf(fnbuf, "hardcopy.%d", fore->w_number);
+ fn = fnbuf;
+ }
if (hardcopy_append && !access(fn, W_OK))
mode = "a";
break;
#ifdef COPY_PASTE
case DUMP_EXCHANGE:
- strncpy(fn, BufferFile, sizeof(fn) - 1);
- fn[sizeof(fn) - 1] = 0;
- public = !strcmp(fn, bufferfile);
+ if (fn == 0)
+ {
+ strncpy(fnbuf, BufferFile, sizeof(fnbuf) - 1);
+ fnbuf[sizeof(fnbuf) - 1] = 0;
+ fn = fnbuf;
+ }
+ public = !strcmp(fn, DEFAULT_BUFFERFILE);
# ifdef HAVE_LSTAT
exists = !lstat(fn, &stb);
if (public && exists && (S_ISLNK(stb.st_mode) || stb.st_nlink > 1))
@@ -413,17 +471,32 @@ int dump;
switch (dump)
{
case DUMP_HARDCOPY:
+ case DUMP_SCROLLBACK:
+ if (!fore)
+ break;
if (*mode == 'a')
{
putc('>', f);
- for (j = D_width - 2; j > 0; j--)
+ for (j = fore->w_width - 2; j > 0; j--)
putc('=', f);
fputs("<\n", f);
}
- for (i = 0; i < D_height; i++)
+ if (dump == DUMP_SCROLLBACK)
{
- p = fore->w_mlines[i].image;
- for (k = D_width - 1; k >= 0 && p[k] == ' '; k--)
+ for (i = 0; i < fore->w_histheight; i++)
+ {
+ p = (char *)(WIN(i)->image);
+ for (k = fore->w_width - 1; k >= 0 && p[k] == ' '; k--)
+ ;
+ for (j = 0; j <= k; j++)
+ putc(p[j], f);
+ putc('\n', f);
+ }
+ }
+ for (i = 0; i < fore->w_height; i++)
+ {
+ p = (char *)fore->w_mlines[i].image;
+ for (k = fore->w_width - 1; k >= 0 && p[k] == ' '; k--)
;
for (j = 0; j <= k; j++)
putc(p[j], f);
@@ -439,8 +512,8 @@ int dump;
break;
#ifdef COPY_PASTE
case DUMP_EXCHANGE:
- p = D_user->u_copybuffer;
- for (i = D_user->u_copylen; i-- > 0; p++)
+ p = user->u_plop.buf;
+ for (i = user->u_plop.len; i-- > 0; p++)
if (*p == '\r' && (i == 0 || p[1] != '\n'))
putc('\n', f);
else
@@ -454,7 +527,7 @@ int dump;
}
if (UserStatus() <= 0)
Msg(0, "Cannot open \"%s\"", fn);
- else
+ else if (display && !*rc_name)
{
switch (dump)
{
@@ -462,6 +535,7 @@ int dump;
Msg(0, "Termcap entry written to \"%s\".", fn);
break;
case DUMP_HARDCOPY:
+ case DUMP_SCROLLBACK:
Msg(0, "Screen image %s to \"%s\".",
(*mode == 'a') ? "appended" : "written", fn);
break;
diff --git a/help.c b/help.c
index bcd74ae..2e5ed81 100644
--- a/help.c
+++ b/help.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -34,13 +34,16 @@ RCS_ID("$Id: help.c,v 1.7 1994/05/31 12:32:04 mlschroe Exp $ FAU")
char version[40]; /* initialised by main() */
extern struct layer *flayer;
-extern struct display *displays;
+extern struct display *display, *displays;
extern char *noargs[];
-extern struct mchar mchar_blank;
+extern struct mchar mchar_blank, mchar_so;
extern char *blank;
+extern struct win *wtab[];
static void PadStr __P((char *, int, int, int));
+extern char *wliststr;
+extern char *wlisttit;
void
exit_with_usage(myname, message, arg)
@@ -76,11 +79,15 @@ char *myname, *message, *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 Do nothing, just clean up SockDir.\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)
{
printf("\nError: ");
@@ -106,6 +113,8 @@ static int helppage __P((void));
struct helpdata
{
+ char *class;
+ struct action *ktabp;
int maxrow, grow, numcols, numrows, num_names;
int numskip, numpages;
int command_search, command_bindings;
@@ -129,7 +138,9 @@ static struct LayFuncs HelpLf =
void
-display_help()
+display_help(class, ktabp)
+char *class;
+struct action *ktabp;
{
int i, n, key, mcom, mkey, l;
struct helpdata *helpdata;
@@ -144,6 +155,8 @@ display_help()
return;
helpdata = (struct helpdata *)flayer->l_data;
+ helpdata->class = class;
+ helpdata->ktabp = ktabp;
helpdata->num_names = helpdata->command_bindings = 0;
helpdata->command_search = 0;
for (n = 0; n <= RC_LAST; n++)
@@ -152,13 +165,13 @@ display_help()
mkey = 0;
for (key = 0; key < 256; key++)
{
- n = ktab[key].nr;
+ n = ktabp[key].nr;
if (n == RC_ILLEGAL)
continue;
- if (ktab[key].args == noargs)
+ if (ktabp[key].args == noargs)
{
- used[n] += (key <= ' ' || key == 0x7f) ? 3 :
- (key > 0x7f) ? 5 : 2;
+ used[n] += (key <= ' ' || key == 0x7f) ? 3 :
+ (key > 0x7f) ? 5 : 2;
}
else
helpdata->command_bindings++;
@@ -171,7 +184,7 @@ display_help()
mcom = l;
if (used[n] > mkey)
mkey = used[n];
- helpdata->nact[i++] = n;
+ helpdata->nact[i++] = n;
}
debug1("help: %d commands bound to keys with no arguments\n", i);
debug2("mcom: %d mkey: %d\n", mcom, mkey);
@@ -223,7 +236,7 @@ int *plen;
{
case ' ':
if (helppage() == 0)
- break;
+ break;
/* FALLTHROUGH */
case '\r':
case '\n':
@@ -242,7 +255,7 @@ int *plen;
static void
HelpAbort()
{
- LAY_CALL_UP(RedisplayLayer(flayer, 0));
+ LAY_CALL_UP(LRefreshAll(flayer, 0));
ExitOverlayPage();
}
@@ -253,16 +266,18 @@ helppage()
struct helpdata *helpdata;
int col, crow, n, key, x;
char buf[MAXKLEN], Esc_buf[5], cbuf[256];
+ struct action *ktabp;
helpdata = (struct helpdata *)flayer->l_data;
+ ktabp = helpdata->ktabp;
if (helpdata->grow >= helpdata->maxrow)
return -1;
helpdata->refgrow = helpdata->grow;
helpdata->refcommand_search = helpdata->command_search;
/* Clear the help screen */
- ClearLayer(flayer, 0);
+ LClearAll(flayer, 0);
sprintf(cbuf,"Screen key bindings, page %d of %d.", helpdata->grow / (flayer->l_height-5) + 1, helpdata->numpages);
centerline(cbuf, 0);
@@ -285,11 +300,14 @@ helppage()
for (; crow < flayer->l_height - 3; crow++)
{
if (helpdata->grow < 1)
- {
- sprintf(cbuf,"Command key: %s Literal %s: %s", Esc_buf, Esc_buf, buf);
- centerline(cbuf, crow);
+ {
+ if (ktabp == ktab)
+ sprintf(cbuf,"Command key: %s Literal %s: %s", Esc_buf, Esc_buf, buf);
+ else
+ sprintf(cbuf,"Command class: '%.80s'", helpdata->class);
+ centerline(cbuf, crow);
helpdata->grow++;
- }
+ }
else if (helpdata->grow >= 2 && helpdata->grow-2 < helpdata->numrows)
{
x = 0;
@@ -299,7 +317,7 @@ helppage()
n = helpdata->nact[n];
buf[0] = '\0';
for (key = 0; key < 256; key++)
- if (ktab[key].nr == n && ktab[key].args == noargs && strlen(buf) < sizeof(buf) - 7)
+ if (ktabp[key].nr == n && ktabp[key].args == noargs && strlen(buf) < sizeof(buf) - 7)
{
strcat(buf, " ");
add_key_to_buf(buf, key);
@@ -309,13 +327,13 @@ helppage()
PadStr(buf, helpdata->mkey, x, crow);
x += helpdata->mkey;
}
- helpdata->grow++;
- }
+ helpdata->grow++;
+ }
else if (helpdata->grow-2-helpdata->numrows >= helpdata->numskip
- && helpdata->grow-2-helpdata->numrows-helpdata->numskip < helpdata->command_bindings)
+ && helpdata->grow-2-helpdata->numrows-helpdata->numskip < helpdata->command_bindings)
{
- while ((n = ktab[helpdata->command_search].nr) == RC_ILLEGAL
- || ktab[helpdata->command_search].args == noargs)
+ while ((n = ktabp[helpdata->command_search].nr) == RC_ILLEGAL
+ || ktabp[helpdata->command_search].args == noargs)
{
if (++helpdata->command_search >= 256)
return -1;
@@ -323,7 +341,7 @@ helppage()
buf[0] = '\0';
add_key_to_buf(buf, helpdata->command_search);
PadStr(buf, 4, 0, crow);
- AddAction(&ktab[helpdata->command_search++], 4, crow);
+ AddAction(&ktabp[helpdata->command_search++], 4, crow);
helpdata->grow++;
}
else
@@ -332,7 +350,7 @@ helppage()
sprintf(cbuf,"[Press Space %s Return to end.]",
helpdata->grow < helpdata->maxrow ? "for next page;" : "or");
centerline(cbuf, flayer->l_height - 2);
- SetCursor();
+ LaySetCursor();
return 0;
}
@@ -375,7 +393,7 @@ int x, y;
*bp++ = del = '\'';
}
while (*cp && bp < buf + 250)
- bp += AddXChar(bp, *(unsigned char *)cp++);
+ bp += AddXChar(bp, *(unsigned char *)cp++);
if (del)
*bp++ = del;
*bp = 0;
@@ -392,7 +410,7 @@ int x, y;
x += strlen(buf);
pp++;
if (*pp)
- LPutChar(flayer, fr ? &mchar_blank : &mchar_dol, x++, y);
+ LPutChar(flayer, fr ? &mchar_blank : &mchar_dol, x++, y);
}
}
@@ -428,7 +446,7 @@ int y, xs, xe, isblank;
if (y != 0 && y != flayer->l_height - 1)
return;
if (!isblank)
- LClear(flayer, xs, y, xe, y, 0);
+ LClearArea(flayer, xs, y, xe, y, 0, 0);
}
@@ -464,7 +482,7 @@ static const char cpmsg[] = "\
\n\
Screen version %v\n\
\n\
-Copyright (c) 1993-1999 Juergen Weigert, Michael Schroeder\n\
+Copyright (c) 1993-2000 Juergen Weigert, Michael Schroeder\n\
Copyright (c) 1987 Oliver Laumann\n\
\n\
This program is free software; you can redistribute it and/or \
@@ -500,7 +518,7 @@ int *plen;
switch (**ppbuf)
{
case ' ':
- if (*copydata->cps)
+ if (*copydata->cps)
{
copypage();
break;
@@ -522,7 +540,7 @@ int *plen;
static void
CopyrightAbort()
{
- LAY_CALL_UP(RedisplayLayer(flayer, 0));
+ LAY_CALL_UP(LRefreshAll(flayer, 0));
ExitOverlayPage();
}
@@ -558,7 +576,7 @@ copypage()
ASSERT(flayer);
copydata = (struct copydata *)flayer->l_data;
- ClearLayer(flayer, 0);
+ LClearAll(flayer, 0);
x = y = 0;
cps = copydata->cps;
copydata->refcps = cps;
@@ -592,7 +610,7 @@ copypage()
x++;
}
if (l)
- LPutStr(flayer, ws, l, &mchar_blank, x, y);
+ LPutStr(flayer, ws, l, &mchar_blank, x, y);
x += l;
cps += l;
if (*cps == 0 && copydata->savedcps)
@@ -614,7 +632,7 @@ copypage()
*cps ? "for next page;" : "or");
centerline(cbuf, flayer->l_height - 2);
copydata->cps = cps;
- SetCursor();
+ LaySetCursor();
}
static void
@@ -636,7 +654,7 @@ int y, xs, xe, isblank;
return;
if (isblank)
return;
- LClear(flayer, xs, y, xe, y, 0);
+ LClearArea(flayer, xs, y, xe, y, 0, 0);
}
@@ -647,6 +665,8 @@ int y, xs, xe, isblank;
**
*/
+#ifdef MULTI
+
static void DisplaysProcess __P((char **, int *));
static void DisplaysRedisplayLine __P((int, int, int, int));
static void displayspage __P((void));
@@ -673,10 +693,8 @@ char **ppbuf;
int *plen;
{
int done = 0;
- struct displaysdata *displaysdata;
ASSERT(flayer);
- displaysdata = (struct displaysdata *)flayer->l_data;
while (!done && *plen > 0)
{
switch (**ppbuf)
@@ -684,7 +702,6 @@ int *plen;
case ' ':
displayspage();
break;
- /* FALLTHROUGH */
case '\r':
case '\n':
HelpAbort();
@@ -698,19 +715,17 @@ int *plen;
}
}
+
void
display_displays()
{
- struct displaysdata *displaysdata;
-
if (flayer->l_width < 10 || flayer->l_height < 5)
{
LMsg(0, "Window size too small for displays page");
return;
}
- if (InitOverlayPage(sizeof(*displaysdata), &DisplaysLf, 0))
+ if (InitOverlayPage(sizeof(struct displaysdata), &DisplaysLf, 0))
return;
- displaysdata = (struct displaysdata *)flayer->l_data;
flayer->l_x = 0;
flayer->l_y = flayer->l_height - 1;
displayspage();
@@ -742,13 +757,10 @@ displayspage()
{
int y, l;
char tbuf[80];
- struct displaysdata *displaysdata;
struct display *d;
struct win *w;
- displaysdata = (struct displaysdata *)flayer->l_data;
-
- ClearLayer(flayer, 0);
+ LClearAll(flayer, 0);
leftline("term-type size user interface window", 0);
leftline("---------- ------- ---------- ----------------- ----------", 1);
@@ -764,11 +776,11 @@ displayspage()
d->d_termname, d->d_width, d->d_height, d->d_user->u_name,
d->d_usertty,
d->d_nonblock ? ((( d->d_obufp - d->d_obuf) > d->d_obufmax) ?
- "NB" : "nb") : " ");
+ "NB" : "nb") : " ");
if (w)
{
- l = 10 - strlen(w->w_title);
+ l = 10 - strlen(w->w_title);
if (l < 0)
l = 0;
sprintf(tbuf + strlen(tbuf), "%3d(%.10s)%*s%c%c%c%c",
@@ -800,7 +812,7 @@ displayspage()
sprintf(tbuf,"[Press Space %s Return to end.]",
1 ? "to refresh;" : "or");
centerline(tbuf, flayer->l_height - 2);
- SetCursor();
+ LaySetCursor();
}
static void
@@ -810,9 +822,6 @@ int y, xs, xe, isblank;
ASSERT(flayer);
if (y < 0)
{
- struct displaysdata *displaysdata;
-
- displaysdata = (struct displaysdata *)flayer->l_data;
displayspage();
return;
}
@@ -820,10 +829,427 @@ int y, xs, xe, isblank;
return;
if (isblank)
return;
- LClear(flayer, xs, y, xe, y, 0);
+ LClearArea(flayer, xs, y, xe, y, 0, 0);
/* To be filled in... */
}
+#endif /* MULTI */
+
+
+/*
+**
+** here is the windowlist
+**
+*/
+
+static void WListProcess __P((char **, int *));
+static void WListRedisplayLine __P((int, int, int, int));
+static void wlistpage __P((void));
+static void WListLine __P((int, int, int, int));
+static void WListLines __P((int, int));
+static void WListMove __P((int, int));
+static void WListUpdate __P((struct win *));
+static int WListNormalize __P((void));
+static int WListResize __P((int, int));
+
+struct wlistdata {
+ int pos;
+ int ypos;
+ int npos;
+ int numwin;
+ int first;
+ int last;
+ int start;
+};
+
+static struct LayFuncs WListLf =
+{
+ WListProcess,
+ HelpAbort,
+ WListRedisplayLine,
+ DefClearLine,
+ DefRewrite,
+ WListResize,
+ DefRestore
+};
+
+static int
+WListResize(wi, he)
+int wi, he;
+{
+ struct wlistdata *wlistdata;
+ if (wi < 10 || he < 5)
+ return -1;
+ wlistdata = (struct wlistdata *)flayer->l_data;
+ flayer->l_width = wi;
+ flayer->l_height = he;
+ wlistdata->numwin = he - 3;
+ if (wlistdata->ypos >= wlistdata->numwin)
+ wlistdata->ypos = wlistdata->numwin - 1;
+ flayer->l_y = he - 1;
+ return 0;
+}
+
+static void
+WListProcess(ppbuf, plen)
+char **ppbuf;
+int *plen;
+{
+ int done = 0;
+ struct wlistdata *wlistdata;
+ int h;
+
+ ASSERT(flayer);
+ wlistdata = (struct wlistdata *)flayer->l_data;
+ h = wlistdata->numwin;
+ while (!done && *plen > 0)
+ {
+ switch ((unsigned char)**ppbuf)
+ {
+ case 0220:
+ case 'k':
+ WListMove(-1, -1);
+ break;
+ case 0216:
+ case 'j':
+ WListMove(1, -1);
+ break;
+ case '\025':
+ WListMove(-(h / 2), wlistdata->ypos);
+ break;
+ case '\004':
+ WListMove(h / 2, wlistdata->ypos);
+ break;
+ case 0002:
+ case 'b':
+ WListMove(-h, -1);
+ break;
+ case 0006:
+ case 'f':
+ WListMove(h, -1);
+ break;
+ case 0201:
+ WListMove(-wlistdata->pos, -1);
+ break;
+ case 0205:
+ WListMove(MAXWIN, -1);
+ break;
+ case '\r':
+ case '\n':
+ case ' ':
+ done = 1;
+ h = wlistdata->pos;
+ if (!display || !wtab[h] || wtab[h] == D_fore || (flayer->l_cvlist && flayer->l_cvlist->c_lnext))
+ HelpAbort();
+#ifdef MULTIUSER
+ else if (AclCheckPermWin(D_user, ACL_READ, wtab[h]))
+ HelpAbort();
+#endif
+ else
+ ExitOverlayPage(); /* no need to redisplay */
+ SwitchWindow(h);
+ break;
+ case 0033:
+ case 0007:
+ h = wlistdata->start;
+ HelpAbort();
+ if (h >= 0 && wtab[h])
+ SwitchWindow(h);
+ else if (h == -2)
+ {
+ struct win *p = FindNiceWindow(display ? D_other : (struct win *)0, 0);
+ if (p)
+ SwitchWindow(p->w_number);
+ }
+ done = 1;
+ break;
+ default:
+ break;
+ }
+ ++*ppbuf;
+ --*plen;
+ }
+}
+
+static void
+WListLine(y, i, pos, isblank)
+int y, i;
+int pos;
+int isblank;
+{
+ char *str;
+ int n;
+
+ display = 0;
+ str = MakeWinMsgEv(wliststr, wtab[i], '%', flayer->l_width, (struct event *)0);
+ n = strlen(str);
+ if (i != pos && isblank)
+ while (n && str[n - 1] == ' ')
+ n--;
+ LPutWinMsg(flayer, str, (i == pos || !isblank) ? flayer->l_width : n, i == pos ? &mchar_so : &mchar_blank, 0, y + 2);
+#if 0
+ LPutStr(flayer, str, n, i == pos ? &mchar_so : &mchar_blank, 0, y + 2);
+ if (i == pos || !isblank)
+ while(n < flayer->l_width)
+ LPutChar(flayer, i == pos ? &mchar_so : &mchar_blank, n++, y + 2);
+#endif
+ return;
+}
+
+static void
+WListLines(up, oldpos)
+int up, oldpos;
+{
+ struct wlistdata *wlistdata;
+ int ypos, pos;
+ int y, i, first;
+
+ wlistdata = (struct wlistdata *)flayer->l_data;
+ ypos = wlistdata->ypos;
+ pos = wlistdata->pos;
+
+ first = ypos;
+ for (i = pos; i >= 0; i--)
+ if (wtab[i] && first-- == 0)
+ break;
+ for (y = 0; y < wlistdata->numwin; y++)
+ {
+ while (i < MAXWIN && wtab[i] == 0)
+ i++;
+ if (i == MAXWIN)
+ continue;
+ if (y == 0)
+ wlistdata->first = i;
+ wlistdata->last = i;
+ if (((i == oldpos || i == pos) && pos != oldpos) || (up > 0 && y >= wlistdata->numwin - up) || (up < 0 && y < -up))
+ WListLine(y, i, pos, i != oldpos);
+ if (i == pos)
+ wlistdata->ypos = y;
+ i++;
+ }
+}
+
+static int
+WListNormalize()
+{
+ struct wlistdata *wlistdata;
+ int i, n;
+ int ypos, pos;
+
+ wlistdata = (struct wlistdata *)flayer->l_data;
+ ypos = wlistdata->ypos;
+ pos = wlistdata->pos;
+ if (ypos < 0)
+ ypos = 0;
+ if (ypos >= wlistdata->numwin)
+ ypos = wlistdata->numwin - 1;
+ for (n = 0, i = pos; i < MAXWIN && n < wlistdata->numwin; i++)
+ if (wtab[i])
+ n++;
+ if (ypos < wlistdata->numwin - n)
+ ypos = wlistdata->numwin - n;
+ for (n = i = 0; i < pos; i++)
+ if (wtab[i])
+ n++;
+ if (ypos > n)
+ ypos = n;
+ wlistdata->ypos = ypos;
+ wlistdata->npos = n;
+ return ypos;
+}
+
+static void
+WListMove(num, ypos)
+int num;
+int ypos;
+{
+ struct wlistdata *wlistdata;
+ int oldpos, oldypos, oldnpos;
+ int pos, up, i;
+
+ wlistdata = (struct wlistdata *)flayer->l_data;
+ oldpos = wlistdata->pos;
+ oldypos = wlistdata->ypos;
+ oldnpos = wlistdata->npos;
+ wlistdata->ypos = ypos == -1 ? oldypos + num : ypos;
+ pos = oldpos;
+ i = pos;
+ while (num > 0 && i < MAXWIN - 1)
+ if (wtab[++i])
+ {
+ pos = i;
+ num--;
+ }
+ while (num < 0 && i > 0)
+ if (wtab[--i])
+ {
+ pos = i;
+ num++;
+ }
+ wlistdata->pos = pos;
+ ypos = WListNormalize();
+ up = wlistdata->npos - ypos - (oldnpos - oldypos);
+ if (up)
+ {
+ LScrollV(flayer, up, 2, 2 + wlistdata->numwin - 1, 0);
+ WListLines(up, oldpos);
+ LaySetCursor();
+ return;
+ }
+ if (pos == oldpos)
+ return;
+ WListLine(oldypos, oldpos, pos, 0);
+ WListLine(ypos, pos, pos, 1);
+ LaySetCursor();
+}
+
+static void
+WListRedisplayLine(y, xs, xe, isblank)
+int y, xs, xe, isblank;
+{
+ ASSERT(flayer);
+ if (y < 0)
+ {
+ wlistpage();
+ return;
+ }
+ if (y != 0 && y != flayer->l_height - 1)
+ return;
+ if (!isblank)
+ LClearArea(flayer, xs, y, xe, y, 0, 0);
+}
+
+void
+display_wlist(onblank)
+int onblank;
+{
+ struct win *p;
+ struct wlistdata *wlistdata;
+
+ if (flayer->l_width < 10 || flayer->l_height < 5)
+ {
+ LMsg(0, "Window size too small for window list page");
+ return;
+ }
+ if (onblank)
+ {
+ debug3("flayer %x %d %x\n", flayer, flayer->l_width, flayer->l_height);
+ if (!display)
+ {
+ LMsg(0, "windowlist -b: display required");
+ return;
+ }
+ p = D_fore;
+ SetForeWindow((struct win *)0);
+ Activate(0);
+ if (flayer->l_width < 10 || flayer->l_height < 5)
+ {
+ LMsg(0, "Window size too small for window list page");
+ return;
+ }
+ debug3("flayer %x %d %x\n", flayer, flayer->l_width, flayer->l_height);
+ }
+ else
+ p = Layer2Window(flayer);
+ if (InitOverlayPage(sizeof(*wlistdata), &WListLf, 0))
+ return;
+ wlistdata = (struct wlistdata *)flayer->l_data;
+ flayer->l_x = 0;
+ flayer->l_y = flayer->l_height - 1;
+ wlistdata->start = onblank && p ? p->w_number : -1;
+ wlistdata->pos = p ? p->w_number : 0;
+ wlistdata->ypos = 0;
+ wlistdata->numwin= flayer->l_height - 3;
+ wlistpage();
+}
+
+static void
+wlistpage()
+{
+ struct wlistdata *wlistdata;
+ char *str;
+ int pos;
+
+ wlistdata = (struct wlistdata *)flayer->l_data;
+
+ LClearAll(flayer, 0);
+ if (wlistdata->start >= 0 && wtab[wlistdata->start] == 0)
+ wlistdata->start = -2;
+
+ pos = wlistdata->pos;
+ if (wtab[pos] == 0)
+ {
+ /* find new position */
+ while(++pos < MAXWIN)
+ if (wtab[pos])
+ break;
+ if (pos == MAXWIN)
+ while (--pos > 0)
+ if (wtab[pos])
+ break;
+ }
+ wlistdata->pos = pos;
+
+ display = 0;
+ str = MakeWinMsgEv(wlisttit, (struct win *)0, '%', flayer->l_width, (struct event *)0);
+ LPutWinMsg(flayer, str, strlen(str), &mchar_blank, 0, 0);
+ WListNormalize();
+ WListLines(wlistdata->numwin, -1);
+ LaySetCursor();
+}
+
+static void
+WListUpdate(p)
+struct win *p;
+{
+ struct wlistdata *wlistdata;
+ int i, n, y;
+
+ if (p == 0)
+ {
+ wlistpage();
+ return;
+ }
+ wlistdata = (struct wlistdata *)flayer->l_data;
+ n = p->w_number;
+ if (n < wlistdata->first || n > wlistdata->last)
+ return;
+ i = wlistdata->first;
+ for (y = 0; y < wlistdata->numwin; y++)
+ {
+ while (i < MAXWIN && wtab[i] == 0)
+ i++;
+ if (i == MAXWIN)
+ return;
+ if (i == n)
+ break;
+ i++;
+ }
+ if (y == wlistdata->numwin)
+ return;
+ WListLine(y, i, wlistdata->pos, 0);
+ LaySetCursor();
+}
+
+void
+WListUpdatecv(cv, p)
+struct canvas *cv;
+struct win *p;
+{
+ if (cv->c_layer->l_layfn != &WListLf)
+ return;
+ CV_CALL(cv, WListUpdate(p));
+}
+
+int
+InWList()
+{
+ if (flayer && flayer->l_layfn == &WListLf)
+ return 1;
+ return 0;
+}
+
+
/*
**
@@ -903,7 +1329,7 @@ struct action *tab;
static void
BindkeyAbort()
{
- LAY_CALL_UP(RedisplayLayer(flayer, 0));
+ LAY_CALL_UP(LRefreshAll(flayer, 0));
ExitOverlayPage();
}
@@ -918,7 +1344,7 @@ bindkeypage()
bindkeydata = (struct bindkeydata *)flayer->l_data;
- ClearLayer(flayer, 0);
+ LClearAll(flayer, 0);
sprintf(tbuf, "%s key bindings, page %d of %d.", bindkeydata->title, bindkeydata->page, bindkeydata->pages);
centerline(tbuf, 0);
@@ -954,7 +1380,7 @@ bindkeypage()
*p++ = del;
*p++ = ' ';
while (p < tbuf + 15)
- *p++ = ' ';
+ *p++ = ' ';
sprintf(p, "%s -> ", xch);
p += 7;
if (p - tbuf > flayer->l_width - 1)
@@ -970,7 +1396,7 @@ bindkeypage()
bindkeydata->last = i;
sprintf(tbuf,"[Press Space %s Return to end.]", bindkeydata->page < bindkeydata->pages ? "for next page;" : "or");
centerline(tbuf, flayer->l_height - 2);
- SetCursor();
+ LaySetCursor();
}
static void
@@ -1021,7 +1447,7 @@ int y, xs, xe, isblank;
if (y != 0 && y != flayer->l_height - 1)
return;
if (!isblank)
- LClear(flayer, xs, y, xe, y, 0);
+ LClearArea(flayer, xs, y, xe, y, 0, 0);
}
#endif /* MAPKEYS */
diff --git a/image.h b/image.h
index 6dc74be..55d795f 100644
--- a/image.h
+++ b/image.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -38,76 +38,126 @@
# 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
struct mchar {
- char image;
- char attr;
-IFFONT( char font;)
-IFCOLOR(char color;)
+ unsigned char image;
+ unsigned char attr;
+IFFONT( unsigned char font;)
+IFCOLOR( unsigned char color;)
+IFCOLORX(unsigned char colorx;)
+IFDWCHAR(unsigned char mbcs;)
};
struct mline {
- char *image;
- char *attr;
-IFFONT( char *font;)
-IFCOLOR(char *color;)
+ unsigned char *image;
+ unsigned char *attr;
+IFFONT( unsigned char *font;)
+IFCOLOR( unsigned char *color;)
+IFCOLORX(unsigned char *colorx;)
};
-#define save_mline(ml, n) do { \
- bcopy((ml)->image, mline_old.image, (n)); \
- bcopy((ml)->attr, mline_old.attr, (n)); \
-IFFONT( bcopy((ml)->font, mline_old.font, (n)); )\
-IFCOLOR(bcopy((ml)->color, mline_old.color, (n)); )\
+#define save_mline(ml, n) do { \
+ 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)); )\
+IFCOLOR( bcopy((char *)(ml)->color, (char *)mline_old.color, (n)); )\
+IFCOLORX(bcopy((char *)(ml)->colorx, (char *)mline_old.colorx, (n)); )\
} while (0)
-#define bcopy_mline(ml, xf, xt, n) do { \
- bcopy((ml)->image + (xf), (ml)->image + (xt), (n)); \
- bcopy((ml)->attr + (xf), (ml)->attr + (xt), (n)); \
-IFFONT( bcopy((ml)->font + (xf), (ml)->font + (xt), (n)); )\
-IFCOLOR(bcopy((ml)->color + (xf), (ml)->color + (xt), (n)); )\
+#define bcopy_mline(ml, xf, xt, n) do { \
+ 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)); )\
+IFCOLOR( bcopy((char *)(ml)->color + (xf), (char *)(ml)->color + (xt), (n)); )\
+IFCOLORX(bcopy((char *)(ml)->colorx + (xf), (char *)(ml)->colorx + (xt), (n));)\
} while (0)
-#define clear_mline(ml, x, n) do { \
- bclear((ml)->image + (x), (n)); \
- if ((ml)->attr != null) bzero((ml)->attr + (x), (n)); \
-IFFONT( if ((ml)->font != null) bzero((ml)->font + (x), (n)); )\
-IFCOLOR(if ((ml)->color!= null) bzero((ml)->color + (x), (n)); )\
+#define clear_mline(ml, x, n) do { \
+ 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)); )\
+IFCOLOR (if ((ml)->color!= null) bzero((char *)(ml)->color + (x), (n)); )\
+IFCOLORX(if ((ml)->colorx!= null) bzero((char *)(ml)->colorx + (x), (n)); )\
} while (0)
#define cmp_mline(ml1, ml2, x) ( \
- (ml1)->image[x] == (ml2)->image[x] \
- && (ml1)->attr[x] == (ml2)->attr[x] \
-IFFONT( && (ml1)->font[x] == (ml2)->font[x] )\
-IFCOLOR(&& (ml1)->color[x] == (ml2)->color[x] )\
+ (ml1)->image[x] == (ml2)->image[x] \
+ && (ml1)->attr[x] == (ml2)->attr[x] \
+IFFONT( && (ml1)->font[x] == (ml2)->font[x] )\
+IFCOLOR( && (ml1)->color[x] == (ml2)->color[x] )\
+IFCOLORX(&& (ml1)->colorx[x] == (ml2)->colorx[x] )\
)
#define cmp_mchar(mc1, mc2) ( \
- (mc1)->image == (mc2)->image \
- && (mc1)->attr == (mc2)->attr \
-IFFONT( && (mc1)->font == (mc2)->font )\
-IFCOLOR(&& (mc1)->color == (mc2)->color )\
+ (mc1)->image == (mc2)->image \
+ && (mc1)->attr == (mc2)->attr \
+IFFONT( && (mc1)->font == (mc2)->font )\
+IFCOLOR( && (mc1)->color == (mc2)->color )\
+IFCOLORX(&& (mc1)->colorx == (mc2)->colorx )\
)
#define cmp_mchar_mline(mc, ml, x) ( \
- (mc)->image == (ml)->image[x] \
- && (mc)->attr == (ml)->attr[x] \
-IFFONT( && (mc)->font == (ml)->font[x] )\
-IFCOLOR(&& (mc)->color == (ml)->color[x] )\
+ (mc)->image == (ml)->image[x] \
+ && (mc)->attr == (ml)->attr[x] \
+IFFONT( && (mc)->font == (ml)->font[x] )\
+IFCOLOR( && (mc)->color == (ml)->color[x] )\
+IFCOLORX(&& (mc)->colorx == (ml)->colorx[x] )\
)
#define copy_mchar2mline(mc, ml, x) do { \
- (ml)->image[x] = (mc)->image; \
- (ml)->attr[x] = (mc)->attr; \
-IFFONT( (ml)->font[x] = (mc)->font; )\
-IFCOLOR((ml)->color[x] = (mc)->color; )\
+ (ml)->image[x] = (mc)->image; \
+ (ml)->attr[x] = (mc)->attr; \
+IFFONT( (ml)->font[x] = (mc)->font; )\
+IFCOLOR( (ml)->color[x] = (mc)->color; )\
+IFCOLORX((ml)->colorx[x] = (mc)->colorx; )\
} while (0)
#define copy_mline2mchar(mc, ml, x) do { \
- (mc)->image = (ml)->image[x]; \
- (mc)->attr = (ml)->attr[x]; \
-IFFONT( (mc)->font = (ml)->font[x]; )\
-IFCOLOR((mc)->color = (ml)->color[x]; )\
+ (mc)->image = (ml)->image[x]; \
+ (mc)->attr = (ml)->attr[x]; \
+IFFONT( (mc)->font = (ml)->font[x]; )\
+IFCOLOR( (mc)->color = (ml)->color[x]; )\
+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
diff --git a/input.c b/input.c
index cf2ebf7..39a8e83 100644
--- a/input.c
+++ b/input.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -243,7 +243,7 @@ int *plen;
x = inpdata->inpstringlen;
if (inpdata->inp.len && !(inpdata->inpmode & INP_NOECHO))
{
- LClear(flayer, x, INPUTLINE, x + inpdata->inp.len - 1, INPUTLINE, 0);
+ LClearArea(flayer, x, INPUTLINE, x + inpdata->inp.len - 1, INPUTLINE, 0, 0);
LGotoPos(flayer, x, INPUTLINE);
}
inpdata->inp.len = inpdata->inp.pos = 0;
@@ -253,7 +253,7 @@ int *plen;
x = inpdata->inpstringlen + inpdata->inp.pos;
if (inpdata->inp.len > inpdata->inp.pos && !(inpdata->inpmode & INP_NOECHO))
{
- LClear(flayer, x, INPUTLINE, x + inpdata->inp.len - inpdata->inp.pos - 1, INPUTLINE, 0);
+ LClearArea(flayer, x, INPUTLINE, x + inpdata->inp.len - inpdata->inp.pos - 1, INPUTLINE, 0, 0);
LGotoPos(flayer, x, INPUTLINE);
}
inpdata->inp.len = inpdata->inp.pos;
@@ -283,7 +283,7 @@ int *plen;
struct mchar mc;
mc = mchar_so;
if (inpdata->inp.len && !(inpdata->inpmode & INP_NOECHO))
- LClear(flayer, inpdata->inpstringlen, INPUTLINE, inpdata->inpstringlen + inpdata->inp.len - 1, INPUTLINE, 0);
+ LClearArea(flayer, inpdata->inpstringlen, INPUTLINE, inpdata->inpstringlen + inpdata->inp.len - 1, INPUTLINE, 0, 0);
inpdata->inp = inphist; /* structure copy */
if (inpdata->inp.len > inpdata->inpmaxlen)
@@ -341,7 +341,7 @@ int *plen;
static void
InpAbort()
{
- LAY_CALL_UP(RedisplayLine(INPUTLINE, 0, flayer->l_width - 1, 0));
+ LAY_CALL_UP(LayRedisplayLine(INPUTLINE, 0, flayer->l_width - 1, 0));
ExitOverlayPage();
}
@@ -355,7 +355,7 @@ int y, xs, xe, isblank;
inpdata = (struct inpdata *)flayer->l_data;
if (y != INPUTLINE)
{
- LAY_CALL_UP(RedisplayLine(y, xs, xe, isblank));
+ LAY_CALL_UP(LayRedisplayLine(y, xs, xe, isblank));
return;
}
inpdata->inp.buf[inpdata->inp.len] = 0;
@@ -390,7 +390,7 @@ int y, xs, xe, isblank;
l = v;
if (l > r - q)
l = r - q;
- LClear(flayer, q, y, q + l - 1, y, 0);
+ LClearArea(flayer, q, y, q + l - 1, y, 0, 0);
q += l;
}
}
diff --git a/layer.c b/layer.c
index dfd40a8..5bd37aa 100644
--- a/layer.c
+++ b/layer.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -34,10 +34,8 @@ RCS_ID("$Id: search.c,v 1.2 1994/05/31 12:32:57 mlschroe Exp $ FAU")
extern struct display *display, *displays;
-extern struct mline mline_blank;
-extern struct mline mline_null;
-extern struct mchar mchar_null;
-extern struct mchar mchar_blank;
+extern struct mline mline_blank, mline_null;
+extern struct mchar mchar_blank, mchar_null;
extern struct layer *flayer; /* sigh */
extern struct LayFuncs WinLf;
@@ -71,10 +69,22 @@ int 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
+
+
void
LGotoPos(l, x, y)
struct layer *l;
@@ -117,9 +127,10 @@ int x, y;
}
void
-LScrollH(l, n, y, xs, xe, ol)
+LScrollH(l, n, y, xs, xe, bce, ol)
struct layer *l;
int n, y, xs, xe;
+int bce;
struct mline *ol;
{
struct canvas *cv;
@@ -143,7 +154,7 @@ struct mline *ol;
if (xs2 > xe2)
continue;
display = cv->c_display;
- ScrollH(y2, xs2, xe2, n, ol ? mloff(ol, -vp->v_xoff) : 0);
+ ScrollH(y2, xs2, xe2, n, bce, ol ? mloff(ol, -vp->v_xoff) : 0);
if (xe2 - xs2 == xe - xs)
continue;
if (n > 0)
@@ -166,10 +177,11 @@ struct mline *ol;
}
void
-LScrollV(l, n, ys, ye)
+LScrollV(l, n, ys, ye, bce)
struct layer *l;
int n;
int ys, ye;
+int bce;
{
struct canvas *cv;
struct viewport *vp;
@@ -195,9 +207,9 @@ int ys, ye;
continue;
display = cv->c_display;
#if 0
- ScrollV(xs2, ys2, xe2, ye2, n);
+ ScrollV(xs2, ys2, xe2, ye2, n, bce);
#else
- ScrollV(vp->v_xs, ys2, vp->v_xe, ye2, n);
+ ScrollV(vp->v_xs, ys2, vp->v_xe, ye2, n, bce);
#endif
debug2("LScrollV: %d %d", ys, ye);
debug2(" -> %d %d\n", ys2, ye2);
@@ -235,6 +247,7 @@ struct mline *ol;
struct viewport *vp;
int xs2, xe2, y2, f;
struct mchar *c2, cc;
+ struct mline *rol;
for (cv = l->l_cvlist; cv; cv = cv->c_lnext)
for (vp = cv->c_vplist; vp; vp = vp->v_next)
@@ -268,7 +281,8 @@ struct mline *ol;
if (xs2 > xe2)
continue;
display = cv->c_display;
- InsChar(c2, xs2, xe2, y2, mloff(ol, -vp->v_xoff));
+ rol = RECODE_MLINE(ol);
+ InsChar(RECODE_MCHAR(c2), xs2, xe2, y2, mloff(rol, -vp->v_xoff));
if (f)
RefreshArea(xs2, y2, xs2, y2, 1);
}
@@ -291,25 +305,82 @@ int x, y;
}
#endif
for (cv = l->l_cvlist; cv; cv = cv->c_lnext)
+ {
+ display = cv->c_display;
+ for (vp = cv->c_vplist; vp; vp = vp->v_next)
+ {
+ y2 = y + vp->v_yoff;
+ if (y2 < vp->v_ys || y2 > vp->v_ye)
+ continue;
+ x2 = x + vp->v_xoff;
+ if (x2 < vp->v_xs || x2 > vp->v_xe)
+ continue;
+ PutChar(RECODE_MCHAR(c), x2, y2);
+ break;
+ }
+ }
+}
+
+void
+LPutStr(l, s, n, r, x, y)
+struct layer *l;
+char *s;
+int n;
+struct mchar *r;
+int x, y;
+{
+ struct canvas *cv;
+ struct viewport *vp;
+ char *s2;
+ int xs2, xe2, y2;
+
+ if (x + n > l->l_width)
+ n = l->l_width - x;
+#ifdef HAVE_BRAILLE
+ if (bd.bd_refreshing)
+ {
+ BPutStr(l, s, n, r, x, y);
+ return;
+ }
+#endif
+ for (cv = l->l_cvlist; cv; cv = cv->c_lnext)
for (vp = cv->c_vplist; vp; vp = vp->v_next)
{
y2 = y + vp->v_yoff;
if (y2 < vp->v_ys || y2 > vp->v_ye)
continue;
- x2 = x + vp->v_xoff;
- if (x2 < vp->v_xs || x2 > vp->v_xe)
+ xs2 = x + vp->v_xoff;
+ xe2 = xs2 + n - 1;
+ if (xs2 < vp->v_xs)
+ xs2 = vp->v_xs;
+ if (xe2 > vp->v_xe)
+ xe2 = vp->v_xe;
+ if (xs2 > xe2)
continue;
display = cv->c_display;
- GotoPos(x2, y2);
- SetRendition(c);
- PUTCHARLP(c->image);
- if (D_AM && !D_CLP && x2 == D_width - 1)
- GotoPos(x2, y2);
+ GotoPos(xs2, y2);
+ SetRendition(r);
+ s2 = s + xs2 - x - vp->v_xoff;
+#ifdef UTF8
+ if (D_encoding == UTF8 && l->l_encoding != UTF8 && (r->font || l->l_encoding))
+ {
+ struct mchar mc;
+ mc = *r;
+ while (xs2 <= xe2)
+ {
+ mc.image = *s2++;
+ PutChar(RECODE_MCHAR(&mc), xs2++, y2);
+ }
+ continue;
+ }
+#endif
+ while (xs2++ <= xe2)
+ PUTCHARLP(*s2++);
}
}
void
-LPutStr(l, s, n, r, x, y)
+LPutWinMsg(l, s, n, r, x, y)
struct layer *l;
char *s;
int n;
@@ -319,7 +390,8 @@ int x, y;
struct canvas *cv;
struct viewport *vp;
char *s2;
- int xs2, xe2, y2;
+ int xs2, xe2, y2, len, len2;
+ struct mchar or;
if (x + n > l->l_width)
n = l->l_width - x;
@@ -330,6 +402,9 @@ int x, y;
return;
}
#endif
+ len = strlen(s);
+ if (len > n)
+ len = n;
for (cv = l->l_cvlist; cv; cv = cv->c_lnext)
for (vp = cv->c_vplist; vp; vp = vp->v_next)
{
@@ -347,16 +422,34 @@ int x, y;
display = cv->c_display;
GotoPos(xs2, y2);
SetRendition(r);
- s2 = s + xs2 - x - vp->v_xoff;
+ len2 = xe2 - (x + vp->v_xoff) + 1;
+ if (len2 > len)
+ len2 = len;
+ if (!PutWinMsg(s, xs2 - x - vp->v_xoff, len2))
+ {
+ s2 = s + xs2 - x - vp->v_xoff;
+ while (len2-- > 0)
+ {
+ PUTCHARLP(*s2++);
+ xs2++;
+ }
+ }
+ else
+ xs2 = x + vp->v_xoff + len2;
+ if (xs2 < vp->v_xs)
+ xs2 = vp->v_xs;
+ or = D_rend;
+ GotoPos(xs2, y2);
+ SetRendition(&or);
while (xs2++ <= xe2)
- PUTCHARLP(*s2++);
+ PUTCHARLP(' ');
}
}
void
-LClearLine(l, y, xs, xe, ol)
+LClearLine(l, y, xs, xe, bce, ol)
struct layer *l;
-int xs, xe;
+int xs, xe, bce;
struct mline *ol;
{
struct canvas *cv;
@@ -383,14 +476,15 @@ struct mline *ol;
if (xs2 > xe2)
continue;
display = cv->c_display;
- DisplayLine(ol ? mloff(ol, -vp->v_xoff) : &mline_null, &mline_blank, y2, xs2, xe2);
+ ClearLine(ol ? mloff(RECODE_MLINE(ol), -vp->v_xoff) : (struct mline *)0, y2, xs2, xe2, bce);
}
}
void
-LClear(l, xs, ys, xe, ye, uself)
+LClearArea(l, xs, ys, xe, ye, bce, uself)
struct layer *l;
int xs, ys, xe, ye;
+int bce;
int uself;
{
struct canvas *cv;
@@ -440,14 +534,14 @@ int uself;
if (ye2 != ye + vp->v_yoff)
xe2 = xce;
display = cv->c_display;
- Clear(xs2, ys2, xcs, xce, xe2, ye2, uself);
+ ClearArea(xs2, ys2, xcs, xce, xe2, ye2, bce, uself);
#else
if (xs == 0 || ys2 != ys + vp->v_yoff)
xs2 = vp->v_xs;
if (xe == l->l_width - 1 || ye2 != ye + vp->v_yoff)
xe2 = vp->v_xe;
display = cv->c_display;
- Clear(xs2, ys2, vp->v_xs, vp->v_xe, xe2, ye2, uself);
+ ClearArea(xs2, ys2, vp->v_xs, vp->v_xe, xe2, ye2, bce, uself);
#endif
}
}
@@ -486,11 +580,33 @@ int isblank;
display = cv->c_display;
debug3("LCDisplayLine: DisplayLine %d, %d-%d", y2, xs2, xe2);
debug1(" mloff = %d\n", -vp->v_xoff);
- DisplayLine(isblank ? &mline_blank : &mline_null, mloff(ml, -vp->v_xoff), y2, xs2, xe2);
+ DisplayLine(isblank ? &mline_blank : &mline_null, mloff(RECODE_MLINE(ml), -vp->v_xoff), y2, xs2, xe2);
}
}
void
+LCDisplayLineWrap(l, ml, y, from, to, isblank)
+struct layer *l;
+struct mline *ml;
+int y, from, to;
+int isblank;
+{
+ 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)
+ LCDisplayLine(l, ml, y, from, to, isblank);
+}
+
+void
LSetRendition(l, r)
struct layer *l;
struct mchar *r;
@@ -516,7 +632,13 @@ int ins;
struct canvas *cv, *cvlist, *cvlnext;
struct viewport *vp, *evp, **vpp;
int yy, y2, yy2, top2, bot2;
+ int bce;
+#ifdef COLOR
+ bce = rend_getbg(c);
+#else
+ bce = 0;
+#endif
if (y != bot)
{
/* simple case: no scrolling */
@@ -526,6 +648,7 @@ int ins;
for (cv = l->l_cvlist; cv; cv = cv->c_lnext)
{
+ y2 = 0; /* gcc -Wall */
display = cv->c_display;
/* find the viewport of the wrapped character */
for (vp = cv->c_vplist; vp; vp = vp->v_next)
@@ -557,7 +680,9 @@ int ins;
cv->c_lnext = cvlnext;
}
else
- WrapChar(c, vp->v_xoff + l->l_width, y2, vp->v_xoff, -1, vp->v_xoff + l->l_width - 1, -1, ins);
+ {
+ WrapChar(RECODE_MCHAR(c), vp->v_xoff + l->l_width, y2, vp->v_xoff, -1, vp->v_xoff + l->l_width - 1, -1, ins);
+ }
}
}
else
@@ -588,7 +713,7 @@ int ins;
cvlnext = cv->c_lnext;
l->l_cvlist = cv;
cv->c_lnext = 0;
- LScrollV(l, 1, top, bot);
+ LScrollV(l, 1, top, bot, bce);
if (!vp)
{
if (ins)
@@ -607,7 +732,7 @@ int ins;
bot2 = bot + vp->v_yoff;
if (top2 < vp->v_ys)
top2 = vp->v_ys;
- WrapChar(c, vp->v_xoff + l->l_width, bot2, vp->v_xoff, top2, vp->v_xoff + l->l_width - 1, bot2, ins);
+ WrapChar(RECODE_MCHAR(c), vp->v_xoff + l->l_width, bot2, vp->v_xoff, top2, vp->v_xoff + l->l_width - 1, bot2, ins);
}
}
}
@@ -674,34 +799,49 @@ int on;
}
}
+void
+LMouseMode(l, on)
+struct layer *l;
+int on;
+{
+ struct canvas *cv;
+ for (cv = l->l_cvlist; cv; cv = cv->c_lnext)
+ {
+ display = cv->c_display;
+ if (cv != D_forecv)
+ continue;
+ MouseMode(on);
+ }
+}
+
/*******************************************************************/
void
-ClearLayer(l, uself)
+LClearAll(l, uself)
struct layer *l;
int uself;
{
- LClear(l, 0, 0, l->l_width - 1, l->l_height - 1, uself);
+ LClearArea(l, 0, 0, l->l_width - 1, l->l_height - 1, 0, uself);
}
void
-RedisplayLayer(l, isblank)
+LRefreshAll(l, isblank)
struct layer *l;
int isblank;
{
struct layer *oldflayer;
int y;
- debug1("RedisplayLayer isblank=%d\n", isblank);
+ debug1("LRefreshAll isblank=%d\n", isblank);
oldflayer = flayer;
flayer = l;
if (!isblank)
- LClear(l, 0, 0, l->l_width - 1, l->l_height - 1, 0);
+ LClearArea(l, 0, 0, l->l_width - 1, l->l_height - 1, 0, 0);
/* signal full refresh */
- RedisplayLine(-1, -1, -1, 1);
+ LayRedisplayLine(-1, -1, -1, 1);
for (y = 0; y < l->l_height; y++)
- RedisplayLine(y, 0, l->l_width - 1, 1);
+ LayRedisplayLine(y, 0, l->l_width - 1, 1);
flayer = oldflayer;
}
@@ -824,12 +964,13 @@ int block;
}
newlay->l_width = flayer->l_width;
newlay->l_height = flayer->l_height;
+ newlay->l_encoding = 0;
newlay->l_layfn = lf;
newlay->l_data = data;
newlay->l_next = flayer;
newlay->l_bottom = flayer->l_bottom;
flayer = newlay;
- Restore();
+ LayRestore();
return 0;
}
@@ -887,13 +1028,13 @@ ExitOverlayPage()
flayer->l_cvlist = oldlay->l_cvlist;
/* redisplay only the warped cvs */
if (doredisplay)
- RedisplayLayer(flayer, 0);
+ LRefreshAll(flayer, 0);
ocv->c_lnext = cv;
}
oldlay->l_cvlist = 0;
free((char *)oldlay);
- Restore();
- SetCursor();
+ LayRestore();
+ LaySetCursor();
}
void
diff --git a/layer.h b/layer.h
index 037fe24..d263644 100644
--- a/layer.h
+++ b/layer.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1995-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -31,13 +31,13 @@ struct mchar; /* forward declaration */
struct LayFuncs
{
- void (*LayProcess) __P((char **, int *));
- void (*LayAbort) __P((void));
- void (*LayRedisplayLine) __P((int, int, int, int));
- void (*LayClearLine) __P((int, int, int));
- int (*LayRewrite) __P((int, int, int, struct mchar *, int));
- int (*LayResize) __P((int, int));
- void (*LayRestore) __P((void));
+ void (*lf_LayProcess) __P((char **, int *));
+ void (*lf_LayAbort) __P((void));
+ void (*lf_LayRedisplayLine) __P((int, int, int, int));
+ void (*lf_LayClearLine) __P((int, int, int, int));
+ int (*lf_LayRewrite) __P((int, int, int, struct mchar *, int));
+ int (*lf_LayResize) __P((int, int));
+ void (*lf_LayRestore) __P((void));
};
struct layer
@@ -47,6 +47,7 @@ struct layer
int l_height;
int l_x; /* cursor position */
int l_y;
+ int l_encoding;
struct LayFuncs *l_layfn;
char *l_data;
@@ -55,16 +56,16 @@ struct layer
int l_blocking;
};
-#define Process (*flayer->l_layfn->LayProcess)
-#define Abort (*flayer->l_layfn->LayAbort)
-#define RedisplayLine (*flayer->l_layfn->LayRedisplayLine)
-#define ClearLine (*flayer->l_layfn->LayClearLine)
-#define Rewrite (*flayer->l_layfn->LayRewrite)
-#define Resize (*flayer->l_layfn->LayResize)
-#define Restore (*flayer->l_layfn->LayRestore)
+#define LayProcess (*flayer->l_layfn->lf_LayProcess)
+#define LayAbort (*flayer->l_layfn->lf_LayAbort)
+#define LayRedisplayLine (*flayer->l_layfn->lf_LayRedisplayLine)
+#define LayClearLine (*flayer->l_layfn->lf_LayClearLine)
+#define LayRewrite (*flayer->l_layfn->lf_LayRewrite)
+#define LayResize (*flayer->l_layfn->lf_LayResize)
+#define LayRestore (*flayer->l_layfn->lf_LayRestore)
-#define SetCursor() LGotoPos(flayer, flayer->l_x, flayer->l_y)
-#define CanResize(l) (l->l_layfn->LayResize != DefResize)
+#define LaySetCursor() LGotoPos(flayer, flayer->l_x, flayer->l_y)
+#define LayCanResize(l) (l->l_layfn->LayResize != DefResize)
/* XXX: AArgh! think again! */
diff --git a/loadav.c b/loadav.c
index 82bf176..0417a7c 100644
--- a/loadav.c
+++ b/loadav.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -72,15 +72,42 @@ static int
GetLoadav()
{
FILE *fp;
- double d[3];
+ char buf[128], *s;
int i;
+ double d, e;
if ((fp = secfopen("/proc/loadavg", "r")) == NULL)
return 0;
- fscanf(fp, "%lf %lf %lf\n", d, d + 1, d + 2);
+ *buf = 0;
+ fgets(buf, sizeof(buf), fp);
fclose(fp);
+ /* can't use fscanf because the decimal point symbol depends on
+ * the locale but the kernel uses always '.'.
+ */
+ s = buf;
for (i = 0; i < (LOADAV_NUM > 3 ? 3 : LOADAV_NUM); i++)
- loadav[i] = d[i];
+ {
+ d = e = 0;
+ while(*s == ' ')
+ s++;
+ if (*s == 0)
+ break;
+ for(;;)
+ {
+ if (*s == '.')
+ e = 1;
+ else if (*s >= '0' && *s <= '9')
+ {
+ d = d * 10 + (*s - '0');
+ if (e)
+ e *= 10;
+ }
+ else
+ break;
+ s++;
+ }
+ loadav[i] = e ? d / e : d;
+ }
return i;
}
#endif /* linux */
@@ -250,10 +277,8 @@ GetLoadav()
extern int nlist __P((char *, struct nlist *));
# endif
-#ifdef __sgi
-# if _MIPS_SZLONG == 64 || (defined(_MIPS_ISA) && _MIPS_ISA > 2)
-# define nlist nlist64
-# endif
+#ifdef LOADAV_USE_NLIST64
+# define nlist nlist64
#endif
static struct nlist nl[2];
diff --git a/logfile.c b/logfile.c
index ed9842f..f1d23ff 100644
--- a/logfile.c
+++ b/logfile.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -29,30 +29,9 @@ RCS_ID("$Id: logfile.c,v 1.4 1994/05/31 12:32:12 jnweiger Exp $ FAU")
#include <fcntl.h> /* O_WRONLY for logfile_reopen */
-#if 1
#include "config.h"
#include "screen.h"
#include "extern.h"
-#define strdup SaveStr
-#else
-extern void *malloc();
-extern void free();
-extern int fwrite();
-extern int fflush();
-extern void fclose();
-extern char *strdup();
-# define debug(a)
-# define debug1(a)
-# define debug2(a)
-# ifndef __P
-# if defined(__STDC__)
-# define __P(a) a
-# else
-# define __P(a) ()
-# endif
-# endif
-#endif
-
#include "logfile.h"
static void changed_logfile __P((struct logfile *));
@@ -217,7 +196,7 @@ FILE *fp;
return NULL;
}
- if (!(l->name = strdup(name)))
+ if (!(l->name = SaveStr(name)))
{
free((char *)l->st);
free((char *)l);
diff --git a/logfile.h b/logfile.h
index 77ec431..0d1ac40 100644
--- a/logfile.h
+++ b/logfile.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
diff --git a/mark.c b/mark.c
index 3bf21f4..6305f26 100644
--- a/mark.c
+++ b/mark.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -59,7 +59,6 @@ static int MarkRewrite __P((int, int, int, struct mchar *, int));
extern struct layer *flayer;
extern struct display *display, *displays;
extern struct win *fore;
-extern char *null, *blank;
extern struct mline mline_blank, mline_null;
extern struct mchar mchar_so;
@@ -113,7 +112,7 @@ linestart(y)
int y;
{
register int x;
- register char *i;
+ register unsigned char *i;
for (x = markdata->left_mar, i = WIN(y)->image + x; x < fore->w_width - 1; x++)
if (*i++ != ' ')
@@ -128,7 +127,7 @@ lineend(y)
int y;
{
register int x;
- register char *i;
+ register unsigned char *i;
for (x = markdata->right_mar, i = WIN(y)->image + x; x >= 0; x--)
if (*i-- != ' ')
@@ -218,11 +217,11 @@ char *pt;
{
int i, j, from, to, ry, c;
int l = 0;
- char *im;
+ unsigned char *im;
struct mline *ml;
#ifdef FONT
int cf, font;
- char *fo;
+ unsigned char *fo;
#endif
markdata->second = 0;
@@ -263,8 +262,8 @@ char *pt;
if (redisplay != 2 && pt == 0) /* don't count/copy */
continue;
j = from;
-#ifdef KANJI
- if (badkanji(ml->font, j))
+#ifdef DW_CHARS
+ if (dw_right(ml, j, fore->w_encoding))
j--;
#endif
im = ml->image + j;
@@ -274,86 +273,37 @@ char *pt;
#endif
for (; j <= to; j++)
{
- c = *im++;
+ c = (unsigned char)*im++;
#ifdef FONT
- cf = *fo++;
-# ifdef KANJI
- if (cf == KANJI)
+ cf = (unsigned char)*fo++;
+# ifdef UTF8
+ if (fore->w_encoding == UTF8)
{
- int t;
- t = *im++;
- fo++;
- j++;
- if (pastefont)
- {
- if (fore->w_kanji == EUC)
- {
- c |= 0x80;
- t |= 0x80;
- }
- else if (fore->w_kanji == SJIS)
- {
- t += (c & 1) ? ((t <= 0x5f) ? 0x1f : 0x20) : 0x7e;
- c = (c - 0x21) / 2 + ((c < 0x5f) ? 0x81 : 0xc1);
- }
- else
- {
- if (pt)
- {
- strcpy(pt, "\033$B");
- pt += 3;
- }
- l += 3;
- font = KANJI;
- }
- }
+ c |= cf << 8;
+ if (c == UCS_HIDDEN)
+ continue;
+ c = ToUtf8(pt, c);
+ l += c;
if (pt)
- *pt++ = c;
- l++;
- c = t;
+ pt += c;
+ continue;
}
- else
-# endif /* KANJI */
+# endif
+# ifdef DW_CHARS
+ if (is_dw_font(cf))
+ {
+ c = c << 8 | (unsigned char)*im++;
+ j++;
+ fo++;
+ }
+# endif
if (pastefont)
{
-# ifdef KANJI
- if (cf == KANA)
- {
- if (fore->w_kanji == EUC)
- {
- if (pt)
- *pt++ = 0x8e;
- l++;
- c |= 0x80;
- }
- else if (fore->w_kanji == SJIS)
- c |= 0x80;
- else if (font != KANA)
- {
- if (pt)
- {
- strcpy(pt, "\033(I");
- pt += 3;
- }
- l += 3;
- font = KANA;
- }
- }
- else
-#endif /* KANJI */
- {
- if (cf != font)
- {
- if (pt)
- {
- strcpy(pt, "\033(");
- pt[2] = (cf == ASCII) ? 'B' : cf;
- pt += 3;
- }
- l += 3;
- font = cf;
- }
- }
+ c = EncodeChar(pt, c | cf << 16, fore->w_encoding, &font);
+ l += c;
+ if (pt)
+ pt += c;
+ continue;
}
#endif /* FONT */
if (pt)
@@ -428,10 +378,10 @@ int a, b;
/**********************************************************************/
int
-GetHistory() /* return value 1 if u_copybuffer changed */
+GetHistory() /* return value 1 if copybuffer changed */
{
int i = 0, q = 0, xx, yy, x, y;
- char *linep;
+ unsigned char *linep;
struct mline *ml;
ASSERT(display && fore);
@@ -460,15 +410,18 @@ GetHistory() /* return value 1 if u_copybuffer changed */
}
if (yy < 0)
return 0;
- if (D_user->u_copybuffer != NULL)
+ if (D_user->u_plop.buf)
UserFreeCopyBuffer(D_user);
- if ((D_user->u_copybuffer = malloc((unsigned) (i - x + 2))) == NULL)
+ if ((D_user->u_plop.buf = (char *)malloc((unsigned) (i - x + 2))) == NULL)
{
LMsg(0, "Not enough memory... Sorry.");
return 0;
}
- bcopy(linep - i + x + 1, D_user->u_copybuffer, i - x + 1);
- D_user->u_copylen = i - x + 1;
+ 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;
}
@@ -487,6 +440,7 @@ MarkRoutine()
if (InitOverlayPage(sizeof(*markdata), &MarkLf, 1))
return;
+ flayer->l_encoding = fore->w_encoding;
markdata = (struct markdata *)flayer->l_data;
markdata->md_user = D_user; /* XXX: Correct? */
markdata->md_window = fore;
@@ -523,7 +477,7 @@ int *inlenp;
int newcopylen = 0, od;
int in_mark;
int rep_cnt;
- struct user *md_user;
+ struct acluser *md_user;
/*
char *extrap = 0, extrabuf[100];
@@ -898,7 +852,7 @@ int *inlenp;
x2 = cx;
y2 = cy;
newcopylen = rem(markdata->x1, markdata->y1, x2, y2, 2, (char *)0, 0); /* count */
- if (md_user->u_copybuffer != NULL && !append_mode)
+ if (md_user->u_plop.buf && !append_mode)
UserFreeCopyBuffer(md_user);
yend = fore->w_height - 1;
if (fore->w_histheight - markdata->hist_offset < fore->w_height)
@@ -909,21 +863,21 @@ int *inlenp;
if (newcopylen > 0)
{
/* the +3 below is for : cr + lf + \0 */
- if (md_user->u_copybuffer != NULL)
- md_user->u_copybuffer = realloc(md_user->u_copybuffer,
- (unsigned) (md_user->u_copylen + newcopylen + 3));
+ if (md_user->u_plop.buf)
+ md_user->u_plop.buf = realloc(md_user->u_plop.buf,
+ (unsigned) (md_user->u_plop.len + newcopylen + 3));
else
{
- md_user->u_copylen = 0;
- md_user->u_copybuffer = malloc((unsigned) (newcopylen + 3));
+ md_user->u_plop.len = 0;
+ md_user->u_plop.buf = malloc((unsigned) (newcopylen + 3));
}
- if (md_user->u_copybuffer == NULL)
+ if (!md_user->u_plop.buf)
{
MarkAbort();
in_mark = 0;
LMsg(0, "Not enough memory... Sorry.");
- md_user->u_copylen = 0;
- md_user->u_copybuffer = NULL;
+ md_user->u_plop.len = 0;
+ md_user->u_plop.buf = 0;
break;
}
if (append_mode)
@@ -936,40 +890,43 @@ int *inlenp;
case 0:
if (join_with_cr)
{
- md_user->u_copybuffer[md_user->u_copylen] = '\r';
- md_user->u_copylen++;
+ md_user->u_plop.buf[md_user->u_plop.len] = '\r';
+ md_user->u_plop.len++;
}
- md_user->u_copybuffer[md_user->u_copylen] = '\n';
- md_user->u_copylen++;
+ md_user->u_plop.buf[md_user->u_plop.len] = '\n';
+ md_user->u_plop.len++;
break;
case 1:
break;
case 2:
- md_user->u_copybuffer[md_user->u_copylen] = ' ';
- md_user->u_copylen++;
+ md_user->u_plop.buf[md_user->u_plop.len] = ' ';
+ md_user->u_plop.len++;
break;
case 3:
- md_user->u_copybuffer[md_user->u_copylen] = ',';
- md_user->u_copylen++;
+ md_user->u_plop.buf[md_user->u_plop.len] = ',';
+ md_user->u_plop.len++;
break;
}
}
- md_user->u_copylen += rem(markdata->x1, markdata->y1, x2, y2,
+ md_user->u_plop.len += rem(markdata->x1, markdata->y1, x2, y2,
markdata->hist_offset == fore->w_histheight,
- md_user->u_copybuffer + md_user->u_copylen, yend);
+ 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)
{
- LAY_CALL_UP(RedisplayLayer(flayer, 0));
+ LAY_CALL_UP(LRefreshAll(flayer, 0));
}
ExitOverlayPage();
if (append_mode)
LMsg(0, "Appended %d characters to buffer",
newcopylen);
else
- LMsg(0, "Copied %d characters into buffer", md_user->u_copylen);
+ LMsg(0, "Copied %d characters into buffer", md_user->u_plop.len);
if (write_buffer)
- WriteFile(DUMP_EXCHANGE);
+ WriteFile(md_user, (char *)0, DUMP_EXCHANGE);
in_mark = 0;
break;
}
@@ -1005,7 +962,7 @@ int tx, ty, line;
int x, y, t, revst, reven, qq, ff, tt, st, en, ce = 0;
int ystart = 0, yend = fore->w_height-1;
int i, ry;
- char *wi;
+ unsigned char *wi;
struct mline *ml;
struct mchar mc;
@@ -1020,12 +977,12 @@ int tx, ty, line;
fx = markdata->cx; fy = markdata->cy;
-#ifdef KANJI
+#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 && badkanji(ml->font, tx) && tx < D_width - 1)
+ if (ty == fy && fx + 1 == tx && dw_right(ml, tx, fore->w_encoding) && tx < D_width - 1)
tx++;
- if (ty == fy && fx - 1 == tx && badkanji(ml->font, fx) && tx)
+ if (ty == fy && fx - 1 == tx && dw_right(ml, fx, fore->w_encoding) && tx)
tx--;
#endif
@@ -1110,18 +1067,16 @@ int tx, ty, line;
}
if (x <= ce && x >= markdata->left_mar && x <= markdata->right_mar)
{
-#ifdef KANJI
- if (badkanji(ml->font, x))
+#ifdef DW_CHARS
+ if (dw_right(ml, x, fore->w_encoding))
{
+ if (t == revst)
+ revst--;
t--;
x--;
}
#endif
-#ifdef KANJI
- if (t >= revst - (ml->font[x] == KANJI) && t <= reven)
-#else
if (t >= revst && t <= reven)
-#endif
{
mc = mchar_so;
#ifdef FONT
@@ -1132,16 +1087,19 @@ int tx, ty, line;
}
else
copy_mline2mchar(&mc, ml, x);
- LPutChar(flayer, &mc, x, W2D(y));
-#ifdef KANJI
- if (ml->font[x] == KANJI)
+#ifdef DW_CHARS
+ if (dw_left(ml, x, fore->w_encoding))
{
- x++;
- mc.image = ml->image[x];
+ 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
}
}
LGotoPos(flayer, tx, W2D(ty));
@@ -1164,7 +1122,7 @@ MarkAbort()
}
if (markdata->hist_offset != fore->w_histheight)
{
- LAY_CALL_UP(RedisplayLayer(flayer, 0));
+ LAY_CALL_UP(LRefreshAll(flayer, 0));
}
else
{
@@ -1182,7 +1140,7 @@ int isblank;
{
int wy, x, i, rm;
int sta, sto, cp; /* NOTE: these 3 are in WINDOW coords system */
- char *wi;
+ unsigned char *wi;
struct mline *ml;
struct mchar mchar_marked;
@@ -1200,13 +1158,9 @@ int isblank;
if (markdata->second == 0)
{
if (xs == 0 && y > 0 && wy > 0 && WIN(wy - 1)->image[flayer->l_width] == 0)
- {
- struct mchar nc;
- copy_mline2mchar(&nc, ml, 0);
- LWrapChar(flayer, &nc, y - 1, -1, -1, 0);
- xs++;
- }
- LCDisplayLine(flayer, ml, y, xs, xe, isblank);
+ LCDisplayLineWrap(flayer, ml, y, xs, xe, isblank);
+ else
+ LCDisplayLine(flayer, ml, y, xs, xe, isblank);
return;
}
@@ -1228,8 +1182,8 @@ int isblank;
for (x = xs; x <= xe; x++, cp++)
if (cp >= sta && x >= markdata->left_mar)
break;
-#ifdef KANJI
- if (badkanji(ml->font, x))
+#ifdef DW_CHARS
+ if (dw_right(ml, x, fore->w_encoding))
x--;
#endif
if (x > xs)
@@ -1243,16 +1197,19 @@ int isblank;
mchar_marked.font = ml->font[x];
#endif
mchar_marked.image = ml->image[x];
- LPutChar(flayer, &mchar_marked, x, y);
-#ifdef KANJI
- if (ml->font[x] == KANJI)
+#ifdef DW_CHARS
+ mchar_marked.mbcs = 0;
+ if (dw_left(ml, x, fore->w_encoding))
{
- x++;
- mchar_marked.image = ml->image[x];
- LPutChar(flayer, &mchar_marked, x, y);
+ 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);
@@ -1268,7 +1225,7 @@ int ry, xs, xe, doit;
struct mchar *rend;
{
int dx, x, y, st, en, t, rm;
- char *i;
+ unsigned char *i;
struct mline *ml;
struct mchar mchar_marked;
@@ -1279,6 +1236,10 @@ struct mchar *rend;
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)
{
@@ -1345,7 +1306,7 @@ int n;
n = fore->w_histheight - markdata->hist_offset;
markdata->hist_offset += n;
i = (n < flayer->l_height) ? n : (flayer->l_height);
- LScrollV(flayer, i, 0, flayer->l_height - 1);
+ LScrollV(flayer, i, 0, flayer->l_height - 1, 0);
while (i-- > 0)
MarkRedisplayLine(flayer->l_height - i - 1, 0, flayer->l_width - 1, 1);
return n;
@@ -1364,7 +1325,7 @@ int n;
n = markdata->hist_offset;
markdata->hist_offset -= n;
i = (n < flayer->l_height) ? n : (flayer->l_height);
- LScrollV(flayer, -i, 0, fore->w_height - 1);
+ LScrollV(flayer, -i, 0, fore->w_height - 1, 0);
while (i-- > 0)
MarkRedisplayLine(i, 0, flayer->l_width - 1, 1);
return n;
diff --git a/mark.h b/mark.h
index 4c3dd14..490e4a2 100644
--- a/mark.h
+++ b/mark.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -25,7 +25,7 @@
struct markdata
{
struct win *md_window;/* pointer to window we are working on */
- struct user *md_user; /* The user who brought us up */
+ struct acluser *md_user; /* The user who brought us up */
int cx, cy; /* cursor Position in WIN coords*/
int x1, y1; /* first mark in WIN coords */
int second; /* first mark dropped flag */
diff --git a/misc.c b/misc.c
index 7fdef8e..1484aee 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -170,7 +170,12 @@ char *nam;
*/
#ifdef POSIX
-sigret_t (*xsignal(sig, func)) __P(SIGPROTOARG)
+sigret_t (*xsignal(sig, func))
+# ifndef __APPLE__
+ __P(SIGPROTOARG)
+# else
+()
+# endif
int sig;
sigret_t (*func) __P(SIGPROTOARG);
{
diff --git a/nethack.c b/nethack.c
index 904cc2d..bbefc15 100644
--- a/nethack.c
+++ b/nethack.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -37,7 +37,7 @@ struct nlstrans {
};
#ifdef NETHACK
-struct nlstrans nethacktrans[] = {
+static struct nlstrans nethacktrans[] = {
{"Cannot lock terminal - fork failed",
"Cannot fork terminal - lock failed"},
{"Got only %d bytes from %s",
diff --git a/os.h b/os.h
index 0d2f1fd..7cb1352 100644
--- a/os.h
+++ b/os.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -25,11 +25,6 @@
#include <stdio.h>
#include <errno.h>
-#ifdef __hpux
-/* workaround for HPUX-11 which manages to include sys/user.h! */
-# define _SYS_USER_INCLUDED
-#endif
-
#include <sys/param.h>
/* In strict ANSI mode, HP-UX machines define __hpux but not hpux */
@@ -37,9 +32,9 @@
# define hpux
#endif
-#if defined(__bsdi__) || defined(__386BSD__) || defined(_CX_UX) || defined(hpux) || defined(_IBMR2)
+#if defined(__bsdi__) || defined(__386BSD__) || defined(_CX_UX) || defined(hpux) || defined(_IBMR2) || defined(linux)
# include <signal.h>
-#endif /* __bsdi__ || __386BSD__ || _CX_UX || hpux || _IBMR2 */
+#endif /* __bsdi__ || __386BSD__ || _CX_UX || hpux || _IBMR2 || linux */
#ifdef ISC
# ifdef ENAMETOOLONG
@@ -75,16 +70,13 @@ extern int errno;
#undef strerror
#endif
-#ifndef SYSV
+#if !defined(SYSV) && !defined(linux)
# ifdef NEWSOS
# define strlen ___strlen___
# include <strings.h>
# undef strlen
# else /* NEWSOS */
# include <strings.h>
-# if defined(__GLIBC__) && (__GLIBC__ >= 2)
-# include <string.h>
-# endif
# endif /* NEWSOS */
#else /* SYSV */
# if defined(SVR4) || defined(NEWSOS)
@@ -186,6 +178,11 @@ extern int errno;
#ifdef BUILTIN_TELNET
# include <netinet/in.h>
+# include <arpa/inet.h>
+#endif
+
+#if defined(USE_LOCALE) && (!defined(HAVE_SETLOCALE) || !defined(HAVE_STRFTIME))
+# undef USE_LOCALE
#endif
/*****************************************************************
diff --git a/osdef.h.in b/osdef.h.in
index af82f8b..8c6ed0d 100644
--- a/osdef.h.in
+++ b/osdef.h.in
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2000
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -195,3 +195,7 @@ extern int fstat __P((int, struct stat *));
extern int fchmod __P((int, int));
extern int fchown __P((int, int, int));
+#if defined(LOADAV) && defined(LOADAV_GETLOADAVG)
+extern int getloadavg(double *, int);
+#endif
+
diff --git a/osdef.sh b/osdef.sh
index d92ade1..b281175 100644
--- a/osdef.sh
+++ b/osdef.sh
@@ -1,7 +1,7 @@
#! /bin/sh
-if test -z "$CC"; then
- CC=cc
+if test -z "$CPP"; then
+ CPP="cc -E"
fi
if test -z "$srcdir"; then
srcdir=.
@@ -50,7 +50,7 @@ cat << EOF > osdef2.sed
1i\\
*/
EOF
-$CC -I. -I$srcdir -E osdef0.c | sed -n -f osdef1.sed >> osdef2.sed
+$CPP -I. -I$srcdir osdef0.c | sed -n -f osdef1.sed >> osdef2.sed
sed -f osdef2.sed < $srcdir/osdef.h.in > osdef.h
rm osdef0.c osdef1.sed osdef2.sed
@@ -62,7 +62,7 @@ if test -f core*; then
echo " retry 'make' now and only remove offending lines from osdef.h later."
exit 1
fi
-if eval test "`diff osdef.h osdef.h.in | wc -l`" -eq 4; then
+if eval test "`diff osdef.h $srcdir/osdef.h.in | wc -l`" -eq 4; then
echo " Hmm, sed is very pessimistic about your system header files."
echo " But it did not dump core -- strange! Let's continue carefully..."
echo " If this fails, you may want to remove offending lines from osdef.h"
diff --git a/patchlevel.h b/patchlevel.h
index 9b81154..0e81d20 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -124,7 +124,7 @@
* 22.07.93 -- 3.05.00 Fixed SVR4, some multiuser bugs, -- DISTRIBUTED
* 05.08.93 -- 3.05.01 ${srcdir} feature added. Shellprog bug fixed.
* Motorola reattach bug fixed. Writelock bug fixed.
- * Copybuffer moved into struct user. Configure.in
+ * Copybuffer moved into struct acluser. Configure.in
* uglified for Autoconf1.5. Paste may now have an
* argument. Interactive setenv. Right margin bug
* fixed. IRIX 5 patches. -- DISTRIBUTED
@@ -423,8 +423,9 @@
* SCO-5 Fixes (Brian L. Gentry).
* 25.11.98 -- 3.07.06 resize code now handles tabs correctly.
* -- DISTRIBUTED
- * -- 3.09.00 loads'o'bugs fixed, 3.8 merged with 3.7, new region
- * clip code. Many new features (see NEWS file).
+ * -- 3.09.00 loads'o'bugs fixed, 3.8 merged with 3.7.
+ * new region clip code.
+ * Many new features (see NEWS file).
* 3.08.99 -- 3.09.02 -- DISTRIBUTED
* 11.08.99 -- 3.09.04 small utmp fix, BSD chflags fix, tty mode fix
* -- DISTRIBUTED
@@ -434,11 +435,64 @@
* console grabbing with SRIOCSREDIR.
* linux utmp workaround added. Some KANJI bugs
* fixed. Stupid StuffKey() bug fixed.
+ * -- DISTRIBUTED
+ * 24.07.00 -- 3.09.06 kanji fixes. lock escape char fix.
+ * removed delayed message hack.
+ * resize command & focus subcomands by joze.
+ * fix for solaris' utmp_helper bug.
+ * linux tty handling fix.
+ * mousetracking, rxvt osc sequences.
+ * background color erase support.
+ * don't log user in after hangup.
+ * hstatus escape update bug fixed.
+ * 1.09.00 -- 3.09.08 -- DISTRIBUTED
+ * 25.05.01 -- 3.09.09 use $DESTDIR in Makefiles.
+ * renamed struct user to acluser to fix hpux
+ * problem for good. utf8 support. 16 color
+ * support. New -X option and escape sequence
+ * to send screen commands.
+ * New commands: attrcolor, defutf8, dinfo, utf8.
+ * Extended commands: width, height, readbuf,
+ * writebuf. Better nlist64 detection.
+ * New config.h option SOCKDIR_IS_LOCAL_TO_HOST.
+ * Don't call tputs with an empty string.
+ * New string escape %{ for attr/color changes.
+ * LRefreshAll bug fixed (0 instead of -1 as bce).
+ * New quote handling in Parse(). Workaround for
+ * some bad termcap/info entries added. Set BE
+ * for all xtermish emulators. Added '0x' and
+ * 'U+' prefix in digraph command. LOADAV_TYPE
+ * detection fixed.
+ * -- DISTRIBUTED
+ * 4.09.01 -- 3.09.10 '-R' security fix. Fixed array in MScrollV().
+ * -- DISTRIBUTED
+ * Reset charset after 'me'.
+ * 14.02.02 -- 3.09.11 Support for other encodings. Double width
+ * utf-8 chars. 'L' modifier for %D, %M, %w
+ * and %W. New %= (hfill), %H (hostname),
+ * %f (flags), %F (focus) escapes. New commands
+ * source, windowlist, deflog. Command key classes.
+ * New login state: always. Time format
+ * changeable. 256 color support.
+ * Updated digraph table. Ignorecase.
+ * Windowlist resizeable on blank window.
+ * Added encoding to paste buffers.
+ * Hpux loadtype detection fixed.
+ * Disabled im/ic warning. Fixed a bug that
+ * could cause window lockups in rare
+ * circumstances. Made hangup signal to the
+ * backend process detach all displays.
+ * New escapes %< %>, + and - flag for %w.
+ * Added eval command, added -h option to detach.
+ * Also set flayer when processing -X commands.
+ * use getpt() on linux systems. doc patches from
+ * Adam Lazur. tty flow/intr cleanup.
+ * -- DISTRIBUTED
*/
#define ORIGIN "FAU"
#define REV 3
#define VERS 9
-#define PATCHLEVEL 5
-#define DATE "1-Sep-99"
+#define PATCHLEVEL 11
+#define DATE "14-Feb-02"
#define STATE ""
diff --git a/process.c b/process.c
index 5ab2819..939a6af 100644
--- a/process.c
+++ b/process.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -52,7 +52,8 @@ extern struct comm comms[];
extern char *rc_name;
extern char *RcFileName, *home;
extern char *BellString, *ActivityString, *ShellProg, *ShellArgs[];
-extern char *hstatusstring, *captionstring;
+extern char *hstatusstring, *captionstring, *timestring;
+extern char *wliststr, *wlisttit;
extern int captionalways;
extern char *hardcopydir, *screenlogfile, *logtstamp_string;
extern int log_flush, logtstamp_on, logtstamp_after;
@@ -62,6 +63,10 @@ extern char SockPath[], *SockName;
extern int TtyMode, auto_detach;
extern int iflag;
extern int use_hardstatus, visual_bell;
+#ifdef COLOR
+extern int attr2color[];
+extern int nattr2color;
+#endif
extern int hardstatusemu;
extern char *printcmd;
extern int default_startup;
@@ -71,11 +76,12 @@ extern int ZombieKey_resurrect;
#ifdef AUTO_NUKE
extern int defautonuke;
#endif
-extern int intrc, origintrc; /* display? */
+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
@@ -86,7 +92,7 @@ extern char *BufferFile;
extern char *BufferFile, *PowDetachString;
#endif
#ifdef MULTIUSER
-extern struct user *EffectiveAclUser; /* acl.c */
+extern struct acluser *EffectiveAclUser; /* acl.c */
#endif
extern struct term term[]; /* terminal capabilities */
#ifdef MAPKEYS
@@ -97,6 +103,9 @@ extern char *kmapmdef[];
#endif
extern struct mchar mchar_so, mchar_null;
extern int VerboseCreate;
+#ifdef UTF8
+extern char *screenencodings;
+#endif
static int CheckArgNum __P((int, char **));
static void ClearAction __P((struct action *));
@@ -104,9 +113,8 @@ static int NextWindow __P((void));
static int PreviousWindow __P((void));
static int MoreWindows __P((void));
static void LogToggle __P((int));
-static void ShowTime __P((void));
static void ShowInfo __P((void));
-static void SwitchWindow __P((int));
+static void ShowDInfo __P((void));
static char **SaveArgs __P((char **));
static struct win *WindowByName __P((char *));
static int WindowByNumber __P((char *));
@@ -120,7 +128,7 @@ static void InputSelect __P((void));
static void InputSetenv __P((char *));
static void InputAKA __P((void));
#ifdef MULTIUSER
-static int InputSu __P((struct win *, struct user **, char *));
+static int InputSu __P((struct win *, struct acluser **, char *));
static void su_fin __P((char *, int, char *));
#endif
static void AKAfin __P((char *, int, char *));
@@ -142,12 +150,14 @@ static void confirm_fn __P((char *, int, char *));
static int StuffKey __P((int));
#endif
static int IsOnDisplay __P((struct win *));
+static void ResizeRegions __P((char*));
+static void ResizeFin __P((char *, int, char *));
extern struct layer *flayer;
extern struct display *display, *displays;
extern struct win *fore, *console_window, *windows;
-extern struct user *users;
+extern struct acluser *users;
extern char screenterm[], HostName[], version[];
extern struct NewWindow nwin_undef, nwin_default;
@@ -180,6 +190,12 @@ int hardcopy_append = 0;
int all_norefresh = 0;
struct action ktab[256]; /* command key translation table */
+struct kclass {
+ struct kclass *next;
+ char *name;
+ struct action ktab[256];
+};
+struct kclass *kclasses;
#ifdef MAPKEYS
struct action umtab[KMAP_KEYS+KMAP_AKEYS+KMAP_EXT];
@@ -192,33 +208,58 @@ int kmap_extras_fl[KMAP_EXT];
#endif
+/* digraph table taken from old vim and rfc1345 */
static const unsigned char digraphs[][3] = {
+ {' ', ' ', 160}, /*   */
+ {'N', 'S', 160}, /*   */
{'~', '!', 161}, /* ¡ */
{'!', '!', 161}, /* ¡ */
+ {'!', 'I', 161}, /* ¡ */
{'c', '|', 162}, /* ¢ */
+ {'c', 't', 162}, /* ¢ */
{'$', '$', 163}, /* £ */
+ {'P', 'd', 163}, /* £ */
{'o', 'x', 164}, /* ¤ */
+ {'C', 'u', 164}, /* ¤ */
+ {'C', 'u', 164}, /* ¤ */
+ {'E', 'u', 164}, /* ¤ */
{'Y', '-', 165}, /* ¥ */
+ {'Y', 'e', 165}, /* ¥ */
{'|', '|', 166}, /* ¦ */
+ {'B', 'B', 166}, /* ¦ */
{'p', 'a', 167}, /* § */
+ {'S', 'E', 167}, /* § */
{'"', '"', 168}, /* ¨ */
+ {'\'', ':', 168}, /* ¨ */
{'c', 'O', 169}, /* © */
+ {'C', 'o', 169}, /* © */
{'a', '-', 170}, /* ª */
{'<', '<', 171}, /* « */
{'-', ',', 172}, /* ¬ */
+ {'N', 'O', 172}, /* ¬ */
{'-', '-', 173}, /* ­ */
{'r', 'O', 174}, /* ® */
+ {'R', 'g', 174}, /* ® */
{'-', '=', 175}, /* ¯ */
+ {'\'', 'm', 175}, /* ¯ */
{'~', 'o', 176}, /* ° */
+ {'D', 'G', 176}, /* ° */
{'+', '-', 177}, /* ± */
{'2', '2', 178}, /* ² */
+ {'2', 'S', 178}, /* ² */
{'3', '3', 179}, /* ³ */
+ {'3', 'S', 179}, /* ³ */
{'\'', '\'', 180}, /* ´ */
{'j', 'u', 181}, /* µ */
+ {'M', 'y', 181}, /* µ */
{'p', 'p', 182}, /* ¶ */
+ {'P', 'I', 182}, /* ¶ */
{'~', '.', 183}, /* · */
+ {'.', 'M', 183}, /* · */
{',', ',', 184}, /* ¸ */
+ {'\'', ',', 184}, /* ¸ */
{'1', '1', 185}, /* ¹ */
+ {'1', 'S', 185}, /* ¹ */
{'o', '-', 186}, /* º */
{'>', '>', 187}, /* » */
{'1', '4', 188}, /* ¼ */
@@ -226,71 +267,113 @@ static const unsigned char digraphs[][3] = {
{'3', '4', 190}, /* ¾ */
{'~', '?', 191}, /* ¿ */
{'?', '?', 191}, /* ¿ */
+ {'?', 'I', 191}, /* ¿ */
{'A', '`', 192}, /* À */
+ {'A', '!', 192}, /* À */
{'A', '\'', 193}, /* Á */
{'A', '^', 194}, /* Â */
+ {'A', '>', 194}, /* Â */
{'A', '~', 195}, /* Ã */
+ {'A', '?', 195}, /* Ã */
{'A', '"', 196}, /* Ä */
+ {'A', ':', 196}, /* Ä */
{'A', '@', 197}, /* Å */
+ {'A', 'A', 197}, /* Å */
{'A', 'E', 198}, /* Æ */
{'C', ',', 199}, /* Ç */
{'E', '`', 200}, /* È */
+ {'E', '!', 200}, /* È */
{'E', '\'', 201}, /* É */
{'E', '^', 202}, /* Ê */
+ {'E', '>', 202}, /* Ê */
{'E', '"', 203}, /* Ë */
+ {'E', ':', 203}, /* Ë */
{'I', '`', 204}, /* Ì */
+ {'I', '!', 204}, /* Ì */
{'I', '\'', 205}, /* Í */
{'I', '^', 206}, /* Î */
+ {'I', '>', 206}, /* Î */
{'I', '"', 207}, /* Ï */
+ {'I', ':', 207}, /* Ï */
{'D', '-', 208}, /* Ð */
{'N', '~', 209}, /* Ñ */
+ {'N', '?', 209}, /* Ñ */
{'O', '`', 210}, /* Ò */
+ {'O', '!', 210}, /* Ò */
{'O', '\'', 211}, /* Ó */
{'O', '^', 212}, /* Ô */
+ {'O', '>', 212}, /* Ô */
{'O', '~', 213}, /* Õ */
+ {'O', '?', 213}, /* Õ */
{'O', '"', 214}, /* Ö */
+ {'O', ':', 214}, /* Ö */
{'/', '\\', 215}, /* × */
+ {'*', 'x', 215}, /* × */
{'O', '/', 216}, /* Ø */
{'U', '`', 217}, /* Ù */
+ {'U', '!', 217}, /* Ù */
{'U', '\'', 218}, /* Ú */
{'U', '^', 219}, /* Û */
+ {'U', '>', 219}, /* Û */
{'U', '"', 220}, /* Ü */
+ {'U', ':', 220}, /* Ü */
{'Y', '\'', 221}, /* Ý */
{'I', 'p', 222}, /* Þ */
+ {'T', 'H', 222}, /* Þ */
{'s', 's', 223}, /* ß */
{'s', '"', 223}, /* ß */
{'a', '`', 224}, /* à */
+ {'a', '!', 224}, /* à */
{'a', '\'', 225}, /* á */
{'a', '^', 226}, /* â */
+ {'a', '>', 226}, /* â */
{'a', '~', 227}, /* ã */
+ {'a', '?', 227}, /* ã */
{'a', '"', 228}, /* ä */
- {'a', '@', 229}, /* å */
+ {'a', ':', 228}, /* ä */
+ {'a', 'a', 229}, /* å */
{'a', 'e', 230}, /* æ */
{'c', ',', 231}, /* ç */
{'e', '`', 232}, /* è */
+ {'e', '!', 232}, /* è */
{'e', '\'', 233}, /* é */
{'e', '^', 234}, /* ê */
+ {'e', '>', 234}, /* ê */
{'e', '"', 235}, /* ë */
+ {'e', ':', 235}, /* ë */
{'i', '`', 236}, /* ì */
+ {'i', '!', 236}, /* ì */
{'i', '\'', 237}, /* í */
{'i', '^', 238}, /* î */
+ {'i', '>', 238}, /* î */
{'i', '"', 239}, /* ï */
+ {'i', ':', 239}, /* ï */
{'d', '-', 240}, /* ð */
{'n', '~', 241}, /* ñ */
+ {'n', '?', 241}, /* ñ */
{'o', '`', 242}, /* ò */
+ {'o', '!', 242}, /* ò */
{'o', '\'', 243}, /* ó */
{'o', '^', 244}, /* ô */
+ {'o', '>', 244}, /* ô */
{'o', '~', 245}, /* õ */
+ {'o', '?', 245}, /* õ */
{'o', '"', 246}, /* ö */
+ {'o', ':', 246}, /* ö */
{':', '-', 247}, /* ÷ */
{'o', '/', 248}, /* ø */
{'u', '`', 249}, /* ù */
+ {'u', '!', 249}, /* ù */
{'u', '\'', 250}, /* ú */
{'u', '^', 251}, /* û */
+ {'u', '>', 251}, /* û */
{'u', '"', 252}, /* ü */
+ {'u', ':', 252}, /* ü */
{'y', '\'', 253}, /* ý */
{'i', 'p', 254}, /* þ */
+ {'t', 'h', 254}, /* þ */
{'y', '"', 255}, /* ÿ */
+ {'y', ':', 255}, /* ÿ */
{'"', '[', 196}, /* Ä */
{'"', '\\', 214}, /* Ö */
{'"', ']', 220}, /* Ü */
@@ -406,7 +489,16 @@ 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] = "-";
+ args[1] = NULL;
+ ktab['-'].nr = RC_SELECT;
+ ktab['-'].args = SaveArgs(args);
+ }
for (i = 0; i < ((MAXWIN < 10) ? MAXWIN : 10); i++)
{
char *args[2], arg1[10];
@@ -416,6 +508,14 @@ InitKeytab()
ktab['0' + i].nr = RC_SELECT;
ktab['0' + i].args = SaveArgs(args);
}
+ ktab['\''].nr = RC_SELECT; /* calling a window by name */
+ {
+ char *args[2];
+ args[0] = "-b";
+ args[1] = 0;
+ ktab['"'].nr = RC_WINDOWLIST;
+ ktab['"'].args = SaveArgs(args);
+ }
ktab[Ctrl('G')].nr = RC_VBELL;
ktab[':'].nr = RC_COLON;
#ifdef COPY_PASTE
@@ -423,17 +523,16 @@ InitKeytab()
{
char *args[2];
args[0] = ".";
- args[1] = NULL;
+ args[1] = 0;
ktab[']'].args = SaveArgs(args);
ktab[Ctrl(']')].args = SaveArgs(args);
+ ktab[']'].nr = ktab[Ctrl(']')].nr = RC_PASTE;
}
- ktab[']'].nr = ktab[Ctrl(']')].nr = RC_PASTE;
ktab['{'].nr = RC_HISTORY;
ktab['}'].nr = RC_HISTORY;
ktab['>'].nr = RC_WRITEBUF;
ktab['<'].nr = RC_READBUF;
ktab['='].nr = RC_REMOVEBUF;
- ktab['\''].nr = ktab['"'].nr = RC_SELECT; /* calling a window by name */
#endif
#ifdef POW_DETACH
ktab['D'].nr = RC_POW_DETACH;
@@ -449,19 +548,57 @@ InitKeytab()
ktab['X'].nr = RC_REMOVE;
ktab['F'].nr = RC_FIT;
ktab['\t'].nr = RC_FOCUS;
- {
- char *args[2];
- args[0] = "-";
- args[1] = NULL;
-
- ktab['-'].nr = RC_SELECT;
- ktab['-'].args = SaveArgs(args);
- }
/* These come last; they may want overwrite others: */
if (DefaultEsc >= 0)
- ktab[DefaultEsc].nr = RC_OTHER;
+ {
+ ClearAction(&ktab[DefaultEsc]);
+ ktab[DefaultEsc].nr = RC_OTHER;
+ }
if (DefaultMetaEsc >= 0)
- ktab[DefaultMetaEsc].nr = RC_META;
+ {
+ ClearAction(&ktab[DefaultMetaEsc]);
+ ktab[DefaultMetaEsc].nr = RC_META;
+ }
+}
+
+struct action *
+FindKtab(class, create)
+char *class;
+int create;
+{
+ struct kclass *kp, **kpp;
+ int i;
+
+ if (class == 0)
+ return ktab;
+ for (kpp = &kclasses; (kp = *kpp) != 0; kpp = &kp->next)
+ if (!strcmp(kp->name, class))
+ break;
+ if (kp == 0)
+ {
+ if (!create)
+ return 0;
+ if (strlen(class) > 80)
+ {
+ Msg(0, "Command class name too long.");
+ return 0;
+ }
+ kp = malloc(sizeof(*kp));
+ if (kp == 0)
+ {
+ Msg(0, strnomem);
+ return 0;
+ }
+ kp->name = SaveStr(class);
+ for (i = 0; i < sizeof(kp->ktab)/sizeof(*kp->ktab); i++)
+ {
+ kp->ktab[i].nr = RC_ILLEGAL;
+ kp->ktab[i].args = noargs;
+ }
+ kp->next = 0;
+ *kpp = kp;
+ }
+ return kp->ktab;
}
static void
@@ -605,10 +742,12 @@ int ilen;
{
char *s;
int ch, slen;
+ struct action *ktabp;
debug1("ProcessInput2: %d bytes\n", ilen);
while (ilen && display)
{
+ debug1(" - ilen now %d bytes\n", ilen);
flayer = D_forecv->c_layer;
fore = D_fore;
slen = ilen;
@@ -625,10 +764,11 @@ int ilen;
if (slen)
DoProcess(fore, &ibuf, &slen, 0);
if (--ilen == 0)
- D_ESCseen = 1;
+ D_ESCseen = ktab;
}
if (ilen <= 0)
return;
+ ktabp = D_ESCseen ? D_ESCseen : ktab;
D_ESCseen = 0;
ch = (unsigned char)*s;
@@ -644,7 +784,7 @@ int ilen;
ch = DefaultMetaEsc;
if (ch >= 0)
- DoAction(&ktab[ch], ch);
+ DoAction(&ktabp[ch], ch);
ibuf = (char *)(s + 1);
ilen--;
}
@@ -682,7 +822,7 @@ struct paster *pa;
while (flayer && *lenp)
{
oldlen = *lenp;
- Process(bufp, lenp);
+ LayProcess(bufp, lenp);
#ifdef COPY_PASTE
if (pa && !pa->pa_pastelayer)
break; /* flush rest of paste */
@@ -810,7 +950,7 @@ char **args;
if (i != n && i != n + 2)
{
Msg(0, orformat[1], rc_name, comms[nr].name, argss[n],
- argss[n + 2], "");
+ argss[n + 2], "s");
return -1;
}
}
@@ -843,7 +983,10 @@ int key;
int argc, i, n, msgok;
char *s;
char ch;
+ struct display *odisplay = display;
+ struct acluser *user;
+ user = display ? D_user : users;
if (nr == RC_ILLEGAL)
{
debug1("key '%c': No action\n", key);
@@ -860,6 +1003,11 @@ int key;
Msg(0, "%s: %s: window required", rc_name, comms[nr].name);
return;
}
+ if ((n & NEED_LAYER) && flayer == 0)
+ {
+ Msg(0, "%s: %s: display or window required", rc_name, comms[nr].name);
+ return;
+ }
if ((argc = CheckArgNum(nr, args)) < 0)
return;
#ifdef MULTIUSER
@@ -868,7 +1016,7 @@ int key;
if (AclCheckPermCmd(D_user, ACL_EXEC, &comms[nr]))
{
Msg(0, "%s: %s: permission denied (user %s)",
- rc_name, comms[nr].name, D_user->u_name);
+ rc_name, comms[nr].name, (EffectiveAclUser ? EffectiveAclUser : D_user)->u_name);
return;
}
}
@@ -917,10 +1065,31 @@ int key;
D_obuflenmax = D_obuflen - D_obufmax;
break;
case RC_DUMPTERMCAP:
- WriteFile(DUMP_TERMCAP);
+ WriteFile(user, (char *)0, DUMP_TERMCAP);
break;
case RC_HARDCOPY:
- WriteFile(DUMP_HARDCOPY);
+ {
+ int mode = DUMP_HARDCOPY;
+
+ if (argc > 1 && !strcmp(*args, "-h"))
+ {
+ mode = DUMP_SCROLLBACK;
+ args++;
+ argc--;
+ }
+ if (*args && args[1])
+ {
+ Msg(0, "%s: hardcopy: too many arguments", rc_name);
+ break;
+ }
+ if (fore == 0 && *args == 0)
+ Msg(0, "%s: hardcopy: window required", rc_name);
+ else
+ WriteFile(user, *args, mode);
+ }
+ break;
+ case RC_DEFLOG:
+ (void)ParseOnOff(act, &nwin_default.Lflag);
break;
case RC_LOG:
n = fore->w_log ? 1 : 0;
@@ -946,7 +1115,11 @@ 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, (char *)RC_KILL);
+#else
+ Input("Really kill this window [y/n]", 1, INP_RAW, confirm_fn, (char *)RC_KILL);
+#endif
break;
}
n = fore->w_number;
@@ -975,7 +1148,10 @@ int key;
/* NOTREACHED */
#ifdef DETACH
case RC_DETACH:
- Detach(D_DETACH);
+ if (*args && !strcmp(*args, "-h"))
+ Hangup();
+ else
+ Detach(D_DETACH);
break;
# ifdef POW_DETACH
case RC_POW_DETACH:
@@ -1074,7 +1250,7 @@ int key;
case '*': /* user */
{
struct display *nd;
- struct user *u;
+ struct acluser *u;
if (!n)
u = D_user;
@@ -1211,6 +1387,19 @@ int key;
#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"))
+ {
+ i = FindEncoding(args[1]);
+ if (i == -1)
+ {
+ Msg(0, "%s: readreg: unknown encoding", rc_name);
+ break;
+ }
+ args += 2;
+ }
+#endif
/*
* Without arguments we prompt for a destination register.
* It will receive the copybuffer contents.
@@ -1232,6 +1421,11 @@ int key;
*/
if (args[1])
{
+ if (args[2])
+ {
+ Msg(0, "%s: readreg: too many arguments", rc_name);
+ break;
+ }
if ((s = ReadFile(args[1], &n)))
{
struct plop *pp = plop_tab + (int)(unsigned char)ch;
@@ -1240,6 +1434,9 @@ int key;
free(pp->buf);
pp->buf = s;
pp->len = n;
+#ifdef ENCODINGS
+ pp->enc = i;
+#endif
}
}
else
@@ -1252,8 +1449,42 @@ int key;
break;
#endif
case RC_REGISTER:
- if ((s = ParseChar(*args, &ch)) == NULL || *s)
+#ifdef ENCODINGS
+ i = fore ? fore->w_encoding : display ? display->d_encoding : 0;
+ if (args[0] && args[1] && !strcmp(args[0], "-e"))
+ {
+ i = FindEncoding(args[1]);
+ if (i == -1)
+ {
+ Msg(0, "%s: register: unknown encoding", rc_name);
+ break;
+ }
+ args += 2;
+ argc -= 2;
+ }
+#endif
+ if (argc != 2)
+ {
+ Msg(0, "%s: register: illegal number of arguments.", rc_name);
+ break;
+ }
+ if ((s = ParseChar(*args, &ch)) == 0 || *s)
Msg(0, "%s: register: character, ^x, or (octal) \\032 expected.", rc_name);
+#ifdef COPY_PASTE
+ else if (ch == '.')
+ {
+ if (user->u_plop.buf != NULL)
+ UserFreeCopyBuffer(user);
+ if (args[1] && args[1][0])
+ {
+ user->u_plop.buf = SaveStr(args[1]);
+ user->u_plop.len = strlen(user->u_plop.buf);
+#ifdef ENCODINGS
+ user->u_plop.enc = i;
+#endif
+ }
+ }
+#endif
else
{
struct plop *plp = plop_tab + (int)(unsigned char)ch;
@@ -1262,6 +1493,9 @@ int key;
free(plp->buf);
plp->buf = SaveStr(args[1]);
plp->len = strlen(plp->buf);
+#ifdef ENCODINGS
+ plp->enc = i;
+#endif
}
break;
case RC_PROCESS:
@@ -1299,13 +1533,13 @@ int key;
if (StuffKey(i - T_CAPS) == 0)
break;
#endif
- s = D_tcs[i].str;
+ s = display ? D_tcs[i].str : 0;
if (s == 0)
break;
}
n = strlen(s);
while(n)
- Process(&s, &n);
+ LayProcess(&s, &n);
break;
case RC_REDISPLAY:
Activate(-1);
@@ -1317,42 +1551,61 @@ int key;
Msg(0, "screen %s", version);
break;
case RC_TIME:
- ShowTime();
+ if (*args)
+ {
+ timestring = SaveStr(*args);
+ break;
+ }
+ Msg(0, "%s", MakeWinMsg(timestring, fore, '%'));
break;
case RC_INFO:
ShowInfo();
break;
+ case RC_DINFO:
+ ShowDInfo();
+ break;
case RC_COMMAND:
- if (!D_ESCseen)
{
- D_ESCseen = 1;
- break;
+ struct action *ktabp = ktab;
+ if (argc == 2 && !strcmp(*args, "-c"))
+ {
+ if ((ktabp = FindKtab(args[1], 0)) == 0)
+ {
+ Msg(0, "Unknown command class '%s'", args[1]);
+ break;
+ }
+ }
+ if (D_ESCseen != ktab || ktabp != ktab)
+ {
+ D_ESCseen = ktabp;
+ break;
+ }
+ D_ESCseen = 0;
}
- D_ESCseen = 0;
/* FALLTHROUGH */
case RC_OTHER:
if (MoreWindows())
- SwitchWindow(D_other ? D_other->w_number : NextWindow());
+ SwitchWindow(display && D_other ? D_other->w_number : NextWindow());
break;
case RC_META:
- if (D_user->u_Esc == -1)
+ if (user->u_Esc == -1)
break;
- ch = D_user->u_Esc;
+ ch = user->u_Esc;
s = &ch;
n = 1;
- Process(&s, &n);
+ LayProcess(&s, &n);
break;
case RC_XON:
ch = Ctrl('q');
s = &ch;
n = 1;
- Process(&s, &n);
+ LayProcess(&s, &n);
break;
case RC_XOFF:
ch = Ctrl('s');
s = &ch;
n = 1;
- Process(&s, &n);
+ LayProcess(&s, &n);
break;
case RC_DEFBREAKTYPE:
case RC_BREAKTYPE:
@@ -1401,84 +1654,138 @@ int key;
break;
#endif
case RC_WIDTH:
- if (*args)
- {
- if (ParseNum(act, &n))
- break;
- }
- else
- {
- if (display == 0)
- break;
- if (D_width == Z0width)
- n = Z1width;
- else if (D_width == Z1width)
- n = Z0width;
- else if (D_width > (Z0width + Z1width) / 2)
- n = Z0width;
- else
- n = Z1width;
- }
- if (n <= 0)
- {
- Msg(0, "Illegal width");
- break;
- }
- if (display == 0 && fore)
- {
- WChangeSize(fore, n, fore->w_height);
- break;
- }
- if (n == D_width)
- break;
- if (ResizeDisplay(n, D_height) == 0)
- {
- Activate(D_fore ? D_fore->w_norefresh : 0);
- /* autofit */
- ResizeLayer(D_forecv->c_layer, D_forecv->c_xe - D_forecv->c_xs + 1, D_forecv->c_ye - D_forecv->c_ys + 1, 0);
- }
- else
- Msg(0, "Your termcap does not specify how to change the terminal's width to %d.", n);
- break;
case RC_HEIGHT:
- if (*args)
- {
- if (ParseNum(act, &n))
+ {
+ int w, h;
+ int what = 0;
+
+ i = 1;
+ if (*args && !strcmp(*args, "-w"))
+ what = 1;
+ else if (*args && !strcmp(*args, "-d"))
+ what = 2;
+ if (what)
+ args++;
+ if (what == 0 && flayer && !display)
+ what = 1;
+ if (what == 1)
+ {
+ if (!flayer)
+ {
+ Msg(0, "%s: %s: window required", rc_name, comms[nr].name);
+ break;
+ }
+ w = flayer->l_width;
+ h = flayer->l_height;
+ }
+ else
+ {
+ if (!display)
+ {
+ Msg(0, "%s: %s: display required", rc_name, comms[nr].name);
+ break;
+ }
+ w = D_width;
+ h = D_height;
+ }
+ if (*args && args[0][0] == '-')
+ {
+ Msg(0, "%s: %s: unknown option %s", rc_name, comms[nr].name, *args);
break;
- }
- else
- {
+ }
+ if (nr == RC_HEIGHT)
+ {
+ if (!*args)
+ {
#define H0height 42
#define H1height 24
- if (D_height == H0height)
- n = H1height;
- else if (D_height == H1height)
- n = H0height;
- else if (D_height > (H0height + H1height) / 2)
- n = H0height;
- else
- n = H1height;
- }
- if (n <= 0)
- {
- Msg(0, "Illegal height");
+ if (h == H0height)
+ h = H1height;
+ else if (h == H1height)
+ h = H0height;
+ else if (h > (H0height + H1height) / 2)
+ h = H0height;
+ else
+ h = H1height;
+ }
+ else
+ {
+ h = atoi(*args);
+ if (args[1])
+ w = atoi(args[1]);
+ }
+ }
+ else
+ {
+ if (!*args)
+ {
+ if (w == Z0width)
+ w = Z1width;
+ else if (w == Z1width)
+ w = Z0width;
+ else if (w > (Z0width + Z1width) / 2)
+ w = Z0width;
+ else
+ w = Z1width;
+ }
+ else
+ {
+ w = atoi(*args);
+ if (args[1])
+ h = atoi(args[1]);
+ }
+ }
+ if (*args && args[1] && args[2])
+ {
+ Msg(0, "%s: %s: too many arguments", rc_name, comms[nr].name);
+ break;
+ }
+ if (w <= 0)
+ {
+ Msg(0, "Illegal width");
+ break;
+ }
+ if (h <= 0)
+ {
+ Msg(0, "Illegal height");
+ break;
+ }
+ if (what == 1)
+ {
+ if (flayer->l_width == w && flayer->l_height == h)
+ break;
+ ResizeLayer(flayer, w, h, (struct display *)0);
+ break;
+ }
+ if (D_width == w && D_height == h)
break;
- }
- if (n == D_height)
- break;
- if (ResizeDisplay(D_width, n) == 0)
- {
- /* DoResize(D_width, D_height); */
- Activate(D_fore ? D_fore->w_norefresh : 0);
- }
- else
- Msg(0, "Your termcap does not specify how to change the terminal's height to %d.", n);
+ if (what == 2)
+ {
+ ChangeScreenSize(w, h, 1);
+ }
+ else
+ {
+ if (ResizeDisplay(w, h) == 0)
+ {
+ Activate(D_fore ? D_fore->w_norefresh : 0);
+ /* autofit */
+ ResizeLayer(D_forecv->c_layer, D_forecv->c_xe - D_forecv->c_xs + 1, D_forecv->c_ye - D_forecv->c_ys + 1, 0);
+ break;
+ }
+ if (h == D_height)
+ Msg(0, "Your termcap does not specify how to change the terminal's width to %d.", w);
+ else if (w == D_width)
+ Msg(0, "Your termcap does not specify how to change the terminal's height to %d.", h);
+ else
+ Msg(0, "Your termcap does not specify how to change the terminal's resolution to %dx%d.", w, h);
+ }
+ }
break;
case RC_TITLE:
if (*args == 0)
InputAKA();
else
- ChangeAKA(fore, *args, 20);
+ ChangeAKA(fore, *args, MAXAKA);
break;
case RC_COLON:
Input(":", 100, INP_COOKED, Colonfin, NULL);
@@ -1486,7 +1793,7 @@ int key;
{
s = *args;
n = strlen(s);
- Process(&s, &n);
+ LayProcess(&s, &n);
}
break;
case RC_LASTMSG:
@@ -1572,7 +1879,7 @@ int key;
WriteString(fore, "\033c", 2);
break;
case RC_MONITOR:
- n = fore->w_monitor == MON_ON;
+ n = fore->w_monitor != MON_OFF;
if (ParseSwitch(act, &n))
break;
if (n)
@@ -1586,8 +1893,7 @@ int key;
#endif
if (fore->w_monitor == MON_OFF)
fore->w_monitor = MON_ON;
- Msg(0, "Window %d (%s) is now being monitored for all activity.",
- fore->w_number, fore->w_title);
+ Msg(0, "Window %d (%s) is now being monitored for all activity.", fore->w_number, fore->w_title);
}
else
{
@@ -1604,15 +1910,57 @@ int key;
if (i < 0)
#endif
fore->w_monitor = MON_OFF;
- Msg(0, "Window %d (%s) is no longer being monitored for activity.",
- fore->w_number, fore->w_title);
+ Msg(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_wlist(0);
+ else if (!strcmp(*args, "-b") && !args[1])
+ display_wlist(1);
+ else if (!strcmp(*args, "string"))
+ {
+ if (args[1])
+ {
+ if (wliststr)
+ free(wliststr);
+ wliststr = SaveStr(args[1]);
+ }
+ if (msgok)
+ Msg(0, "windowlist string is '%s'", wliststr);
+ }
+ else if (!strcmp(*args, "title"))
+ {
+ if (args[1])
+ {
+ if (wlisttit)
+ free(wlisttit);
+ wlisttit = SaveStr(args[1]);
+ }
+ if (msgok)
+ Msg(0, "windowlist title is '%s'", wlisttit);
+ }
+ else
+ Msg(0, "usage: windowlist [-b] [string [string] | title [title]]");
+ break;
case RC_HELP:
- display_help();
+ if (argc == 2 && !strcmp(*args, "-c"))
+ {
+ struct action *ktabp;
+ if ((ktabp = FindKtab(args[1], 0)) == 0)
+ {
+ Msg(0, "Unknown command class '%s'", args[1]);
+ break;
+ }
+ display_help(args[1], ktabp);
+ }
+ else
+ display_help((char *)0, ktab);
break;
case RC_LICENSE:
display_copyright();
@@ -1637,7 +1985,7 @@ int key;
}
if (GetHistory() == 0)
break;
- if (D_user->u_copybuffer == NULL)
+ if (user->u_plop.buf == NULL)
break;
args = pasteargs;
}
@@ -1646,6 +1994,9 @@ 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
@@ -1655,6 +2006,8 @@ int key;
Input("Paste from register:", 1, INP_RAW, ins_reg_fn, NULL);
break;
}
+ if (args[1] == 0 && !fore) /* no window? */
+ break;
/*
* with two arguments we paste into a destination register
* (no window needed here).
@@ -1665,6 +2018,11 @@ int key;
rc_name);
break;
}
+# ifdef ENCODINGS
+ else if (fore)
+ enc = fore->w_encoding;
+# endif
+
/*
* measure length of needed buffer
*/
@@ -1672,11 +2030,26 @@ int key;
{
if (ch == '.')
{
- if (display)
- l += D_user->u_copylen;
+# 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
- l += plop_tab[(int)(unsigned char)ch].len;
+ {
+# 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;
+ }
}
if (l == 0)
{
@@ -1689,11 +2062,13 @@ int key;
* pass a pointer rather than duplicating the buffer.
*/
if (s[1] == 0 && args[1] == 0)
- {
- if (fore)
- MakePaster(&fore->w_paster, *s == '.' ? D_user->u_copybuffer : plop_tab[(int)(unsigned char)*s].buf, l, 0);
- break;
- }
+# 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;
+ }
/*
* if no shortcut, we construct a buffer
*/
@@ -1709,29 +2084,22 @@ int key;
*/
for (ss = s; (ch = *ss); ss++)
{
- if (ch == '.')
+ struct plop *pp = (ch == '.' ? &user->u_plop : &plop_tab[(int)(unsigned char)ch]);
+#ifdef ENCODINGS
+ if (pp->enc != enc)
{
- if (display == 0)
- continue;
- bcopy(D_user->u_copybuffer, dbuf + l, D_user->u_copylen);
- l += D_user->u_copylen;
- }
- else
- {
- bcopy(plop_tab[(int)(unsigned char)ch].buf, dbuf + l, plop_tab[(int)(unsigned char)ch].len);
- l += plop_tab[(int)(unsigned char)ch].len;
- }
+ 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;
}
/*
* when called with one argument we paste our buffer into the window
*/
if (args[1] == 0)
{
- if (fore == 0)
- {
- free(dbuf); /* no window? zap our buffer */
- break;
- }
MakePaster(&fore->w_paster, dbuf, l, 1);
}
else
@@ -1742,51 +2110,118 @@ int key;
*/
if (dch == '.')
{
- if (display == 0)
- {
- free(dbuf);
- break;
- }
- if (D_user->u_copybuffer != NULL)
- UserFreeCopyBuffer(D_user);
- D_user->u_copybuffer = dbuf;
- D_user->u_copylen = l;
+ if (user->u_plop.buf != NULL)
+ UserFreeCopyBuffer(user);
+ user->u_plop.buf = dbuf;
+ user->u_plop.len = l;
+#ifdef ENCODINGS
+ user->u_plop.enc = enc;
+#endif
}
else
{
struct plop *pp = plop_tab + (int)(unsigned char)dch;
-
if (pp->buf)
free(pp->buf);
pp->buf = dbuf;
pp->len = l;
+#ifdef ENCODINGS
+ pp->enc = enc;
+#endif
}
}
break;
}
case RC_WRITEBUF:
- if (D_user->u_copybuffer == NULL)
+ if (!user->u_plop.buf)
{
Msg(0, "empty buffer");
break;
}
- WriteFile(DUMP_EXCHANGE);
+#ifdef ENCODINGS
+ {
+ struct plop oldplop;
+
+ oldplop = user->u_plop;
+ if (args[0] && args[1] && !strcmp(args[0], "-e"))
+ {
+ int enc, l;
+ char *newbuf;
+
+ enc = FindEncoding(args[1]);
+ if (enc == -1)
+ {
+ Msg(0, "%s: writebuf: unknown encoding", rc_name);
+ break;
+ }
+ if (enc != oldplop.enc)
+ {
+ l = RecodeBuf((unsigned char *)oldplop.buf, oldplop.len, oldplop.enc, enc, (unsigned char *)0);
+ newbuf = malloc(l + 1);
+ if (!newbuf)
+ {
+ Msg(0, strnomem);
+ break;
+ }
+ user->u_plop.len = RecodeBuf((unsigned char *)oldplop.buf, oldplop.len, oldplop.enc, enc, (unsigned char *)newbuf);
+ user->u_plop.buf = newbuf;
+ user->u_plop.enc = enc;
+ }
+ args += 2;
+ }
+#endif
+ if (args[0] && args[1])
+ Msg(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:
- if ((s = ReadFile(BufferFile, &n)))
+#ifdef ENCODINGS
+ i = fore ? fore->w_encoding : display ? display->d_encoding : 0;
+ if (args[0] && args[1] && !strcmp(args[0], "-e"))
+ {
+ i = FindEncoding(args[1]);
+ if (i == -1)
+ {
+ Msg(0, "%s: readbuf: unknown encoding", rc_name);
+ break;
+ }
+ args += 2;
+ }
+#endif
+ if (args[0] && args[1])
+ {
+ Msg(0, "%s: readbuf: too many arguments", rc_name);
+ break;
+ }
+ if ((s = ReadFile(args[0] ? args[0] : BufferFile, &n)))
{
- if (D_user->u_copybuffer)
- UserFreeCopyBuffer(D_user);
- D_user->u_copylen = n;
- D_user->u_copybuffer = s;
+ if (user->u_plop.buf)
+ UserFreeCopyBuffer(user);
+ user->u_plop.len = n;
+ user->u_plop.buf = s;
+#ifdef ENCODINGS
+ user->u_plop.enc = i;
+#endif
}
break;
case RC_REMOVEBUF:
KillBuffers();
break;
+ case RC_IGNORECASE:
+ (void)ParseSwitch(act, &search_ic);
+ if (msgok)
+ Msg(0, "Will %signore case in searches", search_ic ? "" : "not ");
+ break;
#endif /* COPY_PASTE */
case RC_ESCAPE:
- if (ParseEscape(display ? D_user : users, *args))
+ if (ParseEscape(user, *args))
{
Msg(0, "%s: two characters required after escape.", rc_name);
break;
@@ -1794,7 +2229,7 @@ int key;
/* Change defescape if master user. This is because we only
* have one ktab.
*/
- if (display && D_user != users)
+ if (display && user != users)
break;
/* FALLTHROUGH */
case RC_DEFESCAPE:
@@ -1818,7 +2253,10 @@ int key;
ShellArgs[0] = ShellProg;
break;
case RC_HARDCOPYDIR:
- (void)ParseSaveStr(act, &hardcopydir);
+ if (*args)
+ (void)ParseSaveStr(act, &hardcopydir);
+ if (msgok)
+ Msg(0, "hardcopydir is %s\n", hardcopydir && *hardcopydir ? hardcopydir : "<cwd>");
break;
case RC_LOGFILE:
if (*args)
@@ -1871,7 +2309,7 @@ int key;
case RC_TERMCAP:
case RC_TERMCAPINFO:
case RC_TERMINFO:
- if (!rc_name || rc_name == "")
+ if (!rc_name || !*rc_name)
Msg(0, "Sorry, too late now. Place that in your .screenrc file.");
break;
case RC_SLEEP:
@@ -1882,7 +2320,7 @@ int key;
break;
if (strlen(s) >= 20)
{
- Msg(0,"%s: term: argument too long ( < 20)", rc_name);
+ Msg(0, "%s: term: argument too long ( < 20)", rc_name);
free(s);
break;
}
@@ -1896,7 +2334,7 @@ int key;
if (!msgok)
break;
/*
- * D_user typed ^A:echo... well, echo isn't FinishRc's job,
+ * user typed ^A:echo... well, echo isn't FinishRc's job,
* but as he wanted to test us, we show good will
*/
if (*args && (args[1] == 0 || (strcmp(args[1], "-n") == 0 && args[2] == 0)))
@@ -1918,7 +2356,7 @@ int key;
#ifdef COPY_PASTE
case RC_BUFFERFILE:
if (*args == 0)
- BufferFile = SaveStr(bufferfile);
+ BufferFile = SaveStr(DEFAULT_BUFFERFILE);
else if (ParseSaveStr(act, &BufferFile))
break;
if (msgok)
@@ -1943,11 +2381,30 @@ int key;
#if defined(UTMPOK) && defined(LOGOUTOK)
case RC_LOGIN:
n = fore->w_slot != (slot_t)-1;
+ if (*args && !strcmp(*args, "always"))
+ {
+ fore->w_lflag = 3;
+ if (!displays && n)
+ SlotToggle(n);
+ break;
+ }
+ if (*args && !strcmp(*args, "attached"))
+ {
+ fore->w_lflag = 1;
+ if (!displays && n)
+ SlotToggle(0);
+ break;
+ }
if (ParseSwitch(act, &n) == 0)
SlotToggle(n);
break;
case RC_DEFLOGIN:
- (void)ParseOnOff(act, &nwin_default.lflag);
+ if (!strcmp(*args, "always"))
+ nwin_default.lflag |= 2;
+ else if (!strcmp(*args, "attached"))
+ nwin_default.lflag &= ~2;
+ else
+ (void)ParseOnOff(act, &nwin_default.lflag);
break;
#endif
case RC_DEFFLOW:
@@ -1956,17 +2413,15 @@ int key;
iflag = 1;
for (display = displays; display; display = display->d_next)
{
- if ((intrc == VDISABLE) && (origintrc != VDISABLE))
- {
+ if (!D_flow)
+ continue;
#if defined(TERMIO) || defined(POSIX)
- intrc = D_NewMode.tio.c_cc[VINTR] = origintrc;
- D_NewMode.tio.c_lflag |= ISIG;
+ D_NewMode.tio.c_cc[VINTR] = D_OldMode.tio.c_cc[VINTR];
+ D_NewMode.tio.c_lflag |= ISIG;
#else /* TERMIO || POSIX */
- intrc = D_NewMode.m_tchars.t_intrc = origintrc;
+ D_NewMode.m_tchars.t_intrc = D_OldMode.m_tchars.t_intrc;
#endif /* TERMIO || POSIX */
-
- SetTTY(D_userfd, &D_NewMode);
- }
+ SetTTY(D_userfd, &D_NewMode);
}
}
if (args[0] && args[0][0] == 'a')
@@ -1980,6 +2435,11 @@ 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;
@@ -2000,7 +2460,10 @@ int key;
break;
case RC_HARDSTATUS:
if (display)
- RemoveStatus();
+ {
+ Msg(0, "%s", ""); /* wait till mintime (keep gcc quiet) */
+ RemoveStatus();
+ }
if (args[0] && strcmp(args[0], "on") && strcmp(args[0], "off"))
{
struct display *olddisplay = display;
@@ -2190,6 +2653,7 @@ int key;
WindowChanged(fore, 'n');
WindowChanged((struct win *)0, 'w');
WindowChanged((struct win *)0, 'W');
+ WindowChanged((struct win *)0, 0);
}
break;
case RC_SILENCE:
@@ -2389,17 +2853,15 @@ int key;
case RC_PASSWORD:
if (*args)
{
- struct user *u = display ? D_user : users;
-
- n = (*u->u_password) ? 1 : 0;
- if (u->u_password != NullStr) free((char *)u->u_password);
- u->u_password = SaveStr(*args);
- if (!strcmp(u->u_password, "none"))
+ n = (*user->u_password) ? 1 : 0;
+ if (user->u_password != NullStr) free((char *)user->u_password);
+ user->u_password = SaveStr(*args);
+ if (!strcmp(user->u_password, "none"))
{
if (n)
Msg(0, "Password checking disabled");
- free(u->u_password);
- u->u_password = NullStr;
+ free(user->u_password);
+ user->u_password = NullStr;
}
}
else
@@ -2409,31 +2871,44 @@ int key;
Msg(0, "%s: password: window required", rc_name);
break;
}
- Input("New screen password:", 100, INP_NOECHO, pass1, (char *)D_user);
+ Input("New screen password:", 100, INP_NOECHO, pass1, display ? (char *)D_user : (char *)users);
}
break;
#endif /* PASSWORD */
case RC_BIND:
- if ((s = ParseChar(*args, &ch)) == 0 || *s)
{
- Msg(0, "%s: bind: character, ^x, or (octal) \\032 expected.",
- rc_name);
- break;
- }
- n = (unsigned char)ch;
- ClearAction(&ktab[n]);
- if (args[1])
- {
- if ((i = FindCommnr(args[1])) == RC_ILLEGAL)
+ struct action *ktabp = ktab;
+
+ if (argc > 2 && !strcmp(*args, "-c"))
{
- Msg(0, "%s: bind: unknown command '%s'", rc_name, args[1]);
+ ktabp = FindKtab(args[1], 1);
+ if (ktabp == 0)
+ break;
+ args += 2;
+ }
+ if ((s = ParseChar(*args, &ch)) == 0 || *s)
+ {
+ Msg(0, "%s: bind: character, ^x, or (octal) \\032 expected.",
+ rc_name);
break;
}
- if (CheckArgNum(i, args + 2) < 0)
- break;
- ktab[n].nr = i;
- if (args[2])
- ktab[n].args = SaveArgs(args + 2);
+ n = (unsigned char)ch;
+ if (args[1])
+ {
+ if ((i = FindCommnr(args[1])) == RC_ILLEGAL)
+ {
+ Msg(0, "%s: bind: unknown command '%s'", rc_name, args[1]);
+ break;
+ }
+ if (CheckArgNum(i, args + 2) < 0)
+ break;
+ ClearAction(&ktabp[n]);
+ ktabp[n].nr = i;
+ if (args[2])
+ ktabp[n].args = SaveArgs(args + 2);
+ }
+ else
+ ClearAction(&ktabp[n]);
}
break;
#ifdef MAPKEYS
@@ -2527,7 +3002,6 @@ int key;
i -= T_CAPS;
}
newact = df ? &dmtab[i] : mf ? &mmtab[i] : &umtab[i];
- ClearAction(newact);
if (args[1])
{
if ((newnr = FindCommnr(args[1])) == RC_ILLEGAL)
@@ -2537,6 +3011,7 @@ int key;
}
if (CheckArgNum(newnr, args + 2) < 0)
break;
+ ClearAction(newact);
newact->nr = newnr;
if (args[2])
newact->args = SaveArgs(args + 2);
@@ -2548,6 +3023,8 @@ int key;
kmap_extras_fl[i - (KMAP_KEYS+KMAP_AKEYS)] = fl;
}
}
+ else
+ ClearAction(newact);
for (display = displays; display; display = display->d_next)
remap(i, args[1] ? 1 : 0);
if (kf == 0 && !args[1])
@@ -2615,8 +3092,8 @@ int key;
}
else /* remove all groups from user */
{
- struct user *u;
- struct usergroup *g;
+ struct acluser *u;
+ struct aclusergroup *g;
if (!(u = *FindUserPtr(args[0])))
break;
@@ -2631,8 +3108,8 @@ int key;
{
char buf[256], *p = buf;
int ngroups = 0;
- struct user *u;
- struct usergroup *g;
+ struct acluser *u;
+ struct aclusergroup *g;
if (!(u = *FindUserPtr(args[0])))
{
@@ -2695,44 +3172,115 @@ int key;
if (ParseSwitch(act, &fore->w_c1) == 0 && msgok)
Msg(0, "Will %suse C1", fore->w_c1 ? "" : "not ");
break;
-#ifdef KANJI
+#ifdef COLOR
+ case RC_BCE:
+ if (ParseSwitch(act, &fore->w_bce) == 0 && msgok)
+ Msg(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])
+ Msg(0, "encodings directory is %s", screenencodings ? screenencodings : "<unset>");
+ else
+ {
+ free(screenencodings);
+ screenencodings = SaveStr(args[1]);
+ }
+ break;
+ }
+ if (*args && !strcmp(args[0], "-l"))
+ {
+ if (!args[1])
+ Msg(0, "encoding: -l: argument required");
+ else if (LoadFontTranslation(-1, args[1]))
+ Msg(0, "encoding: could not load utf8 encoding file");
+ else if (msgok)
+ Msg(0, "encoding: utf8 encoding file loaded");
+ break;
+ }
+#else
+ if (*args && (!strcmp(args[0], "-l") || !strcmp(args[0], "-d")))
+ {
+ if (msgok)
+ Msg(0, "encoding: screen is not compiled for UTF-8.");
+ break;
+ }
+#endif
for (i = 0; i < 2; i++)
{
if (args[i] == 0)
break;
- if (strcmp(args[i], "jis") == 0 || strcmp(args[i], "off") == 0)
- n = 0;
- else if (strcmp(args[i], "euc") == 0)
- n = EUC;
- else if (strcmp(args[i], "sjis") == 0)
- n = SJIS;
- else
+ if (!strcmp(args[i], "."))
+ continue;
+ n = FindEncoding(args[i]);
+ if (n == -1)
{
- Msg(0, "kanji: illegal argument (%s)", args[i]);
- break;
+ Msg(0, "encoding: unknown encoding '%s'", args[i]);
+ break;
}
- if (i == 0)
- fore->w_kanji = n;
- else
- D_kanji = n;
+ if (i == 0 && fore)
+ {
+ WinSwitchEncoding(fore, n);
+ ResetCharsets(fore);
+ }
+ else if (i && display)
+ D_encoding = n;
}
- if (fore)
- ResetCharsets(fore);
break;
case RC_DEFKANJI:
- if (strcmp(*args, "jis") == 0 || strcmp(*args, "off") == 0)
- n = 0;
- else if (strcmp(*args, "euc") == 0)
- n = EUC;
- else if (strcmp(*args, "sjis") == 0)
- n = SJIS;
- else
+ case RC_DEFENCODING:
+ n = FindEncoding(*args);
+ if (n == -1)
+ {
+ Msg(0, "defencoding: unknown encoding '%s'", *args);
+ break;
+ }
+ nwin_default.encoding = n;
+ break;
+#endif
+
+#ifdef UTF8
+ case RC_DEFUTF8:
+ n = nwin_default.encoding == UTF8;
+ if (ParseSwitch(act, &n) == 0)
+ {
+ nwin_default.encoding = n ? UTF8 : 0;
+ if (msgok)
+ Msg(0, "Will %suse UTF-8 encoding for new windows", n ? "" : "not ");
+ }
+ break;
+ case RC_UTF8:
+ for (i = 0; i < 2; i++)
{
- Msg(0, "defkanji: illegal argument (%s)", *args);
+ if (i && args[i] == 0)
+ break;
+ if (args[i] == 0)
+ n = fore->w_encoding != UTF8;
+ else if (strcmp(args[i], "off") == 0)
+ n = 0;
+ else if (strcmp(args[i], "on") == 0)
+ n = 1;
+ else
+ {
+ Msg(0, "utf8: illegal argument (%s)", args[i]);
+ break;
+ }
+ if (i == 0)
+ {
+ WinSwitchEncoding(fore, n ? UTF8 : 0);
+ if (msgok)
+ Msg(0, "Will %suse UTF-8 encoding", n ? "" : "not ");
+ }
+ else if (display)
+ D_encoding = n ? UTF8 : 0;
+ if (args[i] == 0)
break;
}
- nwin_default.kanji = n;
break;
#endif
@@ -2761,7 +3309,7 @@ int key;
{
s = *args;
n = strlen(s);
- Process(&s, &n);
+ LayProcess(&s, &n);
}
break;
@@ -2805,14 +3353,15 @@ int key;
break;
}
n = strlen(*args);
- if (n == 0 || n > 6)
+ if (n == 0 || n > 7)
{
Msg(0, "%s: %s: string has illegal size.", rc_name, comms[nr].name);
break;
}
- if (n > 4 && (
- ((args[0][4] < '0' || args[0][4] > '3') && args[0][4] != '.') ||
- ((args[0][5] < '0' || args[0][5] > '3') && args[0][5] && args[0][5] != '.')))
+ if (n > 5 && (
+ ((args[0][5] < '0' || args[0][5] > '4') && args[0][5] != '.') ||
+ ((args[0][6] < '0' || args[0][6] > '4') && args[0][6] &&
+ args[0][6] != '.')))
{
Msg(0, "%s: %s: illegal mapping number.", rc_name, comms[nr].name);
break;
@@ -2827,40 +3376,53 @@ int key;
nwin_default.charset = SaveStr(*args);
break;
#endif
- case RC_SORENDITION:
- i = mchar_so.attr;
- if (*args && **args)
- {
- if (ParseBase(act, *args, &i, 16, "hex"))
- break;
- if (i < 0 || i >= (1 << NATTR))
- {
- Msg(0, "sorendition: bad standout attributes");
- break;
- }
- }
#ifdef COLOR
- n = mchar_so.color;
- if (*args && args[1])
+ case RC_ATTRCOLOR:
+ if (args[0][0] >= '0' && args[0][0] <= '9')
+ i = args[0][0] - '0';
+ else
+ for (i = 0; i < 8; i++)
+ if (args[0][0] == "dubrsBiI"[i])
+ break;
+ if (args[0][1] || i < 0 || i >= 8)
+ {
+ Msg(0, "%s: attrcolor: unknown attribute '%s'.", rc_name, args[0]);
+ break;
+ }
+ n = 0;
+ if (args[1])
+ n = ParseAttrColor(args[1], args[2], 1);
+ if (n == -1)
+ break;
+ attr2color[i] = n;
+ n = 0;
+ for (i = 0; i < 8; i++)
+ if (attr2color[i])
+ n |= 1 << i;
+ nattr2color = n;
+ break;
+#endif
+ case RC_SORENDITION:
+ i = 0;
+ if (*args)
{
- if (ParseBase(act, args[1], &n, 16, "hex"))
+ i = ParseAttrColor(*args, args[1], 1);
+ if (i == -1)
break;
- if (n < 0 || n > 0x99 || (n & 15) > 9)
- {
- Msg(0, "sorendition: bad standout color");
- break;
- }
- n = 0x99 - n;
+ ApplyAttrColor(i, &mchar_so);
}
- mchar_so.attr = i;
- mchar_so.color = n;
- Msg(0, "Standout attributes 0x%02x color 0x%02x", (unsigned char)mchar_so.attr, 0x99 - (unsigned char)mchar_so.color);
+ if (msgok)
+#ifdef COLOR
+ Msg(0, "Standout attributes 0x%02x color 0x%02x", (unsigned char)mchar_so.attr, 0x99 ^ (unsigned char)mchar_so.color);
#else
- mchar_so.attr = i;
- Msg(0, "Standout attributes 0x%02x", (unsigned char)mchar_so.attr);
+ Msg(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;
@@ -2896,20 +3458,66 @@ int key;
D_forecv->c_yoff = D_forecv->c_ys;
RethinkViewportOffsets(D_forecv);
ResizeLayer(D_forecv->c_layer, D_forecv->c_xe - D_forecv->c_xs + 1, D_forecv->c_ye - D_forecv->c_ys + 1, 0);
- /* XXX: only on canvas? */
flayer = D_forecv->c_layer;
- SetCursor();
+ LaySetCursor();
break;
case RC_FOCUS:
- D_forecv = D_forecv->c_next ? D_forecv->c_next : D_cvlist;
- D_fore = Layer2Window(D_forecv->c_layer);
- fore = D_fore;
+ if (!*args || !strcmp(*args, "down"))
+ D_forecv = D_forecv->c_next ? D_forecv->c_next : D_cvlist;
+ else if (!strcmp(*args, "up"))
+ {
+ struct canvas *cv;
+ for (cv = D_cvlist; cv->c_next && cv->c_next != D_forecv; cv = cv->c_next)
+ ;
+ D_forecv = cv;
+ }
+ else if (!strcmp(*args, "top"))
+ D_forecv = D_cvlist;
+ else if (!strcmp(*args, "bottom"))
+ {
+ struct canvas *cv;
+ for (cv = D_cvlist; cv->c_next; cv = cv->c_next)
+ ;
+ D_forecv = cv;
+ }
+ else
+ {
+ Msg(0, "%s: usage: focus [up|down|top|bottom]", rc_name);
+ break;
+ }
+ fore = D_fore = Layer2Window(D_forecv->c_layer);
+ flayer = D_forecv->c_layer;
+#ifdef RXVT_OSC
+ if (D_xtermosc[2] || D_xtermosc[3])
+ {
+ Activate(-1);
+ break;
+ }
+#endif
RefreshHStatus();
- /* XXX: only on canvas? */
+#ifdef RXVT_OSC
+ RefreshXtermOSC();
+#endif
flayer = D_forecv->c_layer;
- Restore();
- SetCursor();
+ CV_CALL(D_forecv, LayRestore();LaySetCursor());
+ WindowChanged(0, 'F');
break;
+ case RC_RESIZE:
+ if (*args)
+ ResizeRegions(*args);
+ else
+ Input("resize # lines: ", 20, INP_COOKED, ResizeFin, (char*)0);
+ break;
+ case RC_SETSID:
+ (void)ParseSwitch(act, &separate_sids);
+ break;
+ case RC_EVAL:
+ for (; *args; args++)
+ {
+ char *ss = SaveStr(*args);
+ RcLine(ss);
+ free(ss);
+ }
default:
#ifdef HAVE_BRAILLE
/* key == -2: input from braille keybord, msgok always 0 */
@@ -2917,6 +3525,12 @@ int key;
#endif
break;
}
+ if (display != odisplay)
+ {
+ for (display = displays; display; display = display->d_next)
+ if (display == odisplay)
+ break;
+ }
}
void
@@ -2964,7 +3578,7 @@ int
Parse(buf, args)
char *buf, **args;
{
- register char *p = buf, **ap = args;
+ register char *p = buf, **ap = args, *pp;
register int delim, argc;
argc = 0;
@@ -3023,12 +3637,18 @@ char *buf, **args;
return 0;
}
delim = 0;
- if (*p == '"' || *p == '\'')
- delim = *p++;
- *ap++ = p;
- while (*p && !(delim ? *p == delim : (*p == ' ' || *p == '\t')))
- ++p;
- if (*p == '\0')
+ *ap++ = pp = p;
+ while (*p && (delim || (*p != ' ' && *p != '\t')))
+ {
+ if (*p == delim)
+ delim = 0;
+ else if (!delim && (*p == '"' || *p == '\''))
+ delim = *p;
+ else
+ *pp++ = *p;
+ p++;
+ }
+ if (*p == 0)
{
if (delim)
{
@@ -3037,22 +3657,14 @@ char *buf, **args;
}
}
else
- *p++ = '\0';
+ p++;
+ *pp = 0;
}
}
-/*
- * buf is split into argument vector args.
- * leading whitespace is removed.
- * @!| abbreviations are expanded.
- * the end of buffer is recognized by '\0' or an un-escaped '#'.
- * " and ' are interpreted.
- *
- * argc is returned.
- */
int
ParseEscape(u, p)
-struct user *u;
+struct acluser *u;
char *p;
{
unsigned char buf[2];
@@ -3314,7 +3926,7 @@ char *p, *cp;
{
if (*p == 0)
return 0;
- if (*p == '^')
+ if (*p == '^' && p[1])
{
if (*++p == '?')
*cp = '\177';
@@ -3365,7 +3977,7 @@ char *s, *p;
return IsNum(s, base);
}
-static void
+void
SwitchWindow(n)
int n;
{
@@ -3547,6 +4159,7 @@ int norefresh;
if (fore->w_monitor != MON_OFF)
fore->w_monitor = MON_ON;
fore->w_bell = BELL_ON;
+ WindowChanged(fore, 'f');
#if 0
if (ResizeDisplay(fore->w_width, fore->w_height))
@@ -3565,7 +4178,7 @@ static int
NextWindow()
{
register struct win **pp;
- int n = fore ? fore->w_number : 0;
+ int n = fore ? fore->w_number : -1;
for (pp = wtab + n + 1; pp != wtab + n; pp++)
{
@@ -3603,7 +4216,7 @@ MoreWindows()
Msg(0, "No window available");
return 0;
}
- Msg(0, "No other window.", fore->w_number); /* other arg for nethack */
+ Msg(0, "No other window."+1-1, fore->w_number); /* other arg for nethack */
return 0;
}
@@ -3652,6 +4265,7 @@ struct win *wi;
FreeWindow(wi);
WindowChanged((struct win *)0, 'w');
WindowChanged((struct win *)0, 'W');
+ WindowChanged((struct win *)0, 0);
}
static void
@@ -3671,6 +4285,7 @@ int on;
Msg(0, "Logfile \"%s\" closed.", fore->w_log->name);
logfclose(fore->w_log);
fore->w_log = 0;
+ WindowChanged(fore, 'f');
return;
}
if (DoStartLog(fore, buf, sizeof(buf)))
@@ -3682,6 +4297,7 @@ int on;
Msg(0, "Creating logfile \"%s\".", fore->w_log->name);
else
Msg(0, "Appending to logfile \"%s\".", fore->w_log->name);
+ WindowChanged(fore, 'f');
}
char *
@@ -3696,7 +4312,7 @@ int where;
register char *cmd;
s = ss = buf;
- for (pp = wtab; pp < wtab + MAXWIN; pp++)
+ for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + MAXWIN; pp++)
{
if (pp - wtab == where && ss == buf)
ss = s;
@@ -3708,7 +4324,7 @@ int where;
cmd = p->w_title;
if (s - buf + strlen(cmd) > len - 24)
break;
- if (s > buf)
+ if (s > buf || (flags & 4))
{
*s++ = ' ';
*s++ = ' ';
@@ -3717,31 +4333,13 @@ int where;
if (p->w_number == where)
ss = s;
s += strlen(s);
-
if (display && p == D_fore)
*s++ = '*';
-
if (!(flags & 2))
{
- if (display && p == D_other)
+ if (display && p == D_other)
*s++ = '-';
- if (p->w_layer.l_cvlist && p->w_layer.l_cvlist->c_lnext)
- *s++ = '&';
- if (p->w_monitor == MON_DONE)
- *s++ = '@';
- if (p->w_bell == BELL_DONE)
- *s++ = '!';
-#ifdef UTMPOK
- if (p->w_slot != (slot_t) 0 && p->w_slot != (slot_t) -1)
- *s++ = '$';
-#endif
- if (p->w_log != 0)
- {
- strcpy(s, "(L)");
- s += 3;
- }
- if (p->w_ptyfd < 0)
- *s++ = 'Z';
+ s = AddWindowFlags(s, len, p);
}
*s++ = ' ';
strcpy(s, cmd);
@@ -3752,6 +4350,45 @@ int where;
}
char *
+AddWindowFlags(buf, len, p)
+char *buf;
+int len;
+struct win *p;
+{
+ char *s = buf;
+ if (p == 0 || len < 12)
+ {
+ *s = 0;
+ return s;
+ }
+#if 0
+ if (display && p == D_fore)
+ *s++ = '*';
+ if (display && p == D_other)
+ *s++ = '-';
+#endif
+ if (p->w_layer.l_cvlist && p->w_layer.l_cvlist->c_lnext)
+ *s++ = '&';
+ if (p->w_monitor == MON_DONE)
+ *s++ = '@';
+ if (p->w_bell == BELL_DONE)
+ *s++ = '!';
+#ifdef UTMPOK
+ if (p->w_slot != (slot_t) 0 && p->w_slot != (slot_t) -1)
+ *s++ = '$';
+#endif
+ if (p->w_log != 0)
+ {
+ strcpy(s, "(L)");
+ s += 3;
+ }
+ if (p->w_ptyfd < 0)
+ *s++ = 'Z';
+ *s = 0;
+ return s;
+}
+
+char *
AddOtherUsers(buf, len, p)
char *buf;
int len;
@@ -3791,7 +4428,7 @@ struct win *p;
}
*s = 0;
display = olddisplay;
- return buf;
+ return s;
}
void
@@ -3823,24 +4460,6 @@ int where;
}
static void
-ShowTime()
-{
- char buf[512];
- struct tm *tp;
- time_t now;
-
- (void) time(&now);
- tp = localtime(&now);
- sprintf(buf, "%2d:%02d:%02d %s", tp->tm_hour, tp->tm_min, tp->tm_sec,
- HostName);
-#ifdef LOADAV
- strcat(buf, " ");
- AddLoadav(buf + strlen(buf));
-#endif /* LOADAV */
- Msg(0, "%s", buf);
-}
-
-static void
ShowInfo()
{
char buf[512], *p;
@@ -3860,46 +4479,58 @@ ShowInfo()
#ifdef COPY_PASTE
sprintf(p += strlen(p), "+%d", wp->w_histheight);
#endif
- sprintf(p += strlen(p), " %c%sflow %cwrap",
+ sprintf(p += strlen(p), " %c%sflow",
(wp->w_flow & FLOW_NOW) ? '+' : '-',
(wp->w_flow & FLOW_AUTOFLAG) ? "" :
- ((wp->w_flow & FLOW_AUTO) ? "(+)" : "(-)"),
- wp->w_wrap ? '+' : '-');
+ ((wp->w_flow & FLOW_AUTO) ? "(+)" : "(-)"));
+ if (!wp->w_wrap) sprintf(p += strlen(p), " -wrap");
if (wp->w_insert) sprintf(p += strlen(p), " ins");
if (wp->w_origin) sprintf(p += strlen(p), " org");
if (wp->w_keypad) sprintf(p += strlen(p), " app");
if (wp->w_log) sprintf(p += strlen(p), " log");
if (wp->w_monitor != MON_OFF) 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
- if (D_CC0 || (D_CS0 && *D_CS0))
+# ifdef ENCODINGS
+ if (wp->w_encoding && (display == 0 || D_encoding != wp->w_encoding || EncodingDefFont(wp->w_encoding) <= 0))
{
- if (wp->w_gr)
- sprintf(p++, " G%c%c [", wp->w_Charset + '0', wp->w_CharsetR + '0');
- else
- sprintf(p, " G%c [", wp->w_Charset + '0');
- p += 5;
- for (i = 0; i < 4; i++)
- {
- if (wp->w_charsets[i] == ASCII)
- *p++ = 'B';
- else if (wp->w_charsets[i] >= ' ')
- *p++ = wp->w_charsets[i];
- else
- {
- *p++ = '^';
- *p++ = wp->w_charsets[i] ^ 0x40;
- }
- }
- *p++ = ']';
- *p = 0;
-#ifdef KANJI
- strcpy(p, wp->w_kanji == EUC ? " euc" : wp->w_kanji == SJIS ? " sjis" : "");
+ *p++ = ' ';
+ strcpy(p, EncodingName(wp->w_encoding));
p += strlen(p);
-#endif
}
+# ifdef UTF8
+ if (wp->w_encoding != UTF8)
+# endif
+# endif
+ if (D_CC0 || (D_CS0 && *D_CS0))
+ {
+ if (wp->w_gr)
+ sprintf(p++, " G%c%c[", wp->w_Charset + '0', wp->w_CharsetR + '0');
+ else
+ sprintf(p, " G%c[", wp->w_Charset + '0');
+ p += 4;
+ for (i = 0; i < 5; i++)
+ {
+ if (wp->w_charsets[i] == ASCII)
+ *p++ = 'B';
+ else if (wp->w_charsets[i] >= ' ')
+ *p++ = wp->w_charsets[i];
+ else
+ {
+ *p++ = '^';
+ *p++ = wp->w_charsets[i] ^ 0x40;
+ }
+ }
+ *p++ = ']';
+ *p = 0;
+ }
#endif
if (wp->w_type == W_TYPE_PLAIN)
@@ -3919,6 +4550,50 @@ ShowInfo()
}
static void
+ShowDInfo()
+{
+ char buf[512], *p;
+ if (display == 0)
+ return;
+ 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");
+ p += strlen(p);
+ }
+ else if (D_CS0 && *D_CS0)
+ {
+ strcpy(p, " altchar");
+ p += strlen(p);
+ }
+#endif
+ Msg(0, "%s", buf);
+}
+
+static void
AKAfin(buf, len, data)
char *buf;
int len;
@@ -3926,13 +4601,26 @@ char *data; /* dummy */
{
ASSERT(display);
if (len && fore)
- ChangeAKA(fore, buf, 20);
+ ChangeAKA(fore, buf, MAXAKA);
}
static void
InputAKA()
{
- Input("Set window's title to: ", 20, INP_COOKED, AKAfin, NULL);
+ char *s, *ss;
+ int n;
+ Input("Set window's title to: ", MAXAKA, INP_COOKED, AKAfin, NULL);
+ s = fore->w_title;
+ if (!s)
+ return;
+ for (; *s; s++)
+ {
+ if ((*(unsigned char *)s & 0x7f) < 0x20 || *s == 0x7f)
+ continue;
+ ss = s;
+ n = 1;
+ LayProcess(&ss, &n);
+ }
}
static void
@@ -4096,6 +4784,9 @@ char *fn, **av;
case '\0':
nwin.lflag = 1;
break;
+ case 'a':
+ nwin.lflag = 3;
+ break;
default:
break;
}
@@ -4232,17 +4923,20 @@ char *data; /* dummy */
free(pp->buf);
pp->buf = 0;
pp->len = 0;
- if (D_user->u_copylen)
+ if (D_user->u_plop.len)
{
- if ((pp->buf = (char *)malloc(D_user->u_copylen)) == NULL)
+ if ((pp->buf = (char *)malloc(D_user->u_plop.len)) == NULL)
{
Msg(0, strnomem);
return;
}
- bcopy(D_user->u_copybuffer, pp->buf, D_user->u_copylen);
+ bcopy(D_user->u_plop.buf, pp->buf, D_user->u_plop.len);
}
- pp->len = D_user->u_copylen;
- Msg(0, "Copied %d characters into register %c", D_user->u_copylen, *buf);
+ pp->len = D_user->u_plop.len;
+#ifdef ENCODING
+ pp->enc = D_user->u_plop.enc;
+#endif
+ Msg(0, "Copied %d characters into register %c", D_user->u_plop.len, *buf);
}
static void
@@ -4294,20 +4988,6 @@ char *data; /* dummy */
}
static void
-quit_fn(buf, len, data)
-char *buf;
-int len;
-char *data; /* dummy */
-{
- if (len || (*buf != 'y' && *buf != 'Y'))
- {
- *buf = 0;
- return;
- }
- Finit(0);
-}
-
-static void
confirm_fn(buf, len, data)
char *buf;
int len;
@@ -4328,7 +5008,7 @@ char *data; /* dummy */
#ifdef MULTIUSER
struct inputsu
{
- struct user **up;
+ struct acluser **up;
char name[24];
char pw1[130]; /* FreeBSD crypts to 128 bytes */
char pw2[130];
@@ -4369,7 +5049,7 @@ char *data;
static int
InputSu(w, up, name)
struct win *w;
-struct user **up;
+struct acluser **up;
char *name;
{
struct inputsu *i;
@@ -4394,7 +5074,7 @@ char *buf;
int len;
char *data;
{
- struct user *u = (struct user *)data;
+ struct acluser *u = (struct acluser *)data;
if (!*buf)
return;
@@ -4414,7 +5094,7 @@ char *data;
{
int st;
char salt[2];
- struct user *u = (struct user *)data;
+ struct acluser *u = (struct acluser *)data;
ASSERT(u);
if (!buf || strcmp(u->u_password, buf))
@@ -4444,13 +5124,16 @@ char *data;
u->u_password = SaveStr(buf);
bzero(buf, strlen(buf));
#ifdef COPY_PASTE
- if (u->u_copybuffer)
+ if (u->u_plop.buf)
UserFreeCopyBuffer(u);
- u->u_copylen = strlen(u->u_password);
- if (!(u->u_copybuffer = SaveStr(u->u_password)))
+ 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, strnomem);
- D_user->u_copylen = 0;
+ D_user->u_plop.len = 0;
}
else
Msg(0, "[ Password moved into copybuffer ]");
@@ -4474,6 +5157,19 @@ char *data; /* dummy */
{
if (ch < ' ' || ch == '\177')
return;
+ if (len >= 1 && ((*buf == 'U' && buf[1] == '+') || (*buf == '0' && (buf[1] == 'x' || buf[1] == 'X'))))
+ {
+ if (len == 1)
+ return;
+ if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f') && (ch < 'A' || ch > 'F'))
+ {
+ buf[len] = '\034'; /* ^] is ignored by Input() */
+ return;
+ }
+ if (len == (*buf == 'U' ? 5 : 3))
+ buf[len] = '\n';
+ return;
+ }
if (len && *buf == '0')
{
if (ch < '0' || ch > '7')
@@ -4493,7 +5189,22 @@ char *data; /* dummy */
len++;
if (len < 2)
return;
- if (buf[0] == '0')
+ if (len >= 1 && ((*buf == 'U' && buf[1] == '+') || (*buf == '0' && (buf[1] == 'x' || buf[1] == 'X'))))
+ {
+ x = 0;
+ for (i = 2; i < len; i++)
+ {
+ if (buf[i] >= '0' && buf[i] <= '9')
+ x = x * 16 | (buf[i] - '0');
+ else if (buf[i] >= 'a' && buf[i] <= 'f')
+ x = x * 16 | (buf[i] - ('a' - 10));
+ else if (buf[i] >= 'A' && buf[i] <= 'F')
+ x = x * 16 | (buf[i] - ('A' - 10));
+ else
+ break;
+ }
+ }
+ else if (buf[0] == '0')
{
x = 0;
for (i = 1; i < len; i++)
@@ -4518,8 +5229,12 @@ char *data; /* dummy */
}
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)
- Process(&buf, &i);
+ LayProcess(&buf, &i);
}
#ifdef MAPKEYS
@@ -4543,7 +5258,7 @@ int i;
fore = D_fore;
act = 0;
#ifdef COPY_PASTE
- if (InMark() || InInput())
+ if (InMark() || InInput() || InWList())
act = &mmtab[i];
#endif
if ((!act || act->nr == RC_ILLEGAL) && !D_mapdefault)
@@ -4579,13 +5294,14 @@ char *presel;
int i;
debug2("FindNiceWindow %d %s\n", wi ? wi->w_number : -1 , presel ? presel : "NULL");
- ASSERT(display);
if (presel)
{
i = WindowByNoN(presel);
if (i >= 0)
wi = wtab[i];
}
+ if (!display)
+ return wi;
#ifdef MULTIUSER
if (wi && AclCheckPermWin(D_user, ACL_READ, wi))
wi = 0;
@@ -4689,3 +5405,348 @@ char *str;
#endif
+static void
+ResizeRegions(arg)
+char *arg;
+{
+ struct canvas *cv;
+ int nreg, dsize, diff, siz;
+
+ ASSERT(display);
+ for (nreg = 0, cv = D_cvlist; cv; cv = cv->c_next)
+ nreg++;
+ if (nreg < 2)
+ {
+ Msg(0, "resize: need more than one region");
+ return;
+ }
+ dsize = D_height - (D_has_hstatus == HSTATUS_LASTLINE);
+ if (*arg == '=')
+ {
+ /* make all regions the same height */
+ int h = dsize;
+ int hh, i = 0;
+ for (cv = D_cvlist; cv; cv = cv->c_next)
+ {
+ hh = h / nreg-- - 1;
+ cv->c_ys = i;
+ cv->c_ye = i + hh - 1;
+ cv->c_yoff = i;
+ i += hh + 1;
+ h -= hh + 1;
+ }
+ RethinkDisplayViewports();
+ ResizeLayersToCanvases();
+ return;
+ }
+ siz = D_forecv->c_ye - D_forecv->c_ys + 1;
+ if (*arg == '+')
+ diff = atoi(arg + 1);
+ else if (*arg == '-')
+ diff = -atoi(arg + 1);
+ else if (!strcmp(arg, "min"))
+ diff = 1 - siz;
+ else if (!strcmp(arg, "max"))
+ diff = dsize - (nreg - 1) * 2 - 1 - siz;
+ else
+ diff = atoi(arg) - siz;
+ if (diff == 0)
+ return;
+ if (siz + diff < 1)
+ diff = 1 - siz;
+ if (siz + diff > dsize - (nreg - 1) * 2 - 1)
+ diff = dsize - (nreg - 1) * 2 - 1 - siz;
+ if (diff == 0 || siz + diff < 1)
+ return;
+
+ if (diff < 0)
+ {
+ if (D_forecv->c_next)
+ {
+ D_forecv->c_ye += diff;
+ D_forecv->c_next->c_ys += diff;
+ D_forecv->c_next->c_yoff += diff;
+ }
+ else
+ {
+ for (cv = D_cvlist; cv; cv = cv->c_next)
+ if (cv->c_next == D_forecv)
+ break;
+ ASSERT(cv);
+ cv->c_ye -= diff;
+ D_forecv->c_ys -= diff;
+ D_forecv->c_yoff -= diff;
+ }
+ }
+ else
+ {
+ int s, i = 0, found = 0, di = diff, d2;
+ s = dsize - (nreg - 1) * 2 - 1 - siz;
+ for (cv = D_cvlist; cv; i = cv->c_ye + 2, cv = cv->c_next)
+ {
+ if (cv == D_forecv)
+ {
+ cv->c_ye = i + (cv->c_ye - cv->c_ys) + diff;
+ cv->c_yoff -= cv->c_ys - i;
+ cv->c_ys = i;
+ found = 1;
+ continue;
+ }
+ s -= cv->c_ye - cv->c_ys;
+ if (!found)
+ {
+ if (s >= di)
+ continue;
+ d2 = di - s;
+ }
+ else
+ d2 = di > cv->c_ye - cv->c_ys ? cv->c_ye - cv->c_ys : di;
+ di -= d2;
+ cv->c_ye = i + (cv->c_ye - cv->c_ys) - d2;
+ cv->c_yoff -= cv->c_ys - i;
+ cv->c_ys = i;
+ }
+ }
+ RethinkDisplayViewports();
+ ResizeLayersToCanvases();
+}
+
+static void
+ResizeFin(buf, len, data)
+char *buf;
+int len;
+char *data;
+{
+ ResizeRegions(buf);
+}
+
+#ifdef RXVT_OSC
+void
+RefreshXtermOSC()
+{
+ int i;
+ struct win *p;
+
+ p = Layer2Window(D_forecv->c_layer);
+ for (i = 3; i >=0; i--)
+ SetXtermOSC(i, p ? p->w_xtermosc[i] : 0);
+}
+#endif
+
+int
+ParseAttrColor(s1, s2, msgok)
+char *s1, *s2;
+int msgok;
+{
+ int i, n;
+ char *s, *ss;
+ int r = 0;
+
+ s = s1;
+ while (*s == ' ')
+ s++;
+ ss = s;
+ while (*ss && *ss != ' ')
+ ss++;
+ while (*ss == ' ')
+ ss++;
+ if (*s && (s2 || *ss || !((*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || *s == '.')))
+ {
+ int mode = 0, n = 0;
+ if (*s == '+')
+ {
+ mode = 1;
+ s++;
+ }
+ else if (*s == '-')
+ {
+ mode = -1;
+ s++;
+ }
+ else if (*s == '!')
+ {
+ mode = 2;
+ s++;
+ }
+ else if (*s == '=')
+ s++;
+ if (*s >= '0' && *s <= '9')
+ {
+ n = *s++ - '0';
+ if (*s >= '0' && *s <= '9')
+ n = n * 16 + (*s++ - '0');
+ else if (*s >= 'a' && *s <= 'f')
+ n = n * 16 + (*s++ - ('a' - 10));
+ else if (*s >= 'A' && *s <= 'F')
+ n = n * 16 + (*s++ - ('A' - 10));
+ else if (*s && *s != ' ')
+ {
+ if (msgok)
+ Msg(0, "Illegal attribute hexchar '%c'", *s);
+ return -1;
+ }
+ }
+ else
+ {
+ while (*s && *s != ' ')
+ {
+ if (*s == 'd')
+ n |= A_DI;
+ else if (*s == 'u')
+ n |= A_US;
+ else if (*s == 'b')
+ n |= A_BD;
+ else if (*s == 'r')
+ n |= A_RV;
+ else if (*s == 's')
+ n |= A_SO;
+ else if (*s == 'B')
+ n |= A_BL;
+ else
+ {
+ if (msgok)
+ Msg(0, "Illegal attribute specifier '%c'", *s);
+ return -1;
+ }
+ s++;
+ }
+ }
+ if (*s && *s != ' ')
+ {
+ if (msgok)
+ Msg(0, "junk after attribute description: '%c'", *s);
+ return -1;
+ }
+ if (mode == -1)
+ r = n << 8 | n;
+ else if (mode == 1)
+ r = n << 8;
+ else if (mode == 2)
+ r = n;
+ else if (mode == 0)
+ r = 0xffff ^ n;
+ }
+ while (*s && *s == ' ')
+ s++;
+
+ if (s2)
+ {
+ if (*s)
+ {
+ if (msgok)
+ Msg(0, "junk after description: '%c'", *s);
+ return -1;
+ }
+ s = s2;
+ while (*s && *s == ' ')
+ s++;
+ }
+
+#ifdef COLOR
+ if (*s)
+ {
+ static char costr[] = "krgybmcw d i.01234567 9 f FKRGYBMCW I ";
+ int numco = 0, j;
+
+ n = 0;
+ if (*s == '.')
+ {
+ numco++;
+ n = 0x0f;
+ s++;
+ }
+ for (j = 0; j < 2 && *s && *s != ' '; j++)
+ {
+ for (i = 0; costr[i]; i++)
+ if (*s == costr[i])
+ break;
+ if (!costr[i])
+ {
+ if (msgok)
+ Msg(0, "illegal color descriptor: '%c'", *s);
+ return -1;
+ }
+ 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)
+ n |= 0x100; /* special invert mode */
+ if (*s && *s != ' ')
+ {
+ if (msgok)
+ Msg(0, "junk after color description: '%c'", *s);
+ return -1;
+ }
+ n ^= 0xff;
+ r |= n << 16;
+ }
+#endif
+
+ while (*s && *s == ' ')
+ s++;
+ if (*s)
+ {
+ if (msgok)
+ Msg(0, "junk after description: '%c'", *s);
+ return -1;
+ }
+ debug1("ParseAttrColor %06x\n", r);
+ return r;
+}
+
+/*
+ * Color coding:
+ * 0-7 normal colors
+ * 9 default color
+ * e just set intensity
+ * f don't change anything
+ * Intensity is encoded into bits 17(fg) and 18(bg).
+ */
+void
+ApplyAttrColor(i, mc)
+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);
+ if ((i & 0xe0) == 0xe0)
+ i = (i & 0x0f) | (mc->color & 0xf0);
+ mc->color = 0x99 ^ i;
+ debug2("ApplyAttrColor - %02x %02x\n", mc->attr, i);
+#endif
+}
diff --git a/pty.c b/pty.c
index 1dcb813..e9f19a0 100644
--- a/pty.c
+++ b/pty.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -121,19 +121,19 @@ int f;
}
void
-InitPty(f)
+InitPTY(f)
int f;
{
if (f < 0)
return;
#if defined(I_PUSH) && defined(HAVE_SVR4_PTYS) && !defined(sgi) && !defined(linux) && !defined(__osf__) && !defined(M_UNIX)
if (ioctl(f, I_PUSH, "ptem"))
- Panic(errno, "InitPty: cannot I_PUSH ptem");
+ Panic(errno, "InitPTY: cannot I_PUSH ptem");
if (ioctl(f, I_PUSH, "ldterm"))
- Panic(errno, "InitPty: cannot I_PUSH ldterm");
+ Panic(errno, "InitPTY: cannot I_PUSH ldterm");
# ifdef sun
if (ioctl(f, I_PUSH, "ttcompat"))
- Panic(errno, "InitPty: cannot I_PUSH ttcompat");
+ Panic(errno, "InitPTY: cannot I_PUSH ttcompat");
# endif
#endif
}
@@ -152,6 +152,7 @@ char **ttyn;
initmaster(f);
*ttyn = TtyName;
return f;
+}
#endif
/***************************************************************/
@@ -242,13 +243,16 @@ char **ttyn;
{
register int f;
char *m, *ptsname();
- int unlockpt __P((int)), grantpt __P((int)), getpt __P((void));
+ int unlockpt __P((int)), grantpt __P((int));
+#if defined(HAVE_GETPT) && defined(linux)
+ int getpt __P((void));
+#endif
sigret_t (*sigcld)__P(SIGPROTOARG);
-#ifdef HAVE_GETPT
+ strcpy(PtyName, "/dev/ptmx");
+#if defined(HAVE_GETPT) && defined(linux)
if ((f = getpt()) == -1)
#else
- strcpy(PtyName, "/dev/ptmx");
if ((f = open(PtyName, O_RDWR | O_NOCTTY)) == -1)
#endif
return -1;
diff --git a/putenv.c b/putenv.c
index 728cd4c..63a4458 100644
--- a/putenv.c
+++ b/putenv.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -72,14 +72,14 @@ char *realloc __P((char *, int));
void free __P((char *));
int sprintf __P((char *, char *, ...));
-#define EXTRASIZE 5 /* increment to add to env. size */
+#define EXTRASIZE 5 /* increment to add to env. size */
-static int envsize = -1; /* current size of environment */
-extern char **environ; /* the global which is your env. */
+static int envsize = -1; /* current size of environment */
+extern char **environ; /* the global which is your env. */
-static int findenv(); /* look for a name in the env. */
-static int newenv(); /* copy env. from stack to heap */
-static int moreenv(); /* incr. size of env. */
+static int findenv __P((char *)); /* look for a name in the env. */
+static int newenv __P((void)); /* copy env. from stack to heap */
+static int moreenv __P((void)); /* incr. size of env. */
int
unsetenv(name)
diff --git a/rcs.h b/rcs.h
index 2f69cd3..3ee9dc4 100644
--- a/rcs.h
+++ b/rcs.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
diff --git a/resize.c b/resize.c
index 2357643..8a45ece 100644
--- a/resize.c
+++ b/resize.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -43,13 +43,13 @@ RCS_ID("$Id: resize.c,v 1.5 1994/05/31 12:32:47 mlschroe Exp $ FAU")
static void CheckMaxSize __P((int));
static void FreeMline __P((struct mline *));
static int AllocMline __P((struct mline *ml, int));
-static void MakeBlankLine __P((char *, int));
+static void MakeBlankLine __P((unsigned char *, int));
static void kaablamm __P((void));
static int BcopyMline __P((struct mline *, int, struct mline *, int, int, int));
extern struct layer *flayer;
extern struct display *display, *displays;
-extern char *blank, *null;
+extern unsigned char *blank, *null;
extern struct mline mline_blank, mline_null, mline_old;
extern struct win *windows;
extern int Z0width, Z1width;
@@ -60,19 +60,22 @@ extern int captionalways;
#endif
static struct mline mline_zero = {
- (char *)0,
- (char *)0
+ (unsigned char *)0,
+ (unsigned char *)0
#ifdef FONT
- ,(char *)0
+ ,(unsigned char *)0
#endif
#ifdef COLOR
- ,(char *)0
+ ,(unsigned char *)0
+# ifdef COLORS256
+ ,(unsigned char *)0
+# endif
#endif
};
/*
* ChangeFlag: 0: try to modify no window
- * 1: modify fore (and try to modify no D_other) + redisplay
+ * 1: modify fore (and try to modify no other) + redisplay
* 2: modify all windows
*
* Note: Activate() is only called if change_flag == 1
@@ -128,8 +131,11 @@ int change_flag;
return;
}
ChangeScreenSize(wi, he, change_flag);
+/* XXX Redisplay logic */
+#if 0
if (change_flag == 1)
Redisplay(D_fore ? D_fore->w_norefresh : 0);
+#endif
}
void
@@ -153,10 +159,15 @@ int change_fore;
y = 0;
h = he;
if (D_has_hstatus == HSTATUS_LASTLINE)
- h--;
+ {
+ if (h > 1)
+ h--;
+ else
+ D_has_hstatus = 0; /* sorry */
+ }
for (cvpp = &D_cvlist; (cv = *cvpp); )
{
- if (h < 2)
+ if (h < 2 && cvpp != &D_cvlist)
{
/* kill canvas */
SetCanvasWindow(cv, 0);
@@ -171,7 +182,7 @@ int change_fore;
hn = 1;
if (hn + 2 >= h || cv->c_next == 0)
hn = h - 1;
- if (!captionalways && cv == D_cvlist && h - hn < 2)
+ if ((!captionalways && cv == D_cvlist && h - hn < 2) || hn == 0)
hn = h;
ASSERT(hn > 0);
cv->c_xs = 0;
@@ -246,6 +257,7 @@ ResizeLayersToCanvases()
int lx, ly;
debug("ResizeLayersToCanvases\n");
+ D_kaablamm = 0;
for (cv = D_cvlist; cv; cv = cv->c_next)
{
l = cv->c_layer;
@@ -303,6 +315,11 @@ ResizeLayersToCanvases()
}
}
Redisplay(0);
+ if (D_kaablamm)
+ {
+ kaablamm();
+ D_kaablamm = 0;
+ }
}
int
@@ -334,7 +351,6 @@ struct layer *l;
static void
kaablamm()
{
- /* this only works because of the status_delayed hack... */
Msg(0, "Aborted because of window size change.");
}
@@ -366,7 +382,7 @@ struct display *norefdisp;
{
flayer = cv->c_layer;
if (flayer->l_next)
- kaablamm();
+ d->d_kaablamm = 1;
while(flayer->l_next)
ExitOverlayPage();
}
@@ -374,13 +390,22 @@ struct display *norefdisp;
l = p->w_savelayer;
}
flayer = l;
- if (flayer->l_next)
- kaablamm();
- while(flayer->l_next)
- ExitOverlayPage();
+ if (p == 0 && flayer->l_next && flayer->l_next->l_next == 0 && LayResize(wi, he) == 0)
+ {
+ flayer = flayer->l_next;
+ LayResize(wi, he);
+ flayer = l;
+ }
+ else
+ {
+ if (flayer->l_next && display)
+ D_kaablamm = 1;
+ while(flayer->l_next)
+ ExitOverlayPage();
+ }
if (p)
flayer = &p->w_layer;
- Resize(wi, he);
+ LayResize(wi, he);
/* now everybody is on flayer, redisplay */
l = flayer;
for (display = displays; display; display = display->d_next)
@@ -389,7 +414,15 @@ struct display *norefdisp;
continue;
for (cv = D_cvlist; cv; cv = cv->c_next)
if (cv->c_layer == l)
- RefreshArea(cv->c_xs, cv->c_ys, cv->c_xe, cv->c_ye, 0);
+ {
+ CV_CALL(cv, LayRedisplayLine(-1, -1, -1, 0));
+ RefreshArea(cv->c_xs, cv->c_ys, cv->c_xe, cv->c_ye, 0);
+ }
+ if (D_kaablamm)
+ {
+ kaablamm();
+ D_kaablamm = 0;
+ }
}
flayer = oldflayer;
display = olddisplay;
@@ -411,6 +444,10 @@ struct mline *ml;
#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;
}
@@ -427,6 +464,9 @@ int w;
#endif
#ifdef COLOR
ml->color = null;
+# ifdef COLORS256
+ ml->colorx = null;
+# endif
#endif
if (ml->image == 0)
return -1;
@@ -441,34 +481,44 @@ int xf, xt, l, w;
{
int r = 0;
- bcopy(mlf->image + xf, mlt->image + xt, l);
+ bcopy((char *)mlf->image + xf, (char *)mlt->image + xt, l);
if (mlf->attr != null && mlt->attr == null)
{
- if ((mlt->attr = malloc(w)) == 0)
+ if ((mlt->attr = (unsigned char *)malloc(w)) == 0)
mlt->attr = null, r = -1;
- bzero(mlt->attr, w);
+ bzero((char *)mlt->attr, w);
}
if (mlt->attr != null)
- bcopy(mlf->attr + xf, mlt->attr + xt, l);
+ bcopy((char *)mlf->attr + xf, (char *)mlt->attr + xt, l);
#ifdef FONT
if (mlf->font != null && mlt->font == null)
{
- if ((mlt->font = malloc(w)) == 0)
+ if ((mlt->font = (unsigned char *)malloc(w)) == 0)
mlt->font = null, r = -1;
- bzero(mlt->font, w);
+ bzero((char *)mlt->font, w);
}
if (mlt->font != null)
- bcopy(mlf->font + xf, mlt->font + xt, l);
+ bcopy((char *)mlf->font + xf, (char *)mlt->font + xt, l);
#endif
#ifdef COLOR
if (mlf->color != null && mlt->color == null)
{
- if ((mlt->color = malloc(w)) == 0)
+ if ((mlt->color = (unsigned char *)malloc(w)) == 0)
mlt->color = null, r = -1;
- bzero(mlt->color, w);
+ bzero((char *)mlt->color, w);
}
if (mlt->color != null)
- bcopy(mlf->color + xf, mlt->color + xt, l);
+ bcopy((char *)mlf->color + xf, (char *)mlt->color + xt, l);
+# ifdef COLORS256
+ if (mlf->colorx != null && mlt->colorx == null)
+ {
+ if ((mlt->colorx = (unsigned char *)malloc(w)) == 0)
+ mlt->colorx = null, r = -1;
+ bzero((char *)mlt->colorx, w);
+ }
+ if (mlt->colorx != null)
+ bcopy((char *)mlf->colorx + xf, (char *)mlt->colorx + xt, l);
+# endif
#endif
return r;
}
@@ -480,7 +530,7 @@ static void
CheckMaxSize(wi)
int wi;
{
- char *oldnull = null;
+ unsigned char *oldnull = null;
struct win *p;
int i;
struct mline *ml;
@@ -490,39 +540,24 @@ int wi;
return;
maxwidth = wi;
debug1("New maxwidth: %d\n", maxwidth);
- if (blank == 0)
- blank = malloc((unsigned) maxwidth);
- else
- blank = xrealloc(blank, maxwidth);
- if (null == 0)
- null = malloc((unsigned) maxwidth);
- else
- null = xrealloc(null, maxwidth);
- if (mline_old.image == 0)
- mline_old.image = malloc((unsigned) maxwidth);
- else
- mline_old.image = xrealloc(mline_old.image, maxwidth);
- if (mline_old.attr == 0)
- mline_old.attr = malloc((unsigned) maxwidth);
- else
- mline_old.attr = xrealloc(mline_old.attr, maxwidth);
+ blank = (unsigned char *)xrealloc((char *)blank, maxwidth);
+ null = (unsigned char *)xrealloc((char *)null, maxwidth);
+ mline_old.image = (unsigned char *)xrealloc((char *)mline_old.image, maxwidth);
+ mline_old.attr = (unsigned char *)xrealloc((char *)mline_old.attr, maxwidth);
#ifdef FONT
- if (mline_old.font == 0)
- mline_old.font = malloc((unsigned) maxwidth);
- else
- mline_old.font = xrealloc(mline_old.font, maxwidth);
+ mline_old.font = (unsigned char *)xrealloc((char *)mline_old.font, maxwidth);
#endif
#ifdef COLOR
- if (mline_old.color == 0)
- mline_old.color = malloc((unsigned) maxwidth);
- else
- mline_old.color = xrealloc(mline_old.color, maxwidth);
+ mline_old.color = (unsigned char *)xrealloc((char *)mline_old.color, maxwidth);
+# ifdef COLORS256
+ mline_old.colorx = (unsigned char *)xrealloc((char *)mline_old.color, maxwidth);
+# endif
#endif
- if (!(blank && null && mline_old.image && mline_old.attr IFFONT(&& mline_old.font) IFCOLOR(&& mline_old.color)))
+ if (!(blank && null && mline_old.image && mline_old.attr IFFONT(&& mline_old.font) IFCOLOR(&& mline_old.color) IFCOLORX(&& mline_old.colorx)))
Panic(0, strnomem);
MakeBlankLine(blank, maxwidth);
- bzero(null, maxwidth);
+ bzero((char *)null, maxwidth);
mline_blank.image = blank;
mline_blank.attr = null;
@@ -535,6 +570,10 @@ int wi;
#ifdef COLOR
mline_blank.color = null;
mline_null.color = null;
+# ifdef COLORS256
+ mline_blank.colorx = null;
+ mline_null.colorx = null;
+# endif
#endif
/* We have to run through all windows to substitute
@@ -552,8 +591,12 @@ int wi;
ml->font = null;
#endif
#ifdef COLOR
- if (ml->color== oldnull)
+ if (ml->color == oldnull)
ml->color= null;
+#ifdef COLORS256
+ if (ml->colorx == oldnull)
+ ml->colorx = null;
+#endif
#endif
}
#ifdef COPY_PASTE
@@ -567,8 +610,12 @@ int wi;
ml->font = null;
# endif
# ifdef COLOR
- if (ml->color== oldnull)
+ if (ml->color == oldnull)
ml->color= null;
+# ifdef COLORS256
+ if (ml->colorx == oldnull)
+ ml->colorx = null;
+# endif
# endif
}
#endif
@@ -583,6 +630,8 @@ int len;
{
register char *nmem;
+ if (mem == 0)
+ return malloc(len);
if ((nmem = realloc(mem, len)))
return nmem;
free(mem);
@@ -591,7 +640,7 @@ int len;
static void
MakeBlankLine(p, n)
-register char *p;
+register unsigned char *p;
register int n;
{
while (n--)
@@ -630,6 +679,17 @@ int wi, he, hi;
if (wi == 0)
he = hi = 0;
+ if (wi > 1000)
+ {
+ Msg(0, "Window width too large, truncated");
+ wi = 1000;
+ }
+ if (he > 1000)
+ {
+ Msg(0, "Window height too large, truncated");
+ he = 1000;
+ }
+
if (p->w_width == wi && p->w_height == he && p->w_histheight == hi)
{
debug("ChangeWindowSize: No change.\n");
@@ -880,17 +940,8 @@ int wi, he, hi;
{
if (wi)
{
- if (p->w_tabs == 0)
- {
- /* tabs get wi+1 because 0 <= x <= wi */
- p->w_tabs = malloc((unsigned) wi + 1);
- t = 0;
- }
- else
- {
- p->w_tabs = xrealloc(p->w_tabs, wi + 1);
- t = p->w_width;
- }
+ t = p->w_tabs ? p->w_width : 0;
+ p->w_tabs = xrealloc(p->w_tabs, wi + 1);
if (p->w_tabs == 0)
{
nomem:
diff --git a/sched.c b/sched.c
index c45f08e..9e4b608 100644
--- a/sched.c
+++ b/sched.c
@@ -1,3 +1,30 @@
+/* Copyright (c) 1993-2002
+ * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
+ * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
+ * Copyright (c) 1987 Oliver Laumann
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING); if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ ****************************************************************
+ */
+
+#include "rcs.h"
+RCS_ID("$Id: sched.c,v 1.24 1994/09/06 17:00:20 mlschroe Exp $ FAU")
+
+
#include <sys/types.h>
#if !defined(sun) && !defined(B43) && !defined(ISC) && !defined(pyr) && !defined(_CX_UX)
# include <time.h>
@@ -189,7 +216,6 @@ sched()
* Sequents select emulation counts a descriptor which is
* readable and writeable only as one hit. Waaaaa.
*/
- debug2("nsel %d, was %d; ", nsel ? 2 * FD_SETSIZE : nsel, nsel);
if (nsel)
nsel = 2 * FD_SETSIZE;
#endif
@@ -252,7 +278,7 @@ static int sgihack()
{
if (errno == EINTR)
continue;
- SigHup(SIGARG); /* goodbye display */
+ Hangup(); /* goodbye display */
return 1;
}
display = display->d_next;
diff --git a/sched.h b/sched.h
index 853cee0..f9771bf 100644
--- a/sched.h
+++ b/sched.h
@@ -1,3 +1,26 @@
+/* Copyright (c) 1993-2002
+ * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
+ * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
+ * Copyright (c) 1987 Oliver Laumann
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING); if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ ****************************************************************
+ * $Id: sched.h,v 1.1.1.1 1993/06/16 23:51:13 jnweiger Exp $ FAU
+ */
struct event
{
diff --git a/screen.c b/screen.c
index 8c8c10b..912eabd 100644
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -75,6 +75,12 @@ RCS_ID("$Id: screen.c,v 1.24 1994/09/06 17:00:20 mlschroe Exp $ FAU")
#if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX)
# include <compat.h>
#endif
+#if defined(USE_LOCALE) || defined(ENCODINGS)
+# include <locale.h>
+#endif
+#if defined(HAVE_NL_LANGINFO) && defined(ENCODINGS)
+# include <langinfo.h>
+#endif
#include "screen.h"
#ifdef HAVE_BRAILLE
@@ -103,19 +109,14 @@ RCS_ID("$Id: screen.c,v 1.24 1994/09/06 17:00:20 mlschroe Exp $ FAU")
FILE *dfp;
#endif
-char bufferfile[MAXPATHLEN];
-extern char *blank, *null, Term[], screenterm[], **environ, Termcap[];
-int force_vt = 1, assume_LP = 0;
+extern char Term[], screenterm[], **environ, Termcap[];
+int force_vt = 1;
int VBellWait, MsgWait, MsgMinWait, SilenceWait;
-extern struct plop plop_tab[];
-extern struct user *users;
+extern struct acluser *users;
extern struct display *displays, *display;
-/* tty.c */
-extern int intrc;
-
extern int visual_bell;
#ifdef COPY_PASTE
@@ -184,8 +185,12 @@ char *PowDetachString;
#endif
char *hstatusstring;
char *captionstring;
+char *timestring;
+char *wliststr;
+char *wlisttit;
int auto_detach = 1;
int iflag, rflag, dflag, lsflag, quietflag, wipeflag, xflag;
+int cmdflag;
int adaptflag;
#ifdef MULTIUSER
@@ -205,6 +210,10 @@ int default_startup;
int ZombieKey_destroy, ZombieKey_resurrect;
char *preselect = NULL; /* only used in Attach() */
+#ifdef UTF8
+char *screenencodings;
+#endif
+
#ifdef NETHACK
int nethackflag = 0;
#endif
@@ -257,18 +266,18 @@ struct logfile *l;
/********************************************************************/
-struct passwd *
+static struct passwd *
getpwbyname(name, ppp)
char *name;
struct passwd *ppp;
{
- int n, len;
+ int n;
#ifdef SHADOWPW
struct spwd *sss = NULL;
static char *spw = NULL;
#endif
- if (!(ppp = getpwnam(name)))
+ if (!ppp && !(ppp = getpwnam(name)))
return NULL;
/* Do password sanity check..., allow ##user for SUN_C2 security */
@@ -276,19 +285,13 @@ struct passwd *ppp;
pw_try_again:
#endif
n = 0;
- len = 13;
if (ppp->pw_passwd[0] == '#' && ppp->pw_passwd[1] == '#' &&
strcmp(ppp->pw_passwd + 2, ppp->pw_name) == 0)
n = 13;
- else if (!strncmp(ppp->pw_passwd, "$1$", 3)) { /* MD5-based passwords */
- n = 13;
- len = 34;
- }
- for (; n < len; n++)
+ for (; n < 13; n++)
{
char c = ppp->pw_passwd[n];
- if (!(c == '.' || c == '/' ||
- (len == 34 && c == '$') ||
+ if (!(c == '.' || c == '/' || c == '$' ||
(c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z')))
@@ -389,7 +392,7 @@ char **av;
debug("NAMEDPIPE\n");
#endif
#if defined(SIGWINCH) && defined(TIOCGWINSZ)
- debug("Window changing enabled\n");
+ debug("Window size changing enabled\n");
#endif
#ifdef HAVE_SETREUID
debug("SETREUID\n");
@@ -429,6 +432,12 @@ char **av;
logtstamp_string = SaveStr("-- %n:%t -- time-stamp -- %M/%d/%y %c:%s --\n");
hstatusstring = SaveStr("%h");
captionstring = SaveStr("%3n %t");
+ timestring = SaveStr("%c:%s %M %d %H%? %l%?");
+ wlisttit = SaveStr("Num Name%=Flags");
+ wliststr = SaveStr("%3n %t%=%f");
+#ifdef COPY_PASTE
+ BufferFile = SaveStr(DEFAULT_BUFFERFILE);
+#endif
ShellProg = NULL;
#ifdef POW_DETACH
PowDetachString = 0;
@@ -446,6 +455,10 @@ char **av;
#ifdef COPY_PASTE
CompileKeys((char *)NULL, mark_key_tab);
#endif
+#ifdef UTF8
+ InitBuiltinTabs();
+ screenencodings = SaveStr(SCREENENCODINGS);
+#endif
nwin = nwin_undef;
nwin_options = nwin_undef;
strcpy(screenterm, "screen");
@@ -475,6 +488,10 @@ char **av;
ac--;
break;
}
+ if (ap[1] == '-' && !strcmp(ap, "--version"))
+ Panic(0, "Screen version %s", version);
+ if (ap[1] == '-' && !strcmp(ap, "--help"))
+ exit_with_usage(myname, NULL, NULL);
while (ap && *ap && *++ap)
{
switch (*ap)
@@ -521,7 +538,7 @@ char **av;
}
if (ParseEscape(NULL, ap))
Panic(0, "Two characters are required with -e option, not '%s'.", ap);
- ap += 3; /* estimated size of notation */
+ ap = NULL;
break;
case 'f':
ap++;
@@ -575,6 +592,9 @@ char **av;
case '1':
nwin_options.lflag = 1;
break;
+ case 'a':
+ nwin_options.lflag = 3;
+ break;
case 's': /* -ls */
case 'i': /* -list */
lsflag = 1;
@@ -674,9 +694,17 @@ char **av;
if (!*SockMatch)
exit_with_usage(myname, "Empty session-name?", NULL);
break;
+ case 'X':
+ cmdflag = 1;
+ break;
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);
}
@@ -685,13 +713,7 @@ char **av;
else
break;
}
- if (SockMatch && strlen(SockMatch) >= MAXSTR)
- Panic(0, "Ridiculously long socketname - try again.");
- if (dflag && mflag && !(rflag || xflag))
- detached = 1;
- nwin = nwin_options;
- if (ac)
- nwin.args = av;
+
real_uid = getuid();
real_gid = getgid();
eff_uid = geteuid();
@@ -708,6 +730,43 @@ char **av;
signal(SIGSEGV, CoreDump);
}
+#ifdef USE_LOCALE
+ setlocale(LC_ALL, "");
+#endif
+#ifdef ENCODINGS
+ if (nwin_options.encoding == -1)
+ {
+ /* ask locale if we should start in UTF-8 mode */
+# ifdef HAVE_NL_LANGINFO
+# ifndef USE_LOCALE
+ setlocale(LC_CTYPE, "");
+# endif
+ nwin_options.encoding = FindEncoding(nl_langinfo(CODESET));
+ debug1("locale says encoding = %d\n", nwin_options.encoding);
+# else
+# ifdef UTF8
+ char *s;
+ if (((s = getenv("LC_ALL")) || (s = getenv("LC_CTYPE")) ||
+ (s = getenv("LANG"))) && InStr(s, "UTF-8"))
+ nwin_options.encoding = UTF8;
+# endif
+ debug1("environment says encoding=%d\n", nwin_options.encoding);
+#endif
+ }
+#endif
+ if (SockMatch && strlen(SockMatch) >= MAXSTR)
+ Panic(0, "Ridiculously long socketname - try again.");
+ if (cmdflag && !rflag && !dflag && !xflag)
+ xflag = 1;
+ if (!cmdflag && dflag && mflag && !(rflag || xflag))
+ detached = 1;
+ nwin = nwin_options;
+#ifdef ENCODINGS
+ nwin.encoding = nwin_undef.encoding; /* let screenrc overwrite it */
+#endif
+ if (ac)
+ nwin.args = av;
+
/* make the write() calls return -1 on all errors */
#ifdef SIGXFSZ
/*
@@ -819,7 +878,7 @@ char **av;
Panic(0, "$HOME too long - sorry.");
attach_tty = "";
- if (!detached && !lsflag && !(dflag && !mflag && !rflag && !xflag))
+ if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag))
{
/* ttyname implies isatty */
if (!(attach_tty = ttyname(0)))
@@ -844,8 +903,7 @@ char **av;
DebugTTY(&attach_Mode);
#endif /* DEBUG */
}
-
- snprintf(bufferfile,sizeof(bufferfile),"%s/.screen-exchange", home);
+
#ifdef _MODE_T
oumask = umask(0); /* well, unsigned never fails? jw. */
#else
@@ -906,14 +964,14 @@ char **av;
SockDir = SOCKDIR;
if (lstat(SockDir, &st))
{
- n = (eff_uid == 0) ? 0755 :
+ n = (eff_uid == 0 && (real_uid || eff_gid == real_gid)) ? 0755 :
(eff_gid != real_gid) ? 0775 :
#ifdef S_ISVTX
0777|S_ISVTX;
#else
0777;
#endif
- if (mkdir(SockDir, eff_uid ? 0777 : 0755) == -1)
+ if (mkdir(SockDir, n) == -1)
Panic(errno, "Cannot make directory '%s'", SockDir);
}
else
@@ -922,8 +980,8 @@ char **av;
Panic(0, "'%s' must be a directory.", SockDir);
if (eff_uid == 0 && real_uid && st.st_uid != eff_uid)
Panic(0, "Directory '%s' must be owned by root.", SockDir);
- n = (eff_gid == st.st_gid && eff_gid != real_gid) ? 0775 :
- (eff_uid == 0 && (real_uid || (st.st_mode & 0777) != 0777)) ? 0755 :
+ n = (eff_uid == 0 && (real_uid || (st.st_mode & 0775) != 0775)) ? 0755 :
+ (eff_gid == st.st_gid && eff_gid != real_gid) ? 0775 :
0777;
if ((st.st_mode & 0777) != n)
Panic(0, "Directory '%s' must have mode %03o.", SockDir, n);
@@ -983,8 +1041,8 @@ char **av;
if (multi)
real_uid = multi_uid;
#endif
- setuid(real_uid);
setgid(real_gid);
+ setuid(real_uid);
eff_uid = real_uid;
eff_gid = real_gid;
i = FindSocket((int *)NULL, &fo, &oth, SockMatch);
@@ -996,7 +1054,31 @@ char **av;
/* NOTREACHED */
}
signal(SIG_BYE, AttacherFinit); /* prevent races */
- if (rflag || xflag)
+ if (cmdflag)
+ {
+ char *sty = 0;
+
+ /* attach_tty is not mandatory */
+ if ((attach_tty = ttyname(0)) == 0)
+ attach_tty = "";
+ if (strlen(attach_tty) >= MAXPATHLEN)
+ Panic(0, "TtyName too long - sorry.");
+ if (!*av)
+ Panic(0, "Please specify a command.");
+ setgid(real_gid);
+ setuid(real_uid);
+ eff_uid = real_uid;
+ eff_gid = real_gid;
+ if (!mflag && !SockMatch)
+ {
+ sty = getenv("STY");
+ if (sty && *sty == 0)
+ sty = 0;
+ }
+ SendCmdMessage(sty, SockMatch, av);
+ exit(0);
+ }
+ else if (rflag || xflag)
{
debug("screen -r: - is there anybody out there?\n");
if (Attach(MSG_ATTACH))
@@ -1004,6 +1086,10 @@ char **av;
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)
@@ -1019,8 +1105,8 @@ char **av;
if ((sty = getenv("STY")) != 0 && *sty != '\0')
{
- setuid(real_uid);
setgid(real_gid);
+ setuid(real_uid);
eff_uid = real_uid;
eff_gid = real_gid;
nwin_options.args = av;
@@ -1031,11 +1117,6 @@ char **av;
}
nwin_compose(&nwin_default, &nwin_options, &nwin_default);
- if (DefaultEsc == -1)
- DefaultEsc = Ctrl('a');
- if (DefaultMetaEsc == -1)
- DefaultMetaEsc = 'a';
-
if (!detached || dflag != 2)
MasterPid = fork();
else
@@ -1046,16 +1127,9 @@ char **av;
case -1:
Panic(errno, "fork");
/* NOTREACHED */
-#ifdef FORKDEBUG
- default:
- break;
- case 0:
- MasterPid = getppid();
-#else
case 0:
break;
default:
-#endif
if (detached)
exit(0);
if (SockMatch)
@@ -1070,14 +1144,19 @@ char **av;
socknamebuf[NAME_MAX] = 0;
#endif
sprintf(SockPath + strlen(SockPath), "/%s", socknamebuf);
- setuid(real_uid);
setgid(real_gid);
+ setuid(real_uid);
eff_uid = real_uid;
eff_gid = real_gid;
Attacher();
/* NOTREACHED */
}
+ if (DefaultEsc == -1)
+ DefaultEsc = Ctrl('a');
+ if (DefaultMetaEsc == -1)
+ DefaultMetaEsc = 'a';
+
ap = av0 + strlen(av0) - 1;
while (ap >= av0)
{
@@ -1126,16 +1205,16 @@ char **av;
* start detached. From now on we should not refer to 'LoginName'
* any more, use users->u_name instead.
*/
- if (UserAdd(LoginName, (char *)0, (struct user **)0) < 0)
+ if (UserAdd(LoginName, (char *)0, (struct acluser **)0) < 0)
Panic(0, "Could not create user info");
if (!detached)
{
-#ifdef FORKDEBUG
- if (MakeDisplay(LoginName, attach_tty, attach_term, n, MasterPid, &attach_Mode) == 0)
-#else
if (MakeDisplay(LoginName, attach_tty, attach_term, n, getppid(), &attach_Mode) == 0)
-#endif
Panic(0, "Could not alloc display");
+#ifdef ENCODINGS
+ D_encoding = nwin_options.encoding > 0 ? nwin_options.encoding : 0;
+ debug1("D_encoding = %d\n", D_encoding);
+#endif
}
if (SockMatch)
@@ -1211,7 +1290,7 @@ char **av;
if (display)
{
brktty(D_userfd);
- SetMode(&D_OldMode, &D_NewMode, display->d_flow, iflag);
+ SetMode(&D_OldMode, &D_NewMode, D_flow, iflag);
/* Note: SetMode must be called _before_ FinishRc. */
SetTTY(D_userfd, &D_NewMode);
if (fcntl(D_userfd, F_SETFL, FNBLOCK))
@@ -1304,6 +1383,7 @@ struct win *p;
p->w_y = MFindUsedLine(p, p->w_bot, 1);
sprintf(buf, "\n\r=== Window terminated (%s) ===", s ? s : "?");
WriteString(p, buf, strlen(buf));
+ WindowChanged(p, 'f');
}
else
KillWindow(p);
@@ -1353,18 +1433,9 @@ SigChld SIGDEFARG
sigret_t
SigHup SIGDEFARG
{
- if (display == 0)
- return;
- debug("SigHup()\n");
- if (D_userfd >= 0)
- {
- close(D_userfd);
- D_userfd = -1;
- }
- if (auto_detach || displays->d_next)
- Detach(D_DETACH);
- else
- Finit(0);
+ /* Hangup all displays */
+ while ((display = displays) != 0)
+ Hangup();
SIGRETURN;
}
@@ -1377,14 +1448,19 @@ static sigret_t
SigInt SIGDEFARG
{
#if HAZARDOUS
- char buf[1];
+ char ibuf;
debug("SigInt()\n");
- *buf = (char) intrc;
- if (fore)
- fore->w_inlen = 0;
- if (fore)
- write(fore->w_ptyfd, buf, 1);
+ if (fore && displays)
+ {
+# if defined(TERMIO) || defined(POSIX)
+ ibuf = displays->d_OldMode.tio.c_cc[VINTR];
+# else
+ ibuf = displays->d_OldMode.m_tchars.t_intrc;
+# endif
+ fore->w_inlen = 0;
+ write(fore->w_ptyfd, &ibuf, 1);
+ }
#else
signal(SIGINT, SigInt);
debug("SigInt() careful\n");
@@ -1586,16 +1662,34 @@ int e;
if (ServerSocket != -1)
{
debug1("we unlink(%s)\n", SockPath);
- setuid(real_uid);
setgid(real_gid);
+ setuid(real_uid);
(void) unlink(SockPath);
}
exit(e);
}
+void
+Hangup()
+{
+ if (display == 0)
+ return;
+ debug1("Hangup %x\n", display);
+ if (D_userfd >= 0)
+ {
+ close(D_userfd);
+ D_userfd = -1;
+ }
+ if (auto_detach || displays->d_next)
+ Detach(D_HANGUP);
+ else
+ Finit(0);
+}
+
/*
* Detach now has the following modes:
*D_DETACH SIG_BYE detach backend and exit attacher
+ *D_HANGUP SIG_BYE detach backend and exit attacher
*D_STOP SIG_STOP stop attacher (and detach backend)
*D_REMOTE SIG_BYE remote detach -- reattach to new attacher
*D_POWER SIG_POWER_BYE power detach -- attacher kills his parent
@@ -1621,8 +1715,13 @@ int mode;
if (D_status)
RemoveStatus();
FinitTerm();
+ if (!display)
+ return;
switch (mode)
{
+ case D_HANGUP:
+ sign = SIG_BYE;
+ break;
case D_DETACH:
AddStr("[detached]\r\n");
sign = SIG_BYE;
@@ -1661,7 +1760,7 @@ int mode;
#endif
#endif
case D_LOCK:
- ClearDisplay();
+ ClearAll();
sign = SIG_LOCK;
/* tell attacher to lock terminal with a lockprg. */
break;
@@ -1671,7 +1770,7 @@ int mode;
{
for (p = windows; p; p = p->w_next)
{
- if (p->w_slot != (slot_t) -1)
+ if (p->w_slot != (slot_t) -1 && !(p->w_lflag & 2))
{
RemoveUtmp(p);
/*
@@ -1682,7 +1781,8 @@ int mode;
}
}
}
- RestoreLoginSlot();
+ if (mode != D_HANGUP)
+ RestoreLoginSlot();
#endif
if (displays->d_next == 0 && console_window)
{
@@ -1909,34 +2009,91 @@ VA_DECL
*
*/
+#ifndef USE_LOCALE
static const char days[] = "SunMonTueWedThuFriSat";
static const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
+#endif
+
+static char winmsg_buf[MAXSTR];
+#define MAX_WINMSG_REND 16 /* rendition changes */
+static int winmsg_rend[MAX_WINMSG_REND];
+static int winmsg_rendpos[MAX_WINMSG_REND];
+static int winmsg_numrend;
+
+static char *
+pad_expand(buf, p, numpad, padlen)
+char *buf;
+char *p;
+int numpad;
+int padlen;
+{
+ char *pn, *pn2;
+ int i, r;
+
+ padlen = padlen - (p - buf); /* space for rent */
+ if (padlen < 0)
+ padlen = 0;
+ pn2 = pn = p + padlen;
+ r = winmsg_numrend;
+ while (p >= buf)
+ {
+ if (r && p - buf == winmsg_rendpos[r - 1])
+ {
+ winmsg_rendpos[--r] = pn - buf;
+ continue;
+ }
+ *pn-- = *p;
+ if (*p-- == 127)
+ {
+ pn[1] = ' ';
+ i = numpad > 0 ? (padlen + numpad - 1) / numpad : 0;
+ padlen -= i;
+ while (i-- > 0)
+ *pn-- = ' ';
+ numpad--;
+ }
+ }
+ return pn2;
+}
char *
-MakeWinMsgEv(str, win, esc, ev)
+MakeWinMsgEv(str, win, esc, padlen, ev)
char *str;
struct win *win;
int esc;
+int padlen;
struct event *ev;
{
- static char buf[MAXSTR];
static int tick;
char *s = str;
- register char *p = buf;
+ register char *p = winmsg_buf;
register int ctrl;
struct timeval now;
struct tm *tm;
- int l;
+ int l, i, r;
int num;
int zeroflg;
- int qmflag = 0, omflag = 0;
+ int longflg;
+ int minusflg;
+ int plusflg;
+ int qmflag = 0, omflag = 0, qmnumrend = 0;
char *qmpos = 0;
+ int numpad = 0;
+ int lastpad = 0;
+ int truncpos = -1;
+ int truncper = 0;
+ int trunclong = 0;
+ if (winmsg_numrend >= 0)
+ winmsg_numrend = 0;
+ else
+ winmsg_numrend = -winmsg_numrend;
+
tick = 0;
tm = 0;
ctrl = 0;
gettimeofday(&now, NULL);
- for (; *s && (l = buf + MAXSTR - 1 - p) > 0; s++, p++)
+ for (; *s && (l = winmsg_buf + MAXSTR - 1 - p) > 0; s++, p++)
{
*p = *s;
if (ctrl)
@@ -1969,11 +2126,17 @@ struct event *ev;
}
if (*++s == esc) /* double escape ? */
continue;
+ if ((plusflg = *s == '+') != 0)
+ s++;
+ if ((minusflg = *s == '-') != 0)
+ s++;
if ((zeroflg = *s == '0') != 0)
s++;
num = 0;
while(*s >= '0' && *s <= '9')
num = num * 10 + (*s++ - '0');
+ if ((longflg = *s == 'L') != 0)
+ s++;
switch (*s)
{
case '?':
@@ -1981,11 +2144,16 @@ struct event *ev;
if (qmpos)
{
if ((!qmflag && !omflag) || omflag == 1)
- p = qmpos;
+ {
+ p = qmpos;
+ if (qmnumrend < winmsg_numrend)
+ winmsg_numrend = qmnumrend;
+ }
qmpos = 0;
break;
}
qmpos = p;
+ qmnumrend = winmsg_numrend;
qmflag = omflag = 0;
break;
case ':':
@@ -1996,10 +2164,13 @@ struct event *ev;
{
omflag = 1;
qmpos = p;
+ qmnumrend = winmsg_numrend;
}
else
{
p = qmpos;
+ if (qmnumrend < winmsg_numrend)
+ winmsg_numrend = qmnumrend;
omflag = -1;
}
break;
@@ -2008,7 +2179,10 @@ struct event *ev;
if (l < 4)
break;
if (tm == 0)
- tm = localtime(&now.tv_sec);
+ {
+ time_t nowsec = now.tv_sec;
+ tm = localtime(&nowsec);
+ }
qmflag = 1;
switch (*s)
{
@@ -2017,7 +2191,11 @@ struct event *ev;
tick |= 4;
break;
case 'D':
+#ifdef USE_LOCALE
+ strftime(p, l, (longflg ? "%A" : "%a"), tm);
+#else
sprintf(p, "%3.3s", days + 3 * tm->tm_wday);
+#endif
tick |= 4;
break;
case 'm':
@@ -2025,7 +2203,11 @@ struct event *ev;
tick |= 4;
break;
case 'M':
+#ifdef USE_LOCALE
+ strftime(p, l, (longflg ? "%B" : "%b"), tm);
+#else
sprintf(p, "%3.3s", months + 3 * tm->tm_mon);
+#endif
tick |= 4;
break;
case 'y':
@@ -2084,16 +2266,20 @@ struct event *ev;
p--;
else
{
- char savebuf[sizeof(buf)];
+ char savebuf[sizeof(winmsg_buf)];
int oldtick = tick;
+ int oldnumrend = winmsg_numrend;
*p = 0;
- strcpy(savebuf, buf);
+ strcpy(savebuf, winmsg_buf);
+ winmsg_numrend = -winmsg_numrend;
MakeWinMsg(win->w_hstatus, win, '\005');
tick |= oldtick; /* small hack... */
- if (strlen(buf) < l)
- strcat(savebuf, buf);
- strcpy(buf, savebuf);
+ if (strlen(winmsg_buf) < l)
+ strcat(savebuf, winmsg_buf);
+ strcpy(winmsg_buf, savebuf);
+ while (oldnumrend < winmsg_numrend)
+ winmsg_rendpos[oldnumrend++] += p - winmsg_buf;
if (*p)
qmflag = 1;
p += strlen(p) - 1;
@@ -2103,12 +2289,16 @@ struct event *ev;
case 'W':
{
struct win *oldfore = 0;
+ char *ss;
+
if (display)
{
oldfore = D_fore;
D_fore = win;
}
- AddWindows(p, l - 1, *s == 'w' ? 2 : 3, -1);
+ ss = AddWindows(p, l - 1, (*s == 'w' ? 0 : 1) | (longflg ? 0 : 2) | (plusflg ? 4 : 0), win ? win->w_number : -1);
+ if (minusflg)
+ *ss = 0;
if (display)
D_fore = oldfore;
}
@@ -2124,6 +2314,14 @@ struct event *ev;
qmflag = 1;
p += strlen(p) - 1;
break;
+ case 'f':
+ *p = 0;
+ if (win)
+ AddWindowFlags(p, l - 1, win);
+ if (*p)
+ qmflag = 1;
+ p += strlen(p) - 1;
+ break;
case 't':
*p = 0;
if (win && strlen(win->w_title) < l)
@@ -2134,6 +2332,168 @@ struct event *ev;
}
p += strlen(p) - 1;
break;
+ case '{':
+ {
+ char rbuf[128];
+ s++;
+ for (i = 0; i < 127; i++)
+ if (s[i] && s[i] != '}')
+ rbuf[i] = s[i];
+ else
+ break;
+ if (s[i] == '}' && winmsg_numrend < MAX_WINMSG_REND)
+ {
+ r = -1;
+ rbuf[i] = 0;
+ debug1("MakeWinMsg attrcolor %s\n", rbuf);
+ if (i != 1 || rbuf[0] != '-')
+ r = ParseAttrColor(rbuf, (char *)0, 0);
+ if (r != -1 || (i == 1 && rbuf[0] == '-'))
+ {
+ winmsg_rend[winmsg_numrend] = r;
+ winmsg_rendpos[winmsg_numrend] = p - winmsg_buf;
+ winmsg_numrend++;
+ }
+ }
+ s += i;
+ p--;
+ }
+ break;
+ case 'H':
+ *p = 0;
+ if (strlen(HostName) < l)
+ {
+ strcpy(p, HostName);
+ if (*p)
+ qmflag = 1;
+ }
+ p += strlen(p) - 1;
+ break;
+ case 'F':
+ p--;
+ /* small hack */
+ if ((ev && ev == &D_forecv->c_captev) || (!ev && win && win == D_fore))
+ qmflag = 1;
+ break;
+ case '>':
+ truncpos = p - winmsg_buf;
+ truncper = num > 100 ? 100 : num;
+ trunclong = longflg;
+ p--;
+ break;
+ case '=':
+ case '<':
+ *p = ' ';
+ if (num || zeroflg || plusflg || longflg || (*s != '='))
+ {
+ /* expand all pads */
+ if (minusflg)
+ {
+ num = (plusflg ? lastpad : padlen) - num;
+ if (!plusflg && padlen == 0)
+ num = p - winmsg_buf;
+ plusflg = 0;
+ }
+ else if (!zeroflg)
+ {
+ if (*s != '=' && num == 0 && !plusflg)
+ num = 100;
+ if (num > 100)
+ num = 100;
+ if (padlen == 0)
+ num = p - winmsg_buf;
+ else
+ num = (padlen - (plusflg ? lastpad : 0)) * num / 100;
+ }
+ if (num < 0)
+ num = 0;
+ if (plusflg)
+ num += lastpad;
+ if (num > MAXSTR - 1)
+ num = MAXSTR - 1;
+ if (numpad)
+ p = pad_expand(winmsg_buf, p, numpad, num);
+ numpad = 0;
+ if (p - winmsg_buf > num && !longflg)
+ {
+ int left, trunc;
+
+ if (truncpos == -1)
+ {
+ truncpos = lastpad;
+ truncper = 0;
+ }
+ trunc = lastpad + truncper * (num - lastpad) / 100;
+ if (trunc > num)
+ trunc = num;
+ if (trunc < lastpad)
+ trunc = lastpad;
+ left = truncpos - trunc;
+ if (left > p - winmsg_buf - num)
+ left = p - winmsg_buf - num;
+ debug3("truncpos = %d, trunc = %d, left = %d\n", truncpos, trunc, left);
+ if (left > 0)
+ {
+ if (left + lastpad > p - winmsg_buf)
+ left = p - winmsg_buf - lastpad;
+ if (p - winmsg_buf - lastpad - left > 0)
+ bcopy(winmsg_buf + lastpad + left, winmsg_buf + lastpad, p - winmsg_buf - lastpad - left);
+ p -= left;
+ r = winmsg_numrend;
+ while (r && winmsg_rendpos[r - 1] > lastpad)
+ {
+ r--;
+ winmsg_rendpos[r] -= left;
+ if (winmsg_rendpos[r] < lastpad)
+ winmsg_rendpos[r] = lastpad;
+ }
+ if (trunclong)
+ {
+ if (p - winmsg_buf > lastpad)
+ winmsg_buf[lastpad] = '.';
+ if (p - winmsg_buf > lastpad + 1)
+ winmsg_buf[lastpad + 1] = '.';
+ if (p - winmsg_buf > lastpad + 2)
+ winmsg_buf[lastpad + 2] = '.';
+ }
+ }
+ if (p - winmsg_buf > num)
+ {
+ p = winmsg_buf + num;
+ if (trunclong)
+ {
+ if (num - 1 >= lastpad)
+ p[-1] = '.';
+ if (num - 2 >= lastpad)
+ p[-2] = '.';
+ if (num - 3 >= lastpad)
+ p[-3] = '.';
+ }
+ r = winmsg_numrend;
+ while (r && winmsg_rendpos[r - 1] > num)
+ winmsg_rendpos[--r] = num;
+ }
+ truncpos = -1;
+ trunclong = 0;
+ if (lastpad > p - winmsg_buf)
+ lastpad = p - winmsg_buf;
+ }
+ if (*s == '=')
+ {
+ while (p - winmsg_buf < num)
+ *p++ = ' ';
+ lastpad = p - winmsg_buf;
+ truncpos = -1;
+ trunclong = 0;
+ }
+ p--;
+ }
+ else if (padlen)
+ {
+ *p = 127; /* internal pad representation */
+ numpad++;
+ }
+ break;
case 'n':
s++;
/* FALLTHROUGH */
@@ -2156,6 +2516,12 @@ struct event *ev;
if (qmpos && !qmflag)
p = qmpos + 1;
*p = '\0';
+ if (numpad)
+ {
+ if (padlen > MAXSTR - 1)
+ padlen = MAXSTR - 1;
+ p = pad_expand(winmsg_buf, p, numpad, padlen);
+ }
if (ev)
{
evdeq(ev); /* just in case */
@@ -2173,7 +2539,7 @@ struct event *ev;
now.tv_sec += 3600 - (now.tv_sec % 3600);
ev->timeout = now;
}
- return buf;
+ return winmsg_buf;
}
char *
@@ -2182,12 +2548,77 @@ char *s;
struct win *win;
int esc;
{
- return MakeWinMsgEv(s, win, esc, (struct event *)0);
+ return MakeWinMsgEv(s, win, esc, 0, (struct event *)0);
+}
+
+int
+PutWinMsg(s, start, max)
+char *s;
+int start, max;
+{
+ int i, p, l, r, n;
+ struct mchar rend;
+ struct mchar rendstack[MAX_WINMSG_REND];
+ int rendstackn = 0;
+
+ if (s != winmsg_buf)
+ return 0;
+ rend = D_rend;
+ p = 0;
+ l = strlen(s);
+ debug2("PutWinMsg %s start attr %x\n", s, rend.attr);
+ for (i = 0; i < winmsg_numrend && max > 0; i++)
+ {
+ if (p > winmsg_rendpos[i] || winmsg_rendpos[i] > l)
+ break;
+ if (p < winmsg_rendpos[i])
+ {
+ n = winmsg_rendpos[i] - p;
+ if (n > max)
+ n = max;
+ max -= n;
+ p += n;
+ while(n-- > 0)
+ {
+ if (start-- > 0)
+ s++;
+ else
+ PUTCHARLP(*s++);
+ }
+ }
+ r = winmsg_rend[i];
+ if (r == -1)
+ {
+ if (rendstackn > 0)
+ rend = rendstack[--rendstackn];
+ }
+ else
+ {
+ rendstack[rendstackn++] = rend;
+ ApplyAttrColor(r, &rend);
+ }
+ SetRendition(&rend);
+ }
+ if (p < l)
+ {
+ n = l - p;
+ if (n > max)
+ n = max;
+ while(n-- > 0)
+ {
+ if (start-- > 0)
+ s++;
+ else
+ PUTCHARLP(*s++);
+ }
+ }
+ return 1;
}
void
-DisplaySleep(n)
+DisplaySleep(n, eat)
int n;
+int eat;
{
char buf;
fd_set r;
@@ -2206,9 +2637,10 @@ int n;
if (select(FD_SETSIZE, &r, (fd_set *)0, (fd_set *)0, &t) > 0)
{
debug("display activity stopped sleep\n");
- read(D_userfd, &buf, 1);
+ if (eat)
+ read(D_userfd, &buf, 1);
}
- debug1("DisplaySleep(%d) ending\n", n);
+ debug2("DisplaySleep(%d) ending, eat was %d\n", n, eat);
}
@@ -2270,9 +2702,13 @@ char *data;
debug("Backend received interrupt\n");
/* This approach is rather questionable in a multi-display
* environment */
- if (fore)
+ if (fore && displays)
{
- char ibuf = intrc;
+#if defined(TERMIO) || defined(POSIX)
+ char ibuf = displays->d_OldMode.tio.c_cc[VINTR];
+#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);
@@ -2286,15 +2722,6 @@ char *data;
InterruptPlease = 0;
}
- for (display = displays; display; display = display->d_next)
- {
- if (D_status_delayed > 0)
- {
- D_status_delayed = -1;
- MakeStatus(D_status_lastmsg);
- }
- }
-
for (p = windows; p; p = p->w_next)
{
if (p->w_bell == BELL_FOUND || p->w_bell == BELL_VISUAL)
@@ -2310,12 +2737,10 @@ char *data;
if (cv == 0)
{
p->w_bell = BELL_DONE;
- D_status_delayed = -1;
Msg(0, "%s", MakeWinMsg(BellString, p, '%'));
}
else if (visual && !D_VB && (!D_status || !D_status_bell))
{
- D_status_delayed = -1;
Msg(0, "%s", VisualBellString);
if (D_status)
{
@@ -2328,6 +2753,7 @@ char *data;
/* don't annoy the user with two messages */
if (p->w_monitor == MON_FOUND)
p->w_monitor = MON_DONE;
+ WindowChanged(p, 'f');
}
if (p->w_monitor == MON_FOUND)
{
@@ -2344,10 +2770,10 @@ char *data;
if (!(ACLBYTE(p->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id)))
continue; /* user doesn't care */
#endif
- D_status_delayed = -1;
Msg(0, "%s", MakeWinMsg(ActivityString, p, '%'));
p->w_monitor = MON_DONE;
}
+ WindowChanged(p, 'f');
}
}
@@ -2374,12 +2800,12 @@ char *data;
if (n > cv->c_layer->l_height)
n = cv->c_layer->l_height;
CV_CALL(cv,
- LScrollV(flayer, -n, 0, flayer->l_height - 1);
- RedisplayLine(-1, -1, -1, 1);
+ LScrollV(flayer, -n, 0, flayer->l_height - 1, 0);
+ LayRedisplayLine(-1, -1, -1, 1);
for (i = 0; i < n; i++)
- RedisplayLine(i, 0, flayer->l_width - 1, 1);
+ LayRedisplayLine(i, 0, flayer->l_width - 1, 1);
if (cv == cv->c_display->d_forecv)
- SetCursor();
+ LaySetCursor();
);
}
else if (ly + cv->c_yoff > cv->c_ye)
@@ -2390,12 +2816,12 @@ char *data;
if (n > cv->c_layer->l_height)
n = cv->c_layer->l_height;
CV_CALL(cv,
- LScrollV(flayer, n, 0, cv->c_layer->l_height - 1);
- RedisplayLine(-1, -1, -1, 1);
+ LScrollV(flayer, n, 0, cv->c_layer->l_height - 1, 0);
+ LayRedisplayLine(-1, -1, -1, 1);
for (i = 0; i < n; i++)
- RedisplayLine(i + flayer->l_height - n, 0, flayer->l_width - 1, 1);
+ LayRedisplayLine(i + flayer->l_height - n, 0, flayer->l_width - 1, 1);
if (cv == cv->c_display->d_forecv)
- SetCursor();
+ LaySetCursor();
);
}
if (lx + cv->c_xoff < cv->c_xs)
@@ -2410,14 +2836,14 @@ char *data;
if (n > cv->c_layer->l_width)
n = cv->c_layer->l_width;
CV_CALL(cv,
- RedisplayLine(-1, -1, -1, 1);
+ LayRedisplayLine(-1, -1, -1, 1);
for (i = 0; i < flayer->l_height; i++)
{
- LScrollH(flayer, -n, i, 0, flayer->l_width - 1, 0);
- RedisplayLine(i, 0, n - 1, 1);
+ LScrollH(flayer, -n, i, 0, flayer->l_width - 1, 0, 0);
+ LayRedisplayLine(i, 0, n - 1, 1);
}
if (cv == cv->c_display->d_forecv)
- SetCursor();
+ LaySetCursor();
);
}
else if (lx + cv->c_xoff > cv->c_xe)
@@ -2432,14 +2858,14 @@ char *data;
if (n > cv->c_layer->l_width)
n = cv->c_layer->l_width;
CV_CALL(cv,
- RedisplayLine(-1, -1, -1, 1);
+ LayRedisplayLine(-1, -1, -1, 1);
for (i = 0; i < flayer->l_height; i++)
{
- LScrollH(flayer, n, i, 0, flayer->l_width - 1, 0);
- RedisplayLine(i, flayer->l_width - n, flayer->l_width - 1, 1);
+ LScrollH(flayer, n, i, 0, flayer->l_width - 1, 0, 0);
+ LayRedisplayLine(i, flayer->l_width - n, flayer->l_width - 1, 1);
}
if (cv == cv->c_display->d_forecv)
- SetCursor();
+ LaySetCursor();
);
}
}
@@ -2450,7 +2876,7 @@ char *data;
if (D_status == STATUS_ON_WIN || D_cvlist == 0 || D_cvlist->c_next == 0)
continue;
debug1("serv_select_fn: Restore on cv %#x\n", (int)D_forecv);
- CV_CALL(D_forecv, Restore();SetCursor());
+ CV_CALL(D_forecv, LayRestore();LaySetCursor());
}
}
diff --git a/screen.h b/screen.h
index c80d86c..6065b06 100644
--- a/screen.h
+++ b/screen.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -44,7 +44,6 @@
#include "layer.h"
#include "term.h"
-extern char bufferfile[MAXPATHLEN];
#ifdef DEBUG
# define STATIC /* a function that the debugger should see */
@@ -132,11 +131,11 @@ struct mode
int m_ldisc;
int m_lmode;
# endif /* TERMIO */
+#endif /* POSIX */
#if defined(KANJI) && defined(TIOCKSET)
struct jtchars m_jtchars;
int m_knjmode;
-# endif
-#endif /* POSIX */
+#endif
};
@@ -154,6 +153,7 @@ struct mode
#define D_POWER 3
#define D_REMOTE_POWER 4
#define D_LOCK 5
+#define D_HANGUP 6
/*
* Here are the messages the attacher sends to the backend
@@ -166,6 +166,7 @@ struct mode
#define MSG_POW_DETACH 5
#define MSG_WINCH 6
#define MSG_HANGUP 7
+#define MSG_COMMAND 8
/*
* versions of struct msg:
@@ -202,6 +203,7 @@ struct msg
int esc; /* his new escape character unless -1 */
int meta_esc; /* his new meta esc character unless -1 */
char envterm[20 + 1]; /* terminal type */
+ int encoding; /* encoding of display */
}
attach;
struct
@@ -210,6 +212,15 @@ struct msg
int dpid; /* pid of frontend */
}
detach;
+ struct
+ {
+ char auser[20 + 1]; /* username */
+ int nargs;
+ char cmd[MAXPATHLEN]; /* command */
+ int apid; /* pid of frontend */
+ char preselect[20];
+ }
+ command;
char message[MAXPATHLEN * 2];
} m;
};
@@ -243,6 +254,7 @@ struct msg
#define DUMP_TERMCAP 0 /* WriteFile() options */
#define DUMP_HARDCOPY 1
#define DUMP_EXCHANGE 2
+#define DUMP_SCROLLBACK 3
#define SILENCE_OFF 0
#define SILENCE_ON 1
@@ -268,11 +280,6 @@ struct acl
/* register list */
#define MAX_PLOP_DEFS 256
-struct plop
-{
- char *buf;
- int len;
-};
struct baud_values
{
diff --git a/search.c b/search.c
index 51730ae..c4c552d 100644
--- a/search.c
+++ b/search.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -38,6 +38,8 @@ extern struct win *fore;
#ifdef COPY_PASTE
+int search_ic;
+
/********************************************************************
* VI style Search
*/
@@ -133,7 +135,7 @@ matchword(pattern, y, sx, ex)
char *pattern;
int y, sx, ex;
{
- char *ip, *ipe, *cp, *pp;
+ unsigned char *ip, *ipe, *cp, *pp;
struct mline *ml;
/* *sigh* to make WIN work */
@@ -145,12 +147,19 @@ int y, sx, ex;
for (;sx <= ex; sx++)
{
cp = ip++;
- pp = pattern;
- while (*cp++ == *pp++)
- if (*pp == 0)
- return sx;
- else if (cp == ipe)
- break;
+ pp = (unsigned char *)pattern;
+ for (;;)
+ {
+ if (*cp != *pp)
+ if (!search_ic || ((*cp ^ *pp) & 0xdf) || (*cp | 0x20) < 'a' || (*cp | 0x20) > 'z')
+ break;
+ cp++;
+ pp++;
+ if (*pp == 0)
+ return sx;
+ if (cp == ipe)
+ break;
+ }
}
return -1;
}
@@ -178,7 +187,7 @@ int l, p, end, dir;
{
int tab[256];
int i, q;
- char *s, c;
+ unsigned char *s, c;
int w = flayer->l_width;
/* *sigh* to make WIN work */
@@ -194,21 +203,27 @@ int l, p, end, dir;
for (i = 0; i < 256; i++)
tab[i] = l * dir;
for (i = 0; i < l - 1; i++, str += dir)
- tab[(int)(unsigned char) *str] = (l - 1 - i) * dir;
+ {
+ q = *(unsigned char *)str;
+ tab[q] = (l - 1 - i) * dir;
+ if (search_ic && (q | 0x20) >= 'a' && ((q | 0x20) <= 'z'))
+ tab[q ^ 0x20] = (l - 1 - i) * dir;
+ }
if (dir > 0)
p += l - 1;
debug1("first char to match: %c\n", *str);
while (p >= 0 && p < end)
{
q = p;
- s = str;
+ s = (unsigned char *)str;
for (i = 0;;)
{
c = (WIN(q / w))->image[q % w];
if (i == 0)
p += tab[(int)(unsigned char) c];
if (c != *s)
- break;
+ if (!search_ic || ((c ^ *s) & 0xdf) || (c | 0x20) < 'a' || (c | 0x20) > 'z')
+ break;
q -= dir;
s -= dir;
if (++i == l)
@@ -289,7 +304,7 @@ char *data; /* dummy */
y = pos / flayer->l_width;
LAY_CALL_UP
(
- RedisplayLine(INPUTLINE, 0, flayer->l_width - 1, 0);
+ LayRedisplayLine(INPUTLINE, 0, flayer->l_width - 1, 0);
revto(x, y);
if (W2D(markdata->cy) == INPUTLINE)
revto_line(markdata->cx, markdata->cy, INPUTLINE > 0 ? INPUTLINE - 1 : 1);
diff --git a/socket.c b/socket.c
index ad133a7..dff0cd9 100644
--- a/socket.c
+++ b/socket.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -50,6 +50,7 @@ RCS_ID("$Id: socket.c,v 1.23 1994/05/31 12:33:00 mlschroe Exp $ FAU")
static int CheckPid __P((int));
static void ExecCreate __P((struct msg *));
+static void DoCommandMsg __P((struct msg *));
#if defined(_SEQUENT_) && !defined(NAMEDPIPE)
# define connect sconnect /* _SEQUENT_ has braindamaged connect */
static int sconnect __P((int, struct sockaddr *, int));
@@ -64,6 +65,7 @@ extern int dflag, iflag, rflag, lsflag, quietflag, wipeflag, xflag;
extern char *attach_tty, *LoginName, HostName[];
extern struct display *display, *displays;
extern struct win *fore, *wtab[], *console_window, *windows;
+extern struct layer *flayer;
extern struct NewWindow nwin_undef;
#ifdef MULTIUSER
extern char *multi;
@@ -73,6 +75,7 @@ extern char *getenv();
extern char SockPath[];
extern struct event serv_read;
+extern char *rc_name;
#ifdef MULTIUSER
# define SOCKMODE (S_IWRITE | S_IREAD | (displays ? S_IEXEC : 0) | (multi ? 1 : 0))
@@ -242,26 +245,29 @@ char *match;
debug2(" MakeClientSocket failed, unreachable? %d %d\n",
matchlen, wipeflag);
sent->mode = -3;
+#ifndef SOCKDIR_IS_LOCAL_TO_HOST
/* Unreachable - it is dead if we detect that it's local
* or we specified a match
*/
n = name + strlen(name) - 1;
while (n != name && *n != '.')
n--;
- if (matchlen || (*n == '.' && n[1] && strncmp(HostName, n + 1, strlen(n + 1)) == 0))
+ if (matchlen == 0 && !(*n == '.' && n[1] && strncmp(HostName, n + 1, strlen(n + 1)) == 0))
+ {
+ npriv++; /* a good socket that was not for us */
+ continue;
+ }
+#endif
+ ndead++;
+ sent->mode = -1;
+ if (wipeflag)
+ {
+ if (unlink(SockPath) == 0)
{
- ndead++;
- sent->mode = -1;
- if (wipeflag)
- {
- if (unlink(SockPath) == 0)
- {
- sent->mode = -2;
- nwipe++;
- }
- }
+ sent->mode = -2;
+ nwipe++;
+ }
}
- npriv++; /* a good socket that was not for us */
continue;
}
@@ -357,7 +363,7 @@ char *match;
if (wipeflag)
Msg(0, "%d socket%s wiped out.", nwipe, nwipe > 1 ? "s" : "");
else
- Msg(0, "Remove dead screens with 'screen -wipe'.", ndead > 1 ? "s" : "", ndead > 1 ? "" : "es"); /* other args for nethack */
+ Msg(0, "Remove dead screens with 'screen -wipe'."+1-1, ndead > 1 ? "s" : "", ndead > 1 ? "" : "es"); /* other args for nethack */
}
if (firsts != -1)
{
@@ -939,6 +945,15 @@ ReceiveMsg()
#endif
debug2("RecMsg: apid %d is o.k. and we just opened '%s'\n", m.m.attach.apid, m.m_tty);
+#ifndef MULTI
+ if (displays)
+ {
+ write(i, "Screen session in use.\n", 23);
+ close(i);
+ Kill(m.m.attach.apid, SIG_BYE);
+ break;
+ }
+#endif
/* create new display */
GetTTY(i, &Mode);
@@ -950,6 +965,15 @@ ReceiveMsg()
Kill(m.m.attach.apid, SIG_BYE);
break;
}
+#ifdef ENCODINGS
+# 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
/* turn off iflag on a multi-attach... */
if (iflag && olddisplays)
{
@@ -979,7 +1003,7 @@ ReceiveMsg()
break;
case MSG_HANGUP:
if (!wi) /* ignore hangups from inside */
- SigHup(SIGARG);
+ Hangup();
break;
#ifdef REMOTE_DETACH
case MSG_DETACH:
@@ -999,6 +1023,9 @@ ReceiveMsg()
}
break;
#endif
+ case MSG_COMMAND:
+ DoCommandMsg(&m);
+ break;
default:
Msg(0, "Invalid message (type %d).", m.type);
}
@@ -1104,7 +1131,7 @@ struct msg *m;
* We reboot our Terminal Emulator. Forget all we knew about
* the old terminal, reread the termcap entries in .screenrc
* (and nothing more from .screenrc is read. Mainly because
- * I did not check, weather a full reinit is save. jw)
+ * I did not check, weather a full reinit is safe. jw)
* and /etc/screenrc, and initialise anew.
*/
if (extra_outcap)
@@ -1195,7 +1222,7 @@ static void PasswordProcessInput __P((char *, int));
struct pwdata {
int l;
- char buf[8];
+ char buf[20 + 1];
struct msg m;
};
@@ -1248,6 +1275,7 @@ int ilen;
}
/* great, pw matched, all is fine */
bzero(pwdata->buf, sizeof(pwdata->buf));
+ AddStr("\r\n");
D_processinputdata = 0;
D_processinput = ProcessInput;
FinishAttach(&pwdata->m);
@@ -1272,9 +1300,97 @@ int ilen;
l = 0;
continue;
}
- if (l < 8)
+ if (l < sizeof(pwdata->buf) - 1)
pwdata->buf[l++] = c;
}
pwdata->l = l;
}
#endif
+
+static void
+DoCommandMsg(mp)
+struct msg *mp;
+{
+ char *args[MAXARGS];
+ int n;
+ register char **pp = args, *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)
+ n = MAXARGS - 1;
+ for (; n > 0; n--)
+ {
+ *pp++ = p;
+ p += strlen(p) + 1;
+ }
+ *pp = 0;
+#ifdef MULTIUSER
+ user = *FindUserPtr(mp->m.attach.auser);
+ if (user == 0)
+ {
+ Msg(0, "Unknown user %s tried to send a command!", mp->m.attach.auser);
+ return;
+ }
+#else
+ user = users;
+#endif
+#ifdef PASSWORD
+ if (user->u_password && *user->u_password)
+ {
+ Msg(0, "User %s has a password, cannot use -X option.", mp->m.attach.auser);
+ return;
+ }
+#endif
+ if (!display)
+ for (display = displays; display; display = display->d_next)
+ if (D_user == user)
+ break;
+ for (fore = windows; fore; fore = fore->w_next)
+ if (!TTYCMP(mp->m_tty, fore->w_tty))
+ {
+ if (!display)
+ display = fore->w_layer.l_cvlist ? fore->w_layer.l_cvlist->c_display : 0;
+ break;
+ }
+ if (!display)
+ display = displays; /* sigh */
+ if (*mp->m.command.preselect)
+ {
+ int i;
+ i = WindowByNoN(mp->m.command.preselect);
+ fore = i >= 0 ? wtab[i] : 0;
+ }
+ else if (!fore)
+ {
+ if (display && D_user == user)
+ fore = Layer2Window(display->d_forecv->c_layer);
+ if (!fore)
+ {
+ fore = user->u_detachwin >= 0 ? wtab[user->u_detachwin] : 0;
+ fore = FindNiceWindow(fore, 0);
+ }
+ }
+#ifdef MULTIUSER
+ EffectiveAclUser = user;
+#endif
+ if (*args)
+ {
+ char *oldrcname = rc_name;
+ rc_name = "-X";
+ debug3("Running command on display %x window %x (%d)\n", display, fore, fore ? fore->w_number : -1);
+ flayer = fore ? &fore->w_layer : 0;
+ if (fore && fore->w_savelayer && (fore->w_blocked || fore->w_savelayer->l_cvlist == 0))
+ flayer = fore->w_savelayer;
+ DoCommand(args);
+ rc_name = oldrcname;
+ }
+#ifdef MULTIUSER
+ EffectiveAclUser = 0;
+#endif
+}
diff --git a/teln.c b/teln.c
index 04baf2c..f434a1c 100644
--- a/teln.c
+++ b/teln.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -28,7 +28,6 @@ RCS_ID("$Id: teln.c,v 1.6 1994/05/31 12:32:15 mlschroe Exp $ FAU")
#include <sys/socket.h>
#include <fcntl.h>
#include <netdb.h>
-#include <arpa/inet.h>
#include "config.h"
@@ -145,11 +144,16 @@ struct win *p;
Msg(0, "unknown host: %s", *args);
return -1;
}
+ if (hp->h_length != sizeof(p->w_telsa.sin_addr.s_addr) || hp->h_addrtype != AF_INET)
+ {
+ Msg(0, "Bad address type for %s", hp->h_name);
+ return -1;
+ }
bcopy((char *)hp->h_addr,(char *)&p->w_telsa.sin_addr.s_addr, hp->h_length);
p->w_telsa.sin_family = hp->h_addrtype;
}
p->w_telsa.sin_port = htons(port);
- if (port != TEL_DEFPORT)
+ if (port != TEL_DEFPORT)
sprintf(buf, "Trying %s %d...", inet_ntoa(p->w_telsa.sin_addr), port);
else
sprintf(buf, "Trying %s...", inet_ntoa(p->w_telsa.sin_addr));
@@ -215,7 +219,7 @@ int *lenp;
fore->w_telbuf[fore->w_telbufl++] = '\n';
tb = fore->w_telbuf;
tl = fore->w_telbufl;
- Process(&tb, &tl);
+ LayProcess(&tb, &tl);
fore->w_telbufl = 0;
continue;
}
@@ -476,7 +480,8 @@ struct win *p;
if (p->w_telsubidx != 2 || p->w_telsubbuf[1] != 1)
return;
l = strlen(screenterm);
- ASSERT(l < 20);
+ if (l >= 20)
+ break;
sprintf(trepl, "%c%c%c%c%s%c%c", TC_IAC, TC_SB, TO_TTYPE, 0, screenterm, TC_IAC, TC_SE);
TelReply(p, trepl, l + 6);
break;
diff --git a/term.c b/term.c
index ccf123c..1c3c3f3 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -118,8 +118,10 @@ struct term term[T_N] =
{ "Sf", T_STR },
{ "Sb", T_STR },
{ "op", T_STR },
+ { "Co", T_NUM },
{ "be", T_FLG },
{ "AX", T_FLG },
+ { "C8", T_FLG },
/* keypad/cursorkeys */
{ "ks", T_STR },
@@ -159,6 +161,7 @@ struct term term[T_N] =
{ "VR", T_STR },
{ "VN", T_STR },
{ "TF", T_FLG },
+ { "XT", T_FLG },
/* d_font setting */
{ "G0", T_FLG },
@@ -226,6 +229,7 @@ struct term term[T_N] =
{ "kN", T_STR }, KMAPDEF("\033[6~") KMAPMDEF("\006")
{ "kP", T_STR }, KMAPDEF("\033[5~") KMAPMDEF("\002")
{ "kI", T_STR }, KMAPDEF("\033[2~")
+/* define T_NAVIGATE_DELETE */
{ "kD", T_STR }, KMAPDEF("\033[3~")
/* keys that can have two bindings */
diff --git a/term.h.dist b/term.h.dist
index b41db31..bf47f92 100644
--- a/term.h.dist
+++ b/term.h.dist
@@ -150,95 +150,102 @@ union tcu
#define D_CSB (D_tcs[63].str)
#define d_OP d_tcs[64].str
#define D_OP (D_tcs[64].str)
-#define d_BE d_tcs[65].flg
-#define D_BE (D_tcs[65].flg)
-#define d_CAX d_tcs[66].flg
-#define D_CAX (D_tcs[66].flg)
-#define d_KS d_tcs[67].str
-#define D_KS (D_tcs[67].str)
-#define d_KE d_tcs[68].str
-#define D_KE (D_tcs[68].str)
-#define d_CCS d_tcs[69].str
-#define D_CCS (D_tcs[69].str)
-#define d_CCE d_tcs[70].str
-#define D_CCE (D_tcs[70].str)
-#define d_PO d_tcs[71].str
-#define D_PO (D_tcs[71].str)
-#define d_PF d_tcs[72].str
-#define D_PF (D_tcs[72].str)
-#define d_HS d_tcs[73].flg
-#define D_HS (D_tcs[73].flg)
-#define d_WS d_tcs[74].num
-#define D_WS (D_tcs[74].num)
-#define d_TS d_tcs[75].str
-#define D_TS (D_tcs[75].str)
-#define d_FS d_tcs[76].str
-#define D_FS (D_tcs[76].str)
-#define d_DS d_tcs[77].str
-#define D_DS (D_tcs[77].str)
-#define d_VI d_tcs[78].str
-#define D_VI (D_tcs[78].str)
-#define d_VS d_tcs[79].str
-#define D_VS (D_tcs[79].str)
-#define d_VE d_tcs[80].str
-#define D_VE (D_tcs[80].str)
-#define d_AM d_tcs[81].flg
-#define D_AM (D_tcs[81].flg)
-#define d_XV d_tcs[82].flg
-#define D_XV (D_tcs[82].flg)
-#define d_XN d_tcs[83].flg
-#define D_XN (D_tcs[83].flg)
-#define d_COP d_tcs[84].flg
-#define D_COP (D_tcs[84].flg)
-#define d_CLP d_tcs[85].flg
-#define D_CLP (D_tcs[85].flg)
-#define d_CNF d_tcs[86].flg
-#define D_CNF (D_tcs[86].flg)
-#define d_NX d_tcs[87].flg
-#define D_NX (D_tcs[87].flg)
-#define d_CAN d_tcs[88].flg
-#define D_CAN (D_tcs[88].flg)
-#define d_COL d_tcs[89].num
-#define D_COL (D_tcs[89].num)
-#define d_CKJ d_tcs[90].str
-#define D_CKJ (D_tcs[90].str)
-#define d_CVR d_tcs[91].str
-#define D_CVR (D_tcs[91].str)
-#define d_CVN d_tcs[92].str
-#define D_CVN (D_tcs[92].str)
-#define d_CTF d_tcs[93].flg
-#define D_CTF (D_tcs[93].flg)
-#define d_CG0 d_tcs[94].flg
-#define D_CG0 (D_tcs[94].flg)
-#define d_CS0 d_tcs[95].str
-#define D_CS0 (D_tcs[95].str)
-#define d_CE0 d_tcs[96].str
-#define D_CE0 (D_tcs[96].str)
-#define d_CC0 d_tcs[97].str
-#define D_CC0 (D_tcs[97].str)
-#define d_AS d_tcs[98].str
-#define D_AS (D_tcs[98].str)
-#define d_AE d_tcs[99].str
-#define D_AE (D_tcs[99].str)
-#define d_AC d_tcs[100].str
-#define D_AC (D_tcs[100].str)
-#define d_EA d_tcs[101].str
-#define D_EA (D_tcs[101].str)
-#define d_CXC d_tcs[102].str
-#define D_CXC (D_tcs[102].str)
-#define T_CAPS 103
-#define T_NAVIGATE 142
-#define T_CURSOR 150
-#define T_KEYPAD 154
-#define T_OCAPS 172
-#define T_ECAPS 185
-#define T_N 185
+#define d_CCO d_tcs[65].num
+#define D_CCO (D_tcs[65].num)
+#define d_BE d_tcs[66].flg
+#define D_BE (D_tcs[66].flg)
+#define d_CAX d_tcs[67].flg
+#define D_CAX (D_tcs[67].flg)
+#define d_CC8 d_tcs[68].flg
+#define D_CC8 (D_tcs[68].flg)
+#define d_KS d_tcs[69].str
+#define D_KS (D_tcs[69].str)
+#define d_KE d_tcs[70].str
+#define D_KE (D_tcs[70].str)
+#define d_CCS d_tcs[71].str
+#define D_CCS (D_tcs[71].str)
+#define d_CCE d_tcs[72].str
+#define D_CCE (D_tcs[72].str)
+#define d_PO d_tcs[73].str
+#define D_PO (D_tcs[73].str)
+#define d_PF d_tcs[74].str
+#define D_PF (D_tcs[74].str)
+#define d_HS d_tcs[75].flg
+#define D_HS (D_tcs[75].flg)
+#define d_WS d_tcs[76].num
+#define D_WS (D_tcs[76].num)
+#define d_TS d_tcs[77].str
+#define D_TS (D_tcs[77].str)
+#define d_FS d_tcs[78].str
+#define D_FS (D_tcs[78].str)
+#define d_DS d_tcs[79].str
+#define D_DS (D_tcs[79].str)
+#define d_VI d_tcs[80].str
+#define D_VI (D_tcs[80].str)
+#define d_VS d_tcs[81].str
+#define D_VS (D_tcs[81].str)
+#define d_VE d_tcs[82].str
+#define D_VE (D_tcs[82].str)
+#define d_AM d_tcs[83].flg
+#define D_AM (D_tcs[83].flg)
+#define d_XV d_tcs[84].flg
+#define D_XV (D_tcs[84].flg)
+#define d_XN d_tcs[85].flg
+#define D_XN (D_tcs[85].flg)
+#define d_COP d_tcs[86].flg
+#define D_COP (D_tcs[86].flg)
+#define d_CLP d_tcs[87].flg
+#define D_CLP (D_tcs[87].flg)
+#define d_CNF d_tcs[88].flg
+#define D_CNF (D_tcs[88].flg)
+#define d_NX d_tcs[89].flg
+#define D_NX (D_tcs[89].flg)
+#define d_CAN d_tcs[90].flg
+#define D_CAN (D_tcs[90].flg)
+#define d_COL d_tcs[91].num
+#define D_COL (D_tcs[91].num)
+#define d_CKJ d_tcs[92].str
+#define D_CKJ (D_tcs[92].str)
+#define d_CVR d_tcs[93].str
+#define D_CVR (D_tcs[93].str)
+#define d_CVN d_tcs[94].str
+#define D_CVN (D_tcs[94].str)
+#define d_CTF d_tcs[95].flg
+#define D_CTF (D_tcs[95].flg)
+#define d_CXT d_tcs[96].flg
+#define D_CXT (D_tcs[96].flg)
+#define d_CG0 d_tcs[97].flg
+#define D_CG0 (D_tcs[97].flg)
+#define d_CS0 d_tcs[98].str
+#define D_CS0 (D_tcs[98].str)
+#define d_CE0 d_tcs[99].str
+#define D_CE0 (D_tcs[99].str)
+#define d_CC0 d_tcs[100].str
+#define D_CC0 (D_tcs[100].str)
+#define d_AS d_tcs[101].str
+#define D_AS (D_tcs[101].str)
+#define d_AE d_tcs[102].str
+#define D_AE (D_tcs[102].str)
+#define d_AC d_tcs[103].str
+#define D_AC (D_tcs[103].str)
+#define d_EA d_tcs[104].str
+#define D_EA (D_tcs[104].str)
+#define d_CXC d_tcs[105].str
+#define D_CXC (D_tcs[105].str)
+#define T_CAPS 106
+#define T_NAVIGATE 145
+#define T_NAVIGATE_DELETE 152
+#define T_CURSOR 153
+#define T_KEYPAD 157
+#define T_OCAPS 175
+#define T_ECAPS 188
+#define T_N 188
#ifdef MAPKEYS
-# define KMAPDEFSTART 103
+# define KMAPDEFSTART 106
# define NKMAPDEF 69
-# define KMAPADEFSTART 150
+# define KMAPADEFSTART 153
# define NKMAPADEF 22
-# define KMAPMDEFSTART 135
+# define KMAPMDEFSTART 138
# define NKMAPMDEF 19
#endif
diff --git a/termcap.c b/termcap.c
index 1ebaccf..f09e6ac 100644
--- a/termcap.c
+++ b/termcap.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -33,7 +33,7 @@ extern struct display *display, *displays;
extern int real_uid, real_gid, eff_uid, eff_gid;
extern struct term term[]; /* terminal capabilities */
extern struct NewWindow nwin_undef, nwin_default, nwin_options;
-extern int force_vt, assume_LP;
+extern int force_vt;
extern int Z0width, Z1width;
extern int hardstatusemu;
#ifdef MAPKEYS
@@ -202,7 +202,7 @@ int he;
{
/* standard fixes for xterms etc */
/* assume color for everything that looks ansi-compatible */
- if (!D_CAF && D_ME && InStr(D_ME, "\033[m"))
+ if (!D_CAF && D_ME && (InStr(D_ME, "\033[m") || InStr(D_ME, "\033[0m")))
{
#ifdef TERMINFO
D_CAF = "\033[3%p1%dm";
@@ -214,17 +214,22 @@ int he;
}
if (D_OP && InStr(D_OP, "\033[39;49m"))
D_CAX = 1;
- if (strcmp(D_termname, "xterm-color") == 0)
- D_BE = 1;
+ if (D_OP && (InStr(D_OP, "\033[m") || InStr(D_OP, "\033[0m")))
+ D_OP = 0;
/* ISO2022 */
if ((D_EA && InStr(D_EA, "\033(B")) || (D_AS && InStr(D_AS, "\033(0")))
D_CG0 = 1;
+ if (InStr(D_termname, "xterm") || InStr(D_termname, "rxvt"))
+ D_CXT = 1;
+ /* "be" seems to be standard for xterms... */
+ if (D_CXT)
+ D_BE = 1;
}
if (nwin_options.flowflag == nwin_undef.flowflag)
nwin_default.flowflag = D_CNF ? FLOW_NOW * 0 :
D_NX ? FLOW_NOW * 1 :
FLOW_AUTOFLAG;
- D_CLP |= (assume_LP || !D_AM || D_XV || D_XN);
+ D_CLP |= (!D_AM || D_XV || D_XN);
if (!D_BL)
D_BL = "\007";
if (!D_BC)
@@ -320,14 +325,10 @@ int he;
t = D_attrtyp[i];
}
}
- if (D_CAF == 0 && D_CAB == 0)
- {
- /* hmm, where's the difference? */
- D_CAF = D_CSF;
- D_CAB = D_CSB;
- }
- if (D_BE)
- D_UT = 1; /* screen erased with background color */
+ if (D_CAF || D_CAB || D_CSF || D_CSB)
+ D_hascolor = 1;
+ if (D_UT)
+ D_BE = 1; /* screen erased with background color */
if (!D_DO)
D_DO = D_NL;
@@ -413,21 +414,19 @@ int he;
if (D_HS)
{
debug("oy! we have a hardware status line, says termcap\n");
- if (D_WS <= 0)
- D_WS = D_width;
+ if (D_WS < 0)
+ D_WS = 0;
}
D_has_hstatus = hardstatusemu & ~HSTATUS_ALWAYS;
if (D_HS && !(hardstatusemu & HSTATUS_ALWAYS))
D_has_hstatus = HSTATUS_HS;
-#ifdef KANJI
- D_kanji = 0;
+#ifdef ENCODINGS
if (D_CKJ)
{
- if (strcmp(D_CKJ, "euc") == 0)
- D_kanji = EUC;
- else if (strcmp(D_CKJ, "sjis") == 0)
- D_kanji = SJIS;
+ int enc = FindEncoding(D_CKJ);
+ if (enc != -1)
+ D_encoding = enc;
}
#endif
if (!D_tcs[T_NAVIGATE].str && D_tcs[T_NAVIGATE + 1].str)
@@ -457,6 +456,17 @@ int he;
D_obufmax = D_COL;
D_obuflenmax = D_obuflen - D_obufmax;
}
+
+ /* Some xterm entries set F0 and F10 to the same string. Nuke F0. */
+ if (D_tcs[T_CAPS].str && D_tcs[T_CAPS + 10].str && !strcmp(D_tcs[T_CAPS].str, D_tcs[T_CAPS + 10].str))
+ D_tcs[T_CAPS].str = 0;
+ /* Some xterm entries set kD to ^?. Nuke it. */
+ if (D_tcs[T_NAVIGATE_DELETE].str && !strcmp(D_tcs[T_NAVIGATE_DELETE].str, "\0177"))
+ D_tcs[T_NAVIGATE_DELETE].str = 0;
+ /* wyse52 entries have kcub1 == kb == ^H. Nuke... */
+ 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++)
@@ -561,7 +571,7 @@ CheckEscape()
display = odisplay;
return;
}
- ParseEscape((struct user *)0, "^aa");
+ ParseEscape((struct acluser *)0, "^aa");
if (odisplay->d_user->u_Esc == -1)
odisplay->d_user->u_Esc = DefaultEsc;
if (odisplay->d_user->u_MetaEsc == -1)
@@ -721,7 +731,7 @@ int aflag;
{
char buf[TERMCAP_BUFSIZE];
register char *p, *cp, *s, ch, *tname;
- int i, wi, he;
+ int i, wi, he, found;
if (display)
{
@@ -751,6 +761,7 @@ int aflag;
debug("MakeTermcap sets screenterm=screen\n");
strcpy(screenterm, "screen");
}
+ found = 1;
do
{
strcpy(Term, "TERM=");
@@ -771,21 +782,23 @@ int aflag;
if (e_tgetent(buf, p) == 1)
break;
strcpy(p, "vt100");
+ found = 0;
}
while (0); /* Goto free programming... */
+#if 0
+#ifndef TERMINFO
/* check for compatibility problems, displays == 0 after fork */
- {
- char xbuf[TERMCAP_BUFSIZE], *xbp = xbuf;
- if (tgetstr("im", &xbp) && tgetstr("ic", &xbp) && displays)
- {
-#ifdef TERMINFO
- Msg(0, "Warning: smir and ich1 set in %s terminfo entry", p);
-#else
- Msg(0, "Warning: im and ic set in %s termcap entry", p);
+ if (found)
+ {
+ char xbuf[TERMCAP_BUFSIZE], *xbp = xbuf;
+ if (tgetstr("im", &xbp) && tgetstr("ic", &xbp) && displays)
+ {
+ Msg(0, "Warning: im and ic set in %s termcap entry", p);
+ }
+ }
+#endif
#endif
- }
- }
tcLineLen = 100; /* Force NL */
if (strlen(Term) > TERMCAP_BUFSIZE - 40)
@@ -875,7 +888,7 @@ int aflag;
AddCap("mr=\\E[7m:");
if (D_MB || D_MD || D_MH || D_MR)
AddCap("me=\\E[m:ms:");
- if (D_CAF || D_CAB)
+ if (D_hascolor)
AddCap("Co#8:pa#64:AF=\\E[3%dm:AB=\\E[4%dm:op=\\E[39;49m:AX:");
if (D_VB)
AddCap("vb=\\Eg:");
@@ -933,6 +946,13 @@ int aflag;
if (act->nr == RC_ILLEGAL)
act = &dmtab[i - T_CAPS];
}
+ if (act->nr == RC_ILLEGAL && (i == T_NAVIGATE + 1 || i == T_NAVIGATE + 3))
+ {
+ /* kh -> @1, kH -> @7 */
+ act = &umtab[i - T_CAPS - 1];
+ if (act->nr == RC_ILLEGAL)
+ act = &dmtab[i - T_CAPS - 1];
+ }
if (act->nr != RC_ILLEGAL)
{
if (act->nr == RC_STUFF)
diff --git a/terminfo/screeninfo.src b/terminfo/screeninfo.src
index d0ddb31..c982a54 100644
--- a/terminfo/screeninfo.src
+++ b/terminfo/screeninfo.src
@@ -14,7 +14,7 @@ screen|VT 100/ANSI X3.64 virtual terminal,
kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ,
kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~,
kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~,
- kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=\EE,
+ kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=\EE,
rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>,
rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m,
smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m,
@@ -38,7 +38,31 @@ screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols,
kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ,
kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~,
kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~,
- kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=\EE,
+ kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=\EE,
+ rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>,
+ rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m,
+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m,
+ tbc=\E[3g, smacs=^N, rmacs=^O, flash=\Eg,
+ civis=\E[?25l, cnorm=\E[34h\E[?25h, cvvis=\E[34l,
+ op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00,
+screen-bce|VT 100/ANSI X3.64 virtual terminal with bce,
+ am, km, mir, msgr, xenl, bce,
+ cols#80, it#8, lines#24, colors#8, pairs#64,
+ bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z,
+ clear=\E[H\E[J, cr=\r, csr=\E[%i%p1%d;%p2%dr,
+ cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n,
+ cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
+ cuu=\E[%p1%dA, cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P,
+ dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K,
+ enacs=\E(B\E)0, home=\E[H,
+ ht=\t, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
+ ind=\n, is2=\E)0, kbs=\177, kcub1=\EOD, kcud1=\EOB,
+ kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\EOP,
+ kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ,
+ kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~,
+ kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kend=\E[4~,
+ kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=\EE,
rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>,
rmso=\E[23m, rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m,
smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m,
diff --git a/tty.c.dist b/tty.c.dist
index 2ce97b4..c1c0e7b 100644
--- a/tty.c.dist
+++ b/tty.c.dist
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -71,6 +71,8 @@ extern struct win *console_window;
static void consredir_readev_fn __P((struct event *, char *));
#endif
+int separate_sids = 1;
+
static void DoSendBreak __P((int, int, int));
static sigret_t SigAlrmDummy __P(SIGPROTOARG);
@@ -176,6 +178,15 @@ char *line, *opt;
#endif
SetTTY(f, &Mode);
+#if defined(linux) && defined(TIOCMSET)
+ {
+ int mcs = 0;
+ ioctl(f, TIOCMGET, &mcs);
+ mcs |= TIOCM_RTS;
+ ioctl(f, TIOCMSET, &mcs);
+ }
+#endif
+
brktty(f);
alarm(0);
signal(SIGALRM, sigalrm);
@@ -188,14 +199,6 @@ char *line, *opt;
* Tty mode handling
*/
-#if defined(TERMIO) || defined(POSIX)
-int intrc, origintrc = VDISABLE; /* display? */
-#else
-int intrc, origintrc = -1; /* display? */
-#endif
-static int startc, stopc; /* display? */
-
-
void
InitTTY(m, ttyflag)
struct mode *m;
@@ -234,11 +237,11 @@ int ttyflag;
m->tio.c_oflag |= OXTABS;
#endif /* OXTABS */
/* IF{PARENB} m->tio.c_cflag |= PARENB; nah! jw. */
- }
-
#if defined(OPOST)
m->tio.c_oflag |= OPOST;
#endif /* OPOST */
+ }
+
/*
* Or-ing the speed into c_cflags is dangerous.
@@ -415,12 +418,11 @@ int ttyflag;
m->tio.c_iflag |= IXON;
#endif /* IXON */
+ if (!ttyflag) /* may not even be good for ptys.. */
+ {
#if defined(OPOST)
m->tio.c_oflag |= OPOST;
#endif /* OPOST */
-
- if (!ttyflag) /* may not even be good for ptys.. */
- {
#if defined(ICRNL)
m->tio.c_iflag |= ICRNL;
#endif /* ICRNL */
@@ -572,7 +574,7 @@ int ttyflag;
# endif /* TERMIO */
#endif /* POSIX */
-#if defined(KANJI) && defined(TIOCKSET)
+#if defined(ENCODINGS) && defined(TIOCKSET)
m->m_jtchars.t_ascii = 'J';
m->m_jtchars.t_kanji = 'B';
m->m_knjmode = KM_ASCII | KM_SYSSJIS;
@@ -610,7 +612,7 @@ struct mode *mp;
ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); /* moved here for apollo. jw */
# endif
#endif
-#if defined(KANJI) && defined(TIOCKSET)
+#if defined(ENCODINGS) && defined(TIOCKSET)
ioctl(fd, TIOCKSETC, &mp->m_jtchars);
ioctl(fd, TIOCKSET, &mp->m_knjmode);
#endif
@@ -654,7 +656,7 @@ struct mode *mp;
ioctl(fd, TIOCGETD, (char *)&mp->m_ldisc);
# endif
#endif
-#if defined(KANJI) && defined(TIOCKSET)
+#if defined(ENCODINGS) && defined(TIOCKSET)
ioctl(fd, TIOCKGETC, &mp->m_jtchars);
ioctl(fd, TIOCKGET, &mp->m_knjmode);
#endif
@@ -672,6 +674,7 @@ int flow, interrupt;
{
*np = *op;
+ ASSERT(display);
#if defined(TERMIO) || defined(POSIX)
# ifdef CYTERMIO
np->m_mapkey = NOMAPKEY;
@@ -719,27 +722,11 @@ int flow, interrupt;
*/
np->tio.c_cc[VMIN] = 1;
np->tio.c_cc[VTIME] = 0;
-#if defined(VSTART)
-#if (VSTART < MAXCC)
- startc = op->tio.c_cc[VSTART];
-#endif
-#endif /* VSTART */
-#if defined(VSTOP)
-#if (VSTOP < MAXCC)
- stopc = op->tio.c_cc[VSTOP];
-#endif
-#endif /* VSTOP */
- if (interrupt)
- origintrc = intrc = op->tio.c_cc[VINTR];
- else
- {
- origintrc = op->tio.c_cc[VINTR];
- intrc = np->tio.c_cc[VINTR] = VDISABLE;
- }
+ if (!interrupt || !flow)
+ np->tio.c_cc[VINTR] = VDISABLE;
np->tio.c_cc[VQUIT] = VDISABLE;
if (flow == 0)
{
- np->tio.c_cc[VINTR] = VDISABLE;
#if defined(VSTART)
#if (VSTART < MAXCC)
np->tio.c_cc[VSTART] = VDISABLE;
@@ -807,15 +794,8 @@ int flow, interrupt;
#endif /* VWERASE */
# endif /* HPUX_LTCHARS_HACK */
#else /* TERMIO || POSIX */
- startc = op->m_tchars.t_startc;
- stopc = op->m_tchars.t_stopc;
- if (interrupt)
- origintrc = intrc = op->m_tchars.t_intrc;
- else
- {
- origintrc = op->m_tchars.t_intrc;
- intrc = np->m_tchars.t_intrc = -1;
- }
+ if (!interrupt || !flow)
+ np->m_tchars.t_intrc = -1;
np->m_ttyb.sg_flags &= ~(CRMOD | ECHO);
np->m_ttyb.sg_flags |= CBREAK;
# if defined(CYRILL) && defined(CSTYLE) && defined(CS_8BITS)
@@ -825,7 +805,6 @@ int flow, interrupt;
np->m_tchars.t_quitc = -1;
if (flow == 0)
{
- np->m_tchars.t_intrc = -1;
np->m_tchars.t_startc = -1;
np->m_tchars.t_stopc = -1;
}
@@ -847,18 +826,18 @@ int on;
#if defined(TERMIO) || defined(POSIX)
if (on)
{
- D_NewMode.tio.c_cc[VINTR] = intrc;
+ D_NewMode.tio.c_cc[VINTR] = iflag ? D_OldMode.tio.c_cc[VINTR] : VDISABLE;
#if defined(VSTART)
#if (VSTART < MAXCC)
- D_NewMode.tio.c_cc[VSTART] = startc;
+ D_NewMode.tio.c_cc[VSTART] = D_OldMode.tio.c_cc[VSTART];
#endif
#endif /* VSTART */
#if defined(VSTOP)
#if (VSTOP < MAXCC)
- D_NewMode.tio.c_cc[VSTOP] = stopc;
+ D_NewMode.tio.c_cc[VSTOP] = D_OldMode.tio.c_cc[VSTOP];
#endif
#endif /* VSTOP */
- D_NewMode.tio.c_iflag |= IXON;
+ D_NewMode.tio.c_iflag |= D_OldMode.tio.c_iflag & IXON;
}
else
{
@@ -884,9 +863,9 @@ int on;
#else /* POSIX || TERMIO */
if (on)
{
- D_NewMode.m_tchars.t_intrc = intrc;
- D_NewMode.m_tchars.t_startc = startc;
- D_NewMode.m_tchars.t_stopc = stopc;
+ D_NewMode.m_tchars.t_intrc = iflag ? D_OldMode.m_tchars.t_intrc : -1;
+ D_NewMode.m_tchars.t_startc = D_OldMode.m_tchars.t_startc;
+ D_NewMode.m_tchars.t_stopc = D_OldMode.m_tchars.t_stopc;
}
else
{
@@ -985,6 +964,18 @@ char *opt;
m->m_ttyb.sg_flags &= ~TANDEM;
#endif
}
+ else if (!strncmp("crtscts", opt, 7))
+ {
+#if (defined(POSIX) || defined(TERMIO)) && defined(CRTSCTS)
+ m->tio.c_cflag |= CRTSCTS;
+#endif
+ }
+ else if (!strncmp("-crtscts", opt, 8))
+ {
+#if (defined(POSIX) || defined(TERMIO)) && defined(CRTSCTS)
+ m->tio.c_cflag &= ~CRTSCTS;
+#endif
+ }
else
return -1;
while (*opt && !index(sep, *opt)) opt++;
@@ -1005,13 +996,16 @@ brktty(fd)
int fd;
{
#if defined(POSIX) && !defined(ultrix)
- setsid(); /* will break terminal affiliation */
-# if defined(BSD) && defined(TIOCSCTTY)
+ if (separate_sids)
+ setsid(); /* will break terminal affiliation */
+ /* GNU added for Hurd systems 2001-10-10 */
+# if defined(BSD) && defined(TIOCSCTTY) && !defined(__GNU__)
ioctl(fd, TIOCSCTTY, (char *)0);
# endif /* BSD && TIOCSCTTY */
#else /* POSIX */
# ifdef SYSV
- setpgrp(); /* will break terminal affiliation */
+ if (separate_sids)
+ setpgrp(); /* will break terminal affiliation */
# else /* SYSV */
# ifdef BSDJOBS
int devtty;
@@ -1043,24 +1037,27 @@ int fd;
* fgtty: Not a typewriter (25)
*/
# if defined(__osf__) || (BSD >= 199103) || defined(ISC)
- setsid(); /* should be already done */
+ if (separate_sids)
+ setsid(); /* should be already done */
# ifdef TIOCSCTTY
ioctl(fd, TIOCSCTTY, (char *)0);
# endif
# endif
# ifdef POSIX
- if (tcsetpgrp(fd, mypid))
- {
- debug1("fgtty: tcsetpgrp: %d\n", errno);
- return -1;
- }
+ if (separate_sids)
+ if (tcsetpgrp(fd, mypid))
+ {
+ debug1("fgtty: tcsetpgrp: %d\n", errno);
+ return -1;
+ }
# else /* POSIX */
if (ioctl(fd, TIOCSPGRP, (char *)&mypid) != 0)
debug1("fgtty: TIOSETPGRP: %d\n", errno);
# ifndef SYSV /* Already done in brktty():setpgrp() */
- if (setpgrp(fd, mypid))
- debug1("fgtty: setpgrp: %d\n", errno);
+ if (separate_sids)
+ if (setpgrp(fd, mypid))
+ debug1("fgtty: setpgrp: %d\n", errno);
# endif
# endif /* POSIX */
#endif /* BSDJOBS */
@@ -1253,8 +1250,8 @@ int n, closeopen;
#if !defined(TIOCCONS) && defined(SRIOCSREDIR)
-struct event consredir_ev;
-int consredirfd[2] = {-1, -1};
+static struct event consredir_ev;
+static int consredirfd[2] = {-1, -1};
static void
consredir_readev_fn(ev, data)
@@ -1298,7 +1295,7 @@ char *rc_name;
int sfd = -1;
if (on < 0)
- return; /* pty close will ungrab */
+ return 0; /* pty close will ungrab */
if (on)
{
if (displays == 0)
@@ -1461,15 +1458,14 @@ char *buf;
#if defined(CLOCAL) || defined(CRTSCTS)
GetTTY(fd, &mtio);
#endif
+ clocal = 0;
#ifdef CLOCAL
if (mtio.tio.c_cflag & CLOCAL)
{
clocal = 1;
*p++ = '{';
}
- else
#endif
- clocal = 0;
#ifdef TIOCM_CTS
# ifdef CRTSCTS
@@ -1491,8 +1487,8 @@ char *buf;
# else
# ifdef TIOCMODG
if (ioctl(fd, TIOCMODG, (char *)&mflags) < 0)
-# else
- if (ioctl(fd, TIOCMODG, &mflags) < 0)
+# else
+ if (ioctl(fd, MCGETA, &mflags) < 0)
# endif
# endif
{
@@ -1518,6 +1514,7 @@ char *buf;
while (*s) *p++ = *s++;
# endif
# ifdef TIOCM_CTS
+ s = "!CTS ";
if (!rtscts)
{
*p++ = '(';
@@ -1536,15 +1533,14 @@ char *buf;
while (*s) *p++ = *s++;
# endif
# if defined(TIOCM_CD) || defined(TIOCM_CAR)
+ s = "!CD ";
# ifdef TIOCGSOFTCAR
if (softcar)
{
*p++ = '(';
s = "!CD) ";
}
- else
# endif
- s = "!CD ";
# ifdef TIOCM_CD
if (mflags & TIOCM_CD) s++;
# else
diff --git a/tty.sh b/tty.sh
index e32454f..bceae53 100644
--- a/tty.sh
+++ b/tty.sh
@@ -24,7 +24,7 @@ sed -e '1,26d' \
chmod -w $1
exit 0
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -97,6 +97,8 @@ extern struct win *console_window;
static void consredir_readev_fn __P((struct event *, char *));
#endif
+int separate_sids = 1;
+
static void DoSendBreak __P((int, int, int));
static sigret_t SigAlrmDummy __P(SIGPROTOARG);
@@ -202,6 +204,15 @@ char *line, *opt;
#endif
SetTTY(f, &Mode);
+#if defined(linux) && defined(TIOCMSET)
+ {
+ int mcs = 0;
+ ioctl(f, TIOCMGET, &mcs);
+ mcs |= TIOCM_RTS;
+ ioctl(f, TIOCMSET, &mcs);
+ }
+#endif
+
brktty(f);
alarm(0);
signal(SIGALRM, sigalrm);
@@ -214,14 +225,6 @@ char *line, *opt;
* Tty mode handling
*/
-#if defined(TERMIO) || defined(POSIX)
-int intrc, origintrc = VDISABLE; /* display? */
-#else
-int intrc, origintrc = -1; /* display? */
-#endif
-static int startc, stopc; /* display? */
-
-
void
InitTTY(m, ttyflag)
struct mode *m;
@@ -246,9 +249,9 @@ IF{ONLCR} m->tio.c_oflag |= ONLCR;
IF{TAB3} m->tio.c_oflag |= TAB3;
IF{OXTABS} m->tio.c_oflag |= OXTABS;
/* IF{PARENB} m->tio.c_cflag |= PARENB; nah! jw. */
+IF{OPOST} m->tio.c_oflag |= OPOST;
}
-IF{OPOST} m->tio.c_oflag |= OPOST;
/*
* Or-ing the speed into c_cflags is dangerous.
@@ -327,10 +330,9 @@ XIF{VSTATUS} m->tio.c_cc[VSTATUS] = Ctrl('T');
IF{ISTRIP} m->tio.c_iflag |= ISTRIP;
IF{IXON} m->tio.c_iflag |= IXON;
-IF{OPOST} m->tio.c_oflag |= OPOST;
-
if (!ttyflag) /* may not even be good for ptys.. */
{
+IF{OPOST} m->tio.c_oflag |= OPOST;
IF{ICRNL} m->tio.c_iflag |= ICRNL;
IF{ONLCR} m->tio.c_oflag |= ONLCR;
IF{TAB3} m->tio.c_oflag |= TAB3;
@@ -410,7 +412,7 @@ IF{LCRTBS} | LCRTBS
# endif /* TERMIO */
#endif /* POSIX */
-#if defined(KANJI) && defined(TIOCKSET)
+#if defined(ENCODINGS) && defined(TIOCKSET)
m->m_jtchars.t_ascii = 'J';
m->m_jtchars.t_kanji = 'B';
m->m_knjmode = KM_ASCII | KM_SYSSJIS;
@@ -448,7 +450,7 @@ struct mode *mp;
ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); /* moved here for apollo. jw */
# endif
#endif
-#if defined(KANJI) && defined(TIOCKSET)
+#if defined(ENCODINGS) && defined(TIOCKSET)
ioctl(fd, TIOCKSETC, &mp->m_jtchars);
ioctl(fd, TIOCKSET, &mp->m_knjmode);
#endif
@@ -492,7 +494,7 @@ struct mode *mp;
ioctl(fd, TIOCGETD, (char *)&mp->m_ldisc);
# endif
#endif
-#if defined(KANJI) && defined(TIOCKSET)
+#if defined(ENCODINGS) && defined(TIOCKSET)
ioctl(fd, TIOCKGETC, &mp->m_jtchars);
ioctl(fd, TIOCKGET, &mp->m_knjmode);
#endif
@@ -510,6 +512,7 @@ int flow, interrupt;
{
*np = *op;
+ ASSERT(display);
#if defined(TERMIO) || defined(POSIX)
# ifdef CYTERMIO
np->m_mapkey = NOMAPKEY;
@@ -549,19 +552,11 @@ IF{IEXTEN} np->tio.c_lflag &= ~IEXTEN;
*/
np->tio.c_cc[VMIN] = 1;
np->tio.c_cc[VTIME] = 0;
-XIF{VSTART} startc = op->tio.c_cc[VSTART];
-XIF{VSTOP} stopc = op->tio.c_cc[VSTOP];
- if (interrupt)
- origintrc = intrc = op->tio.c_cc[VINTR];
- else
- {
- origintrc = op->tio.c_cc[VINTR];
- intrc = np->tio.c_cc[VINTR] = VDISABLE;
- }
+ if (!interrupt || !flow)
+ np->tio.c_cc[VINTR] = VDISABLE;
np->tio.c_cc[VQUIT] = VDISABLE;
if (flow == 0)
{
- np->tio.c_cc[VINTR] = VDISABLE;
XIF{VSTART} np->tio.c_cc[VSTART] = VDISABLE;
XIF{VSTOP} np->tio.c_cc[VSTOP] = VDISABLE;
np->tio.c_iflag &= ~IXON;
@@ -585,15 +580,8 @@ XIF{VREPRINT} np->tio.c_cc[VREPRINT] = VDISABLE;
XIF{VWERASE} np->tio.c_cc[VWERASE] = VDISABLE;
# endif /* HPUX_LTCHARS_HACK */
#else /* TERMIO || POSIX */
- startc = op->m_tchars.t_startc;
- stopc = op->m_tchars.t_stopc;
- if (interrupt)
- origintrc = intrc = op->m_tchars.t_intrc;
- else
- {
- origintrc = op->m_tchars.t_intrc;
- intrc = np->m_tchars.t_intrc = -1;
- }
+ if (!interrupt || !flow)
+ np->m_tchars.t_intrc = -1;
np->m_ttyb.sg_flags &= ~(CRMOD | ECHO);
np->m_ttyb.sg_flags |= CBREAK;
# if defined(CYRILL) && defined(CSTYLE) && defined(CS_8BITS)
@@ -603,7 +591,6 @@ XIF{VWERASE} np->tio.c_cc[VWERASE] = VDISABLE;
np->m_tchars.t_quitc = -1;
if (flow == 0)
{
- np->m_tchars.t_intrc = -1;
np->m_tchars.t_startc = -1;
np->m_tchars.t_stopc = -1;
}
@@ -625,10 +612,10 @@ int on;
#if defined(TERMIO) || defined(POSIX)
if (on)
{
- D_NewMode.tio.c_cc[VINTR] = intrc;
-XIF{VSTART} D_NewMode.tio.c_cc[VSTART] = startc;
-XIF{VSTOP} D_NewMode.tio.c_cc[VSTOP] = stopc;
- D_NewMode.tio.c_iflag |= IXON;
+ D_NewMode.tio.c_cc[VINTR] = iflag ? D_OldMode.tio.c_cc[VINTR] : VDISABLE;
+XIF{VSTART} D_NewMode.tio.c_cc[VSTART] = D_OldMode.tio.c_cc[VSTART];
+XIF{VSTOP} D_NewMode.tio.c_cc[VSTOP] = D_OldMode.tio.c_cc[VSTOP];
+ D_NewMode.tio.c_iflag |= D_OldMode.tio.c_iflag & IXON;
}
else
{
@@ -646,9 +633,9 @@ XIF{VSTOP} D_NewMode.tio.c_cc[VSTOP] = VDISABLE;
#else /* POSIX || TERMIO */
if (on)
{
- D_NewMode.m_tchars.t_intrc = intrc;
- D_NewMode.m_tchars.t_startc = startc;
- D_NewMode.m_tchars.t_stopc = stopc;
+ D_NewMode.m_tchars.t_intrc = iflag ? D_OldMode.m_tchars.t_intrc : -1;
+ D_NewMode.m_tchars.t_startc = D_OldMode.m_tchars.t_startc;
+ D_NewMode.m_tchars.t_stopc = D_OldMode.m_tchars.t_stopc;
}
else
{
@@ -747,6 +734,18 @@ char *opt;
m->m_ttyb.sg_flags &= ~TANDEM;
#endif
}
+ else if (!strncmp("crtscts", opt, 7))
+ {
+#if (defined(POSIX) || defined(TERMIO)) && defined(CRTSCTS)
+ m->tio.c_cflag |= CRTSCTS;
+#endif
+ }
+ else if (!strncmp("-crtscts", opt, 8))
+ {
+#if (defined(POSIX) || defined(TERMIO)) && defined(CRTSCTS)
+ m->tio.c_cflag &= ~CRTSCTS;
+#endif
+ }
else
return -1;
while (*opt && !index(sep, *opt)) opt++;
@@ -767,13 +766,16 @@ brktty(fd)
int fd;
{
#if defined(POSIX) && !defined(ultrix)
- setsid(); /* will break terminal affiliation */
-# if defined(BSD) && defined(TIOCSCTTY)
+ if (separate_sids)
+ setsid(); /* will break terminal affiliation */
+ /* GNU added for Hurd systems 2001-10-10 */
+# if defined(BSD) && defined(TIOCSCTTY) && !defined(__GNU__)
ioctl(fd, TIOCSCTTY, (char *)0);
# endif /* BSD && TIOCSCTTY */
#else /* POSIX */
# ifdef SYSV
- setpgrp(); /* will break terminal affiliation */
+ if (separate_sids)
+ setpgrp(); /* will break terminal affiliation */
# else /* SYSV */
# ifdef BSDJOBS
int devtty;
@@ -805,24 +807,27 @@ int fd;
* fgtty: Not a typewriter (25)
*/
# if defined(__osf__) || (BSD >= 199103) || defined(ISC)
- setsid(); /* should be already done */
+ if (separate_sids)
+ setsid(); /* should be already done */
# ifdef TIOCSCTTY
ioctl(fd, TIOCSCTTY, (char *)0);
# endif
# endif
# ifdef POSIX
- if (tcsetpgrp(fd, mypid))
- {
- debug1("fgtty: tcsetpgrp: %d\n", errno);
- return -1;
- }
+ if (separate_sids)
+ if (tcsetpgrp(fd, mypid))
+ {
+ debug1("fgtty: tcsetpgrp: %d\n", errno);
+ return -1;
+ }
# else /* POSIX */
if (ioctl(fd, TIOCSPGRP, (char *)&mypid) != 0)
debug1("fgtty: TIOSETPGRP: %d\n", errno);
# ifndef SYSV /* Already done in brktty():setpgrp() */
- if (setpgrp(fd, mypid))
- debug1("fgtty: setpgrp: %d\n", errno);
+ if (separate_sids)
+ if (setpgrp(fd, mypid))
+ debug1("fgtty: setpgrp: %d\n", errno);
# endif
# endif /* POSIX */
#endif /* BSDJOBS */
@@ -1015,8 +1020,8 @@ int n, closeopen;
#if !defined(TIOCCONS) && defined(SRIOCSREDIR)
-struct event consredir_ev;
-int consredirfd[2] = {-1, -1};
+static struct event consredir_ev;
+static int consredirfd[2] = {-1, -1};
static void
consredir_readev_fn(ev, data)
@@ -1060,7 +1065,7 @@ char *rc_name;
int sfd = -1;
if (on < 0)
- return; /* pty close will ungrab */
+ return 0; /* pty close will ungrab */
if (on)
{
if (displays == 0)
@@ -1211,15 +1216,14 @@ IF{MCTS}# define TIOCM_CTS MCTS
#if defined(CLOCAL) || defined(CRTSCTS)
GetTTY(fd, &mtio);
#endif
+ clocal = 0;
#ifdef CLOCAL
if (mtio.tio.c_cflag & CLOCAL)
{
clocal = 1;
*p++ = '{';
}
- else
#endif
- clocal = 0;
#ifdef TIOCM_CTS
# ifdef CRTSCTS
@@ -1241,8 +1245,8 @@ IF{MCTS}# define TIOCM_CTS MCTS
# else
# ifdef TIOCMODG
if (ioctl(fd, TIOCMODG, (char *)&mflags) < 0)
-# else
- if (ioctl(fd, TIOCMODG, &mflags) < 0)
+# else
+ if (ioctl(fd, MCGETA, &mflags) < 0)
# endif
# endif
{
@@ -1268,6 +1272,7 @@ IF{MCTS}# define TIOCM_CTS MCTS
while (*s) *p++ = *s++;
# endif
# ifdef TIOCM_CTS
+ s = "!CTS ";
if (!rtscts)
{
*p++ = '(';
@@ -1286,15 +1291,14 @@ IF{MCTS}# define TIOCM_CTS MCTS
while (*s) *p++ = *s++;
# endif
# if defined(TIOCM_CD) || defined(TIOCM_CAR)
+ s = "!CD ";
# ifdef TIOCGSOFTCAR
if (softcar)
{
*p++ = '(';
s = "!CD) ";
}
- else
# endif
- s = "!CD ";
# ifdef TIOCM_CD
if (mflags & TIOCM_CD) s++;
# else
diff --git a/utf8encodings/01 b/utf8encodings/01
new file mode 100644
index 0000000..a6dde0f
--- /dev/null
+++ b/utf8encodings/01
Binary files differ
diff --git a/utf8encodings/02 b/utf8encodings/02
new file mode 100644
index 0000000..78a5cc0
--- /dev/null
+++ b/utf8encodings/02
Binary files differ
diff --git a/utf8encodings/03 b/utf8encodings/03
new file mode 100644
index 0000000..4c04358
--- /dev/null
+++ b/utf8encodings/03
Binary files differ
diff --git a/utf8encodings/04 b/utf8encodings/04
new file mode 100644
index 0000000..233f2ae
--- /dev/null
+++ b/utf8encodings/04
Binary files differ
diff --git a/utf8encodings/18 b/utf8encodings/18
new file mode 100644
index 0000000..9c7e9c0
--- /dev/null
+++ b/utf8encodings/18
Binary files differ
diff --git a/utf8encodings/a1 b/utf8encodings/a1
new file mode 100644
index 0000000..f39ce11
--- /dev/null
+++ b/utf8encodings/a1
Binary files differ
diff --git a/utf8encodings/bf b/utf8encodings/bf
new file mode 100644
index 0000000..397c128
--- /dev/null
+++ b/utf8encodings/bf
Binary files differ
diff --git a/utf8encodings/c2 b/utf8encodings/c2
new file mode 100644
index 0000000..58e8ffd
--- /dev/null
+++ b/utf8encodings/c2
Binary files differ
diff --git a/utf8encodings/c3 b/utf8encodings/c3
new file mode 100644
index 0000000..9407ed8
--- /dev/null
+++ b/utf8encodings/c3
Binary files differ
diff --git a/utf8encodings/c4 b/utf8encodings/c4
new file mode 100644
index 0000000..1dcd5fa
--- /dev/null
+++ b/utf8encodings/c4
Binary files differ
diff --git a/utf8encodings/c6 b/utf8encodings/c6
new file mode 100644
index 0000000..12159ca
--- /dev/null
+++ b/utf8encodings/c6
Binary files differ
diff --git a/utf8encodings/c7 b/utf8encodings/c7
new file mode 100644
index 0000000..e8f2b37
--- /dev/null
+++ b/utf8encodings/c7
Binary files differ
diff --git a/utf8encodings/c8 b/utf8encodings/c8
new file mode 100644
index 0000000..36a74b6
--- /dev/null
+++ b/utf8encodings/c8
Binary files differ
diff --git a/utf8encodings/cc b/utf8encodings/cc
new file mode 100644
index 0000000..fc16e8f
--- /dev/null
+++ b/utf8encodings/cc
Binary files differ
diff --git a/utf8encodings/cd b/utf8encodings/cd
new file mode 100644
index 0000000..b9d3e80
--- /dev/null
+++ b/utf8encodings/cd
Binary files differ
diff --git a/utf8encodings/d6 b/utf8encodings/d6
new file mode 100644
index 0000000..4025ca0
--- /dev/null
+++ b/utf8encodings/d6
Binary files differ
diff --git a/utmp.c b/utmp.c
index 2a172d4..440741b 100644
--- a/utmp.c
+++ b/utmp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -33,7 +33,15 @@ RCS_ID("$Id: utmp.c,v 1.7 1994/05/31 12:33:21 mlschroe Exp $ FAU")
#include "screen.h"
#include "extern.h"
+#ifdef HAVE_UTEMPTER
+#include <utempter.h>
+#endif
+
+
extern struct display *display;
+#ifdef CAREFULUTMP
+extern struct win *windows;
+#endif
extern struct win *fore;
extern char *LoginName;
extern int real_uid, eff_uid;
@@ -190,6 +198,7 @@ int how;
Msg(0, "This window is now logged in.");
else
Msg(0, "This window should now be logged in.");
+ WindowChanged(fore, 'f');
}
else
Msg(0, "This window is already logged in.");
@@ -215,6 +224,7 @@ int how;
#ifdef CAREFULUTMP
CarefulUtmp();
#endif
+ WindowChanged(fore, 'f');
}
}
}
diff --git a/window.c b/window.c
index 5dc2dd7..789debe 100644
--- a/window.c
+++ b/window.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -55,6 +55,7 @@ extern struct event logflushev;
extern int log_flush, logtstamp_after;
extern int ZombieKey_destroy, ZombieKey_resurrect;
extern struct layer *flayer;
+extern int maxusercount;
#if defined(TIOCSWINSZ) || defined(TIOCGWINSZ)
extern struct winsize glwz;
@@ -64,9 +65,13 @@ extern struct winsize glwz;
extern int aixhack;
#endif
+#ifdef O_NOCTTY
+extern int separate_sids;
+#endif
+
static void WinProcess __P((char **, int *));
static void WinRedisplayLine __P((int, int, int, int));
-static void WinClearLine __P((int, int, int));
+static void WinClearLine __P((int, int, int, int));
static int WinRewrite __P((int, int, int, struct mchar *, int));
static int WinResize __P((int, int));
static void WinRestore __P((void));
@@ -112,9 +117,10 @@ struct NewWindow nwin_undef =
-1, /* wrap */
-1, /* logging */
-1, /* slowpaste */
- -1, /* c1 */
-1, /* gr */
- -1, /* kanji */
+ -1, /* c1 */
+ -1, /* bce */
+ -1, /* encoding */
(char *)0, /* hstatus */
(char *)0 /* charset */
};
@@ -136,9 +142,10 @@ struct NewWindow nwin_default =
1, /* wrap */
0, /* logging */
0, /* slowpaste */
- 1, /* c1 */
0, /* gr */
- 0, /* kanji */
+ 1, /* c1 */
+ 0, /* bce */
+ 0, /* encoding */
(char *)0, /* hstatus */
(char *)0 /* charset */
};
@@ -168,9 +175,10 @@ struct NewWindow *def, *new, *res;
COMPOSE(wrap);
COMPOSE(Lflag);
COMPOSE(slow);
- COMPOSE(c1);
COMPOSE(gr);
- COMPOSE(kanji);
+ COMPOSE(c1);
+ COMPOSE(bce);
+ COMPOSE(encoding);
COMPOSE(hstatus);
COMPOSE(charset);
#undef COMPOSE
@@ -358,13 +366,9 @@ int y, from, to, isblank;
return;
fore = (struct win *)flayer->l_data;
if (from == 0 && y > 0 && fore->w_mlines[y - 1].image[fore->w_width] == 0)
- {
- struct mchar nc;
- copy_mline2mchar(&nc, &fore->w_mlines[y], 0);
- LWrapChar(&fore->w_layer, &nc, y - 1, -1, -1, 0);
- from++;
- }
- LCDisplayLine(&fore->w_layer, &fore->w_mlines[y], y, from, to, isblank);
+ LCDisplayLineWrap(&fore->w_layer, &fore->w_mlines[y], y, from, to, isblank);
+ else
+ LCDisplayLine(&fore->w_layer, &fore->w_mlines[y], y, from, to, isblank);
}
static int
@@ -373,12 +377,15 @@ int y, x1, x2, doit;
struct mchar *rend;
{
register int cost, dx;
- register char *p, *i;
+ register unsigned char *p, *i;
#ifdef FONT
- register char *f;
+ register unsigned char *f;
#endif
#ifdef COLOR
- register char *c;
+ register unsigned char *c;
+# ifdef COLORS256
+ register unsigned char *cx;
+# endif
#endif
debug3("WinRewrite %d, %d-%d\n", y, x1, x2);
@@ -394,9 +401,20 @@ struct mchar *rend;
p = fore->w_mlines[y].attr + x1;
#ifdef FONT
f = fore->w_mlines[y].font + 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;
@@ -411,17 +429,22 @@ struct mchar *rend;
#ifdef COLOR
if (*c++ != rend->color)
return EXPENSIVE;
+# ifdef COLORS256
+ if (*cx++ != rend->colorx)
+ return EXPENSIVE;
+# endif
#endif
}
return cost;
}
static void
-WinClearLine(y, xs, xe)
-int y, xs, xe;
+WinClearLine(y, xs, xe, bce)
+int y, xs, xe, bce;
{
fore = (struct win *)flayer->l_data;
- LClearLine(flayer, y, xs, xe, &fore->w_mlines[y]);
+ debug3("WinClearLine %d %d-%d\n", y, xs, xe);
+ LClearLine(flayer, y, xs, xe, bce, &fore->w_mlines[y]);
}
static int
@@ -451,6 +474,7 @@ WinRestore()
InsertMode(fore->w_insert);
ReverseVideo(fore->w_revvid);
CursorVisibility(fore->w_curinv ? -1 : fore->w_curvvis);
+ MouseMode(fore->w_mouse);
}
}
@@ -510,7 +534,7 @@ struct NewWindow *newwin;
int type;
char *TtyName;
#ifdef MULTIUSER
- extern struct user *users;
+ extern struct acluser *users;
#endif
debug1("NewWindow: StartAt %d\n", newwin->StartAt);
@@ -624,11 +648,27 @@ 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
@@ -638,6 +678,8 @@ struct NewWindow *newwin;
p->w_norefresh = 0;
strncpy(p->w_tty, TtyName, MAXSTR - 1);
+#if 0
+ /* XXX Fixme display resize */
if (ChangeWindowSize(p, display ? D_defwidth : 80,
display ? D_defheight : 24,
nwin.histheight))
@@ -645,10 +687,19 @@ struct NewWindow *newwin;
FreeWindow(p);
return -1;
}
-#ifdef KANJI
- p->w_kanji = nwin.kanji;
+#else
+ if (ChangeWindowSize(p, display ? D_forecv->c_xe - D_forecv->c_xs + 1: 80,
+ display ? D_forecv->c_ye - D_forecv->c_ys + 1 : 24,
+ nwin.histheight))
+ {
+ FreeWindow(p);
+ return -1;
+ }
#endif
- ResetWindow(p); /* sets w_wrap, w_c1, w_gr */
+
+ 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);
@@ -704,18 +755,19 @@ struct NewWindow *newwin;
*pp = p;
p->w_next = windows;
windows = p;
+ p->w_lflag = nwin.lflag;
#ifdef UTMPOK
p->w_slot = (slot_t)-1;
# ifdef LOGOUTOK
debug1("MakeWindow will %slog in.\n", nwin.lflag?"":"not ");
- if (nwin.lflag)
+ if (nwin.lflag & 1)
# else /* LOGOUTOK */
debug1("MakeWindow will log in, LOGOUTOK undefined in config.h%s.\n",
nwin.lflag?"":" (although lflag=0)");
# endif /* LOGOUTOK */
{
p->w_slot = (slot_t)0;
- if (display)
+ if (display || (p->w_lflag & 2))
SetUtmp(p);
}
# ifdef CAREFULUTMP
@@ -757,6 +809,7 @@ struct NewWindow *newwin;
Activate(p->w_norefresh);
WindowChanged((struct win*)0, 'w');
WindowChanged((struct win*)0, 'W');
+ WindowChanged((struct win*)0, 0);
return n;
}
@@ -804,8 +857,8 @@ struct win *p;
#ifdef BUILTIN_TELNET
if (p->w_type == W_TYPE_TELNET)
{
- if (TelConnect(p))
- return -1;
+ if (TelConnect(p))
+ return -1;
}
else
#endif
@@ -817,12 +870,13 @@ struct win *p;
}
#ifdef UTMPOK
- if (display && p->w_slot == (slot_t)0)
+ if (p->w_slot == (slot_t)0 && (display || (p->w_lflag & 2)))
SetUtmp(p);
# ifdef CAREFULUTMP
CarefulUtmp(); /* If all 've been zombies, we've had no slot */
# endif
#endif
+ WindowChanged(p, 'f');
return p->w_number;
}
@@ -1065,7 +1119,24 @@ char **args, *ttyn;
int i, pat, wfdused;
struct pseudowin *pwin = win->w_pwin;
#endif
+#if (defined(sun) || defined(_IBMR2)) && defined(O_NOCTTY)
+ int slave;
+#endif
+#if defined(sun) && defined(O_NOCTTY)
+ /* sun's utmp_update program opens the salve side, thus corrupting
+ * pty semantics */
+ debug("pre-opening slave...\n");
+ if ((slave = open(ttyn, O_RDWR|O_NOCTTY)) == -1)
+ {
+ Msg(errno, "ttyn");
+ return -1;
+ }
+#endif
+#if defined(_IBMR2) && defined(O_NOCTTY)
+ slave = aixhack;
+ aixhack = -1;
+#endif
debug("forking...\n");
proc = *args;
if (proc == 0)
@@ -1118,14 +1189,14 @@ char **args, *ttyn;
if (dfp && dfp != stderr)
fclose(dfp);
#endif
-#ifdef _IBMR2
+#if (defined(sun) || defined(_IBMR2)) && defined(O_NOCTTY)
close(0);
- dup(aixhack);
- close(aixhack);
-#endif
+ dup(slave);
+ close(slave);
+ closeallfiles(win->w_ptyfd);
+ slave = dup(0);
+#else
closeallfiles(win->w_ptyfd);
-#ifdef _IBMR2
- aixhack = dup(0);
#endif
#ifdef DEBUG
if (dfp) /* do not produce child debug, when debug is "off" */
@@ -1158,7 +1229,15 @@ char **args, *ttyn;
{
if (newfd < 0)
{
- if ((newfd = open(ttyn, O_RDWR)) < 0)
+# 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);
}
else
@@ -1181,19 +1260,27 @@ char **args, *ttyn;
Msg(errno, "Warning: clear NBLOCK fcntl failed");
}
#else /* PSEUDOS */
- if ((newfd = open(ttyn, O_RDWR)) != 0)
+# 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);
-#ifdef _IBMR2
- close(aixhack);
+#if (defined(sun) || defined(_IBMR2)) && defined(O_NOCTTY)
+ close(slave);
#endif
if (newfd >= 0)
{
struct mode fakemode, *modep;
- InitPty(newfd);
+ InitPTY(newfd);
if (fgtty(newfd))
Msg(errno, "fgtty");
if (display)
@@ -1288,9 +1375,8 @@ char **args, *ttyn;
default:
break;
}
-#ifdef _IBMR2
- close(aixhack);
- aixhack = -1;
+#if (defined(sun) || defined(_IBMR2)) && defined(O_NOCTTY)
+ close(slave);
#endif
return pid;
}
@@ -1463,12 +1549,6 @@ char **av;
FreePseudowin(w);
return -1;
}
- if (ioctl(w->w_ptyfd, TIOCPKT, (char *)&flag))
- {
- Msg(errno, "TIOCPKT ioctl on parent");
- FreePseudowin(w);
- return -1;
- }
}
#endif /* TIOCPKT */
@@ -1503,16 +1583,10 @@ struct win *w;
close(pwin->p_ptyfd);
evdeq(&pwin->p_readev);
evdeq(&pwin->p_writeev);
+ if (w->w_readev.condneg == &pwin->p_inlen)
+ w->w_readev.condpos = w->w_readev.condneg = 0;
free((char *)pwin);
w->w_pwin = NULL;
-#ifdef TIOCPKT
- {
- int flag = 1;
-
- if (ioctl(w->w_ptyfd, TIOCPKT, (char *)&flag))
- Msg(errno, "TIOCPKT reset on parent failed");
- }
-#endif /* TIOCPKT */
}
#endif /* PSEUDOS */
@@ -1678,7 +1752,7 @@ char *data;
}
debug1("going to read from window fd %d\n", ev->fd);
- if ((len = read(ev->fd, buf, size)) <= 0)
+ if ((len = read(ev->fd, buf, size)) < 0)
{
if (errno == EINTR || errno == EAGAIN)
return;
@@ -1686,7 +1760,13 @@ char *data;
if (errno == EWOULDBLOCK)
return;
#endif
- debug2("Window %d: read error (errno %d) - killing window\n", p->w_number, len ? errno : 0);
+ debug2("Window %d: read error (errno %d) - killing window\n", p->w_number, errno);
+ WindowDied(p);
+ return;
+ }
+ if (len == 0)
+ {
+ debug1("Window %d: EOF - killing window\n", p->w_number);
WindowDied(p);
return;
}
@@ -1698,9 +1778,9 @@ char *data;
{
debug1("PAKET %x\n", buf[0]);
if (buf[0] & TIOCPKT_NOSTOP)
- NewAutoFlow(p, 0);
+ WNewAutoFlow(p, 0);
if (buf[0] & TIOCPKT_DOSTOP)
- NewAutoFlow(p, 1);
+ WNewAutoFlow(p, 1);
}
bp++;
len--;
diff --git a/window.h b/window.h
index 600b19d..0035c7d 100644
--- a/window.h
+++ b/window.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1993
+/* Copyright (c) 1993-2002
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
@@ -41,9 +41,10 @@ struct NewWindow
int wrap;
int Lflag; /* logging */
int slow; /* inter character milliseconds */
- int c1;
int gr;
- int kanji;
+ int c1;
+ int bce;
+ int encoding;
char *hstatus;
char *charset;
};
@@ -154,7 +155,7 @@ struct win
#ifdef MULTIUSER
int w_wlock; /* WLOCK_AUTO, WLOCK_OFF, WLOCK_ON */
- struct user *w_wlockuser; /* NULL when unlocked or user who writes */
+ 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 */
@@ -169,7 +170,7 @@ struct win
char w_FontR; /* character font GR */
int w_Charset; /* charset number GL */
int w_CharsetR; /* charset number GR */
- int w_charsets[4]; /* Font = charsets[Charset] */
+ int w_charsets[5]; /* Font = charsets[Charset] */
#endif
int w_ss;
int w_saved;
@@ -178,7 +179,7 @@ struct win
#ifdef FONT
int w_SavedCharset;
int w_SavedCharsetR;
- int w_SavedCharsets[4];
+ int w_SavedCharsets[5];
#endif
int w_top, w_bot; /* scrollregion */
int w_wrap; /* autowrap */
@@ -193,8 +194,12 @@ struct win
char *w_hstatus; /* hardstatus line */
int w_gr; /* enable GR flag */
int w_c1; /* enable C1 flag */
-#ifdef KANJI
- int w_kanji; /* for input and paste */
+ int w_bce; /* enable backcol erase */
+#if 0
+ int w_encoding; /* for input and paste */
+#endif
+ int w_decodestate; /* state of our input decoder */
+#ifdef DW_CHARS
int w_mbcs; /* saved char for multibytes charset */
#endif
char w_string[MAXSTR];
@@ -209,6 +214,10 @@ 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 HAVE_BRAILLE
int w_bd_x, w_bd_y; /* Braille cursor position */
#endif
@@ -228,6 +237,7 @@ struct win
char *w_dir; /* directory for chdir */
char *w_term; /* TERM to be set instead of "screen" */
+ int w_lflag; /* login flag */
slot_t w_slot; /* utmp slot */
#if defined (UTMPOK)
struct utmp w_savut; /* utmp entry of this window */
@@ -249,6 +259,7 @@ struct win
};
+#define w_encoding w_layer.l_encoding
#define w_width w_layer.l_width
#define w_height w_layer.l_height
#define w_x w_layer.l_x