summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FAQ233
-rw-r--r--src/INSTALL93
-rw-r--r--src/Makefile2
-rw-r--r--src/Makefile.in213
-rw-r--r--src/NEWS139
-rw-r--r--src/README6
-rw-r--r--src/acl.c64
-rw-r--r--src/ansi.c897
-rw-r--r--src/ansi.h20
-rw-r--r--src/attacher.c195
-rw-r--r--src/comm.c59
-rw-r--r--src/comm.h.dist223
-rw-r--r--src/comm.sh8
-rw-r--r--src/config.h.in70
-rwxr-xr-xsrc/configure2489
-rw-r--r--src/configure.in420
-rw-r--r--src/display.c1133
-rw-r--r--src/display.h291
-rw-r--r--src/doc/Makefile.in27
-rwxr-xr-xsrc/doc/install.sh119
-rw-r--r--src/doc/screen.11080
-rw-r--r--src/doc/screen.info164
-rw-r--r--src/doc/screen.info-11502
-rw-r--r--src/doc/screen.info-21270
-rw-r--r--src/doc/screen.info-31302
-rw-r--r--src/doc/screen.info-4237
-rw-r--r--src/doc/screen.texinfo800
-rw-r--r--src/etc/etcscreenrc (renamed from src/etcscreenrc)35
-rwxr-xr-xsrc/etc/mkinstalldirs35
-rwxr-xr-xsrc/etc/newsyntax (renamed from src/newsyntax)0
-rw-r--r--src/etc/screenrc79
-rw-r--r--src/extern.h58
-rw-r--r--src/fileio.c154
-rw-r--r--src/help.c384
-rw-r--r--src/input.c29
-rwxr-xr-xsrc/install.sh119
-rw-r--r--src/kmapdef.c.dist130
-rw-r--r--src/loadav.c34
-rw-r--r--src/mark.c376
-rw-r--r--src/misc.c220
-rw-r--r--src/os.h368
-rw-r--r--src/osdef.h.in13
-rw-r--r--src/osdef.sh5
-rw-r--r--src/overlay.h26
-rw-r--r--src/patchlevel.h60
-rw-r--r--src/process.c1168
-rw-r--r--src/pty.c160
-rw-r--r--src/putenv.c18
-rw-r--r--src/resize.c78
-rw-r--r--src/screen.c598
-rw-r--r--src/screen.h24
-rw-r--r--src/search.c50
-rw-r--r--src/socket.c811
-rw-r--r--src/tek.patch79
-rw-r--r--src/term.c116
-rw-r--r--src/term.h.dist292
-rw-r--r--src/term.sh108
-rw-r--r--src/termcap.c654
-rw-r--r--src/terminfo/checktc.c10
-rw-r--r--src/terminfo/sco.mail (renamed from src/terminfo/screen-sco.mail)0
-rw-r--r--src/terminfo/screencap19
-rw-r--r--src/terminfo/screeninfo.src40
-rw-r--r--src/tty.c.dist203
-rw-r--r--src/tty.sh171
-rw-r--r--src/utmp.c480
-rw-r--r--src/window.c329
-rw-r--r--src/window.h56
67 files changed, 15519 insertions, 5126 deletions
diff --git a/src/FAQ b/src/FAQ
new file mode 100644
index 0000000..05130a2
--- /dev/null
+++ b/src/FAQ
@@ -0,0 +1,233 @@
+ jw 21.10.93
+ 05.05.94
+
+ screen: frequently asked questions -- known problems -- unimplemented bugs
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+
+Q: Why is it impossible to download a file with Kermit/sz/rz when
+ screen is running? Do I need to set some special variables?
+
+A: Screen always interprets control-sequences sent by the
+ applications and translates/optimizes them for the current
+ terminal type. Screen always parses the user input for its
+ escape character (CTRL-A). Both are basic screen features and
+ cannot be switched off. Even if it were possible to switch
+ screen into a completely transparent mode, you could never switch
+ between windows, while kermit/sz/rz is downloading a file. You
+ must wait til the end as kermit/sz/rz will not transmit your
+ input during a file transfer and as kermit/sz/rz would be very
+ confused if screen switched away the window containing the
+ other kermit/sz/rz. Simply detach your screen session for each
+ file transfer and start the transfer program only from the shell
+ where you started screen.
+
+Q: I am using screen with a YYY terminal, which supports the XXX
+ graphic language. I am very happy with it, except one thing: I
+ cannot render graphics into screen windows.
+
+A: You are out of luck there. Screen provides a fixed set of escape
+ sequences in order to make it possible to switch terminal types.
+ Screen has to know exactly what the escape sequences do to the
+ terminal because it must hold an image in memory. Otherwise
+ screen could not restore the image if you switch to another
+ window. Because of this you have to change screens escape
+ sequence parser (ansi.c) to pass the XXX graphics sequences to
+ the terminal. Of course the graphics will be lost if you switch
+ to another window. Screen will only honour graphics sequences
+ that are demanded by an overwhelming majority.
+
+Q: For some unknown reason, the fifo in /tmp/screens/S-myname is
+ gone, and i can't resume my screen session. Is there a way to
+ recreate the fifo?
+
+A: Screen checks the fifo/socket whenever it receives a SIGCHLD
+ signal. If missing, the fifo/socket is recreated then. If screen
+ is running non set-uid the user can issue a 'kill -CHLD
+ screenpid' directly (it is -CHILD on some systems). Screenpid is
+ the process-id of the screen process found in a 'ps -x' listing.
+ But usually this won't work, as screen should be installed set-
+ uid root. In this case you will not be able to send it a signal,
+ but the kernel will. It does so, whenever a child of screen
+ changes its state. Find the process-id (shellpid below) of the
+ "least important" shell running inside screen. The try 'kill
+ -STOP shellpid'. If the fifo/socket does not reappear, destroy
+ the shell process. You sacrify one shell to save the rest. If
+ nothing works, please do not forget to remove all processes
+ running in the lost screen session.
+
+Q: When you start "screen" a page of text comes up to start you
+ off. Is there a way to get rid of this text as a command line
+ argument or by using a switch of some sort.
+
+A: Just put the following line in your ~/.screenrc:
+ startup_message off
+ Many peole ask this, although it is in the man page, too :-)
+
+Q: Start "screen emacs" and run emacs function suspend-emacs
+ (ctrl-z). The window containing emacs vanishes.
+
+A: This is a known bug. Unfortunatly there is no easy fix
+ because this is specified in the POSIX standard. When a new
+ window is created Screen opens up a new session because the
+ window has to get the pty as a controlling terminal (a
+ session can only have one controlling terminal). With the
+ setsid() call the process also creates a new process
+ group. This process group is orphaned, because there is no
+ process in the session which is not in the process
+ group. Now if the process group leader (i.e. your program)
+ gets a TTIN/TTOU/TSTP, POSIX states that the kernel must
+ send a KILL signal to the process group because there is no
+ one left to continue the process. Even if screen would
+ try to restart the program, that would be after it received the
+ KILL signal which cannot be caught or ignored.
+
+ tromey@klab.caltech.edu (Tom Tromey): I've noticed this exact
+ same problem. I put this in my .emacs file. It seems to work:
+
+ ;; If running under screen, disable C-z.
+ (if (and (getenv "STY") (not window-system))
+ (global-unset-key "\C-z"))
+
+Q: Screen gets the terminal size wrong and messes up.
+
+A: Before you start screen: Check with 'stty -a' what the terminal
+ driver thinks about rows and columns. Check the environment
+ variables LINES and COLUMNS. Then from within screen check with
+ the info command (CTRL-A i) what size screen thinks your terminal
+ is. If correcting tty driver setting and environment variables
+ does not help, look up the terminal capability definition. First
+ the TERMCAP environment variable. If this is not set, look up the
+ terminals name as defined in the environment variable TERM in
+ /etc/termcap or in the terminfo database with untic or infocmp.
+ There may be :li=...: and :co=...: or even :ll=...: entries
+ (cols#... and lines#... when it's terminfo) defined incorrectly.
+ Either construct your own TERMCAP environment variables with
+ correct settings, use screens terminfo/termcap command in your
+ .screenrc file or have the database corrected by the system
+ administrator.
+
+Q: Screen messes up the terminal output when I use my favourite ap-
+ plication. Setting the terminal size does not help.
+
+A: Probably you got the termcap/terminfo entries wrong. Fixing this
+ is a three stage procedure. First, find out if terminfo or
+ termcap is used. If your system only has /etc/termcap,
+ but not /usr/lib/terminfo/... then you are using termcap.
+ Easy. But if your system has both, then it depends how the appli-
+ cation and how screen were linked. Beware, if your applica-
+ tion runs on another host via rlogin, telnet or the like, you
+ should check the terminfo/termcap databases there. If you cannot
+ tell if terminfo or termcap is used (or you just want to be
+ save), the do all steps in stage 3 in parallel for both
+ systems (on all envolved hosts). Second: Understand the basic
+ rules how screen does its terminal emulation. When screen is
+ started or reattached, it relies on the TERM environment variable
+ to correctly reflect the terminal type you have physically
+ in front of you. And the entry should either exist in the system
+ terminfo/termcap database or be specified via the TERMCAP en-
+ vironment variable (if screen is using the termcap system). On
+ the other end, screen understands one set of control codes. It
+ relies on the application using these codes. This means applica-
+ tions that run under screen must be able to adapt their con-
+ trol codes to screen. The application should use the TERM vari-
+ able and termcap or terminfo library to find out how to drive
+ its terminal. When running under screen, the terminal is virtual
+ and is only defined by the set of control codes that screen
+ understands. The TERM variable is automatically set to
+ "screen" and the "screen"-entries should exist in the data-
+ bases. If your application uses hardcoded control codes rather
+ than a database, you are on your own. Hint: The codes under-
+ stood by screen are a superset of the very common definition
+ named "vt100". Look at the documentation of screen. The
+ codes are listed there. Third: Have the entry "screen" in-
+ stalled on all hosts or make sure you can live with "vt100".
+ Check the codes sent by your application, when the TERM variable
+ is set to "screen". Do not try to set the TERM variable inside
+ screen to anything other than "screen" or "vt100" or compati-
+ ble. Thus your application can drive screen correctly. Also take
+ care that a good entry is installed for your physical terminal
+ that screen has to drive. Even if the entry was good enough
+ for your application to drive the terminal directly, screen may
+ find flaws, as it tries to use other capabilities while op-
+ timizing the screen output. The screenrc commands
+ "termcap" and/or "terminfo" may help to fine-tune capabilities
+ without calling the supervisor to change the database.
+
+Q: I cannot configure screen. Sed does not work.
+
+A: The regular expressions used in our configure scrip are too
+ complicated for GNU sed version 2.03. In this regard it is bug
+ compatible with Ultrix 3.1 "sed": GNU sed version 2.03 dumps
+ core with our configure script. Try an older release. E.g. from
+ ftp.uni-erlangen.de:/pub/utilities/screen/sed-2.02b.tar.gz
+
+Q: When reattaching a session from a different Workstation, the
+ DISPLAY environment variable should be updated. Even ``CTLR-A
+ : setenv DISPLAY newhost:0'' does not work as expected.
+
+A: Under unix every process has its own environment. The environ-
+ ment of the SCREEN process can be changed with the `setenv' com-
+ mand. This however cannot affect the environment of the
+ shells or applications already running under screen. Subsequently
+ spawned processes will reflect the changes. One should be aware
+ of this problem when running applications from very old shells.
+ Screen is a means for keeping processes alive.
+
+Q: About once every 5 times I ran the program, rather than getting
+ a "screen," I got someone elses IRC output/input.
+
+A: What probably happened is that an IRC process was left running on
+ a pseudo tty in such a way that the kernel thought the tty was
+ available for reallocation. You can fix this behaviour by
+ applying the SunOS 4.1.x tty jumbo patch (100513-04).
+
+Q: Screen compiled on SunOS 5.3 cannot reattach a detached session.
+
+A: You are using /usr/ucb/cc, this compiler is wrong. Actually it
+ links with a C-library that mis-interprets dirent. Try again
+ with /opt/SUNWspro/bin/cc!
+
+Q: The "talk" command does not work when Screen is active.
+
+A: Talk and several other programs rely on entries in the Utmp-
+ Database (/etc/utmp). On some systems this Database is world
+ writable, on others it is not. If it is not, screen must be
+ installed with the appropriate permissions (user or group s-bit)
+ just like any program that uses PTYs (rlogin, xterm, ...). When
+ screen cannot write to utmp, you will see messages on you display
+ which do not belong to any screen window.
+ When screen can update utmp, it is not guaranteed that it does as
+ you expect. First this depends on the config.h file defining
+ UTMPOK, LOGINDEFAULT, and perhaps CAREFULUTMP. Second it depends
+ on the screenrc files (system wide and per user), if utmp entries
+ are done. Third, you can control whether windows are logged in
+ with screens ``login'' command.
+
+Q: Seteuid() does not work as expected in AIX. Attempting a multi-
+ user-attach results in a screen-panic: "seteuid: not owner".
+
+A: This is not a screen problem. According to Kay Nettle
+ (pkn@cs.utexas.edu) you need the AIX patch PTF 423674.
+
+Q: When I type cd directory (any directory or just blank) from
+ within one of the windows in screen, the whole thing just freezes
+ up.
+
+A: You display the current working directory in xterm's title bar,
+ This may be caused by hardcoded ESC-sequences in the shell prompt
+ or in an cd alias. In Xterm the coding is
+ ESC ] n ; string_to_display ^G
+ where n = 1, 2, 3 selects the location of the displayed string.
+ Screen misinterprets this as the ansi operating system comment
+ sequence:
+ ESC ] osc_string
+ and waits (according to ansi) for the string terminator
+ ESC \
+ Screen versions after 3.5.12 may provide a workaround.
+
+Q: Mesg or biff cannot be turned on or off while running screen.
+
+A: Screen failed to change the owner of the pty it uses. You need to
+ install screen setuid-root. See the file INSTALL for details.
+
diff --git a/src/INSTALL b/src/INSTALL
index 24330a3..f70a655 100644
--- a/src/INSTALL
+++ b/src/INSTALL
@@ -1,22 +1,44 @@
-Installation of screen3.3
+Installation of screen3.6 jw 10.01.95
-0.)
+
+0.) This instruction is quite lengthy
+-------------------------------------
+.. and there are still important items near the end. Start here:
Unpack. Screen comes as a compressed tar archive. You need gzip to uncompress.
-But... you probably already managed that step, when you are reading this.
+and... well, you probably already managed that step, when you are reading this.
-1.)
-Run configure. This should create a Makefile and a config.h file
+1.) configure & config.status
+-----------------------------
+Run configure. This should create a reasonable Makefile and a config.h file
suited for your machine. Rename config.status to reflect the architecture
(hostname) where it was built. To reconfigure quickly for that architecture
just run that config.status file.
If this process fails, try to find out what configure did do and what it
should have checked. Mail me.
+Actually the initial Makefile that comes with the distribution just runs
+configure -- thus you can start by typing 'make' right after unpacking.
+You will be prompted to run 'make' again, which will really make screen.
-2.)
-Look through the Makefile & user configuration section in config.h and check the
-pathnames. Change them to suit your installation requirements.
+2.) Makefile & config.h
+-----------------------
+Look through the Makefile & user configuration section in config.h and check
+pathnames. Change them to suit your installation requirements. Usually
+sysadmins discuss the location of SOCKDIR, whether it should be in /tmp or
+not. At least it must be on a filesystem that supports sockets/fifos.
+The path for ETCSCREENRC needs also to be adapted.
-3.)
+3.) how to actually compile
+---------------------------
+Run 'make'. Screen should compile without too many warnings :)
+The creation of term.h, comm.h, tty.c or osdef.h may fail on some machines
+for some odd reason. (E.g. the sed under SCO-unix is known to be
+case-insensitive and breaks term.h.) If so, please mail a short description
+of the problem to screen@uni-erlangen.de and use the files ending in .dist
+as a replacement (or in case of osdef.h retry with an empty file).
+You can then try 'make install' (if you dare).
+
+4.) where to install
+--------------------
You may well run screen from your private binary directory and with a
private socket directory like $HOME/.screen. But to have a full featured
screen and (from a users point of view) more secure pty's you should
@@ -26,31 +48,52 @@ in some globally accessible directory like /usr/local/bin.
Consider this, when deciding whether you install screen setuid-root:
- On some machines root priviliges are required to open pty's.
- Pty's should be owned by the user, so that she can do chmod to prevent
- intrudor attacks.
+ intrudor attacks. The PTYs used by screen will remain world read-writable
+ if screen is not installed setuid-root.
+- Some commands only work properly when the pty is owned by the user.
+ These include mesg and biff.
- The ^At feature may need to lseek and read the kernel file to retrieve
the load average.
- On most machines utmp slots can only be created/manipulated with root
- privileges.
+ privileges. Users will appear to be logged on the primary terminal
+ instead of the screen windows, if screen is not installed setuid-root.
- Multi-user screen sessions are only allowed when screen has a root-s-bit.
+- If screen sockets of multiple users are kept in one directory (e.g.
+ /tmp/screens), this directory must be world writeable when screen is not
+ installed setuid-root. Any user can remove or abuse any socket then.
+
-4.)
-The creation of term.h, comm.h, tty.c or osdef.h may fail on some machines
-for some odd reason. (E.g. the sed under SCO-unix is known to be
-case-insensitive and breaks term.h) If so, please mail a short description
-of the problem to screen@uni-erlangen.de and use the files ending in .dist
-as a replacement (or in case of osdef.h retry with an empty file).
-
-5.)
-The man page screen.1 should go to /usr/local/man/man1, or some similar
+5.) doc/screen.1 & doc/screen.texinfo
+-------------------------------------
+The man page doc/screen.1 should go to /usr/local/man/man1, or some similar
directory. It should format nicely with nroff -man. If it does not, then
try removing extra dots with: sed -e 's/^\.\././' < screen.1 | nroff -man
-Look through the etcscreenrc file for system wide defaults that you like to
-set. e.g. autodetach off, startup_message off, vbell on, ...
-Install it to match the pathname specified in config.h
+The info page doc/screen.texinfo contains basically the same information as
+the man-page, we may have missed one or another thing in one of the files.
+If so, mail me.
-6.)
+6.) etc/screenrc & etc/etcscreenrc
+----------------------------------
+The files screenrc and etc/etcscreenrc are instructive samples that
+demonstrate what can/should be done from your private .screenrc and from
+$ETCSCREENRC -- do not just copy them. Read them. Look through the
+etcscreenrc file for system wide defaults that you like to set. e.g.
+autodetach off, startup_message off, vbell on, ...
Since version 3.2.15 the screenrc file syntax changed slightly. All rc files
from previous versions should be run through the newsyntax script that comes
with this package.
+If and only if you want to install screen as a console multiplexer, look
+at the *.sample files and what 'make cscreen' suggests.
+
+7.) terminfo/screeninfo.src & terminfo/screencap
+------------------------------------------------
+Every now and then we update the termcap/terminfo entries for screen.
+E.g. keycodes were added in 3.6.0 -- thus you check that your termcap/terminfo
+database is up to date. See the README in the terminfo subdirectory.
+
+8.) have fun
+------------
+To get an idea what the basic screen commands are, read the file README.
+Request snail mail address for liquid and solid donations. :-)
-Juergen Weigert. (screen@uni-erlangen.de)
+Juergen & Michael. (screen@uni-erlangen.de)
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..b4b273c
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,2 @@
+install all Makefiles config:
+ sh ./configure
diff --git a/src/Makefile.in b/src/Makefile.in
index 0172e27..feabc00 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -12,8 +12,8 @@ VPATH = @srcdir@
prefix = /usr/local
exec_prefix = $(prefix)
+# don't forget to change mandir and infodir in doc/Makefile.
bindir = $(exec_prefix)/bin
-mandir = $(prefix)/man
VERSION = @VERSION@
@@ -50,73 +50,18 @@ AWK = @AWK@
OPTIONS=
#OPTIONS= -DDEBUG -DTMPTEST
-
-######
-######
-###### The following lines should be obsolete because of the 'configure' script.
-######
-######
-
-
-### If you choose to compile with the tried and true:
-#CC= cc
-#CFLAGS= -O
-#CFLAGS= -g
-### gcc specific CFLAGS:
-#CC= gcc
-# If your system include files are bad, don't use -Wall
-#CFLAGS= -O6 -g #-Wall
-#CFLAGS = -g -fstrength-reduce -fcombine-regs -finline-functions #-Wall
-
-### On some machines special CFLAGS are required:
-#M_CFLAGS=
-#M_CFLAGS= -Dapollo -A cpu,mathchip -A nansi # Apollo DN3000/4000/4500
-#M_CFLAGS= -DBSDI # bsd386
-#M_CFLAGS= -DISC -D_POSIX_SOURCE # isc
-#M_CFLAGS= -systype bsd43 -DMIPS # mips
-#M_CFLAGS= -fforce-mem -fforce-addr\
-# -fomit-frame-pointer -finline-functions -bsd # NeXT
-#M_CFLAGS= -qlanglvl=ansi # RS6000/AIX
-#M_CFLAGS= -qlanglvl=ansi -D_AIX32 # RS6000/AIX 3.2
-#M_CFLAGS= -ansi # sgi/IRIX 3.x ansi
-#M_CFLAGS= -xansi # sgi/IRIX 4.x ext ansi
-#M_CFLAGS= -YBSD # Ultrix 4.x
-#M_CFLAGS= -DSVR4=1 # Bob Kline rvk@blink.att.com 80386 Unix SVR4.0
-#M_CFLAGS= -D_CX_UX # Ken Beal kbeal@amber.ssd.csd.harris.com Harris CX/UX
-
-### Choose one of the LIBS setting below:
-#LIBS= -ltermcap -lc -lsocket -linet -lsec -lseq # Sequent/ptx
-#LIBS= -ltermcap # SunOS, Linux, Apollo,
-# gould_np1, NeXT, Ultrix
-#LIBS= -ltermcap -lelf # SVR4
-#LIBS= -ltermlib -linet -lcposix # isc
-#LIBS= -ltermcap -lmld # mips (nlist is in mld)
-#LIBS= -ltermlib -lsun -lmld #-lc_s # sgi/IRIX
-#LIBS= -lcurses # RS6000/AIX
-#LIBS= -lcrypt_d -ltinfo # sco32
-#LIBS= -lcrypt_i -ltinfo # sco32
-#LIBS= -lcrypt -lsec # sco322 (msilano@sra.com)
-#LIBS= -ltermcap -lcrypt.o -ldir -lx # SCO XENIX 2.3.4
-#LIBS= -ltermcap -lcrypt -ldir -l2.3 -lx # SCO UNIX XENIX cross dev.
-#LIBS= -ltermcap -lelf -lcrypt -lsocket -lnet -lnsl # Bob Kline SVR4
-
-######
-######
-###### end of obsolete lines
-######
-######
-
-
SHELL=/bin/sh
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 acl.c
+ termcap.c input.c attacher.c pty.c process.c display.c comm.c \
+ kmapdef.c acl.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 acl.o
+ termcap.o input.o attacher.o pty.o process.o display.o comm.o \
+ kmapdef.o acl.o
-all: screen
+all: screen screen.info
screen: $(OFILES)
$(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
@@ -133,23 +78,23 @@ install_bin: screen
ln -s $(bindir)/screen-$(VERSION) $(bindir)/screen
install: install_bin
- -$(INSTALL_DATA) $(srcdir)/etcscreenrc $(ETCSCREENRC)
- -$(INSTALL_DATA) $(srcdir)/doc/screen.1 $(mandir)/man1/screen.1
+ cd doc ; $(MAKE) install
-tic ${srcdir}/terminfo/screeninfo.src
# Better do this by hand. E.g. under RCS...
# cat ${srcdir}/terminfo/screencap >> /etc/termcap
- @echo termcap entry not installed.
+ @echo "termcap entry (${srcdir}/terminfo/screencap) should be installed manually."
-installdirs: mkinstalldirs
+installdirs:
# Path leading to ETCSCREENRC and Socketdirectory not checked.
- $(srcdir)/mkinstalldirs $(bindir) $(mandir)
+ $(srcdir)/etc/mkinstalldirs $(bindir)
+ cd doc ; $(MAKE) installdirs
uninstall:
rm -f $(bindir)/screen-$(VERSION)
rm -f $(bindir)/screen
- mv $(bindir)/screen.old $(bindir)/screen
+ -mv $(bindir)/screen.old $(bindir)/screen
rm -f $(ETCSCREENRC)
- rm -f $(mandir)/man1/screen.1
+ cd doc; $(MAKE) uninstall
shadow:
mkdir shadow;
@@ -157,22 +102,24 @@ shadow:
rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h
term.h: term.c term.sh
- AWK=$(AWK) srcdir=$(srcdir) . $(srcdir)/term.sh
+ AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh
+
+kmapdef.c: term.h
tty.c: tty.sh
sh $(srcdir)/tty.sh tty.c
comm.h: comm.c comm.sh config.h
- AWK=$(AWK) CC="$(CC)" srcdir=${srcdir} . $(srcdir)/comm.sh
+ AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh
osdef.h: osdef.sh config.h osdef.h.in
- CC="$(CC)" srcdir=${srcdir} . $(srcdir)/osdef.sh
+ CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh
docs:
- cd doc; $(MAKE) dvi info
+ cd doc; $(MAKE) dvi screen.info
-dvi info:
- cd doc; $(MAKE) $@
+dvi info screen.info:
+ -cd doc; $(MAKE) $@
mostlyclean:
rm -f $(OFILES) screen
@@ -187,29 +134,31 @@ clean celan: mostlyclean
distclean: mostlyclean
rm -f screen-$(VERSION).tar screen-$(VERSION).TZ
rm -f config.status Makefile
+ rm -f osdef.h doc/Makefile
# Delete everything from the current directory that can be
# reconstructed with this Makefile.
realclean: distclean
+ rm -f tty.c term.h comm.h
rm -f config.h
TAGS: $(CFILES)
ctags $(CFILES) *.h
ctags -e $(CFILES) *.h
-dist: screen-$(VERSION).tar.z
+dist: screen-$(VERSION).tar.gz
-screen-$(VERSION).tar: term.h comm.h tty.c
+screen-$(VERSION).tar: term.h comm.h tty.c kmapdef.c
-rm -rf dist
mkdir dist
mkdir dist/screen-$(VERSION)
ln acl.h ansi.h display.h extern.h mark.h os.h overlay.h \
patchlevel.h rcs.h screen.h window.h osdef.h.in \
- term.sh tty.sh comm.sh osdef.sh newsyntax \
+ term.sh tty.sh comm.sh osdef.sh \
acl.c ansi.c attacher.c comm.c display.c window.c fileio.c help.c \
input.c loadav.c mark.c misc.c process.c pty.c putenv.c \
screen.c search.c socket.c term.c termcap.c utmp.c resize.c \
- ChangeLog COPYING INSTALL NEWS \
+ ChangeLog COPYING INSTALL NEWS install.sh \
dist/screen-$(VERSION)
ln configure.in configure dist/screen-$(VERSION)
sed -e 's@"/local/screens@"/tmp/screens@' -e 's@"/local@"/usr/local@g' < config.h.in > dist/screen-$(VERSION)/config.h.in
@@ -217,22 +166,31 @@ screen-$(VERSION).tar: term.h comm.h tty.c
ln term.h dist/screen-$(VERSION)/term.h.dist
ln comm.h dist/screen-$(VERSION)/comm.h.dist
ln tty.c dist/screen-$(VERSION)/tty.c.dist
+ ln kmapdef.c dist/screen-$(VERSION)/kmapdef.c.dist
ln README dist/screen-$(VERSION)/README
+ ln tek.patch dist/screen-$(VERSION)/tek.patch
mkdir dist/screen-$(VERSION)/terminfo
- cd terminfo; ln 8bits README checktc.c screen-sco.mail screencap \
+ cd terminfo; ln 8bits README checktc.c sco.mail screencap \
screeninfo.src test.txt tetris.c \
../dist/screen-$(VERSION)/terminfo
- sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/screen-$(VERSION)/etcscreenrc
- cp $(HOME)/.iscreenrc dist/screen-$(VERSION)/.iscreenrc
+ mkdir dist/screen-$(VERSION)/etc
+ cd etc; ln * ../dist/screen-$(VERSION)/etc
+ sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/screen-$(VERSION)/etc/etcscreenrc
+ cp $(HOME)/.iscreenrc dist/screen-$(VERSION)/etc/screenrc
mkdir dist/screen-$(VERSION)/doc
- ln doc/fdpat.ips dist/screen-$(VERSION)/doc/fdpat.ps
sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/screen-$(VERSION)/doc/Makefile.in
- cd doc; ln screen.1 screen.texinfo \
+ cd doc; ln FAQ screen.1 screen.texinfo fdpat.ps \
../dist/screen-$(VERSION)/doc
+ cd doc; if test -f screen.info; then ln screen.info* \
+ ../dist/screen-$(VERSION)/doc; fi
+ cd dist/screen-$(VERSION)/doc; ln -s ../install.sh .
+ cd dist/screen-$(VERSION); ln -s doc/FAQ .
+ echo "install all Makefiles config:" > dist/screen-$(VERSION)/Makefile
+ echo " sh ./configure" >> dist/screen-$(VERSION)/Makefile
cd dist; tar chf ../screen-$(VERSION).tar screen-$(VERSION)
rm -rf dist
-screen-$(VERSION).tar.z: screen-$(VERSION).tar
+screen-$(VERSION).tar.gz: screen-$(VERSION).tar
gzip -f screen-$(VERSION).tar
# Perform self-tests (if any).
@@ -266,46 +224,47 @@ depend: $(CFILES) term.h
screen.o socket.o: Makefile
### Dependencies:
-screen.o: screen.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h patchlevel.h extern.h osdef.h
-ansi.o: ansi.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-fileio.o: fileio.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-mark.o: mark.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h mark.h extern.h osdef.h
-misc.o: misc.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-resize.o: resize.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-socket.o: socket.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-search.o: search.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h mark.h extern.h osdef.h
-tty.o: tty.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-term.o: term.c rcs.h term.h
-window.o: window.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-utmp.o: utmp.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-loadav.o: loadav.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-putenv.o: putenv.c rcs.h config.h
-help.o: help.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-termcap.o: termcap.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
- term.h display.h window.h extern.h osdef.h
-input.o: input.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-attacher.o: attacher.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
- term.h display.h window.h extern.h osdef.h
-pty.o: pty.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h osdef.h
-process.o: process.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
- term.h display.h window.h extern.h osdef.h
-display.o: display.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
- term.h display.h window.h extern.h osdef.h
-comm.o: comm.c rcs.h config.h comm.h
-acl.o: acl.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
- display.h window.h extern.h acl.h osdef.h
+screen.o: screen.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h patchlevel.h rcs.h screen.h term.h window.h
+ansi.o: ansi.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
+fileio.o: fileio.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+mark.o: mark.c acl.h ansi.h comm.h config.h display.h extern.h mark.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+misc.o: misc.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
+resize.o: resize.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+socket.o: socket.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+search.o: search.c acl.h ansi.h comm.h config.h display.h extern.h \
+ mark.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+tty.o: tty.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
+term.o: term.c rcs.h term.h
+window.o: window.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+utmp.o: utmp.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
+loadav.o: loadav.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+putenv.o: putenv.c config.h rcs.h
+help.o: help.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
+termcap.o: termcap.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+input.o: input.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
+attacher.o: attacher.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+pty.o: pty.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
+process.o: process.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+display.o: display.c acl.h ansi.h comm.h config.h display.h extern.h \
+ os.h osdef.h overlay.h rcs.h screen.h term.h window.h
+comm.o: comm.c acl.h comm.h config.h rcs.h
+kmapdef.o: kmapdef.c config.h
+acl.o: acl.c acl.h ansi.h comm.h config.h display.h extern.h os.h \
+ osdef.h overlay.h rcs.h screen.h term.h window.h
diff --git a/src/NEWS b/src/NEWS
index d0d1970..6d4360f 100644
--- a/src/NEWS
+++ b/src/NEWS
@@ -1,119 +1,48 @@
----------------------------
- What's new in screen-3.5 ?
+ What's new in screen-3.6 ?
----------------------------
-
-* Texinfo manpage! Thanks to Jason Merrill.
-
-* Screen now has a very large 'configure' script. If you have
- problems with the resulting configuration please send mail to
- screen@uni-erlangen.de.
-
-* Stackable overlay planes.
- All commands are available even if you work with an overlay. Thus
- you can be in copy/paste mode on several windows!
-
-* Unification of key bindings and screen commands. All keys now generate
- commands.
-
-* Screen now reads/writes only in asyncronous mode.
-
-* Ansi parser speedup code resulting in much faster output of text.
-
-* Changed the rc file syntax. Commands now directly affect the current
- window. The default settings are changed with 'def...' commands.
- The 'set' keyword no longer exists.
- Please run the 'newsyntax' script on your old screenrc files!
-
-* Emacs style isearch added to copy mode. Try ^A ESC ^R screen ^R ^R
- to locate the last three occurences of the word 'screen' in the
- history buffer.
-
-* New command 'silence'. Alarms the user whenever there was inactivity
- for a specified amount of time on a certain window.
- Useful if you want to wait for a compilation to end.
-
-* Much better margin handling:
- Screen now handles autowrapped lines correctly in the redisplay and
- copy/paste functions.
-
-* New commands for pastebuffer management:
- 'copy_reg' copies the pastebuffer to a register,
- 'ins_reg' pastes a register,
- 'register' fills a register with a string,
- 'process' stuffs a register into strings input queue.
-
-* Autonuke feature. Flush the output buffer if the window gets
- cleared. Enable this with 'autonuke on'.
-
-* Modifications to save memory: Empty attribute and font lines don't
- get allocated. This is very useful if you have a lage scrollback.
-
-* Multi display support:
- You can now attach from more than one terminal to a session with
- the '-x' option.
-
-* New option '-S' to specify socket name.
-
-* Experimental multiuser support added:
- You can start screen in multiuser Mode by prepending the socket
- name with a '/' (or by the command 'multiuser on').
- If another user wants to attach to the screen session, he can do
- this by prepending the socketname with 'screenuser/'.
- Of course he must be in the access control list for a successful
- attach (see the acladd/acldel command).
+* Input translation! This makes the vt100 emulation complete.
+ As an addition it is now possible to bind any command to any
+ (function-) key. See the man page for more details (bindkey
+ command).
+
+* Status line support. Each window can have a different status line.
+ Use the ANSI APC string to set the status line, i.e.:
+ <ESC>_<status string><ESC>\
+ (For convenience the xterm sequence is also accepted.)
+ You may want to add
+ termcap * '' ':hs:ts=\E_:fs=\E\\:ds=\E_\E\\:'
+ terminfo * '' ':hs:ts=\E_:fs=\E\\:ds=\E_\E\\:'
+ to your ~/.screenrc to make screen advertise the hardstatus
+ support.
-* Extension to the 'screen' command: You can now specify tty lines
- instead of programs. This can be used for console management.
- Added the command 'break' to send a break to the tty line.
- Not really a new feature, but terminal initialisation now works
- on suns.
-
-* Input/output filters added. This has been implemented to allow the
- user to configure an open tty line, but got soon exended to allow
- all sorts of filters. For more information read the explanation
- of the 'exec' command in the man page and check the 'fdpat.ps'
- document.
-
-* Screen can now be started detached (screen -d -m -S sockname).
- This is usefull if you want to start screen in your /etc/rc file
- (e.g. as a console multiplexer)
-
-* Console grabbing added ('console on' command).
-
-* Windows can now be selected by akas, too. (Per default bound to the
- >'< key.)
+* Zombie feature added. Windows now may generate a message (with a
+ timestamp) if they die and stay around until the user presses
+ a key.
-* New terminal capabiliteise CS/CE for cursorkey control.
+* New paste syntax: Paste can now concatenate registers and paste
+ either on screen or in anouther register.
+ This makes the old "ins_reg", "copy_reg" commands obsolete.
-* setenv/unsetenv commands added.
+* More architecures supported. Screen now runs on AIX3.2.5,
+ Solaris, NeXT and some other exotic platforms.
-* Expansion of environment variables ($VAR) and terminal capabilities
- ($:TC:) in the screenrc files and detach messages.
- Example: pow_detach_msg "Session of \$LOGNAME \$:cr:\$:nl:ended."
-
-* New commands:
- 'hardcopydir' and 'logdir' to change the output directories,
- 'partial' and 'allpartial' to make screen only refresh the line
- containing the cursor if a window is selected (useful for slow
- modem connections).
+* Kanji support added. Screen understands JIS, EUC and SJIS coding.
+ This is an experimental feature.
-* Cleanup of the provided termcap/terminfo file. Please install
- the new one!
+* GR charset switching (ISO 2022) implemented. Can be enabled with
+ the "gr" command.
-* The program 'terminfo/checktc.c' does a visual check of a
- termcap/terminfo entry. Please try it before calling screen and
- in a screen session.
+* C1 sequences implemented (see the "c1" command).
-* LOTS of bugfixes and code cleanup.
+* Tek support from Xiaoguang Zhang. Apply tek.patch if you want to
+ make screen pass tek sequences.
-Thanks to all the beta testers who helped porting screen to at least
-the following platforms: Ultrix, SunOS, Solaris, BSD43, linux, NEWSOS,
-Irix, OSF/1, Harris CX/UX, hpux, dynix/ptx, AIX.
-And even more thanks to the brave who attempted to use the 'exec'
-command features.
+* List of new commands:
+ bindkey, c1, command, defc1, defgr, defkanji, gr, kanji, mapdefault,
+ mapnotnext, maptimeout, pastefont, printcmd, readreg, stuff, zombie
- Donnate patches, bugreports, suggestions, money, beer & pizza to
- screen@uni-erlangen.de
+* Lots of other bugs fixed.
diff --git a/src/README b/src/README
index 6cc1159..362674f 100644
--- a/src/README
+++ b/src/README
@@ -1,5 +1,9 @@
-Short introduction to iscreen (Version 3.5.2) lvirden 8-8-93
+ [If you just got the screen package, it pays to read the file INSTALL]
+ [This intro only describes the most common features to get you started]
+
+
+Short introduction to screen (Version 3.6.0) lvirden 8-8-93
[note that this intro only describes the most common screen features]
diff --git a/src/acl.c b/src/acl.c
index 3a44f52..3a1da4c 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -85,7 +85,7 @@ int len, delta, defaultbit;
ACLBYTE(n, i) |= ACLBIT(i);
}
if (len)
- free(o);
+ free((char *)o);
*bfp = n;
return 0;
}
@@ -119,7 +119,7 @@ char DefaultMetaEsc = 'a';
/*
* Add a new user. His password may be NULL or "" if none.
- * He is in no groups and thus has no rights.
+ * He has no rights.
*/
int
UserAdd(name, pass, up)
@@ -133,8 +133,10 @@ struct user **up;
*up = (struct user *)calloc(1, sizeof(struct user));
if (!*up)
return -1; /* he still does not exist */
+#ifdef COPY_PASTE
(*up)->u_copybuffer = NULL;
(*up)->u_copylen = 0;
+#endif
(*up)->u_Esc = DefaultEsc;
(*up)->u_MetaEsc = DefaultMetaEsc;
strncpy((*up)->u_name, name, 20);
@@ -157,7 +159,7 @@ struct user **up;
/* first, the used_uid_indicator: */
if (GrowBitfield(&userbits, maxusercount, USER_CHUNK, 0))
{
- free(*up); *up = NULL; return -1;
+ free((char *)*up); *up = NULL; return -1;
}
/* second, default command bits */
/* (only if we generate commands dynamically) */
@@ -166,7 +168,7 @@ struct user **up;
if (GrowBitfield(&default_c_userbits[j], maxusercount, USER_CHUNK,
default_c_bit[j]))
{
- free(*up); *up = NULL; return -1;
+ free((char *)*up); *up = NULL; return -1;
}
*/
/* third, the bits for each commands */
@@ -175,14 +177,14 @@ struct user **up;
if (GrowBitfield(&comms[i].userbits[j], maxusercount, USER_CHUNK,
default_c_bit[j]))
{
- free(*up); *up = NULL; return -1;
+ free((char *)*up); *up = NULL; return -1;
}
/* fourth, default window and bits */
for (j = 0; j < ACL_BITS_PER_WIN; j++)
if (GrowBitfield(&default_w_userbits[j], maxusercount, USER_CHUNK,
default_w_bit[j]))
{
- free(*up); *up = NULL; return -1;
+ free((char *)*up); *up = NULL; return -1;
}
/* fifth, the bits for each window */
for (w = windows; w; w = w->w_next)
@@ -190,11 +192,14 @@ struct user **up;
if (GrowBitfield(&w->w_userbits[j], maxusercount, USER_CHUNK,
default_w_bit[j]))
{
- free(*up); *up = NULL; return -1;
+ free((char *)*up); *up = NULL; return -1;
}
maxusercount += USER_CHUNK;
}
ACLBYTE(userbits, (*up)->id) |= ACLBIT((*up)->id);
+ /* user id 0 is the session creator, he has all rights */
+ if ((*up)->id == 0)
+ AclSetPerm(*up, "+rwx", "#?");
#else /* MULTIUSER */
debug1("UserAdd %s\n", name);
#endif /* MULTIUSER */
@@ -218,8 +223,7 @@ struct user **up;
/*
* Remove a user from the list.
- * Decrease reference count of all his groups
- * Free his grouplist.
+ * Destroy all his permissions and completely detach him from the session.
*/
int
UserDel(name, up)
@@ -236,8 +240,8 @@ struct user **up;
old = display;
for (display = displays; display; display = next)
{
- next = display->_d_next;
- if (d_user != u)
+ next = display->d_next;
+ if (D_user != u)
continue;
if (display == old)
old = 0;
@@ -247,14 +251,23 @@ struct user **up;
*up = u->u_next;
#ifdef MULTIUSER
ACLBYTE(userbits, u->id) &= ~ACLBIT(u->id);
- AclSetPerm(u, "-rwx", "#?");
+ /* restore the bits in his slot to default: */
+ AclSetPerm(u, default_w_bit[ACL_READ] ? "+r" : "-r", "#");
+ AclSetPerm(u, default_w_bit[ACL_WRITE]? "+w" : "-w", "#");
+ AclSetPerm(u, default_w_bit[ACL_EXEC] ? "+x" : "-x", "#");
+ AclSetPerm(u, default_c_bit[ACL_EXEC] ? "+x" : "-x", "?");
#endif
debug1("FREEING user structure for %s\n", u->u_name);
+#ifdef COPY_PASTE
UserFreeCopyBuffer(u);
- free(u);
+#endif
+ free((char *)u);
return 0;
}
+
+#ifdef COPY_PASTE
+
/*
* returns 0 if the copy buffer was really deleted.
* Also removes any references into the users copybuffer
@@ -280,11 +293,13 @@ struct user *u;
}
}
free(u->u_copybuffer);
- d_user->u_copylen = 0;
+ D_user->u_copylen = 0;
u->u_copybuffer = NULL;
return 0;
}
+#endif /* COPY_PASTE */
+
/************************************************************************
* end of user managing code *
************************************************************************/
@@ -308,7 +323,7 @@ struct win *w;
if (GrowBitfield(&w->w_userbits[j], 0, maxusercount, 0))
{
while (--j >= 0)
- free(w->w_userbits[j]);
+ free((char *)w->w_userbits[j]);
return -1;
}
for (i = 0; i < maxusercount; i++)
@@ -358,6 +373,10 @@ struct comm *cmd;
}
/* mode strings of the form +rwx -w+rx r -wx are parsed and evaluated */
+/*
+ * aclchg nerd -w+w 2
+ * releases a writelock on window 2 held by user nerd.
+ */
int
AclSetPermWin(u, mode, win)
struct user *u;
@@ -396,6 +415,13 @@ struct win *win;
ACLBYTE(win->w_userbits[bit], u->id) &= ~ACLBIT(u->id);
else
ACLBYTE(win->w_userbits[bit], u->id) |= ACLBIT(u->id);
+ if ((win->w_wlockuser == u) && neg && (bit == ACL_WRITE))
+ {
+ debug2("%s lost writelock on win %d\n", u->u_name, win->w_number);
+ win->w_wlockuser = NULL;
+ if (win->w_wlock == WLOCK_ON)
+ win->w_wlock = WLOCK_AUTO;
+ }
}
return 0;
}
@@ -408,7 +434,7 @@ char *mode, *s;
{
struct win *w;
int i;
- char *p;
+ char *p, ch;
while (*s)
{
@@ -429,10 +455,8 @@ char *mode, *s;
default:
for (p = s; *p && *p != ' ' && *p != '\t' && *p != ','; p++)
;
- if (*p)
+ if ((ch = *p))
*p++ = '\0';
- else
- *p = '\0';
if ((i = FindCommnr(s)) != RC_ILLEGAL)
AclSetPermCmd(u, mode, &comms[i]);
else if (((i = WindowByNoN(s)) >= 0) && wtab[i])
@@ -440,6 +464,8 @@ char *mode, *s;
else
/* checking group name */
return -1;
+ if (ch)
+ p[-1] = ch;
s = p;
}
}
diff --git a/src/ansi.c b/src/ansi.c
index 407ad4c..1a135a1 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -24,27 +24,27 @@
RCS_ID("$Id$ FAU")
#include <sys/types.h>
+#include <signal.h>
#include <fcntl.h>
#ifndef sun /* we want to know about TIOCPKT. */
# include <sys/ioctl.h>
#endif
+
#include "config.h"
#include "screen.h"
#include "extern.h"
-extern char *getenv(), *tgetstr(), *tgoto();
-#ifndef __STDC__
-extern char *malloc();
-#endif
-
extern struct win *windows; /* linked list of all windows */
extern struct win *fore;
extern struct display *display, *displays;
extern int force_vt;
extern int all_norefresh; /* => display */
-extern int ZombieKey;
+extern int ZombieKey_destroy, ZombieKey_resurrect;
+extern int real_uid, real_gid;
extern time_t Now;
+extern struct NewWindow nwin_default; /* for ResetWindow() */
+extern int nversion;
int maxwidth; /* maximum of all widths so far */
@@ -53,11 +53,9 @@ int Z0width, Z1width; /* widths for Z0/Z1 switching */
static struct win *curr; /* window we are working on */
static int rows, cols; /* window size of the curr window */
-int default_wrap = 1; /* default: wrap on */
-int default_monitor = 0;
-
int visual_bell = 0;
int use_hardstatus = 1;
+char *printcmd = 0;
char *blank; /* line filled with spaces */
char *null; /* line filled with '\0' */
@@ -71,22 +69,24 @@ static void WinSetCursor __P((void));
static int WinResize __P((int, int));
static void WinRestore __P((void));
static int Special __P((int));
-static void DoESC __P((int, int ));
-static void DoCSI __P((int, int ));
-static void SetChar __P((int));
+static void DoESC __P((int, int));
+static void DoCSI __P((int, int));
+static void SetChar __P((int, int));
static void StartString __P((enum string_t));
-static void SaveChar __P((int ));
-static void PrintChar __P((int ));
+static void SaveChar __P((int));
+static void PrintStart __P((void));
+static void PrintChar __P((int));
static void PrintFlush __P((void));
-static void DesignateCharset __P((int, int ));
+static void DesignateCharset __P((int, int));
static void MapCharset __P((int));
+static void MapCharsetR __P((int));
static void SaveCursor __P((void));
static void RestoreCursor __P((void));
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 InsertAChar __P((int, int));
static void InsertChar __P((int));
static void DeleteChar __P((int));
static void DeleteLine __P((int));
@@ -114,6 +114,8 @@ static void FillWithEs __P((void));
static void UpdateLine __P((char *, char *, char *, int, int, int ));
static void FindAKA __P((void));
static void Report __P((char *, int, int));
+static void FixLine __P((void));
+static void ScrollRegion __P((int));
/*
@@ -137,32 +139,50 @@ WinProcess(bufpp, lenp)
char **bufpp;
int *lenp;
{
- int f, *ilen, l = *lenp;
- char *ibuf;
+ int addlf, l2 = 0, f, *ilen, l = *lenp;
+ char *ibuf, *p, *buf = *bufpp;
- fore = d_fore;
+ fore = D_fore;
/* if w_wlock is set, only one user may write, else we check acls */
if (fore->w_ptyfd < 0)
{
- SetCurr(fore);
- Special('\007');
while ((*lenp)-- > 0)
{
- if (*(*bufpp)++ == ZombieKey)
+ f = *(*bufpp)++;
+ if (f == ZombieKey_destroy)
{
debug2("Turning undead: %d(%s)\n", fore->w_number, fore->w_title);
KillWindow(fore);
+ l2--;
+ break;
+ }
+ if (f == ZombieKey_resurrect)
+ {
+ SetCurr(fore);
+
+ debug1("Resurrecting Zombie: %d\n", fore->w_number);
+ LineFeed(2);
+ RemakeWindow(fore);
+ l2++;
break;
}
}
+ if (!l2)
+ {
+ char b1[10], b2[10];
+
+ b1[AddXChar(b1, ZombieKey_destroy)] = '\0';
+ b2[AddXChar(b2, ZombieKey_resurrect)] = '\0';
+ Msg(0, "Press %s to destroy or %s to resurrect window", b1, b2);
+ }
*bufpp += *lenp;
*lenp = 0;
return;
}
#ifdef MULTIUSER
if ((fore->w_wlock == WLOCK_OFF) ?
- AclCheckPermWin(d_user, ACL_WRITE, fore) :
- (d_user != fore->w_wlockuser))
+ AclCheckPermWin(D_user, ACL_WRITE, fore) :
+ (D_user != fore->w_wlockuser))
{
SetCurr(fore);
Special('\007');
@@ -185,17 +205,45 @@ int *lenp;
ibuf = fore->w_inbuf; ilen = &fore->w_inlen;
f = sizeof(fore->w_inbuf) - *ilen;
}
- if (l > f)
- {
- debug1("Yuck! pty buffer full (%d chars missing). lets beep\n", l - f);
- SetCurr(fore);
- Special('\007');
- l = f;
- }
- if (l > 0)
+
+ buf = *bufpp;
+
+ while (l)
{
- bcopy(*bufpp, ibuf + *ilen, l);
- *ilen += l;
+ l2 = l;
+ addlf = 0;
+ if (fore->w_autolf)
+ {
+ for (p = buf; l2; p++, l2--)
+ if (*p == '\r')
+ {
+ l2--;
+ addlf = 1;
+ break;
+ }
+ l2 = l - l2;
+ }
+ if (l2 + addlf > f)
+ {
+ debug1("Yuck! pty buffer full (%d chars missing). lets beep\n", l - f);
+ SetCurr(fore);
+ Special('\007');
+ l = l2 = f;
+ addlf = 0;
+ }
+ if (l2 > 0)
+ {
+ bcopy(buf, ibuf + *ilen, l2);
+ *ilen += l2;
+ f -= l2;
+ buf += l2;
+ l -= l2;
+ if (f && addlf)
+ {
+ ibuf[(*ilen)++] = '\n';
+ f--;
+ }
+ }
}
*bufpp += *lenp;
*lenp = 0;
@@ -207,7 +255,7 @@ int y, from, to, isblank;
{
if (y < 0)
return;
- fore = d_fore;
+ fore = D_fore;
DisplayLine(isblank ? blank: null, null, null, fore->w_image[y],
fore->w_attr[y], fore->w_font[y], y, from, to);
}
@@ -219,7 +267,7 @@ int y, x1, x2, doit;
register int cost, dx;
register char *p, *f, *i;
- fore = d_fore;
+ fore = D_fore;
dx = x2 - x1;
if (doit)
{
@@ -232,11 +280,11 @@ int y, x1, x2, doit;
f = fore->w_font[y] + x1;
cost = dx = x2 - x1;
- if (d_insert)
- cost += d_EIcost + d_IMcost;
+ if (D_insert)
+ cost += D_EIcost + D_IMcost;
while(dx-- > 0)
{
- if (*p++ != d_attr || *f++ != d_font)
+ if (*p++ != D_attr || *f++ != D_font)
return EXPENSIVE;
}
return cost;
@@ -246,7 +294,7 @@ static void
WinClearLine(y, xs, xe)
int y, xs, xe;
{
- fore = d_fore;
+ fore = D_fore;
DisplayLine(fore->w_image[y], fore->w_attr[y], fore->w_font[y],
blank, null, null, y, xs, xe);
}
@@ -254,7 +302,7 @@ int y, xs, xe;
static void
WinSetCursor()
{
- fore = d_fore;
+ fore = D_fore;
GotoPos(fore->w_x, fore->w_y);
}
@@ -262,7 +310,7 @@ static int
WinResize(wi, he)
int wi, he;
{
- fore = d_fore;
+ fore = D_fore;
if (fore)
ChangeWindowSize(fore, wi, he);
return 0;
@@ -271,12 +319,14 @@ int wi, he;
static void
WinRestore()
{
- fore = d_fore;
+ fore = D_fore;
ChangeScrollRegion(fore->w_top, fore->w_bot);
KeypadMode(fore->w_keypad);
CursorkeysMode(fore->w_cursorkeys);
SetFlow(fore->w_flow & FLOW_NOW);
InsertMode(fore->w_insert);
+ ReverseVideo(fore->w_revvid);
+ CursorInvisible(fore->w_curinv);
fore->w_active = 1;
}
@@ -292,19 +342,19 @@ int norefresh;
if (display == 0)
return;
RemoveStatus();
- fore = d_fore;
+ fore = D_fore;
if (fore)
{
ASSERT(fore->w_display == display);
- fore->w_active = d_layfn == &WinLf;
+ fore->w_active = D_layfn == &WinLf;
if (fore->w_monitor != MON_OFF)
fore->w_monitor = MON_ON;
fore->w_bell = BELL_OFF;
if (ResizeDisplay(fore->w_width, fore->w_height))
{
- debug2("Cannot resize from (%d,%d)", d_width, d_height);
+ debug2("Cannot resize from (%d,%d)", D_width, D_height);
debug2(" to (%d,%d) -> resize window\n", fore->w_width, fore->w_height);
- DoResize(d_width, d_height);
+ DoResize(D_width, D_height);
}
}
Redisplay(norefresh + all_norefresh);
@@ -316,10 +366,12 @@ register struct win *p;
{
register int i;
- p->w_wrap = default_wrap;
+ p->w_wrap = nwin_default.wrap;
p->w_origin = 0;
p->w_insert = 0;
- p->w_vbwait = 0;
+ p->w_revvid = 0;
+ p->w_curinv = 0;
+ p->w_autolf = 0;
p->w_keypad = 0;
p->w_cursorkeys = 0;
p->w_top = 0;
@@ -327,16 +379,79 @@ register struct win *p;
p->w_saved = 0;
p->w_Attr = 0;
p->w_Font = 0;
+ p->w_FontR = 0;
p->w_x = p->w_y = 0;
p->w_state = LIT;
p->w_StringType = NONE;
- p->w_ss = 0;
- p->w_Charset = G0;
bzero(p->w_tabs, p->w_width);
for (i = 8; i < p->w_width; i += 8)
p->w_tabs[i] = 1;
+ ResetCharsets(p);
+}
+
+void
+ResetCharsets(p)
+register struct win *p;
+{
+ int i;
+
+ p->w_Charset = G0;
+ p->w_CharsetR = G2;
for (i = G0; i <= G3; i++)
p->w_charsets[i] = ASCII;
+ p->w_gr = nwin_default.gr;
+ p->w_c1 = nwin_default.c1;
+ p->w_ss = 0;
+#ifdef KANJI
+ switch(p->w_kanji)
+ {
+ case SJIS:
+ p->w_CharsetR = G1;
+ p->w_charsets[G1] = KANA;
+ p->w_gr = 1;
+ p->w_c1 = 0;
+ break;
+ case EUC:
+ p->w_CharsetR = G1;
+ p->w_charsets[G1] = KANJI;
+ p->w_charsets[G2] = KANA;
+ p->w_gr = 1;
+ p->w_c1 = 1;
+ break;
+ default:
+ break;
+ }
+#endif
+ p->w_Font = p->w_charsets[p->w_Charset];
+ p->w_FontR = p->w_charsets[p->w_CharsetR];
+}
+
+static void
+FixLine()
+{
+ if (curr->w_Attr && curr->w_attr[curr->w_y] == null)
+ {
+ if ((curr->w_attr[curr->w_y] = (char *)malloc(curr->w_width + 1)) == 0)
+ {
+ curr->w_attr[curr->w_y] = null;
+ curr->w_Attr = 0;
+ Msg(0, "Warning: no space for attr - turned off");
+ }
+ else
+ bzero(curr->w_attr[curr->w_y], curr->w_width + 1);
+ }
+ if ((curr->w_Font || curr->w_FontR) && curr->w_font[curr->w_y] == null)
+ {
+ if ((curr->w_font[curr->w_y] = (char *)malloc(curr->w_width + 1)) == 0)
+ {
+ curr->w_font[curr->w_y] = null;
+ curr->w_Font = curr->w_charsets[curr->w_ss ? curr->w_ss : curr->w_Charset] = 0;
+ curr->w_FontR = curr->w_charsets[curr->w_ss ? curr->w_ss : curr->w_CharsetR] = 0;
+ Msg(0, "Warning: no space for font - turned off");
+ }
+ else
+ bzero(curr->w_font[curr->w_y], curr->w_width + 1);
+ }
}
@@ -349,7 +464,7 @@ struct win *wp;
register char *buf;
register int len;
{
- register int c;
+ register int c, font;
if (!len)
return;
@@ -366,7 +481,7 @@ register int len;
SetCurr(wp);
if (display)
{
- if (d_status && !(use_hardstatus && HS))
+ if (D_status && !(use_hardstatus && D_HS))
RemoveStatus();
}
else
@@ -382,41 +497,23 @@ register int len;
}
do
{
- if (curr->w_Attr && curr->w_attr[curr->w_y] == null)
- {
- if ((curr->w_attr[curr->w_y] = (char *)malloc(curr->w_width + 1)) == 0)
- {
- curr->w_attr[curr->w_y] = null;
- curr->w_Attr = 0;
- Msg(0, "Warning: no space for attr - turned off");
- }
- else
- bzero(curr->w_attr[curr->w_y], curr->w_width + 1);
- }
- if (curr->w_Font && curr->w_font[curr->w_y] == null)
- {
- if ((curr->w_font[curr->w_y] = (char *)malloc(curr->w_width + 1)) == 0)
- {
- curr->w_font[curr->w_y] = null;
- curr->w_Font = curr->w_charsets[curr->w_ss ? curr->w_ss : curr->w_Charset] = 0;
- Msg(0, "Warning: no space for font - turned off");
- }
- else
- bzero(curr->w_font[curr->w_y], curr->w_width + 1);
- }
-
c = (unsigned char)*buf++;
- if (c == '\177')
- continue;
/* The next part is only for speedup */
if (curr->w_state == LIT &&
- c >= ' ' && ((c & 0x80) == 0 || display == 0 || !CB8) &&
+#ifdef KANJI
+ curr->w_Font != KANJI && curr->w_Font != KANA && !curr->w_mbcs &&
+#endif
+ c >= ' ' &&
+ ((c & 0x80) == 0 || ((c >= 0xa0 || !curr->w_c1) && !curr->w_gr && (display == 0 || !D_CB8))) &&
!curr->w_insert && !curr->w_ss && curr->w_x < cols - 1)
{
register int currx;
register char *imp, *atp, *fop, at, fo;
+ if (c == '\177')
+ continue;
+ FixLine();
currx = curr->w_x;
imp = curr->w_image[curr->w_y] + currx;
atp = curr->w_attr[curr->w_y] + currx;
@@ -425,19 +522,19 @@ register int len;
fo = curr->w_Font;
if (display)
{
- if (d_x != currx || d_y != curr->w_y)
+ if (D_x != currx || D_y != curr->w_y)
GotoPos(currx, curr->w_y);
- if (at != d_attr)
+ if (at != D_attr)
SetAttr(at);
- if (fo != d_font)
+ if (fo != D_font)
SetFont(fo);
- if (d_insert)
+ if (D_insert)
InsertMode(0);
}
while (currx < cols - 1)
{
if (display)
- AddChar(d_font != '0' ? c : d_c0_tab[c]);
+ AddChar(D_font != '0' ? c : D_c0_tab[c]);
*imp++ = c;
*atp++ = at;
*fop++ = fo;
@@ -447,27 +544,27 @@ skip: if (--len == 0)
c = (unsigned char)*buf++;
if (c == '\177')
goto skip;
- if (c < ' ' || ((c & 0x80) && display && CB8))
+ if (c < ' ' || ((c & 0x80) && ((c < 0xa0 && curr->w_c1) || curr->w_gr || (display && D_CB8))))
break;
}
curr->w_x = currx;
if (display)
- d_x = currx;
+ D_x = currx;
if (len == 0)
break;
}
/* end of speedup code */
- if ((c & 0x80) && display && CB8)
+ if ((c & 0x80) && display && D_CB8)
{
FILE *logfp = wp->w_logfp;
- char *cb8 = CB8;
+ char *cb8 = D_CB8;
wp->w_logfp = NULL; /* a little hack */
- CB8 = NULL; /* dito */
+ D_CB8 = NULL; /* dito */
WriteString(wp, cb8, (int)strlen(cb8));
wp->w_logfp = logfp;
- CB8 = cb8;
+ D_CB8 = cb8;
c &= 0x7f;
}
tryagain:
@@ -514,6 +611,12 @@ skip: if (--len == 0)
case 'i':
curr->w_state = LIT;
PrintFlush();
+ if (curr->w_pdisplay && curr->w_pdisplay->d_printfd >= 0)
+ {
+ close(curr->w_pdisplay->d_printfd);
+ curr->w_pdisplay->d_printfd = -1;
+ }
+ curr->w_pdisplay = 0;
break;
default:
PrintChar('\033');
@@ -523,18 +626,59 @@ skip: if (--len == 0)
curr->w_state = PRIN;
}
break;
+ case ASTR:
+ if (c == 0)
+ break;
+ if (c == '\033')
+ {
+ curr->w_state = STRESC;
+ break;
+ }
+ /* special xterm hack: accept SetStatus sequence. Yucc! */
+ if (!(curr->w_StringType == OSC && c < ' '))
+ if (!curr->w_c1 || c != ('\\' ^ 0xc0))
+ {
+ SaveChar(c);
+ break;
+ }
+ c = '\\';
+ /* FALLTHROUGH */
case STRESC:
switch (c)
{
case '\\':
curr->w_state = LIT;
- *(curr->w_stringp) = '\0';
+ *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] != ';')
+ break;
+ curr->w_stringp -= 2;
+ if (curr->w_stringp > curr->w_string)
+ bcopy(curr->w_string + 2, curr->w_string, curr->w_stringp - curr->w_string);
+ *curr->w_stringp = '\0';
+ /* FALLTHROUGH */
+ case APC:
+ if (curr->w_hstatus)
+ {
+ if (strcmp(curr->w_hstatus, curr->w_string) == 0)
+ break; /* not changed */
+ free(curr->w_hstatus);
+ curr->w_hstatus = 0;
+ }
+ if (curr->w_string != curr->w_stringp)
+ curr->w_hstatus = SaveStr(curr->w_string);
+ if (display)
+ RefreshStatus();
+ break;
case GM:
{
struct display *old = display;
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
if (display != old)
MakeStatus(curr->w_string);
display = old;
@@ -544,7 +688,7 @@ skip: if (--len == 0)
if (!display)
break;
MakeStatus(curr->w_string);
- if (d_status && !(use_hardstatus && HS) && len > 1)
+ if (D_status && !(use_hardstatus && D_HS) && len > 1)
{
curr->w_outlen = len - 1;
bcopy(buf, curr->w_outbuf, curr->w_outlen);
@@ -576,18 +720,6 @@ skip: if (--len == 0)
break;
}
break;
- case ASTR:
- switch (c)
- {
- case '\0':
- break;
- case '\033':
- curr->w_state = STRESC;
- break;
- default:
- SaveChar(c);
- }
- break;
case ESC:
switch (c)
{
@@ -618,10 +750,22 @@ skip: if (--len == 0)
break;
default:
if (Special(c))
- break;
+ {
+ curr->w_state = LIT;
+ break;
+ }
debug1("not special. c = %x\n", c);
if (c >= ' ' && c <= '/')
- curr->w_intermediate = curr->w_intermediate ? -1 : c;
+ {
+ if (curr->w_intermediate)
+#ifdef KANJI
+ if (curr->w_intermediate == '$')
+ c |= '$' << 8;
+ else
+#endif
+ c = -1;
+ curr->w_intermediate = c;
+ }
else if (c >= '0' && c <= '~')
{
DoESC(c, curr->w_intermediate);
@@ -637,20 +781,12 @@ skip: if (--len == 0)
case CSI:
switch (c)
{
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
+ 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)
{
curr->w_args[curr->w_NumArgs] =
- 10 * curr->w_args[curr->w_NumArgs] + c - '0';
+ 10 * curr->w_args[curr->w_NumArgs] + (c - '0');
}
break;
case ';':
@@ -684,8 +820,8 @@ skip: if (--len == 0)
{
curr->w_intermediate = 0;
curr->w_state = ESC;
- if (display && d_lp_missing && (CIC || IC || IM))
- UpdateLine(blank, null, null, d_bot, cols - 2, cols - 1);
+ if (display && D_lp_missing && (D_CIC || D_IC || D_IM))
+ UpdateLine(blank, null, null, D_bot, cols - 2, cols - 1);
if (curr->w_autoaka < 0)
curr->w_autoaka = 0;
}
@@ -693,41 +829,133 @@ skip: if (--len == 0)
Special(c);
break;
}
+ if (c >= 0x80 && c < 0xa0 && curr->w_c1)
+ {
+ switch (c)
+ {
+ case 0xc0 ^ 'D':
+ case 0xc0 ^ 'E':
+ case 0xc0 ^ 'H':
+ case 0xc0 ^ 'M':
+ case 0xc0 ^ 'N':
+ case 0xc0 ^ 'O':
+ DoESC(c ^ 0xc0, 0);
+ break;
+ case 0xc0 ^ '[':
+ if (display && D_lp_missing && (D_CIC || D_IC || D_IM))
+ UpdateLine(blank, null, null, D_bot, cols - 2, cols - 1);
+ if (curr->w_autoaka < 0)
+ curr->w_autoaka = 0;
+ curr->w_NumArgs = 0;
+ curr->w_intermediate = 0;
+ bzero((char *) curr->w_args, MAXARGS * sizeof(int));
+ curr->w_state = CSI;
+ break;
+ case 0xc0 ^ 'P':
+ StartString(DCS);
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+
+ font = c >= 0x80 ? curr->w_FontR : curr->w_Font;
+#ifdef KANJI
+ if (font == KANA && curr->w_kanji == 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);
+ if ((0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xef))
+ {
+ debug("YES!\n");
+ curr->w_mbcs = c;
+ break;
+ }
+ }
+ if (font == KANJI || curr->w_mbcs)
+ {
+ int t = c;
+ if (curr->w_mbcs == 0)
+ {
+ curr->w_mbcs = c;
+ break;
+ }
+ if (curr->w_x == cols - 1)
+ {
+ 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)
+ {
+ debug2("SJIS !! %x %x\n", c, t);
+ 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++;
+ font = KANJI;
+ }
+ else
+ {
+ /* Incomplete shift-jis - skip first byte */
+ c = t;
+ t = 0;
+ }
+ debug2("SJIS after %x %x\n", c, t);
+ }
+ curr->w_mbcs = t;
+ }
+ kanjiloop:
+#endif
+ if (curr->w_gr)
+ {
+ c &= 0x7f;
+ if (c < ' ') /* this is ugly but kanji support */
+ goto tryagain; /* prevents nicer programming */
+ }
+ if (c == '\177')
+ break;
if (display)
{
- if (d_attr != curr->w_Attr)
+ if (D_attr != curr->w_Attr)
SetAttr(curr->w_Attr);
- if (d_font != curr->w_Font)
- SetFont(curr->w_Font);
+ if (D_font != font)
+ SetFont(font);
}
if (curr->w_x < cols - 1)
{
if (curr->w_insert)
- InsertAChar(c);
+ InsertAChar(c, font);
else
{
if (display)
PUTCHAR(c);
- SetChar(c);
+ SetChar(c, font);
curr->w_x++;
}
}
else if (curr->w_x == cols - 1)
{
- if (display && curr->w_wrap && (CLP || !force_vt || COP))
+ if (display && curr->w_wrap && (D_CLP || !force_vt || D_COP))
{
- RAW_PUTCHAR(c); /* don't care about d_insert */
- SetChar(c);
- if (AM && !CLP)
- LineFeed(0); /* terminal auto-wrapped */
- else
- curr->w_x++;
+ RAW_PUTCHAR(c); /* don't care about D_insert */
+ SetChar(c, font);
+ curr->w_x++;
+ if (D_AM && !D_CLP)
+ {
+ SetChar(0, 0);
+ LineFeed(0); /* terminal auto-wrapped */
+ }
}
else
{
if (display)
{
- if (CLP || curr->w_y != d_bot)
+ if (D_CLP || curr->w_y != D_bot)
{
RAW_PUTCHAR(c);
GotoPos(curr->w_x, curr->w_y);
@@ -735,40 +963,49 @@ skip: if (--len == 0)
else
CheckLP(c);
}
- SetChar(c);
+ SetChar(c, font);
if (curr->w_wrap)
curr->w_x++;
}
}
else /* curr->w_x > cols - 1 */
{
- SetChar(0); /* we wrapped */
+ SetChar(0, 0); /* we wrapped */
if (curr->w_insert)
{
LineFeed(2); /* cr+lf, handle LP */
- InsertAChar(c);
+ InsertAChar(c, font);
}
else
{
- if (display && d_x != cols) /* write char again */
+ if (display && D_AM && D_x != cols) /* write char again */
{
SetAttrFont(curr->w_attr[curr->w_y][cols - 1],
curr->w_font[curr->w_y][cols - 1]);
RAW_PUTCHAR(curr->w_image[curr->w_y][cols - 1]);
- SetAttrFont(curr->w_Attr, curr->w_Font);
- if (curr->w_y == d_bot)
- d_lp_missing = 0; /* just wrote it */
+ SetAttrFont(curr->w_Attr, font);
+ if (curr->w_y == D_bot)
+ D_lp_missing = 0; /* just wrote it */
}
- LineFeed((display == 0 || AM) ? 0 : 2);
+ LineFeed((display == 0 || D_AM) ? 0 : 2);
if (display)
PUTCHAR(c);
- SetChar(c);
+ SetChar(c, font);
curr->w_x = 1;
}
}
+#ifdef KANJI
+ if (curr->w_mbcs)
+ {
+ c = curr->w_mbcs;
+ curr->w_mbcs = 0;
+ goto kanjiloop; /* what a hack! */
+ }
+#endif
if (curr->w_ss)
{
SetFont(curr->w_Font = curr->w_charsets[curr->w_Charset]);
+ curr->w_FontR = curr->w_charsets[curr->w_CharsetR];
curr->w_ss = 0;
}
break;
@@ -803,13 +1040,13 @@ register int c;
else
{
if (!visual_bell)
- PutStr(BL);
+ PutStr(D_BL);
else
{
- if (!VB)
+ if (!D_VB)
curr->w_bell = BELL_VISUAL;
else
- PutStr(VB);
+ PutStr(D_VB);
}
}
return 1;
@@ -884,15 +1121,28 @@ int c, intermediate;
case 'o': /* LS3 */
MapCharset(G3);
break;
+ case '~':
+ MapCharsetR(G1); /* LS1R */
+ break;
+ case '}':
+ MapCharsetR(G2); /* LS2R */
+ break;
+ case '|':
+ MapCharsetR(G3); /* LS3R */
+ break;
case 'N': /* SS2 */
- if (curr->w_charsets[curr->w_Charset] != curr->w_charsets[G2])
- curr->w_Font = curr->w_charsets[curr->w_ss = G2];
+ if (curr->w_charsets[curr->w_Charset] != curr->w_charsets[G2]
+ || curr->w_charsets[curr->w_CharsetR] != curr->w_charsets[G2])
+ {
+ curr->w_FontR = curr->w_Font = curr->w_charsets[curr->w_ss = G2];
+ }
else
curr->w_ss = 0;
break;
case 'O': /* SS3 */
- if (curr->w_charsets[curr->w_Charset] != curr->w_charsets[G3])
- curr->w_Font = curr->w_charsets[curr->w_ss = G3];
+ if (curr->w_charsets[curr->w_Charset] != curr->w_charsets[G3]
+ || curr->w_charsets[curr->w_CharsetR] != curr->w_charsets[G3])
+ curr->w_FontR = curr->w_Font = curr->w_charsets[curr->w_ss = G3];
else
curr->w_ss = 0;
break;
@@ -918,6 +1168,28 @@ int c, intermediate;
case '+':
DesignateCharset(c, G3);
break;
+#ifdef KANJI
+/*
+ * ESC $ ( Fn: invoke multi-byte charset, Fn, to G0
+ * ESC $ Fn: same as above. (old sequence)
+ * ESC $ ) Fn: invoke multi-byte charset, Fn, to G1
+ * ESC $ * Fn: invoke multi-byte charset, Fn, to G2
+ * ESC $ + Fn: invoke multi-byte charset, Fn, to G3
+ */
+ case '$':
+ case '$'<<8 | '(':
+ DesignateCharset(c & 037, G0);
+ break;
+ case '$'<<8 | ')':
+ DesignateCharset(c & 037, G1);
+ break;
+ case '$'<<8 | '*':
+ DesignateCharset(c & 037, G2);
+ break;
+ case '$'<<8 | '+':
+ DesignateCharset(c & 037, G3);
+ break;
+#endif
}
}
@@ -1039,10 +1311,10 @@ int c, intermediate;
a1 = curr->w_width;
if (a2 < 1)
a2 = curr->w_height;
- if (display && CWS == NULL)
+ if (display && D_CWS == NULL)
{
a2 = curr->w_height;
- if (CZ0 == NULL || (a1 != Z0width && a1 != Z1width))
+ if (D_CZ0 == NULL || (a1 != Z0width && a1 != Z1width))
a1 = curr->w_width;
}
if (a1 == curr->w_width && a2 == curr->w_height)
@@ -1086,11 +1358,8 @@ int c, intermediate;
ASetMode(0);
break;
case 'i':
- if (display && PO && a1 == 5)
- {
- curr->w_stringp = curr->w_string;
- curr->w_state = PRIN;
- }
+ if (display && a1 == 5)
+ PrintStart();
break;
case 'n':
if (a1 == 5) /* Report terminal status */
@@ -1099,7 +1368,22 @@ int c, intermediate;
Report("\033[%d;%dR", curr->w_y + 1, curr->w_x + 1);
break;
case 'c': /* Identify as VT100 */
- Report("\033[?%d;%dc", 1, 2);
+ if (a1 == 0)
+ Report("\033[?%d;%dc", 1, 2);
+ break;
+ case 'x': /* decreqtparm */
+ if (a1 == 0 || a1 == 1)
+ Report("\033[%d;1;1;112;112;1;0x", a1 + 2, 0);
+ break;
+ case 'p': /* obscure code from a 97801 term */
+ if (a1 == 6 || a1 == 7)
+ CursorInvisible(curr->w_curinv = 7 - a1);
+ break;
+ case 'S': /* obscure code from a 97801 term */
+ ScrollRegion(a1 ? a1 : 1);
+ break;
+ case 'T': /* obscure code from a 97801 term */
+ ScrollRegion(a1 ? -a1 : -1);
break;
}
break;
@@ -1113,15 +1397,30 @@ int c, intermediate;
i = (c == 'h');
switch (a1)
{
- case 1:
+ case 1: /* CKM: cursor key mode */
CursorkeysMode(curr->w_cursorkeys = i);
#ifndef TIOCPKT
NewAutoFlow(curr, !i);
#endif /* !TIOCPKT */
break;
- case 3:
+ case 2: /* ANM: ansi/vt52 mode */
+ if (i)
+ {
+#ifdef KANJI
+ if (curr->w_kanji)
+ break;
+#endif
+ curr->w_charsets[0] = curr->w_charsets[1] =
+ curr->w_charsets[2] = curr->w_charsets[2] =
+ curr->w_Font = curr->w_FontR = ASCII;
+ curr->w_Charset = 0;
+ curr->w_CharsetR = 2;
+ curr->w_ss = 0;
+ }
+ break;
+ case 3: /* COLM: column mode */
i = (i ? Z0width : Z1width);
- if (curr->w_width != i && (display == 0 || (CZ0 || CWS)))
+ if (curr->w_width != i && (display == 0 || (D_CZ0 || D_CWS)))
{
ChangeWindowSize(curr, i, curr->w_height);
SetCurr(curr); /* update rows/cols */
@@ -1129,17 +1428,30 @@ int c, intermediate;
Activate(0);
}
break;
- case 5:
+ /* case 4: SCLM: scrolling mode */
+ case 5: /* SCNM: screen mode */
+ /* This should be reverse video.
+ * Because it is used in some termcaps to emulate
+ * a visual bell we do this hack here.
+ */
if (i)
- curr->w_vbwait = 1;
+ ReverseVideo(1);
else
{
- if (display && curr->w_vbwait)
- PutStr(VB);
- curr->w_vbwait = 0;
+ if (display && D_CVR)
+ ReverseVideo(0);
+ else
+ if (curr->w_revvid)
+ {
+ if (display && D_VB)
+ PutStr(D_VB);
+ else
+ curr->w_bell = BELL_VISUAL;
+ }
}
+ curr->w_revvid = i;
break;
- case 6:
+ case 6: /* OM: origin mode */
if ((curr->w_origin = i) != 0)
{
curr->w_y = curr->w_top;
@@ -1150,29 +1462,48 @@ int c, intermediate;
if (display)
GotoPos(curr->w_x, curr->w_y);
break;
- case 7:
+ case 7: /* AWM: auto wrap mode */
curr->w_wrap = i;
break;
- case 35:
- debug1("Cursor %svisible\n", i ? "in" : "");
- curr->w_cursor_invisible = i;
+ /* case 8: ARM: auto repeat mode */
+ /* case 9: INLM: interlace mode */
+ /* case 10: EDM: edit mode */
+ /* case 11: LTM: line transmit mode */
+ /* case 13: SCFDM: space compression / field delimiting */
+ /* case 14: TEM: transmit execution mode */
+ /* case 16: EKEM: edit key execution mode */
+ case 25: /* TCEM: text cursor enable mode */
+ CursorInvisible(curr->w_curinv = !i);
break;
+ /* case 40: 132 col enable */
+ /* case 42: NRCM: 7bit NRC character mode */
+ /* case 44: margin bell enable */
}
}
break;
+ case '>':
+ switch (c)
+ {
+ case 'c': /* secondary DA */
+ if (a1 == 0)
+ Report("\033[>%d;%d;0c", 83, nversion); /* 83 == 'S' */
+ break;
+ }
+ break;
}
}
static void
-SetChar(c)
-register int c;
+SetChar(c, f)
+register int c, f;
{
register struct win *p = curr;
+ FixLine();
p->w_image[p->w_y][p->w_x] = c;
p->w_attr[p->w_y][p->w_x] = p->w_Attr;
- p->w_font[p->w_y][p->w_x] = p->w_Font;
+ p->w_font[p->w_y][p->w_x] = f;
}
static void
@@ -1195,6 +1526,46 @@ int c;
}
static void
+PrintStart()
+{
+ int pi[2];
+
+ if (printcmd == 0 && D_PO == 0)
+ return;
+ curr->w_pdisplay = display;
+ curr->w_stringp = curr->w_string;
+ curr->w_state = PRIN;
+ if (printcmd == 0 || curr->w_pdisplay->d_printfd >= 0)
+ return;
+ if (pipe(pi))
+ {
+ Msg(errno, "printing pipe");
+ return;
+ }
+ switch (fork())
+ {
+ case -1:
+ Msg(errno, "printing fork");
+ return;
+ case 0:
+ close(0);
+ dup(pi[0]);
+ closeallfiles(0);
+ if (setuid(real_uid) || setgid(real_gid))
+ _exit(1);
+#ifdef SIGPIPE
+ signal(SIGPIPE, SIG_DFL);
+#endif
+ execl("/bin/sh", "sh", "-c", printcmd, 0);
+ _exit(1);
+ default:
+ break;
+ }
+ close(pi[0]);
+ curr->w_pdisplay->d_printfd = pi[1];
+}
+
+static void
PrintChar(c)
int c;
{
@@ -1206,14 +1577,37 @@ int c;
static void
PrintFlush()
{
- if (display && curr->w_stringp > curr->w_string)
+ struct display *odisp = display;
+
+ display = curr->w_pdisplay;
+ if (display && printcmd)
+ {
+ char *bp = curr->w_string;
+ int len = curr->w_stringp - curr->w_string;
+ int r;
+ while (len && display->d_printfd >= 0)
+ {
+ r = write(display->d_printfd, bp, len);
+ if (r <= 0)
+ {
+ Msg(errno, "printing aborted");
+ close(display->d_printfd);
+ display->d_printfd = -1;
+ break;
+ }
+ bp += r;
+ len -= r;
+ }
+ }
+ else if (display && curr->w_stringp > curr->w_string)
{
- PutStr(PO);
+ PutStr(D_PO);
AddStrn(curr->w_string, curr->w_stringp - curr->w_string);
- PutStr(PF);
+ PutStr(D_PF);
Flush();
}
curr->w_stringp = curr->w_string;
+ display = odisp;
}
@@ -1237,13 +1631,19 @@ DesignateCharset(c, n)
int c, n;
{
curr->w_ss = 0;
- if (c == 'B')
+#ifdef KANJI
+ if (c == ('@' & 037))
+ c = KANJI;
+#endif
+ if (c == 'B' || c == 'J')
c = ASCII;
if (curr->w_charsets[n] != c)
{
curr->w_charsets[n] = c;
if (curr->w_Charset == n)
SetFont(curr->w_Font = c);
+ if (curr->w_CharsetR == n)
+ curr->w_FontR = c;
}
}
@@ -1260,6 +1660,19 @@ int n;
}
static void
+MapCharsetR(n)
+int n;
+{
+ curr->w_ss = 0;
+ if (curr->w_CharsetR != n)
+ {
+ curr->w_CharsetR = n;
+ curr->w_FontR = curr->w_charsets[n];
+ }
+ curr->w_gr = 1;
+}
+
+static void
SaveCursor()
{
curr->w_saved = 1;
@@ -1267,6 +1680,7 @@ SaveCursor()
curr->w_Saved_y = curr->w_y;
curr->w_SavedAttr = curr->w_Attr;
curr->w_SavedCharset = curr->w_Charset;
+ curr->w_SavedCharsetR = curr->w_CharsetR;
bcopy((char *) curr->w_charsets, (char *) curr->w_SavedCharsets,
4 * sizeof(int));
}
@@ -1284,6 +1698,7 @@ RestoreCursor()
bcopy((char *) curr->w_SavedCharsets, (char *) curr->w_charsets,
4 * sizeof(int));
curr->w_Charset = curr->w_SavedCharset;
+ curr->w_CharsetR = curr->w_SavedCharsetR;
curr->w_ss = 0;
SetFont(curr->w_Font = curr->w_charsets[curr->w_Charset]);
}
@@ -1336,7 +1751,7 @@ int out_mode;
curr->w_autoaka--;
if (out_mode && display)
{
- ScrollRegion(curr->w_top, curr->w_bot, 1);
+ ScrollV(0, curr->w_top, cols - 1, curr->w_bot, 1);
GotoPos(curr->w_x, curr->w_y);
}
}
@@ -1349,7 +1764,7 @@ ReverseLineFeed()
ScrollDownMap(1);
if (!display)
return;
- ScrollRegion(curr->w_top, curr->w_bot, -1);
+ ScrollV(0, curr->w_top, cols - 1, curr->w_bot, -1);
GotoPos(curr->w_x, curr->w_y);
}
else if (curr->w_y > 0)
@@ -1357,8 +1772,8 @@ ReverseLineFeed()
}
static void
-InsertAChar(c)
-int c;
+InsertAChar(c, f)
+int c, f;
{
register int y = curr->w_y, x = curr->w_x;
@@ -1370,16 +1785,16 @@ int c;
bcopy(curr->w_image[y] + x, curr->w_image[y] + x + 1, cols - x - 1);
bcopy(curr->w_attr[y] + x, curr->w_attr[y] + x + 1, cols - x - 1);
bcopy(curr->w_font[y] + x, curr->w_font[y] + x + 1, cols - x - 1);
- SetChar(c);
+ SetChar(c, f);
curr->w_x = x + 1;
if (!display)
return;
- if (CIC || IC || IM)
+ if (D_CIC || D_IC || D_IM)
{
InsertMode(curr->w_insert);
INSERTCHAR(c);
- if (y == d_bot)
- d_lp_missing = 0;
+ if (y == D_bot)
+ D_lp_missing = 0;
}
else
UpdateLine(OldImage, OldAttr, OldFont, y, x, cols - 1);
@@ -1389,7 +1804,7 @@ static void
InsertChar(n)
int n;
{
- register int i, y = curr->w_y, x = curr->w_x;
+ register int y = curr->w_y, x = curr->w_x;
if (n <= 0)
return;
@@ -1409,37 +1824,15 @@ int n;
ClearInLine(y, x, x + n - 1);
if (!display)
return;
- if (IC || CIC || IM)
- {
- if (y == d_bot)
- d_lp_missing = 0;
- if (!d_insert)
- {
- if (n == 1 && IC)
- {
- PutStr(IC);
- return;
- }
- if (CIC)
- {
- CPutStr(CIC, n);
- return;
- }
- }
- InsertMode(1);
- for (i = n; i--; )
- INSERTCHAR(' ');
- GotoPos(x, y);
- }
- else
- UpdateLine(OldImage, OldAttr, OldFont, y, x, cols - 1);
+ ScrollH(y, x, curr->w_width - 1, -n, OldImage, OldAttr, OldFont);
+ GotoPos(x, y);
}
static void
DeleteChar(n)
int n;
{
- register int i, y = curr->w_y, x = curr->w_x;
+ register int y = curr->w_y, x = curr->w_x;
if (x == cols)
x--;
@@ -1454,27 +1847,8 @@ int n;
ClearInLine(y, cols - n, cols - 1);
if (!display)
return;
- if (CDC && !(n == 1 && DC))
- {
- CPutStr(CDC, n);
- if (d_lp_missing && y == d_bot)
- {
- FixLP(cols - 1 - n, y);
- GotoPos(x, y);
- }
- }
- else if (DC)
- {
- for (i = n; i; i--)
- PutStr(DC);
- if (d_lp_missing && y == d_bot)
- {
- FixLP(cols - 1 - n, y);
- GotoPos(x, y);
- }
- }
- else
- UpdateLine(OldImage, OldAttr, OldFont, y, x, cols - 1);
+ ScrollH(y, x, curr->w_width - 1, n, OldImage, OldAttr, OldFont);
+ GotoPos(x, y);
}
static void
@@ -1492,7 +1866,7 @@ int n;
curr->w_top = old;
if (!display)
return;
- ScrollRegion(curr->w_y, curr->w_bot, n);
+ ScrollV(0, curr->w_y, cols - 1, curr->w_bot, n);
GotoPos(curr->w_x, curr->w_y);
}
@@ -1511,10 +1885,23 @@ int n;
curr->w_top = old;
if (!display)
return;
- ScrollRegion(curr->w_y, curr->w_bot, -n);
+ ScrollV(0, curr->w_y, cols - 1, curr->w_bot, -n);
GotoPos(curr->w_x, curr->w_y);
}
+static void
+ScrollRegion(n)
+int n;
+{
+ if (n > 0)
+ ScrollUpMap(n);
+ else
+ ScrollDownMap(-n);
+ if (!display)
+ return;
+ ScrollV(0, curr->w_top, cols - 1, curr->w_bot, n);
+ GotoPos(curr->w_x, curr->w_y);
+}
static void
ScrollUpMap(n)
@@ -1647,7 +2034,7 @@ ClearFromBOS()
register int n, y = curr->w_y, x = curr->w_x;
if (display)
- Clear(0, 0, x, y);
+ Clear(0, 0, 0, cols - 1, x, y, 1);
for (n = 0; n < y; ++n)
ClearInLine(n, 0, cols - 1);
ClearInLine(y, 0, x);
@@ -1665,7 +2052,7 @@ ClearToEOS()
return;
}
if (display)
- Clear(x, y, d_width - 1, d_height - 1);
+ Clear(x, y, 0, cols - 1, cols - 1, rows - 1, 1);
ClearInLine(y, x, cols - 1);
for (n = y + 1; n < rows; n++)
ClearInLine(n, 0, cols - 1);
@@ -1678,7 +2065,7 @@ ClearFullLine()
register int y = curr->w_y;
if (display)
- Clear(0, y, d_width - 1, y);
+ Clear(0, y, 0, cols - 1, cols - 1, y, 1);
ClearInLine(y, 0, cols - 1);
RestorePosAttrFont();
}
@@ -1689,7 +2076,7 @@ ClearToEOL()
register int y = curr->w_y, x = curr->w_x;
if (display)
- Clear(x, y, d_width - 1, y);
+ Clear(x, y, 0, cols - 1, cols - 1, y, 1);
ClearInLine(y, x, cols - 1);
RestorePosAttrFont();
}
@@ -1700,7 +2087,7 @@ ClearFromBOL()
register int y = curr->w_y, x = curr->w_x;
if (display)
- Clear(0, y, x, y);
+ Clear(0, y, 0, cols - 1, x, y, 1);
ClearInLine(y, 0, x);
RestorePosAttrFont();
}
@@ -1792,6 +2179,9 @@ int on;
curr->w_insert = on;
InsertMode(on);
break;
+ case 20:
+ curr->w_autolf = on;
+ break;
}
}
}
@@ -1864,7 +2254,7 @@ char n_ch;
ASSERT(display);
x = cols - 1;
- y = d_bot;
+ y = D_bot;
o_ch = curr->w_image[y][x];
o_at = curr->w_attr[y][x];
o_fo = curr->w_font[y][x];
@@ -1872,24 +2262,26 @@ char n_ch;
n_at = curr->w_Attr;
n_fo = curr->w_Font;
- d_lp_image = n_ch;
- d_lp_attr = n_at;
- d_lp_font = n_fo;
- d_lp_missing = 0;
+ D_lp_image = n_ch;
+ D_lp_attr = n_at;
+ D_lp_font = n_fo;
+ D_lp_missing = 0;
if (n_ch == o_ch && n_at == o_at && n_fo == o_fo)
return;
if (n_ch != ' ' || n_at || n_fo)
- d_lp_missing = 1;
+ D_lp_missing = 1;
if (o_ch != ' ' || o_at || o_fo)
{
- if (DC)
- PutStr(DC);
- else if (CDC)
- CPutStr(CDC, 1);
- else if (CE)
- PutStr(CE);
+ if (D_attr && D_UT)
+ SetAttr(0);
+ if (D_DC)
+ PutStr(D_DC);
+ else if (D_CDC)
+ CPutStr(D_CDC, 1);
+ else if (D_CE)
+ PutStr(D_CE);
else
- d_lp_missing = 1;
+ D_lp_missing = 1;
}
}
@@ -2035,3 +2427,4 @@ char **pi, **pa, **pf;
wp->w_histidx = 0;
}
#endif
+
diff --git a/src/ansi.h b/src/ansi.h
index deadcb9..069cdba 100644
--- a/src/ansi.h
+++ b/src/ansi.h
@@ -38,6 +38,10 @@
#define A_BL (1<<ATTR_BL)
#define A_MAX (1<<(NATTR-1))
+#define ATYP_M (1<<0)
+#define ATYP_S (1<<1)
+#define ATYP_U (1<<2)
+
/*
* Parser state
*/
@@ -60,9 +64,11 @@ enum string_t
DCS, /* Device control string */
OSC, /* Operating system command */
APC, /* Application program command */
+ /* - used for status change */
PM, /* Privacy message */
AKA, /* title for current screen */
- GM /* Global message to every display */
+ GM, /* Global message to every display */
+ STATUS /* User hardstatus line */
};
/*
@@ -94,6 +100,16 @@ enum move_t {
#ifdef TOPSTAT
#define STATLINE (0)
#else
-#define STATLINE (d_height-1)
+#define STATLINE (D_height-1)
#endif
+#ifdef KANJI
+
+#undef KANJI
+#define KANJI ('B' & 037)
+#define KANA 'I'
+
+#define EUC 1
+#define SJIS 2
+
+#endif
diff --git a/src/attacher.c b/src/attacher.c
index 29aed73..3151b00 100644
--- a/src/attacher.c
+++ b/src/attacher.c
@@ -36,25 +36,25 @@ RCS_ID("$Id$ FAU")
# include <shadow.h>
#endif /* SHADOWPW */
-static sig_t AttacherSigInt __P(SIGPROTOARG);
+static sigret_t AttacherSigInt __P(SIGPROTOARG);
#ifdef PASSWORD
static void trysend __P((int, struct msg *, char *));
#endif
#if defined(SIGWINCH) && defined(TIOCGWINSZ)
-static sig_t AttacherWinch __P(SIGPROTOARG);
+static sigret_t AttacherWinch __P(SIGPROTOARG);
#endif
#ifdef LOCK
-static sig_t DoLock __P(SIGPROTOARG);
+static sigret_t DoLock __P(SIGPROTOARG);
static void LockTerminal __P((void));
-static sig_t LockHup __P(SIGPROTOARG);
+static sigret_t LockHup __P(SIGPROTOARG);
static void screen_builtin_lck __P((void));
#endif
#ifdef DEBUG
-static sig_t AttacherChld __P(SIGPROTOARG);
+static sigret_t AttacherChld __P(SIGPROTOARG);
#endif
extern int real_uid, real_gid, eff_uid, eff_gid;
-extern char *SockName, *SockNamePtr, SockPath[];
+extern char *SockName, *SockMatch, SockPath[];
extern struct passwd *ppp;
extern char *attach_tty, *attach_term, *LoginName;
extern int xflag, dflag, rflag, quietflag, adaptflag;
@@ -66,7 +66,7 @@ extern int nethackflag;
extern char *multi;
extern int multiattach, multi_uid, own_uid;
extern int tty_mode, tty_oldmode;
-# ifdef NOREUID
+# ifndef USE_SETEUID
static int multipipe[2];
# endif
#endif
@@ -76,26 +76,31 @@ static int multipipe[2];
/*
* Send message to a screen backend.
* returns 1 if we could attach one, or 0 if none.
+ * Understands MSG_ATTACH, MSG_DETACH, MSG_POW_DETACH
+ * MSG_CONT, MSG_WINCH and nothing else!
*/
int
Attach(how)
int how;
{
- int lasts;
+ int n, lasts;
struct msg m;
struct stat st;
char *s;
debug2("Attach: how=%d, tty=%s\n", how, attach_tty);
#ifdef MULTIUSER
-# ifdef NOREUID
+# ifndef USE_SETEUID
while ((how == MSG_ATTACH || how == MSG_CONT) && multiattach)
{
int ret;
if (pipe(multipipe))
Panic(errno, "pipe");
+ if (chmod(attach_tty, 0666))
+ Panic(errno, "chmod %s", attach_tty);
+ tty_oldmode = tty_mode;
eff_uid = -1; /* make UserContext fork */
real_uid = multi_uid;
if ((ret = UserContext()) <= 0)
@@ -145,17 +150,18 @@ int how;
eff_uid = real_uid;
break;
}
-# else /* NOREUID */
+# else /* USE_SETEUID */
if ((how == MSG_ATTACH || how == MSG_CONT) && multiattach)
{
real_uid = multi_uid;
eff_uid = own_uid;
- setreuid(real_uid, eff_uid);
+ xseteuid(multi_uid);
+ xseteuid(own_uid);
if (chmod(attach_tty, 0666))
Panic(errno, "chmod %s", attach_tty);
tty_oldmode = tty_mode;
}
-# endif /* NOREUID */
+# endif /* USE_SETEUID */
#endif /* MULTIUSER */
bzero((char *) &m, sizeof(m));
@@ -164,7 +170,7 @@ int how;
if (how == MSG_WINCH)
{
- if ((lasts = MakeClientSocket(0, SockName)) >= 0)
+ if ((lasts = MakeClientSocket(0)) >= 0)
{
write(lasts, (char *)&m, sizeof(m));
close(lasts);
@@ -174,29 +180,32 @@ int how;
if (how == MSG_CONT)
{
- if ((lasts = MakeClientSocket(0, SockName)) < 0)
+ if ((lasts = MakeClientSocket(0)) < 0)
{
- Panic(0, "Sorry, cannot contact session \"%s\" again\r\n",
- SockName ? SockName : "<NULL>");
+ Panic(0, "Sorry, cannot contact session \"%s\" again.\r\n",
+ SockName);
}
}
else
{
- switch (FindSocket(how, &lasts))
+ n = FindSocket(&lasts, (int *)0, SockMatch);
+ switch (n)
{
case 0:
if (rflag == 2)
return 0;
if (quietflag)
eexit(10);
- Panic(0, SockName && *SockName ? "There is no screen to be %sed matching %s." : "There is no screen to be %sed.",
+ Panic(0, SockMatch && *SockMatch ? "There is no screen to be %sed matching %s." : "There is no screen to be %sed.",
xflag ? "attach" :
dflag ? "detach" :
- "resum", SockName);
+ "resum", SockMatch);
/* NOTREACHED */
case 1:
break;
default:
+ if (quietflag)
+ eexit(10 + n);
Panic(0, "Type \"screen [-d] -r [pid.]tty.host\" to resume one of them.");
/* NOTREACHED */
}
@@ -210,23 +219,22 @@ int how;
if (!multiattach)
#endif
setuid(real_uid);
-#if defined(MULTIUSER) && !defined(NOREUID)
+#if defined(MULTIUSER) && defined(USE_SETEUID)
else
- setreuid(eff_uid, real_uid);
+ xseteuid(real_uid); /* multi_uid, allow backend to send signals */
#endif
setgid(real_gid);
+ eff_uid = real_uid;
+ eff_gid = real_gid;
debug2("Attach: uid %d euid %d\n", getuid(), geteuid());
- SockName = SockNamePtr;
MasterPid = 0;
- while (*SockName)
+ for (s = SockName; *s; s++)
{
- if (*SockName > '9' || *SockName < '0')
+ if (*s > '9' || *s < '0')
break;
- MasterPid = 10 * MasterPid + *SockName - '0';
- SockName++;
+ MasterPid = 10 * MasterPid + (*s - '0');
}
- SockName = SockNamePtr;
debug1("Attach decided, it is '%s'\n", SockPath);
debug1("Attach found MasterPid == %d\n", MasterPid);
if (stat(SockPath, &st) == -1)
@@ -254,11 +262,12 @@ int how;
if (how != MSG_ATTACH)
return 0; /* we detached it. jw. */
sleep(1); /* we dont want to overrun our poor backend. jw. */
- if ((lasts = MakeClientSocket(0, SockName)) == -1)
- Panic(0, "Cannot contact screen again. Shit.");
+ if ((lasts = MakeClientSocket(0)) == -1)
+ Panic(0, "Cannot contact screen again. Sigh.");
m.type = how;
}
#endif
+ ASSERT(how == MSG_ATTACH || how == MSG_CONT);
strcpy(m.m.attach.envterm, attach_term);
debug1("attach: sending %d bytes... ", sizeof m);
@@ -289,15 +298,15 @@ int how;
# ifndef PASSWORD
pause();
# endif
-# ifdef NOREUID
+# ifndef USE_SETEUID
close(multipipe[1]);
# else
- setreuid(real_uid, eff_uid);
+ xseteuid(own_uid);
if (tty_oldmode >= 0)
if (chmod(attach_tty, tty_oldmode))
Panic(errno, "chmod %s", attach_tty);
tty_oldmode = -1;
- setreuid(eff_uid, real_uid);
+ xseteuid(real_uid);
# endif
}
#endif
@@ -310,14 +319,14 @@ int how;
static trysendstatok, trysendstatfail;
-static sig_t
-trysendok(SIGDEFARG)
+static sigret_t
+trysendok SIGDEFARG
{
trysendstatok = 1;
}
-static sig_t
-trysendfail(SIGDEFARG)
+static sigret_t
+trysendfail SIGDEFARG
{
# ifdef SYSVSIGS
signal(SIG_PW_FAIL, trysendfail);
@@ -334,8 +343,8 @@ struct msg *m;
char *pwto;
{
char *npw = NULL;
- sig_t (*sighup)__P(SIGPROTOARG);
- sig_t (*sigusr1)__P(SIGPROTOARG);
+ sigret_t (*sighup)__P(SIGPROTOARG);
+ sigret_t (*sigusr1)__P(SIGPROTOARG);
int tries;
sigusr1 = signal(SIG_PW_OK, trysendok);
@@ -367,8 +376,8 @@ char *pwto;
Panic(0, "Password incorrect.");
}
strncpy(screenpw, npw, 8);
- if ((fd = MakeClientSocket(0, SockName)) == -1)
- Panic(0, "Cannot contact screen again. Shit.");
+ if ((fd = MakeClientSocket(0)) == -1)
+ Panic(0, "Cannot contact screen again. Sigh.");
}
}
#endif /* PASSWORD */
@@ -377,13 +386,11 @@ char *pwto;
#ifdef DEBUG
static int AttacherPanic;
-static sig_t
-AttacherChld(SIGDEFARG)
+static sigret_t
+AttacherChld SIGDEFARG
{
AttacherPanic=1;
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
#endif
@@ -391,14 +398,12 @@ AttacherChld(SIGDEFARG)
* the frontend's Interrupt handler
* we forward SIGINT to the poor backend
*/
-static sig_t
-AttacherSigInt(SIGDEFARG)
+static sigret_t
+AttacherSigInt SIGDEFARG
{
signal(SIGINT, AttacherSigInt);
Kill(MasterPid, SIGINT);
-# ifndef SIGVOID
- return (sig_t) 0;
-# endif
+ SIGRETURN;
}
/*
@@ -406,8 +411,8 @@ AttacherSigInt(SIGDEFARG)
* check, if the backend is already detached.
*/
-sig_t
-AttacherFinit(SIGDEFARG)
+sigret_t
+AttacherFinit SIGDEFARG
{
struct stat statb;
struct msg m;
@@ -416,22 +421,18 @@ AttacherFinit(SIGDEFARG)
debug("AttacherFinit();\n");
signal(SIGHUP, SIG_IGN);
/* Check if signal comes from backend */
- if (SockName)
+ if (stat(SockPath, &statb) == 0 && (statb.st_mode & 0777) != 0600)
{
- strcpy(SockNamePtr, SockName);
- if (stat(SockPath, &statb) == 0 && (statb.st_mode & 0777) != 0600)
+ debug("Detaching backend!\n");
+ bzero((char *) &m, sizeof(m));
+ strcpy(m.m_tty, attach_tty);
+ debug1("attach_tty is %s\n", attach_tty);
+ m.m.detach.dpid = getpid();
+ m.type = MSG_HANGUP;
+ if ((s = MakeClientSocket(0)) >= 0)
{
- debug("Detaching backend!\n");
- bzero((char *) &m, sizeof(m));
- strcpy(m.m_tty, attach_tty);
- debug1("attach_tty is %s\n", attach_tty);
- m.m.detach.dpid = getpid();
- m.type = MSG_HANGUP;
- if ((s = MakeClientSocket(0, SockName)) >= 0)
- {
- write(s, (char *)&m, sizeof(m));
- close(s);
- }
+ write(s, (char *)&m, sizeof(m));
+ close(s);
}
}
#ifdef MULTIUSER
@@ -442,18 +443,16 @@ AttacherFinit(SIGDEFARG)
}
#endif
exit(0);
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
#ifdef POW_DETACH
-static sig_t
-AttacherFinitBye(SIGDEFARG)
+static sigret_t
+AttacherFinitBye SIGDEFARG
{
int ppid;
debug("AttacherFintBye()\n");
-#if defined(MULTIUSER) && defined(NOREUID)
+#if defined(MULTIUSER) && !defined(USE_SETEUID)
if (multiattach)
exit(SIG_POWER_BYE);
#endif
@@ -467,52 +466,44 @@ AttacherFinitBye(SIGDEFARG)
if ((ppid = getppid()) > 1)
Kill(ppid, SIGHUP); /* carefully say good bye. jw. */
exit(0);
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
#endif
static int SuspendPlease;
-static sig_t
-SigStop(SIGDEFARG)
+static sigret_t
+SigStop SIGDEFARG
{
debug("SigStop()\n");
SuspendPlease = 1;
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
#ifdef LOCK
static int LockPlease;
-static sig_t
-DoLock(SIGDEFARG)
+static sigret_t
+DoLock SIGDEFARG
{
# ifdef SYSVSIGS
signal(SIG_LOCK, DoLock);
# endif
debug("DoLock()\n");
LockPlease = 1;
-# ifndef SIGVOID
- return((sig_t) 0);
-# endif
+ SIGRETURN;
}
#endif
#if defined(SIGWINCH) && defined(TIOCGWINSZ)
static int SigWinchPlease;
-static sig_t
-AttacherWinch(SIGDEFARG)
+static sigret_t
+AttacherWinch SIGDEFARG
{
debug("AttacherWinch()\n");
SigWinchPlease = 1;
-# ifndef SIGVOID
- return((sig_t) 0);
-# endif
+ SIGRETURN;
}
#endif
@@ -550,7 +541,7 @@ Attacher()
for (;;)
{
#ifdef DEBUG
- sleep(30);
+ sleep(1);
if (kill(MasterPid, 0) < 0 && errno != EPERM)
{
debug1("attacher: Panic! MasterPid %d does not exist.\n", MasterPid);
@@ -575,7 +566,7 @@ Attacher()
if (SuspendPlease)
{
SuspendPlease = 0;
-#if defined(MULTIUSER) && defined(NOREUID)
+#if defined(MULTIUSER) && !defined(USE_SETEUID)
if (multiattach)
exit(SIG_STOP);
#endif
@@ -591,7 +582,7 @@ Attacher()
if (LockPlease)
{
LockPlease = 0;
-#if defined(MULTIUSER) && defined(NOREUID)
+#if defined(MULTIUSER) && !defined(USE_SETEUID)
if (multiattach)
exit(SIG_LOCK);
#endif
@@ -622,11 +613,15 @@ Attacher()
static char LockEnd[] = "Welcome back to screen !!\n";
-static sig_t
-LockHup(SIGDEFARG)
+static sigret_t
+LockHup SIGDEFARG
{
int ppid = getppid();
+#ifdef MULTIUSER
+ setuid(own_uid);
+#else
setuid(real_uid);
+#endif
setgid(real_gid);
if (ppid > 1)
Kill(ppid, SIGHUP);
@@ -638,7 +633,7 @@ LockTerminal()
{
char *prg;
int sig, pid;
- sig_t (*sigs[NSIG])__P(SIGPROTOARG);
+ sigret_t (*sigs[NSIG])__P(SIGPROTOARG);
for (sig = 1; sig < NSIG; sig++)
{
@@ -655,7 +650,11 @@ LockTerminal()
if ((pid = fork()) == 0)
{
/* Child */
+#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);
@@ -722,7 +721,7 @@ LockTerminal()
/* reset signals */
for (sig = 1; sig < NSIG; sig++)
{
- if (sigs[sig] != (sig_t(*)__P(SIGPROTOARG)) -1)
+ if (sigs[sig] != (sigret_t(*)__P(SIGPROTOARG)) -1)
signal(sig, sigs[sig]);
}
} /* LockTerminal */
@@ -802,6 +801,8 @@ realpw:
}
pass = 0;
}
+ else
+ pass[13] = 0; /* beware of linux's long passwords */
debug("screen_builtin_lck looking in gcos field\n");
strcpy(fullname, ppp->pw_gecos);
diff --git a/src/comm.c b/src/comm.c
index 9eb8b0b..dbee9f3 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -39,35 +39,46 @@ struct comm comms[RC_LAST + 1] =
#endif
{ "activity", ARGS_ONE },
{ "aka", NEED_FORE|ARGS_ZEROONE }, /* TO BE REMOVED */
- { "allpartial", ARGS_ONE },
- { "at", ARGS_TWO|ARGS_ORMORE },
+ { "allpartial", NEED_DISPLAY|ARGS_ONE },
+ { "at", NEED_DISPLAY|ARGS_TWO|ARGS_ORMORE },
{ "autodetach", ARGS_ONE },
#ifdef AUTO_NUKE
{ "autonuke", NEED_DISPLAY|ARGS_ONE },
#endif
- { "bell", ARGS_ONE },
+ { "bell", ARGS_ZEROONE },
+ { "bell_msg", ARGS_ZEROONE },
{ "bind", ARGS_ONE|ARGS_ORMORE },
+#ifdef MAPKEYS
+ { "bindkey", ARGS_ZERO|ARGS_ORMORE },
+#endif
{ "break", NEED_FORE|ARGS_ZEROONE },
#ifdef COPY_PASTE
{ "bufferfile", ARGS_ZEROONE },
#endif
+ { "c1", NEED_FORE|ARGS_ZEROONE },
{ "chdir", ARGS_ZEROONE },
{ "clear", NEED_FORE|ARGS_ZERO },
#ifdef MULTI
{ "clone", NEED_DISPLAY|ARGS_ONE|ARGS_ORMORE },
#endif
{ "colon", NEED_DISPLAY|ARGS_ZERO },
+ { "command", NEED_DISPLAY|ARGS_ZERO },
{ "console", NEED_FORE|ARGS_ZEROONE },
#ifdef COPY_PASTE
{ "copy", NEED_FORE|ARGS_ZERO },
- { "copy_reg", ARGS_ZEROONE },
{ "crlf", ARGS_ONE },
#endif
{ "debug", ARGS_ZEROONE },
#ifdef AUTO_NUKE
{ "defautonuke", ARGS_ONE },
#endif
+ { "defc1", ARGS_ONE },
+ { "defescape", ARGS_ONE },
{ "defflow", ARGS_ONETWO },
+ { "defgr", ARGS_ONE },
+#ifdef KANJI
+ { "defkanji", ARGS_ONE },
+#endif
#if defined(UTMPOK) && defined(LOGOUTOK)
{ "deflogin", ARGS_ONE },
#endif
@@ -78,28 +89,29 @@ struct comm comms[RC_LAST + 1] =
{ "defscrollback", ARGS_ONE },
#endif
{ "defwrap", ARGS_ONE },
+ { "defwritelock", ARGS_ONE },
{ "detach", NEED_DISPLAY|ARGS_ZERO },
{ "displays", NEED_DISPLAY|ARGS_ZERO },
- { "dumptermcap", ARGS_ZERO },
- { "duplicate", ARGS_ZERO|ARGS_ORMORE },
+ { "dumptermcap", NEED_FORE|ARGS_ZERO },
{ "echo", ARGS_ONETWO },
- { "escape", ARGS_ONE },
+ { "escape", NEED_DISPLAY|ARGS_ONE },
#ifdef PSEUDOS
{ "exec", NEED_FORE|ARGS_ZERO|ARGS_ORMORE },
#endif
{ "flow", NEED_FORE|ARGS_ZEROONE },
+ { "gr", NEED_FORE|ARGS_ZEROONE },
{ "hardcopy", NEED_FORE|ARGS_ZERO },
{ "hardcopy_append", ARGS_ONE },
{ "hardcopydir", ARGS_ONE },
- { "hardstatus", ARGS_ZEROONE },
+ { "hardstatus", NEED_DISPLAY|ARGS_ZEROONE },
{ "height", NEED_DISPLAY|ARGS_ZEROONE },
{ "help", NEED_DISPLAY|ARGS_ZERO },
#ifdef COPY_PASTE
{ "history", NEED_FORE|ARGS_ZERO },
#endif
{ "info", NEED_DISPLAY|ARGS_ZERO },
-#ifdef COPY_PASTE
- { "ins_reg", NEED_DISPLAY|ARGS_ZEROONE },
+#ifdef KANJI
+ { "kanji", NEED_FORE|ARGS_ONETWO },
#endif
{ "kill", NEED_FORE|ARGS_ZERO },
{ "lastmsg", NEED_DISPLAY|ARGS_ZERO },
@@ -107,11 +119,16 @@ struct comm comms[RC_LAST + 1] =
#ifdef LOCK
{ "lockscreen", NEED_DISPLAY|ARGS_ZERO },
#endif
- { "log", ARGS_ZEROONE },
+ { "log", NEED_FORE|ARGS_ZEROONE },
{ "logdir", ARGS_ONE },
#if defined(UTMPOK) && defined(LOGOUTOK)
{ "login", NEED_FORE|ARGS_ZEROONE },
#endif
+#ifdef MAPKEYS
+ { "mapdefault", NEED_DISPLAY|ARGS_ZERO },
+ { "mapnotnext", NEED_DISPLAY|ARGS_ZERO },
+ { "maptimeout", ARGS_ZEROONE },
+#endif
#ifdef COPY_PASTE
{ "markkeys", ARGS_ONE },
#endif
@@ -125,29 +142,32 @@ struct comm comms[RC_LAST + 1] =
#ifdef NETHACK
{ "nethack", ARGS_ONE },
#endif
- { "next", ARGS_ZERO },
+ { "next", NEED_DISPLAY|NEED_FORE|ARGS_ZERO },
{ "number", NEED_FORE|ARGS_ZEROONE },
{ "obuflimit", NEED_DISPLAY|ARGS_ZEROONE },
- { "other", NEED_DISPLAY|ARGS_ZERO },
+ { "other", NEED_DISPLAY|NEED_FORE|ARGS_ZERO },
{ "partial", NEED_FORE|ARGS_ZEROONE },
#ifdef PASSWORD
{ "password", ARGS_ZEROONE },
#endif
#ifdef COPY_PASTE
- { "paste", NEED_DISPLAY|ARGS_ZEROONE },
+ { "paste", NEED_DISPLAY|ARGS_ZEROONETWO },
+ { "pastefont", ARGS_ZEROONE },
#endif
{ "pow_break", NEED_FORE|ARGS_ZEROONE },
#ifdef POW_DETACH
{ "pow_detach", NEED_DISPLAY|ARGS_ZERO },
- { "pow_detach_msg", ARGS_ONE },
+ { "pow_detach_msg", ARGS_ZEROONE },
#endif
- { "prev", ARGS_ZERO },
+ { "prev", NEED_DISPLAY|NEED_FORE|ARGS_ZERO },
+ { "printcmd", ARGS_ZEROONE },
{ "process", NEED_DISPLAY|ARGS_ZEROONE },
{ "quit", ARGS_ZERO },
#ifdef COPY_PASTE
{ "readbuf", NEED_DISPLAY|ARGS_ZERO },
#endif
- { "redisplay", ARGS_ZERO },
+ { "readreg", ARGS_ZEROONETWO },
+ { "redisplay", NEED_DISPLAY|ARGS_ZERO },
{ "register", ARGS_TWO },
#ifdef COPY_PASTE
{ "removebuf", ARGS_ZERO },
@@ -168,6 +188,7 @@ struct comm comms[RC_LAST + 1] =
{ "sleep", ARGS_ONE },
{ "slowpaste", ARGS_ONE },
{ "startup_message", ARGS_ONE },
+ { "stuff", NEED_DISPLAY|ARGS_ONE },
#ifdef BSDJOBS
{ "suspend", NEED_DISPLAY|ARGS_ZERO },
#endif
@@ -178,12 +199,12 @@ struct comm comms[RC_LAST + 1] =
{ "title", NEED_FORE|ARGS_ZEROONE },
{ "unsetenv", ARGS_ONE },
{ "vbell", ARGS_ZEROONE },
- { "vbell_msg", ARGS_ONE },
+ { "vbell_msg", ARGS_ZEROONE },
{ "vbellwait", ARGS_ONE },
{ "version", ARGS_ZERO },
{ "wall", NEED_DISPLAY|ARGS_ONE|ARGS_ORMORE },
{ "width", NEED_DISPLAY|ARGS_ZEROONE },
- { "windows", ARGS_ZERO },
+ { "windows", NEED_DISPLAY|ARGS_ZERO },
{ "wrap", NEED_FORE|ARGS_ZEROONE },
#ifdef COPY_PASTE
{ "writebuf", NEED_DISPLAY|ARGS_ZERO },
diff --git a/src/comm.h.dist b/src/comm.h.dist
index de5a949..2227544 100644
--- a/src/comm.h.dist
+++ b/src/comm.h.dist
@@ -29,7 +29,7 @@ struct comm
#define ARGS_ONETWO (ARGS_ONE |ARGS_PLUSONE)
#define ARGS_TWOTHREE (ARGS_TWO |ARGS_PLUSONE)
#define ARGS_ZEROTWO (ARGS_ZERO|ARGS_PLUSTWO)
-#define ARGS_ZEROONETWO (ARGS_ONE |ARGS_PLUSONE|ARGS_PLUSTWO)
+#define ARGS_ZEROONETWO (ARGS_ZERO|ARGS_PLUSONE|ARGS_PLUSTWO)
struct action
{
@@ -50,107 +50,122 @@ struct action
#define RC_AUTODETACH 8
#define RC_AUTONUKE 9
#define RC_BELL 10
-#define RC_BIND 11
-#define RC_BREAK 12
-#define RC_BUFFERFILE 13
-#define RC_CHDIR 14
-#define RC_CLEAR 15
-#define RC_CLONE 16
-#define RC_COLON 17
-#define RC_CONSOLE 18
-#define RC_COPY 19
-#define RC_COPY_REG 20
-#define RC_CRLF 21
-#define RC_DEBUG 22
-#define RC_DEFAUTONUKE 23
-#define RC_DEFFLOW 24
-#define RC_DEFLOGIN 25
-#define RC_DEFMODE 26
-#define RC_DEFMONITOR 27
-#define RC_DEFOBUFLIMIT 28
-#define RC_DEFSCROLLBACK 29
-#define RC_DEFWRAP 30
-#define RC_DETACH 31
-#define RC_DISPLAYS 32
-#define RC_DUMPTERMCAP 33
-#define RC_DUPLICATE 34
-#define RC_ECHO 35
-#define RC_ESCAPE 36
-#define RC_EXEC 37
-#define RC_FLOW 38
-#define RC_HARDCOPY 39
-#define RC_HARDCOPY_APPEND 40
-#define RC_HARDCOPYDIR 41
-#define RC_HARDSTATUS 42
-#define RC_HEIGHT 43
-#define RC_HELP 44
-#define RC_HISTORY 45
-#define RC_INFO 46
-#define RC_INS_REG 47
-#define RC_KILL 48
-#define RC_LASTMSG 49
-#define RC_LICENSE 50
-#define RC_LOCKSCREEN 51
-#define RC_LOG 52
-#define RC_LOGDIR 53
-#define RC_LOGIN 54
-#define RC_MARKKEYS 55
-#define RC_META 56
-#define RC_MONITOR 57
-#define RC_MSGMINWAIT 58
-#define RC_MSGWAIT 59
-#define RC_MULTIUSER 60
-#define RC_NETHACK 61
-#define RC_NEXT 62
-#define RC_NUMBER 63
-#define RC_OBUFLIMIT 64
-#define RC_OTHER 65
-#define RC_PARTIAL 66
-#define RC_PASSWORD 67
-#define RC_PASTE 68
-#define RC_POW_BREAK 69
-#define RC_POW_DETACH 70
-#define RC_POW_DETACH_MSG 71
-#define RC_PREV 72
-#define RC_PROCESS 73
-#define RC_QUIT 74
-#define RC_READBUF 75
-#define RC_REDISPLAY 76
-#define RC_REGISTER 77
-#define RC_REMOVEBUF 78
-#define RC_RESET 79
-#define RC_SCREEN 80
-#define RC_SCROLLBACK 81
-#define RC_SELECT 82
-#define RC_SESSIONNAME 83
-#define RC_SETENV 84
-#define RC_SHELL 85
-#define RC_SHELLAKA 86
-#define RC_SHELLTITLE 87
-#define RC_SILENCE 88
-#define RC_SILENCEWAIT 89
-#define RC_SLEEP 90
-#define RC_SLOWPASTE 91
-#define RC_STARTUP_MESSAGE 92
-#define RC_SUSPEND 93
-#define RC_TERM 94
-#define RC_TERMCAP 95
-#define RC_TERMINFO 96
-#define RC_TIME 97
-#define RC_TITLE 98
-#define RC_UNSETENV 99
-#define RC_VBELL 100
-#define RC_VBELL_MSG 101
-#define RC_VBELLWAIT 102
-#define RC_VERSION 103
-#define RC_WALL 104
-#define RC_WIDTH 105
-#define RC_WINDOWS 106
-#define RC_WRAP 107
-#define RC_WRITEBUF 108
-#define RC_WRITELOCK 109
-#define RC_XOFF 110
-#define RC_XON 111
-#define RC_ZOMBIE 112
+#define RC_BELL_MSG 11
+#define RC_BIND 12
+#define RC_BINDKEY 13
+#define RC_BREAK 14
+#define RC_BUFFERFILE 15
+#define RC_C1 16
+#define RC_CHDIR 17
+#define RC_CLEAR 18
+#define RC_CLONE 19
+#define RC_COLON 20
+#define RC_COMMAND 21
+#define RC_CONSOLE 22
+#define RC_COPY 23
+#define RC_CRLF 24
+#define RC_DEBUG 25
+#define RC_DEFAUTONUKE 26
+#define RC_DEFC1 27
+#define RC_DEFESCAPE 28
+#define RC_DEFFLOW 29
+#define RC_DEFGR 30
+#define RC_DEFKANJI 31
+#define RC_DEFLOGIN 32
+#define RC_DEFMODE 33
+#define RC_DEFMONITOR 34
+#define RC_DEFOBUFLIMIT 35
+#define RC_DEFSCROLLBACK 36
+#define RC_DEFWRAP 37
+#define RC_DEFWRITELOCK 38
+#define RC_DETACH 39
+#define RC_DISPLAYS 40
+#define RC_DUMPTERMCAP 41
+#define RC_ECHO 42
+#define RC_ESCAPE 43
+#define RC_EXEC 44
+#define RC_FLOW 45
+#define RC_GR 46
+#define RC_HARDCOPY 47
+#define RC_HARDCOPY_APPEND 48
+#define RC_HARDCOPYDIR 49
+#define RC_HARDSTATUS 50
+#define RC_HEIGHT 51
+#define RC_HELP 52
+#define RC_HISTORY 53
+#define RC_INFO 54
+#define RC_KANJI 55
+#define RC_KILL 56
+#define RC_LASTMSG 57
+#define RC_LICENSE 58
+#define RC_LOCKSCREEN 59
+#define RC_LOG 60
+#define RC_LOGDIR 61
+#define RC_LOGIN 62
+#define RC_MAPDEFAULT 63
+#define RC_MAPNOTNEXT 64
+#define RC_MAPTIMEOUT 65
+#define RC_MARKKEYS 66
+#define RC_META 67
+#define RC_MONITOR 68
+#define RC_MSGMINWAIT 69
+#define RC_MSGWAIT 70
+#define RC_MULTIUSER 71
+#define RC_NETHACK 72
+#define RC_NEXT 73
+#define RC_NUMBER 74
+#define RC_OBUFLIMIT 75
+#define RC_OTHER 76
+#define RC_PARTIAL 77
+#define RC_PASSWORD 78
+#define RC_PASTE 79
+#define RC_PASTEFONT 80
+#define RC_POW_BREAK 81
+#define RC_POW_DETACH 82
+#define RC_POW_DETACH_MSG 83
+#define RC_PREV 84
+#define RC_PRINTCMD 85
+#define RC_PROCESS 86
+#define RC_QUIT 87
+#define RC_READBUF 88
+#define RC_READREG 89
+#define RC_REDISPLAY 90
+#define RC_REGISTER 91
+#define RC_REMOVEBUF 92
+#define RC_RESET 93
+#define RC_SCREEN 94
+#define RC_SCROLLBACK 95
+#define RC_SELECT 96
+#define RC_SESSIONNAME 97
+#define RC_SETENV 98
+#define RC_SHELL 99
+#define RC_SHELLAKA 100
+#define RC_SHELLTITLE 101
+#define RC_SILENCE 102
+#define RC_SILENCEWAIT 103
+#define RC_SLEEP 104
+#define RC_SLOWPASTE 105
+#define RC_STARTUP_MESSAGE 106
+#define RC_STUFF 107
+#define RC_SUSPEND 108
+#define RC_TERM 109
+#define RC_TERMCAP 110
+#define RC_TERMINFO 111
+#define RC_TIME 112
+#define RC_TITLE 113
+#define RC_UNSETENV 114
+#define RC_VBELL 115
+#define RC_VBELL_MSG 116
+#define RC_VBELLWAIT 117
+#define RC_VERSION 118
+#define RC_WALL 119
+#define RC_WIDTH 120
+#define RC_WINDOWS 121
+#define RC_WRAP 122
+#define RC_WRITEBUF 123
+#define RC_WRITELOCK 124
+#define RC_XOFF 125
+#define RC_XON 126
+#define RC_ZOMBIE 127
-#define RC_LAST 112
+#define RC_LAST 127
diff --git a/src/comm.sh b/src/comm.sh
index b3f5c9c..9aa0a20 100644
--- a/src/comm.sh
+++ b/src/comm.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
if test -z "$AWK"; then
AWK=awk
@@ -43,7 +43,7 @@ struct comm
#define ARGS_ONETWO (ARGS_ONE |ARGS_PLUSONE)
#define ARGS_TWOTHREE (ARGS_TWO |ARGS_PLUSONE)
#define ARGS_ZEROTWO (ARGS_ZERO|ARGS_PLUSTWO)
-#define ARGS_ZEROONETWO (ARGS_ONE |ARGS_PLUSONE|ARGS_PLUSTWO)
+#define ARGS_ZEROONETWO (ARGS_ZERO|ARGS_PLUSONE|ARGS_PLUSTWO)
struct action
{
@@ -65,8 +65,8 @@ $AWK < ${srcdir}/comm.c >> comm.h '
$CC -E -I. -I${srcdir} ${srcdir}/comm.c > comm.cpp
sed < comm.cpp \
-n \
- -e '/^ { "/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
- -e '/^ { "/s/^ { "\([^"]*\)".*/\1/p' \
+ -e '/^ *{ "/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e '/^ *{ "/s/^ *{ "\([^"]*\)".*/\1/p' \
| $AWK '
/.*/ { printf "#define RC_%s %d\n",$0,i++;
}
diff --git a/src/config.h.in b/src/config.h.in
index c673983..24b2341 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -120,7 +120,9 @@
# define PSEUDOS
# define MULTI
# define MULTIUSER
+# define MAPKEYS
#endif /* SIMPLESCREEN */
+#define KANJI
/*
* As error messages are mostly meaningless to the user, we
@@ -150,7 +152,9 @@
* Disabling this feature only makes sense if you have a secure /etc/utmp
* database.
* Negative examples: suns usually have a world writable utmp file,
- * xterm will run perfectly without s-bit.
+ * xterm and script will run perfectly without s-bit.
+ * If LOGOUTOK is undefined and UTMPOK is defined, all windows are initially
+ * and permanently logged in.
*/
#define LOGOUTOK 1
@@ -183,13 +187,23 @@
#undef SVR4
#endif
-#ifndef OSF1
-#undef OSF1
-#endif
-
+/* #ifndef __osf__ */
#ifndef MIPS
#undef MIPS
#endif
+/* #endif */
+
+#ifndef OSX
+#undef OSX
+#endif
+
+#ifndef ISC
+#undef ISC
+#endif
+
+#ifndef _POSIX_SOURCE
+#undef _POSIX_SOURCE
+#endif
/*
* Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).
@@ -211,6 +225,11 @@
#undef TERMIO
/*
+ * Define CYTERMIO if you have cyrillic termio modes.
+ */
+#undef CYTERMIO
+
+/*
* Define TERMINFO if your machine emulates the termcap routines
* with the terminfo database.
* Thus the .screenrc file is parsed for
@@ -289,12 +308,18 @@
#undef BUGGYGETLOGIN
/*
- * If your system does not have the calls setreuid() and setregid(),
- * define NOREUID to force screen to use a forked process to safely
- * create output files without retaining any special privileges.
+ * If your system has the calls setreuid() and setregid(),
+ * define HAVE_SETREUID. Otherwise screen will use a forked process to
+ * safely create output files without retaining any special privileges.
* (Output logging will be disabled, however.)
*/
-#undef NOREUID
+#undef HAVE_SETREUID
+
+/*
+ * If your system supports BSD4.4's seteuid() and setegid(), define
+ * HAVE_SETEUID.
+ */
+#undef HAVE_SETEUID
/*
* If you want the "time" command to display the current load average
@@ -342,6 +367,11 @@
#undef USEVARARGS
/*
+ * If your system has strerror() define this.
+ */
+#undef HAVE_STRERROR
+
+/*
* If the select return value doesn't treat a descriptor that is
* usable for reading and writing as two hits, define SELECT_BROKEN.
*/
@@ -389,6 +419,21 @@
#undef NAME_MAX
/*
+ * define NEED_RENAME if your system doesn't have a rename() function
+ */
+#undef NEED_RENAME
+
+/*
+ * define HAVE__EXIT if your system has the _exit() call.
+ */
+#undef HAVE__EXIT
+
+/*
+ * define HAVE_LSTAT if your system has symlinks and the lstat() call.
+ */
+#undef HAVE_LSTAT
+
+/*
* define HAVE_DEV_PTC if you have a /dev/ptc character special
* device.
*/
@@ -404,10 +449,3 @@
#undef PTYRANGE0
#undef PTYRANGE1
-/*
- * some defines to prevent retypedefs
- */
-#undef SIG_T_DEFINED
-#undef PID_T_DEFINED
-#undef UID_T_DEFINED
-
diff --git a/src/configure b/src/configure
index 206a793..b1586fd 100755
--- a/src/configure
+++ b/src/configure
@@ -1,127 +1,321 @@
#!/bin/sh
+# From configure.in Revision: 1.17
+#!/bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf.
-# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+# Generated automatically using autoconf version 1.10
+# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
-# 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)
+# This configure script 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.
+# This script 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; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
-# [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
-# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
-# --with-PACKAGE unless this script has special code to handle it.
-
+# Save the original args to write them into config.status later.
+configure_args="$*"
-for arg
+# Only options that might do something get documented.
+ac_usage="Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+--build=BUILD configure for building on BUILD [BUILD=HOST]
+--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+--exec-prefix=PREFIX install host dependent files in PREFIX [/usr/local]
+--help print this message
+--host=HOST configure for HOST [guessed]
+--prefix=PREFIX install host independent files in PREFIX [/usr/local]
+--quiet, --silent do not print \`checking for...' messages
+--srcdir=DIR find the sources in DIR [configure dir or ..]
+--target=TARGET configure for TARGET [TARGET=HOST]
+--verbose print results of checks
+--version print the version of autoconf that created configure
+--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+--x-includes=DIR X include files are in DIR
+--x-libraries=DIR X library files are in DIR"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+exec_prefix=
+host=NONE
+no_create=
+nonopt=NONE
+norecursion=
+prefix=
+program_prefix=
+program_suffix=
+program_transform_name=
+silent=
+srcdir=
+target=NONE
+verbose=
+x_includes=
+x_libraries=
+
+ac_prev=
+for ac_option
do
- # Handle --exec-prefix with a space before the argument.
- if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
- # Handle --host with a space before the argument.
- elif test x$next_host = xyes; then next_host=
- # Handle --prefix with a space before the argument.
- elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
- # Handle --srcdir with a space before the argument.
- elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
- else
- case $arg in
- # For backward compatibility, also recognize exact --exec_prefix.
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
- exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
- next_exec_prefix=yes ;;
-
- -gas | --gas | --ga | --g) ;;
-
- -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
- -host | --host | --hos | --ho | --h)
- next_host=yes ;;
-
- -nfp | --nfp | --nf) ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
- no_create=1 ;;
-
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- next_prefix=yes ;;
-
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
- srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
- next_srcdir=yes ;;
-
- -with-* | --with-*)
- package=`echo $arg|sed 's/-*with-//'`
- # Delete all the valid chars; see if any are left.
- if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
- echo "configure: $package: invalid package name" >&2; exit 1
- fi
- eval "with_`echo $package|sed s/-/_/g`=1" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
- verbose=yes ;;
-
- *) ;;
- esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
fi
+
+ # Accept (but ignore some of) the important Cygnus configure
+ # options, so we can diagnose typos.
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ case "$ac_option" in
+
+ -build | --build | --buil | --bui | --bu | --b)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
+ build="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that aren't valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ echo "configure: $ac_feature: invalid feature name" >&2; exit 1
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that aren't valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ echo "configure: $ac_feature: invalid feature name" >&2; exit 1
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ # For backward compatibility, recognize -exec-prefix and --exec_prefix.
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ with_gas=yes ;; # Obsolete; use --with-gas.
+
+ -help | --help | --hel | --he)
+ cat << EOF
+$ac_usage
+EOF
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ with_fp=no ;; # Obsolete; use --without-fp.
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -norecursion | --norecursion | --norecursio | --norecursi \
+ | --norecurs | --norecur | --norecu | --norec | --nore | --nor)
+ norecursion=yes ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 1.10"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that aren't valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ echo "configure: $ac_package: invalid package name" >&2; exit 1
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that aren't valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ echo "configure: $ac_package: invalid package name" >&2; exit 1
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x) with_x=yes ;; # Obsolete; use --with-x.
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) echo "configure: $ac_option: invalid option; use --help to show usage" >&2; exit 1
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" >&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ echo "configure: can only configure for one host and one target at a time" >&2; exit 1
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
done
-trap 'rm -fr conftest* core; exit 1' 1 3 15
+if test -n "$ac_prev"; then
+ echo "configure: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" >&2; exit 1
+fi
+
+trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
+trap 'rm -fr confdefs* $ac_clean_files' 0
+
+# Save the original args if we used an alternate arg parser.
+ac_configure_temp="${configure_args-$*}"
+# Strip out --no-create and --norecursion so they don't pile up.
+configure_args=
+for ac_arg in $ac_configure_temp; do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -norecursion | --norecursion | --norecursio | --norecursi \
+ | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
+ *) configure_args="$configure_args $ac_arg" ;;
+ esac
+done
# NLS nuisances.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = 'set'; then LC_ALL=C; export LC_ALL; fi
+if test "${LANG+set}" = 'set'; then LANG=C; export LANG; fi
-rm -f conftest*
-compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
-unique_file=screen.c
+ac_unique_file=screen.c
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
- srcdirdefaulted=yes
+ ac_srcdir_defaulted=yes
# Try the directory containing this script, then `..'.
- prog=$0
- confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
- test "X$confdir" = "X$prog" && confdir=.
- srcdir=$confdir
- if test ! -r $srcdir/$unique_file; then
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
fi
-if test ! -r $srcdir/$unique_file; then
- if test x$srcdirdefaulted = xyes; then
- echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
+if test ! -r $srcdir/$ac_unique_file; then
+ if test x$ac_srcdir_defaulted = xyes; then
+ echo "configure: can not find sources in ${ac_confdir} or .." >&2; exit 1
else
- echo "configure: Can not find sources in \`${srcdir}'." 1>&2
+ echo "configure: can not find sources in ${srcdir}" >&2; exit 1
fi
- exit 1
fi
-# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
-# But we can't avoid them for `..', to make subdirectories work.
-case $srcdir in
- .|/*|~*) ;;
- *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
-esac
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='${CPP}'
+ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS >/dev/null 2>&1'
-# Save the original args to write them into config.status later.
-configure_args="$*"
@@ -130,25 +324,41 @@ 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'`
VERSION="$rev.$vers.$pat"
-echo "this is screen version $VERSION"
+test -n "$silent" || echo "this is screen version $VERSION"
+
+if test -z "$prefix"
+then
+ test -n "$silent" || echo "checking for gzip to derive installation directory prefix"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$IFS:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_dir != . && test -f $ac_dir/gzip; then
+ # Not all systems have dirname.
+ prefix=`echo $ac_dir|sed 's%/[^/][^/]*$%%'`
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -n "$verbose" && echo " chose installation directory prefix ${prefix}"
+fi
if test -z "$CC"; then
# Extract the first word of `gcc', so it can be a program name with args.
- set dummy gcc; word=$2
- echo checking for $word
- IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/$word; then
+ set ac_dummy gcc; ac_word=$2
+ test -n "$silent" || echo "checking for $ac_word"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
CC="gcc"
break
fi
done
- IFS="$saveifs"
+ IFS="$ac_save_ifs"
fi
test -z "$CC" && CC="cc"
-test -n "$CC" -a -n "$verbose" && echo " setting CC to $CC"
+test -n "$CC" && test -n "$verbose" && echo " setting CC to $CC"
# Find out if we are using GNU C, under whatever name.
cat > conftest.c <<EOF
@@ -162,58 +372,83 @@ if egrep yes conftest.out >/dev/null 2>&1; then
fi
rm -f conftest*
-echo checking how to run the C preprocessor
+test -n "$silent" || echo "checking how to run the C preprocessor"
if test -z "$CPP"; then
# This must be in double quotes, not single quotes, because CPP may get
# substituted into the Makefile and ``${CC-cc}'' will simply confuse
# make. It must be expanded now.
CPP="${CC-cc} -E"
- cat > conftest.c <<EOF
+ cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+#include <stdio.h>
+Syntax Error
+EOF
+# Some shells (Coherent) do redirections in the wrong order, so need
+# the parens.
+ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test -z "$ac_err"; then
+ :
+else
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <stdio.h>
Syntax Error
EOF
-err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
-if test -z "$err"; then
+# Some shells (Coherent) do redirections in the wrong order, so need
+# the parens.
+ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test -z "$ac_err"; then
:
else
+ rm -rf conftest*
CPP=/lib/cpp
fi
rm -f conftest*
fi
-test ".${verbose}" != "." && echo " setting CPP to $CPP"
+rm -f conftest*
+fi
+test -n "$verbose" && echo " setting CPP to $CPP"
if test -n "$GCC"; then
- echo checking whether -traditional is needed
- pattern="Autoconf.*'x'"
- prog='#include <sgtty.h>
+ test -n "$silent" || echo "checking whether -traditional is needed"
+ ac_pattern="Autoconf.*'x'"
+ ac_prog='#include <sgtty.h>
Autoconf TIOCGETP'
- cat > conftest.c <<EOF
-$prog
+ cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+$ac_prog
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
-if egrep "$pattern" conftest.out >/dev/null 2>&1; then
- need_trad=1
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
+if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_need_trad=1
+
fi
rm -f conftest*
- if test -z "$need_trad"; then
- prog='#include <termio.h>
+ if test -z "$ac_need_trad"; then
+ ac_prog='#include <termio.h>
Autoconf TCGETA'
- cat > conftest.c <<EOF
-$prog
+ cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+$ac_prog
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
-if egrep "$pattern" conftest.out >/dev/null 2>&1; then
- need_trad=1
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
+if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_need_trad=1
+
fi
rm -f conftest*
fi
- test -n "$need_trad" && CC="$CC -traditional"
+ test -n "$ac_need_trad" && CC="$CC -traditional"
fi
-echo checking for POSIXized ISC
+test -n "$silent" || echo "checking for POSIXized ISC"
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -222,10 +457,11 @@ then
{
test -n "$verbose" && \
echo " defining _POSIX_SOURCE"
+echo "#define" _POSIX_SOURCE "1" >> confdefs.h
DEFS="$DEFS -D_POSIX_SOURCE=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
-\${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
-\${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}_POSIX_SOURCE\${ac_dB}_POSIX_SOURCE\${ac_dC}1\${ac_dD}
+\${ac_uA}_POSIX_SOURCE\${ac_uB}_POSIX_SOURCE\${ac_uC}1\${ac_uD}
+\${ac_eA}_POSIX_SOURCE\${ac_eB}_POSIX_SOURCE\${ac_eC}1\${ac_eD}
"
}
@@ -237,35 +473,53 @@ SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDd
fi
-
-cat > conftest.c <<EOF
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
main(){exit(0);}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
:
else
- echo "Can't run the compiler - sorry";exit
+ echo "configure: Can't run the compiler - sorry" >&2; exit 1
fi
-rm -f conftest*
-for p in mawk gawk nawk awk
+rm -fr conftest*
+
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+main()
+{
+ int __something_strange_();
+ __something_strange_(0);
+}
+
+EOF
+eval $ac_compile
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+ echo "configure: Your compiler does not set the exit status - sorry" >&2; exit 1
+
+fi
+rm -fr conftest*
+
+for ac_prog in mawk gawk nawk awk
do
if test -z "$AWK"; then
- # Extract the first word of `$p', so it can be a program name with args.
- set dummy $p; word=$2
- echo checking for $word
- IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/$word; then
- AWK="$p"
+ # Extract the first word of `$ac_prog', so it can be a program name with args.
+ set ac_dummy $ac_prog; ac_word=$2
+ test -n "$silent" || echo "checking for $ac_word"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ AWK="$ac_prog"
break
fi
done
- IFS="$saveifs"
+ IFS="$ac_save_ifs"
fi
-test -n "$AWK" -a -n "$verbose" && echo " setting AWK to $AWK"
+test -n "$AWK" && test -n "$verbose" && echo " setting AWK to $AWK"
test -n "$AWK" && break
done
@@ -276,40 +530,64 @@ done
# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
# or the AFS install, which mishandles nonexistent args, or
# /usr/ucb/install on SVR4, which tries to use the nonexistent group
-# `staff'. On most BSDish systems install is in /usr/bin, not /usr/ucb
-# anyway. Sigh.
-if test "z${INSTALL}" = "z" ; then
- echo checking for install
- IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- test -z "$dir" && dir=.
- case $dir in
- /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
+# `staff', or /sbin/install on IRIX which has incompatible command-line
+# syntax. Sigh.
+#
+# On most BSDish systems install is in /usr/bin, not /usr/ucb
+# anyway.
+# This turns out not to be true, so the mere pathname isn't an indication
+# of whether the program works. What we really need is a set of tests for
+# the install program to see if it actually works in all the required ways.
+#
+# Avoid using ./install, which might have been erroneously created
+# by make from ./install.sh.
+if test -z "${INSTALL}"; then
+ test -n "$silent" || echo "checking for a BSD compatible install"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ case "$ac_dir" in
+ ''|.|/etc|/sbin|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
*)
- if test -f $dir/installbsd; then
- INSTALL="$dir/installbsd -c" # OSF1
- INSTALL_PROGRAM='$(INSTALL)'
- INSTALL_DATA='$(INSTALL) -m 644'
- break
- fi
- if test -f $dir/install; then
- if grep dspmsg $dir/install >/dev/null 2>&1; then
- : # AIX
- else
- INSTALL="$dir/install -c"
- INSTALL_PROGRAM='$(INSTALL)'
- INSTALL_DATA='$(INSTALL) -m 644'
- break
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ for ac_prog in installbsd scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ # OSF/1 installbsd also uses dspmsg, but is usable.
+ :
+ else
+ INSTALL="$ac_dir/$ac_prog -c"
+ break 2
+ fi
fi
- fi
+ done
;;
esac
done
- IFS="$saveifs"
+ IFS="$ac_save_ifs"
+fi
+
+if test -z "$INSTALL"; then
+ # As a last resort, use the slow shell script.
+ for ac_dir in ${srcdir} ${srcdir}/.. ${srcdir}/../..; do
+ if test -f $ac_dir/install.sh; then
+ INSTALL=$ac_dir/install.sh; break
+ fi
+ done
+fi
+if test -z "$INSTALL"; then
+ echo "configure: can not find install.sh in ${srcdir} or ${srcdir}/.. or ${srcdir}/../.." >&2; exit 1
fi
-INSTALL=${INSTALL-cp}
-INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
-INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
+test -n "$verbose" && echo " setting INSTALL to $INSTALL"
+
+# Use test -z because SunOS4 sh mishandles ${INSTALL_PROGRAM-'${INSTALL}'}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+test -n "$verbose" && echo " setting INSTALL_PROGRAM to $INSTALL_PROGRAM"
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+test -n "$verbose" && echo " setting INSTALL_DATA to $INSTALL_DATA"
if test -n "$ISC"; then
@@ -317,75 +595,67 @@ if test -n "$ISC"; then
{
test -n "$verbose" && \
echo " defining ISC"
+echo "#define" ISC "1" >> confdefs.h
DEFS="$DEFS -DISC=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}ISC\${SEDdB}ISC\${SEDdC}1\${SEDdD}
-\${SEDuA}ISC\${SEDuB}ISC\${SEDuC}1\${SEDuD}
-\${SEDeA}ISC\${SEDeB}ISC\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}ISC\${ac_dB}ISC\${ac_dC}1\${ac_dD}
+\${ac_uA}ISC\${ac_uB}ISC\${ac_uC}1\${ac_uD}
+\${ac_eA}ISC\${ac_eB}ISC\${ac_eC}1\${ac_eD}
"
}
LIBS="$LIBS -linet"
fi
-echo checking for OSF1
-if test -f /bin/uname ; then
-if test `/bin/uname` = OSF1 || test -f /osf_boot; then
-
-{
-test -n "$verbose" && \
-echo " defining OSF1"
-DEFS="$DEFS -DOSF1=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}OSF1\${SEDdB}OSF1\${SEDdC}1\${SEDdD}
-\${SEDuA}OSF1\${SEDuB}OSF1\${SEDuC}1\${SEDuD}
-\${SEDeA}OSF1\${SEDeB}OSF1\${SEDeC}1\${SEDeD}
-"
-}
- # this disables MIPS again....
-fi
-fi
-echo checking for MIPS
+test -n "$silent" || echo "checking for MIPS"
if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
-LIBS="$LIBS -lmld" # for nlist.
+test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
if test -r /dev/ptc; then
{
test -n "$verbose" && \
echo " defining MIPS"
+echo "#define" MIPS "1" >> confdefs.h
DEFS="$DEFS -DMIPS=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}MIPS\${SEDdB}MIPS\${SEDdC}1\${SEDdD}
-\${SEDuA}MIPS\${SEDuB}MIPS\${SEDuC}1\${SEDuD}
-\${SEDeA}MIPS\${SEDeB}MIPS\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}MIPS\${ac_dB}MIPS\${ac_dC}1\${ac_dD}
+\${ac_uA}MIPS\${ac_uB}MIPS\${ac_uC}1\${ac_uD}
+\${ac_eA}MIPS\${ac_eB}MIPS\${ac_eC}1\${ac_eD}
"
}
-echo checking for wait3
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for wait3"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { wait3(); }
+int main() { return 0; }
+int t() { wait3();; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
- echo checking for wait2
-cat > conftest.c <<EOF
+ rm -rf conftest*
+ test -n "$silent" || echo "checking for wait2"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { wait2(); }
+int main() { return 0; }
+int t() { wait2();; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining USE_WAIT2"
+echo "#define" USE_WAIT2 "1" >> confdefs.h
DEFS="$DEFS -DUSE_WAIT2=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}USE_WAIT2\${SEDdB}USE_WAIT2\${SEDdC}1\${SEDdD}
-\${SEDuA}USE_WAIT2\${SEDuB}USE_WAIT2\${SEDuC}1\${SEDuD}
-\${SEDeA}USE_WAIT2\${SEDeB}USE_WAIT2\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}USE_WAIT2\${ac_dB}USE_WAIT2\${ac_dC}1\${ac_dD}
+\${ac_uA}USE_WAIT2\${ac_uB}USE_WAIT2\${ac_uC}1\${ac_uD}
+\${ac_eA}USE_WAIT2\${ac_eB}USE_WAIT2\${ac_eC}1\${ac_eD}
"
}
LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
+
fi
rm -f conftest*
@@ -395,30 +665,69 @@ rm -f conftest*
fi
fi
-echo checking for Ultrix
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for Ultrix"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#if defined(ultrix) || defined(__ultrix)
yes
#endif
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
ULTRIX=1
+
fi
rm -f conftest*
-echo checking for butterfly
-cat > conftest.c <<EOF
+if test -f /usr/lib/libpyr.a ; then
+oldlibs="$LIBS"
+LIBS="$LIBS -lpyr"
+test -n "$silent" || echo "checking for Pyramid OSX"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { open_controlling_pty("");; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
+
+{
+test -n "$verbose" && \
+echo " defining OSX"
+echo "#define" OSX "1" >> confdefs.h
+DEFS="$DEFS -DOSX=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}OSX\${ac_dB}OSX\${ac_dC}1\${ac_dD}
+\${ac_uA}OSX\${ac_uB}OSX\${ac_uC}1\${ac_uD}
+\${ac_eA}OSX\${ac_eB}OSX\${ac_eC}1\${ac_eD}
+"
+}
+
+
+else
+ rm -rf conftest*
+ LIBS="oldlibs"
+fi
+rm -f conftest*
+
+fi
+
+test -n "$silent" || echo "checking for butterfly"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#if defined(butterfly)
yes
#endif
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
butterfly=1
+
fi
rm -f conftest*
@@ -427,8 +736,9 @@ if test -z "$butterfly"; then
if test -n "$ULTRIX"; then
test -z "$GCC" && CC="$CC -YBSD"
fi
-echo checking for POSIX.1
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for POSIX.1"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <unistd.h>
main () {
@@ -437,43 +747,49 @@ main () {
#endif
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
- echo "- you have a POSIX system";
+ rm -rf conftest*
+ test -n "$silent" || echo "- you have a POSIX system"
{
test -n "$verbose" && \
echo " defining POSIX"
+echo "#define" POSIX "1" >> confdefs.h
DEFS="$DEFS -DPOSIX=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}POSIX\${SEDdB}POSIX\${SEDdC}1\${SEDdD}
-\${SEDuA}POSIX\${SEDuB}POSIX\${SEDuC}1\${SEDuD}
-\${SEDeA}POSIX\${SEDeB}POSIX\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}POSIX\${ac_dB}POSIX\${ac_dC}1\${ac_dD}
+\${ac_uA}POSIX\${ac_uB}POSIX\${ac_uC}1\${ac_uD}
+\${ac_eA}POSIX\${ac_eB}POSIX\${ac_eC}1\${ac_eD}
"
}
+ posix=1
fi
rm -f conftest*
fi
-echo checking for System V
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for System V"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
-int main() { exit(0); }
-int t() { int x = SIGCHLD | FNDELAY; }
+int main() { return 0; }
+int t() { int x = SIGCHLD | FNDELAY;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining SYSV"
+echo "#define" SYSV "1" >> confdefs.h
DEFS="$DEFS -DSYSV=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SYSV\${SEDdB}SYSV\${SEDdC}1\${SEDdD}
-\${SEDuA}SYSV\${SEDuB}SYSV\${SEDuC}1\${SEDuD}
-\${SEDeA}SYSV\${SEDeB}SYSV\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SYSV\${ac_dB}SYSV\${ac_dC}1\${ac_dD}
+\${ac_uA}SYSV\${ac_uB}SYSV\${ac_uC}1\${ac_uD}
+\${ac_eA}SYSV\${ac_eB}SYSV\${ac_eC}1\${ac_eD}
"
}
@@ -481,172 +797,129 @@ fi
rm -f conftest*
-echo checking for sequent/ptx
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for sequent/ptx"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#ifdef _SEQUENT_
yes
#endif
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
LIBS="$LIBS -lsocket -linet";seqptx=1
+
fi
rm -f conftest*
oldlibs="$LIBS"
LIBS="$LIBS -lelf"
-echo checking for SVR4
-cat > conftest.c <<EOF
-
-int main() { exit(0); }
-int t() { }
-EOF
-if eval $compile; then
- echo checking for dwarf.h
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for SVR4"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { ; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
+ test -n "$silent" || echo "checking for dwarf.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <dwarf.h>
EOF
-err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
-if test -z "$err"; then
+# Some shells (Coherent) do redirections in the wrong order, so need
+# the parens.
+ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining SVR4"
+echo "#define" SVR4 "1" >> confdefs.h
DEFS="$DEFS -DSVR4=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
-\${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
-\${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SVR4\${ac_dB}SVR4\${ac_dC}1\${ac_dD}
+\${ac_uA}SVR4\${ac_uB}SVR4\${ac_uC}1\${ac_uD}
+\${ac_eA}SVR4\${ac_eB}SVR4\${ac_eC}1\${ac_eD}
"
}
{
test -n "$verbose" && \
echo " defining BUGGYGETLOGIN"
+echo "#define" BUGGYGETLOGIN "1" >> confdefs.h
DEFS="$DEFS -DBUGGYGETLOGIN=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}BUGGYGETLOGIN\${SEDdB}BUGGYGETLOGIN\${SEDdC}1\${SEDdD}
-\${SEDuA}BUGGYGETLOGIN\${SEDuB}BUGGYGETLOGIN\${SEDuC}1\${SEDuD}
-\${SEDeA}BUGGYGETLOGIN\${SEDeB}BUGGYGETLOGIN\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}BUGGYGETLOGIN\${ac_dB}BUGGYGETLOGIN\${ac_dC}1\${ac_dD}
+\${ac_uA}BUGGYGETLOGIN\${ac_uB}BUGGYGETLOGIN\${ac_uC}1\${ac_uD}
+\${ac_eA}BUGGYGETLOGIN\${ac_eB}BUGGYGETLOGIN\${ac_eC}1\${ac_eD}
"
}
+
else
- echo checking for elf.h
-cat > conftest.c <<EOF
+ rm -rf conftest*
+ test -n "$silent" || echo "checking for elf.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <elf.h>
EOF
-err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
-if test -z "$err"; then
+# Some shells (Coherent) do redirections in the wrong order, so need
+# the parens.
+ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining SVR4"
+echo "#define" SVR4 "1" >> confdefs.h
DEFS="$DEFS -DSVR4=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
-\${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
-\${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SVR4\${ac_dB}SVR4\${ac_dC}1\${ac_dD}
+\${ac_uA}SVR4\${ac_uB}SVR4\${ac_uC}1\${ac_uD}
+\${ac_eA}SVR4\${ac_eB}SVR4\${ac_eC}1\${ac_eD}
"
}
{
test -n "$verbose" && \
echo " defining BUGGYGETLOGIN"
+echo "#define" BUGGYGETLOGIN "1" >> confdefs.h
DEFS="$DEFS -DBUGGYGETLOGIN=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}BUGGYGETLOGIN\${SEDdB}BUGGYGETLOGIN\${SEDdC}1\${SEDdD}
-\${SEDuA}BUGGYGETLOGIN\${SEDuB}BUGGYGETLOGIN\${SEDuC}1\${SEDuD}
-\${SEDeA}BUGGYGETLOGIN\${SEDeB}BUGGYGETLOGIN\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}BUGGYGETLOGIN\${ac_dB}BUGGYGETLOGIN\${ac_dC}1\${ac_dD}
+\${ac_uA}BUGGYGETLOGIN\${ac_uB}BUGGYGETLOGIN\${ac_uC}1\${ac_uD}
+\${ac_eA}BUGGYGETLOGIN\${ac_eB}BUGGYGETLOGIN\${ac_eC}1\${ac_eD}
"
}
-fi
-rm -f conftest*
fi
rm -f conftest*
-
-else
- LIBS="$oldlibs"
-fi
-rm -f conftest*
-
-
-
-echo checking for pid_t
-cat > conftest.c <<EOF
-#include <sys/types.h>
-
-EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
-if egrep "pid_t" conftest.out >/dev/null 2>&1; then
-
-{
-test -n "$verbose" && \
-echo " defining PID_T_DEFINED"
-DEFS="$DEFS -DPID_T_DEFINED=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}PID_T_DEFINED\${SEDdB}PID_T_DEFINED\${SEDdC}1\${SEDdD}
-\${SEDuA}PID_T_DEFINED\${SEDuB}PID_T_DEFINED\${SEDuC}1\${SEDuD}
-\${SEDeA}PID_T_DEFINED\${SEDeB}PID_T_DEFINED\${SEDeC}1\${SEDeD}
-"
-}
-
fi
rm -f conftest*
-echo checking for sig_t
-cat > conftest.c <<EOF
-#include <sys/types.h>
-#include <signal.h>
-
-EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
-if egrep "sig_t" conftest.out >/dev/null 2>&1; then
-
-{
-test -n "$verbose" && \
-echo " defining SIG_T_DEFINED"
-DEFS="$DEFS -DSIG_T_DEFINED=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SIG_T_DEFINED\${SEDdB}SIG_T_DEFINED\${SEDdC}1\${SEDdD}
-\${SEDuA}SIG_T_DEFINED\${SEDuB}SIG_T_DEFINED\${SEDuC}1\${SEDuD}
-\${SEDeA}SIG_T_DEFINED\${SEDeB}SIG_T_DEFINED\${SEDeC}1\${SEDeD}
-"
-}
+else
+ rm -rf conftest*
+ LIBS="$oldlibs"
fi
rm -f conftest*
-echo checking for uid_t
-cat > conftest.c <<EOF
-#include <sys/types.h>
-
-EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
-if egrep "uid_t" conftest.out >/dev/null 2>&1; then
-
-{
-test -n "$verbose" && \
-echo " defining UID_T_DEFINED"
-DEFS="$DEFS -DUID_T_DEFINED=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}UID_T_DEFINED\${SEDdB}UID_T_DEFINED\${SEDdC}1\${SEDdD}
-\${SEDuA}UID_T_DEFINED\${SEDuB}UID_T_DEFINED\${SEDuC}1\${SEDuD}
-\${SEDeA}UID_T_DEFINED\${SEDeB}UID_T_DEFINED\${SEDeC}1\${SEDeD}
-"
-}
-
-fi
-rm -f conftest*
-echo checking for BSD job control
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for BSD job control"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
-int main() { exit(0); }
+int main() { return 0; }
int t() {
#ifdef POSIX
tcsetpgrp(0, 0);
@@ -658,78 +931,118 @@ setpgrp();
int y = TIOCNOTTY;
#endif
#endif
- }
+; return 0; }
EOF
-if eval $compile; then
- echo "- you have jobcontrol"
+if eval $ac_compile; then
+ rm -rf conftest*
+ test -n "$silent" || echo "- you have jobcontrol"
{
test -n "$verbose" && \
echo " defining BSDJOBS"
+echo "#define" BSDJOBS "1" >> confdefs.h
DEFS="$DEFS -DBSDJOBS=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}BSDJOBS\${SEDdB}BSDJOBS\${SEDdC}1\${SEDdD}
-\${SEDuA}BSDJOBS\${SEDuB}BSDJOBS\${SEDuC}1\${SEDuD}
-\${SEDeA}BSDJOBS\${SEDeB}BSDJOBS\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}BSDJOBS\${ac_dB}BSDJOBS\${ac_dC}1\${ac_dD}
+\${ac_uA}BSDJOBS\${ac_uB}BSDJOBS\${ac_uC}1\${ac_uD}
+\${ac_eA}BSDJOBS\${ac_eB}BSDJOBS\${ac_eC}1\${ac_eD}
"
}
+
else
- echo "- you don't have jobcontrol"
+ rm -rf conftest*
+ test -n "$silent" || echo "- you don't have jobcontrol"
fi
rm -f conftest*
-echo checking for setreuid
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for setreuid"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
+int main() { return 0; }
int t() {
-#ifdef hpux
+#ifdef __hpux
setresuid(0, 0, 0);
#else
setreuid(0, 0);
#endif
- }
+; return 0; }
EOF
-if eval $compile; then
- :
-else
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
-echo " defining NOREUID"
-DEFS="$DEFS -DNOREUID=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NOREUID\${SEDdB}NOREUID\${SEDdC}1\${SEDdD}
-\${SEDuA}NOREUID\${SEDuB}NOREUID\${SEDuC}1\${SEDuD}
-\${SEDeA}NOREUID\${SEDeB}NOREUID\${SEDeC}1\${SEDeD}
+echo " defining HAVE_SETREUID"
+echo "#define" HAVE_SETREUID "1" >> confdefs.h
+DEFS="$DEFS -DHAVE_SETREUID=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_SETREUID\${ac_dB}HAVE_SETREUID\${ac_dC}1\${ac_dD}
+\${ac_uA}HAVE_SETREUID\${ac_uB}HAVE_SETREUID\${ac_uC}1\${ac_uD}
+\${ac_eA}HAVE_SETREUID\${ac_eB}HAVE_SETREUID\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
+test -n "$silent" || echo "checking for seteuid"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() {
+#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4))
+seteuid_is_broken(0);
+#else
+seteuid(0);
+#endif
+; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
+
+{
+test -n "$verbose" && \
+echo " defining HAVE_SETEUID"
+echo "#define" HAVE_SETEUID "1" >> confdefs.h
+DEFS="$DEFS -DHAVE_SETEUID=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_SETEUID\${ac_dB}HAVE_SETEUID\${ac_dC}1\${ac_dD}
+\${ac_uA}HAVE_SETEUID\${ac_uB}HAVE_SETEUID\${ac_uC}1\${ac_uD}
+\${ac_eA}HAVE_SETEUID\${ac_eB}HAVE_SETEUID\${ac_eC}1\${ac_eD}
+"
+}
+
+fi
+rm -f conftest*
-echo checking for select
-cat > conftest.c <<EOF
-int main() { exit(0); }
-int t() { select(0, 0, 0, 0, 0); }
+test -n "$silent" || echo "checking for select"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { select(0, 0, 0, 0, 0);; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
+ rm -rf conftest*
LIBS="$LIBS -lnet -lnsl"
-echo checking for select with $LIBS
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for select with $LIBS"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { select(0, 0, 0, 0, 0); }
+int main() { return 0; }
+int t() { select(0, 0, 0, 0, 0);; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
- echo '!!! no select - no screen';exit
+ rm -rf conftest*
+ echo "configure: !!! no select - no screen" >&2; exit 1
fi
rm -f conftest*
@@ -738,15 +1051,16 @@ fi
rm -f conftest*
-echo checking fifos
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking fifos"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
#endif
#ifndef S_IFIFO
#define S_IFIFO 0010000
@@ -760,15 +1074,37 @@ main()
int f;
(void)alarm(5);
+#ifdef POSIX
+ if (mkfifo(fin, 0777))
+#else
if (mknod(fin, S_IFIFO|0777, 0))
+#endif
exit(1);
if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
exit(1);
close(0);
- if (open(fin, O_RDWR | O_NDELAY))
- exit(1);
- if (write(0, "TEST", 4) == -1)
+#ifdef __386BSD__
+ /*
+ * The next test fails under 386BSD, but screen works using fifos.
+ * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
+ * the select() configuration test.
+ */
+ exit(0);
+#endif
+ if (open(fin, O_RDONLY | O_NONBLOCK))
exit(1);
+ if (fork() == 0)
+ {
+ close(0);
+ if (open(fin, O_WRONLY | O_NONBLOCK))
+ exit(1);
+ close(0);
+ if (open(fin, O_WRONLY | O_NONBLOCK))
+ exit(1);
+ if (write(0, "TEST", 4) == -1)
+ exit(1);
+ exit(0);
+ }
f = 1;
if (select(1, &f, 0, 0, 0) == -1)
exit(1);
@@ -776,26 +1112,28 @@ main()
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
- echo "- your fifos are usable"; fifo=1
+ test -n "$silent" || echo "- your fifos are usable";fifo=1
+
else
- echo "- your fifos are not usable"
+ test -n "$silent" || echo "- your fifos are not usable"
fi
-rm -f conftest*
+rm -fr conftest*
rm -f /tmp/conftest*
if test -n "$fifo"; then
-echo "checking for broken fifo implementation"
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for broken fifo implementation"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/stat.h>
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
#endif
#ifndef S_IFIFO
#define S_IFIFO 0010000
@@ -808,10 +1146,14 @@ main()
struct timeval tv;
int r, x;
+#ifdef POSIX
+ if (mkfifo(fin, 0600))
+#else
if (mknod(fin, S_IFIFO|0600, 0))
+#endif
exit(1);
close(0);
- if (open(fin, O_RDONLY|O_NDELAY))
+ if (open(fin, O_RDONLY|O_NONBLOCK))
exit(1);
r = 1;
tv.tv_sec = 1;
@@ -822,42 +1164,38 @@ main()
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
- echo "- your implementation is ok"
+ test -n "$silent" || echo "- your implementation is ok"
+
else
- echo "- you have a broken implementation"
+ test -n "$silent" || echo "- you have a broken implementation"
{
test -n "$verbose" && \
echo " defining BROKEN_PIPE"
+echo "#define" BROKEN_PIPE "1" >> confdefs.h
DEFS="$DEFS -DBROKEN_PIPE=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}BROKEN_PIPE\${SEDdB}BROKEN_PIPE\${SEDdC}1\${SEDdD}
-\${SEDuA}BROKEN_PIPE\${SEDuB}BROKEN_PIPE\${SEDuC}1\${SEDuD}
-\${SEDeA}BROKEN_PIPE\${SEDeB}BROKEN_PIPE\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}BROKEN_PIPE\${ac_dB}BROKEN_PIPE\${ac_dC}1\${ac_dD}
+\${ac_uA}BROKEN_PIPE\${ac_uB}BROKEN_PIPE\${ac_uC}1\${ac_uD}
+\${ac_eA}BROKEN_PIPE\${ac_eB}BROKEN_PIPE\${ac_eC}1\${ac_eD}
"
}
fifobr=1
fi
-rm -f conftest*
+rm -fr conftest*
rm -f /tmp/conftest*
fi
-echo checking sockets
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking sockets"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <fcntl.h>
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
-#endif
-#ifndef FNDELAY
-#define FNDELAY O_NDELAY
-#endif
-
char *son = "/tmp/conftest$$";
main()
@@ -895,18 +1233,20 @@ main()
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
- echo "- your sockets are usable"; sock=1
+ test -n "$silent" || echo "- your sockets are usable";sock=1
+
else
- echo "- your sockets are not usable"
+ test -n "$silent" || echo "- your sockets are not usable"
fi
-rm -f conftest*
+rm -fr conftest*
rm -f /tmp/conftest*
if test -n "$sock"; then
-echo "checking socket implementation"
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking socket implementation"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -934,24 +1274,26 @@ main()
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
- echo "- you are normal"
+ test -n "$silent" || echo "- you are normal"
+
else
- echo "- unix domain sockets are not kept in the filesystem"
+ test -n "$silent" || echo "- unix domain sockets are not kept in the filesystem"
{
test -n "$verbose" && \
echo " defining SOCK_NOT_IN_FS"
+echo "#define" SOCK_NOT_IN_FS "1" >> confdefs.h
DEFS="$DEFS -DSOCK_NOT_IN_FS=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SOCK_NOT_IN_FS\${SEDdB}SOCK_NOT_IN_FS\${SEDdC}1\${SEDdD}
-\${SEDuA}SOCK_NOT_IN_FS\${SEDuB}SOCK_NOT_IN_FS\${SEDuC}1\${SEDuD}
-\${SEDeA}SOCK_NOT_IN_FS\${SEDeB}SOCK_NOT_IN_FS\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SOCK_NOT_IN_FS\${ac_dB}SOCK_NOT_IN_FS\${ac_dC}1\${ac_dD}
+\${ac_uA}SOCK_NOT_IN_FS\${ac_uB}SOCK_NOT_IN_FS\${ac_uC}1\${ac_uD}
+\${ac_eA}SOCK_NOT_IN_FS\${ac_eB}SOCK_NOT_IN_FS\${ac_eC}1\${ac_eD}
"
}
socknofs=1
fi
-rm -f conftest*
+rm -fr conftest*
rm -f /tmp/conftest*
fi
@@ -959,58 +1301,61 @@ fi
if test -n "$fifo"; then
if test -n "$sock"; then
if test -n "$nore"; then
- echo "- hmmm... better take the fifos"
+ test -n "$silent" || echo "- hmmm... better take the fifos"
{
test -n "$verbose" && \
echo " defining NAMEDPIPE"
+echo "#define" NAMEDPIPE "1" >> confdefs.h
DEFS="$DEFS -DNAMEDPIPE=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NAMEDPIPE\${SEDdB}NAMEDPIPE\${SEDdC}1\${SEDdD}
-\${SEDuA}NAMEDPIPE\${SEDuB}NAMEDPIPE\${SEDuC}1\${SEDuD}
-\${SEDeA}NAMEDPIPE\${SEDeB}NAMEDPIPE\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NAMEDPIPE\${ac_dB}NAMEDPIPE\${ac_dC}1\${ac_dD}
+\${ac_uA}NAMEDPIPE\${ac_uB}NAMEDPIPE\${ac_uC}1\${ac_uD}
+\${ac_eA}NAMEDPIPE\${ac_eB}NAMEDPIPE\${ac_eC}1\${ac_eD}
"
}
elif test -n "$fifobr"; then
- echo "- as your fifos are broken lets use the sockets."
+ test -n "$silent" || echo "- as your fifos are broken lets use the sockets."
else
- echo "- both sockets and fifos usable. let's take fifos."
+ test -n "$silent" || echo "- both sockets and fifos usable. let's take fifos."
{
test -n "$verbose" && \
echo " defining NAMEDPIPE"
+echo "#define" NAMEDPIPE "1" >> confdefs.h
DEFS="$DEFS -DNAMEDPIPE=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NAMEDPIPE\${SEDdB}NAMEDPIPE\${SEDdC}1\${SEDdD}
-\${SEDuA}NAMEDPIPE\${SEDuB}NAMEDPIPE\${SEDuC}1\${SEDuD}
-\${SEDeA}NAMEDPIPE\${SEDeB}NAMEDPIPE\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NAMEDPIPE\${ac_dB}NAMEDPIPE\${ac_dC}1\${ac_dD}
+\${ac_uA}NAMEDPIPE\${ac_uB}NAMEDPIPE\${ac_uC}1\${ac_uD}
+\${ac_eA}NAMEDPIPE\${ac_eB}NAMEDPIPE\${ac_eC}1\${ac_eD}
"
}
fi
else
- echo "- using named pipes, of course"
+ test -n "$silent" || echo "- using named pipes"
{
test -n "$verbose" && \
echo " defining NAMEDPIPE"
+echo "#define" NAMEDPIPE "1" >> confdefs.h
DEFS="$DEFS -DNAMEDPIPE=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NAMEDPIPE\${SEDdB}NAMEDPIPE\${SEDdC}1\${SEDdD}
-\${SEDuA}NAMEDPIPE\${SEDuB}NAMEDPIPE\${SEDuC}1\${SEDuD}
-\${SEDeA}NAMEDPIPE\${SEDeB}NAMEDPIPE\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NAMEDPIPE\${ac_dB}NAMEDPIPE\${ac_dC}1\${ac_dD}
+\${ac_uA}NAMEDPIPE\${ac_uB}NAMEDPIPE\${ac_uC}1\${ac_uD}
+\${ac_eA}NAMEDPIPE\${ac_eB}NAMEDPIPE\${ac_eC}1\${ac_eD}
"
}
fi
elif test -n "$sock"; then
- echo "- using unix-domain sockets, of course"
+ test -n "$silent" || echo "- using unix-domain sockets"
else
- echo "!!! you have neither usable sockets nor usable pipes -> no screen"
- exit
+ echo "configure: you have neither usable sockets nor usable pipes -> no screen" >&2; exit 1
fi
-echo "checking select return value"
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking select return value"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -1020,8 +1365,8 @@ char *nam = "/tmp/conftest$$";
#ifdef NAMEDPIPE
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
#endif
#ifndef S_IFIFO
#define S_IFIFO 0010000
@@ -1032,11 +1377,22 @@ main()
{
int l;
+#ifdef __FreeBSD__
+/* From Andrew A. Chernov (ache@astral.msk.su):
+ * opening RDWR fifo fails in BSD 4.4, but select return values is
+ * right.
+ */
+ exit(0);
+#endif
(void)alarm(5);
+#ifdef POSIX
+ if (mkfifo(nam, 0777))
+#else
if (mknod(nam, S_IFIFO|0777, 0))
+#endif
exit(1);
close(0);
- if (open(nam, O_RDWR | O_NDELAY))
+ if (open(nam, O_RDWR | O_NONBLOCK))
exit(1);
if (write(0, "TEST", 4) == -1)
exit(1);
@@ -1087,104 +1443,122 @@ main()
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
- echo "- select is ok"
-else
- echo "- it is not usable"
+ test -n "$silent" || echo "- select is ok"
+else
+ test -n "$silent" || echo "- it is not usable"
{
test -n "$verbose" && \
echo " defining SELECT_BROKEN"
+echo "#define" SELECT_BROKEN "1" >> confdefs.h
DEFS="$DEFS -DSELECT_BROKEN=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_BROKEN\${SEDdB}SELECT_BROKEN\${SEDdC}1\${SEDdD}
-\${SEDuA}SELECT_BROKEN\${SEDuB}SELECT_BROKEN\${SEDuC}1\${SEDuD}
-\${SEDeA}SELECT_BROKEN\${SEDeB}SELECT_BROKEN\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SELECT_BROKEN\${ac_dB}SELECT_BROKEN\${ac_dC}1\${ac_dD}
+\${ac_uA}SELECT_BROKEN\${ac_uB}SELECT_BROKEN\${ac_uC}1\${ac_uD}
+\${ac_eA}SELECT_BROKEN\${ac_eB}SELECT_BROKEN\${ac_eC}1\${ac_eD}
"
}
fi
-rm -f conftest*
+rm -fr conftest*
-echo searching for tgetent
+test -n "$silent" || echo "checking for tgetent"
olibs="$LIBS"
-LIBS="-ltermcap $LIBS"
-echo checking for libtermcap
-cat > conftest.c <<EOF
+LIBS="-lcurses $olibs"
+test -n "$silent" || echo "checking for libcurses"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { tgetent((char *)0, (char *)0); }
+int main() { return 0; }
+int t() { tgetent((char *)0, (char *)0);; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
- LIBS="-lcurses $olibs"
-echo checking for libcurses
-cat > conftest.c <<EOF
+ rm -rf conftest*
+ LIBS="-ltermcap $olibs"
+test -n "$silent" || echo "checking for libtermcap"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { tgetent((char *)0, (char *)0);; return 0; }
+EOF
+if eval $ac_compile; then
+ :
+else
+ rm -rf conftest*
+ LIBS="-ltermlib $olibs"
+test -n "$silent" || echo "checking for libtermlib"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { tgetent((char *)0, (char *)0); }
+int main() { return 0; }
+int t() { tgetent((char *)0, (char *)0);; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
- echo "!!! no tgetent - no screen";exit
+ rm -rf conftest*
+ echo "configure: !!! no tgetent - no screen" >&2; exit 1
fi
rm -f conftest*
+fi
+rm -f conftest*
fi
rm -f conftest*
-TERMCAP="xx|scrdumm:xx:"
-TERM=scrdumm
-export TERMCAP
-export TERM
-cat > conftest.c <<EOF
+
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
main()
{
- char buf[1024];
- if (tgetent(buf, "scrdumm") != 1)
- exit(1);
- exit(0);
+ exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
- echo "- you use the termcap database"
-else
- echo "- you use the terminfo database"
+ test -n "$silent" || echo "- you use the termcap database"
+else
+ test -n "$silent" || echo "- you use the terminfo database"
{
test -n "$verbose" && \
echo " defining TERMINFO"
+echo "#define" TERMINFO "1" >> confdefs.h
DEFS="$DEFS -DTERMINFO=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}TERMINFO\${SEDdB}TERMINFO\${SEDdC}1\${SEDdD}
-\${SEDuA}TERMINFO\${SEDuB}TERMINFO\${SEDuC}1\${SEDuD}
-\${SEDeA}TERMINFO\${SEDeB}TERMINFO\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}TERMINFO\${ac_dB}TERMINFO\${ac_dC}1\${ac_dD}
+\${ac_uA}TERMINFO\${ac_uB}TERMINFO\${ac_uC}1\${ac_uD}
+\${ac_eA}TERMINFO\${ac_eB}TERMINFO\${ac_eC}1\${ac_eD}
"
}
fi
-rm -f conftest*
-echo checking for ospeed
-cat > conftest.c <<EOF
+rm -fr conftest*
+test -n "$silent" || echo "checking for ospeed"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
extern short ospeed;
-int main() { exit(0); }
-int t() { ospeed=5; }
+int main() { return 0; }
+int t() { ospeed=5;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining NEED_OSPEED"
+echo "#define" NEED_OSPEED "1" >> confdefs.h
DEFS="$DEFS -DNEED_OSPEED=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NEED_OSPEED\${SEDdB}NEED_OSPEED\${SEDdC}1\${SEDdD}
-\${SEDuA}NEED_OSPEED\${SEDuB}NEED_OSPEED\${SEDuC}1\${SEDuD}
-\${SEDeA}NEED_OSPEED\${SEDeB}NEED_OSPEED\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NEED_OSPEED\${ac_dB}NEED_OSPEED\${ac_dC}1\${ac_dD}
+\${ac_uA}NEED_OSPEED\${ac_uB}NEED_OSPEED\${ac_uC}1\${ac_uD}
+\${ac_eA}NEED_OSPEED\${ac_eB}NEED_OSPEED\${ac_eC}1\${ac_eD}
"
}
@@ -1192,7 +1566,23 @@ fi
rm -f conftest*
-echo checking for ptyranges
+test -n "$silent" || echo "checking for /dev/ptc"
+if test -r /dev/ptc; then
+
+{
+test -n "$verbose" && \
+echo " defining HAVE_DEV_PTC"
+echo "#define" HAVE_DEV_PTC "1" >> confdefs.h
+DEFS="$DEFS -DHAVE_DEV_PTC=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_DEV_PTC\${ac_dB}HAVE_DEV_PTC\${ac_dC}1\${ac_dD}
+\${ac_uA}HAVE_DEV_PTC\${ac_uB}HAVE_DEV_PTC\${ac_uC}1\${ac_uD}
+\${ac_eA}HAVE_DEV_PTC\${ac_eB}HAVE_DEV_PTC\${ac_eC}1\${ac_eD}
+"
+}
+
+fi
+
+test -n "$silent" || echo "checking for ptyranges"
if test -d /dev/ptym ; then
pdir='/dev/ptym'
else
@@ -1200,200 +1590,341 @@ pdir='/dev'
fi
ptys=`echo $pdir/pty??`
if test "$ptys" != "$pdir/pty??" ; then
-p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | tr ' ' '\012' | sort -u | sed -n -e H -e g -e 's/\n//g' -e '$p'`
-p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | tr ' ' '\012' | sort -u | sed -n -e H -e g -e 's/\n//g' -e '$p'`
+p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
+p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
{
test -n "$verbose" && \
-echo " defining PTYRANGE0 to be \"$p0\""
+echo " defining" PTYRANGE0 to be "\"$p0\""
+echo "#define" PTYRANGE0 "\"$p0\"" >> confdefs.h
DEFS="$DEFS -DPTYRANGE0=\"$p0\""
-SEDDEFS="${SEDDEFS}\${SEDdA}PTYRANGE0\${SEDdB}PTYRANGE0\${SEDdC}\"$p0\"\${SEDdD}
-\${SEDuA}PTYRANGE0\${SEDuB}PTYRANGE0\${SEDuC}\"$p0\"\${SEDuD}
-\${SEDeA}PTYRANGE0\${SEDeB}PTYRANGE0\${SEDeC}\"$p0\"\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}PTYRANGE0\${ac_dB}PTYRANGE0\${ac_dC}\"$p0\"\${ac_dD}
+\${ac_uA}PTYRANGE0\${ac_uB}PTYRANGE0\${ac_uC}\"$p0\"\${ac_uD}
+\${ac_eA}PTYRANGE0\${ac_eB}PTYRANGE0\${ac_eC}\"$p0\"\${ac_eD}
"
}
{
test -n "$verbose" && \
-echo " defining PTYRANGE1 to be \"$p1\""
+echo " defining" PTYRANGE1 to be "\"$p1\""
+echo "#define" PTYRANGE1 "\"$p1\"" >> confdefs.h
DEFS="$DEFS -DPTYRANGE1=\"$p1\""
-SEDDEFS="${SEDDEFS}\${SEDdA}PTYRANGE1\${SEDdB}PTYRANGE1\${SEDdC}\"$p1\"\${SEDdD}
-\${SEDuA}PTYRANGE1\${SEDuB}PTYRANGE1\${SEDuC}\"$p1\"\${SEDuD}
-\${SEDeA}PTYRANGE1\${SEDeB}PTYRANGE1\${SEDeC}\"$p1\"\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}PTYRANGE1\${ac_dB}PTYRANGE1\${ac_dC}\"$p1\"\${ac_dD}
+\${ac_uA}PTYRANGE1\${ac_uB}PTYRANGE1\${ac_uC}\"$p1\"\${ac_uD}
+\${ac_eA}PTYRANGE1\${ac_eB}PTYRANGE1\${ac_eC}\"$p1\"\${ac_eD}
"
}
fi
+test -n "$silent" || echo "checking default tty permissions/group"
+rm -f conftest_grp
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-echo checking for getutent
-cat > conftest.c <<EOF
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+main()
+{
+ struct stat sb;
+ char *x,*ttyname();
+ int om, m;
+ FILE *fp;
+
+ if (!(x = ttyname(0))) exit(1);
+ if (stat(x, &sb)) exit(1);
+ om = sb.st_mode;
+ if (om & 002) exit(0);
+ m = system("mesg y");
+ if (m == -1 || m == 127) exit(1);
+ if (stat(x, &sb)) exit(1);
+ m = sb.st_mode;
+ if (chmod(x, om)) exit(1);
+ if (m & 002) exit(0);
+ if (sb.st_gid == getgid()) exit(1);
+ if (!(fp=fopen("conftest_grp", "w")))
+ exit(1);
+ fprintf(fp, "%d\n", sb.st_gid);
+ fclose(fp);
+ exit(0);
+}
+
+EOF
+eval $ac_compile
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+
+ if test -f conftest_grp; then
+ ptygrp=`cat conftest_grp`
+ test -n "$silent" || echo "- pty mode: 0620"
+
+{
+test -n "$verbose" && \
+echo " defining" PTYMODE to be "0620"
+echo "#define" PTYMODE "0620" >> confdefs.h
+DEFS="$DEFS -DPTYMODE=0620"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}PTYMODE\${ac_dB}PTYMODE\${ac_dC}0620\${ac_dD}
+\${ac_uA}PTYMODE\${ac_uB}PTYMODE\${ac_uC}0620\${ac_uD}
+\${ac_eA}PTYMODE\${ac_eB}PTYMODE\${ac_eC}0620\${ac_eD}
+"
+}
+
+
+{
+test -n "$verbose" && \
+echo " defining" PTYGROUP to be "$ptygrp"
+echo "#define" PTYGROUP "$ptygrp" >> confdefs.h
+DEFS="$DEFS -DPTYGROUP=$ptygrp"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}PTYGROUP\${ac_dB}PTYGROUP\${ac_dC}$ptygrp\${ac_dD}
+\${ac_uA}PTYGROUP\${ac_uB}PTYGROUP\${ac_uC}$ptygrp\${ac_uD}
+\${ac_eA}PTYGROUP\${ac_eB}PTYGROUP\${ac_eC}$ptygrp\${ac_eD}
+"
+}
+
+ else
+ test -n "$silent" || echo "- ptys are world accessable"
+ fi
+
+
+else
+ test -n "$silent" || echo "- can't determine - assume ptys are world accessable"
+
+fi
+rm -fr conftest*
+rm -f conftest_grp
+
+test -n "$silent" || echo "checking for getutent"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <time.h> /* to get time_t on SCO */
#include <sys/types.h>
-#ifdef SVR4
+#if defined(SVR4) && !defined(DGUX)
#include <utmpx.h>
+#define utmp utmpx
#else
#include <utmp.h>
#endif
-#ifdef hpux
+#ifdef __hpux
#define pututline _pututline
#endif
-int main() { exit(0); }
-int t() { int x = DEAD_PROCESS; struct utmp *y = pututline((struct utmp *)0); getutent(); }
+int main() { return 0; }
+int t() { int x = DEAD_PROCESS; struct utmp *y = pututline((struct utmp *)0); getutent();; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining GETUTENT"
+echo "#define" GETUTENT "1" >> confdefs.h
DEFS="$DEFS -DGETUTENT=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}GETUTENT\${SEDdB}GETUTENT\${SEDdC}1\${SEDdD}
-\${SEDuA}GETUTENT\${SEDuB}GETUTENT\${SEDuC}1\${SEDuD}
-\${SEDeA}GETUTENT\${SEDeB}GETUTENT\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}GETUTENT\${ac_dB}GETUTENT\${ac_dC}1\${ac_dD}
+\${ac_uA}GETUTENT\${ac_uB}GETUTENT\${ac_uC}1\${ac_uD}
+\${ac_eA}GETUTENT\${ac_eB}GETUTENT\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
-echo checking for ut_host
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for ut_host"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <time.h>
#include <sys/types.h>
-#ifdef SVR4
+#if defined(SVR4) && !defined(DGUX)
#include <utmpx.h>
#define utmp utmpx
#else
#include <utmp.h>
#endif
-int main() { exit(0); }
-int t() { struct utmp u; u.ut_host[0] = 0; }
+int main() { return 0; }
+int t() { struct utmp u; u.ut_host[0] = 0;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining UTHOST"
+echo "#define" UTHOST "1" >> confdefs.h
DEFS="$DEFS -DUTHOST=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}UTHOST\${SEDdB}UTHOST\${SEDdC}1\${SEDdD}
-\${SEDuA}UTHOST\${SEDuB}UTHOST\${SEDuC}1\${SEDuD}
-\${SEDeA}UTHOST\${SEDeB}UTHOST\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}UTHOST\${ac_dB}UTHOST\${ac_dC}1\${ac_dD}
+\${ac_uA}UTHOST\${ac_uB}UTHOST\${ac_uC}1\${ac_uD}
+\${ac_eA}UTHOST\${ac_eB}UTHOST\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
-echo "checking for libutil(s)"
+test -n "$silent" || echo "checking for libutil(s)"
test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
-echo checking for getloadavg
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for getloadavg"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { getloadavg((double *)0, 0); }
+int main() { return 0; }
+int t() { getloadavg((double *)0, 0);; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining LOADAV_GETLOADAVG"
+echo "#define" LOADAV_GETLOADAVG "1" >> confdefs.h
DEFS="$DEFS -DLOADAV_GETLOADAVG=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_GETLOADAVG\${SEDdB}LOADAV_GETLOADAVG\${SEDdC}1\${SEDdD}
-\${SEDuA}LOADAV_GETLOADAVG\${SEDuB}LOADAV_GETLOADAVG\${SEDuC}1\${SEDuD}
-\${SEDeA}LOADAV_GETLOADAVG\${SEDeB}LOADAV_GETLOADAVG\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV_GETLOADAVG\${ac_dB}LOADAV_GETLOADAVG\${ac_dC}1\${ac_dD}
+\${ac_uA}LOADAV_GETLOADAVG\${ac_uB}LOADAV_GETLOADAVG\${ac_uC}1\${ac_uD}
+\${ac_eA}LOADAV_GETLOADAVG\${ac_eB}LOADAV_GETLOADAVG\${ac_eC}1\${ac_eD}
"
}
load=1
+
+else
+ rm -rf conftest*
+ if test -f /usr/lib/libkvm.a ; then
+olibs="$LIBS"
+LIBS="$LIBS -lkvm"
+test -n "$silent" || echo "checking for getloadavg with -lkvm"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { getloadavg((double *)0, 0);; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
+
+{
+test -n "$verbose" && \
+echo " defining LOADAV_GETLOADAVG"
+echo "#define" LOADAV_GETLOADAVG "1" >> confdefs.h
+DEFS="$DEFS -DLOADAV_GETLOADAVG=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV_GETLOADAVG\${ac_dB}LOADAV_GETLOADAVG\${ac_dC}1\${ac_dD}
+\${ac_uA}LOADAV_GETLOADAVG\${ac_uB}LOADAV_GETLOADAVG\${ac_uC}1\${ac_uD}
+\${ac_eA}LOADAV_GETLOADAVG\${ac_eB}LOADAV_GETLOADAVG\${ac_eC}1\${ac_eD}
+"
+}
+ load=1
+
+else
+ rm -rf conftest*
+ LIBS="$olibs"
+fi
+rm -f conftest*
+
+fi
+
fi
rm -f conftest*
+
if test -z "$load" ; then
-cat > conftest.c <<EOF
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#if defined(NeXT) || defined(apollo) || defined(linux)
yes
#endif
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
load=1
+
fi
rm -f conftest*
fi
if test -z "$load" ; then
-echo "searching for kernelfile"
-for core in /unix /vmunix /dynix /hp-ux /xelos /386bsd /kernel/unix ; do
+test -n "$silent" || echo "checking for kernelfile"
+for core in /unix /vmunix /dynix /hp-ux /xelos /386bsd /kernel/unix /unicos /mach; do
if test -f $core ; then
break
fi
done
if test ! -f $core ; then
- echo "- no kernelfile found"
+ test -n "$silent" || echo "- no kernelfile found"
else
- echo "- using kernelfile '$core'"
+ test -n "$silent" || echo "- using kernelfile '$core'"
{
test -n "$verbose" && \
-echo " defining LOADAV_UNIX to be \"$core\""
+echo " defining" LOADAV_UNIX to be "\"$core\""
+echo "#define" LOADAV_UNIX "\"$core\"" >> confdefs.h
DEFS="$DEFS -DLOADAV_UNIX=\"$core\""
-SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_UNIX\${SEDdB}LOADAV_UNIX\${SEDdC}\"$core\"\${SEDdD}
-\${SEDuA}LOADAV_UNIX\${SEDuB}LOADAV_UNIX\${SEDuC}\"$core\"\${SEDuD}
-\${SEDeA}LOADAV_UNIX\${SEDeB}LOADAV_UNIX\${SEDeC}\"$core\"\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV_UNIX\${ac_dB}LOADAV_UNIX\${ac_dC}\"$core\"\${ac_dD}
+\${ac_uA}LOADAV_UNIX\${ac_uB}LOADAV_UNIX\${ac_uC}\"$core\"\${ac_uD}
+\${ac_eA}LOADAV_UNIX\${ac_eB}LOADAV_UNIX\${ac_eC}\"$core\"\${ac_eD}
"
}
- echo checking for nlist.h
-cat > conftest.c <<EOF
+ test -n "$silent" || echo "checking for nlist.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <nlist.h>
EOF
-err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
-if test -z "$err"; then
+# Some shells (Coherent) do redirections in the wrong order, so need
+# the parens.
+ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining NLIST_STRUCT"
+echo "#define" NLIST_STRUCT "1" >> confdefs.h
DEFS="$DEFS -DNLIST_STRUCT=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_STRUCT\${SEDdB}NLIST_STRUCT\${SEDdC}1\${SEDdD}
-\${SEDuA}NLIST_STRUCT\${SEDuB}NLIST_STRUCT\${SEDuC}1\${SEDuD}
-\${SEDeA}NLIST_STRUCT\${SEDeB}NLIST_STRUCT\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NLIST_STRUCT\${ac_dB}NLIST_STRUCT\${ac_dC}1\${ac_dD}
+\${ac_uA}NLIST_STRUCT\${ac_uB}NLIST_STRUCT\${ac_uC}1\${ac_uD}
+\${ac_eA}NLIST_STRUCT\${ac_eB}NLIST_STRUCT\${ac_eC}1\${ac_eD}
"
}
- echo checking for n_un in struct nlist
-cat > conftest.c <<EOF
+ test -n "$silent" || echo "checking for n_un in struct nlist"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <nlist.h>
-int main() { exit(0); }
-int t() { struct nlist n; n.n_un.n_name = 0; }
+int main() { return 0; }
+int t() { struct nlist n; n.n_un.n_name = 0;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining NLIST_NAME_UNION"
+echo "#define" NLIST_NAME_UNION "1" >> confdefs.h
DEFS="$DEFS -DNLIST_NAME_UNION=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_NAME_UNION\${SEDdB}NLIST_NAME_UNION\${SEDdC}1\${SEDdD}
-\${SEDuA}NLIST_NAME_UNION\${SEDuB}NLIST_NAME_UNION\${SEDuC}1\${SEDuD}
-\${SEDeA}NLIST_NAME_UNION\${SEDeB}NLIST_NAME_UNION\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NLIST_NAME_UNION\${ac_dB}NLIST_NAME_UNION\${ac_dC}1\${ac_dD}
+\${ac_uA}NLIST_NAME_UNION\${ac_uB}NLIST_NAME_UNION\${ac_uC}1\${ac_uD}
+\${ac_eA}NLIST_NAME_UNION\${ac_eB}NLIST_NAME_UNION\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
+
fi
rm -f conftest*
- echo checking for nlist declaration
- cat > conftest.c <<EOF
+ test -n "$silent" || echo "checking for nlist declaration"
+ cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#ifdef NLIST_STRUCT
# include <nlist.h>
@@ -1402,26 +1933,30 @@ rm -f conftest*
#endif
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
-if egrep "nlist( | )( | )*.*\(" conftest.out >/dev/null 2>&1; then
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
+if egrep "nlist(( | )( | )*.*\(|\()" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining NLIST_DECLARED"
+echo "#define" NLIST_DECLARED "1" >> confdefs.h
DEFS="$DEFS -DNLIST_DECLARED=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NLIST_DECLARED\${SEDdB}NLIST_DECLARED\${SEDdC}1\${SEDdD}
-\${SEDuA}NLIST_DECLARED\${SEDuB}NLIST_DECLARED\${SEDuC}1\${SEDuD}
-\${SEDeA}NLIST_DECLARED\${SEDeB}NLIST_DECLARED\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NLIST_DECLARED\${ac_dB}NLIST_DECLARED\${ac_dC}1\${ac_dD}
+\${ac_uA}NLIST_DECLARED\${ac_uB}NLIST_DECLARED\${ac_uC}1\${ac_uD}
+\${ac_eA}NLIST_DECLARED\${ac_eB}NLIST_DECLARED\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
- echo searching for avenrun symbol
+ test -n "$silent" || echo "checking for avenrun symbol"
for av in avenrun _avenrun _Loadavg ; do
- cat > conftest.c <<EOF
+ cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#ifdef NLIST_STRUCT
@@ -1430,14 +1965,24 @@ rm -f conftest*
#include <a.out.h>
#endif
+#ifdef __sgi
+# if _MIPS_SZLONG == 64
+# define nlist nlist64
+# endif
+#endif
+
struct nlist nl[2];
main()
{
-#ifdef NLIST_NAME_UNION
+#if !defined(_AUX_SOURCE) && !defined(AUX)
+# ifdef NLIST_NAME_UNION
nl[0].n_un.n_name = "$av";
-#else
+# else
nl[0].n_name = "$av";
+# endif
+#else
+ strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
#endif
nlist(LOADAV_UNIX, nl);
if (nl[0].n_value == 0)
@@ -1446,24 +1991,26 @@ main()
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
avensym=$av;break
+
fi
-rm -f conftest*
+rm -fr conftest*
done
if test -z "$avensym" ; then
- echo "- no avenrun symbol found"
+ test -n "$silent" || echo "- no avenrun symbol found"
else
- echo "- using avenrun symbol '$avensym'"
+ test -n "$silent" || echo "- using avenrun symbol '$avensym'"
{
test -n "$verbose" && \
-echo " defining LOADAV_AVENRUN to be \"$avensym\""
+echo " defining" LOADAV_AVENRUN to be "\"$avensym\""
+echo "#define" LOADAV_AVENRUN "\"$avensym\"" >> confdefs.h
DEFS="$DEFS -DLOADAV_AVENRUN=\"$avensym\""
-SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_AVENRUN\${SEDdB}LOADAV_AVENRUN\${SEDdC}\"$avensym\"\${SEDdD}
-\${SEDuA}LOADAV_AVENRUN\${SEDuB}LOADAV_AVENRUN\${SEDuC}\"$avensym\"\${SEDuD}
-\${SEDeA}LOADAV_AVENRUN\${SEDeB}LOADAV_AVENRUN\${SEDeC}\"$avensym\"\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV_AVENRUN\${ac_dB}LOADAV_AVENRUN\${ac_dC}\"$avensym\"\${ac_dD}
+\${ac_uA}LOADAV_AVENRUN\${ac_uB}LOADAV_AVENRUN\${ac_uC}\"$avensym\"\${ac_uD}
+\${ac_eA}LOADAV_AVENRUN\${ac_eB}LOADAV_AVENRUN\${ac_eC}\"$avensym\"\${ac_eD}
"
}
@@ -1479,19 +2026,20 @@ cat > conftest.c <<EOF
_CUT_HERE_
-#if ((defined(hp300) && !defined(hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined(__alpha))
+#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined(__alpha) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
loadtype=long
-# ifdef apollo
+# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
loadscale=65536
# else
-# ifdef FSCALE
+# if defined(FSCALE) && !defined(__osf__)
# undef FSCALE
loadscale=FSCALE
# else
# ifdef sgi
loadscale=1024
+loadtype=int
# else
-# if defined(MIPS) || defined(SVR4)
+# if defined(MIPS) || defined(SVR4) || defined(m88k)
loadscale=256
# else /* not MIPS */
loadscale=1000 /* our default value */
@@ -1510,7 +2058,7 @@ loadnum=3
#endif
EOF
-eval "$CPP $DEFS conftest.c 2>/dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out"
+$CPP $DEFS conftest.c 2>/dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out
. ./conftest.out
rm -f conftest*
@@ -1519,103 +2067,143 @@ if test -n "$load" ; then
{
test -n "$verbose" && \
echo " defining LOADAV"
+echo "#define" LOADAV "1" >> confdefs.h
DEFS="$DEFS -DLOADAV=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV\${SEDdB}LOADAV\${SEDdC}1\${SEDdD}
-\${SEDuA}LOADAV\${SEDuB}LOADAV\${SEDuC}1\${SEDuD}
-\${SEDeA}LOADAV\${SEDeB}LOADAV\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV\${ac_dB}LOADAV\${ac_dC}1\${ac_dD}
+\${ac_uA}LOADAV\${ac_uB}LOADAV\${ac_uC}1\${ac_uD}
+\${ac_eA}LOADAV\${ac_eB}LOADAV\${ac_eC}1\${ac_eD}
"
}
fi
if test -n "$loadtype" ; then
{
test -n "$verbose" && \
-echo " defining LOADAV_TYPE to be $loadtype"
+echo " defining" LOADAV_TYPE to be "$loadtype"
+echo "#define" LOADAV_TYPE "$loadtype" >> confdefs.h
DEFS="$DEFS -DLOADAV_TYPE=$loadtype"
-SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_TYPE\${SEDdB}LOADAV_TYPE\${SEDdC}$loadtype\${SEDdD}
-\${SEDuA}LOADAV_TYPE\${SEDuB}LOADAV_TYPE\${SEDuC}$loadtype\${SEDuD}
-\${SEDeA}LOADAV_TYPE\${SEDeB}LOADAV_TYPE\${SEDeC}$loadtype\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV_TYPE\${ac_dB}LOADAV_TYPE\${ac_dC}$loadtype\${ac_dD}
+\${ac_uA}LOADAV_TYPE\${ac_uB}LOADAV_TYPE\${ac_uC}$loadtype\${ac_uD}
+\${ac_eA}LOADAV_TYPE\${ac_eB}LOADAV_TYPE\${ac_eC}$loadtype\${ac_eD}
"
}
fi
if test -n "$loadnum" ; then
{
test -n "$verbose" && \
-echo " defining LOADAV_NUM to be $loadnum"
+echo " defining" LOADAV_NUM to be "$loadnum"
+echo "#define" LOADAV_NUM "$loadnum" >> confdefs.h
DEFS="$DEFS -DLOADAV_NUM=$loadnum"
-SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_NUM\${SEDdB}LOADAV_NUM\${SEDdC}$loadnum\${SEDdD}
-\${SEDuA}LOADAV_NUM\${SEDuB}LOADAV_NUM\${SEDuC}$loadnum\${SEDuD}
-\${SEDeA}LOADAV_NUM\${SEDeB}LOADAV_NUM\${SEDeC}$loadnum\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV_NUM\${ac_dB}LOADAV_NUM\${ac_dC}$loadnum\${ac_dD}
+\${ac_uA}LOADAV_NUM\${ac_uB}LOADAV_NUM\${ac_uC}$loadnum\${ac_uD}
+\${ac_eA}LOADAV_NUM\${ac_eB}LOADAV_NUM\${ac_eC}$loadnum\${ac_eD}
"
}
fi
if test -n "$loadscale" ; then
{
test -n "$verbose" && \
-echo " defining LOADAV_SCALE to be $loadscale"
+echo " defining" LOADAV_SCALE to be "$loadscale"
+echo "#define" LOADAV_SCALE "$loadscale" >> confdefs.h
DEFS="$DEFS -DLOADAV_SCALE=$loadscale"
-SEDDEFS="${SEDDEFS}\${SEDdA}LOADAV_SCALE\${SEDdB}LOADAV_SCALE\${SEDdC}$loadscale\${SEDdD}
-\${SEDuA}LOADAV_SCALE\${SEDuB}LOADAV_SCALE\${SEDuC}$loadscale\${SEDuD}
-\${SEDeA}LOADAV_SCALE\${SEDeB}LOADAV_SCALE\${SEDeC}$loadscale\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}LOADAV_SCALE\${ac_dB}LOADAV_SCALE\${ac_dC}$loadscale\${ac_dD}
+\${ac_uA}LOADAV_SCALE\${ac_uB}LOADAV_SCALE\${ac_uC}$loadscale\${ac_uD}
+\${ac_eA}LOADAV_SCALE\${ac_eB}LOADAV_SCALE\${ac_eC}$loadscale\${ac_eD}
"
}
fi
-echo '#include <signal.h>' > conftest.c
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
-if egrep "(void|sighandler_t).*signal" conftest.out >/dev/null 2>&1; then
+if test -n "$posix" ; then
+
+test -n "$silent" || echo "assuming posix signal definition"
+
+{
+test -n "$verbose" && \
+echo " defining SIGVOID"
+echo "#define" SIGVOID "1" >> confdefs.h
+DEFS="$DEFS -DSIGVOID=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SIGVOID\${ac_dB}SIGVOID\${ac_dC}1\${ac_dD}
+\${ac_uA}SIGVOID\${ac_uB}SIGVOID\${ac_uC}1\${ac_uD}
+\${ac_eA}SIGVOID\${ac_eB}SIGVOID\${ac_eC}1\${ac_eD}
+"
+}
+
+
+else
+
+test -n "$silent" || echo "checking for return type of signal handlers"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+extern void (*signal ()) ();
+int main() { return 0; }
+int t() { int i;; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining SIGVOID"
+echo "#define" SIGVOID "1" >> confdefs.h
DEFS="$DEFS -DSIGVOID=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SIGVOID\${SEDdB}SIGVOID\${SEDdC}1\${SEDdD}
-\${SEDuA}SIGVOID\${SEDuB}SIGVOID\${SEDuC}1\${SEDuD}
-\${SEDeA}SIGVOID\${SEDeB}SIGVOID\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SIGVOID\${ac_dB}SIGVOID\${ac_dC}1\${ac_dD}
+\${ac_uA}SIGVOID\${ac_uB}SIGVOID\${ac_uC}1\${ac_uD}
+\${ac_eA}SIGVOID\${ac_eB}SIGVOID\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
-echo checking for sigset
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for sigset"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
-int main() { exit(0); }
+int main() { return 0; }
int t() {
#ifdef SIGVOID
sigset(0, (void (*)())0);
#else
sigset(0, (int (*)())0);
#endif
- }
+; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining USESIGSET"
+echo "#define" USESIGSET "1" >> confdefs.h
DEFS="$DEFS -DUSESIGSET=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}USESIGSET\${SEDdB}USESIGSET\${SEDdC}1\${SEDdD}
-\${SEDuA}USESIGSET\${SEDuB}USESIGSET\${SEDuC}1\${SEDuD}
-\${SEDeA}USESIGSET\${SEDeB}USESIGSET\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}USESIGSET\${ac_dB}USESIGSET\${ac_dC}1\${ac_dD}
+\${ac_uA}USESIGSET\${ac_uB}USESIGSET\${ac_uC}1\${ac_uD}
+\${ac_eA}USESIGSET\${ac_eB}USESIGSET\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
-echo checking signal implementation
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking signal implementation"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
-#ifndef SIGCHLD
-#define SIGCHLD SIGCLD
+#ifndef SIGCLD
+#define SIGCLD SIGCHLD
#endif
#ifdef USESIGSET
#define signal sigset
@@ -1633,16 +2221,19 @@ hand()
main()
{
- (void)signal(SIGCHLD, hand);
- kill(getpid(), SIGCHLD);
- kill(getpid(), SIGCHLD);
+ /* on hpux we use sigvec to get bsd signals */
+#ifdef __hpux
+ (void)signal(SIGCLD, hand);
+ kill(getpid(), SIGCLD);
+ kill(getpid(), SIGCLD);
if (got < 2)
exit(1);
+#endif
exit(0);
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
:
else
@@ -1650,156 +2241,191 @@ else
{
test -n "$verbose" && \
echo " defining SYSVSIGS"
+echo "#define" SYSVSIGS "1" >> confdefs.h
DEFS="$DEFS -DSYSVSIGS=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SYSVSIGS\${SEDdB}SYSVSIGS\${SEDdC}1\${SEDdD}
-\${SEDuA}SYSVSIGS\${SEDuB}SYSVSIGS\${SEDuC}1\${SEDuD}
-\${SEDeA}SYSVSIGS\${SEDeB}SYSVSIGS\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SYSVSIGS\${ac_dB}SYSVSIGS\${ac_dC}1\${ac_dD}
+\${ac_uA}SYSVSIGS\${ac_uB}SYSVSIGS\${ac_uC}1\${ac_uD}
+\${ac_eA}SYSVSIGS\${ac_eB}SYSVSIGS\${ac_eC}1\${ac_eD}
"
}
fi
-rm -f conftest*
+rm -fr conftest*
+fi
-echo checking for crypt and sec libraries
+
+test -n "$silent" || echo "checking for crypt and sec libraries"
test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
test -f /lib/libcrypt.a || test -f /usr/lib/libcrypt.a && LIBS="$LIBS -lcrypt"
test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
+test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
oldlibs="$LIBS"
LIBS="$LIBS -lsun"
-echo checking for IRIX sun library
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for IRIX sun library"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { }
+int main() { return 0; }
+int t() { ; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
+ rm -rf conftest*
LIBS="$oldlibs"
fi
rm -f conftest*
-echo checking for wait union
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for wait union"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
-int main() { exit(0); }
+int main() { return 0; }
int t() {
union wait x;
int y;
#ifdef WEXITSTATUS
y = WEXITSTATUS(x);
#endif
- }
+; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining BSDWAIT"
+echo "#define" BSDWAIT "1" >> confdefs.h
DEFS="$DEFS -DBSDWAIT=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}BSDWAIT\${SEDdB}BSDWAIT\${SEDdC}1\${SEDdD}
-\${SEDuA}BSDWAIT\${SEDuB}BSDWAIT\${SEDuC}1\${SEDuD}
-\${SEDeA}BSDWAIT\${SEDeB}BSDWAIT\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}BSDWAIT\${ac_dB}BSDWAIT\${ac_dC}1\${ac_dD}
+\${ac_uA}BSDWAIT\${ac_uB}BSDWAIT\${ac_uC}1\${ac_uD}
+\${ac_eA}BSDWAIT\${ac_eB}BSDWAIT\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
if test -z "$butterfly"; then
-echo checking for termio or termios
-cat > conftest.c <<EOF
-#include <termios.h>
+test -n "$silent" || echo "checking for termio or termios"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+#include <termio.h>
EOF
-err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
-if test -z "$err"; then
+# Some shells (Coherent) do redirections in the wrong order, so need
+# the parens.
+ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining TERMIO"
+echo "#define" TERMIO "1" >> confdefs.h
DEFS="$DEFS -DTERMIO=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}TERMIO\${SEDdB}TERMIO\${SEDdC}1\${SEDdD}
-\${SEDuA}TERMIO\${SEDuB}TERMIO\${SEDuC}1\${SEDuD}
-\${SEDeA}TERMIO\${SEDeB}TERMIO\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}TERMIO\${ac_dB}TERMIO\${ac_dC}1\${ac_dD}
+\${ac_uA}TERMIO\${ac_uB}TERMIO\${ac_uC}1\${ac_uD}
+\${ac_eA}TERMIO\${ac_eB}TERMIO\${ac_eC}1\${ac_eD}
"
}
+
else
- cat > conftest.c <<EOF
-#include <termio.h>
+ rm -rf conftest*
+ if test -n "$posix"; then
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+#include <termios.h>
EOF
-err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
-if test -z "$err"; then
+# Some shells (Coherent) do redirections in the wrong order, so need
+# the parens.
+ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining TERMIO"
+echo "#define" TERMIO "1" >> confdefs.h
DEFS="$DEFS -DTERMIO=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}TERMIO\${SEDdB}TERMIO\${SEDdC}1\${SEDdD}
-\${SEDuA}TERMIO\${SEDuB}TERMIO\${SEDuC}1\${SEDuD}
-\${SEDeA}TERMIO\${SEDeB}TERMIO\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}TERMIO\${ac_dB}TERMIO\${ac_dC}1\${ac_dD}
+\${ac_uA}TERMIO\${ac_uB}TERMIO\${ac_uC}1\${ac_uD}
+\${ac_eA}TERMIO\${ac_eB}TERMIO\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
fi
+
+fi
rm -f conftest*
fi
-echo checking for getspnam
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for getspnam"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <shadow.h>
-int main() { exit(0); }
-int t() { getspnam("x"); }
+int main() { return 0; }
+int t() { getspnam("x");; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining SHADOWPW"
+echo "#define" SHADOWPW "1" >> confdefs.h
DEFS="$DEFS -DSHADOWPW=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SHADOWPW\${SEDdB}SHADOWPW\${SEDdC}1\${SEDdD}
-\${SEDuA}SHADOWPW\${SEDuB}SHADOWPW\${SEDuC}1\${SEDuD}
-\${SEDeA}SHADOWPW\${SEDeB}SHADOWPW\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SHADOWPW\${ac_dB}SHADOWPW\${ac_dC}1\${ac_dD}
+\${ac_uA}SHADOWPW\${ac_uB}SHADOWPW\${ac_uC}1\${ac_uD}
+\${ac_eA}SHADOWPW\${ac_eB}SHADOWPW\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
-echo checking for getttyent
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for getttyent"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { getttyent(); }
+int main() { return 0; }
+int t() { getttyent();; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining GETTTYENT"
+echo "#define" GETTTYENT "1" >> confdefs.h
DEFS="$DEFS -DGETTTYENT=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}GETTTYENT\${SEDdB}GETTTYENT\${SEDdC}1\${SEDdD}
-\${SEDuA}GETTTYENT\${SEDuB}GETTTYENT\${SEDuC}1\${SEDuD}
-\${SEDeA}GETTTYENT\${SEDeB}GETTTYENT\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}GETTTYENT\${ac_dB}GETTTYENT\${ac_dC}1\${ac_dD}
+\${ac_uA}GETTTYENT\${ac_uB}GETTTYENT\${ac_uC}1\${ac_uD}
+\${ac_eA}GETTTYENT\${ac_eB}GETTTYENT\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
-echo checking whether memcpy/memmove/bcopy handles overlapping arguments
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking whether memcpy/memmove/bcopy handles overlapping arguments"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
main() {
char buf[10];
@@ -1814,23 +2440,26 @@ main() {
exit(0); /* libc version works properly. */
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
{
test -n "$verbose" && \
echo " defining USEBCOPY"
+echo "#define" USEBCOPY "1" >> confdefs.h
DEFS="$DEFS -DUSEBCOPY=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}USEBCOPY\${SEDdB}USEBCOPY\${SEDdC}1\${SEDdD}
-\${SEDuA}USEBCOPY\${SEDuB}USEBCOPY\${SEDuC}1\${SEDuD}
-\${SEDeA}USEBCOPY\${SEDeB}USEBCOPY\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}USEBCOPY\${ac_dB}USEBCOPY\${ac_dC}1\${ac_dD}
+\${ac_uA}USEBCOPY\${ac_uB}USEBCOPY\${ac_uC}1\${ac_uD}
+\${ac_eA}USEBCOPY\${ac_eB}USEBCOPY\${ac_eC}1\${ac_eD}
"
}
+
fi
-rm -f conftest*
+rm -fr conftest*
-cat > conftest.c <<EOF
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#define bcopy(s,d,l) memmove(d,s,l)
main() {
@@ -1846,24 +2475,27 @@ main() {
exit(0); /* libc version works properly. */
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
{
test -n "$verbose" && \
echo " defining USEMEMMOVE"
+echo "#define" USEMEMMOVE "1" >> confdefs.h
DEFS="$DEFS -DUSEMEMMOVE=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}USEMEMMOVE\${SEDdB}USEMEMMOVE\${SEDdC}1\${SEDdD}
-\${SEDuA}USEMEMMOVE\${SEDuB}USEMEMMOVE\${SEDuC}1\${SEDuD}
-\${SEDeA}USEMEMMOVE\${SEDeB}USEMEMMOVE\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}USEMEMMOVE\${ac_dB}USEMEMMOVE\${ac_dC}1\${ac_dD}
+\${ac_uA}USEMEMMOVE\${ac_uB}USEMEMMOVE\${ac_uC}1\${ac_uD}
+\${ac_eA}USEMEMMOVE\${ac_eB}USEMEMMOVE\${ac_eC}1\${ac_eD}
"
}
+
fi
-rm -f conftest*
+rm -fr conftest*
-cat > conftest.c <<EOF
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#define bcopy(s,d,l) memcpy(d,s,l)
main() {
@@ -1879,23 +2511,25 @@ main() {
exit(0); /* libc version works properly. */
}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
{
test -n "$verbose" && \
echo " defining USEMEMCPY"
+echo "#define" USEMEMCPY "1" >> confdefs.h
DEFS="$DEFS -DUSEMEMCPY=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}USEMEMCPY\${SEDdB}USEMEMCPY\${SEDdC}1\${SEDdD}
-\${SEDuA}USEMEMCPY\${SEDuB}USEMEMCPY\${SEDuC}1\${SEDuD}
-\${SEDeA}USEMEMCPY\${SEDeB}USEMEMCPY\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}USEMEMCPY\${ac_dB}USEMEMCPY\${ac_dC}1\${ac_dD}
+\${ac_uA}USEMEMCPY\${ac_uB}USEMEMCPY\${ac_uC}1\${ac_uD}
+\${ac_eA}USEMEMCPY\${ac_eB}USEMEMCPY\${ac_eC}1\${ac_eD}
"
}
+
fi
-rm -f conftest*
+rm -fr conftest*
-echo checking for long file names
+test -n "$silent" || echo "checking for long file names"
(echo 1 > /tmp/conftest9012345) 2>/dev/null
(echo 2 > /tmp/conftest9012346) 2>/dev/null
val=`cat /tmp/conftest9012345 2>/dev/null`
@@ -1903,142 +2537,164 @@ if test -f /tmp/conftest9012345 && test "$val" = 1; then :
else
{
test -n "$verbose" && \
-echo " defining NAME_MAX to be 14"
+echo " defining" NAME_MAX to be "14"
+echo "#define" NAME_MAX "14" >> confdefs.h
DEFS="$DEFS -DNAME_MAX=14"
-SEDDEFS="${SEDDEFS}\${SEDdA}NAME_MAX\${SEDdB}NAME_MAX\${SEDdC}14\${SEDdD}
-\${SEDuA}NAME_MAX\${SEDuB}NAME_MAX\${SEDuC}14\${SEDuD}
-\${SEDeA}NAME_MAX\${SEDeB}NAME_MAX\${SEDeC}14\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NAME_MAX\${ac_dB}NAME_MAX\${ac_dC}14\${ac_dD}
+\${ac_uA}NAME_MAX\${ac_uB}NAME_MAX\${ac_uC}14\${ac_uD}
+\${ac_eA}NAME_MAX\${ac_eB}NAME_MAX\${ac_eC}14\${ac_eD}
"
}
fi
rm -f /tmp/conftest*
-echo checking for vsprintf
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for vsprintf"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <varargs.h>
#include <stdio.h>
-int main() { exit(0); }
-int t() { vsprintf(); }
+int main() { return 0; }
+int t() { vsprintf();; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining USEVARARGS"
+echo "#define" USEVARARGS "1" >> confdefs.h
DEFS="$DEFS -DUSEVARARGS=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}USEVARARGS\${SEDdB}USEVARARGS\${SEDdC}1\${SEDdD}
-\${SEDuA}USEVARARGS\${SEDuB}USEVARARGS\${SEDuC}1\${SEDuD}
-\${SEDeA}USEVARARGS\${SEDeB}USEVARARGS\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}USEVARARGS\${ac_dB}USEVARARGS\${ac_dC}1\${ac_dD}
+\${ac_uA}USEVARARGS\${ac_uB}USEVARARGS\${ac_uC}1\${ac_uD}
+\${ac_eA}USEVARARGS\${ac_eB}USEVARARGS\${ac_eC}1\${ac_eD}
"
}
+
fi
rm -f conftest*
-echo checking for directory library header
-dirheader=
-if test -z "$dirheader"; then
- echo checking for dirent.h
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for directory library header"
+ac_dir_header=
+if test -z "$ac_dir_header"; then
+ test -n "$silent" || echo "checking for dirent.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <dirent.h>
-int main() { exit(0); }
-int t() { DIR *dirp = opendir ("/"); }
+int main() { return 0; }
+int t() { DIR *dirp = 0;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining DIRENT"
+echo "#define" DIRENT "1" >> confdefs.h
DEFS="$DEFS -DDIRENT=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
-\${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
-\${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}DIRENT\${ac_dB}DIRENT\${ac_dC}1\${ac_dD}
+\${ac_uA}DIRENT\${ac_uB}DIRENT\${ac_uC}1\${ac_uD}
+\${ac_eA}DIRENT\${ac_eB}DIRENT\${ac_eC}1\${ac_eD}
"
}
- dirheader=dirent.h
+ ac_dir_header=dirent.h
+
fi
rm -f conftest*
fi
-if test -z "$dirheader"; then
- echo checking for sys/ndir.h
-cat > conftest.c <<EOF
+if test -z "$ac_dir_header"; then
+ test -n "$silent" || echo "checking for sys/ndir.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/ndir.h>
-int main() { exit(0); }
-int t() { DIR *dirp = opendir ("/"); }
+int main() { return 0; }
+int t() { DIR *dirp = 0;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining SYSNDIR"
+echo "#define" SYSNDIR "1" >> confdefs.h
DEFS="$DEFS -DSYSNDIR=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
-\${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
-\${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SYSNDIR\${ac_dB}SYSNDIR\${ac_dC}1\${ac_dD}
+\${ac_uA}SYSNDIR\${ac_uB}SYSNDIR\${ac_uC}1\${ac_uD}
+\${ac_eA}SYSNDIR\${ac_eB}SYSNDIR\${ac_eC}1\${ac_eD}
"
}
- dirheader=sys/ndir.h
+ ac_dir_header=sys/ndir.h
+
fi
rm -f conftest*
fi
-if test -z "$dirheader"; then
- echo checking for sys/dir.h
-cat > conftest.c <<EOF
+if test -z "$ac_dir_header"; then
+ test -n "$silent" || echo "checking for sys/dir.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <sys/dir.h>
-int main() { exit(0); }
-int t() { DIR *dirp = opendir ("/"); }
+int main() { return 0; }
+int t() { DIR *dirp = 0;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining SYSDIR"
+echo "#define" SYSDIR "1" >> confdefs.h
DEFS="$DEFS -DSYSDIR=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
-\${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
-\${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}SYSDIR\${ac_dB}SYSDIR\${ac_dC}1\${ac_dD}
+\${ac_uA}SYSDIR\${ac_uB}SYSDIR\${ac_uC}1\${ac_uD}
+\${ac_eA}SYSDIR\${ac_eB}SYSDIR\${ac_eC}1\${ac_eD}
"
}
- dirheader=sys/dir.h
+ ac_dir_header=sys/dir.h
+
fi
rm -f conftest*
fi
-if test -z "$dirheader"; then
- echo checking for ndir.h
-cat > conftest.c <<EOF
+if test -z "$ac_dir_header"; then
+ test -n "$silent" || echo "checking for ndir.h"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
#include <ndir.h>
-int main() { exit(0); }
-int t() { DIR *dirp = opendir ("/"); }
+int main() { return 0; }
+int t() { DIR *dirp = 0;; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining NDIR"
+echo "#define" NDIR "1" >> confdefs.h
DEFS="$DEFS -DNDIR=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
-\${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
-\${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NDIR\${ac_dB}NDIR\${ac_dC}1\${ac_dD}
+\${ac_uA}NDIR\${ac_uB}NDIR\${ac_uC}1\${ac_uD}
+\${ac_eA}NDIR\${ac_eB}NDIR\${ac_eC}1\${ac_eD}
"
}
- dirheader=ndir.h
+ ac_dir_header=ndir.h
+
fi
rm -f conftest*
fi
-echo checking for closedir return value
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for closedir return value"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#include <sys/types.h>
-#include <$dirheader>
+#include <$ac_dir_header>
int closedir(); main() { exit(closedir(opendir(".")) != 0); }
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
:
else
@@ -2046,26 +2702,30 @@ else
{
test -n "$verbose" && \
echo " defining VOID_CLOSEDIR"
+echo "#define" VOID_CLOSEDIR "1" >> confdefs.h
DEFS="$DEFS -DVOID_CLOSEDIR=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
-\${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
-\${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}VOID_CLOSEDIR\${ac_dB}VOID_CLOSEDIR\${ac_dC}1\${ac_dD}
+\${ac_uA}VOID_CLOSEDIR\${ac_uB}VOID_CLOSEDIR\${ac_uC}1\${ac_uD}
+\${ac_eA}VOID_CLOSEDIR\${ac_eB}VOID_CLOSEDIR\${ac_eC}1\${ac_eD}
"
}
fi
-rm -f conftest*
+rm -fr conftest*
-echo checking for Xenix
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for Xenix"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
#if defined(M_XENIX) && !defined(M_UNIX)
yes
#endif
EOF
-eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
+eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
+ rm -rf conftest*
XENIX=1
+
fi
rm -f conftest*
@@ -2078,42 +2738,50 @@ if test -n "$XENIX"; then
fi
-echo checking for setenv
-cat > conftest.c <<EOF
+test -n "$silent" || echo "checking for setenv"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { setenv((char *)0,(char *)0);unsetenv((char *)0); }
+int main() { return 0; }
+int t() { setenv((char *)0,(char *)0);unsetenv((char *)0);; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining USESETENV"
+echo "#define" USESETENV "1" >> confdefs.h
DEFS="$DEFS -DUSESETENV=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}USESETENV\${SEDdB}USESETENV\${SEDdC}1\${SEDdD}
-\${SEDuA}USESETENV\${SEDuB}USESETENV\${SEDuC}1\${SEDuD}
-\${SEDeA}USESETENV\${SEDeB}USESETENV\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}USESETENV\${ac_dB}USESETENV\${ac_dC}1\${ac_dD}
+\${ac_uA}USESETENV\${ac_uB}USESETENV\${ac_uC}1\${ac_uD}
+\${ac_eA}USESETENV\${ac_eB}USESETENV\${ac_eC}1\${ac_eD}
"
}
+
else
- echo checking for putenv
-cat > conftest.c <<EOF
+ rm -rf conftest*
+ test -n "$silent" || echo "checking for putenv"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
-int main() { exit(0); }
-int t() { putenv((char *)0);unsetenv((char *)0); }
+int main() { return 0; }
+int t() { putenv((char *)0);unsetenv((char *)0);; return 0; }
EOF
-if eval $compile; then
+if eval $ac_compile; then
:
else
+ rm -rf conftest*
{
test -n "$verbose" && \
echo " defining NEEDPUTENV"
+echo "#define" NEEDPUTENV "1" >> confdefs.h
DEFS="$DEFS -DNEEDPUTENV=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}NEEDPUTENV\${SEDdB}NEEDPUTENV\${SEDdC}1\${SEDdD}
-\${SEDuA}NEEDPUTENV\${SEDuB}NEEDPUTENV\${SEDuC}1\${SEDuD}
-\${SEDeA}NEEDPUTENV\${SEDeB}NEEDPUTENV\${SEDeC}1\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NEEDPUTENV\${ac_dB}NEEDPUTENV\${ac_dC}1\${ac_dD}
+\${ac_uA}NEEDPUTENV\${ac_uB}NEEDPUTENV\${ac_uC}1\${ac_uD}
+\${ac_eA}NEEDPUTENV\${ac_eB}NEEDPUTENV\${ac_eC}1\${ac_eD}
"
}
@@ -2124,62 +2792,163 @@ rm -f conftest*
fi
rm -f conftest*
-if test -r /dev/ptc; then
+test -n "$silent" || echo "checking for rename"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { rename(0,0);; return 0; }
+EOF
+if eval $ac_compile; then
+ :
+else
+ rm -rf conftest*
+
{
test -n "$verbose" && \
-echo " defining HAVE_DEV_PTC"
-DEFS="$DEFS -DHAVE_DEV_PTC=1"
-SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_DEV_PTC\${SEDdB}HAVE_DEV_PTC\${SEDdC}1\${SEDdD}
-\${SEDuA}HAVE_DEV_PTC\${SEDuB}HAVE_DEV_PTC\${SEDuC}1\${SEDuD}
-\${SEDeA}HAVE_DEV_PTC\${SEDeB}HAVE_DEV_PTC\${SEDeC}1\${SEDeD}
+echo " defining NEED_RENAME"
+echo "#define" NEED_RENAME "1" >> confdefs.h
+DEFS="$DEFS -DNEED_RENAME=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}NEED_RENAME\${ac_dB}NEED_RENAME\${ac_dC}1\${ac_dD}
+\${ac_uA}NEED_RENAME\${ac_uB}NEED_RENAME\${ac_uC}1\${ac_uD}
+\${ac_eA}NEED_RENAME\${ac_eB}NEED_RENAME\${ac_eC}1\${ac_eD}
+"
+}
+
+fi
+rm -f conftest*
+
+test -n "$silent" || echo "checking for _exit"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { _exit(0);; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
+
+{
+test -n "$verbose" && \
+echo " defining HAVE__EXIT"
+echo "#define" HAVE__EXIT "1" >> confdefs.h
+DEFS="$DEFS -DHAVE__EXIT=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE__EXIT\${ac_dB}HAVE__EXIT\${ac_dC}1\${ac_dD}
+\${ac_uA}HAVE__EXIT\${ac_uB}HAVE__EXIT\${ac_uC}1\${ac_uD}
+\${ac_eA}HAVE__EXIT\${ac_eB}HAVE__EXIT\${ac_eC}1\${ac_eD}
+"
+}
+
+
+fi
+rm -f conftest*
+
+test -n "$silent" || echo "checking for lstat"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { lstat(0,0);; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
+
+{
+test -n "$verbose" && \
+echo " defining HAVE_LSTAT"
+echo "#define" HAVE_LSTAT "1" >> confdefs.h
+DEFS="$DEFS -DHAVE_LSTAT=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_LSTAT\${ac_dB}HAVE_LSTAT\${ac_dC}1\${ac_dD}
+\${ac_uA}HAVE_LSTAT\${ac_uB}HAVE_LSTAT\${ac_uC}1\${ac_uD}
+\${ac_eA}HAVE_LSTAT\${ac_eB}HAVE_LSTAT\${ac_eC}1\${ac_eD}
+"
+}
+
+
+fi
+rm -f conftest*
+
+test -n "$silent" || echo "checking for strerror"
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
+
+int main() { return 0; }
+int t() { strerror(0);; return 0; }
+EOF
+if eval $ac_compile; then
+ rm -rf conftest*
+
+{
+test -n "$verbose" && \
+echo " defining HAVE_STRERROR"
+echo "#define" HAVE_STRERROR "1" >> confdefs.h
+DEFS="$DEFS -DHAVE_STRERROR=1"
+ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_STRERROR\${ac_dB}HAVE_STRERROR\${ac_dC}1\${ac_dD}
+\${ac_uA}HAVE_STRERROR\${ac_uB}HAVE_STRERROR\${ac_uC}1\${ac_uD}
+\${ac_eA}HAVE_STRERROR\${ac_eB}HAVE_STRERROR\${ac_eC}1\${ac_eD}
"
}
+
fi
+rm -f conftest*
+
test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lsec -lseq"
-cat > conftest.c <<EOF
+cat > conftest.${ac_ext} <<EOF
+#include "confdefs.h"
main(){exit(0);}
EOF
-eval $compile
+eval $ac_compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
:
else
- echo "Can't run the compiler - internal error. Sorry.";exit
+ echo "configure: Can't run the compiler - internal error. Sorry." >&2; exit 1
fi
-rm -f conftest*
+rm -fr conftest*
if test -n "$prefix"; then
{
test -n "$verbose" && \
-echo " defining ETCSCREENRC to be \"$prefix/etc/screenrc\""
+echo " defining" ETCSCREENRC to be "\"$prefix/etc/screenrc\""
+echo "#define" ETCSCREENRC "\"$prefix/etc/screenrc\"" >> confdefs.h
DEFS="$DEFS -DETCSCREENRC=\"$prefix/etc/screenrc\""
-SEDDEFS="${SEDDEFS}\${SEDdA}ETCSCREENRC\${SEDdB}ETCSCREENRC\${SEDdC}\"$prefix/etc/screenrc\"\${SEDdD}
-\${SEDuA}ETCSCREENRC\${SEDuB}ETCSCREENRC\${SEDuC}\"$prefix/etc/screenrc\"\${SEDuD}
-\${SEDeA}ETCSCREENRC\${SEDeB}ETCSCREENRC\${SEDeC}\"$prefix/etc/screenrc\"\${SEDeD}
+ac_sed_defs="${ac_sed_defs}\${ac_dA}ETCSCREENRC\${ac_dB}ETCSCREENRC\${ac_dC}\"$prefix/etc/screenrc\"\${ac_dD}
+\${ac_uA}ETCSCREENRC\${ac_uB}ETCSCREENRC\${ac_uC}\"$prefix/etc/screenrc\"\${ac_uD}
+\${ac_eA}ETCSCREENRC\${ac_eB}ETCSCREENRC\${ac_eC}\"$prefix/etc/screenrc\"\${ac_eD}
"
}
fi
+# Set default prefixes.
if test -n "$prefix"; then
- test -z "$exec_prefix" && exec_prefix='${prefix}'
- prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%"
+ test -z "$exec_prefix" && exec_prefix='${prefix}' # Let make expand it.
+ ac_prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%"
fi
if test -n "$exec_prefix"; then
- prsub="$prsub
+ ac_prsub="$ac_prsub
s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
fi
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+# Quote sed substitution magic chars in DEFS.
cat >conftest.def <<EOF
$DEFS
EOF
-escape_ampersand_and_backslash='s%[&\\]%\\&%g'
-DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
+ac_escape_ampersand_and_backslash='s%[&\\]%\\&%g'
+DEFS=`sed "$ac_escape_ampersand_and_backslash" <conftest.def`
rm -f conftest.def
+# Substitute for predefined variables.
-trap 'rm -f config.status; exit 1' 1 3 15
+trap 'rm -f config.status; exit 1' 1 2 15
echo creating config.status
rm -f config.status
cat > config.status <<EOF
@@ -2191,16 +2960,23 @@ cat > config.status <<EOF
#
# $0 $configure_args
-for arg
+ac_cs_usage="Usage: config.status [--recheck] [--version] [--help]"
+for ac_option
do
- case "\$arg" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- exec /bin/sh $0 $configure_args ;;
- *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create
+ exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "config.status generated by autoconf version 1.10"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
esac
done
-trap 'rm -fr Makefile doc/Makefile config.h conftest*; exit 1' 1 3 15
+trap 'rm -fr Makefile doc/Makefile config.h conftest*; exit 1' 1 2 15
VERSION='$VERSION'
CC='$CC'
CPP='$CPP'
@@ -2210,30 +2986,50 @@ INSTALL_PROGRAM='$INSTALL_PROGRAM'
INSTALL_DATA='$INSTALL_DATA'
LIBS='$LIBS'
srcdir='$srcdir'
+top_srcdir='$top_srcdir'
prefix='$prefix'
exec_prefix='$exec_prefix'
-prsub='$prsub'
+ac_prsub='$ac_prsub'
+ac_vpsub='$ac_vpsub'
+extrasub='$extrasub'
EOF
cat >> config.status <<\EOF
-top_srcdir=$srcdir
-
-# Allow make-time overrides of the generated file list.
-test -n "$gen_files" || gen_files="Makefile doc/Makefile"
+ac_given_srcdir=$srcdir
-for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
- srcdir=$top_srcdir
+CONFIG_FILES=${CONFIG_FILES-"Makefile doc/Makefile"}
+for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then
# Remove last slash and all that follows it. Not all systems have dirname.
- dir=`echo $file|sed 's%/[^/][^/]*$%%'`
- if test "$dir" != "$file"; then
- test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
- test ! -d $dir && mkdir $dir
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file"; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/$ac_dir"
+ else
+ ac_dir_suffix=
fi
- echo creating $file
- rm -f $file
- echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
+
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ case "$ac_given_srcdir" in
+ .) srcdir=.; top_srcdir="$ac_dots." ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ comment_str="Generated automatically from `echo $ac_file|sed 's|.*/||'`.in by configure."
+ case "$ac_file" in
+ *.c | *.h | *.C | *.cc | *.m ) echo "/* $comment_str */" > "$ac_file" ;;
+ * ) echo "# $comment_str" > "$ac_file" ;;
+ esac
sed -e "
-$prsub
+$ac_prsub
+$ac_vpsub
+$extrasub
s%@VERSION@%$VERSION%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
@@ -2243,52 +3039,57 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@LIBS@%$LIBS%g
s%@srcdir@%$srcdir%g
-s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
+s%@top_srcdir@%$top_srcdir%g
+s%@prefix@%$prefix%g
+s%@exec_prefix@%$exec_prefix%g
+s%@DEFS@%-DHAVE_CONFIG_H%" $ac_given_srcdir/${ac_file}.in >> $ac_file
fi; done
-test -n "$gen_config" || gen_config=config.h
-echo creating $gen_config
-# These sed commands are put into SEDDEFS when defining a macro.
+
+# These sed commands are put into ac_sed_defs when defining a macro.
# They are broken into pieces to make the sed script easier to manage.
# They are passed to sed as "A NAME B NAME C VALUE D", where NAME
# is the cpp macro being defined and VALUE is the value it is being given.
# Each defining turns into a single global substitution command.
+# Hopefully no one uses "!" as a variable value.
+# Other candidates for the sed separators, like , and @, do get used.
#
-# SEDd sets the value in "#define NAME VALUE" lines.
-SEDdA='s@^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-SEDdB='\([ ][ ]*\)[^ ]*@\1#\2'
-SEDdC='\3'
-SEDdD='@g'
-# SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-SEDuA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-SEDuB='\([ ]\)@\1#\2define\3'
-SEDuC=' '
-SEDuD='\4@g'
-# SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-SEDeA='s@^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-SEDeB='$@\1#\2define\3'
-SEDeC=' '
-SEDeD='@g'
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s!^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*!\1#\2'
+ac_dC='\3'
+ac_dD='!g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s!^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)!\1#\2define\3'
+ac_uC=' '
+ac_uD='\4!g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s!^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$!\1#\2define\3'
+ac_eC=' '
+ac_eD='!g'
rm -f conftest.sed
EOF
# Turn off quoting long enough to insert the sed commands.
rm -f conftest.sh
cat > conftest.sh <<EOF
-$SEDDEFS
+$ac_sed_defs
EOF
-# Maximum number of lines to put in a single here document.
-maxshlines=9
-
-# Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
+# Break up $ac_sed_defs (now in conftest.sh) because some shells have a limit
# on the size of here documents.
+# Maximum number of lines to put in a single here document.
+ac_max_sh_lines=9
+
while :
do
- lines=`grep -c . conftest.sh`
- if test -z "$lines" || test "$lines" -eq 0; then break; fi
+ # wc gives bogus results for an empty file on some AIX systems.
+ ac_lines=`grep -c . conftest.sh`
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
rm -f conftest.s1 conftest.s2
- sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
- sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
+ sed ${ac_max_sh_lines}q conftest.sh > conftest.s1 # Like head -9.
+ sed 1,${ac_max_sh_lines}d conftest.sh > conftest.s2 # Like tail +10.
# Write a limited-size here document to append to conftest.sed.
echo 'cat >> conftest.sed <<CONFEOF' >> config.status
cat conftest.s1 >> config.status
@@ -2309,37 +3110,47 @@ s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
CONFEOF
rm -f conftest.h
# Break up the sed commands because old seds have small limits.
-maxsedlines=20
-cp $top_srcdir/$gen_config.in conftest.h1
-while :
-do
- lines=`grep -c . conftest.sed`
- if test -z "$lines" || test "$lines" -eq 0; then break; fi
- rm -f conftest.s1 conftest.s2 conftest.h2
- sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
- sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
- sed -f conftest.s1 < conftest.h1 > conftest.h2
- rm -f conftest.s1 conftest.h1 conftest.sed
- mv conftest.h2 conftest.h1
- mv conftest.s2 conftest.sed
-done
-rm -f conftest.sed conftest.h
-echo "/* $gen_config. Generated automatically by configure. */" > conftest.h
-cat conftest.h1 >> conftest.h
-rm -f conftest.h1
-if cmp -s $gen_config conftest.h 2>/dev/null; then
- # The file exists and we would not be changing it.
- rm -f conftest.h
-else
- rm -f $gen_config
- mv conftest.h $gen_config
-fi
+ac_max_sed_lines=20
+
+CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"}
+for ac_file in .. ${CONFIG_HEADERS}; do if test "x$ac_file" != x..; then
+ echo creating $ac_file
+
+ cp $ac_given_srcdir/$ac_file.in conftest.h1
+ cp conftest.sed conftest.stm
+ while :
+ do
+ ac_lines=`grep -c . conftest.stm`
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ rm -f conftest.s1 conftest.s2 conftest.h2
+ sed ${ac_max_sed_lines}q conftest.stm > conftest.s1 # Like head -20.
+ sed 1,${ac_max_sed_lines}d conftest.stm > conftest.s2 # Like tail +21.
+ sed -f conftest.s1 < conftest.h1 > conftest.h2
+ rm -f conftest.s1 conftest.h1 conftest.stm
+ mv conftest.h2 conftest.h1
+ mv conftest.s2 conftest.stm
+ done
+ rm -f conftest.stm conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.h1 >> conftest.h
+ rm -f conftest.h1
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ # The file exists and we would not be changing it.
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+rm -f conftest.sed
+
exit 0
EOF
chmod +x config.status
-test -n "$no_create" || ./config.status
+test -n "$no_create" || ${CONFIG_SHELL-/bin/sh} config.status
# a hook for preserving undef directive in config.h
diff --git a/src/configure.in b/src/configure.in
index 51b68b4..8c2052f 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -5,6 +5,7 @@ dnl
dnl Many thanks to David MacKenzie for writing autoconf and
dnl providing a sample configure.in file for screen.
dnl
+AC_REVISION($Revision$)dnl
AC_INIT(screen.c)
AC_CONFIG_HEADER(config.h)
@@ -17,25 +18,40 @@ define(AC_PROGRAM_SOURCE,
_CUT_HERE_
[$2]
EOF
-eval "$CPP $DEFS conftest.c 2>/dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out"
+$CPP $DEFS conftest.c 2>/dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out
. ./conftest.out
rm -f conftest*
])dnl
+dnl
+define(AC_NOTE,
+[test -n "$silent" || echo "$1"])dnl
+dnl
+dnl Extract version from patchlevel.h
+dnl
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'`
VERSION="$rev.$vers.$pat"
-echo "this is screen version $VERSION"
+AC_NOTE(this is screen version $VERSION)
AC_SUBST(VERSION)
+AC_PREFIX(gzip)
AC_PROG_CC
AC_PROG_CPP
AC_GCC_TRADITIONAL
AC_ISC_POSIX
+AC_TEST_PROGRAM(main(){exit(0);},,AC_ERROR(Can't run the compiler - sorry))
+
+AC_TEST_PROGRAM([
+main()
+{
+ int __something_strange_();
+ __something_strange_(0);
+}
+],AC_ERROR(Your compiler does not set the exit status - sorry))
-AC_TEST_PROGRAM(main(){exit(0);},,echo "Can't run the compiler - sorry";exit)
AC_PROG_AWK
AC_PROG_INSTALL
@@ -47,16 +63,18 @@ if test -n "$ISC"; then
AC_DEFINE(ISC) LIBS="$LIBS -linet"
fi
-echo checking for OSF1
-if test -f /bin/uname ; then
-if test `/bin/uname` = OSF1 || test -f /osf_boot; then
-AC_DEFINE(OSF1) # this disables MIPS again....
-fi
-fi
+dnl AC_CHECKING(for OSF1)
+dnl if test -f /bin/uname ; then
+dnl if test `/bin/uname` = OSF1 || test -f /osf_boot; then
+dnl AC_DEFINE(OSF1) # this disables MIPS again....
+dnl fi
+dnl fi
-echo checking for MIPS
+AC_CHECKING(for MIPS)
if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
-LIBS="$LIBS -lmld" # for nlist.
+test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
+dnl djm@eng.umd.edu: "... for one thing, it doubles the size of the executable"
+dnl
if test -r /dev/ptc; then
AC_DEFINE(MIPS)
AC_COMPILE_CHECK(wait3, , [wait3();], ,
@@ -70,17 +88,23 @@ AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd"
fi
fi
-echo checking for Ultrix
+AC_CHECKING(for Ultrix)
AC_PROGRAM_EGREP(yes,
[#if defined(ultrix) || defined(__ultrix)
yes
#endif
], ULTRIX=1)
+if test -f /usr/lib/libpyr.a ; then
+oldlibs="$LIBS"
+LIBS="$LIBS -lpyr"
+AC_COMPILE_CHECK(Pyramid OSX,,[open_controlling_pty("");],AC_DEFINE(OSX),LIBS="oldlibs")
+fi
+
dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
dnl BBN butterfly is not POSIX, but a MACH BSD system.
dnl Do not define POSIX and TERMIO.
-echo checking for butterfly
+AC_CHECKING(for butterfly)
AC_PROGRAM_EGREP(yes,
[#if defined(butterfly)
yes
@@ -91,7 +115,7 @@ if test -z "$butterfly"; then
if test -n "$ULTRIX"; then
test -z "$GCC" && CC="$CC -YBSD"
fi
-echo checking for POSIX.1
+AC_CHECKING(for POSIX.1)
AC_PROGRAM_EGREP(yes,
[#include <sys/types.h>
#include <unistd.h>
@@ -99,7 +123,7 @@ main () {
#ifdef _POSIX_VERSION
yes
#endif
-], echo "- you have a POSIX system";AC_DEFINE(POSIX))
+], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1)
fi
AC_COMPILE_CHECK([System V],
@@ -107,7 +131,7 @@ AC_COMPILE_CHECK([System V],
#include <signal.h>
#include <fcntl.h>], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
-echo checking for sequent/ptx
+AC_CHECKING(for sequent/ptx)
AC_PROGRAM_EGREP(yes,
[#ifdef _SEQUENT_
yes
@@ -125,18 +149,18 @@ AC_HEADER_CHECK(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN)))
dnl
dnl **** typedefs ****
dnl
-echo checking for pid_t
-AC_PROGRAM_EGREP(pid_t,[#include <sys/types.h>
-],AC_DEFINE(PID_T_DEFINED))
-
-echo checking for sig_t
-AC_PROGRAM_EGREP(sig_t,[#include <sys/types.h>
-#include <signal.h>
-],AC_DEFINE(SIG_T_DEFINED))
-
-echo checking for uid_t
-AC_PROGRAM_EGREP(uid_t,[#include <sys/types.h>
-],AC_DEFINE(UID_T_DEFINED))
+dnl AC_CHECKING(for pid_t)
+dnl AC_PROGRAM_EGREP(pid_t,[#include <sys/types.h>
+dnl ],AC_DEFINE(PID_T_DEFINED))
+dnl
+dnl AC_CHECKING(for sig_t)
+dnl AC_PROGRAM_EGREP(sig_t,[#include <sys/types.h>
+dnl #include <signal.h>
+dnl ],AC_DEFINE(SIG_T_DEFINED))
+dnl
+dnl AC_CHECKING(for uid_t)
+dnl AC_PROGRAM_EGREP(uid_t,[#include <sys/types.h>
+dnl ],AC_DEFINE(UID_T_DEFINED))
dnl
dnl **** Job control ****
@@ -156,41 +180,52 @@ setpgrp();
int y = TIOCNOTTY;
#endif
#endif
-], echo "- you have jobcontrol" AC_DEFINE(BSDJOBS), echo "- you don't have jobcontrol")
+], AC_NOTE(- you have jobcontrol) AC_DEFINE(BSDJOBS), AC_NOTE(- you don't have jobcontrol))
dnl
-dnl **** setreuid() ****
+dnl **** setreuid(), seteuid() ****
dnl
-AC_COMPILE_CHECK(setreuid, ,
-[
-#ifdef hpux
+AC_COMPILE_CHECK(setreuid, , [
+#ifdef __hpux
setresuid(0, 0, 0);
#else
setreuid(0, 0);
#endif
-], , AC_DEFINE(NOREUID))
-
-
+], AC_DEFINE(HAVE_SETREUID))
+dnl
+dnl seteuid() check:
+dnl linux seteuid was broken before V1.1.11
+dnl NeXT, AUX and ultrix are still broken (no saved uid support)
+dnl Solaris seteuid doesn't change the saved uid, bad for
+dnl multiuser screen sessions
+AC_COMPILE_CHECK(seteuid, , [
+#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4))
+seteuid_is_broken(0);
+#else
+seteuid(0);
+#endif
+], AC_DEFINE(HAVE_SETEUID))
+dnl
dnl **** select() ****
dnl
AC_COMPILE_CHECK(select,,[select(0, 0, 0, 0, 0);],,
LIBS="$LIBS -lnet -lnsl"
AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],,
-echo '!!! no select - no screen';exit)
+AC_ERROR(!!! no select - no screen))
)
dnl
dnl **** FIFO tests ****
dnl
-echo checking fifos
+AC_CHECKING(fifos)
AC_TEST_PROGRAM([
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
#endif
#ifndef S_IFIFO
#define S_IFIFO 0010000
@@ -204,33 +239,56 @@ main()
int f;
(void)alarm(5);
+#ifdef POSIX
+ if (mkfifo(fin, 0777))
+#else
if (mknod(fin, S_IFIFO|0777, 0))
+#endif
exit(1);
if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
exit(1);
close(0);
- if (open(fin, O_RDWR | O_NDELAY))
- exit(1);
- if (write(0, "TEST", 4) == -1)
+#ifdef __386BSD__
+ /*
+ * The next test fails under 386BSD, but screen works using fifos.
+ * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
+ * the select() configuration test.
+ */
+ exit(0);
+#endif
+ if (open(fin, O_RDONLY | O_NONBLOCK))
exit(1);
+ if (fork() == 0)
+ {
+ close(0);
+ if (open(fin, O_WRONLY | O_NONBLOCK))
+ exit(1);
+ close(0);
+ if (open(fin, O_WRONLY | O_NONBLOCK))
+ exit(1);
+ if (write(0, "TEST", 4) == -1)
+ exit(1);
+ exit(0);
+ }
f = 1;
if (select(1, &f, 0, 0, 0) == -1)
exit(1);
exit(0);
}
-], echo "- your fifos are usable"; fifo=1, echo "- your fifos are not usable")
+], AC_NOTE(- your fifos are usable);fifo=1,
+AC_NOTE(- your fifos are not usable))
rm -f /tmp/conftest*
if test -n "$fifo"; then
-echo "checking for broken fifo implementation"
+AC_CHECKING(for broken fifo implementation)
AC_TEST_PROGRAM([
#include <sys/types.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/stat.h>
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
#endif
#ifndef S_IFIFO
#define S_IFIFO 0010000
@@ -243,10 +301,14 @@ main()
struct timeval tv;
int r, x;
+#ifdef POSIX
+ if (mkfifo(fin, 0600))
+#else
if (mknod(fin, S_IFIFO|0600, 0))
+#endif
exit(1);
close(0);
- if (open(fin, O_RDONLY|O_NDELAY))
+ if (open(fin, O_RDONLY|O_NONBLOCK))
exit(1);
r = 1;
tv.tv_sec = 1;
@@ -255,8 +317,8 @@ main()
exit(1);
exit(0);
}
-], echo "- your implementation is ok",
-echo "- you have a broken implementation" AC_DEFINE(BROKEN_PIPE) fifobr=1)
+], AC_NOTE(- your implementation is ok),
+AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
rm -f /tmp/conftest*
fi
@@ -266,20 +328,13 @@ dnl
dnl may need LIBS="$LIBS -lsocket" here
dnl
-echo checking sockets
+AC_CHECKING(sockets)
AC_TEST_PROGRAM([
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <fcntl.h>
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
-#endif
-#ifndef FNDELAY
-#define FNDELAY O_NDELAY
-#endif
-
char *son = "/tmp/conftest$$";
main()
@@ -315,11 +370,12 @@ main()
exit(1);
exit(0);
}
-], echo "- your sockets are usable"; sock=1, echo "- your sockets are not usable")
+], AC_NOTE(- your sockets are usable);sock=1,
+AC_NOTE(- your sockets are not usable))
rm -f /tmp/conftest*
if test -n "$sock"; then
-echo "checking socket implementation"
+AC_CHECKING(socket implementation)
AC_TEST_PROGRAM([
#include <sys/types.h>
#include <sys/stat.h>
@@ -345,8 +401,8 @@ main()
close(s);
exit(0);
}
-],echo "- you are normal",
-echo "- unix domain sockets are not kept in the filesystem"
+],AC_NOTE(- you are normal),
+AC_NOTE(- unix domain sockets are not kept in the filesystem)
AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
rm -f /tmp/conftest*
fi
@@ -358,30 +414,29 @@ dnl
if test -n "$fifo"; then
if test -n "$sock"; then
if test -n "$nore"; then
- echo "- hmmm... better take the fifos"
+ AC_NOTE(- hmmm... better take the fifos)
AC_DEFINE(NAMEDPIPE)
elif test -n "$fifobr"; then
- echo "- as your fifos are broken lets use the sockets."
+ AC_NOTE(- as your fifos are broken lets use the sockets.)
else
- echo "- both sockets and fifos usable. let's take fifos."
+ AC_NOTE(- both sockets and fifos usable. let's take fifos.)
AC_DEFINE(NAMEDPIPE)
fi
else
- echo "- using named pipes, of course"
+ AC_NOTE(- using named pipes, of course)
AC_DEFINE(NAMEDPIPE)
fi
elif test -n "$sock"; then
- echo "- using unix-domain sockets, of course"
+ AC_NOTE(- using unix-domain sockets, of course)
else
- echo "!!! you have neither usable sockets nor usable pipes -> no screen"
- exit
+ AC_ERROR(you have neither usable sockets nor usable pipes -> no screen)
fi
dnl
dnl **** check the select implementation ****
dnl
-echo "checking select return value"
+AC_CHECKING(select return value)
AC_TEST_PROGRAM([
#include <sys/types.h>
#include <sys/stat.h>
@@ -391,8 +446,8 @@ char *nam = "/tmp/conftest$$";
#ifdef NAMEDPIPE
-#ifndef O_NDELAY
-#define O_NDELAY O_NONBLOCK
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
#endif
#ifndef S_IFIFO
#define S_IFIFO 0010000
@@ -403,11 +458,22 @@ main()
{
int l;
+#ifdef __FreeBSD__
+/* From Andrew A. Chernov (ache@astral.msk.su):
+ * opening RDWR fifo fails in BSD 4.4, but select return values is
+ * right.
+ */
+ exit(0);
+#endif
(void)alarm(5);
+#ifdef POSIX
+ if (mkfifo(nam, 0777))
+#else
if (mknod(nam, S_IFIFO|0777, 0))
+#endif
exit(1);
close(0);
- if (open(nam, O_RDWR | O_NDELAY))
+ if (open(nam, O_RDWR | O_NONBLOCK))
exit(1);
if (write(0, "TEST", 4) == -1)
exit(1);
@@ -456,39 +522,39 @@ main()
exit(1);
exit(0);
}
-],echo "- select is ok",echo "- it is not usable"
-AC_DEFINE(SELECT_BROKEN))
+],AC_NOTE(- select is ok),
+AC_NOTE(- it is not usable) AC_DEFINE(SELECT_BROKEN))
dnl
dnl **** termcap or terminfo ****
dnl
-echo searching for tgetent
+AC_CHECKING(for tgetent)
olibs="$LIBS"
-LIBS="-ltermcap $LIBS"
-AC_COMPILE_CHECK(libtermcap,,tgetent((char *)0, (char *)0);,,
LIBS="-lcurses $olibs"
AC_COMPILE_CHECK(libcurses,,tgetent((char *)0, (char *)0);,,
-echo "!!! no tgetent - no screen";exit)
-)
-TERMCAP="xx|scrdumm:xx:"
-TERM=scrdumm
-export TERMCAP
-export TERM
+LIBS="-ltermcap $olibs"
+AC_COMPILE_CHECK(libtermcap,,tgetent((char *)0, (char *)0);,,
+LIBS="-ltermlib $olibs"
+AC_COMPILE_CHECK(libtermlib,,tgetent((char *)0, (char *)0);,,
+AC_ERROR(!!! no tgetent - no screen))))
+
AC_TEST_PROGRAM([
main()
{
- char buf[1024];
- if (tgetent(buf, "scrdumm") != 1)
- exit(1);
- exit(0);
-}], echo "- you use the termcap database", echo "- you use the terminfo database"
-AC_DEFINE(TERMINFO))
+ exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
+}], AC_NOTE(- you use the termcap database),
+AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
AC_COMPILE_CHECK(ospeed,extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
dnl
-dnl **** PTY ranges ****
+dnl **** PTY specific things ****
dnl
-echo checking for ptyranges
+AC_CHECKING(for /dev/ptc)
+if test -r /dev/ptc; then
+AC_DEFINE(HAVE_DEV_PTC)
+fi
+
+AC_CHECKING(for ptyranges)
if test -d /dev/ptym ; then
pdir='/dev/ptym'
else
@@ -496,12 +562,58 @@ pdir='/dev'
fi
ptys=`echo $pdir/pty??`
if test "$ptys" != "$pdir/pty??" ; then
-p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | tr ' ' '\012' | sort -u | sed -n -e H -e g -e 's/\n//g' -e '$p'`
-p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | tr ' ' '\012' | sort -u | sed -n -e H -e g -e 's/\n//g' -e '$p'`
+p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
+p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
AC_DEFINE_UNQUOTED(PTYRANGE0,\"$p0\")
AC_DEFINE_UNQUOTED(PTYRANGE1,\"$p1\")
fi
+dnl **** pty mode/group handling ****
+dnl
+dnl support provided by Luke Mewburn <lm@rmit.edu.au>, 931222
+AC_CHECKING(default tty permissions/group)
+rm -f conftest_grp
+AC_TEST_PROGRAM([
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+main()
+{
+ struct stat sb;
+ char *x,*ttyname();
+ int om, m;
+ FILE *fp;
+
+ if (!(x = ttyname(0))) exit(1);
+ if (stat(x, &sb)) exit(1);
+ om = sb.st_mode;
+ if (om & 002) exit(0);
+ m = system("mesg y");
+ if (m == -1 || m == 127) exit(1);
+ if (stat(x, &sb)) exit(1);
+ m = sb.st_mode;
+ if (chmod(x, om)) exit(1);
+ if (m & 002) exit(0);
+ if (sb.st_gid == getgid()) exit(1);
+ if (!(fp=fopen("conftest_grp", "w")))
+ exit(1);
+ fprintf(fp, "%d\n", sb.st_gid);
+ fclose(fp);
+ exit(0);
+}
+],[
+ if test -f conftest_grp; then
+ ptygrp=`cat conftest_grp`
+ 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)
+)
+rm -f conftest_grp
dnl
dnl **** utmp handling ****
@@ -509,19 +621,20 @@ dnl
dnl linux has a void pututline, grrr, gcc will error when evaluating it.
AC_COMPILE_CHECK(getutent, [#include <time.h> /* to get time_t on SCO */
#include <sys/types.h>
-#ifdef SVR4
+#if defined(SVR4) && !defined(DGUX)
#include <utmpx.h>
+#define utmp utmpx
#else
#include <utmp.h>
#endif
-#ifdef hpux
+#ifdef __hpux
#define pututline _pututline
#endif
],
[int x = DEAD_PROCESS; struct utmp *y = pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT))
AC_COMPILE_CHECK(ut_host, [#include <time.h>
#include <sys/types.h>
-#ifdef SVR4
+#if defined(SVR4) && !defined(DGUX)
#include <utmpx.h>
#define utmp utmpx
#else
@@ -533,12 +646,20 @@ AC_COMPILE_CHECK(ut_host, [#include <time.h>
dnl
dnl **** loadav ****
dnl
-echo "checking for libutil(s)"
+AC_CHECKING(for libutil(s))
test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
AC_COMPILE_CHECK(getloadavg, , [getloadavg((double *)0, 0);],
-AC_DEFINE(LOADAV_GETLOADAVG) load=1)
+AC_DEFINE(LOADAV_GETLOADAVG) load=1,
+if test -f /usr/lib/libkvm.a ; then
+olibs="$LIBS"
+LIBS="$LIBS -lkvm"
+AC_COMPILE_CHECK(getloadavg with -lkvm, , [getloadavg((double *)0, 0);],
+AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
+fi
+)
+
if test -z "$load" ; then
AC_PROGRAM_EGREP(yes,
[#if defined(NeXT) || defined(apollo) || defined(linux)
@@ -547,16 +668,16 @@ AC_PROGRAM_EGREP(yes,
], load=1)
fi
if test -z "$load" ; then
-echo "searching for kernelfile"
-for core in /unix /vmunix /dynix /hp-ux /xelos /386bsd /kernel/unix ; do
+AC_CHECKING(for kernelfile)
+for core in /unix /vmunix /dynix /hp-ux /xelos /386bsd /kernel/unix /unicos /mach; do
if test -f $core ; then
break
fi
done
if test ! -f $core ; then
- echo "- no kernelfile found"
+ AC_NOTE(- no kernelfile found)
else
- echo "- using kernelfile '$core'"
+ AC_NOTE(- using kernelfile '$core')
AC_DEFINE_UNQUOTED(LOADAV_UNIX,\"$core\")
AC_HEADER_CHECK(nlist.h,
[AC_DEFINE(NLIST_STRUCT)
@@ -564,8 +685,8 @@ else
[struct nlist n; n.n_un.n_name = 0;],
AC_DEFINE(NLIST_NAME_UNION))])
- echo checking for nlist declaration
- AC_PROGRAM_EGREP([nlist( | )( | )*.*\(],[
+ AC_CHECKING(for nlist declaration)
+ AC_PROGRAM_EGREP([nlist(( | )( | )*.*\(|\()],[
#ifdef NLIST_STRUCT
# include <nlist.h>
#else
@@ -573,7 +694,7 @@ else
#endif
],AC_DEFINE(NLIST_DECLARED))
- echo searching for avenrun symbol
+ AC_CHECKING(for avenrun symbol)
for av in avenrun _avenrun _Loadavg ; do
AC_TEST_PROGRAM([
#include <sys/types.h>
@@ -583,14 +704,24 @@ else
#include <a.out.h>
#endif
+#ifdef __sgi
+# if _MIPS_SZLONG == 64
+# define nlist nlist64
+# endif
+#endif
+
struct nlist nl[2];
main()
{
-#ifdef NLIST_NAME_UNION
+#if !defined(_AUX_SOURCE) && !defined(AUX)
+# ifdef NLIST_NAME_UNION
nl[0].n_un.n_name = "$av";
-#else
+# else
nl[0].n_name = "$av";
+# endif
+#else
+ strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
#endif
nlist(LOADAV_UNIX, nl);
if (nl[0].n_value == 0)
@@ -600,9 +731,9 @@ main()
],avensym=$av;break)
done
if test -z "$avensym" ; then
- echo "- no avenrun symbol found"
+ AC_NOTE(- no avenrun symbol found)
else
- echo "- using avenrun symbol '$avensym'"
+ AC_NOTE(- using avenrun symbol '$avensym')
AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,\"$avensym\")
load=1
fi
@@ -613,19 +744,20 @@ 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(__alpha))
+#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || defined(__alpha) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
loadtype=long
-# ifdef apollo
+# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX)
loadscale=65536
# else
-# ifdef FSCALE
+# if defined(FSCALE) && !defined(__osf__)
# undef FSCALE
loadscale=FSCALE
# else
# ifdef sgi
loadscale=1024
+loadtype=int
# else
-# if defined(MIPS) || defined(SVR4)
+# if defined(MIPS) || defined(SVR4) || defined(m88k)
loadscale=256
# else /* not MIPS */
loadscale=1000 /* our default value */
@@ -653,8 +785,21 @@ if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi
dnl
dnl **** signal handling ****
dnl
-AC_HEADER_EGREP([(void|sighandler_t).*signal], signal.h,
- AC_DEFINE(SIGVOID))
+if test -n "$posix" ; then
+
+dnl POSIX has reliable signals with void return type.
+AC_NOTE(assuming posix signal definition)
+AC_DEFINE(SIGVOID)
+
+else
+
+AC_COMPILE_CHECK([return type of signal handlers],
+[#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
AC_COMPILE_CHECK(sigset, [
#include <sys/types.h>
#include <signal.h>
@@ -665,13 +810,13 @@ sigset(0, (void (*)())0);
sigset(0, (int (*)())0);
#endif
], AC_DEFINE(USESIGSET))
-echo checking signal implementation
+AC_CHECKING(signal implementation)
AC_TEST_PROGRAM([
#include <sys/types.h>
#include <signal.h>
-#ifndef SIGCHLD
-#define SIGCHLD SIGCLD
+#ifndef SIGCLD
+#define SIGCLD SIGCHLD
#endif
#ifdef USESIGSET
#define signal sigset
@@ -689,23 +834,29 @@ hand()
main()
{
- (void)signal(SIGCHLD, hand);
- kill(getpid(), SIGCHLD);
- kill(getpid(), SIGCHLD);
+ /* on hpux we use sigvec to get bsd signals */
+#ifdef __hpux
+ (void)signal(SIGCLD, hand);
+ kill(getpid(), SIGCLD);
+ kill(getpid(), SIGCLD);
if (got < 2)
exit(1);
+#endif
exit(0);
}
],,AC_DEFINE(SYSVSIGS))
+fi
+
dnl
dnl **** libraries ****
dnl
-echo checking for crypt and sec libraries
+AC_CHECKING(for crypt and sec libraries)
test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
test -f /lib/libcrypt.a || test -f /usr/lib/libcrypt.a && LIBS="$LIBS -lcrypt"
test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
+test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
oldlibs="$LIBS"
LIBS="$LIBS -lsun"
@@ -726,9 +877,12 @@ AC_COMPILE_CHECK(wait union,[#include <sys/types.h>
],AC_DEFINE(BSDWAIT))
if test -z "$butterfly"; then
-echo checking for termio or termios
-AC_TEST_CPP([#include <termios.h>], AC_DEFINE(TERMIO),
- AC_TEST_CPP([#include <termio.h>], AC_DEFINE(TERMIO)))
+AC_CHECKING(for termio or termios)
+AC_TEST_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
+if test -n "$posix"; then
+AC_TEST_CPP([#include <termios.h>], AC_DEFINE(TERMIO))
+fi
+)
fi
dnl AC_HEADER_CHECK(shadow.h, AC_DEFINE(SHADOWPW))
@@ -737,7 +891,7 @@ AC_COMPILE_CHECK(getspnam, [#include <shadow.h>], [getspnam("x");],
AC_COMPILE_CHECK(getttyent, , [getttyent();], AC_DEFINE(GETTTYENT))
-echo checking whether memcpy/memmove/bcopy handles overlapping arguments
+AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
AC_TEST_PROGRAM([
main() {
char buf[10];
@@ -783,7 +937,7 @@ main() {
exit(0); /* libc version works properly. */
}], AC_DEFINE(USEMEMCPY))
-echo checking for long file names
+AC_CHECKING(for long file names)
(echo 1 > /tmp/conftest9012345) 2>/dev/null
(echo 2 > /tmp/conftest9012346) 2>/dev/null
val=`cat /tmp/conftest9012345 2>/dev/null`
@@ -802,9 +956,11 @@ AC_COMPILE_CHECK(setenv, , [setenv((char *)0,(char *)0);unsetenv((char *)0);], A
AC_COMPILE_CHECK(putenv, , [putenv((char *)0);unsetenv((char *)0);], ,
AC_DEFINE(NEEDPUTENV)
))
-if test -r /dev/ptc; then
-AC_DEFINE(HAVE_DEV_PTC)
-fi
+
+AC_COMPILE_CHECK(rename, , [rename(0,0);], , AC_DEFINE(NEED_RENAME))
+AC_COMPILE_CHECK(_exit, , [_exit(0);], AC_DEFINE(HAVE__EXIT))
+AC_COMPILE_CHECK(lstat, , [lstat(0,0);], AC_DEFINE(HAVE_LSTAT))
+AC_COMPILE_CHECK(strerror, ,[strerror(0);], AC_DEFINE(HAVE_STRERROR))
dnl
dnl **** the end ****
@@ -812,7 +968,7 @@ dnl
dnl Ptx bug workaround -- insert -lc after -ltermcap
test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lsec -lseq"
-AC_TEST_PROGRAM(main(){exit(0);},,echo "Can't run the compiler - internal error. Sorry.";exit)
+AC_TEST_PROGRAM(main(){exit(0);},,AC_ERROR(Can't run the compiler - internal error. Sorry.))
if test -n "$prefix"; then
AC_DEFINE_UNQUOTED(ETCSCREENRC,\"$prefix/etc/screenrc\")
fi
diff --git a/src/display.c b/src/display.c
index 16e2404..7fefa45 100644
--- a/src/display.c
+++ b/src/display.c
@@ -58,7 +58,6 @@ struct display *display, *displays;
struct display TheDisplay;
#endif
-
/*
* The default values
*/
@@ -121,9 +120,10 @@ void
DefRestore()
{
InsertMode(0);
- ChangeScrollRegion(0, d_height - 1);
+ ChangeScrollRegion(0, D_height - 1);
KeypadMode(0);
CursorkeysMode(0);
+ CursorInvisible(0);
SetAttrFont(0, ASCII);
SetFlow(FLOW_NOW);
}
@@ -182,61 +182,128 @@ struct mode *Mode;
return 0;
display = &TheDisplay;
#endif
- display->_d_next = displays;
+ display->d_next = displays;
displays = display;
- d_flow = 1;
- d_userfd = fd;
- d_OldMode = *Mode;
+ D_flow = 1;
+ D_nonblock = 0;
+ D_userfd = fd;
+ D_OldMode = *Mode;
Resize_obuf(); /* Allocate memory for buffer */
- d_obufmax = defobuflimit;
+ D_obufmax = defobuflimit;
#ifdef AUTO_NUKE
- d_auto_nuke = defautonuke;
+ D_auto_nuke = defautonuke;
#endif
- d_obufp = d_obuf;
- d_userpid = pid;
+ D_obufp = D_obuf;
+ D_printfd = -1;
+ D_userpid = pid;
#ifdef POSIX
- d_dospeed = (short) cfgetospeed(&d_OldMode.tio);
+ switch (cfgetospeed(&D_OldMode.tio))
+ {
+#ifdef B0
+ case B0: D_dospeed = 0; break;
+#endif
+#ifdef B50
+ case B50: D_dospeed = 1; break;
+#endif
+#ifdef B75
+ case B75: D_dospeed = 2; break;
+#endif
+#ifdef B110
+ case B110: D_dospeed = 3; break;
+#endif
+#ifdef B134
+ case B134: D_dospeed = 4; break;
+#endif
+#ifdef B150
+ case B150: D_dospeed = 5; break;
+#endif
+#ifdef B200
+ case B200: D_dospeed = 6; break;
+#endif
+#ifdef B300
+ case B300: D_dospeed = 7; break;
+#endif
+#ifdef B600
+ case B600: D_dospeed = 8; break;
+#endif
+#ifdef B1200
+ case B1200: D_dospeed = 9; break;
+#endif
+#ifdef B1800
+ case B1800: D_dospeed = 10; break;
+#endif
+#ifdef B2400
+ case B2400: D_dospeed = 11; break;
+#endif
+#ifdef B4800
+ case B4800: D_dospeed = 12; break;
+#endif
+#ifdef B9600
+ case B9600: D_dospeed = 13; break;
+#endif
+#ifdef EXTA
+ case EXTA: D_dospeed = 14; break;
+#endif
+#ifdef EXTB
+ case EXTB: D_dospeed = 15; break;
+#endif
+#ifdef B57600
+ case B57600: D_dospeed = 16; break;
+#endif
+#ifdef B115200
+ case B115200: D_dospeed = 17; break;
+#endif
+ default: ;
+ }
#else
# ifndef TERMIO
- d_dospeed = (short) d_OldMode.m_ttyb.sg_ospeed;
+ D_dospeed = (short) D_OldMode.m_ttyb.sg_ospeed;
# endif
#endif
- debug1("New displays ospeed = %d\n", d_dospeed);
- strcpy(d_usertty, utty);
- strcpy(d_termname, term);
+ debug1("New displays ospeed = %d\n", D_dospeed);
+ strcpy(D_usertty, utty);
+ strcpy(D_termname, term);
if (!*(u = FindUserPtr(uname)) && UserAdd(uname, NULL, u))
{
FreeDisplay();
return NULL; /* could not find or add user */
}
- d_user = *u;
- d_lay = &BlankLayer;
- d_layfn = BlankLayer.l_layfn;
+ D_user = *u;
+ D_lay = &BlankLayer;
+ D_layfn = BlankLayer.l_layfn;
return display;
}
void
FreeDisplay()
{
+ struct win *p;
#ifdef MULTI
struct display *d, **dp;
- for (dp = &displays; (d = *dp) ; dp = &d->_d_next)
+ for (dp = &displays; (d = *dp) ; dp = &d->d_next)
if (d == display)
break;
ASSERT(d);
- if (d_status_lastmsg)
- free(d_status_lastmsg);
- if (d_obuf)
- free(d_obuf);
- *dp = display->_d_next;
- free(display);
+ if (D_status_lastmsg)
+ free(D_status_lastmsg);
+ if (D_obuf)
+ free(D_obuf);
+ *dp = display->d_next;
+ free((char *)display);
#else /* MULTI */
ASSERT(display == displays);
ASSERT(display == &TheDisplay);
displays = 0;
#endif /* MULTI */
+ for (p = windows; p; p = p->w_next)
+ {
+ if (p->w_display == display)
+ p->w_display = 0;
+ if (p->w_pdisplay == display)
+ p->w_pdisplay = 0;
+ }
display = 0;
}
@@ -249,26 +316,32 @@ InitTerm(adapt)
int adapt;
{
ASSERT(display);
- d_top = d_bot = -1;
- PutStr(TI);
- PutStr(IS);
+ ASSERT(D_tcinited);
+ D_top = D_bot = -1;
+ PutStr(D_TI);
+ PutStr(D_IS);
/* Check for toggle */
- if (IM && strcmp(IM, EI))
- PutStr(EI);
- d_insert = 0;
+ if (D_IM && strcmp(D_IM, D_EI))
+ PutStr(D_EI);
+ D_insert = 0;
/* Check for toggle */
- if (KS && strcmp(KS, KE))
- PutStr(KE);
- d_keypad = 0;
- if (CCS && strcmp(CCS, CCE))
- PutStr(CCE);
- d_cursorkeys = 0;
- PutStr(CE0);
- d_font = ASCII;
+#ifdef MAPKEYS
+ PutStr(D_KS);
+ PutStr(D_CCS);
+#else
+ if (D_KS && strcmp(D_KS, D_KE))
+ PutStr(D_KE);
+ if (D_CCS && strcmp(D_CCS, D_CCE))
+ PutStr(D_CCE);
+#endif
+ D_keypad = 0;
+ D_cursorkeys = 0;
+ PutStr(D_CE0);
+ D_font = ASCII;
if (adapt == 0)
- ResizeDisplay(d_defwidth, d_defheight);
- ChangeScrollRegion(0, d_height - 1);
- d_x = d_y = 0;
+ ResizeDisplay(D_defwidth, D_defheight);
+ ChangeScrollRegion(0, D_height - 1);
+ D_x = D_y = 0;
Flush();
ClearDisplay();
debug1("we %swant to adapt all our windows to the display\n",
@@ -281,13 +354,22 @@ void
FinitTerm()
{
ASSERT(display);
- ResizeDisplay(d_defwidth, d_defheight);
- DefRestore();
- SetAttrFont(0, ASCII);
- d_x = d_y = -1;
- GotoPos(0, d_height - 1);
- AddChar('\n');
- PutStr(TE);
+ if (D_tcinited)
+ {
+ ResizeDisplay(D_defwidth, D_defheight);
+ DefRestore();
+ SetAttrFont(0, ASCII);
+#ifdef MAPKEYS
+ PutStr(D_KE);
+ PutStr(D_CCE);
+#endif
+ if (D_hstatus)
+ PutStr(D_DS);
+ D_x = D_y = -1;
+ GotoPos(0, D_height - 1);
+ AddChar('\n');
+ PutStr(D_TE);
+ }
Flush();
}
@@ -297,21 +379,21 @@ INSERTCHAR(c)
int c;
{
ASSERT(display);
- if (!d_insert && d_x < d_width - 1)
+ if (!D_insert && D_x < D_width - 1)
{
- if (IC || CIC)
+ if (D_IC || D_CIC)
{
- if (IC)
- PutStr(IC);
+ if (D_IC)
+ PutStr(D_IC);
else
- CPutStr(CIC, 1);
+ CPutStr(D_CIC, 1);
RAW_PUTCHAR(c);
return;
}
InsertMode(1);
- if (!d_insert)
+ if (!D_insert)
{
- RefreshLine(d_y, d_x, d_width-1, 0);
+ RefreshLine(D_y, D_x, D_width-1, 0);
return;
}
}
@@ -323,7 +405,7 @@ PUTCHAR(c)
int c;
{
ASSERT(display);
- if (d_insert && d_x < d_width - 1)
+ if (D_insert && D_x < D_width - 1)
InsertMode(0);
RAW_PUTCHAR(c);
}
@@ -332,22 +414,22 @@ void
PUTCHARLP(c)
int c;
{
- if (d_x < d_width - 1)
+ if (D_x < D_width - 1)
{
- if (d_insert)
+ if (D_insert)
InsertMode(0);
RAW_PUTCHAR(c);
return;
}
- if (CLP || d_y != d_bot)
+ if (D_CLP || D_y != D_bot)
{
RAW_PUTCHAR(c);
return;
}
- d_lp_missing = 1;
- d_lp_image = c;
- d_lp_attr = d_attr;
- d_lp_font = d_font;
+ D_lp_missing = 1;
+ D_lp_image = c;
+ D_lp_attr = D_attr;
+ D_lp_font = D_font;
}
/*
@@ -360,21 +442,71 @@ RAW_PUTCHAR(c)
int c;
{
ASSERT(display);
- if (d_font == '0')
+#ifdef KANJI
+ if (D_font == KANJI)
+ {
+ int t = c;
+ if (D_mbcs == 0)
+ {
+ D_mbcs = c;
+ return;
+ }
+ 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 < 0x5e) ? 0x81 : 0xc1);
+ }
+ D_mbcs = t;
+ }
+ else if (D_font == KANA)
{
- AddChar(d_c0_tab[c]);
+ if (D_kanji == EUC)
+ {
+ AddChar(0x8e); /* SS2 */
+ c |= 0x80;
+ }
+ else if (D_kanji == SJIS)
+ {
+ c |= 0x80;
+ }
+ }
+ kanjiloop:
+#endif
+ if (D_font == '0')
+ {
+ AddChar(D_c0_tab[c]);
}
else
AddChar(c);
- if (++d_x >= d_width)
+ if (++D_x >= D_width)
{
- if ((AM && !CLP) || d_x > d_width)
+ if (D_AM == 0)
+ D_x = D_width - 1;
+ else if (!D_CLP || D_x > D_width)
{
- d_x -= d_width;
- if (d_y < d_height-1 && d_y != d_bot)
- d_y++;
+ D_x -= D_width;
+ if (D_y < D_height-1 && D_y != D_bot)
+ D_y++;
}
}
+#ifdef KANJI
+ if (D_mbcs)
+ {
+ c = D_mbcs;
+ D_mbcs = 0;
+ goto kanjiloop;
+ }
+#endif
}
static void
@@ -391,7 +523,7 @@ char *s;
{
if (display && s)
{
- ospeed = d_dospeed;
+ ospeed = D_dospeed;
tputs(s, 1, PutChar);
}
}
@@ -403,7 +535,7 @@ int c;
{
if (display && s)
{
- ospeed = d_dospeed;
+ ospeed = D_dospeed;
tputs(tgoto(s, 0, c), 1, PutChar);
}
}
@@ -415,43 +547,81 @@ void
InsertMode(on)
int on;
{
- if (display && on != d_insert && IM)
+ if (display && on != D_insert && D_IM)
{
- d_insert = on;
- if (d_insert)
- PutStr(IM);
+ D_insert = on;
+ if (D_insert)
+ PutStr(D_IM);
else
- PutStr(EI);
+ PutStr(D_EI);
}
}
-/* ...and maybe d_keypad application mode is a toggle, too:
+/* ...and maybe keypad application mode is a toggle, too:
*/
void
KeypadMode(on)
int on;
{
- if (display && d_keypad != on && KS)
+#ifdef MAPKEYS
+ if (display)
+ D_keypad = on;
+#else
+ if (display && D_keypad != on && D_KS)
{
- d_keypad = on;
- if (d_keypad)
- PutStr(KS);
+ D_keypad = on;
+ if (D_keypad)
+ PutStr(D_KS);
else
- PutStr(KE);
+ PutStr(D_KE);
}
+#endif
}
void
CursorkeysMode(on)
int on;
{
- if (display && d_cursorkeys != on && CCS)
+#ifdef MAPKEYS
+ if (display)
+ D_cursorkeys = on;
+#else
+ if (display && D_cursorkeys != on && D_CCS)
+ {
+ D_cursorkeys = on;
+ if (D_cursorkeys)
+ PutStr(D_CCS);
+ else
+ PutStr(D_CCE);
+ }
+#endif
+}
+
+void
+ReverseVideo(on)
+int on;
+{
+ if (display && D_revvid != on && D_CVR)
{
- d_cursorkeys = on;
- if (d_cursorkeys)
- PutStr(CCS);
+ D_revvid = on;
+ if (D_revvid)
+ PutStr(D_CVR);
else
- PutStr(CCE);
+ PutStr(D_CVN);
+ }
+}
+
+void
+CursorInvisible(on)
+int on;
+{
+ if (display && D_curinv != on && D_VI)
+ {
+ D_curinv = on;
+ if (D_curinv)
+ PutStr(D_VI);
+ else
+ PutStr(D_VE);
}
}
@@ -473,7 +643,7 @@ register char *s;
if (s)
{
StrCost = 0;
- ospeed = d_dospeed;
+ ospeed = D_dospeed;
tputs(s, 1, CountChars);
return StrCost;
}
@@ -495,15 +665,15 @@ int x2, y2;
if (!display)
return;
- x1 = d_x;
- y1 = d_y;
+ x1 = D_x;
+ y1 = D_y;
- if (x1 == d_width)
- if (CLP && AM)
+ if (x1 == D_width)
+ if (D_CLP && D_AM)
x1 = -1; /* don't know how the terminal treats this */
else
x1--;
- if (x2 == d_width)
+ if (x2 == D_width)
x2--;
dx = x2 - x1;
dy = y2 - y1;
@@ -511,26 +681,26 @@ int x2, y2;
{
return;
}
- if (!MS && (d_attr || d_font != ASCII)) /* Safe to move ? */
+ if (!D_MS && (D_attr || D_font != ASCII)) /* Safe to move ? */
SetAttrFont(0, ASCII);
if (y1 < 0 /* don't know the y position */
- || (y2 > d_bot && y1 <= d_bot) /* have to cross border */
- || (y2 < d_top && y1 >= d_top)) /* of scrollregion ? */
+ || (y2 > D_bot && y1 <= D_bot) /* have to cross border */
+ || (y2 < D_top && y1 >= D_top)) /* of scrollregion ? */
{
DoCM:
- if (HO && !x2 && !y2)
- PutStr(HO);
+ if (D_HO && !x2 && !y2)
+ PutStr(D_HO);
else
- PutStr(tgoto(CM, x2, y2));
- d_x = x2;
- d_y = y2;
+ PutStr(tgoto(D_CM, x2, y2));
+ D_x = x2;
+ D_y = y2;
return;
}
/* Calculate CMcost */
- if (HO && !x2 && !y2)
- s = HO;
+ if (D_HO && !x2 && !y2)
+ s = D_HO;
else
- s = tgoto(CM, x2, y2);
+ s = tgoto(D_CM, x2, y2);
CMcost = CalcCost(s);
/* Calculate the cost to move the cursor to the right x position */
@@ -539,12 +709,12 @@ int x2, y2;
{
if (dx > 0)
{
- if (CRI && (dx > 1 || !ND))
+ if (D_CRI && (dx > 1 || !D_ND))
{
- costx = CalcCost(tgoto(CRI, 0, dx));
+ costx = CalcCost(tgoto(D_CRI, 0, dx));
xm = M_CRI;
}
- if ((m = d_NDcost * dx) < costx)
+ if ((m = D_NDcost * dx) < costx)
{
costx = m;
xm = M_RI;
@@ -558,12 +728,12 @@ int x2, y2;
}
else if (dx < 0)
{
- if (CLE && (dx < -1 || !BC))
+ if (D_CLE && (dx < -1 || !D_BC))
{
- costx = CalcCost(tgoto(CLE, 0, -dx));
+ costx = CalcCost(tgoto(D_CLE, 0, -dx));
xm = M_CLE;
}
- if ((m = -dx * d_LEcost) < costx)
+ if ((m = -dx * D_LEcost) < costx)
{
costx = m;
xm = M_LE;
@@ -573,7 +743,7 @@ int x2, y2;
costx = 0;
}
/* Speedup: Rewrite() >= x2 */
- if (x2 + d_CRcost < costx && (m = (x2 ? Rewrite(y1, 0, x2, 0) : 0) + d_CRcost) < costx)
+ if (x2 + D_CRcost < costx && (m = (x2 ? Rewrite(y1, 0, x2, 0) : 0) + D_CRcost) < costx)
{
costx = m;
xm = M_CR;
@@ -587,12 +757,12 @@ int x2, y2;
costy = EXPENSIVE;
if (dy > 0)
{
- if (CDO && dy > 1) /* DO & NL are always != 0 */
+ if (D_CDO && dy > 1) /* DO & NL are always != 0 */
{
- costy = CalcCost(tgoto(CDO, 0, dy));
+ costy = CalcCost(tgoto(D_CDO, 0, dy));
ym = M_CDO;
}
- if ((m = dy * ((x2 == 0) ? d_NLcost : d_DOcost)) < costy)
+ if ((m = dy * ((x2 == 0) ? D_NLcost : D_DOcost)) < costy)
{
costy = m;
ym = M_DO;
@@ -600,12 +770,12 @@ int x2, y2;
}
else if (dy < 0)
{
- if (CUP && (dy < -1 || !UP))
+ if (D_CUP && (dy < -1 || !D_UP))
{
- costy = CalcCost(tgoto(CUP, 0, -dy));
+ costy = CalcCost(tgoto(D_CUP, 0, -dy));
ym = M_CUP;
}
- if ((m = -dy * d_UPcost) < costy)
+ if ((m = -dy * D_UPcost) < costy)
{
costy = m;
ym = M_UP;
@@ -622,21 +792,21 @@ int x2, y2;
{
case M_LE:
while (dx++ < 0)
- PutStr(BC);
+ PutStr(D_BC);
break;
case M_CLE:
- CPutStr(CLE, -dx);
+ CPutStr(D_CLE, -dx);
break;
case M_RI:
while (dx-- > 0)
- PutStr(ND);
+ PutStr(D_ND);
break;
case M_CRI:
- CPutStr(CRI, dx);
+ CPutStr(D_CRI, dx);
break;
case M_CR:
- PutStr(CR);
- d_x = 0;
+ PutStr(D_CR);
+ D_x = 0;
x1 = 0;
/* FALLTHROUGH */
case M_RW:
@@ -651,90 +821,101 @@ int x2, y2;
{
case M_UP:
while (dy++ < 0)
- PutStr(UP);
+ PutStr(D_UP);
break;
case M_CUP:
- CPutStr(CUP, -dy);
+ CPutStr(D_CUP, -dy);
break;
case M_DO:
- s = (x2 == 0) ? NL : DO;
+ s = (x2 == 0) ? D_NL : D_DO;
while (dy-- > 0)
PutStr(s);
break;
case M_CDO:
- CPutStr(CDO, dy);
+ CPutStr(D_CDO, dy);
break;
default:
break;
}
- d_x = x2;
- d_y = y2;
+ D_x = x2;
+ D_y = y2;
}
void
ClearDisplay()
{
ASSERT(display);
- Clear(0, 0, d_width - 1, d_height - 1);
+ Clear(0, 0, 0, D_width - 1, D_width - 1, D_height - 1, 0);
}
void
-Clear(xs, ys, xe, ye)
-int xs, ys, xe, ye;
+Clear(x1, y1, xs, xe, x2, y2, uselayfn)
+int x1, y1, xs, xe, x2, y2, uselayfn;
{
int y, xxe;
ASSERT(display);
- if (xs == d_width)
- xs--;
- if (xe == d_width)
- xe--;
- if (d_lp_missing && ys <= d_bot)
+ if (x1 == D_width)
+ x1--;
+ if (x2 == D_width)
+ x2--;
+ if (D_attr && D_UT) /* Safe to erase ? */
+ SetAttr(0);
+ if (D_lp_missing && y1 <= D_bot && xe >= D_width - 1)
{
- if (ye > d_bot || (ye == d_bot && xe == d_width - 1))
- d_lp_missing = 0;
+ if (y2 > D_bot || (y2 == D_bot && x2 >= D_width - 1))
+ D_lp_missing = 0;
}
- if (xe == d_width - 1 && ye == d_height - 1)
+ if (x2 == D_width - 1 && (xs == 0 || y1 == y2) && xe == D_width - 1 && y2 == D_height - 1)
{
#ifdef AUTO_NUKE
- if (xs == 0 && ys == 0 && d_auto_nuke)
+ if (x1 == 0 && y1 == 0 && D_auto_nuke)
NukePending();
#endif
- if (xs == 0 && ys == 0 && CL)
+ if (x1 == 0 && y1 == 0 && D_CL)
{
- PutStr(CL);
- d_y = d_x = 0;
+ PutStr(D_CL);
+ D_y = D_x = 0;
return;
}
/*
* Workaround a hp700/22 terminal bug. Do not use CD where CE
* is also appropriate.
*/
- if (CD && (ys < ye || !CE))
+ if (D_CD && (y1 < y2 || !D_CE))
{
- GotoPos(xs, ys);
- PutStr(CD);
+ GotoPos(x1, y1);
+ PutStr(D_CD);
return;
}
}
- xxe = d_width - 1;
- for (y = ys; y <= ye; y++, xs = 0)
+ if (x1 == 0 && xs == 0 && (xe == D_width - 1 || y1 == y2) && y1 == 0 && D_CCD)
+ {
+ GotoPos(x1, y1);
+ PutStr(D_CCD);
+ return;
+ }
+ xxe = xe;
+ for (y = y1; y <= y2; y++, x1 = xs)
{
- if (y == ye)
- xxe = xe;
- if (xs == 0 && CB && (xxe != d_width - 1 || (d_x == xxe && d_y == y)))
+ if (y == y2)
+ xxe = x2;
+ if (x1 == 0 && D_CB && (xxe != D_width - 1 || (D_x == xxe && D_y == y)))
{
GotoPos(xxe, y);
- PutStr(CB);
+ PutStr(D_CB);
continue;
}
- if (xxe == d_width - 1 && CE)
+ if (xxe == D_width - 1 && D_CE)
{
- GotoPos(xs, y);
- PutStr(CE);
+ GotoPos(x1, y);
+ PutStr(D_CE);
continue;
}
- ClearLine(y, xs, xxe);
+ if (uselayfn)
+ ClearLine(y, x1, xxe);
+ else
+ DisplayLine(null, null, null, blank, null, null, y, x1, xxe);
}
}
@@ -752,24 +933,98 @@ int cur_only;
ASSERT(display);
DefRestore();
ClearDisplay();
- stop = d_height;
+ stop = D_height;
i = 0;
- if (cur_only > 0 && d_fore)
+ if (cur_only > 0 && D_fore)
{
- i = stop = d_fore->w_y;
+ i = stop = D_fore->w_y;
stop++;
}
- else RedisplayLine(-1, 0, d_width - 1, 1);
+ else
+ RedisplayLine(-1, 0, D_width - 1, 1);
for (; i < stop; i++)
- RedisplayLine(i, 0, d_width - 1, 1);
+ RedisplayLine(i, 0, D_width - 1, 1);
+ RefreshStatus();
Restore();
SetCursor();
}
void
-ScrollRegion(ys, ye, n)
-int ys, ye, n;
+ScrollH(y, xs, xe, n, oi, oa, of)
+int y, xs, xe, n;
+char *oi, *oa, *of;
+{
+ int i;
+
+ if (n == 0)
+ return;
+ if (xe != D_width - 1)
+ {
+ RefreshLine(y, xs, xe, 0);
+ /* UpdateLine(oi, oa, of, y, xs, xe); */
+ return;
+ }
+ GotoPos(xs, y);
+ if (D_attr && D_UT)
+ SetAttr(0);
+ if (n > 0)
+ {
+ if (D_CDC && !(n == 1 && D_DC))
+ CPutStr(D_CDC, n);
+ else if (D_DC)
+ {
+ for (i = n; i--; )
+ PutStr(D_DC);
+ }
+ else
+ {
+ RefreshLine(y, xs, xe, 0);
+ /* UpdateLine(oi, oa, of, y, xs, xe); */
+ return;
+ }
+ }
+ else
+ {
+ if (!D_insert)
+ {
+ if (D_CIC && !(n == -1 && D_IC))
+ CPutStr(D_CIC, -n);
+ else if (D_IC)
+ {
+ for (i = -n; i--; )
+ PutStr(D_IC);
+ }
+ else if (D_IM)
+ {
+ InsertMode(1);
+ for (i = -n; i--; )
+ INSERTCHAR(' ');
+ }
+ else
+ {
+ /* UpdateLine(oi, oa, of, y, xs, xe); */
+ RefreshLine(y, xs, xe, 0);
+ return;
+ }
+ }
+ else
+ {
+ for (i = -n; i--; )
+ INSERTCHAR(' ');
+ }
+ }
+ if (D_lp_missing && y == D_bot)
+ {
+ if (n > 0)
+ FixLP(D_width - 1 - n, y);
+ D_lp_missing = 0;
+ }
+}
+
+void
+ScrollV(xs, ys, xe, ye, n)
+int xs, ys, xe, ye, n;
{
int i;
int up;
@@ -780,22 +1035,26 @@ int ys, ye, n;
ASSERT(display);
if (n == 0)
return;
- if (ys == 0 && ye == d_height - 1 &&
- (n >= d_height || -n >= d_height))
+ if (n >= ye - ys + 1 || -n >= ye - ys + 1)
{
- ClearDisplay();
+ Clear(xs, ys, xs, xe, xe, ye, 0);
+ return;
+ }
+ if (xs != 0 || xe != D_width - 1)
+ {
+ Redisplay(0);
return;
}
- if (d_lp_missing)
+ if (D_lp_missing)
{
- if (d_bot > ye || d_bot < ys)
- missy = d_bot;
+ if (D_bot > ye || D_bot < ys)
+ missy = D_bot;
else
{
- missy = d_bot - n;
- if (missy>ye || missy<ys)
- d_lp_missing = 0;
+ missy = D_bot - n;
+ if (missy > ye || missy < ys)
+ D_lp_missing = 0;
}
}
@@ -805,24 +1064,24 @@ int ys, ye, n;
up = 0;
n = -n;
}
- if (n >= ye-ys+1)
- n = ye-ys+1;
+ if (n >= ye - ys + 1)
+ n = ye - ys + 1;
- oldtop = d_top;
- oldbot = d_bot;
- if (d_bot != ye)
+ oldtop = D_top;
+ oldbot = D_bot;
+ if (D_bot != ye)
ChangeScrollRegion(ys, ye);
- alok = (AL || CAL || (ye == d_bot && up));
- dlok = (DL || CDL || (ye == d_bot && !up));
- if (d_top != ys && !(alok && dlok))
+ alok = (D_AL || D_CAL || (ye == D_bot && up));
+ dlok = (D_DL || D_CDL || (ye == D_bot && !up));
+ if (D_top != ys && !(alok && dlok))
ChangeScrollRegion(ys, ye);
- if (d_lp_missing &&
- (oldbot != d_bot ||
- (oldbot == d_bot && up && d_top == ys && d_bot == ye)))
+ if (D_lp_missing &&
+ (oldbot != D_bot ||
+ (oldbot == D_bot && up && D_top == ys && D_bot == ye)))
{
- FixLP(d_width - 1, oldbot);
- if (oldbot == d_bot) /* have scrolled */
+ FixLP(D_width - 1, oldbot);
+ if (oldbot == D_bot) /* have scrolled */
{
if (--n == 0)
{
@@ -832,42 +1091,44 @@ int ys, ye, n;
}
}
- aldlfaster = (n > 1 && ye == d_bot && ((up && CDL) || (!up && CAL)));
+ aldlfaster = (n > 1 && ye == D_bot && ((up && D_CDL) || (!up && D_CAL)));
- if ((up || SR) && d_top == ys && d_bot == ye && !aldlfaster)
+ if (D_attr && D_UT)
+ SetAttr(0);
+ if ((up || D_SR) && D_top == ys && D_bot == ye && !aldlfaster)
{
if (up)
{
GotoPos(0, ye);
while (n-- > 0)
- PutStr(NL); /* was SF, I think NL is faster */
+ PutStr(D_NL); /* was SF, I think NL is faster */
}
else
{
GotoPos(0, ys);
while (n-- > 0)
- PutStr(SR);
+ PutStr(D_SR);
}
}
else if (alok && dlok)
{
- if (up || ye != d_bot)
+ if (up || ye != D_bot)
{
GotoPos(0, up ? ys : ye+1-n);
- if (CDL && !(n == 1 && DL))
- CPutStr(CDL, n);
+ if (D_CDL && !(n == 1 && D_DL))
+ CPutStr(D_CDL, n);
else
for(i = n; i--; )
- PutStr(DL);
+ PutStr(D_DL);
}
- if (!up || ye != d_bot)
+ if (!up || ye != D_bot)
{
GotoPos(0, up ? ye+1-n : ys);
- if (CAL && !(n == 1 && AL))
- CPutStr(CAL, n);
+ if (D_CAL && !(n == 1 && D_AL))
+ CPutStr(D_CAL, n);
else
for(i = n; i--; )
- PutStr(AL);
+ PutStr(D_AL);
}
}
else
@@ -875,69 +1136,71 @@ int ys, ye, n;
Redisplay(0);
return;
}
- if (d_lp_missing && missy != d_bot)
- FixLP(d_width - 1, missy);
+ if (D_lp_missing && missy != D_bot)
+ FixLP(D_width - 1, missy);
ChangeScrollRegion(oldtop, oldbot);
- if (d_lp_missing && missy != d_bot)
- FixLP(d_width - 1, missy);
+ if (D_lp_missing && missy != D_bot)
+ FixLP(D_width - 1, missy);
}
void
SetAttr(new)
register int new;
{
- register int i, old;
+ register int i, j, old, typ;
- if (!display || (old = d_attr) == new)
+ if (!display || (old = D_attr) == new)
return;
- d_attr = new;
- for (i = 1; i <= A_MAX; i <<= 1)
+ typ = D_atyp;
+ if ((new & old) != old)
{
- if ((old & i) && !(new & i))
+ if ((typ & ATYP_U))
+ PutStr(D_UE);
+ if ((typ & ATYP_S))
+ PutStr(D_SE);
+ if ((typ & ATYP_M))
+ PutStr(D_ME);
+ old = 0;
+ typ = 0;
+ }
+ old ^= new;
+ for (i = 0, j = 1; old && i < NATTR; i++, j <<= 1)
+ {
+ if ((old & j) == 0)
+ continue;
+ old ^= j;
+ if (D_attrtab[i])
{
- PutStr(UE);
- PutStr(SE);
- PutStr(ME);
- if (new & A_DI)
- PutStr(d_attrtab[ATTR_DI]);
- if (new & A_US)
- PutStr(d_attrtab[ATTR_US]);
- if (new & A_BD)
- PutStr(d_attrtab[ATTR_BD]);
- if (new & A_RV)
- PutStr(d_attrtab[ATTR_RV]);
- if (new & A_SO)
- PutStr(d_attrtab[ATTR_SO]);
- if (new & A_BL)
- PutStr(d_attrtab[ATTR_BL]);
- return;
+ PutStr(D_attrtab[i]);
+ typ |= D_attrtyp[i];
}
}
- if ((new & A_DI) && !(old & A_DI))
- PutStr(d_attrtab[ATTR_DI]);
- if ((new & A_US) && !(old & A_US))
- PutStr(d_attrtab[ATTR_US]);
- if ((new & A_BD) && !(old & A_BD))
- PutStr(d_attrtab[ATTR_BD]);
- if ((new & A_RV) && !(old & A_RV))
- PutStr(d_attrtab[ATTR_RV]);
- if ((new & A_SO) && !(old & A_SO))
- PutStr(d_attrtab[ATTR_SO]);
- if ((new & A_BL) && !(old & A_BL))
- PutStr(d_attrtab[ATTR_BL]);
+ D_attr = new;
+ D_atyp = typ;
}
void
SetFont(new)
int new;
{
- if (!display || d_font == new)
+ if (!display || D_font == new)
return;
- d_font = new;
+ D_font = new;
+#ifdef KANJI
+ if ((new == KANJI || new == KANA) && D_kanji)
+ return; /* all done in RAW_PUTCHAR */
+#endif
if (new == ASCII)
- PutStr(CE0);
+ PutStr(D_CE0);
+#ifdef KANJI
+ else if (new < ' ')
+ {
+ AddStr("\033$");
+ AddChar(new + '@');
+ }
+#endif
else
- CPutStr(CS0, new);
+ CPutStr(D_CS0, new);
}
void
@@ -958,7 +1221,7 @@ char *msg;
if (!display)
return;
- if (!d_tcinited)
+ if (!D_tcinited)
{
debug("tc not inited, just writing msg\n");
AddStr(msg);
@@ -966,19 +1229,19 @@ char *msg;
Flush();
return;
}
- if (!use_hardstatus || !HS)
+ if (!use_hardstatus || !D_HS)
{
- max = d_width;
- if (CLP == 0)
+ max = D_width;
+ if (D_CLP == 0)
max--;
}
else
- max = WS;
- if (d_status)
+ max = D_WS;
+ if (D_status)
{
- if (!d_status_bell)
+ if (!D_status_bell)
{
- ti = time((time_t *) 0) - d_status_time;
+ ti = time((time_t *) 0) - D_status_time;
if (ti < MsgMinWait)
sleep(MsgMinWait - ti);
}
@@ -986,51 +1249,54 @@ char *msg;
}
for (s = t = msg; *s && t - msg < max; ++s)
if (*s == BELL)
- PutStr(BL);
+ PutStr(D_BL);
else if ((unsigned char)*s >= ' ' && *s != 0177)
*t++ = *s;
*t = '\0';
if (t > msg)
{
- if (t - msg >= d_status_buflen)
+ if (t - msg >= D_status_buflen)
{
char *buf;
- if (d_status_lastmsg)
- buf = realloc(d_status_lastmsg, t - msg + 1);
+ if (D_status_lastmsg)
+ buf = realloc(D_status_lastmsg, t - msg + 1);
else
buf = malloc(t - msg + 1);
if (buf)
{
- d_status_lastmsg = buf;
- d_status_buflen = t - msg + 1;
+ D_status_lastmsg = buf;
+ D_status_buflen = t - msg + 1;
}
}
- if (t - msg < d_status_buflen)
- strcpy(d_status_lastmsg, msg);
- d_status = 1;
- d_status_len = t - msg;
- d_status_lastx = d_x;
- d_status_lasty = d_y;
- if (!use_hardstatus || !HS)
+ if (t - msg < D_status_buflen)
+ strcpy(D_status_lastmsg, msg);
+ D_status = 1;
+ D_status_len = t - msg;
+ D_status_lastx = D_x;
+ D_status_lasty = D_y;
+ if (!use_hardstatus || !D_HS)
{
debug1("using STATLINE %d\n", STATLINE);
GotoPos(0, STATLINE);
SetAttrFont(A_SO, ASCII);
InsertMode(0);
AddStr(msg);
- d_x = -1;
+ D_x = -1;
}
else
{
debug("using HS\n");
SetAttrFont(0, ASCII);
InsertMode(0);
- CPutStr(TS, 0);
+ if (D_hstatus)
+ PutStr(D_DS);
+ CPutStr(D_TS, 0);
AddStr(msg);
- PutStr(FS);
+ PutStr(D_FS);
+ D_hstatus = 1;
}
Flush();
- (void) time(&d_status_time);
+ (void) time(&D_status_time);
}
}
@@ -1041,7 +1307,7 @@ RemoveStatus()
if (!display)
return;
- if (!d_status)
+ if (!D_status)
return;
/*
@@ -1064,22 +1330,53 @@ RemoveStatus()
p->w_bell = BELL_DONE;
}
}
- d_status = 0;
- d_status_bell = 0;
- if (!use_hardstatus || !HS)
+ D_status = 0;
+ D_status_bell = 0;
+ if (!use_hardstatus || !D_HS)
{
GotoPos(0, STATLINE);
- RefreshLine(STATLINE, 0, d_status_len - 1, 0);
- GotoPos(d_status_lastx, d_status_lasty);
+ RefreshLine(STATLINE, 0, D_status_len - 1, 0);
+ GotoPos(D_status_lastx, D_status_lasty);
}
else
{
+ /*
SetAttrFont(0, ASCII);
- PutStr(DS);
+ if (D_hstatus)
+ PutStr(D_DS);
+ */
+ RefreshStatus();
}
SetCursor();
}
+/*
+ * Refreshes the harstatus of the _window_. Shouldn't be here...
+ */
+
+void
+RefreshStatus()
+{
+ if (D_HS)
+ {
+ SetAttrFont(0, ASCII);
+ if (D_hstatus)
+ PutStr(D_DS);
+ if (D_fore && D_fore->w_hstatus)
+ {
+ CPutStr(D_TS, 0);
+ if (strlen(D_fore->w_hstatus) > D_WS)
+ AddStrn(D_fore->w_hstatus, D_WS);
+ else
+ AddStr(D_fore->w_hstatus);
+ PutStr(D_FS);
+ D_hstatus = 1;
+ }
+ }
+ else if (D_fore && D_fore->w_hstatus)
+ Msg(0, D_fore->w_hstatus);
+}
+
void
RefreshLine(y, from, to, isblank)
int y, from, to, isblank;
@@ -1087,10 +1384,12 @@ int y, from, to, isblank;
ASSERT(display);
debug2("RefreshLine %d %d", y, from);
debug2(" %d %d\n", to, isblank);
- if (isblank == 0 && CE && to == d_width - 1)
+ if (isblank == 0 && D_CE && to == D_width - 1)
{
GotoPos(from, y);
- PutStr(CE);
+ if (D_attr && D_UT)
+ SetAttr(0);
+ PutStr(D_CE);
isblank = 1;
}
RedisplayLine(y, from, to, isblank);
@@ -1100,13 +1399,13 @@ void
FixLP(x2, y2)
register int x2, y2;
{
- int oldattr = d_attr, oldfont = d_font;
+ int oldattr = D_attr, oldfont = D_font;
ASSERT(display);
GotoPos(x2, y2);
- SetAttrFont(d_lp_attr, d_lp_font);
- PUTCHAR(d_lp_image);
- d_lp_missing = 0;
+ SetAttrFont(D_lp_attr, D_lp_font);
+ PUTCHAR(D_lp_image);
+ D_lp_missing = 0;
SetAttrFont(oldattr, oldfont);
}
@@ -1119,45 +1418,56 @@ register char *os, *oa, *of, *s, *as, *fs;
int last2flag = 0, delete_lp = 0;
ASSERT(display);
- ASSERT(y >= 0 && y < d_height);
- ASSERT(from >= 0 && from < d_width);
- ASSERT(to >= 0 && to < d_width);
- if (!CLP && y == d_bot && to == d_width - 1)
- if (d_lp_missing
+ ASSERT(y >= 0 && y < D_height);
+ ASSERT(from >= 0 && from < D_width);
+ ASSERT(to >= 0 && to < D_width);
+ if (!D_CLP && y == D_bot && to == D_width - 1)
+ if (D_lp_missing
|| s[to] != os[to] || as[to] != oa[to] || of[to] != fs[to])
{
- if ((IC || IM) && from < to)
+ if ((D_IC || D_IM) && from < to)
{
to -= 2;
last2flag = 1;
- d_lp_missing = 0;
+ D_lp_missing = 0;
}
else
{
to--;
- delete_lp = (CE || DC || CDC);
- d_lp_missing = (s[to] != ' ' || as[to] || fs[to]);
- d_lp_image = s[to];
- d_lp_attr = as[to];
- d_lp_font = fs[to];
+ delete_lp = (D_CE || D_DC || D_CDC);
+ D_lp_missing = (s[to] != ' ' || as[to] || fs[to]);
+ D_lp_image = s[to];
+ D_lp_attr = as[to];
+ D_lp_font = fs[to];
}
}
else
to--;
for (x = from; x <= to; ++x)
{
- if (x || d_x != d_width || d_y != y - 1)
+ if (x || D_x != D_width || D_y != y - 1)
{
- if (x < to || x != d_width - 1 || s[x + 1] == ' ')
+ if (x < to || x != D_width - 1 || s[x + 1] == ' ')
if (s[x] == os[x] && as[x] == oa[x] && of[x] == fs[x])
continue;
GotoPos(x, y);
}
+#ifdef KANJI
+ if (badkanji(fs, x))
+ {
+ x--;
+ GotoPos(x, y);
+ }
+#endif
SetAttr(as[x]);
SetFont(fs[x]);
PUTCHAR(s[x]);
+#ifdef KANJI
+ if (fs[x] == KANJI)
+ PUTCHAR(s[++x]);
+#endif
}
- if (to == d_width - 1 && y < d_height - 1 && s[to + 1] == ' ')
+ if (to == D_width - 1 && y < D_height - 1 && s[to + 1] == ' ')
GotoPos(0, y + 1);
if (last2flag)
{
@@ -1172,12 +1482,14 @@ register char *os, *oa, *of, *s, *as, *fs;
}
else if (delete_lp)
{
- if (DC)
- PutStr(DC);
- else if (CDC)
- CPutStr(CDC, 1);
- else if (CE)
- PutStr(CE);
+ if (D_attr && D_UT)
+ SetAttr(0);
+ if (D_DC)
+ PutStr(D_DC);
+ else if (D_CDC)
+ CPutStr(D_CDC, 1);
+ else if (D_CE)
+ PutStr(D_CE);
}
}
@@ -1186,8 +1498,8 @@ SetLastPos(x,y)
int x,y;
{
ASSERT(display);
- d_x = x;
- d_y = y;
+ D_x = x;
+ D_y = y;
}
int
@@ -1196,24 +1508,24 @@ int wi, he;
{
ASSERT(display);
debug2("ResizeDisplay: to (%d,%d).\n", wi, he);
- if (d_width == wi && d_height == he)
+ if (D_width == wi && D_height == he)
{
debug("ResizeDisplay: No change\n");
return 0;
}
- if (CWS)
+ if (D_CWS)
{
debug("ResizeDisplay: using WS\n");
- PutStr(tgoto(CWS, wi, he));
+ PutStr(tgoto(D_CWS, wi, he));
ChangeScreenSize(wi, he, 0);
return 0;
}
- else if (CZ0 && (wi == Z0width || wi == Z1width))
+ else if (D_CZ0 && (wi == Z0width || wi == Z1width))
{
debug("ResizeDisplay: using Z0/Z1\n");
- PutStr(wi == Z0width ? CZ0 : CZ1);
- ChangeScreenSize(wi, d_height, 0);
- return (he == d_height) ? 0 : -1;
+ PutStr(wi == Z0width ? D_CZ0 : D_CZ1);
+ ChangeScreenSize(wi, D_height, 0);
+ return (he == D_height) ? 0 : -1;
}
return -1;
}
@@ -1224,19 +1536,19 @@ int newtop, newbot;
{
if (display == 0)
return;
- if (CS == 0)
+ if (D_CS == 0)
{
- d_top = 0;
- d_bot = d_height - 1;
+ D_top = 0;
+ D_bot = D_height - 1;
return;
}
- if (d_top == newtop && d_bot == newbot)
+ if (D_top == newtop && D_bot == newbot)
return;
debug2("ChangeScrollRegion: (%d - %d)\n", newtop, newbot);
- PutStr(tgoto(CS, newbot, newtop));
- d_top = newtop;
- d_bot = newbot;
- d_y = d_x = -1; /* Just in case... */
+ PutStr(tgoto(D_CS, newbot, newtop));
+ D_top = newtop;
+ D_bot = newbot;
+ D_y = D_x = -1; /* Just in case... */
}
@@ -1254,8 +1566,8 @@ int block;
struct layer *newlay;
RemoveStatus();
- debug3("Entering new layer display %#x d_fore %#x oldlay %#x\n",
- (unsigned int)display, (unsigned int)d_fore, (unsigned int)d_lay);
+ debug3("Entering new layer display %#x D_fore %#x oldlay %#x\n",
+ (unsigned int)display, (unsigned int)D_fore, (unsigned int)D_lay);
if ((newlay = (struct layer *)malloc(sizeof(struct layer))) == 0)
{
Msg(0, "No memory for layer struct");
@@ -1266,23 +1578,23 @@ int block;
{
if ((data = malloc(datasize)) == 0)
{
- free(newlay);
+ free((char *)newlay);
Msg(0, "No memory for layer data");
return(-1);
}
bzero(data, datasize);
}
newlay->l_layfn = lf;
- newlay->l_block = block | d_lay->l_block;
+ newlay->l_block = block | D_lay->l_block;
newlay->l_data = data;
- newlay->l_next = d_lay;
- if (d_fore)
+ newlay->l_next = D_lay;
+ if (D_fore)
{
- d_fore->w_lay = newlay; /* XXX: CHECK */
- d_fore->w_active = 0; /* XXX: CHECK */
+ D_fore->w_lay = newlay; /* XXX: CHECK */
+ D_fore->w_active = 0; /* XXX: CHECK */
}
- d_lay = newlay;
- d_layfn = newlay->l_layfn;
+ D_lay = newlay;
+ D_layfn = newlay->l_layfn;
Restore();
return(0);
}
@@ -1292,16 +1604,16 @@ ExitOverlayPage()
{
struct layer *oldlay;
- debug3("Exiting layer display %#x fore %#x d_lay %#x\n",
- (unsigned int)display, (unsigned int)d_fore, (unsigned int)d_lay);
- oldlay = d_lay;
+ debug3("Exiting layer display %#x fore %#x D_lay %#x\n",
+ (unsigned int)display, (unsigned int)D_fore, (unsigned int)D_lay);
+ oldlay = D_lay;
if (oldlay->l_data)
free(oldlay->l_data);
- d_lay = oldlay->l_next;
- d_layfn = d_lay->l_layfn;
- free(oldlay);
- if (d_fore)
- d_fore->w_lay = d_lay; /* XXX: Is this necessary ? */
+ D_lay = oldlay->l_next;
+ D_layfn = D_lay->l_layfn;
+ free((char *)oldlay);
+ if (D_fore)
+ D_fore->w_lay = D_lay; /* XXX: Is this necessary ? */
Restore();
SetCursor();
}
@@ -1343,24 +1655,24 @@ Flush()
register char *p;
ASSERT(display);
- l = d_obufp - d_obuf;
+ l = D_obufp - D_obuf;
debug1("Flush(): %d\n", l);
- ASSERT(l + d_obuffree == d_obuflen);
+ ASSERT(l + D_obuffree == D_obuflen);
if (l == 0)
return;
- if (d_userfd < 0)
+ if (D_userfd < 0)
{
- d_obuffree += l;
- d_obufp = d_obuf;
+ D_obuffree += l;
+ D_obufp = D_obuf;
return;
}
- p = d_obuf;
- if (fcntl(d_userfd, F_SETFL, 0))
- debug1("Warning: DELAY fcntl failed: %d\n", errno);
+ p = D_obuf;
+ if (fcntl(D_userfd, F_SETFL, 0))
+ debug1("Warning: BLOCK fcntl failed: %d\n", errno);
while (l)
{
register int wr;
- wr = write(d_userfd, p, l);
+ wr = write(D_userfd, p, l);
if (wr <= 0)
{
if (errno == EINTR)
@@ -1368,29 +1680,29 @@ Flush()
debug1("Writing to display: %d\n", errno);
wr = l;
}
- d_obuffree += wr;
+ D_obuffree += wr;
p += wr;
l -= wr;
}
- d_obuffree += l;
- d_obufp = d_obuf;
- if (fcntl(d_userfd, F_SETFL, FNDELAY))
- debug1("Warning: NDELAY fcntl failed: %d\n", errno);
+ D_obuffree += l;
+ D_obufp = D_obuf;
+ if (fcntl(D_userfd, F_SETFL, FNBLOCK))
+ debug1("Warning: NBLOCK fcntl failed: %d\n", errno);
}
void
freetty()
{
- if (d_userfd >= 0)
- close(d_userfd);
- debug1("did freetty %d\n", d_userfd);
- d_userfd = -1;
- d_obufp = 0;
- d_obuffree = 0;
- if (d_obuf)
- free(d_obuf);
- d_obuf = 0;
- d_obuflen = 0;
+ if (D_userfd >= 0)
+ close(D_userfd);
+ debug1("did freetty %d\n", D_userfd);
+ D_userfd = -1;
+ D_obufp = 0;
+ D_obuffree = 0;
+ if (D_obuf)
+ free(D_obuf);
+ D_obuf = 0;
+ D_obuflen = 0;
}
/*
@@ -1404,24 +1716,24 @@ Resize_obuf()
register int ind;
ASSERT(display);
- if (d_obuflen && d_obuf)
+ if (D_obuflen && D_obuf)
{
- ind = d_obufp - d_obuf;
- d_obuflen += GRAIN;
- d_obuffree += GRAIN;
- d_obuf = realloc(d_obuf, d_obuflen);
+ ind = D_obufp - D_obuf;
+ D_obuflen += GRAIN;
+ D_obuffree += GRAIN;
+ D_obuf = realloc(D_obuf, D_obuflen);
}
else
{
ind = 0;
- d_obuflen = GRAIN;
- d_obuffree = GRAIN;
- d_obuf = malloc(d_obuflen);
+ D_obuflen = GRAIN;
+ D_obuffree = GRAIN;
+ D_obuf = malloc(D_obuflen);
}
- if (!d_obuf)
+ if (!D_obuf)
Panic(0, "Out of memory");
- d_obufp = d_obuf + ind;
- debug1("ResizeObuf: resized to %d\n", d_obuflen);
+ D_obufp = D_obuf + ind;
+ debug1("ResizeObuf: resized to %d\n", D_obuflen);
}
#ifdef AUTO_NUKE
@@ -1429,61 +1741,82 @@ void
NukePending()
{/* Nuke pending output in current display, clear screen */
register int len;
- int oldfont = d_font, oldattr = d_attr, oldtop = d_top, oldbot = d_bot;
- int oldkeypad = d_keypad, oldcursorkeys = d_cursorkeys;
+ int oldfont = D_font, oldattr = D_attr, oldtop = D_top, oldbot = D_bot;
+ int oldkeypad = D_keypad, oldcursorkeys = D_cursorkeys;
- len = d_obufp - d_obuf;
+ len = D_obufp - D_obuf;
debug1("NukePending: nuking %d chars\n", len);
/* Throw away any output that we can... */
# ifdef POSIX
- tcflush(d_userfd, TCOFLUSH);
+ tcflush(D_userfd, TCOFLUSH);
# else
# ifdef TCFLSH
- (void) ioctl(d_userfd, TCFLSH, (char *) 1);
+ (void) ioctl(D_userfd, TCFLSH, (char *) 1);
# endif
# endif
- d_obufp = d_obuf;
- d_obuffree += len;
- d_top = d_bot = -1;
- PutStr(TI);
- PutStr(IS);
+ D_obufp = D_obuf;
+ D_obuffree += len;
+ D_top = D_bot = -1;
+ PutStr(D_TI);
+ PutStr(D_IS);
/* Turn off all attributes. (Tim MacKenzie) */
- if (ME)
- PutStr(ME);
+ if (D_ME)
+ PutStr(D_ME);
else
{
- PutStr(SE);
- PutStr(UE);
+ PutStr(D_SE);
+ PutStr(D_UE);
}
/* Check for toggle */
- if (IM && strcmp(IM, EI))
- PutStr(EI);
- d_insert = 0;
+ if (D_IM && strcmp(D_IM, D_EI))
+ PutStr(D_EI);
+ D_insert = 0;
/* Check for toggle */
- if (KS && strcmp(KS, KE))
- PutStr(KE);
- d_keypad = 0;
- if (CCS && strcmp(CCS, CCE))
- PutStr(CCE);
- d_cursorkeys = 0;
- PutStr(CE0);
- d_font = ASCII;
- d_attr = 0;
+#ifndef MAPKEYS
+ if (D_KS && strcmp(D_KS, D_KE))
+ PutStr(D_KE);
+ D_keypad = 0;
+ if (D_CCS && strcmp(D_CCS, D_CCE))
+ PutStr(D_CCE);
+ D_cursorkeys = 0;
+#endif
+ PutStr(D_CE0);
+ D_font = ASCII;
+ D_attr = 0;
+ D_atyp = 0;
+ PutStr(D_DS);
+ D_hstatus = 0;
ChangeScrollRegion(oldtop, oldbot);
SetAttrFont(oldattr, oldfont);
KeypadMode(oldkeypad);
CursorkeysMode(oldcursorkeys);
- if (CWS)
+ if (D_CWS)
{
debug("ResizeDisplay: using WS\n");
- PutStr(tgoto(CWS, d_width, d_height));
+ PutStr(tgoto(D_CWS, D_width, D_height));
}
- else if (CZ0 && (d_width == Z0width || d_width == Z1width))
+ else if (D_CZ0 && (D_width == Z0width || D_width == Z1width))
{
debug("ResizeDisplay: using Z0/Z1\n");
- PutStr(d_width == Z0width ? CZ0 : CZ1);
+ PutStr(D_width == Z0width ? D_CZ0 : D_CZ1);
}
}
#endif /* AUTO_NUKE */
+
+#ifdef KANJI
+int
+badkanji(f, x)
+char *f;
+int x;
+{
+ int i, j;
+ if (f[x] != KANJI)
+ return 0;
+ for (i = j = 0; i < x; i++)
+ if (*f++ == KANJI)
+ j ^= 1;
+ return j;
+}
+#endif
diff --git a/src/display.h b/src/display.h
index 4f89796..7e5daa0 100644
--- a/src/display.h
+++ b/src/display.h
@@ -21,66 +21,106 @@
* $Id$ FAU
*/
+
+#ifdef MAPKEYS
+struct kmap
+{
+ char seq[8];
+ char off[8];
+ int nr;
+};
+
+#define KMAP_SEQ ((int)((struct kmap *)0)->seq)
+#define KMAP_OFF ((int)((struct kmap *)0)->off)
+
+#define KMAP_KEYS (T_OCAPS-T_CAPS)
+#define KMAP_AKEYS (T_OCAPS-T_CURSOR)
+#define KMAP_EXT 10
+
+#define KMAP_NOTIMEOUT 0x4000
+
+#endif
+
struct win; /* forward declaration */
struct display
{
- struct display *_d_next; /* linked list */
- struct user *_d_user; /* user who owns that display */
- struct LayFuncs *_d_layfn; /* current layer functions */
- struct layer *_d_lay; /* layers on the display */
- struct win *_d_fore; /* pointer to fore window */
- struct win *_d_other; /* pointer to other window */
- char _d_termname[20 + 1]; /* $TERM */
- char _d_tentry[TERMCAP_BUFSIZE]; /* buffer for tgetstr */
- int _d_tcinited; /* termcap inited flag */
- int _d_width, _d_height; /* width/height of the screen */
- int _d_defwidth, _d_defheight; /* default width/height of windows */
- int _d_top, _d_bot; /* scrollregion start/end */
- int _d_x, _d_y; /* cursor position */
- char _d_attr; /* current attributes */
- char _d_font; /* current font */
- int _d_insert; /* insert mode flag */
- int _d_keypad; /* application keypad flag */
- int _d_cursorkeys; /* application cursorkeys flag */
- int _d_flow; /* flow control on/off flag*/
- int _d_lp_missing; /* last character on bot line missing */
- int _d_lp_image; /* missing image */
- int _d_lp_attr; /* missing attr */
- int _d_lp_font; /* missing font */
- int _d_status; /* is status displayed? */
- time_t _d_status_time; /* time of status display */
- int _d_status_bell; /* is it only a vbell? */
- int _d_status_len; /* length of status line */
- char *_d_status_lastmsg; /* last displayed message */
- 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_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 */
- struct mode _d_OldMode; /* tty mode when screen was started */
- struct mode _d_NewMode; /* New tty mode */
- char *_d_obuf; /* output buffer */
- int _d_obuflen; /* len of buffer */
- int _d_obufmax; /* len where we are blocking the pty */
- char *_d_obufp; /* pointer in buffer */
- int _d_obuffree; /* free bytes in buffer */
+ struct display *d_next; /* linked list */
+ struct user *d_user; /* user who owns that display */
+ struct LayFuncs *d_layfn; /* current layer functions */
+ struct layer *d_lay; /* layers on the display */
+ struct win *d_fore; /* pointer to fore window */
+ struct win *d_other; /* pointer to other window */
+ char d_nonblock; /* don't block when d_obufmax reached */
+ char d_termname[20 + 1]; /* $TERM */
+ char d_tentry[TERMCAP_BUFSIZE]; /* buffer for tgetstr */
+ char d_tcinited; /* termcap inited flag */
+ int d_width, d_height; /* width/height of the screen */
+ int d_defwidth, d_defheight; /* default width/height of windows */
+ int d_top, d_bot; /* scrollregion start/end */
+ int d_x, d_y; /* cursor position */
+ char d_attr; /* current attributes */
+ char d_atyp; /* current attribute types */
+ char d_font; /* current font */
+#ifdef KANJI
+ int d_mbcs; /* saved char for multibytes charset */
+ int d_kanji; /* what kanji type the display is */
+#endif
+ int d_insert; /* insert mode flag */
+ int d_keypad; /* application keypad flag */
+ int d_cursorkeys; /* application cursorkeys flag */
+ int d_revvid; /* reverse video */
+ int d_curinv; /* cursor invisible */
+ int d_hstatus; /* hardstatus used */
+ int d_lp_missing; /* last character on bot line missing */
+ int d_lp_image; /* missing image */
+ int d_lp_attr; /* missing attr */
+ int d_lp_font; /* missing font */
+ time_t d_status_time; /* time of status display */
+ char d_status; /* is status displayed? */
+ char d_status_bell; /* is it only a vbell? */
+ int d_status_len; /* length of status line */
+ char *d_status_lastmsg; /* last displayed message */
+ 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_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 */
+ 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*/
+ char *d_obuf; /* output buffer */
+ int d_obuflen; /* len of buffer */
+ int d_obufmax; /* len where we are blocking the pty */
+ char *d_obufp; /* pointer in buffer */
+ int d_obuffree; /* free bytes in buffer */
#ifdef AUTO_NUKE
- int _d_auto_nuke; /* autonuke flag */
+ int d_auto_nuke; /* autonuke flag */
+#endif
+#ifdef MAPKEYS
+ int d_nseqs; /* number of valid mappings */
+ char *d_seqp; /* pointer into keymap array */
+ int d_seql; /* number of parsed chars */
+ int d_seqruns; /* number of select calls */
+ int d_dontmap; /* do not map next */
+ int d_mapdefault; /* do map next to default */
+ struct kmap d_kmaps[KMAP_KEYS+KMAP_EXT]; /* keymaps */
#endif
- union tcu _d_tcs[T_N]; /* terminal capabilities */
- char *_d_attrtab[NATTR];
- short _d_dospeed; /* baudrate of tty */
- char _d_c0_tab[256]; /* conversion for C0 */
- int _d_UPcost, _d_DOcost, _d_LEcost, _d_NDcost;
- int _d_CRcost, _d_IMcost, _d_EIcost, _d_NLcost;
+ union tcu d_tcs[T_N]; /* terminal capabilities */
+ char *d_attrtab[NATTR]; /* attrib emulation table */
+ char d_attrtyp[NATTR]; /* attrib group table */
+ short d_dospeed; /* baudrate of tty */
+ char d_c0_tab[256]; /* conversion for C0 */
+ int d_UPcost, d_DOcost, d_LEcost, d_NDcost;
+ int d_CRcost, d_IMcost, d_EIcost, d_NLcost;
+ int d_printfd; /* fd for vt100 print sequence */
#ifdef UTMPOK
- slot_t _d_loginslot; /* offset, where utmp_logintty belongs */
- struct utmp _d_utmp_logintty; /* here the original utmp structure is stored */
+ slot_t d_loginslot; /* offset, where utmp_logintty belongs */
+ struct utmp d_utmp_logintty; /* here the original utmp structure is stored */
# ifdef _SEQUENT_
- char _d_loginhost[100+1];
+ char d_loginhost[100+1];
# endif /* _SEQUENT_ */
#endif
};
@@ -92,80 +132,95 @@ extern struct display TheDisplay;
# define DISPLAY(x) TheDisplay.x
#endif
-#define d_user DISPLAY(_d_user)
-#define d_username (DISPLAY(_d_user) ? DISPLAY(_d_user)->u_name : 0)
-#define d_layfn DISPLAY(_d_layfn)
-#define d_lay DISPLAY(_d_lay)
-#define d_fore DISPLAY(_d_fore)
-#define d_other DISPLAY(_d_other)
-#define d_termname DISPLAY(_d_termname)
-#define d_tentry DISPLAY(_d_tentry)
-#define d_tcinited DISPLAY(_d_tcinited)
-#define d_width DISPLAY(_d_width)
-#define d_height DISPLAY(_d_height)
-#define d_defwidth DISPLAY(_d_defwidth)
-#define d_defheight DISPLAY(_d_defheight)
-#define d_top DISPLAY(_d_top)
-#define d_bot DISPLAY(_d_bot)
-#define d_x DISPLAY(_d_x)
-#define d_y DISPLAY(_d_y)
-#define d_attr DISPLAY(_d_attr)
-#define d_font DISPLAY(_d_font)
-#define d_insert DISPLAY(_d_insert)
-#define d_keypad DISPLAY(_d_keypad)
-#define d_cursorkeys DISPLAY(_d_cursorkeys)
-#define d_flow DISPLAY(_d_flow)
-#define d_lp_missing DISPLAY(_d_lp_missing)
-#define d_lp_image DISPLAY(_d_lp_image)
-#define d_lp_attr DISPLAY(_d_lp_attr)
-#define d_lp_font DISPLAY(_d_lp_font)
-#define d_status DISPLAY(_d_status)
-#define d_status_time DISPLAY(_d_status_time)
-#define d_status_bell DISPLAY(_d_status_bell)
-#define d_status_len DISPLAY(_d_status_len)
-#define d_status_lastmsg DISPLAY(_d_status_lastmsg)
-#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_ESCseen DISPLAY(_d_ESCseen)
-#define d_userpid DISPLAY(_d_userpid)
-#define d_usertty DISPLAY(_d_usertty)
-#define d_userfd DISPLAY(_d_userfd)
-#define d_OldMode DISPLAY(_d_OldMode)
-#define d_NewMode DISPLAY(_d_NewMode)
-#define d_obuf DISPLAY(_d_obuf)
-#define d_obuflen DISPLAY(_d_obuflen)
-#define d_obufmax DISPLAY(_d_obufmax)
-#define d_obufp DISPLAY(_d_obufp)
-#define d_obuffree DISPLAY(_d_obuffree)
-#define d_auto_nuke DISPLAY(_d_auto_nuke)
-#define d_tcs DISPLAY(_d_tcs)
-#define d_attrtab DISPLAY(_d_attrtab)
-#define d_dospeed DISPLAY(_d_dospeed)
-#define d_c0_tab DISPLAY(_d_c0_tab)
-#define d_UPcost DISPLAY(_d_UPcost)
-#define d_DOcost DISPLAY(_d_DOcost)
-#define d_LEcost DISPLAY(_d_LEcost)
-#define d_NDcost DISPLAY(_d_NDcost)
-#define d_CRcost DISPLAY(_d_CRcost)
-#define d_IMcost DISPLAY(_d_IMcost)
-#define d_EIcost DISPLAY(_d_EIcost)
-#define d_NLcost DISPLAY(_d_NLcost)
-#define d_loginslot DISPLAY(_d_loginslot)
-#define d_utmp_logintty DISPLAY(_d_utmp_logintty)
-#define d_loginhost DISPLAY(_d_loginhost)
+#define D_user DISPLAY(d_user)
+#define D_username (DISPLAY(d_user) ? DISPLAY(d_user)->u_name : 0)
+#define D_layfn DISPLAY(d_layfn)
+#define D_lay DISPLAY(d_lay)
+#define D_fore DISPLAY(d_fore)
+#define D_other DISPLAY(d_other)
+#define D_nonblock DISPLAY(d_nonblock)
+#define D_termname DISPLAY(d_termname)
+#define D_tentry DISPLAY(d_tentry)
+#define D_tcinited DISPLAY(d_tcinited)
+#define D_width DISPLAY(d_width)
+#define D_height DISPLAY(d_height)
+#define D_defwidth DISPLAY(d_defwidth)
+#define D_defheight DISPLAY(d_defheight)
+#define D_top DISPLAY(d_top)
+#define D_bot DISPLAY(d_bot)
+#define D_x DISPLAY(d_x)
+#define D_y DISPLAY(d_y)
+#define D_attr DISPLAY(d_attr)
+#define D_atyp DISPLAY(d_atyp)
+#define D_font DISPLAY(d_font)
+#define D_mbcs DISPLAY(d_mbcs)
+#define D_kanji DISPLAY(d_kanji)
+#define D_insert DISPLAY(d_insert)
+#define D_keypad DISPLAY(d_keypad)
+#define D_cursorkeys DISPLAY(d_cursorkeys)
+#define D_revvid DISPLAY(d_revvid)
+#define D_curinv DISPLAY(d_curinv)
+#define D_hstatus DISPLAY(d_hstatus)
+#define D_lp_missing DISPLAY(d_lp_missing)
+#define D_lp_image DISPLAY(d_lp_image)
+#define D_lp_attr DISPLAY(d_lp_attr)
+#define D_lp_font DISPLAY(d_lp_font)
+#define D_status DISPLAY(d_status)
+#define D_status_time DISPLAY(d_status_time)
+#define D_status_bell DISPLAY(d_status_bell)
+#define D_status_len DISPLAY(d_status_len)
+#define D_status_lastmsg DISPLAY(d_status_lastmsg)
+#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_ESCseen DISPLAY(d_ESCseen)
+#define D_userpid DISPLAY(d_userpid)
+#define D_usertty DISPLAY(d_usertty)
+#define D_userfd DISPLAY(d_userfd)
+#define D_OldMode DISPLAY(d_OldMode)
+#define D_NewMode DISPLAY(d_NewMode)
+#define D_flow DISPLAY(d_flow)
+#define D_obuf DISPLAY(d_obuf)
+#define D_obuflen DISPLAY(d_obuflen)
+#define D_obufmax DISPLAY(d_obufmax)
+#define D_obufp DISPLAY(d_obufp)
+#define D_obuffree DISPLAY(d_obuffree)
+#define D_auto_nuke DISPLAY(d_auto_nuke)
+#define D_nseqs DISPLAY(d_nseqs)
+#define D_seqp DISPLAY(d_seqp)
+#define D_seql DISPLAY(d_seql)
+#define D_seqruns DISPLAY(d_seqruns)
+#define D_dontmap DISPLAY(d_dontmap)
+#define D_mapdefault DISPLAY(d_mapdefault)
+#define D_kmaps DISPLAY(d_kmaps)
+#define D_tcs DISPLAY(d_tcs)
+#define D_attrtab DISPLAY(d_attrtab)
+#define D_attrtyp DISPLAY(d_attrtyp)
+#define D_dospeed DISPLAY(d_dospeed)
+#define D_c0_tab DISPLAY(d_c0_tab)
+#define D_UPcost DISPLAY(d_UPcost)
+#define D_DOcost DISPLAY(d_DOcost)
+#define D_LEcost DISPLAY(d_LEcost)
+#define D_NDcost DISPLAY(d_NDcost)
+#define D_CRcost DISPLAY(d_CRcost)
+#define D_IMcost DISPLAY(d_IMcost)
+#define D_EIcost DISPLAY(d_EIcost)
+#define D_NLcost DISPLAY(d_NLcost)
+#define D_printfd DISPLAY(d_printfd)
+#define D_loginslot DISPLAY(d_loginslot)
+#define D_utmp_logintty DISPLAY(d_utmp_logintty)
+#define D_loginhost DISPLAY(d_loginhost)
#define GRAIN 4096 /* Allocation grain size for output buffer */
-#define OBUF_MAX 256
- /* Maximum amount of buffered output before input is blocked */
+#define OBUF_MAX 256 /* default for obuflimit */
#define OUTPUT_BLOCK_SIZE 256 /* Block size of output to tty */
#define AddChar(c) \
{ \
- if (--d_obuffree == 0) \
+ if (--D_obuffree == 0) \
Resize_obuf(); \
- *d_obufp++ = (c); \
+ *D_obufp++ = (c); \
}
diff --git a/src/doc/Makefile.in b/src/doc/Makefile.in
index 8d0ab0f..ac604c1 100644
--- a/src/doc/Makefile.in
+++ b/src/doc/Makefile.in
@@ -4,6 +4,7 @@ srcdir = @srcdir@
VPATH = @srcdir@
prefix = /usr/local
+mandir = $(prefix)/man
infodir = $(prefix)/info
INSTALL = @INSTALL@
@@ -13,7 +14,7 @@ TEXI2DVI = texi2dvi
SHELL = /bin/sh
-all:
+all: screen.info
dvi screen.dvi: screen.texinfo mostlyclean
$(TEXI2DVI) $(srcdir)/screen.texinfo
@@ -21,22 +22,32 @@ dvi screen.dvi: screen.texinfo mostlyclean
info screen.info: screen.texinfo
$(MAKEINFO) $(srcdir)/screen.texinfo -o screen.info
-install: screen.info
- -if test -f foo.info; then d=.; else d=$(srcdir); fi; \
- -for f in $$d/screen.info*; do $(INSTALL_DATA) $$f $(infodir)/$$f;done \
- if install-info --version >/dev/null 2>&1; then \
- install-info --infodir=$(infodir) $$d/foo.info; \
- else true; fi
+install:
+ $(INSTALL_DATA) -c $(srcdir)/screen.1 $(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) -c $$f $(infodir)/$$f;done; \
+ if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+ install-info --infodir=$(infodir) $$d/screen.info; \
+ else true; fi; \
+ fi
uninstall:
+ rm -f $(mandir)/man1/screen.1
rm -f $(infodir)/screen.info*
+installdirs:
+ $(srcdir)/../etc/mkinstalldirs $(mandir)/man1 $(infodir)
+
mostlyclean:
-rm -f *.cp *.cps *.fn *.fns *.ky *.kys *.pg *.tp *.vr
-rm -f *.log *.aux *.toc *~
-clean distclean realclean clobber: mostlyclean
+clean distclean clobber: mostlyclean
-rm -f *.dvi
+
+realclean: clean
-rm -f *.info*
check installcheck:
diff --git a/src/doc/install.sh b/src/doc/install.sh
new file mode 100755
index 0000000..8c07c50
--- /dev/null
+++ b/src/doc/install.sh
@@ -0,0 +1,119 @@
+#! /bin/sh
+
+#
+# install - install a program, script, or datafile
+# This comes from X11R5; it is not part of GNU.
+#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+
+instcmd="$mvprog"
+chmodcmd=""
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+fi
+
+if [ x"$dst" = x ]
+then
+ echo "install: no destination specified"
+ exit 1
+fi
+
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+if [ -d $dst ]
+then
+ dst="$dst"/`basename $src`
+fi
+
+# Make a temp file name in the proper directory.
+
+dstdir=`dirname $dst`
+dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+$doit $instcmd $src $dsttmp
+
+# and set any options; do chmod last to preserve setuid bits
+
+if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
+if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
+if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
+if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
+
+# Now rename the file to the real destination.
+
+$doit $rmcmd $dst
+$doit $mvcmd $dsttmp $dst
+
+
+exit 0
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index 94fd25f..c30f5d5 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -1,4 +1,4 @@
-.TH SCREEN 1 "2 Aug 1993"
+.TH SCREEN 1 "28 Nov 1994"
.if n .ds Q \&"
.if n .ds U \&"
.if t .ds Q ``
@@ -32,17 +32,17 @@ Each virtual terminal provides the functions
of a DEC VT100 terminal and, in addition, several control functions
from the ANSI X3.64 (ISO 6429) 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
+There is a scrollback history buffer for each virtual terminal and a
copy-and-paste mechanism that allows moving text regions between
windows.
-.PP
+.PP
When
.I screen
is called, it creates a single window with a shell in it (or the specified
command) and then gets out of your way so that you can use the program as you
normally would.
Then, at any time, you can create new (full-screen) windows with other programs
-in them (including more shells), kill existing windows, view a list of
+in them (including more shells), kill existing windows, view a list of
windows, turn output logging on and off, copy-and-paste text between
windows, view the scrollback history, switch between windows
in whatever manner you wish, etc.
@@ -67,7 +67,7 @@ This creates a new window running a shell and switches to that
window immediately, regardless of the state of the process running
in the current window.
Similarly, you can create a new window with a custom command in it by
-first binding the command to a keystroke (in your .screenrc file or at the
+first binding the command to a keystroke (in your .screenrc file or at the
\*QC-a :\*U command line) and
then using it just like the \*QC-a c\*U command.
In addition, new windows can be created by running a command like:
@@ -75,9 +75,9 @@ In addition, new windows can be created by running a command like:
screen emacs prog.c
.PP
from a shell prompt within a previously created window.
-This will not run another copy of
+This will not run another copy of
.IR screen ,
-but will instead supply the command name and its arguments to the window
+but will instead supply the command name and its arguments to the window
manager (specified in the $STY environment variable) who will use it to
create the new window.
The above example would start the emacs editor (editing prog.c) and switch
@@ -89,7 +89,7 @@ an appropriate record will be written to this file for each window, and
removed when the window is terminated.
This is useful for working with \*Qtalk\*U, \*Qscript\*U, \*Qshutdown\*U,
\*Qrsend\*U, \*Qsccs\*U and other similar programs that use the utmp
-file to determine who you are. As long as
+file to determine who you are. As long as
.I screen
is active on your terminal,
the terminal's own record is removed from the utmp file. See also \*QC-a L\*U.
@@ -109,7 +109,7 @@ you should remember this one command: \*QC-a ?\*U.
Typing these two characters will display a list of the available
.I screen
commands and their bindings. Each keystroke is discussed in
-the section \*QDEFAULT KEY BINDINGS\*U. The manual section \*QCUSTOMIZATION\*U
+the section \*QDEFAULT KEY BINDINGS\*U. The manual section \*QCUSTOMIZATION\*U
deals with the contents of your .screenrc.
.PP
If possible, choose a version of your terminal's termcap that has automatic
@@ -117,7 +117,7 @@ margins turned \fIoff\fP.
This will ensure an accurate and optimal update of the screen
in all circumstances.
The next best thing is an auto-margin terminal that allows the last position
-on the screen to be updated without scrolling the screen (such as a vt100).
+on the screen to be updated without scrolling the screen (such as a VT100).
This also allows the entire screen to be updated.
Lastly, if all you've got is a \*Qtrue\*U auto-margin terminal
.I screen
@@ -147,7 +147,7 @@ flag `OP' in your termcap entry, or by specifying the
command-line option.
The trade-off is that
.I screen
-will no-longer accurately emulate the vt100's line-end quirks (e.\|g. the
+will no-longer accurately emulate the VT100's line-end quirks (e.\|g. the
screen will scroll after putting \fIone\fP character in the last screen
position).
@@ -162,11 +162,11 @@ window's termcap, even if
must redraw parts of the display in order to implement a function.
.TP 5
.B \-A
-Adapt the sizes of all windows to the size of the current terminal.
+Adapt the sizes of all windows to the size of the current terminal.
By default,
.I screen
-tries to restore its old window sizes when attaching to resizeable terminals
-(those with \*QWS\*U in its description, e.g. suncmd or some xterm).
+tries to restore its old window sizes when attaching to resizable terminals
+(those with \*QWS\*U in its description, e.g. suncmd or some xterm).
.TP 5
.BI "\-c " file
override the default configuration file from \*Q$HOME/.screenrc\*U
@@ -175,14 +175,14 @@ to \fIfile\fP.
.BR \-d | \-D " [" \fIpid.tty.host ]
does not start
.IR screen ,
-but detaches the elsewhere running
+but detaches the elsewhere running
.I screen
-session. It has the same effect as typing \*QC-a d\*U from
+session. It has the same effect as typing \*QC-a d\*U from
.I screen's
controlling terminal. \fB\-D\fP is the equivalent to the power detach key.
-If no session can be detached, this option is ignored.
-The combination \*Qscreen \-D \-r\*U can be used to `transport' the elsewhere
-running session to this terminal and logout there.
+If no session can be detached, this option is ignored.
+The combination \*Qscreen \-D \-r\*U can be used to `transport' the elsewhere
+running session to this terminal and logout there.
Note: It is a good idea to have the status of your sessions checked by means of
\*Qscreen \-list\*U.
.TP 5
@@ -190,7 +190,14 @@ Note: It is a good idea to have the status of your sessions checked by means of
specifies the command character to be \fIx\fP and the character generating a
literal command character to \fIy\fP (when typed after the command character).
The default is \*QC-a\*U and `a', which can be specified as \*Q-e^Aa\*U.
-See the \*Qescape\*U .screenrc command for more details.
+When creating a
+.I screen
+session, this option sets the default command character. In a multiuser
+session all users added will start off with this command character. But
+when attaching to an already running session, this option changes only
+the command character of the attaching user.
+This option is equivalent to either the commands \*Qdefescape\*U or
+\*Qescape\*U respectively.
.TP 5
.BR \-f\fP ", " \-fn ", and " \-fa
turns flow-control on, off, or \*Qautomatic switching mode\*U.
@@ -214,16 +221,16 @@ does not start
.IR screen ,
but prints a list of
.I pid.tty.host
-strings identifying your
+strings identifying your
.I screen
sessions.
-Sessions marked `detached' can be resumed with \*Qscreen -r\*U. Those marked
+Sessions marked `detached' can be resumed with \*Qscreen -r\*U. Those marked
`attached' are running and have a controlling terminal. Sessions marked as
`dead' should be thoroughly checked and removed. Ask your system administrator
if you are not sure. Remove sessions with the \fB-wipe\fP option.
.TP 5
.B \-L
-tells
+tells
.I screen
your auto-margin terminal has a writable last-position on
the screen.
@@ -231,17 +238,17 @@ This can also be set in your .screenrc by specifying `LP' in a \*Qtermcap\*U
command.
.TP 5
.B \-m
-causes
+causes
.I screen
to ignore the $STY environment variable. With \*Qscreen -m\*U creation of
-a new session is enforced, regardless whether
+a new session is enforced, regardless whether
.I screen
-is called from within another
+is called from within another
.I screen
session or not.
.TP 5
.B \-O
-selects a more optimal output mode for your terminal rather than true vt100
+selects a more optimal output mode for your terminal rather than true VT100
emulation (only affects auto-margin terminals without `LP').
This can also be set in your .screenrc by specifying `OP' in a \*Qtermcap\*U
command.
@@ -257,15 +264,16 @@ may be needed to distinguish between multiple detached
sessions.
.TP 5
.B \-R
-attempts to resume the first detached
+attempts to resume the first detached
.I screen
session it finds.
If successful, all other command-line options are ignored.
If no detached session exists, starts a new session using the specified
options, just as if
.B \-R
-had not been specified. The option is set by default if screen is run as
-a login-shell.
+had not been specified. The option is set by default if
+.I screen
+is run as a login-shell.
.TP 5
.B \-s
sets the default shell to the program specified, instead of the value
@@ -275,7 +283,7 @@ This can also be defined through the \*Qshell\*U .screenrc command.
.BI "\-S " sessionname
When creating a new session, this option can be used to specify a
meaningful name for the session. This name identifies the session for
-\*Qscreen -list\*U and \*Qscreen -r\*U actions. It substitutes the
+\*Qscreen -list\*U and \*Qscreen -r\*U actions. It substitutes the
default [\fItty.host\fP] suffix.
.TP 5
.BI "\-t " name
@@ -286,11 +294,13 @@ See also the \*Qshelltitle\*U .screenrc command.
Print version number.
.TP 5
.B \-wipe
-does the same as \*Qscreen -ls\*U, but removes destroyed sessions instead of
+does the same as \*Qscreen -ls\*U, but removes destroyed sessions instead of
marking them as `dead'.
.TP 5
.B \-x
-Attach to a not detached screen session. (Multi display mode).
+Attach to a not detached
+.I screen
+session. (Multi display mode).
.SH "DEFAULT KEY BINDINGS"
@@ -302,7 +312,7 @@ command consists of a
For your convenience, all commands that are bound to lower-case letters are
also bound to their control character counterparts (with the exception
of \*QC-a a\*U; see below), thus, \*QC-a c\*U as well as \*QC-a C-c\*U can
-be used to create a window. See section \*QCUSTOMIZATION\*U for a description
+be used to create a window. See section \*QCUSTOMIZATION\*U for a description
of the command.
.PP
.TP 26n
@@ -320,7 +330,7 @@ Prompt for a window name or number to switch to.
Switch to window number 0 \- 9.
.IP "\fBC-a C-a\fP (other)"
Toggle to the window displayed previously.
-Note that this binding defaults to the command character typed twice,
+Note that this binding defaults to the command character typed twice,
unless overridden; for instance, if you use the option \*Q\fB\-e]x\fP\*U,
this function becomes \*Q]]\*U, not \*Q]C-a\*U.
.IP "\fBC-a a\fP (meta)"
@@ -356,9 +366,9 @@ Detach and logout.
.PD
Toggle flow \fIon\fP, \fIoff\fP or \fIauto\fP.
.IP "\fBC-a C-g\fP (vbell)"
-Toggles
+Toggles
.I screen's
-visual bell mode.
+visual bell mode.
.IP "\fBC-a h\fP (hardcopy)"
.PD
Write a hardcopy of the current window to the file \*Qhardcopy.\fIn\fP\*U.
@@ -380,7 +390,7 @@ Destroy current window.
.PD
Fully refresh current window.
.IP "\fBC-a L\fP (login)"
-Toggle this windows login slot. Available only if
+Toggle this windows login slot. Available only if
.I screen
is configured to update the utmp database.
.IP "\fBC-a m\fP"
@@ -448,7 +458,8 @@ Lock this terminal.
.IP "\fBC-a C-z\fP (suspend)"
.PD
Suspend
-.IR screen . Your system must support BSD-style job-control.
+.IR screen .
+Your system must support BSD-style job-control.
.IP "\fBC-a Z\fP (reset)"
Reset the virtual terminal to its \*Qpower-on\*U values.
.IP "\fBC-a .\fP (dumptermcap)"
@@ -465,24 +476,26 @@ Enter command line mode.
.IP "\fBC-a C-[\fP"
.IP "\fBC-a esc\fP (copy)"
.PD
-Enter copy/scrollback mode.
-.IP "\fBC-a ]\fP (paste)"
+Enter copy/scrollback mode.
+.IP "\fBC-a ]\fP (paste .)"
.PD
Write the contents of the paste buffer to the stdin queue of the
-current window.
+current window.
.IP "\fBC-a {\fP
.PD 0
.IP "\fBC-a }\fP (history)"
.PD
Copy and paste a previous (command) line.
.IP "\fBC-a >\fP (writebuf)"
-Write pastebuffer to a file.
+Write paste buffer to a file.
.IP "\fBC-a <\fP (readbuf)"
-Reads the screen-exchange file into the pastebuffer.
+Reads the screen-exchange file into the paste buffer.
.IP "\fBC-a =\fP (removebuf)"
Removes the file used by \fBC-a <\fP and \fPC-a >\fP.
.IP "\fBC-a ,\fP (license)"
-Shows where screen comes from, where it went to and why you can use it.
+Shows where
+.I screen
+comes from, where it went to and why you can use it.
.IP "\fBC-a _\fP (silence)"
Start/stop monitoring the current window for inactivity.
@@ -492,7 +505,9 @@ The \*Qsocket directory\*U defaults either to $HOME/.screen or simply to
/tmp/screens or preferably to /usr/local/screens chosen at compile-time. If
.I screen
is installed setuid-root, then the administrator
-should compile screen with an adequate (not NFS mounted) socket directory. If
+should compile
+.I screen
+with an adequate (not NFS mounted) socket directory. If
.I screen
is not running setuid-root, the user can specify any mode 777 directory
in the environment variable $SCREENDIR.
@@ -502,8 +517,8 @@ When
is invoked, it executes initialization commands from the files
\*Q/usr/local/etc/screenrc\*U and
\*Q.screenrc\*U in the user's home directory. These are the \*Qprogrammer's
-defaults\*U that can be overridden in the following ways: For the
-global screenrc file
+defaults\*U that can be overridden in the following ways: for the
+global screenrc file
.I screen
searches for the environment variable $SYSSCREENRC (this override feature
may be disabled at compile-time). The user specific
@@ -521,9 +536,9 @@ A command's arguments are separated by tabs or spaces, and may be
surrounded by single or double quotes.
A `#' turns the rest of the line into a comment, except in quotes.
Unintelligible lines are warned about and ignored.
-Commands may contain references to environment variables. The
-syntax is the shell-like "$VAR " or "${VAR}". Note that this causes
-incompatibility with previous
+Commands may contain references to environment variables. The
+syntax is the shell-like "$VAR " or "${VAR}". Note that this causes
+incompatibility with previous
.I screen
versions, as now the '$'-character has to be protected with '\e' if no
variable substitution shall be performed. A string in single-quotes is also
@@ -534,32 +549,47 @@ Customization can also be done 'on-line'. To enter the command mode type
while others change current settings.
.PP
The following commands are available:
-.sp
+.sp
.ne 3
-.BI acladd " username"
+.BI acladd " usernames"
.PP
-Enable a user to (fully) access this screen session. Necessary to allow other
-users to attach to this
+Enable users to fully access this screen session. \fIUsernames\fP can be one
+user or a comma seperated list of users. This command enables to attach to the
.I screen
-session. Same as `aclchg \fIusername\fP +rwx \&"#?\&"'. Multi user mode only.
-.sp
+session and performs the equivalent of `aclchg \fIusernames\fP +rwx \&"#?\&"'.
+executed. To add a user with restricted access, use the `aclchg' command below.
+Multi user mode only.
+.sp
.ne 3
-.BI aclchg " username permbits list"
-.PP
-Change a users permissions. Permission bits are represented as `r', `w' and `x'.
-Prefixing `+' grants the permission, `-' removes it. The third parameter is a
-komma seperated list of commands or windows (specified either by number or
-title). The special list `#' refers to all windows, `?' to all commands.
-A Command can be executed when the user has the `x' bit for it.
-The user can type input to a window, when he has its `w' bit set and no other
-user obtains a writelock for this window. Other bits are currently ignored.
+.BI aclchg " usernames permbits list"
+.PP
+Change permissions for a comma seperated list of users. Permission bits are
+represented as `r', `w' and `x'. Prefixing `+' grants the permission, `-'
+removes it. The third parameter is a comma seperated list of commands and/or
+windows (specified either by number or title). The special list `#' refers to
+all windows, `?' to all commands. if \fIusernames\fP consists of a single `*',
+all known users are affected.
+A command can be executed when the user has the `x' bit for it.
+The user can type input to a window when he has its `w' bit set and no other
+user obtains a writelock for this window.
+Other bits are currently ignored.
+To withdraw the writelock from another user in window 2:
+`aclchg \fIusername\fP -w+w 2'.
+To allow readonly access to the session: `aclchg \fIusername\fP
+-w \&"#\&"'. As soon as a user's name is known to
+.I screen
+he can attach to the session and (per default) has full permissions for all
+command and windows. Execution permission for the acl commands, `at' and others
+should also be removed or the user may be able to regain write permission.
Multi user mode only.
.sp
.ne 3
.BI acldel " username"
.PP
-Remove a user from screens access control list. If currently attached, all the
-users displays are detached from the session. He cannot attach again.
+Remove a user from
+.IR screen 's
+access control list. If currently attached, all the
+user's displays are detached from the session. He cannot attach again.
Multi user mode only.
.sp
.ne 3
@@ -585,9 +615,11 @@ by use of the \*Qmonitor\*U command (C-a M).
.BR "allpartial on" | off
.PP
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
+This affects all windows and is useful for slow terminal lines. The
previous setting of full/partial refresh for each window is restored
-with \*Qallpartial off\*U.
+with \*Qallpartial off\*U. This is a global flag that immediately takes effect
+on all windows overriding the \*Qpartial\*U settings. It does not change the
+default redraw behaviour of newly created windows.
.sp
.ne 3
.BR "at " "[\fIidentifier\fP][" "#\fP|\fP*\fP|\fP%\fP] "
@@ -595,29 +627,30 @@ with \*Qallpartial off\*U.
.PP
Execute a command at other displays or windows as if it had been entered there.
\*QAt\*U changes the context (the `current window' or `current display'
-setting) of the command. If the first parameter describes a
-non-unique context, the command will be executed multiple times. If the first
+setting) of the command. If the first parameter describes a
+non-unique context, the command will be executed multiple times. If the first
parameter is of the form `\fIidentifier\fP*' then identifier is matched against
-user names. The command is executed once for each display of the selected
-user(s). If the first parameter is of the form `\fIidentifier\fP%' identifier
-is matched against displays. Displays are named after the ttys they
-attach. The prefix `/dev/' or `/dev/tty' may be ommited from the identifier.
-If \fIidentifier\fP has a `#' or nothing appended it is matched against
-window numbers and titles. Omitting an identifier in front of the `#', `*' or
+user names. The command is executed once for each display of the selected
+user(s). If the first parameter is of the form `\fIidentifier\fP%' identifier
+is matched against displays. Displays are named after the ttys they
+attach. The prefix `/dev/' or `/dev/tty' may be omitted from the identifier.
+If \fIidentifier\fP has a `#' or nothing appended it is matched against
+window numbers and titles. Omitting an identifier in front of the `#', `*' or
`%'-character selects all users, displays or windows because a prefix-match is
performed. Note that on the affected display(s) a short message will describe
-what happened.
+what happened. Caution: Permission is checked for the owners or the
+affected display(s), not for the initiator of the `at' command.
.sp
.ne 3
.BR "autodetach on" | off
.PP
-Sets whether
+Sets whether
.I screen
will automatically detach upon hangup, which
saves all your running programs until they are resumed with a
.B "screen -r"
command.
-When turned off, a hangup signal will terminate
+When turned off, a hangup signal will terminate
.I screen
and all the processes it contains. Autodetach is on by default.
.sp
@@ -648,7 +681,7 @@ An empty message can be supplied to the \*Qbell\*U command to suppress
output of a message line (bell "").
.sp
.ne 3
-.BI "bind " key
+.BI "bind " key
.RI [ command " [" args ]]
.PP
Bind a command to a key.
@@ -685,6 +718,90 @@ that creates an non-login window with a.\|k.\|a. \*Qroot\*U in slot #9, with
a super-user shell and a scrollback buffer of 1000 lines.
.sp
.ne 3
+.B bindkey
+.RB [ -d ]
+.RB [ -m ]
+.RB [ -a ]
+.RB [[ -k | -t ]
+.I string
+.RI [ "cmd args" ]]
+.PP
+This command manages screen's input translation tables. Every
+entry in one of the tables tells screen how to react if a certain
+sequence of characters is encountered. There are three tables:
+one that should contain actions programmed by the user, one for
+the default actions used for terminal emulation and one for
+screen's copy mode to do cursor movement. See section
+\*QINPUT TRANSLATION\*U for a list of default key bindings.
+.br
+If the
+.B -d
+option is given, bindkey modifies the default table,
+.B -m
+changes the copy mode table
+and with neither option the user table is selected.
+The argument
+.I string
+is the sequence of characters to which an action is bound. This
+can either be a fixed string or a termcap keyboard capability
+name (selectable with the
+.B -k
+option).
+.br
+Some keys on a VT100 terminal can send a different
+string if application mode is turned on (e.g the cursor keys).
+Such keys have two entries in the translation table. You can
+select the application mode entry by specifying the
+.B -a
+option.
+.br
+The
+.B -t
+option tells screen not to do intercharacter timing. One cannot
+turn off the timing if a termcap capabilty is used.
+.br
+.I Cmd
+can be any of screen's commands with an arbitrary number of
+.IR args .
+If
+.I cmd
+is omitted the keybinding is removed from the table.
+.br
+Here are some examples of keyboard bindings:
+.sp
+.nf
+ bindkey -d
+.fi
+Show all of the default key bindings. The application mode entries
+are marked with [A].
+.sp
+.nf
+ bindkey -k k1 select 1
+.fi
+Make the "F1" key switch to window one.
+.sp
+.nf
+ bindkey -t foo stuff barfoo
+.fi
+Make "foo" an abrevation of the word "barfoo". Timeout is disabled
+so that users can type slowly.
+.sp
+.nf
+ bindkey "\e024" mapdefault
+.fi
+This keybinding makes \*Q^T\*U an escape character for keybindings. If
+you did the above \*Qstuff barfoo\*U binding, you can enter the word
+\*Qfoo\*U by typing \*Q^Tfoo\*U. If you want to insert a \*Q^T\*U
+you have to press the key twice (i.e. escape the escape binding).
+.sp
+.nf
+ bindkey -k F1 command
+.fi
+Make the F11 (not F1!) key an alternative screen
+escape (besides ^A). Note that \*QF11 F11\*U does not work in
+the current release of screen.
+.sp
+.ne 3
.B break
.RI [ duration ]
.PP
@@ -696,11 +813,13 @@ attached to the window rather than a shell process.
.B bufferfile
.RI [ exchange-file ]
.PP
-Change the filename used for reading and writing with the copybuffer.
-If the optional argument to the \*Qbufferfile\*U command is omitted,
+Change the filename used for reading and writing with the paste buffer.
+If the optional argument to the \*Qbufferfile\*U command is omitted,
the default setting (\*Q/tmp/screen-exchange\*U) is reactivated.
-The following example will paste the system's password file into
-the screen window:
+The following example will paste the system's password file into
+the
+.I screen
+window (using the paste buffer, where a copy remains):
.PP
.nf
C-a : bufferfile /etc/passwd
@@ -709,6 +828,17 @@ the screen window:
.fi
.sp
.ne 3
+.BR "c1 " [ on | off ]
+.PP
+Change c1 code processing. \*QC1 on\*U 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 \*Qdefc1\*U command.
+Users with fonts that have usable characters in the
+c1 positions may want to turn this off.
+.sp
+.ne 3
.B chdir
.RI [ directory ]
.PP
@@ -737,17 +867,24 @@ Clears the current window and saves its image to the scrollback buffer.
.ne 3
.B colon
.PP
-Allows you to enter \*Q.screenrc\*U command lines. Useful
-for on-the-fly modification of key bindings,
+Allows you to enter \*Q.screenrc\*U command lines. Useful
+for on-the-fly modification of key bindings,
specific window creation and changing settings. Note that the \*Qset\*U
-keyword no longer exists! Usually commands affect the current window rather
+keyword no longer exists! Usually commands affect the current window rather
than default settings for future windows. Change defaults with commands
-starting with 'def...'.
+starting with 'def...'.
-If you consider this as the `Ex command mode' of
+If you consider this as the `Ex command mode' of
.IR screen ,
you may regard \*QC-a esc\*U (copy mode) as its `Vi command mode'.
-.sp
+.sp
+.ne 3
+.B command
+.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.
+.sp
.ne 3
.BR "console " [ on | off ]
.PP
@@ -764,7 +901,7 @@ window and its history into the paste buffer. In this mode a vi-like
.br
.in +4n
.ti -2n
-\fBh\fP, \fBj\fP, \fBk\fP, \fBl\fP move the cursor line by line or
+\fBh\fP, \fBj\fP, \fBk\fP, \fBl\fP move the cursor line by line or
column by column.
.br
.ti -2n
@@ -773,23 +910,23 @@ non-whitespace character on the line.
.br
.ti -2n
\fBH\fP, \fBM\fP and \fBL\fP move the cursor to the leftmost column
-of the top, center or bottom line of the window.
+of the top, center or bottom line of the window.
.br
.ti -2n
\fB+\fP and \fB\-\fP positions one line up and down.
.br
.ti -2n
\fBG\fP moves to the specified absolute line (default: end of buffer).
-.br
+.br
.ti -2n
\fB|\fP moves to the specified absolute column.
.br
.ti -2n
\fBw\fP, \fBb\fP, \fBe\fP move the cursor word by word.
-.br
+.br
.ti -2n
-\fBC-u\fP and \fBC-d\fP scroll the display up/down by the specified amount of
-lines while preserving the cursor position. (Default: half screen-full).
+\fBC-u\fP and \fBC-d\fP scroll the display up/down by the specified amount of
+lines while preserving the cursor position. (Default: half screen-full).
.br
.ti -2n
\fBC-b\fP and \fBC-f\fP scroll the display up/down a full screen.
@@ -804,40 +941,40 @@ lines while preserving the cursor position. (Default: half screen-full).
.IR Note :
.br
-Emacs style movement keys can be customized by a .screenrc command.
-(E.\|g. markkeys "h=^B:l=^F:$=^E") There is no simple method for a full
+Emacs style movement keys can be customized by a .screenrc command.
+(E.\|g. markkeys "h=^B:l=^F:$=^E") There is no simple method for a full
emacs-style keymap, as this involves multi-character codes.
.br
.ti -4n
.IR Marking :
.br
-The copy range is specified by setting two marks. The text between these marks
-will be highlighted. Press
+The copy range is specified by setting two marks. The text between these marks
+will be highlighted. Press
.br
.ti -2n
\fBspace\fP to set the first or second mark
respectively.
.br
.ti -2n
-\fBY\fP and \fBy\fP used to mark one whole line or to mark from
+\fBY\fP and \fBy\fP used to mark one whole line or to mark from
start of line.
.br
.ti -2n
-\fBW\fP marks exactly one word.
-.br
+\fBW\fP marks exactly one word.
+.br
.ti -4n
.IR "Repeat count" :
.br
-Any of these commands can be prefixed with a repeat count number by pressing
-digits
+Any of these commands can be prefixed with a repeat count number by pressing
+digits
.br
.ti -2n
\fB0\fP..\fB9\fP which
-is taken as a repeat count.
+is taken as a repeat count.
.br
Example: \*QC-a C-[ H 10 j 5 Y\*U will copy lines
-11 to 15 into the pastebuffer.
+11 to 15 into the paste buffer.
.br
.ti -4n
.IR Searching :
@@ -845,7 +982,7 @@ Example: \*QC-a C-[ H 10 j 5 Y\*U will copy lines
\fB/\fP \fIVi\fP-like search forward.
.ti -2n
\fB?\fP \fIVi\fP-like search backward.
-.ti -2n
+.ti -2n
\fBC-a s\fP \fIEmacs\fP style incremental search forward.
.ti -2n
\fBC-r\fP \fIEmacs\fP style reverse i-search.
@@ -857,49 +994,49 @@ There are however some keys that act differently than in
.I Vi
does not allow one to yank rectangular blocks of text, but
.I screen
-does. Press
+does. Press
.br
.ti -2n
\fBc\fP or \fBC\fP to set the left or right margin respectively. If no repeat count is
-given, both default to the current cursor position.
+given, both default to the current cursor position.
.br
-Example: Try this on a rather full text screen:
+Example: Try this on a rather full text screen:
\*QC-a [ M 20 l SPACE c 10 l 5 j C SPACE\*U.
This moves one to the middle line of the screen, moves in 20 columns left,
-marks the beginning of the copybuffer, sets the left column, moves 5 columns
+marks the beginning of the paste buffer, sets the left column, moves 5 columns
down, sets the right column, and then marks the end of
-the copybuffer. Now try:
+the paste buffer. Now try:
.br
\*QC-a [ M 20 l SPACE 10 l 5 j SPACE\*U
and notice the difference in the amount of text copied.
.br
.ti -2n
-\fBJ\fP joins lines. It toggles between
+\fBJ\fP joins lines. It toggles between
3 modes: lines separated by a newline character (012), lines glued seamless,
lines separated by a single whitespace. Note that you can prepend the newline
character with a carriage return character, by issuing a \*Qcrlf on\*U.
.br
.ti -2n
\fBv\fP is for all the
-.I vi
+.I vi
users with \*Q:set numbers\*U \- it toggles the left margin between column 9
-and 1. Press
+and 1. Press
.br
.ti -2n
\fBa\fP before the final space key to toggle in append mode. Thus
-the contents of the pastebuffer will not be overwritten, but is appended to.
+the contents of the paste buffer will not be overwritten, but is appended to.
.br
.ti -2n
\fBA\fP toggles in append mode and sets a (second) mark.
.br
.ti -2n
-\fB>\fP sets the (second) mark and writes the contents of the copybuffer to
-the screen-exchange file (/tmp/screen-exchange per default) once copy-mode is
-finished.
+\fB>\fP 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.
.br
-This example demonstrates how to dump the whole scrollback buffer
+This example demonstrates how to dump the whole scrollback buffer
to that file: \*QC-A [ g SPACE G $ >\*U.
.br
.ti -2n
@@ -913,48 +1050,74 @@ to that file: \*QC-A [ g SPACE G $ >\*U.
.B copy_reg
.RI [ key ]
.PP
-Store the current copybuffer contents in a register referenced by \fIkey\fP.
-If the name is omitted you will be prompted to press the key.
+No longer exists, use \*Qreadreg\*U instead.
.sp
.ne 3
.BR "crlf on" | off
.PP
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 sequence `CR' - `LF'.
+to `on', lines will be separated by the two character sequence `CR' - `LF'.
Otherwise (default) only `LF' is used.
.sp
.ne 3
.BR "debug on" | off
.PP
-Turns runtime debugging on or off. If
+Turns runtime debugging on or off. If
.I screen
-has been compiled with option -DDEBUG debugging available and is turned on per
-default. Note that this command only affects debugging output from the main
-\*QSCREEN\*U process.
+has been compiled with option -DDEBUG debugging available and is turned on per
+default. Note that this command only affects debugging output from the main
+\*QSCREEN\*U process.
+.sp
+.ne 3
+.BR "defc1 on" | off
+.PP
+Same as the \fBc1\fP command except that the default setting for new
+windows is changed. Initial setting is `on'.
.sp
.ne 3
.BR "defautonuke on" | off
.PP
Same as the \fBautonuke\fP command except that the default setting for new displays is changed. Initial setting is `off'.
-Note that you can use the special 'AN' terminal capability if you
+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 "defflow on" | off | auto
+.BI "defescape " xy
+.PP
+Set the default command characters. This is equivalent to the
+\*Qescape\*U except that it is useful multiuser sessions only. In a
+multiuser session \*Qescape\*U changes the command character of the
+calling user, where \*Qdefescape\*U changes the default command
+characters for users that will be added later.
+.sp
+.ne 3
+.BR "defflow on" | off | auto
.RB [ interrupt ]
.PP
-Same as the \fBflow\fP command except that the default setting for new windows
+Same as the \fBflow\fP command except that the default setting for new windows
is changed. Initial setting is `auto'.
Specifying \*Qdefflow auto interrupt\*U is the same as the command-line options
.B \-fa
and
-.BR \-i .
+.BR \-i .
+.sp
+.ne 3
+.BR "defgr on" | off
+.PP
+Same as the \fBgr\fP command except that the default setting for new
+windows is changed. Initial setting is `off'.
+.sp
+.ne 3
+.BR "defkanji jis" | sjis | euc
+.PP
+Same as the \fBkanji\fP command except that the default setting for new
+windows is changed. Initial setting is `off', i.e. `jis'.
.sp
.ne 3
.BR "deflogin on" | off
.PP
-Same as the \fBlogin\fP command except that the default setting for new windows
-is changed. This is initialised with `on' as distributed (see config.h.in).
+Same as the \fBlogin\fP command except that the default setting for new windows
+is changed. This is initialized with `on' as distributed (see config.h.in).
.sp
.ne 3
.BI "defmode " mode
@@ -966,7 +1129,7 @@ When no \*Qdefmode\*U command is given, mode 0622 is used.
.ne 3
.BR "defmonitor on" | off
.PP
-Same as the \fBmonitor\fP command except that the default setting for new
+Same as the \fBmonitor\fP command except that the default setting for new
windows is changed. Initial setting is `off'.
.sp
.ne 3
@@ -979,20 +1142,32 @@ want to have a dependency on the terminal type.
.ne 3
.BI "defscrollback " num
.PP
-Same as the \fBscrollback\fP command except that the default setting for new
+Same as the \fBscrollback\fP command except that the default setting for new
windows is changed. Initial setting is 100.
.sp
.ne 3
.BR "defwrap on" | off
.PP
-Same as the \fBwrap\fP command except that the default setting for new
-windows is changed. Initially line-wrap is on and can be toggled with the
+Same as the \fBwrap\fP command except that the default setting for new
+windows is changed. Initially line-wrap is on and can be toggled with the
\*Qwrap\*U command (\*QC-a r\*U) or by means of "C-a : wrap on|off".
.sp
.ne 3
+.BR "defwritelock on" | off | auto
+.PP
+Same as the \fBwritelock\fP command except that the default setting for new
+windows is changed. Initially writelocks will operate in automatic mode.
+.sp
+.ne 3
+.BR "defzombie " [\fIkeys\fP]
+.PP
+Synonym to the \fBzombie\fP command. Both currently change the default.
+See there.
+.sp
+.ne 3
.B detach
.PP
-Detach the
+Detach the
.I screen
session (disconnect it from the terminal and put it into the background).
This returns you to the shell where you invoked
@@ -1009,24 +1184,24 @@ option. (See also section \*QCOMMAND-LINE OPTIONS\*U.)
.B dumptermcap
.PP
Write the termcap entry for the virtual terminal optimized for the currently
-active window to the file \*Q.termcap\*U in the user's
-\*Q$HOME/.screen\*U directory (or wherever
+active window to the file \*Q.termcap\*U in the user's
+\*Q$HOME/.screen\*U directory (or wherever
.I screen
stores its sockets. See the \*QFILES\*U section below).
This termcap entry is identical to the value of the environment variable
$TERMCAP that is set up by
.I screen
for each window. For terminfo based systems you will need to run a converter
-like
+like
.IR captoinfo
-and then compile the entry with
+and then compile the entry with
.IR tic .
.sp
.ne 3
.BR "echo " [ -n ]
.I message
.PP
-The echo command may be used to annoy
+The echo command may be used to annoy
.I screen
users with a 'message of the
day'. Typically installed in a global /local/etc/screenrc. See also
@@ -1049,16 +1224,18 @@ The default is \*Q^Aa\*U.
.RI [[ fdpat ]
.IR "newcommand " [ "args ..." ]]
.PP
-Run a subprocess (newcommand) in the current window. The flow of data between
-newcommands stdin/stdout/stderr, the process already running (shell) and
+Run a subprocess (newcommand) in the current window. The flow of data between
+newcommand's stdin/stdout/stderr, the process already running (shell) and
screen itself (window) is controlled by the filedescriptor pattern fdpat.
This pattern is basically a three character sequence representing stdin, stdout
and stderr of newcommand. A dot (.) connects the file descriptor
-to screen. An exclamation mark (!) causes the file
+to
+.IR screen .
+An exclamation mark (!) causes the file
descriptor to be connected to the already running process. A colon (:) combines
both.
-User input will go to newcommand unless newcommand requests the old process'
-output (fdpats first character is `!' or `:') or a pipe (|) is added to
+User input will go to newcommand unless newcommand requests the old process'
+output (fdpats first character is `!' or `:') or a pipe (|) is added to
the end of fdpat.
.br
Invoking `exec' without arguments shows name and arguments of the currently
@@ -1069,16 +1246,18 @@ windows process.
.br
Refer to the postscript file `fdpat.ips' for illustration of all 21 possible
combinations. Each drawing shows the numbers 210 representing the three
-file descriptors of newcommand. The box marked `W' is usual pty that has
-the old process (shell) on its slave side. The box marked `P' is the
-secondary pty that now has screen at its master side.
+file descriptors of newcommand. The box marked `W' is usual pty that has
+the old process (shell) on its slave side. The box marked `P' is the
+secondary pty that now has
+.I screen
+at its master side.
.sp
-Abbreviations:
+Abbreviations:
.br
-Whitespace between the word `exec' and fdpat and the command
-can be omitted. Trailing dots and a fdpat consisting only of dots can be
+Whitespace between the word `exec' and fdpat and the command
+can be omitted. Trailing dots and a fdpat consisting only of dots can be
omitted. A simple `|' is synonymous for the pattern `!..|'; the word exec can
-be ommitted here and can always be replaced by `!'.
+be omitted here and can always be replaced by `!'.
.sp
Examples:
.IP
@@ -1088,7 +1267,7 @@ exec /bin/sh
.br
!/bin/sh
.PP
-Creates another shell in the same window, while the orignal shell is still
+Creates another shell in the same window, while the original shell is still
running. Output of both shells is displayed and user input is sent to the new
/bin/sh.
.IP
@@ -1098,7 +1277,7 @@ exec ! stty 19200
.br
!!stty 19200
.PP
-Set the speed of the windows tty. If your stty command operates on stdout, then
+Set the speed of the window's tty. If your stty command operates on stdout, then
add another `!'.
.IP
exec !..| less
@@ -1106,13 +1285,14 @@ exec !..| less
|less
.PP
This adds a pager to the window output. The special character `|' is needed to
-give the user control over the pager although it gets its input from the
+give the user control over the pager although it gets its input from the
original process.
.IP
!:sed -n s/.*Error.*/\e007/p
.PP
Sends window output to both, the user and the sed command. The sed inserts an
-additional bell character (oct. 007) to the window output seen by screen.
+additional bell character (oct. 007) to the window output seen by
+.IR screen .
This will cause "Bell in window x" messages, whenever the string "Error"
appears in the window.
.sp
@@ -1121,42 +1301,53 @@ appears in the window.
.RB [ on | off | "auto\fR]\fP"
.PP
Sets the flow-control mode for this window.
-Without parameters it cycles the current window's flow-control setting from
+Without parameters it cycles the current window's flow-control setting from
"automatic" to "on" to "off".
-See the discussion on \*QFLOW-CONTROL\*U later on in this document for full
+See the discussion on \*QFLOW-CONTROL\*U later on in this document for full
details and note, that this is subject to change in future releases.
Default is set by `defflow'.
.sp
.ne 3
+.BR "gr " [ on | off ]
+.PP
+Turn GR charset switching on/off. Whenever screens 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 \*Qdefgr\*U) is not to process GR switching because
+otherwise the ISO88591 charset would not work.
+.sp
+.ne 3
.B hardcopy
.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.
+of the current window.
This either appends or overwrites the file if it exists. See below.
.sp
.ne 3
.BR "hardcopy_append on" | off
.PP
-If set to "on",
+If set to "on",
.I screen
-will append to the "hardcopy.n" files created by the command \*QC-a h\*U,
+will append to the "hardcopy.n" files created by the command \*QC-a h\*U,
otherwise these files are overwritten each time.
Default is `off'.
.sp
.ne 3
.BI "hardcopydir "directory
.PP
-Defines a directory where hardcopy files will be placed. If unset hardcopys
-are dumped in screens current working directory.
+Defines a directory where hardcopy files will be placed. If unset, hardcopys
+are dumped in
+.IR screen 's
+current working directory.
.sp
.ne 3
.BR "hardstatus " [ on | off ]
.PP
-Toggles the use of the terminal's hardware status line. If "on",
+Toggles the use of the terminal's hardware status line. If "on",
.I screen
will use this facility to display one line messages. Otherwise these messages
-are overlayed in reverse video mode at the display line. Note that the
+are overlayed in reverse video mode at the display line. Note that the
hardstatus feature can only be used if the termcap/terminfo capabilities
"hs", "ts", "fs" and "ds" are set properly. Default is `on' whenever the "hs"
capability is present.
@@ -1170,7 +1361,7 @@ is given it toggles between 24 and 42 lines display.
.ne 3
.B help
.PP
-Not really a online help, but
+Not really a online help, but
displays a help screen showing you all the key bindings.
The first pages list all the internal commands followed by their current
bindings.
@@ -1184,23 +1375,23 @@ See also \*QDEFAULT KEY BINDINGS\*U section.
.B history
.PP
Usually users work with a shell that allows easy access to previous commands.
-For example csh has the command \*Q!!\*U to repeat the last command executed.
+For example csh has the command \*Q!!\*U to repeat the last command executed.
.I Screen
allows you to have a primitive way of re-calling \*Qthe command that
started ...\*U: You just type the first letter of that command, then hit
`C-a {' and
.I screen
-tries to find a previous line that matches with the `prompt character'
+tries to find a previous line that matches with the `prompt character'
to the left of the cursor. This line is pasted into this window's input queue.
Thus you have a crude command history (made up by the visible window and its
-scrollback buffer).
+scrollback buffer).
.sp
.ne 3
.B info
.PP
Uses the message line to display some information about the current window:
the cursor position in the form \*Q(column,row)\*U starting with \*Q(1,1)\*U,
-the terminal width and height plus the size of the scrollback buffer in lines,
+the terminal width and height plus the size of the scrollback buffer in lines,
like in \*U(80,24)+50\*U, various flag settings (flow-control, insert mode,
origin mode, wrap mode, application-keypad mode, output logging, activity
monitoring and redraw (`+' indicates enabled, `\-' not)),
@@ -1212,18 +1403,33 @@ For system information use the \*Qtime\*U command.
.ne 3
.BR ins_reg " [" \fIkey ]
.PP
-Paste contents of register \fIkey\fP in current windows input stream. See also
-the \*Qcopy_reg\*U and \*Qregister\*U commands.
+No longer exists, use \*Qpaste\*U instead.
+.sp
+.ne 3
+.B kanji
+.BR jis | euc | sjis
+.RB [ jis | euc | sjis\fR]
+.PP
+Tell 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 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
+window.
.sp
.ne 3
.B kill
.PP
Kill current window.
-.br
+.br
If there is an `exec' command running then it is killed. Otherwise the process
(shell) running in the window receives a HANGUP condition, the window structure
-is removed and screen switches to the previously displayed window.
-When the last window is destroyed,
+is removed and
+.I screen
+switches to the previously displayed window.
+When the last window is destroyed,
.I screen
exits.
Note:
@@ -1237,7 +1443,7 @@ escape key or to rebind kill to \*QC-a K\*U.
.B lastmsg
.PP
Redisplay the last contents of the message/status line.
-Useful if you're typing when a message appears, because the message goes
+Useful if you're typing when a message appears, because the message goes
away when you press a key (unless your terminal has a hardware status line).
Refer to the commands \*Qmsgwait\*U and \*Qmsgminwait\*U for fine tuning.
.sp
@@ -1246,7 +1452,7 @@ Refer to the commands \*Qmsgwait\*U and \*Qmsgminwait\*U for fine tuning.
.PP
Display the disclaimer page. This is done whenever
.I screen
-is started without options, which should be often enough. See also
+is started without options, which should be often enough. See also
the \*Qstartup_message\*U command.
.sp
.ne 3
@@ -1255,20 +1461,20 @@ the \*Qstartup_message\*U command.
Lock this display.
Call a screenlock program (/local/bin/lck or /usr/bin/lock or a builtin if no
other is available). Screen does not accept any command keys until this program
-terminates. Meanwhile processes in the windows may continue, as the windows
+terminates. Meanwhile processes in the windows may continue, as the windows
are in the `detached' state. The screenlock program may be changed through the
-environment variable $LOCKPRG (which must be set in the shell from which
+environment variable $LOCKPRG (which must be set in the shell from which
.I screen
is started) and is executed with the user's uid and gid.
.sp
.ne 3
.BR "log " [ on | off ]
.PP
-Start/stop writing output of the current window to a file
-\*Qscreenlog.\fIn\fP\*U in the window's default directory, where \fIn\fP
+Start/stop writing output of the current window to a file
+\*Qscreenlog.\fIn\fP\*U in the window's default directory, where \fIn\fP
is the number of the current window. If no parameter is given, the state
-of logging is toggled. The session log is appended to the previous contents
-of the file if it already exists. The current contents and the contents
+of logging is toggled. The session log is appended to the previous contents
+of the file if it already exists. The current contents and the contents
of the scrollback history are not included in the session log.
Default is `off'.
.sp
@@ -1276,7 +1482,9 @@ Default is `off'.
.BI "logdir "directory
.PP
Defines a directory where logfiles will be placed. If unset logfiles are written
-in screens current working directory.
+in
+.IR screen's
+current working directory.
.sp
.ne 3
.BR "login " [ on | off ]
@@ -1287,20 +1495,42 @@ When no parameter is given, the login state of the window is toggled.
Additionally to that toggle, it is convenient having a `log in' and a `log out'
key. E.\|g. `bind I login on' and `bind O login off' will map these
keys to be C-a I and C-a O.
-The default setting (in config.h.in) should be \*Qon\*U for a
+The default setting (in config.h.in) should be \*Qon\*U for a
.I screen
that runs under suid-root.
-Use the \*Qdeflogin\*U command to change the default login state for new
-windows. Both commands are only present when
+Use the \*Qdeflogin\*U command to change the default login state for new
+windows. Both commands are only present when
.I screen
has been compiled with utmp support.
.sp
.ne 3
+.B mapdefault
+.PP
+Tell screen that the next input character should only be looked up
+in the default bindkey table. See also \*Qbindkey\*U.
+.sp
+.ne 3
+.B mapnotnext
+.PP
+Like mapdefault, but don't even look in the default bindkey table.
+.sp
+.ne 3
+.B maptimeout
+.RI [ timo ]
+.PP
+Set the intercharacter timer for input sequence detection to a timeout
+of
+.I timo
+ms. The default timeout is 300ms. Maptimeout with no arguments shows
+the current setting.
+See also \*Qbindkey\*U.
+.sp
+.ne 3
.BI "markkeys " string
.PP
This is a method of changing the keymap used for copy/history mode.
The string is made up of \fIoldchar\fP=\fInewchar\fP pairs which are
-separated by `:'. Example: The string \*QB=^B:F=^F\*U will change the
+separated by `:'. Example: The string \*QB=^B:F=^F\*U will change the
keys `C-b' and `C-f' to the vi style binding (scroll up/down fill page).
This happens to be the default binding for `B' and `F'.
The command \*Qmarkkeys h=^B:l=^F:$=^E\*U would set the mode for an emacs-style
@@ -1324,24 +1554,26 @@ Monitoring is initially off for all windows.
.ne 3
.BI "msgminwait " sec
.PP
-Defines the time
-.I screen
-delays a new message when one message is currently displayed.
+Defines the time
+.I screen
+delays a new message when one message is currently displayed.
The default is 1 second.
.sp
.ne 3
.BI "msgwait " sec
.PP
-Defines the time a message is displayed if
+Defines the time a message is displayed if
.I screen
is not disturbed by other activity. The default is 5 seconds.
.sp
.ne 3
.BR "multiuser on" | off
.PP
-Switch between singleuser and multiuser mode. Standard screen operation
-is singleuser. In multiuser mode the commands `acladd' and `acldel' can be
-used to enable (and disable) other users to access this screen.
+Switch between singleuser and multiuser mode. Standard
+.I screen
+operation is singleuser. In multiuser mode the commands `acladd',
+`aclchg' and `acldel'
+can be used to enable (and disable) other users accessing this screen.
.sp
.ne 3
.BR "nethack on" | off
@@ -1353,9 +1585,11 @@ nethack-style messages which will often blur the facts a little, but are
much funnier to read. Anyway, standard messages often tend to be unclear as
well.
.br
-This option is only
-available if screen was compiled with the NETHACK flag defined. The
-default setting is then determined by the presence of the environment
+This option is only
+available if
+.I screen
+was compiled with the NETHACK flag defined. The
+default setting is then determined by the presence of the environment
variable $NETHACKOPTIONS.
.sp
.ne 3
@@ -1367,7 +1601,7 @@ This command can be used repeatedly to cycle through the list of windows.
.ne 3
.BR "number " [ \fIn ]
.PP
-Change the current windows number. If the given number \fIn\fP is already
+Change the current windows number. If the given number \fIn\fP is already
used by another window, both windows exchange their numbers. If no argument is
specified, the current window number (and title) is shown.
.sp
@@ -1388,32 +1622,57 @@ Switch to the window displayed previously.
.ne 3
.BR "partial on" | off
.PP
-Defines whether the display should be refreshed (as done with "C-a l") after
+Defines whether the display should be refreshed (as with \fIredisplay\fP) after
switching to the current window. This command only affects the current window.
-To affect all windows use the \fIallpartial\fP command.
-Default is `off', of course.
+To immediately affect all windows use the \fIallpartial\fP command.
+Default is `off', of course. This default is fixed, as there is currently no
+\fIdefpartial\fP command.
.sp
.ne 3
.BR "password " [ \fIcrypted_pw ]
.PP
-Present a crypted password in your \*Q.screenrc\*U file and screen will ask
+Present a crypted password in your \*Q.screenrc\*U file and
+.I screen
+will ask
for it, whenever someone attempts to resume a detached. This is useful
if you have privileged programs running under
.I screen
and you want to protect your session from reattach attempts by another user
masquerading as your uid (i.e. any superuser.)
-If no crypted password is specified, screen prompts twice for typing a
-password and places its encryption in the copybuffer.
+If no crypted password is specified,
+.I screen
+prompts twice for typing a
+password and places its encryption in the paste buffer.
Default is `none', this disables password checking.
.sp
.ne 3
-.BR "paste " [ \fIregisters ]
+.BR paste
+.RI [ registers [ dest_reg ]]
.PP
-Write the contents of the specified registers to the stdin queue
+Write the (concatenated) contents of the specified registers to the stdin queue
of the current window. The register '.' is treated as the
-paste buffer. If no parameter is given only the paste buffer is used.
-It can be filled with the \fIcopy\fP, \fIhistory\fP and
-\fIreadbuf\fP commands.
+paste buffer. If no parameter is given the user is prompted for a single
+register to paste.
+The paste buffer can be filled with the \fIcopy\fP, \fIhistory\fP and
+\fIreadbuf\fP commands.
+Other registers can be filled with the \fIregister\fP, \fIreadreg\fP and
+\fIpaste\fP commands.
+If \fIpaste\fP is called with a second argument, the contents of the specified
+registers is pasted into the named destination register rather than
+the window. If '.' is used as the second argument, the displays paste buffer is
+the destination.
+Note, that \*Qpaste\*U uses a wide variety of resources: Whenever a second
+argument is specified no current window is needed. When the source specification
+only contains registers (not the paste buffer) then there need not be a current
+display (terminal attached), as the registers are a global resource. The
+paste buffer exists once for every user.
+.sp
+.ne 3
+.BR "pastefont " [ on | off ]
+.PP
+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.
.sp
.ne 3
.B pow_break
@@ -1423,11 +1682,11 @@ Reopen the window's terminal line and send a break condition. See `break'.
.ne 3
.B pow_detach
.PP
-Power detach.
+Power detach.
Mainly the same as \fIdetach\fP, but also sends a HANGUP signal to
the parent process of
.IR screen .
-CAUTION: This will result in a logout, when
+CAUTION: This will result in a logout, when
.I screen
was started from your login shell.
.sp
@@ -1435,8 +1694,8 @@ was started from your login shell.
.BI "pow_detach_msg " message
.PP
The \fImessage\fP specified here is output whenever a `Power detach' was
-performed. It may be used as a replacement for a logout message or to reset
-baud rate, etc.
+performed. It may be used as a replacement for a logout message or to reset
+baud rate, etc.
.sp
.ne 3
.B prev
@@ -1445,11 +1704,33 @@ Switch to the window with the next lower number.
This command can be used repeatedly to cycle through the list of windows.
.sp
.ne 3
+.B printcmd
+.RI [ cmd ]
+.PP
+If
+.I cmd
+is not an empty string, screen will not use the terminal capabilities
+\*Qpo/pf\*U if it detects an ansi print sequence
+.BR "ESC [ 5 i" ,
+but pipe the output into
+.IR cmd .
+This should normally be a command like \*Qlpr\*U or
+\*Q'cat > /tmp/scrprint'\*U.
+.B printcmd
+without a command displays the current setting.
+The ansi sequence
+.B "ESC \e"
+ends printing and closes the pipe.
+.br
+Warning: Be careful with this command! If other user have write
+access to your terminal, they will be able to fire off print commands.
+.sp
+.ne 3
.BR process " [" \fIkey ]
.PP
-Stuff the contents of the specified register into \fscreen\fP's
+Stuff the contents of the specified register into \fIscreen\fP's
input queue. If no argument is given you are prompted for a
-register name. The text is parsed as if it had been typed in from the users
+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.
.sp
.ne 3
@@ -1457,7 +1738,7 @@ keyboard. This command can be used to bind multiple actions to a single key.
.PP
Kill all windows and terminate
.IR screen .
-Note that on vt100-style terminals the keys C-4 and C-\e are identical.
+Note that on VT100-style terminals the keys C-4 and C-\e are identical.
This makes the default bindings dangerous:
Be careful not to type C-a C-4 when selecting window no. 4.
Use the empty bind command (as in \*Qbind '^\e'\*U) to remove a key binding.
@@ -1465,10 +1746,27 @@ Use the empty bind command (as in \*Qbind '^\e'\*U) to remove a key binding.
.ne 3
.B readbuf
.PP
-Reads the contents of the current screen-exchange file into the copy buffer.
+Reads the contents of the current screen-exchange file into the paste buffer.
See also \*Qbufferfile\*U command.
.sp
.ne 3
+.B readreg
+.RI [ register " [" filename ]]
+.PP
+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 \fIreadbuf\fP 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):
+.PP
+.nf
+ C-a : readreg p /etc/passwd
+ C-a : paste p
+.fi
+.sp
+.ne 3
.B redisplay
.PP
Redisplay the current window. Needed to get a full redisplay when in
@@ -1478,17 +1776,17 @@ partial redraw mode.
.BI "register " "key string"
.PP
Save the specified \fIstring\fP to the register \fIkey\fP. See also the
-\*Qins_reg\*U command.
+\*Qpaste\*U command.
.sp
.ne 3
.B "removebuf"
.PP
-Unlinks the screen-exchange file used by the commands \*Qwritebuf\*U and
-\*Qreadbuf\*U.
+Unlinks the screen-exchange file used by the commands \*Qwritebuf\*U and
+\*Qreadbuf\*U.
.sp
.ne 3
.B "reset"
-.PP
+.PP
Reset the virtual terminal to its \*Qpower-on\*U values. Useful when strange
settings (like scroll regions or graphics character set) are left over from
an application.
@@ -1519,7 +1817,7 @@ creates a shell window (in window #1) and a window with a TELNET connection
to the machine foobar (with no flow-control using the title \*Qfoobar\*U
in window #2). Note, that unlike previous versions of
.I screen
-no additional default window is created when \*Qscreen\*U commands are
+no additional default window is created when \*Qscreen\*U commands are
included in your \*Q.screenrc\*U file. When the initialization is completed,
.I screen
switches to the last window specified in your .screenrc file or, if none,
@@ -1528,9 +1826,9 @@ opens a default window #0.
.ne 3
.B "scrollback \fP\fInum\fP"
.PP
-Set the size of the scrollback buffer for the current windows to \fInum\fP
+Set the size of the scrollback buffer for the current windows to \fInum\fP
lines. The default scrollback is 100 lines.
-See also the \*Qdefscrollback\*U command and use \*QC-a i\*U to view the
+See also the \*Qdefscrollback\*U command and use \*QC-a i\*U to view the
current setting.
.sp
.ne 3
@@ -1542,21 +1840,22 @@ identifier. This can be title (alphanumeric window name) or a number.
When a new window is established, the first available number
is assigned to this window.
Thus, the first window can be activated by \*Qselect 0\*U (there can be no more
-than 10 windows present simultaneously unless screen is compiled with a higher
-MAXWIN setting).
+than 10 windows present simultaneously unless
+.I screen
+is compiled with a higher MAXWIN setting).
.sp
.ne
.BR "sessionname " [ \fIname ]
.PP
Rename the current session. Note, that for \*Qscreen -list\*U the
name shows up with the process-id prepended. If the argument \*Qname\*U
-is omitted, the name of this session is displayed. Caution: The $STY
-environment variables still reflects the old name. This may result in
-confusion.
+is omitted, the name of this session is displayed. Caution: The $STY
+environment variables still reflects the old name. This may result in
+confusion.
The default is constructed from the tty and host names.
.sp
.ne 3
-.B "setenv "
+.B "setenv "
.RI [ var " [" string ]]
.PP
Set the environment variable \fIvar\fP to value \fIstring\fP.
@@ -1588,7 +1887,7 @@ Toggles silence monitoring of windows.
When silence is turned on and an affected window is switched into the
background, you will receive the silence notification message in the
status line after a specified period of inactivity (silence). The default
-timeout can be changed with the `silencewait' command or by specifying a
+timeout can be changed with the `silencewait' command or by specifying a
number of seconds instead of `on' or `off'.
Silence is initially off for all windows.
.sp
@@ -1608,25 +1907,38 @@ It may be used to give users a chance to read the messages output by \*Qecho\*U.
.ne 3
.B "slowpaste \fIusec\fP"
.PP
-Define the speed at which text is inserted by the paste ("C-a ]") command.
+Define the speed at which text is inserted by the paste ("C-a ]") command.
If the slowpaste value is nonzero text is written character by character.
.I screen
-will make a pause of \fIusec\fP milliseconds after each write to allow the
-application to process its input. Only use slowpaste if your underlying system
-exposes flow control problems while pasting large amounts of text.
+will make a pause of \fIusec\fP milliseconds after each single character write
+to allow the application to process its input. Only use slowpaste if your
+underlying system exposes flow control problems while pasting large amounts of
+text.
.sp
.ne 3
.B "startup_message on\fP|\fBoff"
.PP
Select whether you want to see the copyright notice during startup.
-Default is `on', as you propably noticed.
+Default is `on', as you probably noticed.
+.sp
+.ne 3
+.B stuff
+.I string
+.PP
+Stuff the string
+.I string
+in the input buffer of the current window.
+This is like the \*Qpaste\*U command but with much less overhead.
+You cannot paste
+large buffers with the \*stuff\*U command. It is most useful for key
+bindings. See also \*Qbindkey\*U.
.sp
.ne 3
.B "suspend"
.PP
Suspend
.IR screen .
-The windows are in the `detached' state, while
+The windows are in the `detached' state, while
.IR screen
is suspended. This feature relies on the shell being able to do job control.
.sp
@@ -1635,10 +1947,10 @@ is suspended. This feature relies on the shell being able to do job control.
.PP
In each window's environment
.I screen
-opens, the $TERM variable is set to \*Qscreen\*U by default.
+opens, the $TERM variable is set to \*Qscreen\*U by default.
But when no description for \*Qscreen\*U is installed in the local termcap
or terminfo data base, you set $TERM to \- say \-
-\*Qvt100\*U. This won't do much harm, as
+\*Qvt100\*U. This won't do much harm, as
.I screen
is VT100/ANSI compatible.
The use of the \*Qterm\*U command is discouraged for non-default purpose.
@@ -1678,7 +1990,9 @@ The first tweak modifies your terminal's termcap, and contains definitions
that your terminal uses to perform certain functions.
Specify a null string to leave this unchanged (e.\|g. '').
The second (optional) tweak modifies all the window termcaps, and should
-contain definitions that screen understands (see the \*QVIRTUAL TERMINAL\*U
+contain definitions that
+.I screen
+understands (see the \*QVIRTUAL TERMINAL\*U
section).
.PP
Some examples:
@@ -1699,7 +2013,7 @@ termcap vt102|vt220 Z0=\eE[?3h:Z1=\eE[?3l
Specifies the firm-margined `LP' capability for all terminals that begin with
`vt', and the second line will also add the escape-sequences to switch
into (Z0) and back out of (Z1) 132-character-per-line mode if this is
-a vt102 or vt220.
+a VT102 or VT220.
(You must specify Z0 and Z1 in your termcap to use the width-changing
commands.)
.IP
@@ -1714,10 +2028,14 @@ Takes a h19 or z19 termcap and turns off auto-margins (am@) and enables the
insert mode (im) and end-insert (ei) capabilities (the `@' in the `im'
string is after the `=', so it is part of the string).
Having the `im' and `ei' definitions put into your terminal's termcap will
-cause screen to automatically advertise the character-insert capability in
+cause
+.I screen
+to automatically advertise the character-insert capability in
each window's termcap.
Each window will also get the delete-character capability (dc) added to its
-termcap, which screen will translate into a line-update for the terminal
+termcap, which
+.I screen
+will translate into a line-update for the terminal
(we're pretending it doesn't support character deletion).
.PP
If you would like to fully specify each window's termcap entry, you should
@@ -1736,8 +2054,10 @@ For window specific information use \*Qinfo\*U.
.ne 3
.BR "title " [ \fIwindowalias ]
.PP
-Set the name of the current window to \fIwindowalias\fP. If no name is
-specified, screen prompts for one. This command was known as `aka' in previous
+Set the name of the current window to \fIwindowalias\fP. If no name is
+specified,
+.I screen
+prompts for one. This command was known as `aka' in previous
releases.
.sp
.ne 3
@@ -1749,10 +2069,10 @@ Unset an environment variable.
.BR "vbell on" | off
.PP
If your terminal does not support
-a visual bell, a `vbell-message' is displayed in the status line.
+a visual bell, a `vbell-message' is displayed in the status line.
Sets the visual bell setting for this window. If your terminal does not support
a visual bell, a `vbell-message' is displayed in the status line.
-Refer to the termcap variable `vb' (terminfo: 'flash').
+Refer to the termcap variable `vb' (terminfo: 'flash').
.sp
.ne 3
.BI "vbell_msg " message
@@ -1764,7 +2084,7 @@ The default message is \*QWuff, Wuff!!\*U.
.ne 3
.BI "vbellwait " sec
.PP
-Define a delay in seconds after each display of
+Define a delay in seconds after each display of
.IR screen 's
visual bell message. The default is 1 second.
.sp
@@ -1776,14 +2096,14 @@ Print the current version and the compile date in the status line.
.ne 3
.BI "wall " "message ..."
.PP
-Write a message to all displays. The message will appear in the terminals
+Write a message to all displays. The message will appear in the terminal's
status line.
.sp
.ne 3
.BR "width " [ \fInum ]
.PP
-Toggle the window width between 80 and 132 columns or set it to \fInum\fP
-columns if an argument is specified.
+Toggle the window width between 80 and 132 columns or set it to \fInum\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.
.sp
@@ -1799,10 +2119,10 @@ all the windows that are \*Qlogged in\*U are marked with a `$';
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 `@';
-a window which has output logging turned on is marked with `(L)';
+a window which has output logging turned on is marked with `(L)';
windows occupied by other users are marked with `&';
windows in the zombie state are marked with `Z'.
-If this list is too long to fit on the terminals status line only the
+If this list is too long to fit on the terminal's status line only the
portion around the current window is displayed.
.sp
.ne 3
@@ -1821,19 +2141,18 @@ Default is `on'.
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
.I screen
-users on the same host. The filename can be set with the \fIbufferfile\fP
+users on the same host. The filename can be set with the \fIbufferfile\fP
command and defaults to \*Q/tmp/screen-exchange\*U.
.sp
.ne 3
-.B writelock
-.IB [ on | off | auto\fP]
+.BR "writelock " [ on | "off\fR|\fBauto\fR]"
.PP
In addition to access control lists, not all users may be able to write to
the same window at once. Per default, writelock is in `auto' mode and
grants exclusive input permission to the user who is the first to switch
to the particular window. When he leaves the window, other users may obtain
the writelock (automatically). The writelock of the current window is disabled
-by the command \*Qwritelock off\*U. If the user issues the command
+by the command \*Qwritelock off\*U. If the user issues the command
\*Qwritelock on\*U he keeps the exclusive write permission while switching
to other windows.
.sp
@@ -1846,20 +2165,35 @@ Insert a CTRL-s / CTRL-q character to the stdin queue of the
current window.
.sp
.ne 3
-.BR "zombie " [\fIkey\fP]
-.PP
-Per default screen windows are removed from the window list as soon as
-the windows process (e.g. shell) exits. When a key is specified to the
-zombie command a `dead' windows will remain in the list until it is selected
-and this key is pressed or the \*Qkill\*U command is issued.
+.BR "zombie " [\fIkeys\fP]
+.br
+.BR "defzombie " [\fIkeys\fP]
+.PP
+Per default
+.I screen
+windows are removed from the window list as soon as
+the windows process (e.g. shell) exits. When a string of two keys is
+specified to the zombie command, `dead' windows will remain in the list.
+The \fBkill\fP kommand may be used to remove such a window. Pressing the
+first key in the dead window has the same effect. When pressing the second
+key, screen will attempt to resurrect the window. The process that was
+initially running in the window will be launched again. Calling \fBzombie\fP
+without parameters will clear the zombie setting, thus making windows disappear
+when their process exits.
+
+As the zombie-setting is manipulated globally for all windows, this command
+should only be called \fBdefzombie\fP. Until we need this as a per window
+setting, the commands \fBzombie\fP and \fBdefzombie\fP are synonymous.
.SH "THE MESSAGE LINE"
.I Screen
displays informational messages and other diagnostics in a \fImessage line\fP.
While this line is distributed to appear at the bottom of the screen,
it can be defined to appear at the top of the screen during compilation.
-If your terminal has a status line defined in its termcap, screen will use
-this for displaying its messages, otherwise a line of the current screen will
+If your terminal has a status line defined in its termcap,
+.I screen
+will use this for displaying its messages, otherwise a line of the
+current 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
@@ -1877,9 +2211,13 @@ and '\e\e' turns into a single backslash.
.SH "FLOW-CONTROL"
-Each window has a flow-control setting that determines how screen deals with
+Each window has a flow-control setting that determines how
+.I screen
+deals with
the XON and XOFF characters (and perhaps the interrupt character).
-When flow-control is turned off, screen ignores the XON and XOFF characters,
+When flow-control is turned off,
+.I screen
+ignores the XON and XOFF characters,
which allows the user to send them to the current program by simply typing
them (useful for the \fIemacs\fP editor, for instance).
The trade-off is that it will take longer for output from a \*Qnormal\*U
@@ -1887,7 +2225,9 @@ program to pause in response to an XOFF.
With flow-control turned on, XON and XOFF characters are used to immediately
pause the output of the current window.
You can still send these characters to the current program, but you must use
-the appropriate two-character screen commands (typically \*QC-a q\*U (xon)
+the appropriate two-character
+.I screen
+commands (typically \*QC-a q\*U (xon)
and \*QC-a s\*U (xoff)).
The xon/xoff commands are also useful for typing C-s and C-q past a terminal
that intercepts these characters.
@@ -1901,14 +2241,18 @@ It can then be toggled between the three states 'fixed on', 'fixed off' and
.PP
The automatic flow-switching mode deals with
flow control using the TIOCPKT mode (like \*Qrlogin\*U does). If
-the tty driver does not support TIOCPKT, screen tries to find out
+the tty driver does not support TIOCPKT,
+.I screen
+tries to find out
the right mode based on the current setting of the application
keypad \- when it is enabled, flow-control is turned off and visa versa.
Of course, you can still manipulate flow-control manually when needed.
.PP
If you're running with flow-control enabled and find that pressing the
interrupt key (usually C-c) does not interrupt the display until another
-6-8 lines have scrolled by, try running screen with the \*Qinterrupt\*U
+6-8 lines have scrolled by, try running
+.I screen
+with the \*Qinterrupt\*U
option (add the \*Qinterrupt\*U flag to the \*Qflow\*U command in
your .screenrc, or use the
.B \-i
@@ -2071,16 +2415,18 @@ are missing. This is no problem on machines using termcap,
because
.I screen
can use the $TERMCAP variable to
-customize the standard screen termcap.
+customize the standard
+.I screen
+termcap.
.PP
But if you do a
rlogin on another machine or your machine supports only
terminfo this method fails. Because of this,
.I screen
-offers a way to deal with these cases.
+offers a way to deal with these cases.
Here is how it works:
.PP
-When
+When
.I screen
tries to figure out a terminal name for itself,
it first looks
@@ -2133,7 +2479,7 @@ window's $TERMCAP variable.
This can either be the full terminal definition, or a filename where the
terminal \*Qscreen\*U (and/or \*Qscreen-w\*U) is defined.
.PP
-Note that
+Note that
.I screen
honors the \*Qterminfo\*U .screenrc command if the system uses the
terminfo database rather than termcap.
@@ -2152,11 +2498,13 @@ The following control functions from ISO 2022 are supported:
and \fIsingle shift G3\fP.
When a virtual terminal is created or reset, the ASCII character
set is designated as \fIG0\fP through \fIG3\fP.
-When the `G0' capability is present, screen evaluates the capabilities
+When the `G0' capability is present,
+.I screen
+evaluates the capabilities
`S0', `E0', and `C0' if present. `S0' is the sequence the terminal uses
-to enable and start the graphics character set rather than \fISI\fP.
+to enable and start the graphics character set rather than \fISI\fP.
`E0' is the corresponding replacement for \fISO\fP. `C0' gives a character
-by character translation string that is used during semi-graphics mode. This
+by character translation string that is used during semi-graphics mode. This
string is built like the `acsc' terminfo capability.
.PP
When the `po' and `pf' capabilities are present in the terminal's
@@ -2176,7 +2524,7 @@ variable of the virtual terminal if they can be efficiently
implemented by the physical terminal.
For instance, `dl' (delete line) is only put into the $TERMCAP
variable if the terminal supports either delete line itself or
-scrolling regions. Note that this may provoke confusion, when
+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.
.PP
@@ -2289,10 +2637,10 @@ Direct Cursor Addressing
Erase in Display
.TP 27
\h'\w'ESC [ 'u'Pn = None or \fB0\fP
-From Cursor to End of Screen
+>From Cursor to End of Screen
.TP 27
\h'\w'ESC [ Pn = 'u'\fB1\fP
-From Beginning of Screen to Cursor
+>From Beginning of Screen to Cursor
.TP 27
\h'\w'ESC [ Pn = 'u'\fB2\fP
Entire Screen
@@ -2301,10 +2649,10 @@ Entire Screen
Erase in Line
.TP 27
\h'\w'ESC [ 'u'Pn = None or \fB0\fP
-From Cursor to End of Line
+>From Cursor to End of Line
.TP 27
\h'\w'ESC [ Pn = 'u'\fB1\fP
-From Beginning of Line to Cursor
+>From Beginning of Line to Cursor
.TP 27
\h'\w'ESC [ Pn = 'u'\fB2\fP
Entire Line
@@ -2426,20 +2774,115 @@ Resize the window to `Ph' lines and `Pw' columns (SunView special)
.B "ESC [ c"
Send VT100 Identification String
.TP 27
+.B "ESC [ > c"
+Send VT220 Secondary Device Attributes String
+.TP 27
.B "ESC [ 6 n"
Send Cursor Position Report
+.SH "INPUT TRANSLATION"
+In order to do a full VT100 emulation \fIscreen\fP has to detect
+that a sequence of characters in the input stream was generated
+by a keypress on the user's keyboard and insert the VT100
+style escape sequence. \fIScreen\fP has a very flexible way of doing
+this by making it posible 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 \fBstuff\fP in the command table).
+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.
+\fIScreen\fP will insert the correct binding after each
+reattach. See the \fBbindkey\fP command for further details on the
+syntax and examples.
+.PP
+Here is the table of the default key bindings. (A) means that the
+command is executed if the keyboard is switched into application
+mode.
+.PP
+.ta 18n 34n 50n
+.nf
+Key name Termcap name Command
+\l'54n'
+.ta 22n 34n 50n
+Cursor up ku stuff \e033[A
+ stuff \e033OA (A)
+Cursor down kd stuff \e033[B
+ stuff \e033OB (A)
+Cursor right kr stuff \e033[C
+ stuff \e033OC (A)
+Cursor left kl stuff \e033[D
+ stuff \e033OD (A)
+Function key 0 k0 stuff \e033[10~
+Function key 1 k1 stuff \e033OP
+Function key 2 k2 stuff \e033OQ
+Function key 3 k3 stuff \e033OR
+Function key 4 k4 stuff \e033OS
+Function key 5 k5 stuff \e033[15~
+Function key 6 k6 stuff \e033[17~
+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
+Home kh stuff \e033[1~
+End kH stuff \e033[4~
+Insert kI stuff \e033[2~
+Delete kD stuff \e033[3~
+Page up kP stuff \e033[5~
+Page down kN stuff \e033[6~
+Keypad 0 f0 stuff 0
+ stuff \e033Op (A)
+Keypad 1 f1 stuff 1
+ stuff \e033Oq (A)
+Keypad 2 f2 stuff 2
+ stuff \e033Or (A)
+Keypad 3 f3 stuff 3
+ stuff \e033Os (A)
+Keypad 4 f4 stuff 4
+ stuff \e033Ot (A)
+Keypad 5 f5 stuff 5
+ stuff \e033Ou (A)
+Keypad 6 f6 stuff 6
+ stuff \e033Ov (A)
+Keypad 7 f7 stuff 7
+ stuff \e033Ow (A)
+Keypad 8 f8 stuff 8
+ stuff \e033Ox (A)
+Keypad 9 f9 stuff 9
+ stuff \e033Oy (A)
+Keypad + f+ stuff +
+ stuff \e033Ok (A)
+Keypad - f- stuff -
+ stuff \e033Om (A)
+Keypad * f* stuff *
+ stuff \e033Oj (A)
+Keypad / f/ stuff /
+ stuff \e033Oo (A)
+Keypad = fq stuff =
+ stuff \e033OX (A)
+Keypad . f. stuff .
+ stuff \e033On (A)
+Keypad , f, stuff ,
+ stuff \e033Ol (A)
+Keypad enter fe stuff \e015
+ stuff \e033OM (A)
+.fi
+
+
.SH SPECIAL TERMINAL CAPABILITIES
The following table describes all terminal capabilities
-that are recognized by \fscreen\fP and are not in the
+that are recognized by \fIscreen\fP and are not in the
termcap(5) manual.
.PP
.ta 5n
.TP 13
.BI LP " (bool)"
-Terminal has vt100 style margins (`magic margins'). Note that
-this capability is obsolete because \fscreen\fP uses 'xn'
+Terminal has VT100 style margins (`magic margins'). Note that
+this capability is obsolete because \fIscreen\fP uses 'xn'
instead.
.TP 13
.BI Z0 " (str)"
@@ -2453,22 +2896,22 @@ Resize display. This capability has the desired width and height as
arguments. \fISunView(tm)\fP example: '\eE[8;%d;%dt'.
.TP 13
.BI B8 " (str)"
-Tell \fscreen\fP to look out for characters with 8th bit set. If such
-a character is found \fscreen\fP processes the specified string
+Tell \fIscreen\fP to look out for characters with 8th bit set. If such
+a character is found \fIscreen\fP processes the specified string
and than outputs the character with the 8th bit stripped off.
Note that the string can contain any esc-sequences known to
-\fscreen\fP, too. (Example: Single Shift G2 = \eEN.)
+\fIscreen\fP, too. (Example: Single Shift G2 = \eEN.)
.TP 13
.BI OP " (bool)"
-Don't do a full vt100 style margin emulation. Same as the -O option.
+Don't do a full VT100 style margin emulation. Same as the -O option.
.TP 13
.BI 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 'xo'.
+capability is 'nx'.
.TP 13
.BI G0 " (bool)"
-Terminal can deal with ISO2022 font selection sequences.
+Terminal can deal with ISO 2022 font selection sequences.
.TP 13
.BI S0 " (str)"
Switch charset 'G0' to the specified charset. Default
@@ -2493,6 +2936,10 @@ Turn on autonuke. See the 'autonuke' command for more details.
.TP 13
.BI OL " (num)"
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.
.SH ENVIRONMENT
@@ -2503,7 +2950,7 @@ Number of columns on the terminal (overrides termcap entry).
Directory in which to look for .screenrc.
.IP ISCREENRC
Alternate user screenrc file.
-.IP LINES
+.IP LINES
Number of lines on the terminal (overrides termcap entry).
.IP LOCKPRG
Screen lock program.
@@ -2533,7 +2980,7 @@ Terminal description.
.PD 0
.IP $SYSSCREENRC 28
.IP /local/etc/screenrc
-\fscreen\fP initialization commands
+\fIscreen\fP initialization commands
.IP $ISCREENRC
.IP $SCREENRC
.IP $HOME/.iscreenrc
@@ -2550,7 +2997,7 @@ Written by the "termcap" output function
.IP /usr/tmp/screens/screen-exchange
or
.IP /tmp/screen-exchange
-\fscreen\fP `interprocess communication buffer'
+\fIscreen\fP `interprocess communication buffer'
.IP hardcopy.[0-9]
Screen images created by the hardcopy function
.IP screenlog.[0-9]
@@ -2574,10 +3021,12 @@ Originally created by Oliver Laumann, this latest version was
produced by Wayne Davison, Juergen Weigert and Michael Schroeder.
.SH COPYLEFT
+.nf
Copyright (C) 1993
Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
Copyright (C) 1987 Oliver Laumann
+.fi
.PP
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
@@ -2597,7 +3046,7 @@ Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
.nf
Ken Beal (kbeal@amber.ssd.csd.harris.com),
Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de),
-Toerless Eckert (eckert@immd4.informatik.uni-erlangen.de),
+Toerless Eckert (eckert@immd4.informatik.uni-erlangen.de),
Wayne Davison (davison@borland.com),
Patrick Wolfe (pat@kai.com, kailand!pat),
Bart Schaefer (schaefer@cse.ogi.edu),
@@ -2616,7 +3065,7 @@ 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 (phone@coombs.anu.edu.au),
+Matthew Green (mrgreen@mame.mu.oz.au),
Christopher Williams (cgw@unt.edu),
Matt Mosley (mattm@access.digex.net),
Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU).
@@ -2624,10 +3073,10 @@ Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU).
.SH VERSION
-This is version 3.5.1. Its roots are a merge of a custom version
+This is version 3.6.0. 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.
+numbered 2.x are copyright by Oliver Laumann.
.SH BUGS
@@ -2637,11 +3086,16 @@ numbered 2.x are copyright by Oliver Laumann.
correctly (they are ignored). `xn' is treated as a magic-margin
indicator.
.IP \(bu
-The \fIGR\fP set of ISO 2022 is not supported.
+.I Screen
+has no clue about double-high or double-wide characters.
+But this is the only area where
+.I vttest
+is allowed to fail.
.IP \(bu
-There is no keyboard input translation to VT100 sequences.
+.I Screen
+does not support color, although this has repeatedly been asked for.
.IP \(bu
-It is not possible to change the environment variable $TERMCAP when
+It is not possible to change the environment variable $TERMCAP when
reattaching under a different terminal type.
.IP \(bu
The support of terminfo based systems is very limited. Adding extra
@@ -2665,6 +3119,16 @@ to advertise that a user is logged on who really isn't.
.I Screen
may give a strange warning when your tty has no utmp entry.
.IP \(bu
+When the modem line was hung up,
+.I screen
+may not automatically detach (or quit)
+unless the device driver is configured to send a HANGUP signal.
+To detach a
+.I screen
+session use the -D or -d command line option.
+.IP \(bu
+A weird imagination is most useful to gain full advantage of all the features.
+.IP \(bu
Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to
.BR screen@uni-erlangen.de .
diff --git a/src/doc/screen.info b/src/doc/screen.info
new file mode 100644
index 0000000..f20488f
--- /dev/null
+++ b/src/doc/screen.info
@@ -0,0 +1,164 @@
+This is Info file screen.info, produced by Makeinfo-1.55 from the input
+file ./screen.texinfo.
+
+ This file documents the the `Screen' virtual terminal manager.
+
+ Copyright (c) 1993 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+ Permission is granted to copy and distribute modified versions of
+this manual under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+ Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Foundation.
+
+
+Indirect:
+screen.info-1: 877
+screen.info-2: 50270
+screen.info-3: 99564
+screen.info-4: 146565
+
+Tag Table:
+(Indirect)
+Node: Top877
+Node: Overview2760
+Node: Getting Started6133
+Node: Invoking Screen8337
+Node: Customization14009
+Node: Startup Files14496
+Node: Colon16206
+Node: Commands16828
+Node: Default Key Bindings17786
+Node: Command Summary22681
+Node: New Window32520
+Node: Chdir33225
+Node: Screen Command34196
+Node: Setenv35834
+Node: Shell36354
+Node: Term37027
+Node: Selecting37861
+Node: Next and Previous38398
+Node: Other Window38924
+Node: Select39466
+Node: Session Management40069
+Node: Detach40906
+Node: Power Detach42191
+Node: Lock42830
+Node: Multiuser Session43716
+Node: Multiuser44474
+Node: Acladd44861
+Node: Aclchg45356
+Node: Acldel46679
+Node: Wall47012
+Node: Writelock47254
+Node: Session Name48147
+Node: Suspend48694
+Node: Quit49026
+Node: Window Settings49451
+Node: Naming Windows50270
+Node: Title Command51771
+Node: Dynamic Titles52045
+Node: Title Prompts53579
+Node: Title Screenrc54660
+Node: Autonuke56298
+Node: Console56948
+Node: Kill57384
+Node: Login58207
+Node: Mode59026
+Node: Monitor59424
+Node: Obuflimit60837
+Node: Windows61659
+Node: Virtual Terminal62651
+Node: Control Sequences63644
+Node: Input Translation68906
+Node: Bell73419
+Node: Clear75267
+Node: Height75472
+Node: Info75748
+Node: Redisplay76575
+Node: Wrap77707
+Node: Reset78458
+Node: Width78770
+Node: Character Processing79192
+Node: Copy and Paste81230
+Node: Copy81835
+Node: Line Termination82680
+Node: Scrollback83089
+Node: Copy Mode Keys83578
+Node: Movement84393
+Node: Marking85547
+Node: Repeat count85922
+Node: Searching86236
+Node: Specials86498
+Node: Paste88271
+Node: Registers90832
+Node: Screen-Exchange91838
+Node: History92921
+Node: Subprocess Execution93661
+Node: Exec94025
+Node: Using Exec95599
+Node: Key Binding97254
+Node: Bind97897
+Node: Bind Examples98884
+Node: Command Character99564
+Node: Help101071
+Node: Bindkey101677
+Node: Bindkey Examples103220
+Node: Bindkey Control104173
+Node: Flow Control104770
+Node: Flow Control Summary105346
+Node: Flow108280
+Node: XON/XOFF109054
+Node: Termcap109427
+Node: Window Termcap110132
+Node: Dump Termcap115290
+Node: Termcap Syntax116005
+Node: Termcap Examples117610
+Node: Special Capabilities119651
+Node: Message Line121469
+Node: Privacy Message122380
+Node: Hardware Status Line122877
+Node: Last Message123506
+Node: Message Wait123933
+Node: Logging124359
+Node: Hardcopy124683
+Node: Log125479
+Node: Startup126214
+Node: echo126621
+Node: sleep127027
+Node: Startup Message127368
+Node: Miscellaneous127641
+Node: At128575
+Node: Break129883
+Node: Debug130286
+Node: License130670
+Node: Nethack130935
+Node: Number131611
+Node: Silence131980
+Node: Time132747
+Node: Version133121
+Node: Zombie133338
+Node: Printcmd134392
+Node: Environment135078
+Node: Files136160
+Node: Credits137286
+Node: Bugs139203
+Node: Known Bugs139673
+Node: Reporting Bugs141251
+Node: Availability142027
+Node: Installation142473
+Node: Socket Directory142863
+Node: Compiling Screen143393
+Node: Concept Index144785
+Node: Command Index146565
+Node: Keystroke Index153105
+
+End Tag Table
diff --git a/src/doc/screen.info-1 b/src/doc/screen.info-1
new file mode 100644
index 0000000..995cff0
--- /dev/null
+++ b/src/doc/screen.info-1
@@ -0,0 +1,1502 @@
+This is Info file screen.info, produced by Makeinfo-1.55 from the input
+file ./screen.texinfo.
+
+ This file documents the the `Screen' virtual terminal manager.
+
+ Copyright (c) 1993 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+ Permission is granted to copy and distribute modified versions of
+this manual under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+ Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Foundation.
+
+
+File: screen.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
+
+Screen
+******
+
+ This file documents the `Screen' virtual terminal manager, version
+3.6.0.
+
+* Menu:
+
+* Overview:: Preliminary information.
+* Getting Started:: An introduction to `screen'.
+* Invoking Screen:: Command line options for `screen'.
+* Customization:: The `.screenrc' file.
+* Commands:: List all of the commands.
+* New Window:: Running a program in a new window.
+* Selecting:: Selecting a window to display.
+* Session Management:: Suspending or detaching a session.
+* Window Settings:: titles, logging, etc.
+* Virtual Terminal:: Controlling the `screen' VT100 emulation.
+* Copy and Paste:: Exchanging text between windows and sessions.
+* Subprocess Execution:: I/O filtering with `exec'.
+* Key Binding:: Binding commands to keys.
+* Flow Control:: Trap or pass flow control characters.
+* Termcap:: Tweaking your terminal's termcap entry.
+* Message Line:: The `screen' message line.
+* Logging:: Keeping a record of your session.
+* Startup:: Functions only useful at `screen' startup.
+* Miscellaneous:: Various other commands.
+* Environment:: Environment variables used by `screen'.
+* Files:: Files used by `screen'.
+* Credits:: Who's who of `screen'.
+* Bugs:: What to do if you find a bug.
+* Installation:: Getting `screen' running on your system.
+* Concept Index:: Index of concepts.
+* Command Index:: Index of all `screen' commands.
+* Keystroke Index:: Index of default key bindings.
+
+
+File: screen.info, Node: Overview, Next: Getting Started, Prev: Top, Up: Top
+
+Overview
+********
+
+ Screen is a full-screen window manager that multiplexes a physical
+terminal between several processes, typically interactive shells. Each
+virtual terminal provides the functions of the DEC VT100 terminal and,
+in addition, several control functions from the ANSI X3.64 (ISO 6429)
+and ISO 2022 standards (e.g. insert/delete line and support for multiple
+character sets). There is a scrollback history buffer for each virtual
+terminal and a copy-and-paste mechanism that allows the user to move
+text regions between windows.
+
+ When `screen' is called, it creates a single window with a shell in
+it (or the specified command) and then gets out of your way so that you
+can use the program as you normally would. Then, at any time, you can
+create new (full-screen) windows with other programs in them (including
+more shells), kill the current window, view a list of the active
+windows, turn output logging on and off, copy text between windows, view
+the scrollback history, switch between windows, etc. All windows run
+their programs completely independent of each other. Programs continue
+to run when their window is currently not visible and even when the
+whole screen session is detached from the users terminal.
+
+ When a program terminates, `screen' (per default) kills the window
+that contained it. If this window was in the foreground, the display
+switches to the previously displayed window; if none are left, `screen'
+exits.
+
+ Everything you type is sent to the program running in the current
+window. The only exception to this is the one keystroke that is used to
+initiate a command to the window manager. By default, each command
+begins with a control-a (abbreviated `C-a' from now on), and is
+followed by one other keystroke. The command character (*note Command
+Character::.) and all the key bindings (*note Key Binding::.) can be
+fully customized to be anything you like, though they are always two
+characters in length.
+
+ The standard way to create a new window is to type `C-a c'. This
+creates a new window running a shell and switches to that window
+immediately, regardless of the state of the process running in the
+current window. Similarly, you can create a new window with a custom
+command in it by first binding the command to a keystroke (in your
+`.screenrc' file or at the `C-a :' command line) and then using it just
+like the `C-a c' command. In addition, new windows can be created by
+running a command like:
+
+ screen emacs prog.c
+
+from a shell prompt within a previously created window. This will not
+run another copy of `screen', but will instead supply the command name
+and its arguments to the window manager (specified in the $STY
+environment variable) who will use it to create the new window. The
+above example would start the `emacs' editor (editing `prog.c') and
+switch to its window.
+
+ If `/etc/utmp' is writable by `screen', an appropriate record will
+be written to this file for each window, and removed when the window is
+closed. This is useful for working with `talk', `script', `shutdown',
+`rsend', `sccs' and other similar programs that use the utmp file to
+determine who you are. As long as `screen' is active on your terminal,
+the terminal's own record is removed from the utmp file. *Note Login::.
+
+
+File: screen.info, Node: Getting Started, Next: Invoking Screen, Prev: Overview, Up: Top
+
+Getting Started
+***************
+
+ Before you begin to use `screen' you'll need to make sure you have
+correctly selected your terminal type, just as you would for any other
+termcap/terminfo program. (You can do this by using `tset', `qterm',
+or just `set term=mytermtype', for example.)
+
+ If you're impatient and want to get started without doing a lot more
+reading, you should remember this one command: `C-a ?' (*note Key
+Binding::.). Typing these two characters will display a list of the
+available `screen' commands and their bindings. Each keystroke is
+discussed in the section on keystrokes (*note Default Key Bindings::.).
+Another section (*note Customization::.) deals with the contents of your
+`.screenrc'.
+
+ If possible, choose a version of your terminal's termcap that has
+automatic margins turned *off*. This will ensure an accurate and
+optimal update of the screen in all circumstances. The next best thing
+is an auto-margin terminal that allows the last position on the screen
+to be updated without scrolling the screen (such as a VT100). This also
+allows the entire screen to be updated. If all you've got is a "true"
+auto-margin terminal, `screen' will be content to use it, but updating
+a character put into the last position on the screen may not be
+possible until the screen scrolls or the character is moved into a safe
+position in some other way. This delay can be shortened by using a
+terminal with insert-character capability.
+
+ If your terminal is of the second type (firm-margined `am'), you will
+want to let `screen' know about this, since a normal termcap doesn't
+distinguish this type of automatic margins from a "true" `am' terminal.
+You do this by specifying the `xn' capability in your termcap (*note
+`termcap' command: Termcap.), or by using the `-L' command-line option.
+`screen' needs this information to correctly update the screen. You
+don't need to worry about this if your terminal type starts with `vt',
+as `screen' assumes `xn' in that case.
+
+ *Note Special Capabilities::, for more information about telling
+`screen' what kind of terminal you have.
+
+
+File: screen.info, Node: Invoking Screen, Next: Customization, Prev: Getting Started, Up: Top
+
+Invoking `Screen'
+*****************
+
+ Screen has the following command-line options:
+
+`-a'
+ Include *all* capabilities (with some minor exceptions) in each
+ window's termcap, even if `screen' must redraw parts of the display
+ in order to implement a function.
+
+`-A'
+ Adapt the sizes of all windows to the size of the display. By
+ default, `screen' may try to restore its old window sizes when
+ attaching to resizable terminals (those with `WS' in their
+ descriptions, e.g. `suncmd' or some varieties of `xterm').
+
+`-c FILE'
+ Use FILE as the user's configuration file instead of the default
+ of `$HOME/.screenrc'.
+
+`-d [PID.SESSIONNAME]'
+`-D [PID.SESSIONNAME]'
+ Do not start `screen', but instead detach a `screen' session
+ running elsewhere (*note Detach::.). `-d' has the same effect as
+ typing `C-a d' from the controlling terminal for the session.
+ `-D' is the equivalent to the power detach key. If no session can
+ be detached, this option is ignored. The combination `screen -D
+ -r' can be used to log out from a remote terminal and transport the
+ session running there to your current terminal. *Note*: It is a
+ good idea to check the status of your sessions with `screen -list'
+ before using this option.
+
+`-e XY'
+ Set the command character to X, and the character generating a
+ literal command character (when typed after the command character)
+ to Y. The defaults are `C-a' and `a', which can be specified as
+ `-e^Aa'. When creating a `screen' session, this option sets the
+ default command caracter. In a multiuser session all users added
+ will start off with this command character. But when attaching to
+ an already running session, this option only changes the command
+ character of the attaching user. This option is equivalent to the
+ commands `defescape' or `escape' respectively. (*note Command
+ Character::.).
+
+`-f'
+`-fn'
+`-fa'
+ Set flow-control to on, off, or automatic switching mode,
+ respectively. This option is equivalent to the `defflow' command
+ (*note Flow Control::.).
+
+`-h NUM'
+ Set the history scrollback buffer to be NUM lines high.
+ Equivalent to the `defscrollback' command (*note Copy::.).
+
+`-i'
+ Cause the interrupt key (usually `C-c') to interrupt the display
+ immediately when flow control is on. This option is equivalent to
+ the `interrupt' argument to the `defflow' command (*note Flow
+ Control::.). Its use is discouraged.
+
+`-l'
+`-ln'
+ Turn login mode on or off (for `/etc/utmp' updating). This option
+ is equivalent to the `deflogin' command (*note Login::.).
+
+`-ls'
+`-list'
+ Do not start `screen', but instead print a list of session
+ identification strings (usually of the form PID.TTY.HOST; *note
+ Session Name::.). Sessions marked `detached' can be resumed with
+ `screen -r'. Those marked `attached' are running and have a
+ controlling terminal. Sessions marked as `dead' should be
+ thoroughly checked and removed. Ask your system administrator if
+ you are not sure why they died. Remove sessions with the `-wipe'
+ option.
+
+`-L'
+ 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::.).
+
+`-m'
+ Tell `screen' to ignore the `$STY' environment variable. When
+ this option is used, a new session will always be created,
+ regardless of whether `screen' is being called from within another
+ `screen' session or not.
+
+`-r [PID.SESSIONNAME]'
+`-r SESSIONOWNER/[PID.SESSIONNAME]'
+ Resume a detached `screen' session. No other options (except `-d'
+ or `-D') may be specified, though the session name (*note Session
+ Name::.) may be needed to distinguish between multiple detached
+ `screen' sessions. The second form is used to connect to another
+ users screen session which runs in multi-user mode. This indicates
+ that screen should look for sessions in another users directory.
+ This requires setuid-root.
+
+`-R'
+ Resume the first appropriate detached `screen' session. If
+ successful, all other command-line options are ignored. If no
+ detached session exists, start a new session using the specified
+ options, just as if `-R' had not been specified. This option is
+ set by default if screen is run as a login-shell.
+
+`-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::.).
+
+`-S SESSIONNAME'
+ Set the name of the new session to SESSIONNAME. This option can
+ be used to specify a meaningful name for the session in place of
+ the default TTY.HOST suffix. This name identifies the session for
+ the `screen -list' and `screen -r' commands. This option is
+ equivalent to the `sessionname' command (*note Session Name::.).
+
+`-t NAME'
+ Set the title (name) for the default shell or specified program.
+ This option is equivalent to the `shelltitle' command (*note
+ Shell::.).
+
+`-v'
+ Print the version number.
+
+`-wipe'
+ List available screens like `screen -ls', but remove destroyed
+ sessions instead of marking them as `dead'.
+
+`-x'
+ Attach to a session which is already attached elsewhere
+ (multi-display mode).
+
+
+File: screen.info, Node: Customization, Next: Commands, Prev: Invoking Screen, Up: Top
+
+Customizing `Screen'
+********************
+
+ You can modify the default settings for `screen' to fit your tastes
+either through a personal `.screenrc' file which contains commands to
+be executed at startup, or on the fly using the `colon' command.
+
+* Menu:
+
+* Startup Files:: The `.screenrc' file.
+* Colon:: Entering customization commands interactively.
+
+
+File: screen.info, Node: Startup Files, Next: Colon, Up: Customization
+
+The `.screenrc' file
+====================
+
+ When `screen' is invoked, it executes initialization commands from
+the files `.screenrc' in the user's home directory and
+`/usr/local/etc/screenrc'. These defaults can be overridden in the
+following ways: For the global screenrc file `screen' searches for the
+environment variable `$SYSSCREENRC' (this override feature may be
+disabled at compile-time). The user specific screenrc file is searched
+for in `$ISCREENRC', then `$SCREENRC', then ``$HOME'/.iscreenrc' and
+finally defaults to ``$HOME'/.screenrc'. The command line option `-c'
+specifies which file to use (*note Invoking Screen::.. Commands in
+these files are used to set options, bind commands to keys, and to
+automatically establish one or more windows at the beginning of your
+`screen' session. Commands are listed one per line, with empty lines
+being ignored. A command's arguments are separated by tabs or spaces,
+and may be surrounded by single or double quotes. A `#' turns the rest
+of the line into a comment, except in quotes. Unintelligible lines are
+warned about and ignored. Commands may contain references to
+environment variables. The syntax is the shell-like `$VAR' or
+`${VAR}'. Note that this causes incompatibility with previous `screen'
+versions, as now the '$'-character has to be protected with '\' if no
+variable substitution is intended. A string in single-quotes is also
+protected from variable substitution.
+
+ Two configuration files are shipped as examples with your screen
+distribution: `etc/screenrc' and `etc/etcscreenrc'. They contain a
+number of useful examples for various commands.
+
+
+File: screen.info, Node: Colon, Prev: Startup Files, Up: Customization
+
+Colon
+=====
+
+ Customization can also be done online, with this command:
+
+ - Command: colon
+ (`C-a :')
+ Allows you to enter `.screenrc' command lines. Useful for
+ on-the-fly modification of key bindings, specific window creation
+ and changing settings. Note that the `set' keyword no longer
+ exists, as of version 3.3. Change default settings with commands
+ starting with `def'. You might think of this as the `ex' command
+ mode of `screen', with `copy' as its `vi' command mode (*note Copy
+ and Paste::.).
+
+
+File: screen.info, Node: Commands, Next: New Window, Prev: Customization, Up: Top
+
+Commands
+********
+
+ A command in `screen' can either be bound to a key, invoked from a
+screenrc file, or called from the `colon' prompt (*note
+Customization::.). As of version 3.3, all commands can be bound to
+keys, although some may be less useful than others. For a number of
+real life working examples of the most important commands see the files
+`etc/screenrc' and `etc/etcscreenrc' of your screen distribution.
+
+ In this manual, a command definition looks like this:
+
+- Command: command [-n] ARG1 [ARG2] ...
+ (KEYBINDINGS)
+ This command does something, but I can't remember what.
+
+ An argument in square brackets (`[]') is optional. Many commands
+take an argument of `on' or `off', which is indicated as STATE in the
+definition.
+
+* Menu:
+
+* Default Key Bindings:: `screen' keyboard commands.
+* Command Summary:: List of all commands.
+
+
+File: screen.info, Node: Default Key Bindings, Next: Command Summary, Up: Commands
+
+Default Key Bindings
+====================
+
+ As mentioned previously, each keyboard command consists of a `C-a'
+followed by one other character. For your convenience, all commands
+that are bound to lower-case letters are also bound to their control
+character counterparts (with the exception of `C-a a'; see below).
+Thus, both `C-a c' and `C-a C-c' can be used to create a window.
+
+ The following table shows the default key bindings:
+
+`C-a ''
+`C-a "'
+ (select)
+ Prompt for a window identifier and switch. *Note Selecting::.
+
+`C-a 0...9'
+ (select 0...select 9)
+ Switch to window number 0...9. *Note Selecting::.
+
+`C-a C-a'
+ (other)
+ Toggle to the window displayed previously. *Note Selecting::.
+
+`C-a a'
+ (meta)
+ Send the command character (C-a) to window. See `escape' command.
+ *Note Command Character::.
+
+`C-a A'
+ (title)
+ Allow the user to enter a title for the current window. *Note
+ Naming Windows::.
+
+`C-a b'
+ itemx `C-a C-b' (break)
+ Send a break to the tty. *Note Break::.
+
+`C-a B'
+ (pow_break)
+ Close and reopen the tty-line. *Note Break::.
+
+`C-a c'
+`C-a C-c'
+ (screen)
+ Create a new window with a shell and switch to that window. *Note
+ Screen Command::.
+
+`C-a C'
+ (clear)
+ Clear the screen. *Note Clear::.
+
+`C-a d'
+`C-a C-d'
+ (detach)
+ Detach `screen' from this terminal. *Note Detach::.
+
+`C-a D D'
+ (pow_detach)
+ Detach and logout. *Note Power Detach::.
+
+`C-a f'
+`C-a C-f'
+ (flow)
+ Cycle flow among `on', `off' or `auto'. *Note Flow::.
+
+`C-a C-g'
+ (vbell)
+ Toggle visual bell mode. *Note Bell::.
+
+`C-a h'
+ (hardcopy)
+ Write a hardcopy of the current window to the file "hardcopy.N".
+ *Note Hardcopy::.
+
+`C-a H'
+ (log)
+ Toggle logging of the current window to the file "screenlog.N".
+ *Note Log::.
+
+`C-a i'
+`C-a C-i'
+ (info)
+ Show info about the current window. *Note Info::.
+
+`C-a k'
+`C-a C-k'
+ (kill)
+ Destroy the current window. *Note Kill::.
+
+`C-a l'
+`C-a C-l'
+ (redisplay)
+ Fully refresh the current window. *Note Redisplay::.
+
+`C-a L'
+ (login)
+ Toggle the current window's login state. *Note Login::.
+
+`C-a m'
+`C-a C-m'
+ (lastmsg)
+ Repeat the last message displayed in the message line. *Note Last
+ Message::.
+
+`C-a M'
+ (monitor) Toggle monitoring of the current window. *Note
+ Monitor::.
+
+`C-a SPC'
+`C-a n'
+`C-a C-n'
+ (next)
+ Switch to the next window. *Note Selecting::.
+
+`C-a N'
+ (number)
+ Show the number (and title) of the current window. *Note Number::.
+
+`C-a p'
+`C-a C-p'
+`C-a C-h'
+`C-a BackSpace'
+ (prev)
+ Switch to the previous window (opposite of `C-a n'). *Note
+ Selecting::.
+
+`C-a q'
+`C-a C-q'
+ (xon)
+ Send a ^Q (ASCII XON) to the current window. *Note XON/XOFF::.
+
+`C-a r'
+`C-a C-r'
+ (wrap)
+ Toggle the current window's line-wrap setting (turn the current
+ window's automatic margins on or off). *Note Wrap::.
+
+`C-a s'
+`C-a C-s'
+ (xoff)
+ Send a ^S (ASCII XOFF) to the current window. *Note XON/XOFF::.
+
+`C-a t'
+`C-a C-t'
+ (time)
+ Show the load average and xref. *Note Time::.
+
+`C-a v'
+`C-a C-v'
+ (version)
+ Display the version and compilation date. *Note Version::.
+
+`C-a w'
+`C-a C-w'
+ (windows)
+ Show a list of active windows. *Note Windows::.
+
+`C-a W'
+ (width)
+ Toggle between 80 and 132 columns. *Note Width::.
+
+`C-a x'
+`C-a C-x'
+ (lockscreen)
+ Lock your terminal. *Note Lock::.
+
+`C-a z'
+`C-a C-z'
+ (suspend)
+ Suspend `screen'. *Note Suspend::.
+
+`C-a Z'
+ (reset)
+ Reset the virtual terminal to its "power-on" values. *Note
+ Reset::.
+
+`C-a .'
+ (dumptermcap)
+ Write out a `.termcap' file. *Note Dump Termcap::.
+
+`C-a ?'
+ (help)
+ Show key bindings. *Note Help::.
+
+`C-a C-\'
+ (quit)
+ Kill all windows and terminate `screen'. *Note Quit::.
+
+`C-a :'
+ (colon)
+ Enter a command line. *Note Colon::.
+
+`C-a ['
+`C-a C-['
+`C-a ESC'
+ (copy)
+ Enter copy/scrollback mode. *Note Copy::.
+
+`C-a ]'
+`C-a C-]'
+ (paste .)
+ Write the contents of the paste buffer to the stdin queue of the
+ current window. *Note Paste::.
+
+`C-a {'
+ (history)
+ Copy and paste a previous (command) line. *Note History::.
+
+`C-a >'
+ (writebuf)
+ Write the paste buffer out to the screen-exchange file. *Note
+ Screen-Exchange::.
+
+`C-a <'
+ (readbuf)
+ Read the screen-exchange file into the paste buffer. *Note
+ Screen-Exchange::.
+
+`C-a ='
+ (removebuf)
+ Delete the screen-exchange file. *Note Screen-Exchange::.
+
+`C-a _'
+ (silence)
+ Start/stop monitoring the current window for inactivity. *Note
+ Silence::,
+
+`C-a ,'
+ (license)
+ Show the copyright page.
+
+
+File: screen.info, Node: Command Summary, Prev: Default Key Bindings, Up: Commands
+
+Command Summary
+===============
+
+`acladd USERNAMES'
+ Allow other users in this session. *Note Multiuser Session::.
+
+`aclchg USERNAMES PERMBITS LIST'
+ Change a user's permissions. *Note Multiuser Session::.
+
+`acldel USERNAME'
+ Disallow other user in this session. *Note Multiuser Session::.
+
+`activity MESSAGE'
+ Set the activity notification message. *Note Monitor::.
+
+`allpartial STATE'
+ Set all windows to partial refresh. *Note Redisplay::.
+
+`at [IDENT][`#'|`*'|`%'] COMMAND [ARGS]'
+ Execute a command at other displays or windows. *Note At::.
+
+`autodetach STATE'
+ Automatically detach the session on SIGHUP. *Note Detach::.
+
+`autonuke STATE'
+ Enable a clear screen to discard unwritten output. *Note
+ Autonuke::.
+
+`bell_msg MESSAGE'
+ Set the bell notification message. *Note Bell::.
+
+`bind KEY [COMMAND [ARGS]]'
+ Bind a command to a key. *Note Bind::.
+
+`bindkey [OPTS] [STRING [CMD ARGS]]'
+ Bind a string to a series of keystrokes. *Note Bindkey::.
+
+`break [DURATION]'
+ Send a break signal to the current window. *Note Break::.
+
+`bufferfile [EXCHANGE-FILE]'
+ Select a file for screen-exchange. *Note Screen-Exchange::.
+
+`c1 [STATE]'
+ Change c1 code processing. *Note Character Processing::.
+
+`chdir [DIRECTORY]'
+ Change the current directory for future windows. *Note Chdir::.
+
+`clear'
+ Clear the window screen. *Note Clear::.
+
+`colon'
+ Enter a `screen' command. *Note Colon::.
+
+`command'
+ Simulate the screen escape key. *Note Command Character::.
+
+`console [STATE]'
+ Grab or ungrab console output. *Note Console::.
+
+`copy'
+ Enter copy mode. *Note Copy::.
+
+`copy_reg [KEY]'
+ Removed. Use `paste' instead. *Note Registers::.
+
+`crlf STATE'
+ Select line break behavior for copying. *Note Line Termination::.
+
+`debug STATE'
+ Suppress/allow debugging output. *Note Debug::.
+
+`defautonuke STATE'
+ Select default autonuke behavior. *Note Autonuke::.
+
+`defc1 STATE'
+ Select default c1 processing behavior. *Note Character
+ Processing::.
+
+`defescape XY'
+ Set the default command and `meta' characters. *Note Command
+ Character::.
+
+`defflow FSTATE'
+ Select default flow control behavior. *Note Flow::.
+
+`defgr STATE'
+ Select default GR processing behavior. *Note Character
+ Processing::.
+
+`defkanji WTYPE'
+ Select default GR processing behavior. *Note Character
+ Processing::.
+
+`deflogin STATE'
+ Select default utmp logging behavior. *Note Login::.
+
+`defmode MODE'
+ Select default file mode for ptys. *Note Mode::.
+
+`defmonitor STATE'
+ Select default activity monitoring behavior. *Note Monitor::.
+
+`defobuflimit LIMIT'
+ Select default output buffer limit. *Note Obuflimit::.
+
+`defscrollback NUM'
+ Set default lines of scrollback. *Note Scrollback::.
+
+`defwrap STATE'
+ Set default line-wrapping behavior. *Note Wrap::.
+
+`defwritelock ON|OFF|AUTO'
+ Set default writelock behavior. *Note Multiuser::.
+
+`defzombie [KEYS]'
+ Keep dead windows. *Note Zombie::.
+
+`detach'
+ Disconnect `screen' from the terminal. *Note Detach::.
+
+`dumptermcap'
+ Write the window's termcap entry to a file. *Note Dump Termcap::.
+
+`echo [-n] MESSAGE'
+ Display a message on startup. *Note Startup::.
+
+`escape XY'
+ Set the command and `meta' characters. *Note Command Character::.
+
+`exec [[FDPAT] COMMAND [ARGS ...]]'
+ Run a subprocess (filter). *Note Exec::.
+
+`flow [FSTATE]'
+ Set flow control behavior. *Note Flow::.
+
+`gr [STATE]'
+ Change GR charset processing. *Note Character Processing::.
+
+`hardcopy'
+ Write out the contents of the current window. *Note Hardcopy::.
+
+`hardcopy_append STATE'
+ Append to hardcopy files. *Note Hardcopy::.
+
+`hardcopydir DIRECTORY'
+ Place, where to dump hardcopy files. *Note Hardcopy::.
+
+`hardstatus [STATE]'
+ Use the hardware status line. *Note Hardware Status Line::.
+
+`height [LINES]'
+ Set display height. *Note Height::.
+
+`help'
+ Display current key bindings. *Note Help::.
+
+`history'
+ Find previous command beginning .... *Note History::.
+
+`info'
+ Display terminal 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::.
+
+`lastmsg'
+ Redisplay the last message. *Note Last Message::.
+
+`license'
+ Display licensing information. *Note Startup::.
+
+`lockscreen'
+ Lock the controlling terminal. *Note Lock::.
+
+`log [STATE]'
+ Log all output in the current window. *Note Log::.
+
+`logdir DIRECTORY'
+ Place where to collect logfiles. *Note Log::.
+
+`login [STATE]'
+ Log the window in `/etc/utmp'. *Note Login::.
+
+`mapdefault'
+ Use only the default mapping table for the next keystroke. *Note
+ Bindkey Control::.
+
+`mapnotnext'
+ Don't try to do keymapping on the next keystroke. *Note Bindkey
+ Control::.
+
+`maptimeout TIMO'
+ Set the intercharacter timeout used for keymapping. *Note Bindkey
+ Control::.
+
+`markkeys STRING'
+ Rebind keys in copy mode. *Note Copy Mode Keys::.
+
+`meta'
+ Insert the command character. *Note Command Character::.
+
+`monitor [STATE]'
+ Monitor activity in window. *Note Monitor::.
+
+`msgminwait SEC'
+ Set minimum message wait. *Note Message Wait::.
+
+`msgwait SEC'
+ Set default message wait. *Note Message Wait::.
+
+`multiuser STATE'
+ Go into single or multi user mode. *Note Multiuser Session::.
+
+`nethack STATE'
+ Use `nethack'-like error messages. *Note Nethack::.
+
+`next'
+ Switch to the next window. *Note Selecting::.
+
+`number [N]'
+ Change/display the current window's number. *Note Number::.
+
+`obuflimit [LIMIT]'
+ Select output buffer limit. *Note Obuflimit::.
+
+`other'
+ Switch to the window you were in last. *Note Selecting::.
+
+`partial STATE'
+ Set window to partial refresh. *Note Redisplay::.
+
+`password [CRYPTED_PW]'
+ Set reattach password. *Note Detach::.
+
+`paste [SRC_REGS [DEST_REG]]'
+ Paste contents of paste buffer or registers somewhere. *Note
+ Paste::.
+
+`pastefont [STATE]'
+ Include font information in the paste buffer. *Note Paste::.
+
+`pow_break'
+ Close and Reopen the window's terminal. *Note Break::.
+
+`pow_detach'
+ Detach and hang up. *Note Power Detach::.
+
+`pow_detach_msg [MESSAGE]'
+ Set message displayed on `pow_detach'. *Note Power Detach::.
+
+`prev'
+ Switch to the previous window. *Note Selecting::.
+
+`printcmd [CMD]'
+ Set a command for VT100 printer port emulation. *Note Printcmd::.
+
+`process [KEY]'
+ Treat a register as input to `screen'. *Note Registers::.
+
+`quit'
+ Kill all windows and exit. *Note Quit::.
+
+`readbuf'
+ Read the paste buffer from the screen-exchange file. *Note
+ Screen-Exchange::.
+
+`readreg [REG [FILE]]'
+ Load a register from paste buffer or file. *Note Registers::.
+
+`redisplay'
+ Redisplay the current window. *Note Redisplay::.
+
+`register KEY STRING'
+ Store a string to a register. *Note Registers::.
+
+`removebuf'
+ Delete the screen-exchange file. *Note Screen-Exchange::.
+
+`reset'
+ Reset the terminal settings for the window. *Note Reset::.
+
+`screen [OPTS] [N] [CMD [ARGS]]'
+ Create a new window. *Note Screen Command::.
+
+`scrollback NUM'
+ Set size of scrollback buffer. *Note Scrollback::.
+
+`select [N]'
+ Switch to a specified window. *Note Selecting::.
+
+`sessionname [NAME]'
+ Name this session. *Note Session Name::.
+
+`setenv [VAR [STRING]]'
+ Set an environment variable for new windows. *Note Setenv::.
+
+`shell COMMAND'
+ Set the default program for new windows. *Note Shell::.
+
+`shelltitle TITLE'
+ Set the default name for new windows. *Note Shell::.
+
+`silence [STATE|SECONDS]'
+ Monitor a window for inactivity. *Note Silence::.
+
+`silencewait SECONDS'
+ Default timeout to trigger an inactivity notify. *Note Silence::.
+
+`sleep NUM'
+ Pause during startup. *Note Startup::.
+
+`slowpaste MSEC'
+ Slow down pasting in windows. *Note Paste::.
+
+`startup_message STATE'
+ Display copyright notice on startup. *Note Startup::.
+
+`stuff STRING'
+ Stuff a string in the input buffer of a window. *Note Paste::.
+
+`suspend'
+ Put session in background. *Note Suspend::.
+
+`term TERM'
+ Set `$TERM' for new windows. *Note Term::.
+
+`termcap TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]'
+ Tweak termcap entries for best performance. *Note Termcap
+ Syntax::.
+
+`terminfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]'
+ Ditto, for terminfo systems. *Note Termcap Syntax::.
+
+`time'
+ Display time and load average. *Note Time::.
+
+`title [WINDOWTITLE]'
+ Set the name of the current window. *Note Title Command::.
+
+`unsetenv VAR'
+ Unset environment variable for new windows. *Note Setenv::.
+
+`vbell [STATE]'
+ Use visual bell. *Note Bell::.
+
+`vbell_msg [MESSAGE]'
+ Set vbell message. *Note Bell::.
+
+`vbellwait SEC'
+ Set delay for vbell message. *Note Bell::.
+
+`version'
+ Display `screen' version. *Note Version::.
+
+`wall MESSAGE ...'
+ Write a message to all displays. *Note Multiuser Session::.
+
+`width [NUM]'
+ Set the width of the window. *Note Width::.
+
+`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::.
+
+`writelock ON|OFF|AUTO'
+ Grant exclusive write permission. *Note Multiuser Session::.
+
+`xoff'
+ Send an XOFF character. *Note XON/XOFF::.
+
+`xon'
+ Send an XON character. *Note XON/XOFF::.
+
+`zombie [KEYS]'
+ Keep dead windows. *Note Zombie::.
+
+
+File: screen.info, Node: New Window, Next: Selecting, Prev: Commands, Up: Top
+
+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.
+
+* Menu:
+
+* Chdir:: Change the working directory for new windows.
+* Screen Command:: Create a new window.
+* Setenv:: Set environment variables for new windows.
+* Shell:: Parameters for shell windows.
+* Term:: Set the terminal type for new windows.
+
+
+File: screen.info, Node: Chdir, Next: Screen Command, Up: New Window
+
+Chdir
+=====
+
+ - Command: chdir [DIRECTORY]
+ (none)
+ Change the current directory of `screen' to the specified directory
+ or, if called without an argument, to your home directory (the
+ value of the environment variable `$HOME'). All windows that are
+ created by means of the `screen' command from within `.screenrc'
+ or by means of `C-a : screen ...' or `C-a c' use this as their
+ default directory. Without a `chdir' command, this would be the
+ directory from which `screen' was invoked. Hardcopy and log files
+ are always written to the *window's* default directory, *not* the
+ current directory of the process running in the window. You can
+ use this command multiple times in your `.screenrc' to start
+ various windows in different default directories, but the last
+ `chdir' value will affect all the windows you create interactively.
+
+
+File: screen.info, Node: Screen Command, Next: Setenv, Prev: Chdir, Up: New Window
+
+Screen Command
+==============
+
+ - 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') ,
+ terminal type option (`-T TERM') and scrollback option (`-h NUM')
+ may be specified for each command. If an optional number N in the
+ range 0...9 is given, the window number N is assigned to the newly
+ created window (or, if this number is already in-use, the next
+ available number). If a command is specified after `screen', this
+ command (with the given arguments) is started in the window;
+ otherwise, a shell is created.
+
+ If a tty (character special device) name (e.g. `/dev/ttyS0') is
+ specified as cmd, then the window is directly connected to this
+ device. This is similar to the cmd `kermit -l /dev/ttyS0 -c' but
+ saves resources and is more efficient.
+
+ Thus, if your `.screenrc' contains the lines
+
+ # example for .screenrc:
+ screen 1
+ screen -fn -t foobar 2 telnet foobar
+
+`screen' creates a shell window (in window #1) and a window with a
+TELNET connection to the machine foobar (with no flow-control using the
+title `foobar' in window #2). If you do not include any `screen'
+commands in your `.screenrc' file, then `screen' defaults to creating a
+single shell window, number zero. When the initialization is
+completed, `screen' switches to the last window specified in your
+.screenrc file or, if none, it opens default window #0.
+
+
+File: screen.info, Node: Setenv, Next: Shell, Prev: Screen Command, Up: New Window
+
+Setenv
+======
+
+ - Command: setenv VAR STRING
+ (none)
+ Set the environment variable VAR to value STRING. If only VAR is
+ specified, the user will be prompted to enter a value. If no
+ parameters are specified, the user will be prompted for both
+ variable and value. The environment is inherited by all
+ subsequently forked shells.
+
+ - Command: unsetenv VAR
+ (none)
+ Unset an environment variable.
+
+
+File: screen.info, Node: Shell, Next: Term, Prev: Setenv, Up: New Window
+
+Shell
+=====
+
+ - Command: shell COMMAND
+ (none)
+ Set the command to be used to create a new shell. This overrides
+ the value of the environment variable `$SHELL'. This is useful if
+ you'd like to run a tty-enhancer which is expecting to execute the
+ program specified in `$SHELL'. If the command begins with a `-'
+ character, the shell will be started as a login-shell.
+
+ - Command: shelltitle TITLE
+ (none)
+ Set the title for all shells created during startup or by the C-a
+ C-c command. *Note Naming Windows::, for details about what
+ titles are.
+
+
+File: screen.info, Node: Term, Prev: Shell, Up: New Window
+
+Term
+====
+
+ - Command: term TERM
+ (none)
+ In each window `screen' opens, it sets the `$TERM' variable to
+ `screen' by default, unless no description for `screen' is
+ installed in the local termcap or terminfo data base. In that
+ case it pretends that the terminal emulator is `vt100'. This
+ won't do much harm, as `screen' is VT100/ANSI compatible. The use
+ of the `term' command is discouraged for non-default purpose.
+ That is, one may want to specify special `$TERM' settings (e.g.
+ vt100) for the next `screen rlogin othermachine' command. Use the
+ command `screen -T vt100 rlogin othermachine' rather than setting
+ (`term vt100') and resetting (`term screen') the default before
+ and after the `screen' command.
+
+
+File: screen.info, Node: Selecting, Next: Session Management, Prev: New Window, Up: Top
+
+Selecting a Window
+******************
+
+ This section describes the commands for switching between windows in
+an `screen' session. The windows are numbered from 0 to 9, and are
+created in that order by default (*note New Window::.).
+
+* Menu:
+
+* Next and Previous:: Forward or back one window.
+* Other Window:: Switch back and forth between two windows.
+* Select:: Specify a particular window.
+
+
+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
+ `]]', not `]C-a' (*note Command Character::.). On the other hand,
+ if you use the option `-e``', this command remains `` C-a', since
+ ```' is bound to `meta'.
+
+
+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).
+
+
+File: screen.info, Node: Session Management, Next: Window Settings, 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
+ (none)
+ Sets whether `screen' will automatically detach upon hangup, which
+ saves all your running programs until they are resumed with a
+ `screen -r' command. When turned off, a hangup signal will
+ terminate `screen' and all the processes it contains. Autodetach is
+ on by default.
+
+ - Command: detach
+ (`C-a d', `C-a C-d')
+ Detach the `screen' session (disconnect it from the terminal and
+ put it into the background). A detached `screen' can be resumed by
+ invoking `screen' with the `-r' option. (*note Invoking Screen::.)
+
+ - Command: password [CRYPTED_PW]
+ (none)
+ Present a crypted password in your `.screenrc' file and screen will
+ ask for it, whenever someone attempts to resume a detached
+ session. This is useful, if you have privileged programs running
+ under `screen' and you want to protect your session from reattach
+ attempts by users that managed to assume your uid. (I.e. any
+ superuser.) If no crypted password is specified, screen prompts
+ twice a password and places its encryption in the paste buffer.
+ Default is `none', which disables password checking.
+
+
+File: screen.info, Node: Power Detach, Next: Lock, Prev: Detach, Up: Session Management
+
+Power Detach
+============
+
+ - Command: pow_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
+ from your login shell.
+
+ - Command: pow_detach_msg [MESSAGE]
+ (none)
+ The MESSAGE specified here is output whenever a power detach is
+ performed. It may be used as a replacement for a logout message or
+ to reset baud rate, etc. Without parameter, the current message
+ is shown.
+
+
+File: screen.info, Node: Lock, Next: Multiuser Session, Prev: Power Detach, Up: Session Management
+
+Lock
+====
+
+ - Command: lockscreen
+ (`C-a x', `C-a C-x')
+ Call a screenlock program (`/local/bin/lck' or `/usr/bin/lock' or
+ a builtin, if no other is available). Screen does not accept any
+ command keys until this program terminates. Meanwhile processes in
+ the windows may continue, as the windows are in the detached state.
+ The screenlock program may be changed through the environment
+ variable `$LOCKPRG' (which must be set in the shell from which
+ `screen' is started) and is executed with the user's uid and gid.
+
+ Warning: When you leave other shells unlocked and have no password
+ set on `screen', the lock is void: One could easily re-attach from
+ an unlocked shell. This feature should rather be called
+ `lockterminal'.
+
+
+File: screen.info, Node: Multiuser Session, Next: Session Name, Prev: Lock, Up: Session Management
+
+Multiuser Session
+=================
+
+ These commands allow other users to gain access to one single
+`screen' session. When attaching to a multiuser `screen' the
+sessionname is specified as `username/sessionname' to the `-S' command
+line option. `Screen' must be compiled with multiuser support to
+enable features described here.
+
+* Menu:
+
+* Multiuser:: Enable / Disable multiuser mode.
+* Acladd:: Enable a specific user.
+* Aclchg:: Change a users permissions.
+* Acldel:: Disable a specific user.
+* Wall:: Write a message to all users.
+* Writelock:: Grant exclusive window access.
+
+
+File: screen.info, Node: Multiuser, Next: Acladd, Up: Multiuser Session
+
+Multiuser
+---------
+
+ - Command: multiuser STATE
+ (none)
+ Switch between single-user and multi-user mode. Standard screen
+ operation is single-user. In multi-user mode the commands
+ `acladd', `aclchg' and `acldel' can be used to enable (and
+ disable) other users accessing this `screen'.
+
+
+File: screen.info, Node: Acladd, Next: Aclchg, Prev: Multiuser, Up: Multiuser Session
+
+Acladd
+------
+
+ - Command: acladd USERNAMES
+ (none)
+ Enable users to fully access this screen session. USERNAMES can be
+ one user or a comma seperated list of users. This command enables
+ to attach to the `screen' session and performs the equivalent of
+ `aclchg USERNAMES +rwx "#?"'. To add a user with restricted access,
+ use the `aclchg' command below. Multi-user mode only.
+
+
+File: screen.info, Node: Aclchg, Next: Acldel, Prev: Acladd, Up: Multiuser Session
+
+Aclchg
+------
+
+ - Command: aclchg USERNAMES PERMBITS LIST
+ (none)
+ Change permissions for a comma seperated list of users.
+ Permission bits are represented as `r', `w' and `x'. Prefixing
+ `+' grants the permission, `-' removes it. The third parameter is
+ a comma seperated list of commands or windows (specified either by
+ number or title). The special list `#' refers to all windows, `?'
+ to all commands. If USERNAMES consists of a single `*', all known
+ users is affected. A command can be executed when the user has
+ the `x' bit for it. The user can type input to a window when he
+ has its `w' bit set and no other user obtains a writelock for this
+ window. Other bits are currently ignored. To withdraw the
+ writelock from another user in e.g. window 2: `aclchg USERNAME
+ -w+w 2'. To allow readonly access to the session: `aclchg USERNAME
+ -w "#"'. As soon as a user's name is known to screen, he can
+ attach to the session and (per default) has full permissions for
+ all command and windows. Execution permission for the acl
+ commands, `at' and others should also be removed or the user may
+ be able to regain write permission. Multi-user mode only.
+
+
+File: screen.info, Node: Acldel, Next: Wall, Prev: Aclchg, Up: Multiuser Session
+
+Acldel
+------
+
+ - Command: acldel USERNAME
+ (none)
+ Remove a user from screen's access control list. If currently
+ attached, all the user's displays are detached from the session.
+ He cannot attach again. Multi-user mode only.
+
+
+File: screen.info, Node: Wall, Next: Writelock, Prev: Acldel, Up: Multiuser Session
+
+Wall
+----
+
+ - Command: wall MESSAGE ...
+ (none)
+ Write a message to all displays. The message will appear in the
+ terminal's status line.
+
+
+File: screen.info, Node: Writelock, Prev: Wall, Up: Multiuser Session
+
+Writelock
+---------
+
+ - Command: writelock ON|OFF|AUTO
+ (none)
+ In addition to access control lists, not all users may be able to
+ write to the same window at once. Per default, writelock is in
+ `auto' mode and grants exclusive input permission to the user who
+ is the first to switch to the particular window. When he leaves
+ the window, other users may obtain the writelock (automatically).
+ The writelock of the current window is disabled by the command
+ `writelock off'. If the user issues the command `writelock on' he
+ keeps the exclusive write permission while switching to other
+ windows.
+
+ - Command: defwritelock ON|OFF|AUTO
+ (none)
+ Sets the default writelock behaviour for new windows. Initially
+ all windows will be created with automatic writelocks.
+
+
+File: screen.info, Node: Session Name, Next: Suspend, Prev: Multiuser Session, Up: Session Management
+
+Session Name
+============
+
+ - Command: sessionname [NAME]
+ (none)
+ Rename the current session. Note that for `screen -list' the name
+ shows up with the process-id prepended. If the argument NAME is
+ omitted, the name of this session is displayed.
+ *Caution*: The `$STY' environment variable still reflects the old
+ name. This may result in confusion. The default is constructed
+ from the tty and host names.
+
+
+File: screen.info, Node: Suspend, Next: Quit, Prev: Session Name, Up: Session Management
+
+Suspend
+=======
+
+ - Command: suspend
+ (`C-a z', `C-a C-z')
+ Suspend `screen'. The windows are in the detached state while
+ `screen' is suspended. This feature relies on the parent shell
+ being able to do job control.
+
+
+File: screen.info, Node: Quit, Prev: Suspend, Up: Session Management
+
+Quit
+====
+
+ - Command: quit
+ (`C-a C-\')
+ Kill all windows and terminate `screen'. Note that on VT100-style
+ 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::.).
+
+
+File: screen.info, Node: Window Settings, Next: Virtual Terminal, Prev: Session Management, Up: Top
+
+Window Settings
+***************
+
+ These commands control the way `screen' treats individual windows in
+a session. *Note Virtual Terminal::, for commands to control the
+terminal emulation itself.
+
+* Menu:
+
+* Naming Windows:: Control the name of the window
+* Autonuke:: Flush unseen output
+* Console:: See the host's console messages
+* Kill:: Destroy an unwanted window
+* Login:: Control `/etc/utmp' logging
+* Mode:: Control the file mode of the pty
+* Monitor:: Watch for activity in a window
+* Obuflimit:: Allow pending output when reading more
+* Windows:: List the active windows
+
diff --git a/src/doc/screen.info-2 b/src/doc/screen.info-2
new file mode 100644
index 0000000..5f24596
--- /dev/null
+++ b/src/doc/screen.info-2
@@ -0,0 +1,1270 @@
+This is Info file screen.info, produced by Makeinfo-1.55 from the input
+file ./screen.texinfo.
+
+ This file documents the the `Screen' virtual terminal manager.
+
+ Copyright (c) 1993 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+ Permission is granted to copy and distribute modified versions of
+this manual under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+ Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Foundation.
+
+
+File: screen.info, Node: Naming Windows, Next: Autonuke, Up: Window Settings
+
+Naming Windows (Titles)
+=======================
+
+ You can customize each window's name in the window display (viewed
+with the `windows' command (*note Windows::.) by setting it with one of
+the title commands. Normally the name displayed is the actual command
+name of the program created in the window. However, it is sometimes
+useful to distinguish various programs of the same name or to change
+the name on-the-fly to reflect the current state of the window.
+
+ The default name for all shell windows can be set with the
+`shelltitle' command (*note Shell::.). You can specify the name you
+want for a window with the `-t' option to the `screen' command when the
+window is created (*note Screen Command::.). To change the name after
+the window has been created you can use the title-string escape-sequence
+(`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.
+
+* Menu:
+
+* Title Command:: The `title' command.
+* Dynamic Titles:: Make shell windows change titles dynamically.
+* Title Prompts:: Set up your shell prompt for dynamic Titles.
+* Title Screenrc:: Set up Titles in your `.screenrc'.
+
+
+File: screen.info, Node: Title Command, Next: Dynamic Titles, Up: Naming Windows
+
+Title Command
+-------------
+
+ - Command: title [WINDOWTITLE]
+ (`C-a A')
+ Set the name of the current window to WINDOWALIAS. If no name is
+ specified, screen prompts for one.
+
+
+File: screen.info, Node: Dynamic Titles, Next: Title Prompts, Prev: Title Command, Up: Naming Windows
+
+Dynamic Titles
+--------------
+
+ `screen' has a shell-specific heuristic that is enabled by setting
+the window's name to SEARCH|NAME and arranging to have a null title
+escape-sequence output as a part of your prompt. The SEARCH portion
+specifies an end-of-prompt search string, while the NAME portion
+specifies the default shell name for the window. If the NAME ends in a
+`:' `screen' will add what it believes to be the current command
+running in the window to the end of the specified name (e.g. NAME:CMD).
+Otherwise the current command name supersedes the shell name while it
+is running.
+
+ Here's how it works: you must modify your shell prompt to output a
+null title-escape-sequence (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.
+
+
+File: screen.info, Node: Title Prompts, Next: Title Screenrc, Prev: Dynamic Titles, Up: Naming Windows
+
+Setting up your prompt for shell titles
+---------------------------------------
+
+ One thing to keep in mind when adding a null title-escape-sequence
+to your prompt is that some shells (like the csh) count all the
+non-control characters as part of the prompt's length. If these
+invisible characters aren't a multiple of 8 then backspacing over a tab
+will result in an incorrect display. One way to get around this is to
+use a prompt like this:
+
+ set prompt='k\% '
+
+ The escape-sequence `' not only normalizes the character
+attributes, but all the zeros round the length of the invisible
+characters up to 8.
+
+ Tcsh handles escape codes in the prompt more intelligently, so you
+can specify your prompt like this:
+
+ set prompt="%{\ek\e\\%}\% "
+
+ Bash users will probably want to echo the escape sequence in the
+PROMPT_COMMAND:
+
+ PROMPT_COMMAND='echo -n -e "\033k\033\134"'
+
+ (I used `\134' to output a `\' because of a bug in v1.04).
+
+
+File: screen.info, Node: Title Screenrc, Prev: Title Prompts, Up: Naming Windows
+
+Setting up shell Titles in your `.screenrc'
+-------------------------------------------
+
+ Here are some .screenrc examples:
+
+ screen -t top 2 nice top
+
+ Adding this line to your .screenrc would start a niced version of the
+`top' command in window 2 name `top' rather than `nice'.
+
+ shelltitle '> |csh'
+ screen 1
+
+ This file would start a shell using the given shelltitle. The title
+specified is an auto-title that would expect the prompt and the typed
+command to look something like the following:
+
+ /usr/joe/src/dir> trn
+
+ (it looks after the '> ' for the command name). The window status
+would show the name `trn' while the command was running, and revert to
+`csh' upon completion.
+
+ bind R screen -t '% |root:' su
+
+ Having this command in your .screenrc would bind the key sequence
+`C-a R' to the `su' command and give it an auto-title name of `root:'.
+For this auto-title to work, the screen could look something like this:
+
+ % !em
+ emacs file.c
+
+ Here the user typed the csh history command `!em' which ran the
+previously entered `emacs' command. The window status would show
+`root:emacs' during the execution of the command, and revert to simply
+`root:' at its completion.
+
+ bind o title
+ bind E title ""
+ bind u title (unknown)
+
+ The first binding doesn't have any arguments, so it would prompt you
+for a title when you type `C-a o'. The second binding would clear an
+auto-titles current setting (C-a E). The third binding would set the
+current window's title to `(unknown)' (C-a u).
+
+
+File: screen.info, Node: Autonuke, Next: Console, Prev: Naming Windows, Up: Window Settings
+
+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: Console, Next: Kill, Prev: Autonuke, Up: Window Settings
+
+Console
+=======
+
+ - Command: console [STATE]
+ (none)
+ Grabs or ungrabs the machines console output to a window. When the
+ argument is omitted the current state is displayed. *Note*: Only
+ the owner of `/dev/console' can grab the console output. This
+ command is only available if the host supports the ioctl
+ `TIOCCONS'.
+
+
+File: screen.info, Node: Kill, Next: Login, Prev: Console, Up: Window Settings
+
+Kill
+====
+
+ - Command: kill
+ (`C-a k', `C-a C-k')
+ Kill the current window.
+ If there is an `exec' command running (*note Exec::.) then it is
+ killed. Otherwise the process (e.g. shell) running in the window
+ receives a `HANGUP' condition, the window structure is removed and
+ screen switches to the previously displayed window. When the last
+ window is destroyed, `screen' exits.
+ *Caution*: `emacs' users may find themselves killing their `emacs'
+ session when trying to delete the current line. For this reason,
+ it is probably wise to use a different command character (*note
+ Command Character::.) or rebind `kill' to another key sequence,
+ such as `C-a K' (*note Key Binding::.).
+
+
+File: screen.info, Node: Login, Next: Mode, Prev: Kill, Up: Window Settings
+
+Login
+=====
+
+ - Command: deflogin STATE
+ (none)
+ Same as the `login' command except that the default setting for new
+ windows is changed. This defaults to `on' unless otherwise
+ specified at compile time (*note Installation::.). Both commands
+ are only present when `screen' has been compiled with utmp support.
+
+ - Command: login [STATE]
+ (`C-a L')
+ Adds or removes the entry in `/etc/utmp' for the current window.
+ This controls whether or not the window is "logged in". In
+ addition to this toggle, it is convenient to have "log in" and
+ "log out" keys. For instance, `bind I login on' and `bind O login
+ off' will map these keys to be `C-a I' and `C-a O' (*note Key
+ Binding::.).
+
+
+File: screen.info, Node: Mode, Next: Monitor, Prev: Login, Up: Window Settings
+
+Mode
+====
+
+ - Command: defmode MODE
+ (none)
+ The mode of each newly allocated pseudo-tty is set to MODE. MODE
+ is an octal number as used by chmod(1). Defaults to 0622 for
+ windows which are logged in, 0600 for others (e.g. when `-ln' was
+ specified for creation. *Note Screen Command::).
+
+
+File: screen.info, Node: Monitor, Next: Obuflimit, Prev: Mode, Up: Window Settings
+
+Monitoring
+==========
+
+ - Command: activity MESSAGE
+ (none)
+ When any activity occurs in a background window that is being
+ monitored, `screen' displays a notification in the message line.
+ The notification message can be redefined by means of the
+ `activity' command. Each occurrence of `%' in MESSAGE is replaced
+ by the number of the window in which activity has occurred, and
+ each occurrence of `~' is replaced by the definition for bell in
+ your termcap (usually an audible bell). The default message is
+
+ 'Activity in window %'
+
+ Note that monitoring is off for all windows by default, but can be
+ altered by use of the `monitor' command (`C-a M').
+
+ - Command: defmonitor STATE
+ (none)
+ Same as the `monitor' command except that the default setting for
+ new windows is changed. Initial setting is `off'.
+
+ - Command: monitor [STATE]
+ (`C-a M')
+ Toggles monitoring of the current window. When monitoring is
+ turned on and the affected window is switched into the background,
+ the activity notification message will be displayed in the status
+ line at the first sign of output, and the window will also be
+ marked with an `@' in the window-status display (*note
+ Windows::.). Monitoring defaults to `off' for all windows.
+
+
+File: screen.info, Node: Obuflimit, Next: Windows, Prev: Monitor, Up: Window Settings
+
+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: Windows, Prev: Obuflimit, Up: Window Settings
+
+Windows
+=======
+
+ - Command: windows
+ (`C-a w', `C-a C-w')
+ Uses the message line to display a list of all the windows. Each
+ window is listed by number with the name of the program running in
+ the window (or its title); the current window is marked with a `*';
+ the previous window is marked with a `-'; all the windows that are
+ logged in are marked with a `$' (*note Login::.); a background
+ window that has received a bell is marked with a `!'; a background
+ window that is being monitored and has had activity occur is
+ marked with an `@' (*note Monitor::.); a window which has output
+ logging turned on is marked with `(L)'; windows occupied by other
+ users are marked with `&'; windows in the zombie state are marked
+ with `Z'. If this list is too long to fit on the terminal's
+ status line only the portion around the current window is
+ displayed.
+
+
+File: screen.info, Node: Virtual Terminal, Next: Copy and Paste, Prev: Window Settings, Up: Top
+
+Virtual Terminal
+****************
+
+ Each window in a `screen' session emulates a VT100 terminal, with
+some extra functions added. The commands described here modify the
+terminal emulation.
+
+* Menu:
+
+* Control Sequences:: Details of the internal VT100 emulation.
+* Input Translation:: How keystrokes are remapped.
+* Bell:: Getting your attention.
+* Clear:: Clear the window display.
+* Height:: Changing the height of your terminal.
+* Info:: Terminal emulation statistics.
+* Redisplay:: When the display gets confusing.
+* Wrap:: Automatic margins.
+* Reset:: Recovering from ill-behaved applications.
+* Width:: Changing the width of your terminal.
+* Character Processing:: Change the effect of special characters.
+
+
+File: screen.info, Node: Control Sequences, Next: Input Translation, Up: Virtual Terminal
+
+Control Sequences
+=================
+
+ The following is a list of control sequences recognized by `screen'.
+`(V)' and `(A)' indicate VT100-specific and ANSI- or ISO-specific
+functions, respectively.
+
+ ESC E Next Line
+ ESC D Index
+ ESC M Reverse Index
+ ESC H Horizontal Tab Set
+ ESC Z Send VT100 Identification String
+ ESC 7 (V) Save Cursor and Attributes
+ ESC 8 (V) Restore Cursor and Attributes
+ ESC [s (A) Save Cursor and Attributes
+ ESC [u (A) Restore Cursor and Attributes
+ ESC c Reset to Initial State
+ ESC = (V) Application Keypad Mode
+ ESC > (V) Numeric Keypad Mode
+ ESC # 8 (V) Fill Screen with E's
+ ESC \ (A) String Terminator
+ ESC ^ (A) Privacy Message String (Message Line)
+ ESC ! Global Message String (Message Line)
+ ESC k Title Definition String
+ ESC P (A) Device Control String
+ Outputs a string directly to the host
+ terminal without interpretation.
+ ESC _ (A) Application Program Command (not used)
+ ESC ] (A) Operating System Command (not used)
+ Control-N (A) Lock Shift G1 (SO)
+ Control-O (A) Lock Shift G0 (SI)
+ ESC n (A) Lock Shift G2
+ ESC o (A) Lock Shift G3
+ ESC N (A) Single Shift G2
+ ESC O (A) Single Shift G3
+ ESC ( Pcs (A) Designate character set as G0
+ ESC ) Pcs (A) Designate character set as G1
+ ESC * Pcs (A) Designate character set as G2
+ ESC + Pcs (A) Designate character set as G3
+ ESC [ Pn ; Pn H Direct Cursor Addressing
+ ESC [ Pn ; Pn f Direct Cursor Addressing
+ ESC [ Pn J Erase in Display
+ Pn = None or 0 From Cursor to End of Screen
+ 1 From Beginning of Screen to Cursor
+ 2 Entire Screen
+ ESC [ Pn K Erase in Line
+ Pn = None or 0 From Cursor to End of Line
+ 1 From Beginning of Line to Cursor
+ 2 Entire Line
+ ESC [ Pn A Cursor Up
+ ESC [ Pn B Cursor Down
+ ESC [ Pn C Cursor Right
+ ESC [ Pn D Cursor Left
+ ESC [ Ps ;...; Ps m Select Graphic Rendition
+ Ps = None or 0 Default Rendition
+ 1 Bold
+ 2 (A) Faint
+ 3 (A) Standout Mode (ANSI: Italicized)
+ 4 Underlined
+ 5 Blinking
+ 7 Negative Image
+ 22 (A) Normal Intensity
+ 23 (A) Standout Mode off (ANSI: Italicized off)
+ 24 (A) Not Underlined
+ 25 (A) Not Blinking
+ 27 (A) Positive Image
+ ESC [ Pn g Tab Clear
+ Pn = None or 0 Clear Tab at Current Position
+ 3 Clear All Tabs
+ ESC [ Pn ; Pn r (V) Set Scrolling Region
+ ESC [ Pn I (A) Horizontal Tab
+ ESC [ Pn Z (A) Backward Tab
+ ESC [ Pn L (A) Insert Line
+ ESC [ Pn M (A) Delete Line
+ ESC [ Pn @ (A) Insert Character
+ ESC [ Pn P (A) Delete Character
+ ESC [ Ps ;...; Ps h Set Mode
+ ESC [ Ps ;...; Ps l Reset Mode
+ Ps = 4 (A) Insert Mode
+ ?1 (V) Application Cursor Keys
+ ?3 (V) Change Terminal Width to 132 columns
+ ?5 (V) Visible Bell (`On' followed by `Off')
+ ?6 (V) `Origin' Mode
+ ?7 (V) `Wrap' Mode
+ ESC [ 5 i (A) Start relay to printer (ANSI Media Copy)
+ ESC [ 4 i (A) Stop relay to printer (ANSI Media Copy)
+ ESC [ 8 ; Ph ; Pw t Resize the window to `Ph' lines and
+ `Pw' columns (SunView special)
+ ESC [ c Send VT100 Identification String
+ ESC [ > c Send Secondary Device Attributes String
+ ESC [ 6 n Send Cursor Position Report
+
+
+File: screen.info, Node: Input Translation, Next: Bell, Prev: Control Sequences, Up: Virtual Terminal
+
+Input Translation
+=================
+
+ In order to do a full VT100 emulation `screen' has to detect that a
+sequence of characters in the input stream was generated by a keypress
+on the user's keyboard and insert the VT100 style escape sequence.
+`Screen' has a very flexible way of doing this by making it possible to
+map arbitrary commands on arbitrary sequences of characters. For
+standard VT100 emulation the command will always insert a string in the
+input buffer of the window (see also command `stuff', *note Paste::.).
+Because the sequences generated by a keypress can change after a
+reattach from a different terminal type, it is possible to bind
+commands to the termcap name of the keys. `Screen' will insert the
+correct binding after each reattach. *Note Bindkey:: for further
+details on the syntax and examples.
+
+ Here is the table of the default key bindings. (A) means that the
+command is executed if the keyboard is switched into application mode.
+
+ Key name Termcap name Command
+ -----------------------------------------------------
+ Cursor up ku stuff \033[A
+ stuff \033OA (A)
+ Cursor down kd stuff \033[B
+ stuff \033OB (A)
+ Cursor right kr stuff \033[C
+ stuff \033OC (A)
+ Cursor left kl stuff \033[D
+ stuff \033OD (A)
+ Function key 0 k0 stuff \033[10~
+ Function key 1 k1 stuff \033OP
+ Function key 2 k2 stuff \033OQ
+ Function key 3 k3 stuff \033OR
+ Function key 4 k4 stuff \033OS
+ Function key 5 k5 stuff \033[15~
+ Function key 6 k6 stuff \033[17~
+ Function key 7 k7 stuff \033[18~
+ Function key 8 k8 stuff \033[19~
+ Function key 9 k9 stuff \033[20~
+ Function key 10 k; stuff \033[21~
+ Function key 11 F1 stuff \033[22~
+ Function key 12 F2 stuff \033[23~
+ Backspace kb stuff \010
+ Home kh stuff \033[1~
+ End kH stuff \033[4~
+ Insert kI stuff \033[2~
+ Delete kD stuff \033[3~
+ Page up kP stuff \033[5~
+ Page down kN stuff \033[6~
+ Keypad 0 f0 stuff 0
+ stuff \033Op (A)
+ Keypad 1 f1 stuff 1
+ stuff \033Oq (A)
+ Keypad 2 f2 stuff 2
+ stuff \033Or (A)
+ Keypad 3 f3 stuff 3
+ stuff \033Os (A)
+ Keypad 4 f4 stuff 4
+ stuff \033Ot (A)
+ Keypad 5 f5 stuff 5
+ stuff \033Ou (A)
+ Keypad 6 f6 stuff 6
+ stuff \033Ov (A)
+ Keypad 7 f7 stuff 7
+ stuff \033Ow (A)
+ Keypad 8 f8 stuff 8
+ stuff \033Ox (A)
+ Keypad 9 f9 stuff 9
+ stuff \033Oy (A)
+ Keypad + f+ stuff +
+ stuff \033Ok (A)
+ Keypad - f- stuff -
+ stuff \033Om (A)
+ Keypad * f* stuff *
+ stuff \033Oj (A)
+ Keypad / f/ stuff /
+ stuff \033Oo (A)
+ Keypad = fq stuff =
+ stuff \033OX (A)
+ Keypad . f. stuff .
+ stuff \033On (A)
+ Keypad , f, stuff ,
+ stuff \033Ol (A)
+ Keypad enter fe stuff \015
+ stuff \033OM (A)
+
+
+File: screen.info, Node: Bell, Next: Clear, Prev: Input Translation, Up: Virtual Terminal
+
+Bell
+====
+
+ - Command: bell_msg [MESSAGE]
+ (none)
+ When a bell character is sent to a background window, `screen'
+ displays a notification in the message line. The notification
+ message can be re-defined by means of the `bell' command. Each
+ occurrence of `%' in MESSAGE is replaced by the number of the
+ window to which a bell has been sent, and each occurrence of `~'
+ is replaced by the definition for bell in your termcap (usually an
+ audible bell). The default message is
+
+ 'Bell in window %'
+
+ An empty message can be supplied to the `bell_msg' command to
+ suppress output of a message line (`bell_msg ""').
+
+ - Command: vbell [STATE]
+ (`C-a C-g')
+ Sets or toggles the visual bell setting for the current window. If
+ `vbell' is switched to `on', but your terminal does not support a
+ visual bell, the visual bell message is displayed in the status
+ line when the bell character is received. Visual bell support of
+ a terminal is defined by the termcap variable `vb'. *Note Visual
+ Bell: (termcap)Bell, for more information on visual bells. The
+ equivalent terminfo capability is `flash'.
+
+ Per default, `vbell' is `off', thus the audible bell is used.
+
+ - Command: vbell_msg [MESSAGE]
+ (none)
+ Sets the visual bell message. MESSAGE is printed to the status
+ line if the window receives a bell character (^G), `vbell' is set
+ to `on' and the terminal does not support a visual bell. The
+ default message is `Wuff, Wuff!!'. Without parameter, the current
+ message is shown.
+
+ - Command: vbellwait SEC
+ (none)
+ Define a delay in seconds after each display of `screen' 's visual
+ bell message. The default is 1 second.
+
+
+File: screen.info, Node: Clear, Next: Height, Prev: Bell, Up: Virtual Terminal
+
+Clear
+=====
+
+ - Command: clear
+ (`C-a C')
+ Clears the screen and saves its contents to the scrollback buffer.
+
+
+File: screen.info, Node: Height, Next: Info, Prev: Clear, Up: Virtual Terminal
+
+Height
+======
+
+ - 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.
+
+
+File: screen.info, Node: Info, Next: Redisplay, Prev: Height, Up: Virtual Terminal
+
+Info
+====
+
+ - Command: info
+ (`C-a i', `C-a C-i')
+ Uses the message line to display some information about the current
+ window: the cursor position in the form `(COLUMN,ROW)' starting
+ with `(1,1)', the terminal width and height plus the size of the
+ scrollback buffer in lines, like in `(80,24)+50', various flag
+ settings (flow-control, insert mode, origin mode, wrap mode,
+ application-keypad mode, output logging, activity monitoring, and
+ redraw (`+' indicates enabled, `-' not)), 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'. 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
+ behaviour 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: Width, 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: Width, Next: Character Processing, Prev: Reset, Up: Virtual Terminal
+
+Width
+=====
+
+ - 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.
+
+
+File: screen.info, Node: Character Processing, Prev: Width, 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 screens 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: 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'.
+
+
+File: screen.info, Node: Copy and Paste, Next: Subprocess Execution, Prev: Virtual Terminal, Up: Top
+
+Copy and Paste
+**************
+
+ For those confined to a hardware terminal, these commands provide a
+cut and paste facility more powerful than those provided by most
+windowing systems.
+
+* Menu:
+
+* Copy:: Copy from scrollback to buffer
+* Paste:: Paste from buffer into window
+* Registers:: Longer-term storage
+* Screen-Exchange:: Sharing data between screen users
+* History:: Recalling previous input
+
+
+File: screen.info, Node: Copy, Next: Paste, Up: Copy and Paste
+
+Copying
+=======
+
+ - Command: copy
+ (`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
+ outlined below.
+
+* Menu:
+
+* Line Termination:: End copied lines with CR/LF
+* Scrollback:: Set the size of the scrollback buffer
+* Copy Mode Keys:: Remap keys in copy mode
+* Movement:: Move around in the scrollback buffer
+* Marking:: Select the text you want
+* Repeat count:: Repeat a command
+* Searching:: Find the text you want
+* Specials:: Other random keys
+
+
+File: screen.info, Node: Line Termination, Next: Scrollback, Up: Copy
+
+CR/LF
+-----
+
+ - 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
+ sequence `CR'/`LF'. Otherwise only `LF' is used. `crlf' is off
+ by default. When no parameter is given, the state is toggled.
+
+
+File: screen.info, Node: Scrollback, Next: Copy Mode Keys, Prev: Line Termination, Up: Copy
+
+Scrollback
+----------
+
+ - Command: defscrollback NUM
+ (none)
+ Same as the `scrollback' command except that the default setting
+ for new windows is changed. Defaults to 100.
+
+ - Command: scrollback NUM
+ (none)
+ Set the size of the scrollback buffer for new windows to NUM
+ lines. The default scrollback is 100 lines. Use `C-a i' to view
+ the current setting.
+
+
+File: screen.info, Node: Copy Mode Keys, Next: Movement, Prev: Scrollback, Up: Copy
+
+markkeys
+--------
+
+ - Command: markkeys STRING
+ (none)
+ This is a method of changing the keymap used for copy/history
+ mode. The string is made up of OLDCHAR=NEWCHAR pairs which are
+ separated by `:'. Example: The command `markkeys h=^B:l=^F:$=^E'
+ would set some keys to be more familiar to `emacs' users. If your
+ terminal sends characters, that cause you to abort copy mode, then
+ this command may help by binding these characters to do nothing.
+ The no-op character is `' and is used like this: `markkeys @=L=H'
+ if you do not want to use the `H' or `L' commands any longer. As
+ shown in this example, multiple keys can be assigned to one
+ function in a single statement.
+
+
+File: screen.info, Node: Movement, Next: Marking, Prev: Copy Mode Keys, Up: Copy
+
+Movement Keys
+-------------
+
+`h', `j', `k', `l' move the cursor line by line or column by column.
+
+`0', `^' and `$' move to the leftmost column or to the first or last
+non-whitespace character on the line.
+
+`H', `M' and `L' move the cursor to the leftmost column of the top,
+center or bottom line of the window.
+
+`+' and `-' move the cursor to the leftmost column of the next or
+previous line.
+
+`G' moves to the specified absolute line (default: end of buffer).
+
+`|' moves to the specified absolute column.
+
+`w', `b', `e' move the cursor word by word.
+
+`C-u' and `C-d' scroll the display up/down by the specified amount of
+lines while preserving the cursor position. (Default: half screenfull).
+
+`C-b' and `C-f' move the cursor up/down a full screen.
+
+`g' moves to the beginning of the buffer.
+
+`%' jumps to the specified percentage of the buffer.
+
+ Note that Emacs-style movement keys can be specified by a .screenrc
+command. (`markkeys "h=^B:l=^F:$=^E"') There is no simple method for a
+full emacs-style keymap, however, as this involves multi-character
+codes.
+
+
+File: screen.info, Node: Marking, Next: Repeat count, Prev: Movement, Up: Copy
+
+Marking
+-------
+
+ The copy range is specified by setting two marks. The text between
+these marks will be highlighted. Press `space' to set the first or
+second mark respectively.
+
+`Y' and `y' can be used to mark one whole line or to mark from start of
+line.
+
+`W' marks exactly one word.
+
+
+File: screen.info, Node: Repeat count, Next: Searching, Prev: Marking, Up: Copy
+
+Repeat Count
+------------
+
+ Any command in copy mode can be prefixed with a number (by pressing
+digits `0...9') which is taken as a repeat count. Example: `C-a C-[ H
+10 j 5 Y' will copy lines 11 to 15 into the paste buffer.
+
+
+File: screen.info, Node: Searching, Next: Specials, Prev: Repeat count, Up: Copy
+
+Searching
+---------
+
+`/' `vi'-like search forward.
+
+`?' `vi'-like search backward.
+
+`C-a s' `emacs' style incremental search forward.
+
+`C-r' `emacs' style reverse i-search.
+
+
+File: screen.info, Node: Specials, Prev: Searching, Up: Copy
+
+Specials
+--------
+
+ There are, however, some keys that act differently here from in
+`vi'. `Vi' does not allow to yank rectangular blocks of text, but
+`screen' does. Press
+
+`c' or `C' to set the left or right margin respectively. If no repeat
+count is given, both default to the current cursor position.
+Example: Try this on a rather full text screen: `C-a [ M 20 l SPACE c
+10 l 5 j C SPACE'.
+
+This moves one to the middle line of the screen, moves in 20 columns
+left, marks the beginning of the paste buffer, sets the left column,
+moves 5 columns down, sets the right column, and then marks the end of
+the paste buffer. Now try:
+`C-a [ M 20 l SPACE 10 l 5 j SPACE'
+
+and notice the difference in the amount of text copied.
+
+`J' joins lines. It toggles between 3 modes: lines separated by a
+newline character (012), lines glued seamless, or lines separated by a
+single space. Note that you can prepend the newline character with a
+carriage return character, by issuing a `set crlf on'.
+
+`v' is for all the `vi' users who use `:set numbers' - it toggles the
+left margin between column 9 and 1.
+
+`a' before the final space key turns on append mode. Thus the contents
+of the paste buffer will not be overwritten, but appended to.
+
+`A' turns on append mode and sets a (second) mark.
+
+`>' sets the (second) mark and writes the contents of the paste buffer
+to the screen-exchange file (`/tmp/screen-exchange' per default) once
+copy-mode is finished. *Note Screen-Exchange::.
+This example demonstrates how to dump the whole scrollback buffer to
+that file:
+`C-a [ g SPACE G $ >'.
+
+`C-g' gives information about the current line and column.
+
+`@' does nothing. Absolutely nothing. Does not even exit copy mode.
+
+
+File: screen.info, Node: Paste, Next: Registers, Prev: Copy, Up: Copy and Paste
+
+Paste
+=====
+
+ - Command: paste [REGISTERS [DESTINATION]]
+ (`C-a ]', `C-a C-]')
+ Write the (concatenated) contents of the specified registers to
+ the stdin stream of the current window. The register `.' is
+ treated as the paste buffer. If no parameter is specified the user
+ is prompted to enter a single register. The paste buffer can be
+ filled with the `copy', `history' and `readbuf' commands. Other
+ registers can be filled with the `register', `readreg' and `paste'
+ commands. If `paste' is called with a second argument, the
+ contents of the specified registers is pasted into the named
+ destination register rather than the window. If `.' is used as the
+ second argument, the display's paste buffer is the destination.
+ Note, that `paste' uses a wide variety of resources: Usually both,
+ a current window and a current display are required. But whenever
+ a second argument is specified no current window is needed. When
+ the source specification only contains registers (not the paste
+ buffer) then there need not be a current display (terminal
+ attached), as the registers are a global resource. The paste
+ buffer exists once for every user.
+
+ - Command: 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
+ (none)
+ Define the speed text is inserted by the `paste' command. If the
+ slowpaste value is nonzero text is written character by character.
+ `screen' will pause for MSEC milliseconds after each write to
+ allow the application to process the input. only use `slowpaste' if
+ your underlying system exposes flow control problems while pasting
+ large amounts of text.
+
+ - Command: readreg [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):
+
+ C-a : readreg p /etc/passwd
+ C-a : paste p
+
+
+File: screen.info, Node: Registers, Next: Screen-Exchange, Prev: Paste, Up: Copy and Paste
+
+Registers
+=========
+
+ - Command: copy_reg [KEY]
+ (none)
+ Removed. Use `readreg' instead.
+
+ - Command: ins_reg [KEY]
+ (none)
+ Removed. Use `paste' instead.
+
+ - Command: process [KEY]
+ (none)
+ Stuff the contents of the specified register into the `screen'
+ input queue. If no argument is given you are prompted for a
+ register name. The text is parsed as if it had been typed in from
+ the user's keyboard. This command can be used to bind multiple
+ actions to a single key.
+
+ - Command: register KEY STRING
+ (none)
+ Save the specified STRING to the register KEY.
+
+ - 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::
+
+
+
+File: screen.info, Node: Screen-Exchange, Next: History, Prev: Registers, Up: Copy and Paste
+
+Screen-Exchange
+===============
+
+ - Command: bufferfile [EXCHANGE-FILE]
+ (none)
+ Change the filename used for reading and writing with the paste
+ buffer. If the EXCHANGE-FILE parameter is omitted, `screen'
+ reverts to the default of `/tmp/screen-exchange'. The following
+ example will paste the system's password file into the screen
+ window (using the paste buffer, where a copy remains):
+
+ C-a : bufferfile /etc/passwd
+ C-a < C-a ]
+ C-a : bufferfile
+
+ - Command: readbuf
+ (`C-a <')
+ Reads the contents of the current screen-exchange file into the
+ paste buffer.
+
+ - Command: removebuf
+ (`C-a =')
+ Unlinks the screen-exchange file.
+
+ - Command: writebuf
+ (`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::.).
+
+
+File: screen.info, Node: History, Prev: Screen-Exchange, Up: Copy and Paste
+
+History
+=======
+
+ - Command: history
+ (`C-a {')
+ Usually users work with a shell that allows easy access to previous
+ commands. For example, `csh' has the command `!!' to repeat the
+ last command executed. `screen' provides a primitive way of
+ recalling "the command that started ...": You just type the first
+ letter of that command, then hit `C-a {' and `screen' tries to
+ find a previous line that matches with the prompt character to the
+ left of the cursor. This line is pasted into this window's input
+ queue. Thus you have a crude command history (made up by the
+ visible window and its scrollback buffer).
+
+
+File: screen.info, Node: Subprocess Execution, Next: Key Binding, Prev: Copy and Paste, Up: Top
+
+Subprocess Execution
+********************
+
+ Control Input or Output of a window by another filter process. Use
+with care!
+
+* Menu:
+
+* Exec:: The `exec' command syntax.
+* Using Exec:: Weird things that filters can do.
+
+
+File: screen.info, Node: Exec, Next: Using Exec, Up: Subprocess Execution
+
+Exec
+====
+
+ - Command: exec [[FDPAT] NEWCOMMAND [ARGS ... ]]
+ (none)
+ Run a unix subprocess (specified by an executable path NEWCOMMAND
+ and its optional arguments) in the current window. The flow of
+ data between newcommand's stdin/stdout/stderr, the process already
+ running (shell) and screen itself (window) is controlled by the
+ filedescriptor pattern FDPAT. This pattern is basically a three
+ character sequence representing stdin, stdout and stderr of
+ newcommand. A dot (`.') connects the file descriptor to screen. An
+ exclamation mark (`!') causes the file descriptor to be connected
+ to the already running process. A colon (`:') combines both.
+ User input will go to newcommand unless newcommand requests the
+ old process' output (FDPATs first character is `!' or `:') or a
+ pipe symbol (`|') is added to the end of FDPAT.
+ Invoking `exec' without arguments shows name and arguments of the
+ currently running subprocess in this window.
+ When a subprocess is running the `kill' command will affect it
+ instead of the window's process.
+ Refer to the postscript file `doc/fdpat.ps' for illustration of
+ all 21 possible combinations. Each drawing shows the numbers 210
+ representing the three file descriptors of newcommand. The box
+ marked `W' is usual pty that has the old process (shell) on its
+ slave side. The box marked `P' is the secondary pty that now has
+ screen at its master side.
+
+
+File: screen.info, Node: Using Exec, Prev: Exec, Up: Subprocess Execution
+
+Using Exec
+==========
+
+Abbreviations:
+
+ * Whitespace between the word `exec' and FDPAT and the command name
+ can be omitted.
+
+ * Trailing dots and a FDPAT consisting only of dots can be omitted.
+
+ * A simple `|' is synonymous for the `!..|' pattern.
+
+ * The word `exec' can be omitted when the `|' abbreviation is used.
+
+ * The word `exec' can always be replaced by leading `!'.
+
+Examples:
+
+`!/bin/sh'
+`exec /bin/sh'
+`exec ... /bin/sh'
+ Creates another shell in the same window, while the original shell
+ is still running. Output of both shells is displayed and user
+ input is sent to the new `/bin/sh'.
+
+`!!stty 19200'
+`exec!stty 19200'
+`exec !.. stty 19200'
+ Set the speed of the window's tty. If your stty command operates
+ on stdout, then add another `!'. This is a useful command, when a
+ screen window is directly connected to a serial line that needs to
+ be configured.
+
+`|less'
+`exec !..| less'
+ This adds a pager to the window output. The special character `|'
+ is needed to give the user control over the pager although it gets
+ its input from the window's process. This works, because `less'
+ listens on stderr (a behavior that `screen' would not expect
+ without the `|') when its stdin is not a tty.
+
+`!:sed -n s/.*Error.*/\007/p'
+ Sends window output to both, the user and the sed command. The sed
+ inserts an additional bell character (oct. 007) to the window
+ output seen by screen. This will cause 'Bell in window x'
+ messages, whenever the string `Error' appears in the window.
+
+
+File: screen.info, Node: Key Binding, Next: Flow Control, Prev: Subprocess Execution, Up: Top
+
+Key Binding
+***********
+
+ You may disagree with some of the default bindings (I know I do).
+The `bind' command allows you to redefine them to suit your preferences.
+
+* Menu:
+
+* Bind:: `bind' syntax.
+* Bind Examples:: Using `bind'.
+* Command Character:: The character used to start keyboard commands.
+* Help:: Show current key bindings.
+* Bindkey:: `bindkey' syntax.
+* Bindkey Examples:: Some easy examples.
+* Bindkey Control:: How to control the bindkey mechanism.
+
+
+File: screen.info, Node: Bind, Next: Bind Examples, Up: Key Binding
+
+The `bind' command
+==================
+
+ - Command: bind KEY [COMMAND [ARGS]]
+ (none)
+ Bind a command to a key. The KEY argument is either a single
+ character, a two-character sequence of the form `^x' (meaning
+ `C-x'), a backslash followed by an octal number (specifying the
+ ASCII code of the character), or a backslash followed by a second
+ character, such as `\^' or `\\'. The argument can also be quoted,
+ if you like. If no further argument is given, any previously
+ established binding for this key is removed. The COMMAND argument
+ can be any command (*note Command Index::.).
+
+ 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.
+
+
+File: screen.info, Node: Bind Examples, Next: Command Character, Prev: Bind, Up: Key Binding
+
+Examples of the `bind' command
+==============================
+
+Some examples:
+
+ bind ' ' windows
+ bind ^f screen telnet foobar
+ bind \033 screen -ln -t root -h 1000 9 su
+
+would bind the space key to the command that displays a list of windows
+(so that the command usually invoked by `C-a C-w' would also be
+available as `C-a space'), bind `C-f' to the command "create a window
+with a TELNET connection to foobar", and bind ESC to the command that
+creates an non-login window with title `root' in slot #9, with a
+super-user shell and a scrollbackbuffer of 1000 lines.
+
diff --git a/src/doc/screen.info-3 b/src/doc/screen.info-3
new file mode 100644
index 0000000..02a331b
--- /dev/null
+++ b/src/doc/screen.info-3
@@ -0,0 +1,1302 @@
+This is Info file screen.info, produced by Makeinfo-1.55 from the input
+file ./screen.texinfo.
+
+ This file documents the the `Screen' virtual terminal manager.
+
+ Copyright (c) 1993 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+ Permission is granted to copy and distribute modified versions of
+this manual under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+ Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Foundation.
+
+
+File: screen.info, Node: Command Character, Next: Help, Prev: Bind Examples, Up: Key Binding
+
+Command Character
+=================
+
+ - Command: escape XY
+ (none)
+ Set the command character to X and the character generating a
+ literal command character to Y (just like with the `-e' option).
+ Each argument is either a single character, a two-character
+ sequence of the form `^x' (meaning `C-x'), a backslash followed by
+ an octal number (specifying the ASCII code of the character), or a
+ backslash followed by a second character, such as `\^' or `\\'.
+ The default is `^Aa', but ```' is recommended by one of the
+ authors.
+
+ - Command: defescape XY
+ (none)
+ Set the default command characters. This is equivalent to the
+ command `escape' except that it is useful for multiuser sessions
+ only. In a multiuser session `escape' changes the command
+ character of the calling user, where `defescape' changes the
+ default command characters for users that will be added later.
+
+ - Command: meta
+ (`C-a a')
+ Send the command character (`C-a') to the process in the current
+ window. The keystroke for this command is the second parameter to
+ the `-e' command line switch (*note Invoking Screen::.), or the
+ `escape' .screenrc directive.
+
+ - Command: command
+ (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::
+
+
+File: screen.info, Node: Help, Next: Bindkey, Prev: Command Character, Up: Key Binding
+
+Help
+====
+
+ - Command: help
+ (`C-a ?')
+ Displays a help screen showing you all the key bindings. The first
+ pages list all the internal commands followed by their bindings.
+ Subsequent pages will display the custom commands, one command per
+ key. Press space when you're done reading each page, or return to
+ exit early. All other characters are ignored, except for the
+ command character, which will exit the help display and begin a
+ command. *Note Default Key Bindings::.
+
+
+File: screen.info, Node: Bindkey, Next: Bindkey Examples, Prev: Help, Up: Key Binding
+
+Bindkey
+=======
+
+ - Command: bindkey [OPTS] [STRING [CMD ARGS]]
+ (none)
+ This command manages screen's input translation tables. Every
+ entry in one of the tables tells screen how to react if a certain
+ sequence of characters is encountered. There are three tables: one
+ that should contain actions programmed by the user, one for the
+ default actions used for terminal emulation and one for screen's
+ copy mode to do cursor movement. *Note Input Translation:: for a
+ list of default key bindings.
+
+ If the `-d' option is given, bindkey modifies the default table,
+ `-m' changes the copy mode table and with neither option the user
+ table is selected. The argument `string' is the sequence of
+ characters to which an action is bound. This can either be a fixed
+ tring or a termcap keyboard capability name (selectable with the
+ `-k' option).
+
+ Some keys on a VT100 terminal can send a different string if
+ application mode is turned on (e.g. the cursor keys). Such keys
+ have two entries in the translation table. You can select the
+ application mode entry by specifying the `-a' option.
+
+ The `-t' option tells screen not to do intercharacter timing. One
+ cannot turn off the timing if a termcap capabilty is used.
+
+ `cmd' can be any of screen's commands with an arbitrary number of
+ `args'. If `cmd' is omitted the keybinding is removed from the
+ table.
+
+
+File: screen.info, Node: Bindkey Examples, Next: Bindkey Control, Prev: Bindkey, Up: Key Binding
+
+Bindkey Examples
+================
+
+Here are some examples of keyboard bindings:
+
+ bindkey -d
+
+Show all of the default key bindings. The application mode entries are
+marked with [A].
+
+ bindkey -k k1 select 1
+
+Make the "F1" key switch to window one.
+
+ bindkey -t foo stuff barfoo
+
+Make `foo' an abrevation of the word `barfoo'. Timeout is disabled so
+that users can type slowly.
+
+ bindkey "\024" mapdefault
+
+This keybinding makes `C-t' an escape character for keybindings. If you
+did the above `stuff barfoo' binding, you can enter the word `foo' by
+typing `C-t foo'. If you want to insert a `C-t' you have to press the
+key twice (i.e. escape the escape binding).
+
+ bindkey -k F1 command
+
+Make the F11 (not F1!) key an alternative screen escape (besides
+`C-a'). Note that `F11 F11' does not work in the current release of
+screen.
+
+
+File: screen.info, Node: Bindkey Control, Prev: Bindkey Examples, Up: Key Binding
+
+Bindkey Control
+===============
+
+ - Command: mapdefault
+ (none)
+ Tell screen that the next input character should only be looked up
+ in the default bindkey table.
+
+ - Command: mapnotnext
+ (none)
+ Like mapdefault, but don't even look in the default bindkey table.
+
+ - Command: maptimeout TIMO
+ (none)
+ Set the intercharacter timer for input sequence detection to a
+ timeout of TIMO ms. The default timeout is 300ms. Maptimeout with
+ no arguments shows the current setting.
+
+
+File: screen.info, Node: Flow Control, Next: Termcap, Prev: Key Binding, Up: Top
+
+Flow Control
+************
+
+ `screen' can trap flow control characters or pass them to the
+program, as you see fit. This is useful when your terminal wants to use
+XON/XOFF flow control and you are running a program which wants to use
+^S/^Q for other purposes (i.e. `emacs').
+
+* Menu:
+
+* Flow Control Summary:: The effect of `screen' flow control
+* Flow:: Setting the flow control behavior
+* XON/XOFF:: Sending XON or XOFF to the window
+
+
+File: screen.info, Node: Flow Control Summary, Next: Flow, Up: Flow Control
+
+About `screen' flow control settings
+====================================
+
+ Each window has a flow-control setting that determines how screen
+deals with the XON and XOFF characters (and perhaps the interrupt
+character). When flow-control is turned off, screen ignores the XON
+and XOFF characters, which allows the user to send them to the current
+program by simply typing them (useful for the `emacs' editor, for
+instance). The trade-off is that it will take longer for output from a
+"normal" program to pause in response to an XOFF. With flow-control
+turned on, XON and XOFF characters are used to immediately pause the
+output of the current window. You can still send these characters to
+the current program, but you must use the appropriate two-character
+screen commands (typically `C-a q' (xon) and `C-a s' (xoff)). The
+xon/xoff commands are also useful for typing C-s and C-q past a
+terminal that intercepts these characters.
+
+ Each window has an initial flow-control value set with either the
+`-f' option or the `defflow' command. By default the windows are set
+to automatic flow-switching. It can then be toggled between the three
+states 'fixed on', 'fixed off' and 'automatic' interactively with the
+`flow' command bound to `C-a f'.
+
+ The automatic flow-switching mode deals with flow control using the
+TIOCPKT mode (like `rlogin' does). If the tty driver does not support
+TIOCPKT, screen tries to determine the right mode based on the current
+setting of the application keypad -- when it is enabled, flow-control
+is turned off and visa versa. Of course, you can still manipulate
+flow-control manually when needed.
+
+ If you're running with flow-control enabled and find that pressing
+the interrupt key (usually C-c) does not interrupt the display until
+another 6-8 lines have scrolled by, try running screen with the
+`interrupt' option (add the `interrupt' flag to the `flow' command in
+your .screenrc, or use the `-i' command-line option). This causes the
+output that `screen' has accumulated from the interrupted program to be
+flushed. One disadvantage is that the virtual terminal's memory
+contains the non-flushed version of the output, which in rare cases can
+cause minor inaccuracies in the output. For example, if you switch
+screens and return, or update the screen with `C-a l' you would see the
+version of the output you would have gotten without `interrupt' being
+on. Also, you might need to turn off flow-control (or use auto-flow
+mode to turn it off automatically) when running a program that expects
+you to type the interrupt character as input, as the `interrupt'
+parameter only takes effect when flow-control is enabled. If your
+program's output is interrupted by mistake, a simple refresh of the
+screen with `C-a l' will restore it. Give each mode a try, and use
+whichever mode you find more comfortable.
+
+
+File: screen.info, Node: Flow, Next: XON/XOFF, Prev: Flow Control Summary, Up: Flow Control
+
+Flow
+====
+
+ - Command: defflow FSTATE [INTERRUPT]
+ (none)
+ Same as the `flow' command except that the default setting for new
+ windows is changed. Initial setting is `auto'. Specifying `flow
+ auto interrupt' has the same effect as the command-line options
+ `-fa' and `-i'. Note that if `interrupt' is enabled, all existing
+ displays are changed immediately to forward interrupt signals.
+
+ - Command: flow [FSTATE]
+ (`C-a f', `C-a C-f')
+ Sets the flow-control mode for this window to FSTATE, which can be
+ `on', `off' or `auto'. Without parameters it cycles the current
+ window's flow-control setting. Default is set by `defflow'.
+
+
+File: screen.info, Node: XON/XOFF, Prev: Flow, Up: Flow Control
+
+XON and XOFF
+============
+
+ - Command: xon
+ (`C-a q', `C-a C-q')
+ Send a ^Q (ASCII XON) to the program in the current window.
+ Redundant if flow control is set to `off' or `auto'.
+
+ - Command: xoff
+ (`C-a s', `C-a C-s')
+ Send a ^S (ASCII XOFF) to the program in the current window.
+
+
+File: screen.info, Node: Termcap, Next: Message Line, Prev: Flow Control, Up: Top
+
+Termcap
+*******
+
+ `screen' demands the most out of your terminal so that it can
+perform its VT100 emulation most efficiently. These functions provide
+means for tweaking the termcap entries for both your physical terminal
+and the one simulated by `screen'.
+
+* Menu:
+
+* Window Termcap:: Choosing a termcap entry for the window.
+* Dump Termcap:: Write out a termcap entry for the window.
+* Termcap Syntax:: The `termcap' and `terminfo' commands.
+* Termcap Examples:: Uses for `termcap'.
+* Special Capabilities:: Non-standard capabilities used by `screen'.
+
+
+File: screen.info, Node: Window Termcap, Next: Dump Termcap, Up: Termcap
+
+Choosing the termcap entry for a window
+=======================================
+
+ Usually `screen' tries to emulate as much of the VT100/ANSI standard
+as possible. But if your terminal lacks certain capabilities the
+emulation may not be complete. In these cases `screen' has to tell the
+applications that some of the features are missing. This is no problem
+on machines using termcap, because `screen' can use the `$TERMCAP'
+variable to customize the standard screen termcap.
+
+ But if you do a rlogin on another machine or your machine supports
+only terminfo this method fails. Because of this `screen' offers a way
+to deal with these cases. Here is how it works:
+
+ When `screen' tries to figure out a terminal name for itself, it
+first looks for an entry named `screen.TERM', where TERM is the
+contents of your `$TERM' variable. If no such entry exists, `screen'
+tries `screen' (or `screen-w', if the terminal is wide (132 cols or
+more)). If even this entry cannot be found, `vt100' is used as a
+substitute.
+
+ The idea is that if you have a terminal which doesn't support an
+important feature (e.g. delete char or clear to EOS) you can build a new
+termcap/terminfo entry for `screen' (named `screen.DUMBTERM') in which
+this capability has been disabled. If this entry is installed on your
+machines you are able to do a rlogin and still keep the correct
+termcap/terminfo entry. The terminal name is put in the `$TERM'
+variable of all new windows. `screen' also sets the `$TERMCAP'
+variable reflecting the capabilities of the virtual terminal emulated.
+Furthermore, the variable `$WINDOW' is set to the window number of each
+window.
+
+ The actual set of capabilities supported by the virtual terminal
+depends on the capabilities supported by the physical terminal. If, for
+instance, the physical terminal does not support underscore mode,
+`screen' does not put the `us' and `ue' capabilities into the window's
+`$TERMCAP' variable, accordingly. However, a minimum number of
+capabilities must be supported by a terminal in order to run `screen';
+namely scrolling, clear screen, and direct cursor addressing (in
+addition, `screen' does not run on hardcopy terminals or on terminals
+that over-strike).
+
+ Also, you can customize the `$TERMCAP' value used by `screen' by
+using the `termcap' command, or by defining the variable `$SCREENCAP'
+prior to startup. When the latter defined, its value will be copied
+verbatim into each window's `$TERMCAP' variable. This can either be
+the full terminal definition, or a filename where the terminal `screen'
+(and/or `screen-w') is defined.
+
+ Note that `screen' honors the `terminfo' command if the system uses
+the terminfo database rather than termcap. On such machines the
+`$TERMCAP' variable has no effect and you must use the `dumptermcap'
+command (*note Dump Termcap::.) and the `tic' program to generate
+terminfo entries for `screen' windows.
+
+ When the boolean `G0' capability is present in the termcap entry for
+the terminal on which `screen' has been called, the terminal emulation
+of `screen' supports multiple character sets. This allows an
+application to make use of, for instance, the VT100 graphics character
+set or national character sets. The following control functions from
+ISO 2022 are supported: `lock shift G0' (`SI'), `lock shift G1' (`SO'),
+`lock shift G2', `lock shift G3', `single shift G2', and `single shift
+G3'. When a virtual terminal is created or reset, the ASCII character
+set is designated as `G0' through `G3'. When the `G0' capability is
+present, screen evaluates the capabilities `S0', `E0', and `C0' if
+present. `S0' is the sequence the terminal uses to enable and start the
+graphics character set rather than `SI'. `E0' is the corresponding
+replacement for `SO'. `C0' gives a character by character translation
+string that is used during semi-graphics mode. This string is built
+like the `acsc' terminfo capability.
+
+ When the `po' and `pf' capabilities are present in the terminal's
+termcap entry, applications running in a `screen' window can send
+output to the printer port of the terminal. This allows a user to have
+an application in one window sending output to a printer connected to
+the terminal, while all other windows are still active (the printer
+port is enabled and disabled again for each chunk of output). As a
+side-effect, programs running in different windows can send output to
+the printer simultaneously. Data sent to the printer is not displayed
+in the window.
+
+ Some capabilities are only put into the `$TERMCAP' variable of the
+virtual terminal if they can be efficiently implemented by the physical
+terminal. For instance, `dl' (delete line) is only put into the
+`$TERMCAP' variable if the terminal supports either delete line itself
+or scrolling regions. Note that this may provoke confusion, when the
+session is reattached on a different terminal, as the value of
+`$TERMCAP' cannot be modified by parent processes. You can force
+`screen' to include all capabilities in `$TERMCAP' with the `-a'
+command-line option (*note Invoking Screen::.).
+
+
+File: screen.info, Node: Dump Termcap, Next: Termcap Syntax, Prev: Window Termcap, Up: Termcap
+
+Write out the window's termcap entry
+====================================
+
+ - Command: dumptermcap
+ (`C-a .')
+ Write the termcap entry for the virtual terminal optimized for the
+ currently active window to the file `.termcap' in the user's
+ `$HOME/.screen' directory (or wherever `screen' stores its
+ sockets. *note Files::.). This termcap entry is identical to the
+ value of the environment variable `$TERMCAP' that is set up by
+ `screen' for each window. For terminfo based systems you will need
+ to run a converter like `captoinfo' and then compile the entry with
+ `tic'.
+
+
+File: screen.info, Node: Termcap Syntax, Next: Termcap Examples, Prev: Dump Termcap, Up: Termcap
+
+The `termcap' command
+=====================
+
+ - Command: termcap TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]
+ - Command: terminfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]
+ (none)
+ Use this command to modify your terminal's termcap entry without
+ going through all the hassles involved in creating a custom
+ termcap entry. Plus, you can optionally customize the termcap
+ generated for the windows. If your system uses the terminfo
+ database rather than termcap, `screen' will understand the
+ `terminfo' command which has the same effects as the `termcap'
+ command. Thus users can write one .screenrc file that handles both
+ cases, although terminfo syntax is slightly different from termcap
+ syntax.
+
+ The first argument specifies which terminal(s) should be affected by
+this definition. You can specify multiple terminal names by separating
+them with `|'s. Use `*' to match all terminals and `vt*' to match all
+terminals that begin with `vt'.
+
+ Each TWEAK argument contains one or more termcap defines (separated
+by `:'s) to be inserted at the start of the appropriate termcap entry,
+enhancing it or overriding existing values. The first tweak modifies
+your terminal's termcap, and contains definitions that your terminal
+uses to perform certain functions. Specify a null string to leave this
+unchanged (e.g. ""). The second (optional) tweak modifies all the
+window termcaps, and should contain definitions that screen understands
+(*note Virtual Terminal::.).
+
+
+File: screen.info, Node: Termcap Examples, Next: Special Capabilities, Prev: Termcap Syntax, Up: Termcap
+
+Termcap Examples
+================
+
+ Some examples:
+
+ termcap xterm* xn:hs@
+
+Informs `screen' that all terminals that begin with `xterm' have firm
+auto-margins that allow the last position on the screen to be updated
+(xn), but they don't really have a status line (no 'hs' - append `@' to
+turn entries off). Note that we assume `xn' for all terminal names
+that start with `vt', but only if you don't specify a termcap command
+for that terminal.
+
+ termcap vt* xn
+ termcap vt102|vt220 Z0=\E[?3h:Z1=\E[?3l
+
+Specifies the firm-margined `xn' capability for all terminals that
+begin with `vt', and the second line will also add the escape-sequences
+to switch into (Z0) and back out of (Z1) 132-character-per-line mode if
+this is a VT102 or VT220. (You must specify Z0 and Z1 in your termcap
+to use the width-changing commands.)
+
+ termcap vt100 "" l0=PF1:l1=PF2:l2=PF3:l3=PF4
+
+This leaves your vt100 termcap alone and adds the function key labels to
+each window's termcap entry.
+
+ termcap h19|z19 am@:im=\E@:ei=\EO dc=\E[P
+
+Takes a h19 or z19 termcap and turns off auto-margins (am@) and enables
+the insert mode (im) and end-insert (ei) capabilities (the `@' in the
+`im' string is after the `=', so it is part of the string). Having the
+`im' and `ei' definitions put into your terminal's termcap will cause
+screen to automatically advertise the character-insert capability in
+each window's termcap. Each window will also get the delete-character
+capability (dc) added to its termcap, which screen will translate into
+a line-update for the terminal (we're pretending it doesn't support
+character deletion).
+
+ If you would like to fully specify each window's termcap entry, you
+should instead set the `$SCREENCAP' variable prior to running `screen'.
+*Note Virtual Terminal::, for the details of the `screen' terminal
+emulation. *Note Termcap: (termcap)Top, for more information on
+termcap definitions.
+
+
+File: screen.info, Node: Special Capabilities, 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.).
+
+`LP'
+ (bool)
+ Terminal has VT100 style margins (`magic margins'). Note that this
+ capability is obsolete -- `screen' now uses `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'.
+
+`B8'
+ (str)
+ Tell `screen' to look out for characters with 8th bit set. If such
+ a character is found `screen' processes the specified string and
+ than outputs the character with the 8th bit stripped off. Note
+ that the string can contain any esc-sequences known to `screen',
+ too. (Example: Single Shift G2 = \EN.)
+
+`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(%d'.
+
+`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.
+
+`KJ'
+ (str)
+ Set the kanji type of the terminal. Valid strings are `jis', `euc'
+ and `sjis'.
+
+
+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]
+ (none)
+ Toggles the use of the terminal's hardware status line. If `on',
+ `screen' will use this facility to display one line messages.
+ Otherwise these messages are overlayed in reverse video mode at the
+ display line. Note that the hardstatus feature can only be used if
+ the termcap/terminfo capabilities "hs", "ts", "fs" and "ds" are set
+ properly. Default is `on' whenever the "hs" capability is present.
+
+
+File: screen.info, Node: Last Message, Next: Message Wait, Prev: Hardware Status Line, Up: Message Line
+
+Display Last Message
+====================
+
+ - Command: lastmsg
+ (`C-a m', `C-a C-m')
+ Repeat the last message displayed in the message line. Useful if
+ you're typing when a message appears, because (unless your
+ terminal has a hardware status line) the message goes away when
+ you press a key.
+
+
+File: screen.info, Node: Message Wait, Prev: Last Message, Up: Message Line
+
+Message Wait
+============
+
+ - Command: msgminwait SEC
+ (none)
+ Defines the time `screen' delays a new message when another is
+ currently displayed. Defaults to 1 second.
+
+ - Command: msgwait SEC
+ (none)
+ Defines the time a message is displayed, if `screen' is not
+ disturbed by other activity. Defaults to 5 seconds.
+
+
+File: screen.info, Node: Logging, Next: Startup, Prev: Message Line, Up: Top
+
+Logging
+*******
+
+ This section describes the commands for keeping a record of your
+session.
+
+* Menu:
+
+* Hardcopy:: Dump the current screen to a file
+* Log:: Log the output of a window to a file
+
+
+File: screen.info, Node: Hardcopy, Next: Log, Up: Logging
+
+hardcopy
+========
+
+ - Command: hardcopy
+ (`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
+ (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
+ (none)
+ Defines a directory where hardcopy files will be placed. If unset
+ hardcopys are dumped in screen's current working directory.
+
+
+File: screen.info, Node: Log, Prev: Hardcopy, Up: Logging
+
+log
+===
+
+ - 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
+ number of the current window. If no parameter is given, the
+ logging state is toggled. The session log is appended to the
+ previous contents of the file if it already exists. The current
+ contents and the contents of the scrollback history are not
+ included in the session log. Default is `off'.
+
+ - Command: logdir DIRECTORY
+ (none)
+ Defines a directory where logfiles will be placed. If unset
+ logfiles are written in `screen's current working directory.
+
+
+File: screen.info, Node: Startup, Next: Miscellaneous, Prev: Logging, Up: Top
+
+Startup
+*******
+
+ This section describes commands which are only useful in the
+`.screenrc' file, for use at startup.
+
+* Menu:
+
+* echo:: Display a message.
+* sleep:: Pause execution of the `.screenrc'.
+* Startup Message:: Control display of the copyright notice.
+
+
+File: screen.info, Node: echo, Next: sleep, Up: Startup
+
+echo
+====
+
+ - 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.
+ The option `-n' may be used to suppress the line feed. See also
+ `sleep'. Echo is also useful for online checking of environment
+ variables.
+
+
+File: screen.info, Node: sleep, Next: Startup Message, Prev: echo, Up: Startup
+
+sleep
+=====
+
+ - 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
+ give users a chance to read the messages output by `echo'.
+
+
+File: screen.info, Node: Startup Message, Prev: sleep, Up: Startup
+
+Startup Message
+===============
+
+ - Command: startup_message STATE
+ (none)
+ Select whether you want to see the copyright notice during startup.
+ Default is `on', as you probably noticed.
+
+
+File: screen.info, Node: Miscellaneous, Next: Environment, Prev: Startup, Up: Top
+
+Miscellaneous commands
+**********************
+
+ The commands described here do not fit well under any of the other
+categories.
+
+* Menu:
+
+* At:: Execute a command at other displays or windows.
+* Break:: Send a break signal to the window.
+* Debug:: Suppress/allow debugging output.
+* License:: Display the disclaimer page.
+* Nethack:: Use `nethack'-like error messages.
+* Number:: Change the current window's number.
+* Silence:: Notify on inactivity.
+* Time:: Display the time and load average.
+* Version:: Display the version of `screen'.
+* Zombie:: Keep dead windows.
+* Printcmd:: Set command for VT100 printer port emulation.
+
+
+File: screen.info, Node: At, Next: Break, Up: Miscellaneous
+
+At
+==
+
+ - 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
+ `current display' setting) of the command. If the first parameter
+ describes a non-unique context, the command will be executed
+ multiple times. If the first parameter is of the form
+ `IDENTIFIER*' then identifier is matched against user names. The
+ command is executed once for each display of the selected user(s).
+ If the first parameter is of the form `IDENTIFIER%' identifier is
+ matched against displays. Displays are named after the ttys they
+ attach. The prefix `/dev/' or `/dev/tty' may be omitted from the
+ identifier. If IDENTIFIER has a `#' or nothing appended it is
+ matched against window numbers and titles. Omitting an identifier
+ in front of the `#', `*' or `%' character selects all users,
+ displays or windows because a prefix-match is performed. Note that
+ on the affected display(s) a short message will describe what
+ happened. Caution: Permission is checked for the owners or the
+ affected display(s), not for the initiator of the `at' command.
+
+
+File: screen.info, Node: Break, Next: Debug, Prev: At, Up: Miscellaneous
+
+Break
+=====
+
+ - Command: break [DURATION]
+ (none)
+ Send a break signal for DURATION*0.25 seconds to this window.
+ Most useful if a character device is attached to the window rather
+ than a shell process.
+
+ - Command: pow_break
+ (none)
+ Reopen the window's terminal line and send a break condition.
+
+
+File: screen.info, Node: Debug, Next: License, Prev: Break, Up: Miscellaneous
+
+Debug
+=====
+
+ - 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
+ default. Note that this command only affects debugging output
+ from the main `SCREEN' process.
+
+
+File: screen.info, Node: License, Next: Nethack, Prev: Debug, Up: Miscellaneous
+
+License
+=======
+
+ - Command: license
+ (none)
+ Display the disclaimer page. This is done whenever `screen' is
+ started without options, which should be often enough.
+
+
+File: screen.info, Node: Nethack, Next: Number, Prev: License, Up: Miscellaneous
+
+Nethack
+=======
+
+ - 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
+ messages which will often blur the facts a little, but are much
+ funnier to read. Anyway, standard messages often tend to be
+ unclear as well.
+
+ This option is only available if `screen' was compiled with the
+ NETHACK flag defined (*note Installation::.). The default setting
+ is then determined by the presence of the environment variable
+ `$NETHACKOPTIONS'.
+
+
+File: screen.info, Node: Number, Next: Silence, Prev: Nethack, Up: Miscellaneous
+
+Number
+======
+
+ - Command: number [N]
+ (`C-a N')
+ Change the current window's number. If the given number N is
+ already used by another window, both windows exchange their
+ numbers. If no argument is specified, the current window number
+ (and title) is shown.
+
+
+File: screen.info, Node: Silence, Next: Time, Prev: Number, Up: Miscellaneous
+
+Silence
+=======
+
+ - Command: silence [STATE|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 silence notification message in the status line after
+ a specified period of inactivity (silence). The default timeout
+ can be changed with the `silencewait' command or by specifying a
+ number of seconds instead of `on' or `off'. Silence is initially
+ off for all windows.
+
+ - Command: silencewait SECONDS
+ (none)
+ Define the time that all windows monitored for silence should wait
+ before displaying a message. Default is 30 seconds.
+
+
+File: screen.info, Node: Time, Next: Version, Prev: Silence, Up: Miscellaneous
+
+Time
+====
+
+ - Command: time
+ (`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::.).
+
+
+File: screen.info, Node: Version, Next: Zombie, Prev: Time, Up: Miscellaneous
+
+Version
+=======
+
+ - Command: version
+ (`C-a v', `C-a C-v')
+ Display the version and modification date in the message line.
+
+
+File: screen.info, Node: Zombie, Next: Printcmd, Prev: Version, Up: Miscellaneous
+
+Zombie
+======
+
+ - Command: zombie [KEYX]
+ - Command: defzombie [KEYX]
+ (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
+ specified to the zombie command, `dead' windows will remain in the
+ list. The `kill' kommand may be used to remove the window.
+ Pressing the first key in the dead window has the same effect.
+ Pressing the second key, however, screen will attempt to resurrect
+ the window. The process that was initially running in the window
+ will be launched again. Calling `zombie' without parameters will
+ clear the zombie setting, thus making windows disappear when the
+ process terminates.
+
+ As the zombie setting is affected globally for all windows, this
+ command should only be called `defzombie'. Until we need this as a
+ per window setting, the commands `zombie' and `defzombie' are
+ synonymous.
+
+
+File: screen.info, Node: Printcmd, Prev: Zombie, Up: Miscellaneous
+
+Printcmd
+========
+
+ - Command: printcmd [CMD]
+ (none)
+ If CMD is not an empty string, screen will not use the terminal
+ capabilities `po/pf' for printing if it detects an ansi print
+ sequence `ESC [ 5 i', but pipe the output into CMD. This should
+ normally be a command like `lpr' or `cat > /tmp/scrprint'.
+ `Printcmd' without an argument displays the current setting. The
+ ansi sequence `ESC \' ends printing and closes the pipe.
+
+ Warning: Be careful with this command! If other user have write
+ access to your terminal, they will be able to fire off print
+ commands.
+
+
+File: screen.info, Node: Environment, Next: Files, Prev: Miscellaneous, Up: Top
+
+Environment Variables
+*********************
+
+`COLUMNS'
+ Number of columns on the terminal (overrides termcap entry).
+
+`HOME'
+ Directory in which to look for .screenrc.
+
+`ISCREENRC'
+ Alternate user screenrc file.
+
+`LINES'
+ Number of lines on the terminal (overrides termcap entry).
+
+`LOCKPRG'
+ Screen lock program.
+
+`NETHACKOPTIONS'
+ Turns on `nethack' option.
+
+`PATH'
+ Used for locating programs to run.
+
+`SCREENCAP'
+ For customizing a terminal's `TERMCAP' value.
+
+`SCREENDIR'
+ Alternate socket directory.
+
+`SCREENRC'
+ Alternate user screenrc file.
+
+`SHELL'
+ Default shell program for opening windows (default `/bin/sh').
+
+`STY'
+ Alternate socket name. If `screen' is invoked, and the environment
+ variable `STY' is set, then it creates only a window in the
+ running `screen' session rather than starting a new session.
+
+`SYSSCREENRC'
+ Alternate system screenrc file.
+
+`TERM'
+ Terminal name.
+
+`TERMCAP'
+ Terminal description.
+
+
+File: screen.info, Node: Files, Next: Credits, Prev: Environment, Up: Top
+
+Files Referenced
+****************
+
+`.../screen-3.?.??/etc/screenrc'
+`.../screen-3.?.??/etc/etcscreenrc'
+ Examples in the `screen' distribution package for private and
+ global initialization files.
+
+``$SYSSCREENRC''
+`/local/etc/screenrc'
+ `screen' initialization commands
+
+``$ISCREENRC''
+``$SCREENRC''
+``$HOME'/.iscreenrc'
+``$HOME'/.screenrc'
+ Read in after /local/etc/screenrc
+
+``$ISCREENDIR'/S-LOGIN'
+``$SCREENDIR'/S-LOGIN'
+`/local/screens/S-LOGIN'
+ Socket directories (default)
+
+`/usr/tmp/screens/S-LOGIN'
+ Alternate socket directories.
+
+`SOCKET DIRECTORY/.termcap'
+ Written by the `dumptermcap' command
+
+`/usr/tmp/screens/screen-exchange or'
+`/tmp/screen-exchange'
+ `screen' interprocess communication buffer
+
+`hardcopy.[0-9]'
+ Screen images created by the hardcopy command
+
+`screenlog.[0-9]'
+ Output log files created by the log command
+
+`/usr/lib/terminfo/?/* or'
+`/etc/termcap'
+ Terminal capability databases
+
+`/etc/utmp'
+ Login records
+
+``$LOCKPRG''
+ Program for locking the terminal.
+
+
+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 (mrgreen@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.6.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.
+
+ * `screen' does not support color, although this has repeatedly been
+ asked for.
+
+ * 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.
+
+ * 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 latest beta testing release of `screen' is available from
+`ftp.uni-erlangen.de (131.188.1.43)', in the directory
+`pub/utilities/screen'.
+
+
+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. 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 777 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 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.
+* 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.
+* screenrc: Startup Files.
+* scrollback: Copy.
+* socket directory: Socket Directory.
+* terminal capabilities: Special Capabilities.
+* title: Naming Windows.
+
diff --git a/src/doc/screen.info-4 b/src/doc/screen.info-4
new file mode 100644
index 0000000..e8bc0dd
--- /dev/null
+++ b/src/doc/screen.info-4
@@ -0,0 +1,237 @@
+This is Info file screen.info, produced by Makeinfo-1.55 from the input
+file ./screen.texinfo.
+
+ This file documents the the `Screen' virtual terminal manager.
+
+ Copyright (c) 1993 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+ Permission is granted to copy and distribute modified versions of
+this manual under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+ Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Foundation.
+
+
+File: screen.info, Node: 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.
+* activity: Monitor.
+* allpartial: Redisplay.
+* at: At.
+* autodetach: Detach.
+* autonuke: Autonuke.
+* bell_msg: Bell.
+* bind: Bind.
+* bindkey: Bindkey.
+* break: Break.
+* bufferfile: Screen-Exchange.
+* c1: 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.
+* defc1: Character Processing.
+* defescape: Command Character.
+* defflow: Flow.
+* defgr: Character Processing.
+* defkanji: Character Processing.
+* deflogin: Login.
+* defmode: Mode.
+* defmonitor: Monitor.
+* defobuflimit: Obuflimit.
+* defscrollback: Scrollback.
+* defwrap: Wrap.
+* defwritelock: Writelock.
+* defzombie: Zombie.
+* detach: Detach.
+* dumptermcap: Dump Termcap.
+* echo: echo.
+* escape: Command Character.
+* exec: Exec.
+* flow: Flow.
+* gr: Character Processing.
+* hardcopy: Hardcopy.
+* hardcopydir: Hardcopy.
+* hardcopy_append: Hardcopy.
+* hardstatus: Hardware Status Line.
+* height: Height.
+* help: Help.
+* history: History.
+* info: Info.
+* ins_reg: Registers.
+* kanji: Character Processing.
+* kill: Kill.
+* lastmsg: Last Message.
+* license: License.
+* lockscreen: Lock.
+* log: Log.
+* logdir: 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.
+* number: Number.
+* obuflimit: Obuflimit.
+* 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.
+* 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.
+* startup_message: Startup Message.
+* stuff: Registers.
+* suspend: Suspend.
+* term: Term.
+* termcap: Termcap Syntax.
+* terminfo: Termcap Syntax.
+* time: Time.
+* title: Title Command.
+* unsetenv: Setenv.
+* vbell: Bell.
+* vbellwait: Bell.
+* vbell_msg: Bell.
+* version: Version.
+* wall: Wall.
+* width: Width.
+* 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.
+* .: Dump Termcap.
+* 0...9: Select.
+* :: Colon.
+* <: Screen-Exchange.
+* =: Screen-Exchange.
+* >: Screen-Exchange.
+* ?: Help.
+* {: History.
+* a: Command Character.
+* A: Title Command.
+* 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: Version.
+* C-w: Windows.
+* C-x: Lock.
+* C-z: Suspend.
+* C-[: Copy.
+* C-\: Quit.
+* C-]: Paste.
+* D: Power Detach.
+* d: Detach.
+* ESC: Copy.
+* f: Flow.
+* h: Hardcopy.
+* H: Log.
+* i: Info.
+* k: Kill.
+* l: Redisplay.
+* L: Login.
+* M: Monitor.
+* m: Last Message.
+* N: Number.
+* n: Next and Previous.
+* p: Next and Previous.
+* q: XON/XOFF.
+* r: Wrap.
+* s: XON/XOFF.
+* SPC: Next and Previous.
+* t: Time.
+* v: Version.
+* w: Windows.
+* W: Width.
+* x: Lock.
+* Z: Reset.
+* z: Suspend.
+* [: Copy.
+* ]: Paste.
+
+
diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo
index a544868..8db4f3f 100644
--- a/src/doc/screen.texinfo
+++ b/src/doc/screen.texinfo
@@ -5,7 +5,7 @@
@finalout
@setchapternewpage odd
@c %**end of header
-@set version 3.5
+@set version 3.6.0
@c For examples, use a literal escape in info.
@ifinfo
@@ -46,7 +46,7 @@ by the Foundation.
@title Screen
@subtitle The virtual terminal manager
@subtitle for Version @value{version}
-@subtitle Aug 1993
+@subtitle Nov 1994
@page
@vskip 0pt plus 1filll
@@ -124,10 +124,15 @@ can use the program as you normally would. Then, at any time, you can
create new (full-screen) windows with other programs in them (including
more shells), kill the current window, view a list of the active
windows, turn output logging on and off, copy text between windows, view
-the scrollback history, switch between windows, etc. When a program
-terminates, @code{screen} (per default) kills the window that contained it.
-If this window was in the foreground, the display switches to the previously
-displayed window; if none are left, @code{screen} exits.
+the scrollback history, switch between windows, etc. All windows run
+their programs completely independent of each other. Programs continue
+to run when their window is currently not visible and even when the
+whole screen session is detached from the users terminal.
+
+When a program terminates, @code{screen} (per default) kills the window
+that contained it. If this window was in the foreground, the display
+switches to the previously displayed window; if none are left,
+@code{screen} exits.
Everything you type is sent to the program running in the current
window. The only exception to this is the one keystroke that is used to
@@ -187,7 +192,7 @@ If possible, choose a version of your terminal's termcap that has
automatic margins turned @emph{off}. This will ensure an accurate and
optimal update of the screen in all circumstances. The next best thing
is an auto-margin terminal that allows the last position on the screen
-to be updated without scrolling the screen (such as a vt100). This also
+to be updated without scrolling the screen (such as a VT100). This also
allows the entire screen to be updated. If all you've got is a
``true'' auto-margin terminal, @code{screen} will be content to use it,
but updating a character put into the last position on the screen may
@@ -204,13 +209,6 @@ command-line option. @code{screen} needs this information to correctly
update the screen. You don't need to worry about this if your terminal
type starts with @samp{vt}, as @code{screen} assumes @samp{xn} in that case.
-If you are using a ``true'' auto-margin terminal (no @samp{xn}) at low baud
-rates, you may want to turn on a more optimal output mode by including
-the flag @samp{OP} in your termcap entry, or by specifying the @samp{-O}
-command-line option. The trade-off is that @code{screen} will no-longer
-accurately emulate the vt100's line-end quirks (e.g. the screen will
-scroll after putting @emph{one} character in the last screen position).
-
@xref{Special Capabilities}, for more information about telling
@code{screen} what kind of terminal you have.
@@ -231,7 +229,7 @@ in order to implement a function.
@item -A
Adapt the sizes of all windows to the size of the display. By default,
@code{screen} may try to restore its old window sizes when attaching to
-resizeable terminals (those with @samp{WS} in their descriptions, e.g.
+resizable terminals (those with @samp{WS} in their descriptions, e.g.
@code{suncmd} or some varieties of @code{xterm}).
@item -c @var{file}
@@ -240,7 +238,7 @@ of @file{$HOME/.screenrc}.
@item -d [@var{pid.sessionname}]
@itemx -D [@var{pid.sessionname}]
-Do not start @samp{screen}, but instead detach a @code{screen} session
+Do not start @code{screen}, but instead detach a @code{screen} session
running elsewhere (@pxref{Detach}). @samp{-d} has the same effect as
typing @kbd{C-a d} from the controlling terminal for the session.
@samp{-D} is the equivalent to the power detach key. If no session can
@@ -254,8 +252,13 @@ with @code{screen -list} before using this option.
Set the command character to @var{x}, and the character generating a
literal command character (when typed after the command character) to
@var{y}. The defaults are @kbd{C-a} and @kbd{a}, which can be specified
-as @samp{-e^Aa}. This option is equivalent to the @code{escape} command
-(@pxref{Command Character}).
+as @samp{-e^Aa}. When creating a @code{screen} session, this option
+sets the default command caracter. In a multiuser session all users
+added will start off with this command character. But when attaching
+to an already running session, this option only changes the command
+character of the attaching user.
+This option is equivalent to the commands @code{defescape} or
+@code{escape} respectively. (@pxref{Command Character}).
@item -f
@itemx -fn
@@ -301,17 +304,15 @@ this option is used, a new session will always be created, regardless of
whether @code{screen} is being called from within another @code{screen}
session or not.
-@item -O
-Select an output mode for your terminal which is more optimal than true
-vt100 emulation (only affects auto-margin terminals without @samp{xn}).
-This can also be set in your @file{.screenrc} by specifying @samp{OP} in a
-@code{termcap} command (@pxref{Termcap}).
-
@item -r [@var{pid.sessionname}]
+@itemx -r @var{sessionowner/[pid.sessionname]}
Resume a detached @code{screen} session. No other options (except
@samp{-d} or @samp{-D}) may be specified, though the session name
(@pxref{Session Name}) may be needed to distinguish between multiple
detached @code{screen} sessions.
+The second form is used to connect to another users screen session which
+runs in multi-user mode. This indicates that screen should look for
+sessions in another users directory. This requires setuid-root.
@item -R
Resume the first appropriate detached @code{screen} session. If
@@ -391,6 +392,10 @@ with previous @code{screen} versions, as now the '$'-character has to be
protected with '\' if no variable substitution is intended. A string in
single-quotes is also protected from variable substitution.
+Two configuration files are shipped as examples with your screen
+distribution: @file{etc/screenrc} and @file{etc/etcscreenrc}. They
+contain a number of useful examples for various commands.
+
@node Colon, , Startup Files, Customization
@section Colon
Customization can also be done online, with this command:
@@ -414,6 +419,9 @@ A command in @code{screen} can either be bound to a key, invoked from a
screenrc file, or called from the @code{colon} prompt
(@pxref{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 @file{etc/screenrc} and @file{etc/etcscreenrc}
+of your screen distribution.
In this manual, a command definition looks like this:
@@ -469,6 +477,17 @@ Send the command character (C-a) to window. See @code{escape} command.
Allow the user to enter a title for the current window.
@xref{Naming Windows}.
+@item @kbd{C-a b}
+itemx @kbd{C-a C-b}
+(break)@*
+Send a break to the tty.
+@xref{Break}.
+
+@item @kbd{C-a B}
+(pow_break)@*
+Close and reopen the tty-line.
+@xref{Break}.
+
@item @kbd{C-a c}
@itemx @kbd{C-a C-c}
(screen)@*
@@ -628,7 +647,7 @@ Enter copy/scrollback mode. @xref{Copy}.
@item @kbd{C-a ]}
@itemx @kbd{C-a C-]}
-(paste)@*
+(paste .)@*
Write the contents of the paste buffer to the stdin queue of the
current window. @xref{Paste}.
@@ -638,12 +657,12 @@ Copy and paste a previous (command) line. @xref{History}.
@item @kbd{C-a >}
(writebuf)@*
-Write the pastebuffer out to the screen-exchange file.
+Write the paste buffer out to the screen-exchange file.
@xref{Screen-Exchange}.
@item @kbd{C-a <}
(readbuf)@*
-Read the screen-exchange file into the pastebuffer.
+Read the screen-exchange file into the paste buffer.
@xref{Screen-Exchange}.
@item @kbd{C-a =}
@@ -653,6 +672,10 @@ Delete the screen-exchange file. @xref{Screen-Exchange}.
@item @kbd{C-a _}
(silence)@*
Start/stop monitoring the current window for inactivity. @xref{Silence},
+
+@item @kbd{C-a ,}
+(license)@*
+Show the copyright page.
@end table
@node Command Summary, , Default Key Bindings, Commands
@@ -660,12 +683,12 @@ Start/stop monitoring the current window for inactivity. @xref{Silence},
@cindex command summary
@table @code
-@item acladd @var{username}
-Allow other user in this session. @xref{Multiuser}.
-@item aclchg @var{username permbits list}
-Change a user's permissions. @xref{Multiuser}.
+@item acladd @var{usernames}
+Allow other users in this session. @xref{Multiuser Session}.
+@item aclchg @var{usernames permbits list}
+Change a user's permissions. @xref{Multiuser Session}.
@item acldel @var{username}
-Disallow other user in this session. @xref{Multiuser}.
+Disallow other user in this session. @xref{Multiuser Session}.
@item activity @var{message}
Set the activity notification message. @xref{Monitor}.
@item allpartial @var{state}
@@ -676,34 +699,48 @@ Execute a command at other displays or windows. @xref{At}.
Automatically detach the session on SIGHUP. @xref{Detach}.
@item autonuke @var{state}
Enable a clear screen to discard unwritten output. @xref{Autonuke}.
-@item bell @var{message}
+@item bell_msg @var{message}
Set the bell notification message. @xref{Bell}.
@item bind @var{key [command [args]]}
Bind a command to a key. @xref{Bind}.
+@item bindkey @var{[opts] [string [cmd args]]}
+Bind a string to a series of keystrokes. @xref{Bindkey}.
@item break @var{[duration]}
Send a break signal to the current window. @xref{Break}.
@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 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
+Simulate the screen escape key. @xref{Command Character}.
@item console @var{[state]}
Grab or ungrab console output. @xref{Console}.
@item copy
Enter copy mode. @xref{Copy}.
@item copy_reg @var{[key]}
-Store the copy buffer to a register. @xref{Registers}.
+Removed. Use @code{paste} instead. @xref{Registers}.
@item crlf @var{state}
Select line break behavior for copying. @xref{Line Termination}.
@item debug @var{state}
Suppress/allow debugging output. @xref{Debug}.
@item defautonuke @var{state}
Select default autonuke behavior. @xref{Autonuke}.
+@item defc1 @var{state}
+Select default c1 processing behavior. @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 defkanji @var{wtype}
+Select default GR processing behavior. @xref{Character Processing}.
@item deflogin @var{state}
Select default utmp logging behavior. @xref{Login}.
@item defmode @var{mode}
@@ -716,6 +753,10 @@ Select default output buffer limit. @xref{Obuflimit}.
Set default lines of scrollback. @xref{Scrollback}.
@item defwrap @var{state}
Set default line-wrapping behavior. @xref{Wrap}.
+@item defwritelock @var{on|off|auto}
+Set default writelock behavior. @xref{Multiuser}.
+@item defzombie @var{[keys]}
+Keep dead windows. @xref{Zombie}.
@item detach
Disconnect @code{screen} from the terminal. @xref{Detach}.
@item dumptermcap
@@ -728,6 +769,8 @@ Set the command and @code{meta} characters. @xref{Command Character}.
Run a subprocess (filter). @xref{Exec}.
@item flow @var{[fstate]}
Set flow control behavior. @xref{Flow}.
+@item gr @var{[state]}
+Change GR charset processing. @xref{Character Processing}.
@item hardcopy
Write out the contents of the current window. @xref{Hardcopy}.
@item hardcopy_append @var{state}
@@ -745,7 +788,9 @@ Find previous command beginning @dots{}. @xref{History}.
@item info
Display terminal settings. @xref{Info}.
@item ins_reg @var{[key]}
-Paste the contents of a register. @xref{Registers}.
+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
@@ -760,6 +805,12 @@ Log all output in the current window. @xref{Log}.
Place where to collect logfiles. @xref{Log}.
@item login @var{[state]}
Log the window in @file{/etc/utmp}. @xref{Login}.
+@item mapdefault
+Use only the default mapping table for the next keystroke. @xref{Bindkey Control}.
+@item mapnotnext
+Don't try to do keymapping on the next keystroke. @xref{Bindkey Control}.
+@item maptimeout @var{timo}
+Set the intercharacter timeout used for keymapping. @xref{Bindkey Control}.
@item markkeys @var{string}
Rebind keys in copy mode. @xref{Copy Mode Keys}.
@item meta
@@ -771,7 +822,7 @@ Set minimum message wait. @xref{Message Wait}.
@item msgwait @var{sec}
Set default message wait. @xref{Message Wait}.
@item multiuser @var{state}
-Go into single or multi user mode. @xref{Multiuser}.
+Go into single or multi user mode. @xref{Multiuser Session}.
@item nethack @var{state}
Use @code{nethack}-like error messages. @xref{Nethack}.
@item next
@@ -786,22 +837,28 @@ Switch to the window you were in last. @xref{Selecting}.
Set window to partial refresh. @xref{Redisplay}.
@item password @var{[crypted_pw]}
Set reattach password. @xref{Detach}.
-@item paste
-Paste contents of copy buffer. @xref{Paste}.
+@item paste @var{[src_regs [dest_reg]]}
+Paste contents of paste buffer or registers somewhere. @xref{Paste}.
+@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]}
+Set a command for VT100 printer port emulation. @xref{Printcmd}.
@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 copy buffer from the screen-exchange file. @xref{Screen-Exchange}.
+Read the paste buffer from the screen-exchange file. @xref{Screen-Exchange}.
+@item readreg @var{[reg [file]]}
+Load a register from paste buffer or file. @xref{Registers}.
@item redisplay
Redisplay the current window. @xref{Redisplay}.
@item register @var{key string}
@@ -825,15 +882,17 @@ 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]}
-Monitor window for inactivity. @xref{Silence}.
+Monitor a window for inactivity. @xref{Silence}.
@item silencewait @var{seconds}
Default timeout to trigger an inactivity notify. @xref{Silence}.
@item sleep @var{num}
Pause during startup. @xref{Startup}.
@item slowpaste @var{msec}
-Slow down pasting. @xref{Paste}.
+Slow down pasting in windows. @xref{Paste}.
@item startup_message @var{state}
Display copyright notice on startup. @xref{Startup}.
+@item stuff @var{string}
+Stuff a string in the input buffer of a window. @xref{Paste}.
@item suspend
Put session in background. @xref{Suspend}.
@item term @var{term}
@@ -850,14 +909,14 @@ Set the name of the current window. @xref{Title Command}.
Unset environment variable for new windows. @xref{Setenv}.
@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}.
@item version
Display @code{screen} version. @xref{Version}.
@item wall @var{message ...}
-Write a message to all displays. @xref{Multiuser}.
+Write a message to all displays. @xref{Multiuser Session}.
@item width @var{[num]}
Set the width of the window. @xref{Width}.
@item windows
@@ -865,14 +924,14 @@ List active windows. @xref{Windows}.
@item wrap @var{[state]}
Control line-wrap behavior. @xref{Wrap}.
@item writebuf
-Write copy buffer to screen-exchange file. @xref{Screen-Exchange}.
+Write paste buffer to screen-exchange file. @xref{Screen-Exchange}.
@item writelock @var{on|off|auto}
-Grant exclusive write permission. @xref{Multiuser}.
+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{[key]}
+@item zombie @var{[keys]}
Keep dead windows. @xref{Zombie}.
@end table
@@ -925,6 +984,11 @@ the window number @var{n} is assigned to the newly created window (or,
if this number is already in-use, the next available number). If a
command is specified after @code{screen}, this command (with the given
arguments) is started in the window; otherwise, a shell is created.
+
+If a tty (character special device) name (e.g. @samp{/dev/ttyS0})
+is specified as cmd, then the window is directly connected to this
+device. This is similar to the cmd @samp{kermit -l /dev/ttyS0 -c} but
+saves resources and is more efficient.
@end deffn
Thus, if your @file{.screenrc} contains the lines
@@ -1050,6 +1114,11 @@ C-a}, since @kbd{``} is bound to @code{meta}.
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.
+When a new window is established, the lowest available number
+is assigned to this window.
+Thus, the first window can be activated by @code{select 0}; there
+can be no more than 10 windows present simultaneously (unless screen is
+compiled with a higher MAXWIN setting).
@end deffn
@node Session Management, Window Settings, Selecting, Top
@@ -1100,7 +1169,7 @@ is useful, if you have privileged programs running under @code{screen}
and you want to protect your session from reattach attempts by users
that managed to assume your uid. (I.e. any superuser.) If no crypted
password is specified, screen prompts twice a password and places its
-encryption in the copybuffer. Default is `none', which disables
+encryption in the paste buffer. Default is `none', which disables
password checking.
@end deffn
@@ -1116,11 +1185,12 @@ to the parent process of @code{screen}.@*
logout if @code{screen} was started from your login shell.
@end deffn
-@deffn Command pow_detach_msg message
+@deffn Command pow_detach_msg [message]
(none)@*
The @var{message} specified here is output whenever a power detach is
performed. It may be used as a replacement for a logout message or to reset
baud rate, etc.
+Without parameter, the current message is shown.
@end deffn
@node Lock, Multiuser Session, Power Detach, Session Management
@@ -1136,6 +1206,11 @@ windows may continue, as the windows are in the detached state.
The screenlock program may be changed through the environment variable
@code{$LOCKPRG} (which must be set in the shell from which @code{screen}
is started) and is executed with the user's uid and gid.
+
+Warning: When you leave other shells unlocked and have no password set
+on @code{screen}, the lock is void: One could easily re-attach from an
+unlocked shell. This feature should rather be called
+@code{lockterminal}.
@end deffn
@node Multiuser Session, Session Name, Lock, Session Management
@@ -1162,31 +1237,43 @@ described here.
@deffn Command multiuser @var{state}
(none)@*
Switch between single-user and multi-user mode. Standard screen operation is
-single-user. In multi-user mode the commands @code{acladd} and @code{acldel}
-can be used to enable (and disable) other users accessing this @code{screen}.
+single-user. In multi-user mode the commands @code{acladd}, @code{aclchg} and
+@code{acldel} can be used to enable (and disable) other users accessing this
+@code{screen}.
@end deffn
@node Acladd, Aclchg, Multiuser, Multiuser Session
@subsection Acladd
-@deffn Command acladd @var{username}
+@deffn Command acladd @var{usernames}
(none)@*
-Enable a user to (fully) access this screen session. Necessary to allow other
-users to attach to this @code{screen} session. Same as
-@code{aclchg @var{username} +rwx "#?"}. Multi-user mode only.
+Enable users to fully access this screen session. @var{Usernames} can be one
+user or a comma seperated list of users. This command enables to attach to
+the @code{screen} session and performs the equivalent of
+@code{aclchg @var{usernames} +rwx "#?"}. To add a user with restricted access,
+use the @code{aclchg} command below. Multi-user mode only.
@end deffn
@node Aclchg, Acldel, Acladd, Multiuser Session
@subsection Aclchg
-@deffn Command aclchg @var{username permbits list}
-(none)@*
-Change a users permissions. Permission bits are represented as @samp{r},
-@samp{w} and @samp{x}. Prefixing @samp{+} grants the permission, @samp{-}
-removes it. The third parameter is a komma seperated list of commands or windows
-(specified either by number or title). The special list @samp{#} refers to all
-windows, @samp{?} to all commands.
-A Command can be executed when the user has the @samp{x} bit for it. the user
-can type input to a window, when he has its @samp{w} bit set and no other
+@deffn Command aclchg @var{usernames permbits list}
+(none)@*
+Change permissions for a comma seperated list of users.
+Permission bits are represented as @samp{r}, @samp{w} and @samp{x}.
+Prefixing @samp{+} grants the permission, @samp{-} removes it. The third
+parameter is a comma seperated list of commands or windows (specified either
+by number or title). The special list @samp{#} refers to all windows, @samp{?}
+to all commands. If @var{usernames} consists of a single @samp{*}, all
+known users is affected.
+A command can be executed when the user has the @samp{x} bit for it. The user
+can type input to a window when he has its @samp{w} bit set and no other
user obtains a writelock for this window. Other bits are currently ignored.
+To withdraw the writelock from another user in e.g. window 2:
+@samp{aclchg @var{username} -w+w 2}. To allow readonly access
+to the session: @samp{aclchg @var{username} -w "#"}. As soon as a user's name
+is known to screen, he can attach to the session and (per default) has full
+permissions for all command and windows. Execution permission for the acl
+commands, @code{at} and others should also be removed or the user may be able
+to regain write permission.
Multi-user mode only.
@end deffn
@@ -1194,8 +1281,8 @@ Multi-user mode only.
@subsection Acldel
@deffn Command acldel @var{username}
(none)@*
-Remove a user from screens access control list. If currently attached, all the
-users displays are detached from the session. He cannot attach again.
+Remove a user from screen's access control list. If currently attached, all the
+user's displays are detached from the session. He cannot attach again.
Multi-user mode only.
@end deffn
@@ -1203,7 +1290,7 @@ Multi-user mode only.
@subsection Wall
@deffn Command wall @var{message ...}
(none)@*
-Write a message to all displays. The message will appear in the terminals
+Write a message to all displays. The message will appear in the terminal's
status line.
@end deffn
@@ -1221,6 +1308,13 @@ by the command @code{writelock off}. If the user issues the command
to other windows.
@end deffn
+@deffn Command defwritelock @var{on|off|auto}
+(none)@*
+Sets the default writelock behaviour for new windows. Initially all windows
+will be created with automatic writelocks.
+@end deffn
+
+
@node Session Name, Suspend, Multiuser Session, Session Management
@section Session Name
@deffn Command sessionname [name]
@@ -1249,7 +1343,7 @@ being able to do job control.
@kindex C-\
@deffn Command quit
(@kbd{C-a C-\})@*
-Kill all windows and terminate @code{screen}. Note that on vt100-style
+Kill all windows and terminate @code{screen}. Note that on VT100-style
terminals the keys @kbd{C-4} and @kbd{C-\} are identical. So be careful
not to type @kbd{C-a C-4} when selecting window no. 4. Use the empty
bind command (as in @code{bind "^\"}) to remove a key binding
@@ -1260,7 +1354,7 @@ bind command (as in @code{bind "^\"}) to remove a key binding
@chapter Window Settings
These commands control the way @code{screen} treats individual windows
-in a session. @xref{Virtual Terminal}, for comands to control the
+in a session. @xref{Virtual Terminal}, for commands to control the
terminal emulation itself.
@menu
@@ -1436,14 +1530,15 @@ current window's title to @samp{(unknown)} (C-a u).
(none)@*
Sets whether a clear screen sequence should nuke all the output
that has not been written to the terminal. @xref{Obuflimit}.
+This property is set per display, not per window.
@end deffn
@deffn Command defautonuke @var{state}
(none)@*
Same as the @code{autonuke} command except that the default setting for
-new displays is changed. Initial setting is @code{off}.
+new displays is also changed. Initial setting is @code{off}.
Note that you can use the special @code{AN} terminal capability if you
-want to have a terminal type dependant setting.
+want to have a terminal type dependent setting.
@end deffn
@node Console, Kill, Autonuke, Window Settings
@@ -1451,7 +1546,10 @@ want to have a terminal type dependant setting.
@deffn Command console @var{[state]}
(none)@*
Grabs or ungrabs the machines console output to a window. When the argument
-is ommitted the current state is displayed.
+is omitted the current state is displayed.
+@emph{Note}: Only the owner of @file{/dev/console} can grab the console
+output. This command is only available if the host supports the ioctl
+@code{TIOCCONS}.
@end deffn
@node Kill, Login, Console, Window Settings
@@ -1504,7 +1602,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. @xref{Screen Command}).
@end deffn
@node Monitor, Obuflimit, Mode, Window Settings
@@ -1553,14 +1651,15 @@ 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 @code{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.
@end deffn
@deffn Command defobuflimit @var{limit}
(none)@*
Same as the @code{obuflimit} command except that the default setting for new
-displays is changed. Initial setting is 256 bytes. Note that you can use
+displays is also changed. Initial setting is 256 bytes. Note that you can use
the special @code{OL} terminal capability if you want to have a terminal
-type dependant limit.
+type dependent limit.
@end deffn
@node Windows, , Obuflimit, Window Settings
@@ -1579,7 +1678,7 @@ window that is being monitored and has had activity occur is marked with
an @samp{@@} (@pxref{Monitor}); a window which has output logging turned
on is marked with @samp{(L)}; windows occupied by other users are marked with
@samp{&}; windows in the zombie state are marked with @samp{Z}.
-If this list is too long to fit on the terminals status line only the
+If this list is too long to fit on the terminal's status line only the
portion around the current window is displayed.
@end deffn
@@ -1592,6 +1691,7 @@ terminal emulation.
@menu
* Control Sequences:: Details of the internal VT100 emulation.
+* Input Translation:: How keystrokes are remapped.
* Bell:: Getting your attention.
* Clear:: Clear the window display.
* Height:: Changing the height of your terminal.
@@ -1600,9 +1700,10 @@ terminal emulation.
* Wrap:: Automatic margins.
* Reset:: Recovering from ill-behaved applications.
* Width:: Changing the width of your terminal.
+* Character Processing:: Change the effect of special characters.
@end menu
-@node Control Sequences, Bell, , Virtual Terminal
+@node Control Sequences, Input Translation, , Virtual Terminal
@section Control Sequences
@cindex control sequences
The following is a list of control sequences recognized by
@@ -1692,13 +1793,106 @@ ESC [ 4 i (A) Stop relay to printer (ANSI Media Copy)
ESC [ 8 ; Ph ; Pw t Resize the window to @samp{Ph} lines and
@samp{Pw} columns (SunView special)
ESC [ c Send VT100 Identification String
+ESC [ > c Send Secondary Device Attributes String
ESC [ 6 n Send Cursor Position Report
+
@end example
-@node Bell, Clear, Control Sequences, Virtual Terminal
+
+@node Input Translation, Bell, Control Sequences, Virtual Terminal
+@section Input Translation
+@cindex input translation
+In order to do a full VT100 emulation @code{screen} has to detect
+that a sequence of characters in the input stream was generated
+by a keypress on the user's keyboard and insert the VT100
+style escape sequence. @code{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 @code{stuff}, @pxref{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.
+@code{Screen} will insert the correct binding after each
+reattach. @xref{Bindkey} for further details on the syntax and examples.
+
+Here is the table of the default key bindings. (A) means that the
+command is executed if the keyboard is switched into application
+mode.
+@example
+
+Key name Termcap name Command
+-----------------------------------------------------
+Cursor up ku stuff \033[A
+ stuff \033OA (A)
+Cursor down kd stuff \033[B
+ stuff \033OB (A)
+Cursor right kr stuff \033[C
+ stuff \033OC (A)
+Cursor left kl stuff \033[D
+ stuff \033OD (A)
+Function key 0 k0 stuff \033[10~
+Function key 1 k1 stuff \033OP
+Function key 2 k2 stuff \033OQ
+Function key 3 k3 stuff \033OR
+Function key 4 k4 stuff \033OS
+Function key 5 k5 stuff \033[15~
+Function key 6 k6 stuff \033[17~
+Function key 7 k7 stuff \033[18~
+Function key 8 k8 stuff \033[19~
+Function key 9 k9 stuff \033[20~
+Function key 10 k; stuff \033[21~
+Function key 11 F1 stuff \033[22~
+Function key 12 F2 stuff \033[23~
+Backspace kb stuff \010
+Home kh stuff \033[1~
+End kH stuff \033[4~
+Insert kI stuff \033[2~
+Delete kD stuff \033[3~
+Page up kP stuff \033[5~
+Page down kN stuff \033[6~
+Keypad 0 f0 stuff 0
+ stuff \033Op (A)
+Keypad 1 f1 stuff 1
+ stuff \033Oq (A)
+Keypad 2 f2 stuff 2
+ stuff \033Or (A)
+Keypad 3 f3 stuff 3
+ stuff \033Os (A)
+Keypad 4 f4 stuff 4
+ stuff \033Ot (A)
+Keypad 5 f5 stuff 5
+ stuff \033Ou (A)
+Keypad 6 f6 stuff 6
+ stuff \033Ov (A)
+Keypad 7 f7 stuff 7
+ stuff \033Ow (A)
+Keypad 8 f8 stuff 8
+ stuff \033Ox (A)
+Keypad 9 f9 stuff 9
+ stuff \033Oy (A)
+Keypad + f+ stuff +
+ stuff \033Ok (A)
+Keypad - f- stuff -
+ stuff \033Om (A)
+Keypad * f* stuff *
+ stuff \033Oj (A)
+Keypad / f/ stuff /
+ stuff \033Oo (A)
+Keypad = fq stuff =
+ stuff \033OX (A)
+Keypad . f. stuff .
+ stuff \033On (A)
+Keypad , f, stuff ,
+ stuff \033Ol (A)
+Keypad enter fe stuff \015
+ stuff \033OM (A)
+@end example
+
+@node Bell, Clear, Input Translation, Virtual Terminal
@section Bell
-@deffn Command bell message
+@deffn Command bell_msg [message]
(none)@*
When a bell character is sent to a background window, @code{screen}
displays a notification in the message line. The notification message
@@ -1712,25 +1906,32 @@ The default message is
'Bell in window %'
@end example
-An empty message can be supplied to the @code{bell} command to suppress
-output of a message line (@code{bell ""}).
+An empty message can be supplied to the @code{bell_msg} command to suppress
+output of a message line (@code{bell_msg ""}).
@end deffn
@kindex C-g
@deffn Command vbell [state]
(@kbd{C-a C-g})@*
-Sets or toggles the visual bell setting for the current window. If your
+Sets or toggles the visual bell setting for the current window. If
+@code{vbell} is switched to @samp{on}, but your
terminal does not support a visual bell, the visual bell message is
-displayed in the status line. @xref{Bell, , Visual Bell, termcap, The
-Termcap Manual}, for more information on visual bells. The equivalent
-terminfo capability is @code{flash}.
+displayed in the status line when the bell character is received.
+Visual bell support of a terminal is
+defined by the termcap variable @code{vb}. @xref{Bell, , Visual Bell,
+termcap, The Termcap Manual}, for more information on visual bells.
+The equivalent terminfo capability is @code{flash}.
+
+Per default, @code{vbell} is @samp{off}, thus the audible bell is used.
@end deffn
-@deffn Command vbell_msg message
+@deffn Command vbell_msg [message]
(none)@*
Sets the visual bell message. @var{message} is printed to the status
-line if the window receives a bell character (^G) and @code{vbell} is
-set to @samp{on}. The default message is @samp{Wuff, Wuff!!}.
+line if the window receives a bell character (^G), @code{vbell} is
+set to @samp{on} and the terminal does not support a visual bell.
+The default message is @samp{Wuff, Wuff!!}.
+Without parameter, the current message is shown.
@end deffn
@deffn Command vbellwait sec
@@ -1782,15 +1983,18 @@ designated as @samp{G0} through @samp{G3}. For system information use
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 @code{allpartial off}.
+with @code{allpartial off}. This is a global flag that immediately takes effect
+on all windows overriding the @code{partial} settings. It does not change the
+default redraw behaviour of newly created windows.
@end deffn
@deffn Command partial state
(none)@*
Defines whether the display should be refreshed (as with
@code{redisplay}) after switching to the current window. This command
-only affects the current window. To affect all windows use the
-@code{allpartial} command. Default is @samp{off}, of course.
+only affects the current window. To immediately affect all windows use the
+@code{allpartial} command. Default is @samp{off}, of course. This default is
+fixed, as there is currently no @code{defpartial} command.
@end deffn
@kindex l
@@ -1832,7 +2036,7 @@ settings (like scroll regions or graphics character set) are left over from
an application.
@end deffn
-@node Width, , Reset, Virtual Terminal
+@node Width, Character Processing, Reset, Virtual Terminal
@section Width
@kindex W
@deffn Command width [num]
@@ -1843,6 +2047,60 @@ capable terminal and the termcap entries @samp{Z0} and @samp{Z1}. See
the @code{termcap} command (@pxref{Termcap}), for more information.
@end deffn
+@node Character Processing, ,Width, Virtual Terminal
+@section Character Processing
+
+@deffn Command c1 [state]
+(none)@*
+Change c1 code processing. @samp{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 @samp{defc1} command.
+Users with fonts that have usable characters in the
+c1 positions may want to turn this off.
+
+@end deffn
+@deffn Command gr [state]
+(none)@*
+Turn GR charset switching on/off. Whenever screens 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 @samp{defgr}) is not to process GR switching because
+otherwise the ISO88591 charset would not work.
+@end deffn
+
+@deffn Command kanji wtype [dtype]
+(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
+window.
+@end deffn
+
+@deffn Command defc1 state
+(none)@*
+Same as the @samp{c1} command except that the default setting for
+new windows is changed. Initial setting is @samp{on}.
+@end deffn
+
+@deffn Command defgr state
+(none)@*
+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
+(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}.
+@end deffn
+
@node Copy and Paste, Subprocess Execution, Virtual Terminal, Top
@chapter Copy and Paste
@cindex copy and paste
@@ -1887,12 +2145,13 @@ outlined below.
@node Line Termination, Scrollback, , Copy
@subsection CR/LF
-@deffn Command crlf state
+@deffn Command crlf [state]
(none)@*
This affects the copying of text regions with the @kbd{C-a [} command.
If it is set to @samp{on}, lines will be separated by the two character
sequence @samp{CR}/@samp{LF}. Otherwise only @samp{LF} is used.
@code{crlf} is off by default.
+When no parameter is given, the state is toggled.
@end deffn
@node Scrollback, Copy Mode Keys, Line Termination, Copy
@@ -1919,6 +2178,12 @@ string is made up of @var{oldchar}=@var{newchar} pairs which are
separated by @samp{:}. Example: The command @code{markkeys
h=^B:l=^F:$=^E} would set some keys to be more familiar to @code{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: @code{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.
@end deffn
@node Movement, Marking, Copy Mode Keys, Copy
@@ -1986,7 +2251,7 @@ start of line.
Any command in copy mode can be prefixed with a number (by pressing
digits @kbd{0@dots{}9}) which is taken as a repeat count. Example:
-@kbd{C-a C-[ H 10 j 5 Y} will copy lines 11 to 15 into the pastebuffer.
+@kbd{C-a C-[ H 10 j 5 Y} will copy lines 11 to 15 into the paste buffer.
@node Searching, Specials, Repeat count, Copy
@subsection Searching
@@ -2018,9 +2283,9 @@ Example: Try this on a rather full text screen:
@noindent
This moves one to the middle line of the screen, moves in 20 columns left,
-marks the beginning of the copybuffer, sets the left column, moves 5 columns
+marks the beginning of the paste buffer, sets the left column, moves 5 columns
down, sets the right column, and then marks the end of
-the copybuffer. Now try:@*
+the paste buffer. Now try:@*
@kbd{C-a [ M 20 l SPACE 10 l 5 j SPACE}
@noindent
@@ -2038,13 +2303,13 @@ toggles the left margin between column 9 and 1.
@noindent
@kbd{a} before the final space key turns on append mode. Thus
-the contents of the pastebuffer will not be overwritten, but appended to.
+the contents of the paste buffer will not be overwritten, but appended to.
@noindent
@kbd{A} turns on append mode and sets a (second) mark.
@noindent
-@kbd{>} sets the (second) mark and writes the contents of the copybuffer
+@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}.@*
This example demonstrates how to dump the
@@ -2062,13 +2327,31 @@ mode.
@kindex ]
@kindex C-]
-@deffn Command paste [registers]
+@deffn Command paste [registers [destination]]
(@kbd{C-a ]}, @kbd{C-a C-]})@*
-Write the contents of the specified registers to the stdin stream of the
-current window. The register @samp{.} is treated as the
-paste buffer. If no parameter is given only the paste buffer is used.
-The paste buffer can be filled with the @code{copy},
-@code{history} and @code{readbuf} commands.
+Write the (concatenated) contents of the specified registers to the stdin
+stream of the current window. The register @samp{.} is treated as the
+paste buffer. If no parameter is specified the user is prompted to enter a
+single register. The paste buffer can be filled with the
+@code{copy}, @code{history} and @code{readbuf} commands.
+Other registers can be filled with the @code{register}, @code{readreg} and
+@code{paste} commands.
+If @code{paste} is called with a second argument, the contents of the specified
+registers is pasted into the named destination register rather than
+the window. If @samp{.} is used as the second argument, the display's paste
+buffer is the destination.
+Note, that @code{paste} uses a wide variety of resources: Usually both, a
+current window and a current display are required. But whenever a second
+argument is specified no current window is needed. When the source specification
+only contains registers (not the paste buffer) then there need not be a current
+display (terminal attached), as the registers are a global resource. The
+paste buffer exists once for every user.
+@end deffn
+
+@deffn 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.
@end deffn
@deffn Command slowpaste msec
@@ -2081,26 +2364,40 @@ your underlying system exposes flow control problems while pasting large
amounts of text.
@end deffn
+@deffn Command readreg [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.
+The following example will paste the system's password file into
+the screen window (using register p, where a copy remains):
+
+@example
+C-a : readreg p /etc/passwd
+C-a : paste p
+@end example
+@end deffn
+
@node Registers, Screen-Exchange, Paste, Copy and Paste
@section Registers
@deffn Command copy_reg [key]
(none)@*
-Store the current copybuffer contents in a register referenced by @var{key}.
-If the name is omitted you will be prompted to press the key.
+Removed. Use @code{readreg} instead.
@end deffn
@deffn Command ins_reg [key]
(none)@*
-Paste contents of register @var{key} into the current window's input
-stream.
+Removed. Use @code{paste} instead.
@end deffn
@deffn Command process [key]
(none)@*
Stuff the contents of the specified register into the @code{screen}
input queue. If no argument is given you are prompted for a
-register name. The text is parsed as if it had been typed in from the users
+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
@@ -2109,26 +2406,37 @@ keyboard. This command can be used to bind multiple actions to a single key.
Save the specified @var{string} to the register @var{key}.
@end deffn
+@deffn Command stuff string
+(none)@*
+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}
+
+@end deffn
+
@node Screen-Exchange, History, Registers, Copy and Paste
@section Screen-Exchange
@deffn Command bufferfile [exchange-file]
(none)@*
-Change the filename used for reading and writing with the copybuffer.
+Change the filename used for reading and writing with the paste buffer.
If the @var{exchange-file} parameter is omitted, @code{screen} reverts
to the default of @file{/tmp/screen-exchange}. The following example
-will paste the system's password file into the screen window:
+will paste the system's password file into the screen window (using the
+paste buffer, where a copy remains):
@example
C-a : bufferfile /etc/passwd
C-a < C-a ]
+C-a : bufferfile
@end example
@end deffn
@kindex <
@deffn Command readbuf
(@kbd{C-a <})@*
-Reads the contents of the current screen-exchange file into the copy buffer.
+Reads the contents of the current screen-exchange file into the paste buffer.
@end deffn
@kindex =
@@ -2179,7 +2487,7 @@ Use with care!
(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
-newcommands stdin/stdout/stderr, the process already running (shell) and
+newcommand's stdin/stdout/stderr, the process already running (shell) and
screen itself (window) is controlled by the filedescriptor pattern @var{fdpat}.
This pattern is basically a three character sequence representing stdin, stdout
and stderr of newcommand. A dot (@code{.}) connects the file descriptor
@@ -2194,7 +2502,7 @@ Invoking @code{exec} without arguments shows name and arguments of the currently
running subprocess in this window.
@*
When a subprocess is running the @code{kill} command will affect it instead of
-the windows process.
+the window's process.
@*
Refer to the postscript file @file{doc/fdpat.ps} for illustration of all 21
possible combinations. Each drawing shows the numbers 210 representing the three
@@ -2220,7 +2528,7 @@ Trailing dots and a @var{fdpat} consisting only of dots can be omitted.
A simple @samp{|} is synonymous for the @samp{!..|} pattern.
@item
-The word @samp{exec} can be ommitted when the @samp{|} abbreviation is used.
+The word @samp{exec} can be omitted when the @samp{|} abbreviation is used.
@item
The word @samp{exec} can always be replaced by leading @samp{!}.
@@ -2233,14 +2541,14 @@ Examples:
@item !/bin/sh
@itemx exec /bin/sh
@itemx exec ... /bin/sh
-Creates another shell in the same window, while the orignal shell is still
+Creates another shell in the same window, while the original shell is still
running. Output of both shells is displayed and user input is sent to the new
@file{/bin/sh}.
@item !!stty 19200
@itemx exec!stty 19200
@itemx exec !.. stty 19200
-Set the speed of the windows tty. If your stty command operates on stdout, then
+Set the speed of the window's tty. If your stty command operates on stdout, then
add another @samp{!}. This is a useful command, when a screen window is
directly connected to a serial line that needs to be configured.
@@ -2248,7 +2556,7 @@ directly connected to a serial line that needs to be configured.
@itemx exec !..| less
This adds a pager to the window output. The special character @samp{|} is
needed to give the user control over the pager although it gets its input from
-the windows process. This works, because @samp{less} listens on stderr
+the window's process. This works, because @samp{less} listens on stderr
(a behavior that @code{screen} would not expect without the @samp{|})
when its stdin is not a tty.
@@ -2273,6 +2581,9 @@ preferences.
* Bind Examples:: Using @code{bind}.
* Command Character:: The character used to start keyboard commands.
* Help:: Show current key bindings.
+* Bindkey:: @code{bindkey} syntax.
+* Bindkey Examples:: Some easy examples.
+* Bindkey Control:: How to control the bindkey mechanism.
@end menu
@node Bind, Bind Examples, , Key Binding
@@ -2329,6 +2640,16 @@ backslash followed by a second character, such as @samp{\^} or
one of the authors.
@end deffn
+@deffn Command defescape xy
+(none)@*
+Set the default command characters. This is equivalent to the command
+@code{escape} except that it is useful for multiuser sessions only.
+In a multiuser session
+@code{escape} changes the command character of the calling user, where
+@code{defescape} changes the default command characters for users that
+will be added later.
+@end deffn
+
@kindex a
@deffn Command meta
(@kbd{C-a a})@*
@@ -2338,7 +2659,14 @@ window. The keystroke for this command is the second parameter to the
@code{escape} .screenrc directive.
@end deffn
-@node Help, , Command Character, Key Binding
+@deffn Command command
+(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}
+@end deffn
+
+@node Help, Bindkey, Command Character, Key Binding
@section Help
@kindex ?
@deffn Command help
@@ -2352,6 +2680,102 @@ which will exit the help display and begin a command.
@xref{Default Key Bindings}.
@end deffn
+@node Bindkey, Bindkey Examples, Help, Key Binding
+@section Bindkey
+@deffn Command bindkey @var{[opts] [string [cmd args]]}
+(none)@*
+This command manages screen's input translation tables. Every
+entry in one of the tables tells screen how to react if a certain
+sequence of characters is encountered. There are three tables:
+one that should contain actions programmed by the user, one for
+the default actions used for terminal emulation and one for
+screen's copy mode to do cursor movement. @xref{Input Translation}
+for a list of default key bindings.
+
+If the @samp{-d}
+option is given, bindkey modifies the default table, @samp{-m}
+changes the copy mode table and with neither option the user
+table is selected. The argument @samp{string} is the sequence of
+characters to which an action is bound. This can either be a fixed
+tring or a termcap keyboard capability name (selectable with the
+@samp{-k} option).
+
+Some keys on a VT100 terminal can send a different
+string if application mode is turned on (e.g. the cursor keys).
+Such keys have two entries in the translation table. You can
+select the application mode entry by specifying the @samp{-a}
+option.
+
+The @samp{-t} option tells screen not to do intercharacter
+timing. One cannot turn off the timing if a termcap capabilty is
+used.
+
+@samp{cmd} can be any of screen's commands with an arbitrary
+number of @samp{args}. If @samp{cmd} is omitted the keybinding is
+removed from the table.
+@end deffn
+
+@node Bindkey Examples, Bindkey Control,Bindkey, Key Binding
+@section Bindkey Examples
+@noindent
+Here are some examples of keyboard bindings:
+
+@example
+bindkey -d
+@end example
+@noindent
+Show all of the default key bindings. The application mode entries
+are marked with [A].
+
+@example
+bindkey -k k1 select 1
+@end example
+@noindent
+Make the "F1" key switch to window one.
+
+@example
+bindkey -t foo stuff barfoo
+@end example
+@noindent
+Make @samp{foo} an abrevation of the word @samp{barfoo}. Timeout is
+disabled so that users can type slowly.
+
+@example
+bindkey "\024" mapdefault
+@end example
+@noindent
+This keybinding makes @samp{C-t} an escape character for keybindings. If
+you did the above @samp{stuff barfoo} binding, you can enter the word
+@samp{foo} by typing @samp{C-t foo}. If you want to insert a
+@samp{C-t} you have to press the key twice (i.e. escape the escape
+binding).
+
+@example
+bindkey -k F1 command
+@end example
+@noindent
+Make the F11 (not F1!) key an alternative screen
+escape (besides @samp{C-a}). Note that @samp{F11 F11} does not work in
+the current release of screen.
+
+@node Bindkey Control, , Bindkey Examples, Key Binding
+@section Bindkey Control
+@deffn Command mapdefault
+(none)@*
+Tell screen that the next input character should only be looked up
+in the default bindkey table.
+@end deffn
+@deffn Command mapnotnext
+(none)@*
+Like mapdefault, but don't even look in the default bindkey table.
+@end deffn
+@deffn Command maptimeout timo
+(none)@*
+Set the intercharacter timer for input sequence detection to a timeout
+of @var{timo} ms. The default timeout is 300ms. Maptimeout with no
+arguments shows the current setting.
+@end deffn
+
@node Flow Control, Termcap, Key Binding, Top
@chapter Flow Control
@cindex flow control
@@ -2421,9 +2845,10 @@ a try, and use whichever mode you find more comfortable.
(none)@*
Same as the @code{flow} command except that the default setting for new
windows is changed. Initial setting is `auto'.
-Specifying @code{flow auto
-interrupt} has the same effect as the command-line options @samp{-fa}
-and @samp{-i}.
+Specifying @code{flow auto interrupt} has the same effect as the
+command-line options @samp{-fa} and @samp{-i}.
+Note that if @samp{interrupt} is enabled, all existing displays are
+changed immediately to forward interrupt signals.
@end deffn
@kindex f
@@ -2630,7 +3055,7 @@ termcap vt102|vt220 Z0=\E[?3h:Z1=\E[?3l
Specifies the firm-margined @samp{xn} capability for all terminals that
begin with @samp{vt}, and the second line will also add the
escape-sequences to switch into (Z0) and back out of (Z1)
-132-character-per-line mode if this is a vt102 or vt220. (You must
+132-character-per-line mode if this is a VT102 or VT220. (You must
specify Z0 and Z1 in your termcap to use the width-changing commands.)
@example
@@ -2673,7 +3098,7 @@ recognized by @code{screen} and are not in the termcap manual
@table @samp
@item LP
(bool)@*
-Terminal has vt100 style margins (`magic margins'). Note that
+Terminal has VT100 style margins (`magic margins'). Note that
this capability is obsolete --- @code{screen} now uses @samp{xn}
instead.
@@ -2698,19 +3123,15 @@ and than outputs the character with the 8th bit stripped off.
Note that the string can contain any esc-sequences known to
@code{screen}, too. (Example: Single Shift G2 = \EN.)
-@item OP
-(bool)@*
-Don't do full vt100-style margin emulation. Same as the -O option.
-
@item NF
(bool)@*
Terminal doesn't need flow control. Send ^S and ^Q direct to
the application. Same as @code{flow off}. The opposite of this
-capability is @samp{xo}.
+capability is @samp{nx}.
@item G0
(bool)@*
-Terminal can deal with ISO2022 font selection sequences.
+Terminal can deal with ISO 2022 font selection sequences.
@item S0
(str)@*
@@ -2734,6 +3155,11 @@ Switch cursor keys to application mode.
@item CE
(str)@*
Switch cursor keys to cursor mode.
+
+@item KJ
+(str)@*
+Set the kanji type of the terminal. Valid strings are @samp{jis},
+@samp{euc} and @samp{sjis}.
@end table
@node Message Line, Logging, Termcap, Top
@@ -2835,10 +3261,10 @@ If set to @samp{on}, @code{screen} will append to the
otherwise, these files are overwritten each time.
@end deffn
-@deffn Comand hardcopydir directory
+@deffn Command hardcopydir directory
(none)@*
Defines a directory where hardcopy files will be placed.
-If unset hardcopys are dumped in screens current working
+If unset hardcopys are dumped in screen's current working
directory.
@end deffn
@@ -2856,7 +3282,7 @@ current contents and the contents of the scrollback history are not
included in the session log. Default is @samp{off}.
@end deffn
-@deffn Comand logdir directory
+@deffn Command logdir directory
(none)@*
Defines a directory where logfiles will be placed. If unset logfiles
are written in @code{screen}s current working directory.
@@ -2879,9 +3305,10 @@ This section describes commands which are only useful in the
@deffn Command echo [@t{-n}] message
(none)@*
The echo command may be used to annoy @code{screen} users with a
-'message of the day'. Typically installed in a global screenrc. See also
-@code{sleep}. Echo is also useful for online checking of environment
-variables.
+'message of the day'. Typically installed in a global screenrc.
+The option @samp{-n} may be used to suppress the line feed.
+See also @code{sleep}.
+Echo is also useful for online checking of environment variables.
@end deffn
@node sleep, Startup Message, echo, Startup
@@ -2918,6 +3345,7 @@ categories.
* Time:: Display the time and load average.
* Version:: Display the version of @code{screen}.
* Zombie:: Keep dead windows.
+* Printcmd:: Set command for VT100 printer port emulation.
@end menu
@node At, Break, , Miscellaneous
@@ -2932,12 +3360,13 @@ form @samp{@var{identifier}*} then identifier is matched against user names.
The command is executed once for each display of the selected user(s).
If the first parameter is of the form @samp{@var{identifier}%} identifier is
matched against displays. Displays are named after the ttys they attach. The
-prefix @samp{/dev/} or @samp{/dev/tty} may be ommited from the identifier.
+prefix @samp{/dev/} or @samp{/dev/tty} may be omitted from the identifier.
If @var{identifier} has a @code{#} or nothing appended it is matched against
window numbers and titles. Omitting an identifier in front of the @code{#},
@code{*} or @code{%} character selects all users, displays or windows because
a prefix-match is performed. Note that on the affected display(s) a short
-message will describe what happened.
+message will describe what happened. Caution: Permission is checked for the
+owners or the affected display(s), not for the initiator of the `at' command.
@end deffn
@node Break, Debug, At, Miscellaneous
@@ -3035,13 +3464,40 @@ system). For window-specific information use @code{info} (@pxref{Info}).
Display the version and modification date in the message line.
@end deffn
-@node Zombie, , Version, Miscellaneous
+@node Zombie, Printcmd, Version, Miscellaneous
@section Zombie
-@deffn Command zombie @var{[key]}
+@deffn Command zombie @var{[keyx]}
+@deffnx Command defzombie @var{[keyx]}
+(none)@*
Per default windows are removed from the window list as soon as the
-window's process (e.g. shell) exits. When a key is specified to the
-zombie command a `dead' windows will remain in the list until it is selected
-and this key is pressed or the @code{kill} command is issued.
+windows process (e.g. shell) exits. When a string of two keys is
+specified to the zombie command, `dead' windows will remain in the list.
+The @code{kill} kommand may be used to remove the window. Pressing the first key
+in the dead window has the same effect. Pressing the second key, however,
+screen will attempt to resurrect the window. The process that was initially
+running in the window will be launched again. Calling @code{zombie} without
+parameters will clear the zombie setting, thus making windows disappear when
+the process terminates.
+
+As the zombie setting is affected globally for all windows, this command
+should only be called @code{defzombie}. Until we need this as a per window
+setting, the commands @code{zombie} and @code{defzombie} are synonymous.
+@end deffn
+
+@node Printcmd, , Zombie, Miscellaneous
+@section Printcmd
+@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
+sequence @code{ESC [ 5 i}, but pipe the output into @var{cmd}.
+This should normally be a command like @samp{lpr} or
+@samp{cat > /tmp/scrprint}.
+@code{Printcmd} without an argument displays the current setting.
+The ansi sequence @code{ESC \} ends printing and closes the pipe.
+
+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 Environment, Files, Miscellaneous, Top
@@ -3102,6 +3558,11 @@ Terminal description.
@cindex files
@table @file
+@item .../screen-3.?.??/etc/screenrc
+@itemx .../screen-3.?.??/etc/etcscreenrc
+Examples in the @code{screen} distribution package for private and
+global initialization files.
+
@item @code{$SYSSCREENRC}
@itemx /local/etc/screenrc
@code{screen} initialization commands
@@ -3181,7 +3642,7 @@ Contributors @*
Martin Schweikert (schweik@@cpp.ob.open.de),
David Vrona (dave@@sashimi.lcu.com),
E. Tye McQueen (tye%spillman.UUCP@@uunet.uu.net),
- Matthew Green (phone@@coombs.anu.edu.au),
+ Matthew Green (mrgreen@@mame.mu.oz.au),
Christopher Williams (cgw@@unt.edu),
Matt Mosley (mattm@@access.digex.net),
Gregory Neil Shapiro (gshapiro@@wpi.WPI.EDU),
@@ -3192,10 +3653,12 @@ Contributors @*
Version @*
=======
-This is version @value{version}. 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.
+This manual describes version @value{version} of the @code{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 @xref{Availability}.
@node Bugs, Installation, Credits, Top
@chapter Bugs
@@ -3208,6 +3671,7 @@ 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.
@end menu
@node Known Bugs, Reporting Bugs, , Bugs
@@ -3219,10 +3683,12 @@ found a bug not mentioned here.
are ignored). @samp{xn} is treated as a magic-margin indicator.
@item
-The @samp{GR} set of ISO 2022 is not supported.
+@code{screen} has no clue about double-high or double-wide characters.
+But this is the only area where @code{vttest} is allowed to fail.
@item
-There is no keyboard input translation to VT100 sequences.
+@code{screen} does not support color, although this has repeatedly
+been asked for.
@item
It is not possible to change the environment variable @code{$TERMCAP}
@@ -3249,9 +3715,19 @@ advertise that a user is logged on who really isn't.
@item
@code{screen} may give a strange warning when your tty has no utmp
entry.
+
+@item
+When the modem line was hung up, @code{screen} may not automatically
+detach (or quit) unless the device driver sends a HANGUP signal.
+To detach such a @code{screen} session use the -D or -d command
+line option.
+
+@item
+A weird imagination is most useful to gain full advantage of all the
+features.
@end itemize
-@node Reporting Bugs, , Known Bugs, Bugs
+@node Reporting Bugs, Availability, Known Bugs, Bugs
@section Reporting Bugs
@cindex bug report
@@ -3266,13 +3742,25 @@ enabled, reproduce the bug, and have a look at the debug output written to
the directory @file{/tmp/debug}. If necessary quote suspect passages from the
debug output and show the contents of your @file{config.h} if it matters.
+@node Availability, , Reporting Bugs, Bugs
+@section Availability
+@cindex availability
+
+@code{Screen} is available under the @code{GNU} copyleft.
+
+The latest official release of @code{screen} available via anonymous
+ftp from @samp{prep.ai.mit.edu}, @samp{nic.funet.fi} or any other
+@code{GNU} distribution site. The latest beta testing release of
+@code{screen} is available from @samp{ftp.uni-erlangen.de
+(131.188.1.43)}, in the directory @file{pub/utilities/screen}.
+
@node Installation, Concept Index, Bugs, Top
@chapter Installation
@cindex installation
Since @code{screen} uses pseudo-ttys, the select system call, and
-UNIX-domain sockets, it will not run under a system that does not
-include these features of 4.2 and 4.3 BSD UNIX.
+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.
@@ -3306,7 +3794,7 @@ This will create a @file{config.h} and @file{Makefile} for your machine.
If @code{configure} fails for some reason, then look at the examples and
comments found in the @file{Makefile.in} and @file{config.h.in} templates.
Rename @file{config.status} to @file{config.status.@var{machine}} when
-you want to keep configuration data for multiple architectures. Runing
+you want to keep configuration data for multiple architectures. Running
@code{sh ./config.status.@var{machine}} recreates your configuration
significantly faster than rerunning @code{configure}.
@*
@@ -3344,8 +3832,8 @@ This is a list of all the commands supported by @code{screen}.
This is a list of the default key bindings.
-The escape character has been omitted from the key sequences, since it
-is the same for all bindings.
+The leading escape character (@pxref{Command Character}) has been omitted
+from the key sequences, since it is the same for all bindings.
@printindex ky
diff --git a/src/etcscreenrc b/src/etc/etcscreenrc
index d324426..433599e 100644
--- a/src/etcscreenrc
+++ b/src/etc/etcscreenrc
@@ -7,19 +7,7 @@
# The 'termcap' lines are written in termcap syntax.
# The syntax for a terminfo based host is slightly different.
#
-#echo "-----------------------------------------------------------------------"
-#echo ""
-#echo " This is iScreen version 3.2.13 -- Enjoy :-)"
-#echo ""
-#echo " Coredumps zu mir, Beschwerden nach /dev/null! "
-#echo " Vorbeugend bitte schon mal alle screenrc files"
-#echo " genau einmal mit ~jnweiger/trojan_horse/newsyntax bearbeiten!"
-#echo " -- und in hartnaeckigen Faellen screen.old verwenden"
-#echo ""
-#echo " Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)"
-#echo "-----------------------------------------------------------------------"
-#echo " >>>>>>>>>>>> Press RETURN to continue <<<<<<<<<<<<"
-#sleep 5
+
#startup_message off
#defflow on # will force iScreen to process ^S/^Q
@@ -71,10 +59,23 @@ terminfo sun 'up=^K:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p
#xterm understands both im/ic and doesn't have a status line.
#Note: Do not specify im and ic in the real termcap/info file as
-#some programs (e.g. vi) will not work anymore.
+#some programs (e.g. vi) will (no,no, may (jw)) not work anymore.
termcap xterm|fptwist hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
terminfo xterm|fptwist hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
+# Long time I had this in my private screenrc file. But many people
+# seem to want it (jw):
+# we do not want the width to change to 80 characters on startup:
+# on suns, /etc/termcap has :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:
+termcap xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
+terminfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
+
+#
+# Do not use xterms alternate window buffer.
+# This one would not add lines to the scrollback buffer.
+termcap xterm|xterms|xs ti=\E7\E[?47l
+terminfo xterm|xterms|xs ti=\E7\E[?47l
+
# xs is xterm's two letter name.
# story ... in earlier versions I used xterms here ... buggy sequent termcap
# routines allowes 32 :tc=...: references per lifetime.... gave lots of OOPS
@@ -83,13 +84,8 @@ terminfo xterm|fptwist hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
# why I don't take the entry called xterm? well, I own a verion of xterm that
# allows window resizing. My private .iscreenrc adds WS to this entry.
-# Anyway, here are all the definitions needed to access a hardstatus line
termcap xs 'hs:ts=\E]0;:fs=\007:ds=\E]0;Screen\007:cs=\E[%i%d;%dr:LP:G0:im=\E[4h:ei=\E[4l'
terminfo xs 'hs:ts=\E]0;:fs=\007:ds=\E]0;Screen\007:cs=\E[%i%p1%d;%p2%dr:LP:G0:im=\E[4h:ei=\E[4l'
-termcap sun 'hs:ts=\E]l:fs=\E\\:ds=\E]lScreen\E\\'
-terminfo sun 'hs:ts=\E]l:fs=\E\\:ds=\E]lScreen\E\\'
-termcap sun-cmd 'hs:ts=\E]l:fs=\E\\:ds=\E]lScreen\E\\'
-terminfo sun-cmd 'hs:ts=\E]l:fs=\E\\:ds=\E]lScreen\E\\'
#make hp700 termcap/info better
termcap hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
@@ -101,7 +97,6 @@ termcap wy75-42 xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h
terminfo wy75-42 xo:Z0=\E[?3h\E[31h:Z1=\E[?3l\E[31h
#remove some stupid / dangerous key bindings
-bind '-' prev
bind '^k'
#bind 'L'
bind '^\'
diff --git a/src/etc/mkinstalldirs b/src/etc/mkinstalldirs
new file mode 100755
index 0000000..0e29377
--- /dev/null
+++ b/src/etc/mkinstalldirs
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Make directory hierarchy.
+# Written by Noah Friedman <friedman@prep.ai.mit.edu>
+# Public domain.
+
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+errstatus=0
+
+for file in ${1+"$@"} ; do
+ oIFS="${IFS}"
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'`
+ IFS="${oIFS}"
+
+ pathcomp=''
+
+ for d in ${1+"$@"} ; do
+ pathcomp="${pathcomp}${d}"
+
+ if test ! -d "${pathcomp}"; then
+ echo "mkdir $pathcomp" 1>&2
+ mkdir "${pathcomp}" || errstatus=$?
+ fi
+
+ pathcomp="${pathcomp}/"
+ done
+done
+
+exit $errstatus
+
+# eof
diff --git a/src/newsyntax b/src/etc/newsyntax
index 6b5bb03..6b5bb03 100755
--- a/src/newsyntax
+++ b/src/etc/newsyntax
diff --git a/src/etc/screenrc b/src/etc/screenrc
new file mode 100644
index 0000000..f0eefbc
--- /dev/null
+++ b/src/etc/screenrc
@@ -0,0 +1,79 @@
+#password ODSJQf.4IJN7E # "1234"
+
+vbell on
+autodetach on
+startup_message off
+
+# Extend the vt100 desciption with 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
+
+#xterm understands both im/ic and doesn't have a status line.
+#Note: Do not specify im and ic in the real termcap/info file as
+#some programs (e.g. vi) will not work anymore.
+termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
+terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
+
+#80/132 column switching must be enabled for Z0/Z1 to work
+#change init sequence to not switch width
+termcap xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
+terminfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
+
+#make hp700 termcap/info better
+termcap hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
+terminfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
+
+#wyse-75-42 must have flow control (xo = "terminal uses xon/xoff")
+#essential to have it here, as this is a slow terminal.
+termcap wy75-42 xo
+terminfo wy75-42 xo
+
+# New termcap sequences for cursor application mode.
+termcap wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J
+terminfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J
+
+# Make the output buffer large for (fast) xterms.
+termcap xterm* OL=10000
+terminfo xterm* OL=10000
+
+#remove some stupid / dangerous key bindings
+bind k
+bind ^k
+bind .
+bind ^\
+bind \\
+bind ^h
+bind h
+#make them better
+bind '\\' quit
+bind 'K' kill
+bind 'I' login on
+bind 'O' login off
+bind '}' history
+
+pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."
+
+# Yet another hack:
+# Prepend/append register [/] to the paste if ^a^] is pressed.
+# This lets me have autoindent mode in vi.
+register [ "\033:se noai\015a"
+register ] "\033:se ai\015a"
+bind ^] paste [.]
+
+terminfo xterm 'VR=\E[?5h:VN=\E[?5l:k1=\E[11~:k2=\E[12~:k3=\E[13~'
+termcap xterm 'VR=\E[?5h:VN=\E[?5l:k1=\E[11~:k2=\E[12~:k3=\E[13~'
+termcap xterm 'kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:kP=\E[5~:kN=\E[6~'
+terminfo xterm 'kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:kP=\E[5~:kN=\E[6~'
+
+# xterm hardstatus: use the window title.
+termcap xterm 'hs:ts=\E]0;:fs=\007:ds=\E]0;Screen\007'
+terminfo xterm 'hs:ts=\E]0;:fs=\007:ds=\E]0;Screen\007'
+
+termcap con80x* "xn:f0=\033Op:f1=\033Oq:f2=\033Or:f3=\033Os:f4=\033Ot:f5=\033Ou:f6=\033Ov:f7=\033Ow:f8=\033Ox:f9=\033Oy:f.=\033On:f,=\033Ol:fe=\033OM:f+=\033Ok:f-=\033Om:f*=\033Oj:f/=\033Oo:fq=\033OX:kN=\033[6~:kP=\033[5~"
+
+# advertise hardstatus support to $TERMCAP
+termcap * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'
+terminfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'
+
+# make the shell in every window a login shell
+#shell -$SHELL
diff --git a/src/extern.h b/src/extern.h
index 7ce46cb..c439188 100644
--- a/src/extern.h
+++ b/src/extern.h
@@ -24,18 +24,18 @@
/* screen.c */
extern void main __P((int, char **));
-extern sig_t SigHup __P(SIGPROTOARG);
+extern sigret_t SigHup __P(SIGPROTOARG);
extern void eexit __P((int));
extern void Detach __P((int));
extern void Kill __P((int, int));
#ifdef USEVARARGS
extern void Msg __P((int, char *, ...))
-# ifdef __GNUC__
+# if __GNUC__ > 1
__attribute__ ((format (printf, 2, 3)))
# endif
;
extern void Panic __P((int, char *, ...))
-# ifdef __GNUC__
+# if __GNUC__ > 1
__attribute__ ((format (printf, 2, 3)))
# endif
;
@@ -44,12 +44,13 @@ extern void Msg __P(());
extern void Panic __P(());
#endif
extern void DisplaySleep __P((int));
-extern sig_t Finit __P((int));
+extern void Finit __P((int));
extern void MakeNewEnv __P((void));
/* ansi.c */
extern void Activate __P((int));
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 Redisplay __P((int));
@@ -66,7 +67,7 @@ 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 ReadFile __P((void));
+extern char *ReadFile __P((char *, int *));
extern void KillBuffers __P((void));
extern char *expand_vars __P((char *));
@@ -90,6 +91,7 @@ extern int GetHistory __P((void));
extern void MarkRoutine __P((void));
extern void revto_line __P((int, int, int));
extern void revto __P((int, int));
+extern int InMark __P((void));
/* search.c */
extern void Search __P((int));
@@ -104,9 +106,11 @@ extern void exit_with_usage __P((char *));
extern void display_help __P((void));
extern void display_copyright __P((void));
extern void display_displays __P((void));
+extern void display_bindkey __P((char *, struct action *));
/* window.c */
extern int MakeWindow __P((struct NewWindow *));
+extern int RemakeWindow __P((struct win *));
extern void FreeWindow __P((struct win *));
#ifdef PSEUDOS
extern int winexec __P((char **));
@@ -150,6 +154,7 @@ extern void SetForeWindow __P((struct win *));
extern int Parse __P((char *, char **));
extern int ParseEscape __P((struct user *, char *));
extern void DoScreen __P((char *, char **));
+extern int IsNumColon __P((char *, int, char *, int));
extern void ShowWindows __P((void));
extern int WindowByNoN __P((char *));
#ifdef COPY_PASTE
@@ -160,11 +165,14 @@ extern int CompileKeys __P((char *, char *));
extern int InitTermcap __P((int, int));
extern char *MakeTermcap __P((int));
extern char *gettermcapstring __P((char *));
+#ifdef MAPKEYS
+extern int remap __P((int, int));
+#endif
/* attacher.c */
extern int Attach __P((int));
extern void Attacher __P((void));
-extern sig_t AttacherFinit __P(SIGPROTOARG);
+extern sigret_t AttacherFinit __P(SIGPROTOARG);
/* display.c */
extern struct display *MakeDisplay __P((char *, char *, char *, int, int, struct mode *));
@@ -185,17 +193,21 @@ extern void PUTCHAR __P((int));
extern void PUTCHARLP __P((int));
extern void RAW_PUTCHAR __P((int));
extern void ClearDisplay __P((void));
-extern void Clear __P((int, int, int, int));
+extern void Clear __P((int, int, int, int, int, int, int));
extern void RefreshLine __P((int, int, int, int));
+extern void RefreshStatus __P((void));
extern void DisplayLine __P((char *, char *, char *, char *, char *, char *, int, int, int));
extern void FixLP __P((int, int));
extern void GotoPos __P((int, int));
extern int CalcCost __P((char *));
-extern void ScrollRegion __P((int, int, int));
+extern void ScrollH __P((int, int, int, int, char *, char *, char *));
+extern void ScrollV __P((int, int, int, int, int));
extern void ChangeScrollRegion __P((int, int));
extern void InsertMode __P((int));
extern void KeypadMode __P((int));
extern void CursorkeysMode __P((int));
+extern void ReverseVideo __P((int));
+extern void CursorInvisible __P((int));
extern void SetFont __P((int));
extern void SetAttr __P((int));
extern void SetAttrFont __P((int, int));
@@ -213,6 +225,9 @@ extern void Resize_obuf __P((void));
#ifdef AUTO_NUKE
extern void NukePending __P((void));
#endif
+#ifdef KANJI
+extern int badkanji __P((char *, int));
+#endif
/* resize.c */
extern int ChangeScrollback __P((struct win *, int, int));
@@ -223,16 +238,16 @@ extern void DoResize __P((int, int));
extern char *xrealloc __P((char *, int));
/* socket.c */
-extern int FindSocket __P((int, int *));
-extern int MakeClientSocket __P((int, char *));
+extern int FindSocket __P((int *, int *, char *));
+extern int MakeClientSocket __P((int));
extern int MakeServerSocket __P((void));
extern int RecoverSocket __P((void));
extern int chsock __P((void));
extern void ReceiveMsg __P(());
-extern void SendCreateMsg __P((int, struct NewWindow *));
+extern void SendCreateMsg __P((char *, struct NewWindow *));
#ifdef USEVARARGS
extern void SendErrorMsg __P((char *, ...))
-# ifdef __GNUC__
+# if __GNUC__ > 1
__attribute__ ((format (printf, 1, 2)))
# endif
;
@@ -242,17 +257,32 @@ extern void SendErrorMsg __P(());
/* misc.c */
extern char *SaveStr __P((const char *));
+#ifndef HAVE_STRERROR
+extern char *strerror __P((int));
+#endif
extern void centerline __P((char *));
extern char *Filename __P((char *));
extern char *stripdev __P((char *));
-#if defined(NEED_OWN_BCOPY) && !defined(linux)
-extern void bcopy __P((char *, char *, int));
+#ifdef NEED_OWN_BCOPY
+extern void xbcopy __P((char *, char *, int));
#endif
extern void bclear __P((char *, int));
extern void closeallfiles __P((int));
extern int UserContext __P((void));
extern void UserReturn __P((int));
extern int UserStatus __P((void));
+#if defined(POSIX) || defined(hpux)
+extern void (*xsignal __P((int, void (*)SIGPROTOARG))) __P(SIGPROTOARG);
+#endif
+#ifdef NEED_RENAME
+extern int rename __P((char *, char *));
+#endif
+#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID)
+extern void xseteuid __P((int));
+extern void xsetegid __P((int));
+#endif
+extern int AddXChar __P((char *, int));
+extern int AddXChars __P((char *, int, char *));
/* acl.c */
#ifdef MULTIUSER
diff --git a/src/fileio.c b/src/fileio.c
index 4463ec6..9f16be3 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -25,13 +25,12 @@ RCS_ID("$Id$ FAU")
#include <sys/types.h>
-#ifndef sgi
-# include <sys/file.h>
-#endif /* sgi */
-#include <sys/stat.h>
#include <fcntl.h>
+#include <sys/stat.h>
-#include <signal.h>
+#ifndef SIGINT
+# include <signal.h>
+#endif
#include "config.h"
#include "screen.h"
@@ -47,7 +46,7 @@ extern int real_uid, eff_uid;
extern int real_gid, eff_gid;
extern char *extra_incap, *extra_outcap;
extern char *home, *RcFileName;
-extern char SockPath[], *SockNamePtr;
+extern char SockPath[], *SockName;
#ifdef COPY_PASTE
extern char *BufferFile;
#endif
@@ -146,6 +145,12 @@ char *rcfilename;
char buf[256];
char *args[MAXARGS];
+
+ /* Special settings for vt100 and others */
+
+ if (display && (!strncmp(D_termname, "vt", 2) || !strncmp(D_termname, "xterm", 5)))
+ extra_incap = CatExtra("xn:f0=\033Op:f1=\033Oq:f2=\033Or:f3=\033Os:f4=\033Ot:f5=\033Ou:f6=\033Ov:f7=\033Ow:f8=\033Ox:f9=\033Oy:f.=\033On:f,=\033Ol:fe=\033OM:f+=\033Ok:f-=\033Om:f*=\033Oj:f/=\033Oo:fq=\033OX", extra_incap);
+
rc_name = findrcfile(rcfilename);
if ((fp = secfopen(rc_name, "r")) == NULL)
@@ -170,7 +175,7 @@ char *rcfilename;
{
if ((p = rindex(buf, '\n')) != NULL)
*p = '\0';
- if ((argc = Parse(buf, args)) == 0)
+ if ((argc = Parse(expand_vars(buf), args)) == 0)
continue;
if (strcmp(args[0], "echo") == 0)
{
@@ -220,10 +225,10 @@ char *rcfilename;
len = strlen(p);
if (p[len - 1] == '*')
{
- if (!(len - 1) || !strncmp(p, d_termname, len - 1))
+ if (!(len - 1) || !strncmp(p, D_termname, len - 1))
break;
}
- else if (!strcmp(p, d_termname))
+ else if (!strcmp(p, D_termname))
break;
}
if (!(p && *p))
@@ -337,11 +342,11 @@ char *ss;
{
v = xbuf;
if (strcmp(s, "TERM") == 0)
- v = display ? d_termname : "unknown";
+ v = display ? D_termname : "unknown";
else if (strcmp(s, "COLUMNS") == 0)
- sprintf(xbuf, "%d", display ? d_width : -1);
+ sprintf(xbuf, "%d", display ? D_width : -1);
else if (strcmp(s, "LINES") == 0)
- sprintf(xbuf, "%d", display ? d_height : -1);
+ sprintf(xbuf, "%d", display ? D_height : -1);
else
v = getenv(s);
}
@@ -363,7 +368,7 @@ char *ss;
{
/*
* \$, \\$, \\, \\\, \012 are reduced here,
- * d_other sequences starting whith \ are passed through.
+ * other sequences starting whith \ are passed through.
*/
if (s[0] == '\\' && !quofl)
{
@@ -386,6 +391,8 @@ char *ss;
}
debug2("expandvars: octal coded character %o (%d)\n", i, i);
*e++ = i;
+ esize--;
+ continue;
}
else
{
@@ -438,7 +445,7 @@ int dump;
switch (dump)
{
case DUMP_TERMCAP:
- i = SockNamePtr - SockPath;
+ i = SockName - SockPath;
strncpy(fn, SockPath, i);
strcpy(fn + i, ".termcap");
break;
@@ -475,14 +482,14 @@ int dump;
if (*mode == 'a')
{
putc('>', f);
- for (j = d_width - 2; j > 0; j--)
+ for (j = D_width - 2; j > 0; j--)
putc('=', f);
fputs("<\n", f);
}
- for (i = 0; i < d_height; i++)
+ for (i = 0; i < D_height; i++)
{
p = fore->w_image[i];
- for (k = d_width - 1; k >= 0 && p[k] == ' '; k--)
+ for (k = D_width - 1; k >= 0 && p[k] == ' '; k--)
;
for (j = 0; j <= k; j++)
putc(p[j], f);
@@ -498,9 +505,12 @@ int dump;
break;
#ifdef COPY_PASTE
case DUMP_EXCHANGE:
- p = d_user->u_copybuffer;
- for (i = 0; i < d_user->u_copylen; i++)
- putc(*p++, f);
+ p = D_user->u_copybuffer;
+ for (i = D_user->u_copylen; i-- > 0; p++)
+ if (*p == '\r' && (i == 0 || p[1] != '\n'))
+ putc('\n', f);
+ else
+ putc(*p, f);
break;
#endif
}
@@ -531,57 +541,67 @@ int dump;
#ifdef COPY_PASTE
-void
-ReadFile()
+/*
+ * returns an allocated buffer which holds a copy of the file named fn.
+ * lenp (if nonzero) points to a location, where the buffer size should be
+ * stored.
+ */
+char *
+ReadFile(fn, lenp)
+char *fn;
+int *lenp;
{
int i, l, size;
- char fn[1024], c;
+ char c, *bp, *buf;
struct stat stb;
- sprintf(fn, "%s", BufferFile);
+ ASSERT(lenp);
debug1("ReadFile(%s)\n", fn);
if ((i = secopen(fn, O_RDONLY, 0)) < 0)
{
Msg(errno, "no %s -- no slurp", fn);
- return;
+ return NULL;
}
if (fstat(i, &stb))
{
Msg(errno, "no good %s -- no slurp", fn);
close(i);
- return;
+ return NULL;
}
size = stb.st_size;
- if (d_user->u_copybuffer)
- UserFreeCopyBuffer(d_user);
- d_user->u_copylen = 0;
- if ((d_user->u_copybuffer = malloc(size)) == NULL)
+ if ((buf = malloc(size)) == NULL)
{
close(i);
Msg(0, strnomem);
- return;
+ return NULL;
}
errno = 0;
- if ((l = read(i, d_user->u_copybuffer, size)) != size)
+ if ((l = read(i, buf, size)) != size)
{
- d_user->u_copylen = (l > 0) ? l : 0;
+ if (l < 0)
+ l = 0;
#ifdef NETHACK
if (nethackflag)
- Msg(errno, "You choke on your food: %d bytes from %s",
- d_user->u_copylen, fn);
+ Msg(errno, "You choke on your food: %d bytes from %s", l, fn);
else
#endif
- Msg(errno, "Got only %d bytes from %s", d_user->u_copylen, fn);
+ Msg(errno, "Got only %d bytes from %s", l, fn);
close(i);
- return;
}
- d_user->u_copylen = l;
- if (read(i, &c, 1) > 0)
- Msg(0, "Slurped only %d characters into buffer - try again", d_user->u_copylen);
else
- Msg(0, "Slurped %d characters into buffer", d_user->u_copylen);
+ {
+ if (read(i, &c, 1) > 0)
+ Msg(0, "Slurped only %d characters (of %d) into buffer - try again",
+ l, size);
+ else
+ Msg(0, "Slurped %d characters into buffer", l);
+ }
close(i);
- return;
+ *lenp = l;
+ for (bp = buf; l-- > 0; bp++)
+ if (*bp == '\n' && (bp == buf || bp[-1] != '\r'))
+ *bp = '\r';
+ return buf;
}
void
@@ -589,23 +609,11 @@ KillBuffers()
{
char fn[1024];
sprintf(fn, "%s", BufferFile);
- errno = 0;
-#ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
-#else
- if (access(fn, W_OK) == -1)
- {
- Msg(errno, "%s not removed", fn);
- return;
- }
-#endif
- unlink(fn);
- Msg(errno, "%s removed", fn);
-#ifndef NOREUID
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
-#endif
+
+ if (UserContext() > 0)
+ UserReturn(unlink(SockPath) ? errno : 0);
+ errno = UserStatus();
+ Msg(errno, "%s %sremoved", fn, errno ? "not " : "");
}
#endif /* COPY_PASTE */
@@ -620,17 +628,17 @@ char *name;
char *mode;
{
FILE *fi;
-#ifdef NOREUID
+#ifndef USE_SETEUID
int flags, fd;
#endif
debug2("secfopen(%s, %s)\n", name, mode);
-#ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
+#ifdef USE_SETEUID
+ xseteuid(real_uid);
+ xsetegid(real_gid);
fi = fopen(name, mode);
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
return fi;
#else
if (eff_uid == real_uid)
@@ -667,18 +675,18 @@ int flags;
int mode;
{
int fd;
-#ifdef NOREUID
+#ifndef USE_SETEUID
int q;
struct stat stb;
#endif
debug3("secopen(%s, 0x%x, 0%03o)\n", name, flags, mode);
-#ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
+#ifdef USE_SETEUID
+ xseteuid(real_uid);
+ xsetegid(real_gid);
fd = open(name, flags, mode);
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
return fd;
#else
if (eff_uid == real_uid)
@@ -697,7 +705,7 @@ int mode;
errno = EACCES;
UserReturn(errno);
}
- if (q = UserStatus())
+ if ((q = UserStatus()))
{
if (q > 0)
errno = q;
@@ -731,7 +739,7 @@ int mode;
}
if ((stb.st_mode & q) != q)
{
- debug("secopen: permission denied\n");
+ debug1("secopen: permission denied (%03o)\n", stb.st_mode & 07777);
close(fd);
errno = EACCES;
return(-1);
diff --git a/src/help.c b/src/help.c
index 8cfe871..3328cae 100644
--- a/src/help.c
+++ b/src/help.c
@@ -53,7 +53,7 @@ char *myname;
printf("-f Flow control on, -fn = off, -fa = auto.\n");
printf("-h lines Set the size of the scrollback history buffer.\n");
printf("-i Interrupt output sooner when flow control is on.\n");
-#ifdef LOGOUTOK
+#if defined(LOGOUTOK) && defined(UTMPOK)
printf("-l Login mode on (update %s), -ln = off.\n", UTMPFILE);
#endif
printf("-list or -ls. Do nothing, just list our SockDir.\n");
@@ -88,6 +88,7 @@ static void HelpAbort __P((void));
static void HelpRedisplayLine __P((int, int, int, int));
static void HelpSetCursor __P((void));
static void add_key_to_buf __P((char *, int));
+static int AddAction __P((struct action *, int));
static int helppage __P((void));
struct helpdata
@@ -122,7 +123,7 @@ display_help()
struct helpdata *helpdata;
int used[RC_LAST + 1];
- if (d_height < 6)
+ if (D_height < 6)
{
Msg(0, "Window height too small for help page");
return;
@@ -130,7 +131,7 @@ display_help()
if (InitOverlayPage(sizeof(*helpdata), &HelpLf, 0))
return;
- helpdata = (struct helpdata *)d_lay->l_data;
+ helpdata = (struct helpdata *)D_lay->l_data;
helpdata->num_names = helpdata->command_bindings = 0;
helpdata->command_search = 0;
for (n = 0; n <= RC_LAST; n++)
@@ -166,14 +167,14 @@ display_help()
if (mkey > MAXKLEN)
mkey = MAXKLEN;
- helpdata->numcols = (d_width - !CLP)/(mcom + mkey + 1);
+ helpdata->numcols = (D_width - !D_CLP)/(mcom + mkey + 1);
if (helpdata->numcols == 0)
{
HelpAbort();
Msg(0, "Width too small");
return;
}
- helpdata->inter = (d_width - !CLP - (mcom + mkey) * helpdata->numcols) / (helpdata->numcols + 1);
+ helpdata->inter = (D_width - !D_CLP - (mcom + mkey) * helpdata->numcols) / (helpdata->numcols + 1);
if (helpdata->inter <= 0)
helpdata->inter = 1;
debug1("inter: %d\n", helpdata->inter);
@@ -181,24 +182,24 @@ display_help()
helpdata->mkey = mkey;
helpdata->numrows = (helpdata->num_names + helpdata->numcols - 1) / helpdata->numcols;
debug1("Numrows: %d\n", helpdata->numrows);
- helpdata->numskip = d_height-5 - (2 + helpdata->numrows);
+ helpdata->numskip = D_height-5 - (2 + helpdata->numrows);
while (helpdata->numskip < 0)
- helpdata->numskip += d_height-5;
- helpdata->numskip %= d_height-5;
+ helpdata->numskip += D_height-5;
+ helpdata->numskip %= D_height-5;
debug1("Numskip: %d\n", helpdata->numskip);
- if (helpdata->numskip > d_height/3 || helpdata->numskip > helpdata->command_bindings)
+ if (helpdata->numskip > D_height/3 || helpdata->numskip > helpdata->command_bindings)
helpdata->numskip = 1;
helpdata->maxrow = 2 + helpdata->numrows + helpdata->numskip + helpdata->command_bindings;
helpdata->grow = 0;
- helpdata->numpages = (helpdata->maxrow + d_height-6) / (d_height-5);
+ helpdata->numpages = (helpdata->maxrow + D_height-6) / (D_height-5);
helppage();
}
static void
HelpSetCursor()
{
- GotoPos(0, d_height - 1);
+ GotoPos(0, D_height - 1);
}
static void
@@ -208,7 +209,7 @@ int *plen;
{
int done = 0;
- GotoPos(0, d_height-1);
+ GotoPos(0, D_height-1);
while (!done && *plen > 0)
{
switch (**ppbuf)
@@ -246,7 +247,7 @@ helppage()
int col, crow, n, key;
char buf[MAXKLEN], Esc_buf[5], cbuf[256];
- helpdata = (struct helpdata *)d_lay->l_data;
+ helpdata = (struct helpdata *)D_lay->l_data;
if (helpdata->grow >= helpdata->maxrow)
{
@@ -259,20 +260,20 @@ helppage()
SetAttrFont(0, ASCII);
ClearDisplay();
- sprintf(cbuf,"Screen key bindings, page %d of %d.", helpdata->grow / (d_height-5) + 1, helpdata->numpages);
+ sprintf(cbuf,"Screen key bindings, page %d of %d.", helpdata->grow / (D_height-5) + 1, helpdata->numpages);
centerline(cbuf);
AddChar('\n');
crow = 2;
*Esc_buf = '\0';
- add_key_to_buf(Esc_buf, d_user->u_Esc);
+ add_key_to_buf(Esc_buf, D_user->u_Esc);
- for (; crow < d_height - 3; crow++)
+ for (; crow < D_height - 3; crow++)
{
if (helpdata->grow < 1)
{
*buf = '\0';
- add_key_to_buf(buf, d_user->u_MetaEsc);
+ add_key_to_buf(buf, D_user->u_MetaEsc);
sprintf(cbuf,"Command key: %s Literal %s: %s", Esc_buf, Esc_buf, buf);
centerline(cbuf);
helpdata->grow++;
@@ -300,8 +301,6 @@ helppage()
else if (helpdata->grow-2-helpdata->numrows >= helpdata->numskip
&& helpdata->grow-2-helpdata->numrows-helpdata->numskip < helpdata->command_bindings)
{
- char **pp, *cp;
-
while ((n = ktab[helpdata->command_search].nr) == RC_ILLEGAL
|| ktab[helpdata->command_search].args == noargs)
{
@@ -311,39 +310,7 @@ helppage()
buf[0] = '\0';
add_key_to_buf(buf, helpdata->command_search);
AddStrn(buf, 4);
- col = 4;
- AddStr(comms[n].name);
- AddChar(' ');
- col += strlen(comms[n].name) + 1;
- pp = ktab[helpdata->command_search++].args;
- while (pp && (cp = *pp) != NULL)
- {
- if (!*cp || (index(cp, ' ') != NULL))
- {
- if (index(cp, '\'') != NULL)
- *buf = '"';
- else
- *buf = '\'';
- sprintf(buf + 1, "%s%c", cp, *buf);
- cp = buf;
- }
- if ((col += strlen(cp) + 1) >= d_width)
- {
- col = d_width - (col - (strlen(cp) + 1)) - 2;
- if (col >= 0)
- {
- n = cp[col];
- cp[col] = '\0';
- AddStr(*pp);
- AddChar('$');
- cp[col] = (char) n;
- }
- break;
- }
- AddStr(cp);
- AddChar((d_width - col != 1 || !pp[1]) ? ' ' : '$');
- pp++;
- }
+ AddAction(&ktab[helpdata->command_search++], D_width - 5);
AddStr("\r\n");
helpdata->grow++;
}
@@ -357,10 +324,63 @@ helppage()
sprintf(cbuf,"[Press Space %s Return to end.]",
helpdata->grow < helpdata->maxrow ? "for next page;" : "or");
centerline(cbuf);
- SetLastPos(0, d_height-1);
+ SetLastPos(0, D_height-1);
return(0);
}
+static int
+AddAction(act, fr)
+struct action *act;
+int fr;
+{
+ char buf[256];
+ int del, l;
+ char *bp, *cp, **pp;
+
+ if (fr <= 0)
+ return 0;
+ l = strlen(comms[act->nr].name);
+
+ if (l + 1 > fr)
+ l = fr - 1;
+ AddStrn(comms[act->nr].name, l);
+ fr -= l + 1;
+ AddChar(fr ? ' ' : '$');
+
+ pp = act->args;
+ while (pp && (cp = *pp) != NULL)
+ {
+ del = 0;
+ bp = buf;
+ if (!*cp || (index(cp, ' ') != NULL))
+ {
+ if (index(cp, '\'') != NULL)
+ *bp++ = del = '"';
+ else
+ *bp++ = del = '\'';
+ }
+ while (*cp && bp < buf + 250)
+ bp += AddXChar(bp, *cp++);
+ if (del)
+ *bp++ = del;
+ *bp = 0;
+ if ((fr -= (bp - buf) + 1) < 0)
+ {
+ fr += bp - buf;
+ if (fr > 0)
+ AddStrn(buf, fr);
+ if (fr == 0)
+ AddChar('$');
+ return 0;
+ }
+ AddStr(buf);
+ pp++;
+ if (*pp)
+ AddChar(fr ? ' ' : '$');
+ }
+ return fr;
+}
+
static void
add_key_to_buf(buf, key)
char *buf;
@@ -370,12 +390,7 @@ int key;
buf += strlen(buf);
if (key == ' ')
sprintf(buf, "sp");
- else if (key < ' ' || key == 0x7f)
- sprintf(buf, "^%c", (key ^ 0x40));
- else if (key >= 0x80)
- sprintf(buf, "\\%03o", key);
- else
- sprintf(buf, "%c", key);
+ else buf[AddXChar(buf, key)] = 0;
}
@@ -387,17 +402,17 @@ int y, xs, xe, isblank;
{
struct helpdata *helpdata;
- helpdata = (struct helpdata *)d_lay->l_data;
+ helpdata = (struct helpdata *)D_lay->l_data;
helpdata->grow = helpdata->refgrow;
helpdata->command_search = helpdata->refcommand_search;
helppage();
return;
}
- if (y != 0 && y != d_height - 1)
+ if (y != 0 && y != D_height - 1)
return;
if (isblank)
return;
- Clear(xs, y, xe, y);
+ Clear(xs, y, xs, xe, xe, y, 0);
}
@@ -459,7 +474,7 @@ screen@uni-erlangen.de\n";
static void
CopyrightSetCursor()
{
- GotoPos(0, d_height - 1);
+ GotoPos(0, D_height - 1);
}
static void
@@ -470,8 +485,8 @@ int *plen;
int done = 0;
struct copydata *copydata;
- copydata = (struct copydata *)d_lay->l_data;
- GotoPos(0, d_height - 1);
+ copydata = (struct copydata *)D_lay->l_data;
+ GotoPos(0, D_height - 1);
while (!done && *plen > 0)
{
switch (**ppbuf)
@@ -508,14 +523,14 @@ display_copyright()
{
struct copydata *copydata;
- if (d_width < 10 || d_height < 5)
+ if (D_width < 10 || D_height < 5)
{
Msg(0, "Window size too small for copyright page");
return;
}
if (InitOverlayPage(sizeof(*copydata), &CopyrightLf, 0))
return;
- copydata = (struct copydata *)d_lay->l_data;
+ copydata = (struct copydata *)D_lay->l_data;
copydata->cps = (char *)cpmsg;
copydata->savedcps = 0;
copypage();
@@ -530,14 +545,14 @@ copypage()
char cbuf[80];
struct copydata *copydata;
- copydata = (struct copydata *)d_lay->l_data;
+ copydata = (struct copydata *)D_lay->l_data;
SetAttrFont(0, ASCII);
ClearDisplay();
x = y = 0;
cps = copydata->cps;
copydata->refcps = cps;
copydata->refsavedcps = copydata->savedcps;
- while (*cps && y < d_height - 3)
+ while (*cps && y < D_height - 3)
{
ws = cps;
while (*cps == ' ')
@@ -552,9 +567,9 @@ copypage()
cps++;
l = cps - ws;
cps = ws;
- if (l > d_width - 1)
- l = d_width - 1;
- if (x && x + l >= d_width - 2)
+ if (l > D_width - 1)
+ l = D_width - 1;
+ if (x && x + l >= D_width - 2)
{
AddStr("\r\n");
x = 0;
@@ -586,12 +601,12 @@ copypage()
}
while (*cps == '\n')
cps++;
- while (y++ < d_height - 2)
+ while (y++ < D_height - 2)
AddStr("\r\n");
sprintf(cbuf,"[Press Space %s Return to end.]",
*cps ? "for next page;" : "or");
centerline(cbuf);
- SetLastPos(0, d_height-1);
+ SetLastPos(0, D_height-1);
copydata->cps = cps;
}
@@ -603,17 +618,17 @@ int y, xs, xe, isblank;
{
struct copydata *copydata;
- copydata = (struct copydata *)d_lay->l_data;
+ copydata = (struct copydata *)D_lay->l_data;
copydata->cps = copydata->refcps;
copydata->savedcps = copydata->refsavedcps;
copypage();
return;
}
- if (y != 0 && y != d_height - 1)
+ if (y != 0 && y != D_height - 1)
return;
if (isblank)
return;
- Clear(xs, y, xe, y);
+ Clear(xs, y, xs, xe, xe, y, 0);
}
void
@@ -622,3 +637,218 @@ display_displays()
/* To be filled in... */
}
+/*
+**
+** The bindkey help page
+**
+*/
+
+#ifdef MAPKEYS
+
+extern char *kmap_extras[];
+extern int kmap_extras_fl[];
+extern struct term term[];
+
+static void BindkeyProcess __P((char **, int *));
+static void BindkeyAbort __P((void));
+static void BindkeyRedisplayLine __P((int, int, int, int));
+static void BindkeySetCursor __P((void));
+static void bindkeypage __P((void));
+
+struct bindkeydata
+{
+ char *title;
+ struct action *tab;
+ int pos;
+ int last;
+ int page;
+ int pages;
+};
+
+static struct LayFuncs BindkeyLf =
+{
+ BindkeyProcess,
+ BindkeyAbort,
+ BindkeyRedisplayLine,
+ DefClearLine,
+ DefRewrite,
+ BindkeySetCursor,
+ DefResize,
+ DefRestore
+};
+
+
+void
+display_bindkey(title, tab)
+char *title;
+struct action *tab;
+{
+ struct bindkeydata *bindkeydata;
+ int i, n;
+
+ if (display == 0)
+ return;
+ if (D_height < 6)
+ {
+ Msg(0, "Window height too small for bindkey page");
+ return;
+ }
+ if (InitOverlayPage(sizeof(*bindkeydata), &BindkeyLf, 0))
+ return;
+
+ bindkeydata = (struct bindkeydata *)D_lay->l_data;
+ bindkeydata->title = title;
+ bindkeydata->tab = tab;
+
+ n = 0;
+ for (i = 0; i < KMAP_KEYS+KMAP_AKEYS+KMAP_EXT; i++)
+ {
+ if (tab[i].nr != RC_ILLEGAL)
+ n++;
+ }
+ bindkeydata->pos = 0;
+ bindkeydata->page = 1;
+ bindkeydata->pages = (n + D_height - 6) / (D_height - 5);
+ if (bindkeydata->pages == 0)
+ bindkeydata->pages = 1;
+ bindkeypage();
+}
+
+static void
+BindkeySetCursor()
+{
+ GotoPos(0, D_height - 1);
+}
+
+static void
+BindkeyAbort()
+{
+ LAY_CALL_UP(Activate(0));
+ ExitOverlayPage();
+}
+
+static void
+bindkeypage()
+{
+ struct bindkeydata *bindkeydata;
+ char tbuf[256];
+ int del, i, ch, y;
+ struct action *act;
+ char *xch, *s, *p;
+
+ bindkeydata = (struct bindkeydata *)D_lay->l_data;
+
+ SetAttrFont(0, ASCII);
+ ClearDisplay();
+
+ sprintf(tbuf, "%s key bindings, page %d of %d.", bindkeydata->title, bindkeydata->page, bindkeydata->pages);
+ centerline(tbuf);
+ AddChar('\n');
+ y = D_height - 5;
+ for (i = bindkeydata->pos; i < KMAP_KEYS+KMAP_AKEYS+KMAP_EXT && y; i++)
+ {
+ p = tbuf;
+ act = &bindkeydata->tab[i];
+ if (act->nr == RC_ILLEGAL)
+ continue;
+ xch = " ";
+ if (i < KMAP_KEYS)
+ {
+ del = *p++ = ':';
+ s = term[i + T_CAPS].tcname;
+ }
+ else if (i < KMAP_KEYS+KMAP_AKEYS)
+ {
+ del = *p++ = ':';
+ s = term[i + (T_CAPS - T_OCAPS + T_CURSOR)].tcname;
+ xch = "[A]";
+ }
+ else
+ {
+ del = 0;
+ s = kmap_extras[i - (KMAP_KEYS+KMAP_AKEYS)];
+ if (kmap_extras_fl[i - (KMAP_KEYS+KMAP_AKEYS)])
+ xch = "[T]";
+ }
+ while ((ch = *(unsigned char *)s++))
+ p += AddXChar(p, ch);
+ if (del)
+ *p++ = del;
+ *p++ = ' ';
+ while (p < tbuf + 15)
+ *p++ = ' ';
+ sprintf(p, "%s -> ", xch);
+ p += 7;
+ if (p - tbuf > D_width - 1)
+ {
+ tbuf[D_width - 2] = '$';
+ tbuf[D_width - 1] = 0;
+ }
+ AddStr(tbuf);
+ AddAction(act, D_width - 1 - strlen(tbuf));
+ AddStr("\r\n");
+ y--;
+ }
+ y++;
+ while(y--)
+ AddChar('\n');
+ bindkeydata->last = i;
+ sprintf(tbuf,"[Press Space %s Return to end.]", bindkeydata->page < bindkeydata->pages ? "for next page;" : "or");
+ centerline(tbuf);
+ SetLastPos(0, D_height-1);
+}
+
+static void
+BindkeyProcess(ppbuf, plen)
+char **ppbuf;
+int *plen;
+{
+ int done = 0;
+ struct bindkeydata *bindkeydata;
+
+ bindkeydata = (struct bindkeydata *)D_lay->l_data;
+ GotoPos(0, D_height-1);
+ while (!done && *plen > 0)
+ {
+ switch (**ppbuf)
+ {
+ case ' ':
+ if (bindkeydata->page < bindkeydata->pages)
+ {
+ bindkeydata->pos = bindkeydata->last;
+ bindkeydata->page++;
+ bindkeypage();
+ break;
+ }
+ /* FALLTHROUGH */
+ case '\r':
+ case '\n':
+ done = 1;
+ break;
+ default:
+ break;
+ }
+ ++*ppbuf;
+ --*plen;
+ }
+ if (done)
+ BindkeyAbort();
+}
+
+static void
+BindkeyRedisplayLine(y, xs, xe, isblank)
+int y, xs, xe, isblank;
+{
+ if (y < 0)
+ {
+ bindkeypage();
+ return;
+ }
+ if (y != 0 && y != D_height - 1)
+ return;
+ if (isblank)
+ return;
+ Clear(xs, y, xs, xe, xe, y, 0);
+}
+
+#endif
diff --git a/src/input.c b/src/input.c
index 7ea908c..c5dab8c 100644
--- a/src/input.c
+++ b/src/input.c
@@ -68,7 +68,7 @@ char *p, *s;
{
struct inpdata *inpdata;
- inpdata = (struct inpdata *)d_lay->l_data;
+ inpdata = (struct inpdata *)D_lay->l_data;
if (p)
{
inpdata->inpstringlen = strlen(p);
@@ -80,7 +80,7 @@ char *p, *s;
inpdata->inpbuf[sizeof(inpdata->inpbuf) - 1] = 0;
inpdata->inplen = strlen(inpdata->inpbuf);
}
- RefreshLine(STATLINE, 0, d_width - 1, 0);
+ RefreshLine(STATLINE, 0, D_width - 1, 0);
}
/*
@@ -102,12 +102,17 @@ int mode;
int maxlen;
struct inpdata *inpdata;
+ if (!display)
+ {
+ Msg(0, "Input: cannot interact with user w/o display. Try other form of command\n");
+ return;
+ }
if (len > 100)
len = 100;
if (!(mode & INP_NOECHO))
{
- maxlen = d_width - strlen(istr);
- if (!CLP && STATLINE == d_bot)
+ maxlen = D_width - strlen(istr);
+ if (!D_CLP && STATLINE == D_bot)
maxlen--;
if (len > maxlen)
len = maxlen;
@@ -119,7 +124,7 @@ int mode;
}
if (InitOverlayPage(sizeof(*inpdata), &InpLf, 1))
return;
- inpdata = (struct inpdata *)d_lay->l_data;
+ inpdata = (struct inpdata *)D_lay->l_data;
inpdata->inpmaxlen = len;
inpdata->inpfinfunc = finfunc;
inpdata->inplen = 0;
@@ -132,7 +137,7 @@ InpSetCursor()
{
struct inpdata *inpdata;
- inpdata = (struct inpdata *)d_lay->l_data;
+ inpdata = (struct inpdata *)D_lay->l_data;
GotoPos(inpdata->inpstringlen + (inpdata->inpmode & INP_NOECHO ? 0 : inpdata->inplen), STATLINE);
}
@@ -146,7 +151,7 @@ int *plen;
char ch;
struct inpdata *inpdata;
- inpdata = (struct inpdata *)d_lay->l_data;
+ inpdata = (struct inpdata *)D_lay->l_data;
GotoPos(inpdata->inpstringlen + (inpdata->inpmode & INP_NOECHO ? 0 : inpdata->inplen), STATLINE);
if (ppbuf == 0)
@@ -197,7 +202,7 @@ int *plen;
inpdata->inplen = 0;
inpdata->inpbuf[inpdata->inplen] = 0;
- d_lay->l_data = 0;
+ D_lay->l_data = 0;
InpAbort(); /* redisplays... */
*ppbuf = pbuf;
*plen = len;
@@ -205,7 +210,7 @@ int *plen;
(*inpdata->inpfinfunc)(inpdata->inpbuf, inpdata->inplen);
else
(*inpdata->inpfinfunc)(pbuf - 1, 0);
- free(inpdata);
+ free((char *)inpdata);
return;
}
}
@@ -216,7 +221,7 @@ int *plen;
static void
InpAbort()
{
- LAY_CALL_UP(RefreshLine(STATLINE, 0, d_width - 1, 0));
+ LAY_CALL_UP(RefreshLine(STATLINE, 0, D_width - 1, 0));
ExitOverlayPage();
}
@@ -227,7 +232,7 @@ int y, xs, xe, isblank;
int q, r, s, l, v;
struct inpdata *inpdata;
- inpdata = (struct inpdata *)d_lay->l_data;
+ inpdata = (struct inpdata *)D_lay->l_data;
if (y != STATLINE)
{
@@ -263,7 +268,7 @@ int y, xs, xe, isblank;
v -= l;
}
s = r;
- r = d_width;
+ r = D_width;
if (!isblank && v > 0 && q < r)
{
SetAttrFont(0, ASCII);
diff --git a/src/install.sh b/src/install.sh
new file mode 100755
index 0000000..8c07c50
--- /dev/null
+++ b/src/install.sh
@@ -0,0 +1,119 @@
+#! /bin/sh
+
+#
+# install - install a program, script, or datafile
+# This comes from X11R5; it is not part of GNU.
+#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+
+instcmd="$mvprog"
+chmodcmd=""
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+fi
+
+if [ x"$dst" = x ]
+then
+ echo "install: no destination specified"
+ exit 1
+fi
+
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+if [ -d $dst ]
+then
+ dst="$dst"/`basename $src`
+fi
+
+# Make a temp file name in the proper directory.
+
+dstdir=`dirname $dst`
+dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+$doit $instcmd $src $dsttmp
+
+# and set any options; do chmod last to preserve setuid bits
+
+if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
+if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
+if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
+if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
+
+# Now rename the file to the real destination.
+
+$doit $rmcmd $dst
+$doit $mvcmd $dsttmp $dst
+
+
+exit 0
diff --git a/src/kmapdef.c.dist b/src/kmapdef.c.dist
new file mode 100644
index 0000000..943c600
--- /dev/null
+++ b/src/kmapdef.c.dist
@@ -0,0 +1,130 @@
+/*
+ * This file is automagically created from term.c -- DO NOT EDIT
+ */
+
+#include "config.h"
+
+#ifdef MAPKEYS
+
+char *kmapdef[] = {
+"\033[10~",
+"\033OP",
+"\033OQ",
+"\033OR",
+"\033OS",
+"\033[15~",
+"\033[17~",
+"\033[18~",
+"\033[19~",
+"\033[20~",
+"\033[21~",
+"\033[23~",
+"\033[24~",
+"\010",
+"\033[1~",
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+"\033[3~",
+0,
+0,
+"\033[4~",
+"\033[2~",
+0,
+0,
+"\033[6~",
+"\033[5~",
+0,
+0,
+0,
+0,
+0,
+0,
+"\033[A",
+"\033[B",
+"\033[C",
+"\033[D",
+"0",
+"1",
+"2",
+"3",
+"4",
+"5",
+"6",
+"7",
+"8",
+"9",
+"+",
+"-",
+"*",
+"/",
+"=",
+".",
+",",
+"\015"
+};
+
+char *kmapadef[] = {
+"\033OA",
+"\033OB",
+"\033OC",
+"\033OD",
+"\033Op",
+"\033Oq",
+"\033Or",
+"\033Os",
+"\033Ot",
+"\033Ou",
+"\033Ov",
+"\033Ow",
+"\033Ox",
+"\033Oy",
+"\033Ok",
+"\033Om",
+"\033Oj",
+"\033Oo",
+"\033OX",
+"\033On",
+"\033Ol",
+"\033OM"
+};
+
+char *kmapmdef[] = {
+"g",
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+"\004",
+"G",
+0,
+0,
+0,
+"\006",
+"\002",
+"\025",
+0,
+0,
+0,
+0,
+0,
+"k",
+"j",
+"l",
+"h"
+};
+
+#endif
diff --git a/src/loadav.c b/src/loadav.c
index 3f53b4c..6b29f0f 100644
--- a/src/loadav.c
+++ b/src/loadav.c
@@ -66,11 +66,11 @@ GetLoadav()
if ((fp = secfopen("/proc/loadavg", "r")) == NULL)
return 0;
- fscanf(fp, "%lf %lf %lf\n", d, d+1, d+2);
+ fscanf(fp, "%lf %lf %lf\n", d, d + 1, d + 2);
fclose(fp);
- for (i = 0; i < LOADAV_NUM; i++)
+ for (i = 0; i < (LOADAV_NUM > 3 ? 3 : LOADAV_NUM); i++)
loadav[i] = d[i];
- return LOADAV_NUM;
+ return i;
}
#endif /* linux */
@@ -114,7 +114,7 @@ GetLoadav()
#if defined(NeXT) && !defined(LOADAV_DONE)
#define LOADAV_DONE
-#include <mach.h>
+#include <mach/mach.h>
static processor_set_t default_set;
@@ -163,6 +163,12 @@ GetLoadav()
extern int nlist __P((char *, struct nlist *));
# endif
+#ifdef __sgi
+# if _MIPS_SZLONG == 64
+# define nlist nlist64
+# endif
+#endif
+
static struct nlist nl[2];
static int kmemf;
@@ -170,24 +176,30 @@ void
InitLoadav()
{
debug("Init Kmem...\n");
- kmemf = open("/dev/kmem", O_RDONLY);
- if (kmemf == -1)
+ if ((kmemf = open("/dev/kmem", O_RDONLY)) == -1)
return;
- debug("Kmem opened\n");
-# ifdef NLIST_NAME_UNION
+# if !defined(_AUX_SOURCE) && !defined(AUX)
+# ifdef NLIST_NAME_UNION
nl[0].n_un.n_name = LOADAV_AVENRUN;
-# else
+# else
nl[0].n_name = LOADAV_AVENRUN;
+# endif
+# else
+ strncpy(nl[0].n_name, LOADAV_AVENRUN, sizeof(nl[0].n_name));
# endif
debug2("Searching in %s for %s\n", LOADAV_UNIX, nl[0].n_name);
nlist(LOADAV_UNIX, nl);
+# ifndef _IBMR2
if (nl[0].n_value == 0)
+# else
+ if (nl[0].n_value == 0 || lseek(kmemf, (off_t) nl[0].n_value, 0) == (off_t)-1 || read(kmemf, (char *)&nl[0].n_value, sizeof(nl[0].n_value)) != sizeof(nl[0].n_value))
+# endif
{
close(kmemf);
return;
}
# ifdef sgi
- nl[0].n_value &= ~(1 << 31); /* clear upper bit */
+ nl[0].n_value &= (unsigned long)-1 >> 1; /* clear upper bit */
# endif /* sgi */
debug1("AvenrunSym found (0x%lx)!!\n", nl[0].n_value);
loadok = 1;
@@ -196,7 +208,7 @@ InitLoadav()
static int
GetLoadav()
{
- if (lseek(kmemf, (off_t) nl[0].n_value, 0) == (off_t) - 1)
+ if (lseek(kmemf, (off_t) nl[0].n_value, 0) == (off_t)-1)
return 0;
if (read(kmemf, (char *) loadav, sizeof(loadav)) != sizeof(loadav))
return 0;
diff --git a/src/mark.c b/src/mark.c
index 678c554..b3ea3b8 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -55,6 +55,8 @@ extern char *null, *blank;
extern nethackflag;
#endif
+int pastefont = 1;
+
static struct LayFuncs MarkLf =
{
MarkProcess,
@@ -102,10 +104,10 @@ int y;
register int x;
register char *i;
- for (x = markdata->left_mar, i = iWIN(y) + x; x < d_width - 1; x++)
+ for (x = markdata->left_mar, i = iWIN(y) + x; x < D_width - 1; x++)
if (*i++ != ' ')
break;
- if (x == d_width - 1)
+ if (x == D_width - 1)
x = markdata->left_mar;
return(x);
}
@@ -142,7 +144,7 @@ static void
nextword(xp, yp, flags, num)
int *xp, *yp, flags, num;
{
- int xx = d_width, yy = fore->w_histheight + d_height;
+ int xx = D_width, yy = fore->w_histheight + D_height;
register int sx, oq, q, x, y;
x = *xp;
@@ -199,9 +201,9 @@ rem(x1, y1, x2, y2, redisplay, pt, yend)
int x1, y1, x2, y2, redisplay, yend;
char *pt;
{
- int i, j, from, to, ry;
+ int i, j, from, to, ry, c, cf, font;
int l = 0;
- char *im;
+ char *im, *fo;
markdata->second = 0;
if (y2 < y1 || ((y2 == y1) && (x2 < x1)))
@@ -228,7 +230,7 @@ char *pt;
from = (i == y1) ? x1 : 0;
if (from < markdata->left_mar)
from = markdata->left_mar;
- for (to = d_width, im = iWIN(i) + to; to >= 0; to--)
+ for (to = D_width, im = iWIN(i) + to; to >= 0; to--)
if (*im-- != ' ')
break;
if (i == y2 && x2 < to)
@@ -239,13 +241,108 @@ char *pt;
MarkRedisplayLine(ry, from, to, 0);
if (redisplay != 2 && pt == 0) /* don't count/copy */
continue;
- for (j = from, im = iWIN(i)+from; j <= to; j++)
+ j = from;
+#ifdef KANJI
+ if (badkanji(fWIN(i), j))
+ j--;
+#endif
+ font = ASCII;
+ for (im = iWIN(i)+j, fo = fWIN(i)+j; j <= to; j++)
{
+ cf = *fo++;
+ c = *im++;
+#ifdef KANJI
+ if (cf == KANJI)
+ {
+ 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 < 0x5e) ? 0x81 : 0xc1);
+ }
+ else
+ {
+ if (pt)
+ {
+ strcpy(pt, "\033$B");
+ pt += 3;
+ }
+ l += 3;
+ font = KANJI;
+ }
+ }
+ if (pt)
+ *pt++ = c;
+ l++;
+ c = t;
+ }
+ else
+#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
+ {
+ if (cf != font)
+ {
+ if (pt)
+ {
+ strcpy(pt, "\033(");
+ pt[2] = (cf == ASCII) ? 'B' : cf;
+ pt += 3;
+ }
+ l += 3;
+ font = cf;
+ }
+ }
+ }
if (pt)
- *pt++ = *im++;
+ *pt++ = c;
l++;
}
- if (i != y2 && (to != d_width - 1 || iWIN(i)[to + 1] == ' '))
+ if (pastefont && font != ASCII)
+ {
+ if (pt)
+ {
+ strcpy(pt, "\033(B");
+ pt += 3;
+ }
+ l += 3;
+ }
+ if (i != y2 && (to != D_width - 1 || iWIN(i)[to + 1] == ' '))
{
/*
* this code defines, what glues lines together
@@ -253,15 +350,15 @@ char *pt;
switch (markdata->nonl)
{
case 0: /* lines separated by newlines */
+ if (pt)
+ *pt++ = '\r';
+ l++;
if (join_with_cr)
{
if (pt)
- *pt++ = '\r';
+ *pt++ = '\n';
l++;
}
- if (pt)
- *pt++ = '\n';
- l++;
break;
case 1: /* nothing to separate lines */
break;
@@ -273,7 +370,7 @@ char *pt;
}
}
}
- return(l);
+ return l;
}
/* Check if two chars are identical. All digits are treatened
@@ -301,8 +398,8 @@ GetHistory() /* return value 1 if u_copybuffer changed */
char *linep;
x = fore->w_x;
- if (x >= d_width)
- x = d_width - 1;
+ if (x >= D_width)
+ x = D_width - 1;
y = fore->w_y + fore->w_histheight;
debug2("cursor is at x=%d, y=%d\n", x, y);
for (xx = x - 1, linep = iWIN(y) + xx; xx >= 0; xx--)
@@ -314,7 +411,7 @@ GetHistory() /* return value 1 if u_copybuffer changed */
linep = iWIN(yy);
if (xx < 0 || eq(linep[xx], q))
{ /* line is matching... */
- for (i = d_width - 1, linep += i; i >= x; i--)
+ for (i = D_width - 1, linep += i; i >= x; i--)
if (*linep-- != ' ')
break;
if (i >= x)
@@ -323,15 +420,15 @@ GetHistory() /* return value 1 if u_copybuffer changed */
}
if (yy < 0)
return 0;
- if (d_user->u_copybuffer != NULL)
- UserFreeCopyBuffer(d_user);
- if ((d_user->u_copybuffer = malloc((unsigned) (i - x + 2))) == NULL)
+ if (D_user->u_copybuffer != NULL)
+ UserFreeCopyBuffer(D_user);
+ if ((D_user->u_copybuffer = malloc((unsigned) (i - x + 2))) == NULL)
{
Msg(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(linep - i + x + 1, D_user->u_copybuffer, i - x + 1);
+ D_user->u_copylen = i - x + 1;
return 1;
}
@@ -343,29 +440,29 @@ MarkRoutine()
ASSERT(fore->w_active);
if (InitOverlayPage(sizeof(*markdata), &MarkLf, 1))
return;
- markdata = (struct markdata *)d_lay->l_data;
+ markdata = (struct markdata *)D_lay->l_data;
markdata->second = 0;
markdata->rep_cnt = 0;
markdata->append_mode = 0;
markdata->write_buffer = 0;
markdata->nonl = 0;
markdata->left_mar = 0;
- markdata->right_mar = d_width - 1;
+ markdata->right_mar = D_width - 1;
markdata->hist_offset = fore->w_histheight;
x = fore->w_x;
y = D2W(fore->w_y);
- if (x >= d_width)
- x = d_width - 1;
+ if (x >= D_width)
+ x = D_width - 1;
GotoPos(x, W2D(y));
#ifdef NETHACK
if (nethackflag)
Msg(0, "Welcome to hacker's treasure zoo - Column %d Line %d(+%d) (%d,%d)",
- x + 1, W2D(y + 1), fore->w_histheight, d_width, d_height);
+ x + 1, W2D(y + 1), fore->w_histheight, D_width, D_height);
else
#endif
Msg(0, "Copy mode - Column %d Line %d(+%d) (%d,%d)",
- x + 1, W2D(y + 1), fore->w_histheight, d_width, d_height);
+ x + 1, W2D(y + 1), fore->w_histheight, D_width, D_height);
markdata->cx = markdata->x1 = x;
markdata->cy = markdata->y1 = y;
}
@@ -373,8 +470,8 @@ MarkRoutine()
static void
MarkSetCursor()
{
- markdata = (struct markdata *)d_lay->l_data;
- fore = d_fore;
+ markdata = (struct markdata *)D_lay->l_data;
+ fore = D_fore;
GotoPos(markdata->cx, W2D(markdata->cy));
}
@@ -394,8 +491,8 @@ int *inlenp;
char *extrap = 0, extrabuf[100];
*/
- markdata = (struct markdata *)d_lay->l_data;
- fore = d_fore;
+ markdata = (struct markdata *)D_lay->l_data;
+ fore = D_fore;
if (inbufp == 0)
{
MarkAbort();
@@ -465,8 +562,8 @@ int *inlenp;
if (rep_cnt == 0)
rep_cnt = 1;
j = cy + rep_cnt;
- if (j > fore->w_histheight + d_height - 1)
- j = fore->w_histheight + d_height - 1;
+ if (j > fore->w_histheight + D_height - 1)
+ j = fore->w_histheight + D_height - 1;
revto(linestart(j), j);
break;
case '-':
@@ -500,7 +597,7 @@ int *inlenp;
break;
case '\004': /* CTRL-D down half screen */
if (rep_cnt == 0)
- rep_cnt = (d_height + 1) >> 1;
+ rep_cnt = (D_height + 1) >> 1;
revto_line(cx, cy + rep_cnt, W2D(cy));
break;
case '$':
@@ -516,11 +613,11 @@ int *inlenp;
break;
case '\025': /* CTRL-U up half screen */
if (rep_cnt == 0)
- rep_cnt = (d_height + 1) >> 1;
+ rep_cnt = (D_height + 1) >> 1;
revto_line(cx, cy - rep_cnt, W2D(cy));
break;
case '\007': /* CTRL-G show cursorpos */
- if (markdata->left_mar == 0 && markdata->right_mar == d_width - 1)
+ if (markdata->left_mar == 0 && markdata->right_mar == D_width - 1)
Msg(0, "Column %d Line %d(+%d)", cx+1, W2D(cy)+1,
markdata->hist_offset);
else
@@ -530,13 +627,13 @@ int *inlenp;
case '\002': /* CTRL-B back one page */
if (rep_cnt == 0)
rep_cnt = 1;
- rep_cnt *= d_height;
+ rep_cnt *= D_height;
revto(cx, cy - rep_cnt);
break;
case '\006': /* CTRL-F forward one page */
if (rep_cnt == 0)
rep_cnt = 1;
- rep_cnt *= d_height;
+ rep_cnt *= D_height;
revto(cx, cy + rep_cnt);
break;
case '\005': /* CTRL-E scroll up */
@@ -552,8 +649,8 @@ int *inlenp;
if (rep_cnt == 0)
rep_cnt = 1;
rep_cnt = MarkScrollDownDisplay(rep_cnt);
- if (cy > D2W(d_height-1))
- revto(cx, D2W(d_height-1));
+ if (cy > D2W(D_height-1))
+ revto(cx, D2W(D_height-1));
else
GotoPos(cx, W2D(cy));
break;
@@ -567,7 +664,7 @@ int *inlenp;
rep_cnt = 0;
if (rep_cnt > 100)
rep_cnt = 100;
- revto_line(markdata->left_mar, (rep_cnt * (fore->w_histheight + d_height)) / 100, (d_height - 1) / 2);
+ revto_line(markdata->left_mar, (rep_cnt * (fore->w_histheight + D_height)) / 100, (D_height - 1) / 2);
break;
case 'g':
rep_cnt = 1;
@@ -575,17 +672,17 @@ int *inlenp;
case 'G':
/* rep_cnt is here the WIN line number */
if (rep_cnt == 0)
- rep_cnt = fore->w_histheight + d_height;
- revto_line(markdata->left_mar, --rep_cnt, (d_height - 1) / 2);
+ rep_cnt = fore->w_histheight + D_height;
+ revto_line(markdata->left_mar, --rep_cnt, (D_height - 1) / 2);
break;
case 'H':
revto(markdata->left_mar, D2W(0));
break;
case 'M':
- revto(markdata->left_mar, D2W((d_height - 1) / 2));
+ revto(markdata->left_mar, D2W((D_height - 1) / 2));
break;
case 'L':
- revto(markdata->left_mar, D2W(d_height - 1));
+ revto(markdata->left_mar, D2W(D_height - 1));
break;
case '|':
revto(--rep_cnt, cy);
@@ -626,7 +723,7 @@ int *inlenp;
/* set start column (c) and end column (C) */
if (markdata->second)
{
- rem(markdata->x1, markdata->y1, cx, cy, 1, (char *)0, d_height-1); /* Hack */
+ rem(markdata->x1, markdata->y1, cx, cy, 1, (char *)0, D_height-1); /* Hack */
markdata->second = 1; /* rem turns off second */
}
rep_cnt--;
@@ -749,28 +846,28 @@ int *inlenp;
x2 = cx;
y2 = cy;
newcopylen = rem(markdata->x1, markdata->y1, x2, y2, 2, (char *)0, 0); /* count */
- if (d_user->u_copybuffer != NULL && !append_mode)
+ if (D_user->u_copybuffer != NULL && !append_mode)
{
- UserFreeCopyBuffer(d_user);
+ UserFreeCopyBuffer(D_user);
}
if (newcopylen > 0)
{
/* the +3 below is for : cr + lf + \0 */
- if (d_user->u_copybuffer != NULL)
- d_user->u_copybuffer = realloc(d_user->u_copybuffer,
- (unsigned) (d_user->u_copylen + newcopylen + 3));
+ if (D_user->u_copybuffer != NULL)
+ D_user->u_copybuffer = realloc(D_user->u_copybuffer,
+ (unsigned) (D_user->u_copylen + newcopylen + 3));
else
{
- d_user->u_copylen = 0;
- d_user->u_copybuffer = malloc((unsigned) (newcopylen + 3));
+ D_user->u_copylen = 0;
+ D_user->u_copybuffer = malloc((unsigned) (newcopylen + 3));
}
- if (d_user->u_copybuffer == NULL)
+ if (D_user->u_copybuffer == NULL)
{
MarkAbort();
in_mark = 0;
Msg(0, "Not enough memory... Sorry.");
- d_user->u_copylen = 0;
- d_user->u_copybuffer = NULL;
+ D_user->u_copylen = 0;
+ D_user->u_copybuffer = NULL;
break;
}
if (append_mode)
@@ -783,29 +880,29 @@ int *inlenp;
case 0:
if (join_with_cr)
{
- d_user->u_copybuffer[d_user->u_copylen] = '\r';
- d_user->u_copylen++;
+ D_user->u_copybuffer[D_user->u_copylen] = '\r';
+ D_user->u_copylen++;
}
- d_user->u_copybuffer[d_user->u_copylen] = '\n';
- d_user->u_copylen++;
+ D_user->u_copybuffer[D_user->u_copylen] = '\n';
+ D_user->u_copylen++;
break;
case 1:
break;
case 2:
- d_user->u_copybuffer[d_user->u_copylen] = ' ';
- d_user->u_copylen++;
+ D_user->u_copybuffer[D_user->u_copylen] = ' ';
+ D_user->u_copylen++;
break;
}
}
- yend = d_height - 1;
- if (fore->w_histheight - markdata->hist_offset < d_height)
+ yend = D_height - 1;
+ if (fore->w_histheight - markdata->hist_offset < D_height)
{
markdata->second = 0;
yend -= MarkScrollUpDisplay(fore->w_histheight - markdata->hist_offset);
}
- d_user->u_copylen += rem(markdata->x1, markdata->y1, x2, y2,
+ D_user->u_copylen += rem(markdata->x1, markdata->y1, x2, y2,
markdata->hist_offset == fore->w_histheight,
- d_user->u_copybuffer + d_user->u_copylen, yend);
+ D_user->u_copybuffer + D_user->u_copylen, yend);
}
if (markdata->hist_offset != fore->w_histheight)
LAY_CALL_UP(Activate(0));
@@ -814,7 +911,7 @@ int *inlenp;
Msg(0, "Appended %d characters to buffer",
newcopylen);
else
- Msg(0, "Copied %d characters into buffer", d_user->u_copylen);
+ Msg(0, "Copied %d characters into buffer", D_user->u_copylen);
if (write_buffer)
WriteFile(DUMP_EXCHANGE);
in_mark = 0;
@@ -850,17 +947,18 @@ int tx, ty, line;
{
int fx, fy;
int x, y, t, revst, reven, qq, ff, tt, st, en, ce = 0;
- int ystart = 0, yend = d_height-1;
+ int ystart = 0, yend = D_height-1;
int i, ry;
+ char *wi, *wa, *wf;
if (tx < 0)
tx = 0;
- else if (tx > d_width - 1)
- tx = d_width -1;
+ else if (tx > D_width - 1)
+ tx = D_width -1;
if (ty < 0)
ty = 0;
- else if (ty > fore->w_histheight + d_height - 1)
- ty = fore->w_histheight + d_height - 1;
+ else if (ty > fore->w_histheight + D_height - 1)
+ ty = fore->w_histheight + D_height - 1;
fx = markdata->cx; fy = markdata->cy;
markdata->cx = tx; markdata->cy = ty;
@@ -870,12 +968,12 @@ int tx, ty, line;
* then scroll the screen
*/
i = 0;
- if (line >= 0 && line < d_height)
+ if (line >= 0 && line < D_height)
i = W2D(ty) - line;
else if (ty < markdata->hist_offset)
i = ty - markdata->hist_offset;
- else if (ty > markdata->hist_offset + (d_height-1))
- i = ty-markdata->hist_offset-(d_height-1);
+ else if (ty > markdata->hist_offset + (D_height - 1))
+ i = ty - markdata->hist_offset - (D_height - 1);
if (i > 0)
yend -= MarkScrollUpDisplay(i);
else if (i < 0)
@@ -887,9 +985,9 @@ int tx, ty, line;
return;
}
- qq = markdata->x1 + markdata->y1 * d_width;
- ff = fx + fy * d_width; /* "from" offset in WIN coords */
- tt = tx + ty * d_width; /* "to" offset in WIN coords*/
+ qq = markdata->x1 + markdata->y1 * D_width;
+ ff = fx + fy * D_width; /* "from" offset in WIN coords */
+ tt = tx + ty * D_width; /* "to" offset in WIN coords*/
if (ff > tt)
{
@@ -921,33 +1019,57 @@ int tx, ty, line;
{
y += (ystart - ry);
x = 0;
- st = y * d_width;
+ st = y * D_width;
ry = ystart;
}
+ wi = iWIN(y);
+ wa = aWIN(y);
+ wf = fWIN(y);
for (t = st; t <= en; t++, x++)
{
- if (x >= d_width)
+ if (x >= D_width)
{
x = 0;
y++, ry++;
+ wi = iWIN(y);
+ wa = aWIN(y);
+ wf = fWIN(y);
}
if (ry > yend)
break;
if (t == st || x == 0)
{
- for (ce = d_width; ce >= 0; ce--)
- if (iWIN(y)[ce] != ' ')
+ for (ce = D_width; ce >= 0; ce--)
+ if (wi[ce] != ' ')
break;
}
if (x <= ce && x >= markdata->left_mar && x <= markdata->right_mar
- && (CLP || x < d_width-1 || ry < d_bot))
+ && (D_CLP || x < D_width-1 || ry < D_bot))
{
+#ifdef KANJI
+ if (badkanji(wf, x))
+ {
+ t--;
+ x--;
+ }
+#endif
GotoPos(x, W2D(y));
+#ifdef KANJI
+ if (t >= revst - (wf[x] == KANJI) && t <= reven)
+#else
if (t >= revst && t <= reven)
- SetAttrFont(A_SO, ASCII);
+#endif
+ SetAttrFont(A_SO, pastefont ? wf[x] : ASCII);
else
- SetAttrFont(aWIN(y)[x], fWIN(y)[x]);
- PUTCHARLP(iWIN(y)[x]);
+ SetAttrFont(wa[x], wf[x]);
+ PUTCHARLP(wi[x]);
+#ifdef KANJI
+ if (wf[x] == KANJI)
+ {
+ PUTCHARLP(wi[++x]);
+ t++;
+ }
+#endif
}
}
GotoPos(tx, W2D(ty));
@@ -959,11 +1081,11 @@ MarkAbort()
int yend, redisp;
debug("MarkAbort\n");
- markdata = (struct markdata *)d_lay->l_data;
- fore = d_fore;
- yend = d_height - 1;
+ markdata = (struct markdata *)D_lay->l_data;
+ fore = D_fore;
+ yend = D_height - 1;
redisp = markdata->second;
- if (fore->w_histheight - markdata->hist_offset < d_height)
+ if (fore->w_histheight - markdata->hist_offset < D_height)
{
markdata->second = 0;
yend -= MarkScrollUpDisplay(fore->w_histheight - markdata->hist_offset);
@@ -993,8 +1115,8 @@ int isblank;
if (y < 0) /* No special full page handling */
return;
- markdata = (struct markdata *)d_lay->l_data;
- fore = d_fore;
+ markdata = (struct markdata *)D_lay->l_data;
+ fore = D_fore;
wi = iWIN(D2W(y));
wa = aWIN(D2W(y));
@@ -1007,16 +1129,16 @@ int isblank;
return;
}
- sta = markdata->y1 * d_width + markdata->x1;
- sto = markdata->cy * d_width + markdata->cx;
+ sta = markdata->y1 * D_width + markdata->x1;
+ sto = markdata->cy * D_width + markdata->cx;
if (sta > sto)
{
i=sta; sta=sto; sto=i;
}
- cp = D2W(y) * d_width + xs;
+ cp = D2W(y) * D_width + xs;
rm = markdata->right_mar;
- for (x = d_width; x >= 0; x--)
+ for (x = D_width; x >= 0; x--)
if (wi[x] != ' ')
break;
if (x < rm)
@@ -1025,15 +1147,26 @@ int isblank;
for (x = xs; x <= xe; x++, cp++)
if (cp >= sta && x >= markdata->left_mar)
break;
+#ifdef KANJI
+ if (badkanji(wf, x))
+ x--;
+#endif
if (x > xs)
DisplayLine(oldi, null, null, wi, wa, wf, y, xs, x-1);
for (; x <= xe; x++, cp++)
{
- if (cp > sto || x > rm || (!CLP && x >= d_width-1 && y == d_bot))
+ if (cp > sto || x > rm || (!D_CLP && x >= D_width-1 && y == D_bot))
break;
GotoPos(x, y);
- SetAttrFont(A_SO, ASCII);
+ SetAttrFont(A_SO, pastefont ? wf[x] : ASCII);
PUTCHARLP(wi[x]);
+#ifdef KANJI
+ if (wf[x] == KANJI)
+ {
+ PUTCHARLP(wi[++x]);
+ cp++;
+ }
+#endif
}
if (x <= xe)
DisplayLine(oldi, null, null, wi, wa, wf, y, x, xe);
@@ -1050,8 +1183,8 @@ int ry, xs, xe, doit;
int dx, x, y, st, en, t, rm;
char *a, *f, *i;
- markdata = (struct markdata *)d_lay->l_data;
- fore = d_fore;
+ markdata = (struct markdata *)D_lay->l_data;
+ fore = D_fore;
y = D2W(ry);
dx = xe - xs;
if (doit)
@@ -1068,15 +1201,15 @@ int ry, xs, xe, doit;
st = en = -1;
else
{
- st = markdata->y1 * d_width + markdata->x1;
- en = markdata->cy * d_width + markdata->cx;
+ st = markdata->y1 * D_width + markdata->x1;
+ en = markdata->cy * D_width + markdata->cx;
if (st > en)
{
t = st; st = en; en = t;
}
}
- t = y * d_width + xs;
- for (rm=d_width, i=iWIN(y) + d_width; rm>=0; rm--)
+ t = y * D_width + xs;
+ for (rm=D_width, i=iWIN(y) + D_width; rm>=0; rm--)
if (*i-- != ' ')
break;
if (rm > markdata->right_mar)
@@ -1086,17 +1219,17 @@ int ry, xs, xe, doit;
{
if (t >= st && t <= en && x >= markdata->left_mar && x <= rm)
{
- if (d_attr != A_SO || d_font != ASCII)
- return(EXPENSIVE);
+ if (D_attr != A_SO || (D_font != pastefont ? *f : ASCII))
+ return EXPENSIVE;
}
else
{
- if (d_attr != *a || d_font != *f)
- return(EXPENSIVE);
+ if (D_attr != *a || D_font != *f)
+ return EXPENSIVE;
}
a++, f++, t++, x++;
}
- return(xe - xs);
+ return xe - xs;
}
@@ -1113,15 +1246,16 @@ int n;
return 0;
if (n > fore->w_histheight - markdata->hist_offset)
n = fore->w_histheight - markdata->hist_offset;
- i = (n < d_height) ? n : (d_height);
- ScrollRegion(0, d_height - 1, i);
+ i = (n < D_height) ? n : (D_height);
+ ScrollV(0, 0, D_width - 1, D_height - 1, i);
markdata->hist_offset += n;
while (i-- > 0)
- MarkRedisplayLine(d_height - i - 1, 0, d_width - 1, 1);
+ MarkRedisplayLine(D_height - i - 1, 0, D_width - 1, 1);
return n;
}
-static int MarkScrollDownDisplay(n)
+static int
+MarkScrollDownDisplay(n)
int n;
{
int i;
@@ -1131,12 +1265,20 @@ int n;
return 0;
if (n > markdata->hist_offset)
n = markdata->hist_offset;
- i = (n < d_height) ? n : (d_height);
- ScrollRegion(0, d_height - 1, -i);
+ i = (n < D_height) ? n : (D_height);
+ ScrollV(0, 0, D_width - 1, D_height - 1, -i);
markdata->hist_offset -= n;
while (i-- > 0)
- MarkRedisplayLine(i, 0, d_width - 1, 1);
+ MarkRedisplayLine(i, 0, D_width - 1, 1);
return n;
}
+int
+InMark()
+{
+ if (display && D_layfn->LayProcess == MarkProcess)
+ return 1;
+ return 0;
+}
+
#endif /* COPY_PASTE */
diff --git a/src/misc.c b/src/misc.c
index 00d4fc2..2029ab1 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -52,16 +52,33 @@ register const char *str;
return cp;
}
+#ifndef HAVE_STRERROR
+char *
+strerror(err)
+int err;
+{
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+
+ static char er[20];
+ if (err > 0 && err < sys_nerr)
+ return(sys_errlist[err]);
+ sprintf(er, "Error %d", err);
+ return er;
+}
+#endif
+
void
centerline(str)
char *str;
{
int l, n;
+ ASSERT(display);
n = strlen(str);
- if (n > d_width - 1)
- n = d_width - 1;
- l = (d_width - 1 - n) / 2;
+ if (n > D_width - 1)
+ n = D_width - 1;
+ l = (D_width - 1 - n) / 2;
if (l > 0)
AddStrn("", l);
AddStrn(str, n);
@@ -101,15 +118,34 @@ char *nam;
return nam;
}
-#ifdef hpux
+
+/*
+ * Signal handling
+ */
+
+#ifdef POSIX
+sigret_t (*xsignal(sig, func)) __P(SIGPROTOARG)
+int sig;
+sigret_t (*func) __P(SIGPROTOARG);
+{
+ struct sigaction osa, sa;
+ sa.sa_handler = func;
+ (void)sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ if (sigaction(sig, &sa, &osa))
+ return (sigret_t (*)__P(SIGPROTOARG))-1;
+ return osa.sa_handler;
+}
+
+#else
+# ifdef hpux
/*
* hpux has berkeley signal semantics if we use sigvector,
* but not, if we use signal, so we define our own signal() routine.
- * (jw)
*/
-void (*signal(sig, func)) ()
+void (*xsignal(sig, func)) __P(SIGPROTOARG)
int sig;
-void (*func) ();
+void (*func) __P(SIGPROTOARG);
{
struct sigvec osv, sv;
@@ -117,28 +153,82 @@ void (*func) ();
sv.sv_mask = sigmask(sig);
sv.sv_flags = SV_BSDSIG;
if (sigvector(sig, &sv, &osv) < 0)
- return (BADSIG);
+ return (void (*)__P(SIGPROTOARG))(BADSIG);
return (osv.sv_handler);
}
-#endif /* hpux */
+# endif /* hpux */
+#endif /* POSIX */
+
+
+/*
+ * uid/gid handling
+ */
+
+#ifdef HAVE_SETEUID
+
+void
+xseteuid(euid)
+int euid;
+{
+ if (seteuid(euid) == 0)
+ return;
+ seteuid(0);
+ if (seteuid(euid))
+ Panic(errno, "seteuid");
+}
-#ifdef NEED_OWN_BCOPY
void
-#ifdef linux
-bcopy(ss1, ss2, len)
-register const void *ss1;
-register void *ss2;
+xsetegid(egid)
+int egid;
+{
+ if (setegid(egid))
+ Panic(errno, "setegid");
+}
+
#else
-bcopy(s1, s2, len)
-register char *s1, *s2;
+# ifdef HAVE_SETREUID
+
+void
+xseteuid(euid)
+int euid;
+{
+ int oeuid;
+
+ oeuid = geteuid();
+ if (oeuid == euid)
+ return;
+ if (getuid() != euid)
+ oeuid = getuid();
+ if (setreuid(oeuid, euid))
+ Panic(errno, "setreuid");
+}
+
+void
+xsetegid(egid)
+int egid;
+{
+ int oegid;
+
+ oegid = getegid();
+ if (oegid == egid)
+ return;
+ if (getgid() != egid)
+ oegid = getgid();
+ if (setregid(oegid, egid))
+ Panic(errno, "setregid");
+}
+
+# endif
#endif
+
+
+#ifdef NEED_OWN_BCOPY
+void
+xbcopy(s1, s2, len)
+register char *s1, *s2;
register int len;
{
-#ifdef linux
- register char *s1 = (char *)ss1;
- register char *s2 = (char *)ss2;
-#endif
if (s1 < s2 && s2 < s1 + len)
{
s1 += len;
@@ -160,6 +250,7 @@ int n;
bcopy(blank, p, n);
}
+
void
Kill(pid, sig)
int pid, sig;
@@ -193,18 +284,23 @@ int except;
}
-#ifdef NOREUID
+
+/*
+ * Security - switch to real uid
+ */
+
+#ifndef USE_SETEUID
static int UserPID;
-static sig_t (*Usersigcld)__P(SIGPROTOARG);
+static sigret_t (*Usersigcld)__P(SIGPROTOARG);
#endif
static int UserSTAT;
int
UserContext()
{
-#ifdef NOREUID
- if (eff_uid == real_uid)
- return(1);
+#ifndef USE_SETEUID
+ if (eff_uid == real_uid && eff_gid == real_gid)
+ return 1;
Usersigcld = signal(SIGCHLD, SIG_DFL);
debug("UserContext: forking.\n");
switch (UserPID = fork())
@@ -228,8 +324,8 @@ UserContext()
return 0;
}
#else
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
+ xseteuid(real_uid);
+ xsetegid(real_gid);
return 1;
#endif
}
@@ -238,14 +334,14 @@ void
UserReturn(val)
int val;
{
-#if defined(NOREUID)
- if (eff_uid == real_uid)
+#ifndef USE_SETEUID
+ if (eff_uid == real_uid && eff_gid == real_gid)
UserSTAT = val;
else
- exit(val);
+ _exit(val);
#else
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
UserSTAT = val;
#endif
}
@@ -253,7 +349,7 @@ int val;
int
UserStatus()
{
-#ifdef NOREUID
+#ifndef USE_SETEUID
int i;
# ifdef BSDWAIT
union wait wstat;
@@ -261,7 +357,7 @@ UserStatus()
int wstat;
# endif
- if (eff_uid == real_uid)
+ if (eff_uid == real_uid && eff_gid == real_gid)
return UserSTAT;
if (UserPID < 0)
return -1;
@@ -276,3 +372,59 @@ UserStatus()
return UserSTAT;
#endif
}
+
+#ifdef NEED_RENAME
+int
+rename (old, new)
+char *old;
+char *new;
+{
+ if (link(old, new) < 0)
+ return -1;
+ return unlink(old);
+}
+#endif
+
+
+int
+AddXChar(buf, ch)
+char *buf;
+int ch;
+{
+ char *p = buf;
+
+ if (ch < ' ' || ch == 0x7f)
+ {
+ *p++ = '^';
+ *p++ = ch ^ 0x40;
+ }
+ else if (ch >= 0x80)
+ {
+ *p++ = '\\';
+ *p++ = (ch >> 6 & 7) + '0';
+ *p++ = (ch >> 3 & 7) + '0';
+ *p++ = (ch >> 0 & 7) + '0';
+ }
+ else
+ *p++ = ch;
+ return p - buf;
+}
+
+int
+AddXChars(buf, len, str)
+char *buf, *str;
+int len;
+{
+ char *p;
+
+ len -= 4; /* longest sequence produced by AddXChar() */
+ for (p = buf; p < buf + len && *str; str++)
+ {
+ if (*str == ' ')
+ *p++ = *str;
+ else
+ p += AddXChar(p, *str);
+ }
+ *p = 0;
+ return p - buf;
+}
diff --git a/src/os.h b/src/os.h
index 5bafc2f..56f8f97 100644
--- a/src/os.h
+++ b/src/os.h
@@ -25,6 +25,7 @@
#include <errno.h>
#include <sys/param.h>
+
#if defined(BSDI) || defined(__386BSD__) || defined(_CX_UX)
# include <signal.h>
#endif /* BSDI || __386BSD__ || _CX_UX */
@@ -36,60 +37,32 @@
# ifdef ENOTEMPTY
# undef ENOTEMPTY
# endif
+# include <sys/bsdtypes.h>
# include <net/errno.h>
#endif
-#ifdef hpux
-# ifndef GETUTENT
-# define GETUTENT 1
-# endif
-#endif
-
-#ifndef linux /* all done in <errno.h> */
-extern int errno;
-extern int sys_nerr;
-extern char *sys_errlist[];
-#endif /* linux */
-
#ifdef sun
# define getpgrp __getpgrp
# define exit __exit
#endif
-
#ifdef POSIX
# include <unistd.h>
# if defined(__STDC__)
# include <stdlib.h>
# endif /* __STDC__ */
#endif /* POSIX */
-
#ifdef sun
# undef getpgrp
# undef exit
#endif /* sun */
-#ifdef POSIX
-# include <termios.h>
-# ifdef hpux
-# include <bsdtty.h>
-# endif /* hpux */
-# ifdef NCCS
-# define MAXCC NCCS
-# else
-# define MAXCC 256
-# endif
-#else /* POSIX */
-# ifdef TERMIO
-# include <termio.h>
-# ifdef NCC
-# define MAXCC NCC
-# else
-# define MAXCC 256
-# endif
-# else /* TERMIO */
-# include <sgtty.h>
-# endif /* TERMIO */
-#endif /* POSIX */
+#ifndef linux /* all done in <errno.h> */
+extern int errno;
+#endif /* linux */
+#ifndef HAVE_STRERROR
+/* No macros, please */
+#undef strerror
+#endif
#ifndef SYSV
# ifdef NEWSOS
@@ -99,7 +72,7 @@ extern char *sys_errlist[];
# else /* NEWSOS */
# include <strings.h>
# endif /* NEWSOS */
-#else /* BSD */
+#else /* SYSV */
# if defined(SVR4) || defined(NEWSOS)
# define strlen ___strlen___
# include <string.h>
@@ -110,7 +83,7 @@ extern char *sys_errlist[];
# else /* SVR4 */
# include <string.h>
# endif /* SVR4 */
-#endif /* BSD */
+#endif /* SYSV */
#ifdef USEVARARGS
# if defined(__STDC__)
@@ -130,8 +103,110 @@ extern char *sys_errlist[];
# include <sys/ptem.h>
#endif
-#ifdef UTMPOK
-# ifdef SVR4
+#ifdef SYSV
+# define index strchr
+# define rindex strrchr
+# define bzero(poi,len) memset(poi,0,len)
+# define bcmp memcmp
+# define killpg(pgrp,sig) kill( -(pgrp), sig)
+#else
+# define getcwd(b,l) getwd(b)
+#endif
+
+#ifndef USEBCOPY
+# ifdef USEMEMMOVE
+# define bcopy(s,d,len) memmove(d,s,len)
+# else
+# ifdef USEMEMCPY
+# define bcopy(s,d,len) memcpy(d,s,len)
+# else
+# define NEED_OWN_BCOPY
+# define bcopy xbcopy
+# endif
+# endif
+#endif
+
+#ifdef hpux
+# define setreuid(ruid, euid) setresuid(ruid, euid, -1)
+# define setregid(rgid, egid) setresgid(rgid, egid, -1)
+#endif
+
+#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID)
+# define USE_SETEUID
+#endif
+
+#if !defined(HAVE__EXIT) && !defined(_exit)
+#define _exit(x) exit(x)
+#endif
+
+/*****************************************************************
+ * terminal handling
+ */
+
+#ifdef POSIX
+# include <termios.h>
+# ifdef hpux
+# include <bsdtty.h>
+# endif /* hpux */
+# ifdef NCCS
+# define MAXCC NCCS
+# else
+# define MAXCC 256
+# endif
+#else /* POSIX */
+# ifdef TERMIO
+# include <termio.h>
+# ifdef NCC
+# define MAXCC NCC
+# else
+# define MAXCC 256
+# endif
+# ifdef CYTERMIO
+# include <cytermio.h>
+# endif
+# else /* TERMIO */
+# include <sgtty.h>
+# endif /* TERMIO */
+#endif /* POSIX */
+
+#ifndef VDISABLE
+# ifdef _POSIX_VDISABLE
+# define VDISABLE _POSIX_VDISABLE
+# else
+# define VDISABLE 0377
+# endif /* _POSIX_VDISABLE */
+#endif /* !VDISABLE */
+
+
+/* on sgi, regardless of the stream head's read mode (RNORM/RMSGN/RMSGD)
+ * TIOCPKT mode causes data loss if our buffer is too small (IOSIZE)
+ * to hold the whole packet at first read().
+ * (Marc Boucher)
+ */
+#ifdef sgi
+# undef TIOCPKT
+#endif
+
+/* matthew green:
+ * TIOCPKT is broken on dgux 5.4.1 generic AViiON mc88100
+ */
+#ifdef DGUX
+# undef TIOCPKT
+#endif
+
+
+/*****************************************************************
+ * utmp handling
+ */
+
+#ifdef GETUTENT
+ typedef char *slot_t;
+#else
+ typedef int slot_t;
+#endif
+
+#if defined(UTMPOK) || defined(BUGGYGETLOGIN)
+# if defined(SVR4) && !defined(DGUX)
# include <utmpx.h>
# define UTMPFILE UTMPX_FILE
# define utmp utmpx
@@ -145,7 +220,7 @@ extern char *sys_errlist[];
# else /* SVR4 */
# include <utmp.h>
# endif /* SVR4 */
-# if defined(apollo) || defined(linux)
+# ifdef apollo
/*
* We don't have GETUTENT, so we dig into utmp ourselves.
* But we save the permanent filedescriptor and
@@ -153,25 +228,28 @@ extern char *sys_errlist[];
* This code supports an unsorted utmp. jw.
*/
# define UTNOKEEP
-# endif /* apollo || linux */
-#endif
+# endif /* apollo */
+# ifdef linux
+ /* pututline is useless so we do it ourself... */
+# define UT_UNSORTED
+# endif
-#ifndef UTMPFILE
-# ifdef UTMP_FILE
-# define UTMPFILE UTMP_FILE
-# else
-# ifdef _PATH_UTMP
-# define UTMPFILE _PATH_UTMP
+# ifndef UTMPFILE
+# ifdef UTMP_FILE
+# define UTMPFILE UTMP_FILE
# else
-# define UTMPFILE "/etc/utmp"
-# endif /* _PATH_UTMP */
+# ifdef _PATH_UTMP
+# define UTMPFILE _PATH_UTMP
+# else
+# define UTMPFILE "/etc/utmp"
+# endif /* _PATH_UTMP */
+# endif
# endif
-#endif
-#ifndef UTMPOK
-# ifdef USRLIMIT
-# undef USRLIMIT
-# endif
+#endif /* UTMPOK || BUGGYGETLOGIN */
+
+#if !defined(UTMPOK) && defined(USRLIMIT)
+# undef USRLIMIT
#endif
#ifdef LOGOUTOK
@@ -179,10 +257,17 @@ extern char *sys_errlist[];
# define LOGINDEFAULT 0
# endif
#else
-# undef LOGINDEFAULT
+# ifdef LOGINDEFAULT
+# undef LOGINDEFAULT
+# endif
# define LOGINDEFAULT 1
#endif
+
+/*****************************************************************
+ * file stuff
+ */
+
#ifndef F_OK
#define F_OK 0
#endif
@@ -210,43 +295,65 @@ extern char *sys_errlist[];
#endif
#if defined(S_IFIFO) && defined(S_IFMT) && !defined(S_ISFIFO)
-#define S_ISFIFO(mode) ((mode & S_IFMT) == S_IFIFO)
+#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#endif
#if defined(S_IFSOCK) && defined(S_IFMT) && !defined(S_ISSOCK)
-#define S_ISSOCK(mode) ((mode & S_IFMT) == S_IFSOCK)
+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+#endif
+#if defined(S_IFCHR) && defined(S_IFMT) && !defined(S_ISCHR)
+#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
+#endif
+#if defined(S_IFDIR) && defined(S_IFMT) && !defined(S_ISDIR)
+#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif
-#ifndef TERMCAP_BUFSIZE
-# define TERMCAP_BUFSIZE 1024
+#if !defined(O_NONBLOCK) && defined(O_NDELAY)
+# define O_NONBLOCK O_NDELAY
#endif
-#ifndef MAXPATHLEN
-# define MAXPATHLEN 1024
+#if !defined(FNBLOCK) && defined(FNONBLOCK)
+# define FNBLOCK FNONBLOCK
+#endif
+#if !defined(FNBLOCK) && defined(FNDELAY)
+# define FNBLOCK FNDELAY
+#endif
+#if !defined(FNBLOCK) && defined(O_NONBLOCK)
+# define FNBLOCK O_NONBLOCK
#endif
-#ifndef SIG_T_DEFINED
-# ifdef SIGVOID
-# if defined(ultrix)
-# define sig_t void
-# else /* nice compilers: */
- typedef void sig_t;
-# endif
-# else
- typedef int sig_t; /* (* sig_t) */
-# endif
+#ifndef POSIX
+#undef mkfifo
+#define mkfifo(n,m) mknod(n,S_IFIFO|(m),0)
+#endif
+
+#if !defined(HAVE_LSTAT) && !defined(lstat)
+# define lstat stat
+#endif
+
+/*****************************************************************
+ * signal handling
+ */
+
+#ifdef SIGVOID
+# define SIGRETURN
+# define sigret_t void
#else
-# if defined (__alpha)
-# define sig_t void /* From: Dietrich Wiegandt <dietrich@afsw01.cern.ch> */
-# endif
-#endif /* SIG_T_DEFINED */
+# define SIGRETURN return 0;
+# define sigret_t int
+#endif
-#if defined(SVR4) || (defined(SYSV) && defined(ISC)) || defined(_AIX) || defined(linux) || defined(ultrix) || defined(__386BSD__) || defined(BSDI)
+/* Geeeee, reverse it? */
+#if defined(SVR4) || (defined(SYSV) && defined(ISC)) || defined(_AIX) || defined(linux) || defined(ultrix) || defined(__386BSD__) || defined(BSDI) || defined(POSIX) || defined(NeXT)
+# define SIGHASARG
+#endif
+
+#ifdef SIGHASARG
# define SIGPROTOARG (int)
-# define SIGDEFARG int sigsig
+# define SIGDEFARG (sigsig) int sigsig;
# define SIGARG 0
#else
# define SIGPROTOARG (void)
-# define SIGDEFARG
+# define SIGDEFARG ()
# define SIGARG
#endif
@@ -254,55 +361,23 @@ extern char *sys_errlist[];
#define SIGCHLD SIGCLD
#endif
-#ifdef USESIGSET
-# define signal sigset
-#endif /* USESIGSET */
-
-#ifndef PID_T_DEFINED
-typedef int pid_t;
-#endif
-
-#ifndef UID_T_DEFINED
-typedef int gid_t;
-typedef int uid_t;
-#endif
-
-#ifdef GETUTENT
- typedef char *slot_t;
+#if defined(POSIX) || defined(hpux)
+# define signal xsignal
#else
- typedef int slot_t;
+# ifdef USESIGSET
+# define signal sigset
+# endif /* USESIGSET */
#endif
-#ifdef SYSV
-# define index strchr
-# define rindex strrchr
-# define bzero(poi,len) memset(poi,0,len)
-# define bcmp memcmp
-# define killpg(pgrp,sig) kill( -(pgrp), sig)
-#endif /* SYSV */
-
-#ifndef USEBCOPY
-# ifdef USEMEMCPY
-# define bcopy(s,d,len) memcpy(d,s,len)
-# else
-# ifdef USEMEMMOVE
-# define bcopy(s,d,len) memmove(d,s,len)
-# else
-# define NEED_OWN_BCOPY
-# endif
-# endif
-#endif
+/* used in screen.c and attacher.c */
+#ifndef NSIG /* kbeal needs these w/o SYSV */
+# define NSIG 32
+#endif /* !NSIG */
-#if defined(_POSIX_SOURCE) && defined(ISC)
-# ifndef O_NDELAY
-# define O_NDELAY O_NONBLOCK
-# endif
-#endif
-#ifdef hpux
-# define setreuid(ruid, euid) setresuid(ruid, euid, -1)
-# define setregid(rgid, egid) setresgid(rgid, egid, -1)
-#endif
+/*****************************************************************
+ * Wait stuff
+ */
#if (!defined(sysV68) && !defined(M_XENIX)) || defined(NeXT)
# include <sys/wait.h>
@@ -345,21 +420,22 @@ typedef int uid_t;
# endif
#endif
+
+/*****************************************************************
+ * select stuff
+ */
+
#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_)
-#include <sys/select.h> /* for timeval + FD... */
+#include <sys/select.h> /* for timeval + FD... */
#endif
-
/*
* SunOS 3.5 - Tom Schmidt - Micron Semiconductor, Inc - 27-Jul-93
* tschmidt@vax.micron.com
*/
#ifndef FD_SET
# ifndef SUNOS3
-typedef struct fd_set
-{
- int fds_bits[1];
-} fd_set;
+typedef struct fd_set { int fds_bits[1]; } fd_set;
# endif
# define FD_ZERO(fd) ((fd)->fds_bits[0] = 0)
# define FD_SET(b, fd) ((fd)->fds_bits[0] |= 1 << (b))
@@ -368,40 +444,22 @@ typedef struct fd_set
#endif
-#if defined(sgi)
-/* on IRIX, regardless of the stream head's read mode (RNORM/RMSGN/RMSGD)
- * TIOCPKT mode causes data loss if our buffer is too small (IOSIZE)
- * to hold the whole packet at first read().
- * (Marc Boucher)
+/*****************************************************************
+ * user defineable stuff
*/
-# undef TIOCPKT
-#endif
-#if !defined(VDISABLE)
-# ifdef _POSIX_VDISABLE
-# define VDISABLE _POSIX_VDISABLE
-# else
-# define VDISABLE 0377
-# endif /* _POSIX_VDISABLE */
-#endif /* !VDISABLE */
-
-#if !defined(FNDELAY) && defined(O_NDELAY)
-# define FNDELAY O_NDELAY
+#ifndef TERMCAP_BUFSIZE
+# define TERMCAP_BUFSIZE 2048
#endif
-/*typedef long off_t; */ /* Someone might need this */
-
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 1024
+#endif
/*
- * 4 <= IOSIZE <=1000
* you may try to vary this value. Use low values if your (VMS) system
* tends to choke when pasting. Use high values if you want to test
* how many characters your pty's can buffer.
*/
#define IOSIZE 4096
-/* used in screen.c and attacher.c */
-#if !defined(NSIG) /* kbeal needs these w/o SYSV */
-# define NSIG 32
-#endif /* !NSIG */
-
diff --git a/src/osdef.h.in b/src/osdef.h.in
index 4c1569e..02af070 100644
--- a/src/osdef.h.in
+++ b/src/osdef.h.in
@@ -27,6 +27,12 @@
****************************************************************
*/
+extern int printf __P((char *, ...));
+extern int fprintf __P((FILE *, char *, ...));
+extern int sprintf __P((char *, char *, ...));
+#if defined(sun) || defined(_SEQUENT_)
+extern int _flsbuf __P((int, FILE *));
+#endif
#ifdef SYSV
extern char *strchr __P((char *, int));
extern char *strrchr __P((char *, int));
@@ -64,7 +70,7 @@ extern int waitpid __P((int, int *, int));
extern int getdtablesize __P((void));
-#ifndef NOREUID
+#ifdef HAVE_SETREUID
# ifdef hpux
extern int setresuid __P((int, int, int));
extern int setresgid __P((int, int, int));
@@ -73,6 +79,10 @@ extern int setreuid __P((int, int));
extern int setregid __P((int, int));
# endif
#endif
+#ifdef HAVE_SETEUID
+extern int seteuid __P((int));
+extern int setegid __P((int));
+#endif
extern char *crypt __P((char *, char *));
extern int putenv __P((char *));
@@ -98,6 +108,7 @@ extern int getuid __P((void));
extern int geteuid __P((void));
extern int getgid __P((void));
extern int getegid __P((void));
+struct passwd;
extern struct passwd *getpwuid __P((int));
extern struct passwd *getpwnam __P((char *));
extern int isatty __P((int));
diff --git a/src/osdef.sh b/src/osdef.sh
index 856c568..a857649 100644
--- a/src/osdef.sh
+++ b/src/osdef.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
if test -z "$CC"; then
CC=cc
@@ -7,7 +7,8 @@ if test -z "$srcdir"; then
srcdir=.
fi
-sed < $srcdir/osdef.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([^ ]*\) __P.*@/[)*, ]\1[ (]/s/.*/\\/\1 __P\\/d/p@p' > osdef1.sed
+sed < $srcdir/osdef.h.in -n -e '/^extern/s@.*[)* ][)* ]*\([^ *]*\) __P.*@/[)*, ]\1[ (]/i\\\
+\\/\\[^a-zA-Z_\\]\1 __P\\/d@p' > osdef1.sed
cat << EOF > osdef0.c
#include "config.h"
#include <sys/types.h>
diff --git a/src/overlay.h b/src/overlay.h
index 5bc39de..e6eb865 100644
--- a/src/overlay.h
+++ b/src/overlay.h
@@ -46,22 +46,22 @@ struct layer
char *l_data; /* should be void * */
};
-#define Process (*d_layfn->LayProcess)
-#define Abort (*d_layfn->LayAbort)
-#define RedisplayLine (*d_layfn->LayRedisplayLine)
-#define ClearLine (*d_layfn->LayClearLine)
-#define Rewrite (*d_layfn->LayRewrite)
-#define SetCursor (*d_layfn->LaySetCursor)
-#define Resize (*d_layfn->LayResize)
-#define Restore (*d_layfn->LayRestore)
+#define Process (*D_layfn->LayProcess)
+#define Abort (*D_layfn->LayAbort)
+#define RedisplayLine (*D_layfn->LayRedisplayLine)
+#define ClearLine (*D_layfn->LayClearLine)
+#define Rewrite (*D_layfn->LayRewrite)
+#define SetCursor (*D_layfn->LaySetCursor)
+#define Resize (*D_layfn->LayResize)
+#define Restore (*D_layfn->LayRestore)
#define LAY_CALL_UP(fn) \
{ \
- struct layer *oldlay = d_lay; \
- d_lay = d_lay->l_next; \
- d_layfn = d_lay->l_layfn; \
+ struct layer *oldlay = D_lay; \
+ D_lay = D_lay->l_next; \
+ D_layfn = D_lay->l_layfn; \
fn; \
- d_lay = oldlay; \
- d_layfn = d_lay->l_layfn; \
+ D_lay = oldlay; \
+ D_layfn = D_lay->l_layfn; \
}
diff --git a/src/patchlevel.h b/src/patchlevel.h
index 9ff2417..80537ff 100644
--- a/src/patchlevel.h
+++ b/src/patchlevel.h
@@ -132,11 +132,67 @@
* sysmacros.h now included in pty.c on sgis
* Strange hpux hack added for TTYCMP.
* Zombie feature improved.
+ * 08.09.93 -- 3.05.03 Makefile and OSF1 fine tuning. Eased attach to
+ * multi sessions. Writelock now obeys acl write
+ * permissions. UserDel() now preserves defaults.
+ * acladd/aclchg syntax improved. Updated
+ * documentation. Bug in at command fixed.
+ * MakeWindow() now obeys perm defaults.
+ * 30.11.93 -- 3.05.04 Kanji support added. New keymap feature:
+ * bindkey and various map commands. GR and C1
+ * flags now define the character processing.
+ * 14.01.94 -- 3.05.05 New FindSocket() code. Nicer socket handling.
+ * 20.01.94 -- 3.05.06 New attribute handling code. NeXT fixes.
+ * 04.02.94 -- 3.05.07 Ugly bug in ScrollH fixed. Keymap defaults.
+ * 13.04.94 -- 3.05.08 Kanji bug fixed. POSIX sigaction support.
+ * os.h cleanup. UTNOKEEP splitted into
+ * UT_CLOSE and UT_UNSORTED. linux no longer
+ * implies UT_CLOSE. "struct display" name
+ * convention change: _d_ to d_ and d_ to D_.
+ * 20.04.94 -- 3.05.09 configure.in ptyrange bug fixed. Upgraded
+ * to autoconf-1.8
+ * 27.04.94 -- 3.05.10 97801 obscure code support. Linux long
+ * password workaround.
+ * 09.05.94 -- 3.05.11 seteuid() support added. Security fixes.
+ * _IBMR2 kludge makes call to sleep obsolete.
+ * Small fixes in uname() code.
+ * 27.07.94 -- 3.05.12 seteuid attacher bug fixed. ks/ke changed
+ * in termcap/info and termcap.c
+ * 27.09.94 -- 3.05.13 defwlock stupidity fixed. MakeTermcap ks/ke
+ * ':' removed. Termcap entry improved.
+ * 05.12.94 -- 3.05.17 SVR4 pty bug fixed, don't update window status
+ * line if not changed, onyx support. Manual
+ * pages updated.
+ * 14.12.94 -- 3.05.18 w_status changed to w_hstatus, it's a #define in
+ * Domain/OS reported by ejackson@iastate.edu.
+ * Screen manpage patches by larry.
+ * Ugly seteuid bug in ForkWindow() fixed.
+ * 20.12.94 -- 3.06.00 Solaris has broken seteuid().
+ * osf loadav patches. -- DISTRIBUTED
+ * 16.01.95 -- 3.06.01 KANJI patch. doc/Makefile.in fixed.
+ * Install now calls doc/Makefile install.
+ * Don't use 'ds' too often, breaks MSkermit.
+ * undef'd LOGOUTOK logs in now.
+ * Ultrix is broken, too (seteuid).
+ * Use \r (not \n) to join lines in pastebuf.
+ * bindkey can now remove sequences.
+ * InitTTY fixed for PLAIN. -- DISTRIBUTED
+ * 04.04.95 -- 3.06.02 Simple ESC-CR fix in the vt100 state machine.
+ * Now compiles again with all extras disabled.
+ * Zombie resurrect added. defc1, defgr, defkanji
+ * added. Screen now replies to a secondary DA
+ * query. Some missing NEED_XXX added in comm.c.
+ * Better default tty permissions/group test.
+ * More AUX support, now compiles with POSIX.
+ * Function keycodes xtermified (F11, F12).
+ * Paste bug fixed (only worked with KANJI).
+ * Check bcopy before memcpy/memmove.
+ * FindSocket code much fixed & improved.
*/
#define ORIGIN "FAU"
#define REV 3
-#define VERS 5
+#define VERS 6
#define PATCHLEVEL 2
-#define DATE "19-Aug-93"
+#define DATE "4-Apr-95"
#define STATE ""
diff --git a/src/process.c b/src/process.c
index 612376e..d4cebc0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -27,41 +27,47 @@ RCS_ID("$Id$ FAU")
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
+#if !defined(sun) && !defined(B43) && !defined(ISC) && !defined(pyr) && !defined(_CX_UX)
+# include <time.h>
+#endif
+#include <sys/time.h>
#ifndef sun
#include <sys/ioctl.h>
#endif
#include "config.h"
-#include "screen.h"
-#include "extern.h"
-#if defined(sun) && defined(SVR4)
+#ifdef SVR4
# include <sys/stropts.h>
#endif
+#include "screen.h"
+#include "extern.h"
+
extern struct comm comms[];
extern char *rc_name;
-extern char *RcFileName, *home, *extra_incap, *extra_outcap;
+extern char *RcFileName, *home;
extern char *BellString, *ActivityString, *ShellProg, *ShellArgs[];
extern char *hardcopydir, *screenlogdir;
extern char *VisualBellString;
extern int VBellWait, MsgWait, MsgMinWait, SilenceWait;
-extern char SockPath[], *SockNamePtr;
+extern char SockPath[], *SockName;
extern int TtyMode, auto_detach;
extern int iflag;
-extern int default_wrap;
-extern int use_hardstatus, visual_bell, default_monitor;
+extern int use_hardstatus, visual_bell;
+extern char *printcmd;
extern int default_startup;
extern int slowpaste, defobuflimit;
-extern int ZombieKey;
+extern int ZombieKey_destroy;
+extern int ZombieKey_resurrect;
#ifdef AUTO_NUKE
extern int defautonuke;
#endif
extern int intrc, origintrc; /* display? */
extern struct NewWindow nwin_default, nwin_undef;
#ifdef COPY_PASTE
-extern int join_with_cr;
+extern int join_with_cr, pastefont;
extern char mark_key_tab[];
extern char *BufferFile;
#endif
@@ -69,9 +75,17 @@ extern char *BufferFile;
extern char *BufferFile, *PowDetachString;
#endif
extern time_t Now;
+#ifdef MAPKEYS
+extern struct term term[]; /* terminal capabilities */
+extern int maptimeout;
+extern char *kmapdef[];
+extern char *kmapadef[];
+extern char *kmapmdef[];
+#endif
+
static int CheckArgNum __P((int, char **));
-static void FreeKey __P((int));
+static void ClearAction __P((struct action *));
static int NextWindow __P((void));
static int PreviousWindow __P((void));
static int MoreWindows __P((void));
@@ -91,7 +105,6 @@ static int ParseWinNum __P((struct action *act, int *));
static int ParseOct __P((struct action *act, int *));
static char *ParseChar __P((char *, char *));
static int IsNum __P((char *, int));
-static int IsNumColon __P((char *, int, char *, int));
static void InputColon __P((void));
static void Colonfin __P((char *, int));
static void InputSelect __P((void));
@@ -130,28 +143,37 @@ extern int nethackflag;
#endif
-struct win *wtab[MAXWIN]; /* window table */
-struct action ktab[256]; /* command key translation table */
-
+struct win *wtab[MAXWIN]; /* window table, should be dynamic */
#ifdef MULTIUSER
extern char *multi;
#endif
#ifdef PASSWORD
int CheckPassword;
-char Password[20];
+char Password[30];
#endif
struct plop plop_tab[MAX_PLOP_DEFS];
-#ifdef PTYMODE
-int TtyMode = PTYMODE;
-#else
-int TtyMode = 0622;
+#ifndef PTYMODE
+# define PTYMODE 0622
#endif
+
+int TtyMode = PTYMODE;
int hardcopy_append = 0;
int all_norefresh = 0;
+struct action ktab[256]; /* command key translation table */
+
+#ifdef MAPKEYS
+struct action umtab[KMAP_KEYS+KMAP_AKEYS+KMAP_EXT];
+struct action dmtab[KMAP_KEYS+KMAP_AKEYS+KMAP_EXT];
+struct action mmtab[KMAP_KEYS+KMAP_AKEYS+KMAP_EXT];
+
+char *kmap_extras[KMAP_EXT];
+int kmap_extras_fl[KMAP_EXT];
+
+#endif
char *noargs[1];
@@ -159,12 +181,64 @@ void
InitKeytab()
{
register unsigned int i;
+#ifdef MAPKEYS
+ char *argarr[2];
+#endif
for (i = 0; i < sizeof(ktab)/sizeof(*ktab); i++)
{
ktab[i].nr = RC_ILLEGAL;
ktab[i].args = noargs;
}
+#ifdef MAPKEYS
+ for (i = 0; i < KMAP_KEYS+KMAP_AKEYS+KMAP_EXT; i++)
+ {
+ umtab[i].nr = RC_ILLEGAL;
+ umtab[i].args = noargs;
+ dmtab[i].nr = RC_ILLEGAL;
+ dmtab[i].args = noargs;
+ mmtab[i].nr = RC_ILLEGAL;
+ mmtab[i].args = noargs;
+ }
+ argarr[1] = 0;
+ for (i = 0; i < NKMAPDEF; i++)
+ {
+ if (i + KMAPDEFSTART < T_CAPS)
+ continue;
+ if (i + KMAPDEFSTART >= T_CAPS + KMAP_KEYS)
+ continue;
+ if (kmapdef[i] == 0)
+ continue;
+ argarr[0] = kmapdef[i];
+ dmtab[i + (KMAPDEFSTART - T_CAPS)].nr = RC_STUFF;
+ dmtab[i + (KMAPDEFSTART - T_CAPS)].args = SaveArgs(argarr);
+ }
+ for (i = 0; i < NKMAPADEF; i++)
+ {
+ if (i + KMAPADEFSTART < T_CURSOR)
+ continue;
+ if (i + KMAPADEFSTART >= T_CURSOR + KMAP_AKEYS)
+ continue;
+ if (kmapadef[i] == 0)
+ continue;
+ argarr[0] = kmapadef[i];
+ dmtab[i + (KMAPADEFSTART - T_CURSOR + KMAP_KEYS)].nr = RC_STUFF;
+ dmtab[i + (KMAPADEFSTART - T_CURSOR + KMAP_KEYS)].args = SaveArgs(argarr);
+ }
+ for (i = 0; i < NKMAPMDEF; i++)
+ {
+ if (i + KMAPMDEFSTART < T_CAPS)
+ continue;
+ if (i + KMAPMDEFSTART >= T_CAPS + KMAP_KEYS)
+ continue;
+ if (kmapmdef[i] == 0)
+ continue;
+ argarr[0] = kmapmdef[i];
+ argarr[1] = 0;
+ mmtab[i + (KMAPMDEFSTART - T_CAPS)].nr = RC_STUFF;
+ mmtab[i + (KMAPMDEFSTART - T_CAPS)].args = SaveArgs(argarr);
+ }
+#endif
ktab['h'].nr = RC_HARDCOPY;
#ifdef BSDJOBS
@@ -198,8 +272,6 @@ InitKeytab()
ktab['C'].nr = RC_CLEAR;
ktab['Z'].nr = RC_RESET;
ktab['H'].nr = RC_LOG;
- ktab[(int)(unsigned char)DefaultEsc].nr = RC_OTHER;
- ktab[(int)(unsigned char)DefaultMetaEsc].nr = RC_META;
ktab['M'].nr = RC_MONITOR;
ktab['?'].nr = RC_HELP;
for (i = 0; i < ((MAXWIN < 10) ? MAXWIN : 10); i++)
@@ -215,6 +287,13 @@ InitKeytab()
ktab[':'].nr = RC_COLON;
#ifdef COPY_PASTE
ktab['['].nr = ktab[Ctrl('[')].nr = RC_COPY;
+ {
+ char *args[2];
+ args[0] = ".";
+ args[1] = NULL;
+ ktab[']'].args = SaveArgs(args);
+ ktab[Ctrl(']')].args = SaveArgs(args);
+ }
ktab[']'].nr = ktab[Ctrl(']')].nr = RC_PASTE;
ktab['{'].nr = RC_HISTORY;
ktab['}'].nr = RC_HISTORY;
@@ -232,15 +311,16 @@ InitKeytab()
ktab['b'].nr = ktab[Ctrl('b')].nr = RC_BREAK;
ktab['B'].nr = RC_POW_BREAK;
ktab['_'].nr = RC_SILENCE;
+ ktab[(int)(unsigned char)DefaultEsc].nr = RC_OTHER;
+ ktab[(int)(unsigned char)DefaultMetaEsc].nr = RC_META;
}
static void
-FreeKey(key)
-int key;
+ClearAction(act)
+struct action *act;
{
char **p;
- struct action *act = &ktab[key];
if (act->nr == RC_ILLEGAL)
return;
act->nr = RC_ILLEGAL;
@@ -248,10 +328,11 @@ int key;
return;
for (p = act->args; *p; p++)
free(*p);
- free(act->args);
+ free((char *)act->args);
act->args = noargs;
}
+#if 0
void
ProcessInput(ibuf, ilen)
char *ibuf;
@@ -262,12 +343,12 @@ int ilen;
while (display)
{
- fore = d_fore;
+ fore = D_fore;
slen = ilen;
s = ibuf;
while (ilen > 0)
{
- if (*s++ == d_user->u_Esc)
+ if (*s++ == D_user->u_Esc)
break;
ilen--;
}
@@ -275,7 +356,7 @@ int ilen;
while (slen)
Process(&ibuf, &slen);
if (--ilen == 0)
- d_ESCseen = 1;
+ D_ESCseen = 1;
if (ilen <= 0)
return;
DoAction(&ktab[(int)(unsigned char)*s], (int)(unsigned char)*s);
@@ -283,7 +364,147 @@ int ilen;
ilen--;
}
}
+#endif
+
+
+void
+ProcessInput(ibuf, ilen)
+char *ibuf;
+int ilen;
+{
+ int ch, slen;
+ char *s;
+#ifdef MAPKEYS
+ struct action *act;
+ int i, l;
+#endif
+
+ if (display == 0 || ilen == 0)
+ return;
+ slen = ilen;
+ s = ibuf;
+ while (D_ESCseen)
+ {
+ D_ESCseen = 0;
+ fore = D_fore;
+ DoAction(&ktab[(int)(unsigned char)*s], (int)(unsigned char)*s);
+ ibuf = ++s;
+ slen = --ilen;
+ if (display == 0 || ilen == 0)
+ return;
+ }
+ while(ilen-- > 0)
+ {
+ ch = *(unsigned char *)s++;
+#ifdef MAPKEYS
+ if (D_dontmap)
+ D_dontmap = 0;
+ else if (D_nseqs)
+ for (;;)
+ {
+ if (*(unsigned char *)D_seqp != ch)
+ {
+ l = *((unsigned char *)D_seqp + (KMAP_OFF - KMAP_SEQ));
+ if (l)
+ {
+ D_seqp += sizeof(struct kmap) * l;
+ continue;
+ }
+ if (D_seql)
+ {
+ D_seqp -= D_seql;
+ while (D_seql)
+ Process(&D_seqp, &D_seql);
+ }
+ D_seqp = D_kmaps[0].seq;
+ D_mapdefault = 0;
+ break;
+ }
+ if (D_seql++ == 0)
+ {
+ slen -= ilen + 1;
+ while (slen)
+ Process(&ibuf, &slen);
+ D_seqruns = 0;
+ }
+ ibuf = s;
+ slen = ilen;
+ ch = -1;
+ if (*++D_seqp == 0)
+ {
+ i = (struct kmap *)(D_seqp - D_seql - KMAP_SEQ) - D_kmaps;
+ debug1("Mapping #%d", i);
+ i = D_kmaps[i].nr & ~KMAP_NOTIMEOUT;
+#ifdef DEBUG
+ if (i < KMAP_KEYS)
+ debug1(" - %s", term[i + T_CAPS].tcname);
+#endif
+ if (i >= T_CURSOR - T_CAPS && i < T_KEYPAD - T_CAPS && D_cursorkeys)
+ i += T_OCAPS - T_CURSOR;
+ else if (i >= T_KEYPAD - T_CAPS && i < T_OCAPS - T_CAPS && D_keypad)
+ i += T_OCAPS - T_CURSOR;
+ debug1(" - action %d\n", i);
+ fore = D_fore;
+ act = 0;
+#ifdef COPY_PASTE
+ if (InMark())
+ act = &mmtab[i];
+#endif
+ if ((!act || act->nr == RC_ILLEGAL) && !D_mapdefault)
+ act = &umtab[i];
+ D_mapdefault = 0;
+ if (!act || act->nr == RC_ILLEGAL)
+ act = &dmtab[i];
+ if (act && act->nr != RC_ILLEGAL)
+ DoAction(act, 0);
+ else
+ {
+ D_seqp -= D_seql;
+ while (D_seql)
+ Process(&D_seqp, &D_seql);
+ }
+ if (display == 0)
+ return;
+ D_seql = 0;
+ D_seqp = D_kmaps[0].seq;
+ if (D_ESCseen)
+ {
+ slen++;
+ ch = D_user->u_Esc;
+ }
+ }
+ break;
+ }
+#endif
+ if (ch == D_user->u_Esc)
+ {
+ slen -= ilen + 1;
+ while (slen)
+ Process(&ibuf, &slen);
+ do
+ {
+ if (ilen-- == 0)
+ {
+ D_ESCseen = 1;
+ return;
+ }
+ D_ESCseen = 0;
+ fore = D_fore;
+ ch = (int)(unsigned char)*s++;
+ DoAction(&ktab[ch], ch);
+ if (display == 0 || ilen == 0)
+ return;
+ }
+ while (D_ESCseen);
+ ibuf = s;
+ slen = ilen;
+ }
+ }
+ while (slen)
+ Process(&ibuf, &slen);
+}
+
int
FindCommnr(str)
char *str;
@@ -391,7 +612,7 @@ int key;
#ifdef MULTIUSER
if (multi && display)
{
- if (AclCheckPermCmd(d_user, ACL_EXEC, &comms[nr]))
+ if (AclCheckPermCmd(D_user, ACL_EXEC, &comms[nr]))
return;
}
#endif /* MULTIUSER */
@@ -409,62 +630,24 @@ int key;
if (ParseOnOff(act, &defautonuke) == 0 && msgok)
Msg(0, "Default autonuke turned %s", defautonuke ? "on" : "off");
if (display && *rc_name)
- d_auto_nuke = defautonuke;
+ D_auto_nuke = defautonuke;
break;
case RC_AUTONUKE:
- if (ParseOnOff(act, &d_auto_nuke) == 0 && msgok)
- Msg(0, "Autonuke turned %s", d_auto_nuke ? "on" : "off");
+ if (ParseOnOff(act, &D_auto_nuke) == 0 && msgok)
+ Msg(0, "Autonuke turned %s", D_auto_nuke ? "on" : "off");
break;
#endif
- case RC_DUPLICATE:
- if (!*args)
- {
- if (fore->w_dupto >= 0)
- Msg(0, "Duplicating output to window %d", fore->w_dupto);
- else
- Msg(0, "No duplicate from here\n");
- break;
- }
- if (!strcmp(*args, "off"))
- {
- fore->w_dupto = -1;
- break;
- }
- while (*args)
- {
- n = WindowByNoN(*args++);
- if (n < 0)
- {
- Msg(0, "Invalid window description");
- continue;
- }
- if ((p = wtab[n]) == 0)
- {
- Msg(0, "Window %d does not exist", n);
- continue;
- }
- for (nr = fore->w_number; wtab[nr] && wtab[nr]->w_dupto >= 0;nr = wtab[nr]->w_dupto)
- {
- if (wtab[nr]->w_dupto == n)
- {
- Msg(0, "Cyclic dup detected\n");
- return;
- }
- }
- wtab[n]->w_dupto = fore->w_number;
- }
- break;
case RC_DEFOBUFLIMIT:
if (ParseNum(act, &defobuflimit) == 0 && msgok)
Msg(0, "Default limit set to %d", defobuflimit);
if (display && *rc_name)
- d_obufmax = defobuflimit;
+ D_obufmax = defobuflimit;
break;
case RC_OBUFLIMIT:
if (*args == 0)
- Msg(0, "Limit is %d, current buffer size is %d", d_obufmax, d_obuflen);
- else if (ParseNum(act, &d_obufmax) == 0 && msgok)
- Msg(0, "Limit set to %d", d_obufmax);
+ Msg(0, "Limit is %d, current buffer size is %d", D_obufmax, D_obuflen);
+ else if (ParseNum(act, &D_obufmax) == 0 && msgok)
+ Msg(0, "Limit set to %d", D_obufmax);
break;
case RC_DUMPTERMCAP:
WriteFile(DUMP_TERMCAP);
@@ -570,18 +753,26 @@ int key;
#endif
break;
case RC_ZOMBIE:
- if (!(s = *args))
- {
- ZombieKey = 0;
- break;
- }
- if (!(s = ParseChar(s, &ch)) || *s)
- {
- Msg(0, "%s:zombie: one character expected.", rc_name);
- break;
- }
- ZombieKey = ch;
- break;
+ {
+ char ch2 = 0;
+
+ if (!(s = *args))
+ {
+ ZombieKey_destroy = 0;
+ break;
+ }
+ if (!(s = ParseChar(s, &ch)) || *s)
+ {
+ if (!s || !(s = ParseChar(s, &ch2)) || *s)
+ {
+ Msg(0, "%s:zombie: one or two characters expected.", rc_name);
+ break;
+ }
+ }
+ ZombieKey_destroy = ch;
+ ZombieKey_resurrect = ch2;
+ break;
+ }
case RC_WALL:
for (n = 0, s = *args; args[n]; n++)
{
@@ -592,18 +783,19 @@ int key;
*s++ = ' ';
}
#ifdef MULTIUSER
- s = d_user->u_name;
+ s = D_user->u_name;
#else
- s = d_usertty;
+ s = D_usertty;
#endif
display = NULL; /* a message without display will cause a broadcast */
Msg(0, "%s: %s", s, *args);
break;
case RC_AT:
+ /* where this AT command comes from: */
#ifdef MULTIUSER
- s = SaveStr(d_user->u_name);
+ s = SaveStr(D_user->u_name);
#else
- s = SaveStr(d_usertty);
+ s = SaveStr(D_usertty);
#endif
n = strlen(args[0]);
if (n) n--;
@@ -619,21 +811,23 @@ int key;
struct display *nd;
struct user *u;
- args[0][n] = '\0';
- if (!*args[0])
- u = d_user;
+ if (!n)
+ u = D_user;
else
for (u = users; u; u = u->u_next)
- if (!strncmp(s, u->u_name, n))
- break;
+ {
+ debug3("strncmp('%s', '%s', %d)\n", *args, u->u_name, n);
+ if (!strncmp(*args, u->u_name, n))
+ break;
+ }
debug1("at all displays of user %s\n", u->u_name);
for (display = displays; display; display = nd)
{
- nd = display->_d_next;
- fore = d_fore;
- if (d_user != u)
+ nd = display->d_next;
+ fore = D_fore;
+ if (D_user != u)
continue;
- debug1("AT display %s\n", d_usertty);
+ debug1("AT display %s\n", D_usertty);
DoCommand(args + 1);
if (display)
Msg(0, "command from %s: %s %s",
@@ -648,19 +842,18 @@ int key;
{
struct display *nd;
- args[0][n] = '\0';
debug1("at display matching '%s'\n", args[0]);
for (display = displays; display; display = nd)
{
- nd = display->_d_next;
- fore = d_fore;
- if (strncmp(args[0], d_usertty, n) &&
- (strncmp("/dev/", d_usertty, 5) ||
- strncmp(args[0], d_usertty + 5, n)) &&
- (strncmp("/dev/tty", d_usertty, 8) ||
- strncmp(args[0], d_usertty + 8, n)))
+ nd = display->d_next;
+ fore = D_fore;
+ if (strncmp(args[0], D_usertty, n) &&
+ (strncmp("/dev/", D_usertty, 5) ||
+ strncmp(args[0], D_usertty + 5, n)) &&
+ (strncmp("/dev/tty", D_usertty, 8) ||
+ strncmp(args[0], D_usertty + 8, n)))
continue;
- debug1("AT display %s\n", d_usertty);
+ debug1("AT display %s\n", D_usertty);
DoCommand(args + 1);
if (display)
Msg(0, "command from %s: %s %s",
@@ -672,15 +865,19 @@ int key;
return;
}
case '#':
- args[0][n--] = '\0';
+ n--;
/* FALLTHROUGH */
default:
{
struct win *nw;
+ int ch;
n++;
+ ch = args[0][n];
+ args[0][n] = '\0';
if (!*args[0] || (i = WindowByNumber(args[0])) < 0)
{
+ args[0][n] = ch; /* must restore string in case of bind */
/* try looping over titles */
for (fore = windows; fore; fore = nw)
{
@@ -688,8 +885,17 @@ int key;
if (strncmp(args[0], fore->w_title, n))
continue;
debug2("AT window %d(%s)\n", fore->w_number, fore->w_title);
+ /*
+ * consider this a bug or a feature:
+ * while looping through windows, we have fore AND
+ * display context. This will confuse users who try to
+ * set up loops inside of loops, but often allows to do
+ * what you mean, even when you adress your context wrong.
+ */
i++;
- DoCommand(args + 1);
+ if (fore->w_display)
+ display = fore->w_display;
+ DoCommand(args + 1); /* may destroy our display */
if ((display = fore->w_display))
Msg(0, "command from %s: %s %s",
s, args[1], args[2] ? args[2] : "");
@@ -703,7 +909,10 @@ int key;
}
else if (i < MAXWIN && (fore = wtab[i]))
{
+ args[0][n] = ch; /* must restore string in case of bind */
debug2("AT window %d (%s)\n", fore->w_number, fore->w_title);
+ if (fore->w_display)
+ display = fore->w_display;
DoCommand(args + 1);
if ((display = fore->w_display))
Msg(0, "command from %s: %s %s",
@@ -719,33 +928,46 @@ int key;
free(s);
break;
#ifdef COPY_PASTE
- case RC_COPY_REG:
+ case RC_READREG:
+ /*
+ * Without arguments we prompt for a destination register.
+ * It will receive the copybuffer contents.
+ * This is not done by RC_PASTE, as we prompt for source (not dest)
+ * there.
+ */
if ((s = *args) == NULL)
{
Input("Copy to register:", 1, copy_reg_fn, INP_RAW);
break;
}
- if ((s = ParseChar(s, &ch)) == NULL || *s)
+ if (((s = ParseChar(s, &ch)) == NULL) || *s)
{
- Msg(0, "%s: copy_reg: character, ^x, or (octal) \\032 expected.",
+ Msg(0, "%s: copyreg: character, ^x, or (octal) \\032 expected.",
rc_name);
break;
}
- copy_reg_fn(&ch, 0);
- break;
- case RC_INS_REG:
- if ((s = *args) == NULL)
- {
- Input("Insert from register:", 1, ins_reg_fn, INP_RAW);
- break;
- }
- if ((s = ParseChar(s, &ch)) == NULL || *s)
- {
- Msg(0, "%s: ins_reg: character, ^x, or (octal) \\032 expected.",
- rc_name);
- break;
+ /*
+ * With two arguments we *really* read register contents from file
+ */
+ if (args[1])
+ {
+ if ((s = ReadFile(args[1], &n)))
+ {
+ struct plop *pp = plop_tab + (int)(unsigned char)ch;
+
+ if (pp->buf)
+ free(pp->buf);
+ pp->buf = s;
+ pp->len = n;
+ }
}
- ins_reg_fn(&ch, 0);
+ else
+ /*
+ * with one argument we copy the copybuffer into a specified register
+ * This could be done with RC_PASTE too, but is here to be consistent
+ * with the zero argument call.
+ */
+ copy_reg_fn(&ch, 0);
break;
#endif
case RC_REGISTER:
@@ -776,6 +998,12 @@ int key;
}
process_fn(&ch, 0);
break;
+ case RC_STUFF:
+ s = *args;
+ n = strlen(s);
+ while(n)
+ Process(&s, &n);
+ break;
case RC_REDISPLAY:
Activate(-1);
break;
@@ -791,12 +1019,19 @@ int key;
case RC_INFO:
ShowInfo();
break;
+ case RC_COMMAND:
+ if (!D_ESCseen)
+ {
+ D_ESCseen = 1;
+ break;
+ }
+ /* FALLTHROUGH */
case RC_OTHER:
if (MoreWindows())
- SwitchWindow(d_other ? d_other->w_number : NextWindow());
+ SwitchWindow(D_other ? D_other->w_number : NextWindow());
break;
case RC_META:
- ch = d_user->u_Esc;
+ ch = D_user->u_Esc;
s = &ch;
n = 1;
Process(&s, &n);
@@ -833,11 +1068,11 @@ int key;
}
else
{
- if (d_width == Z0width)
+ if (D_width == Z0width)
n = Z1width;
- else if (d_width == Z1width)
+ else if (D_width == Z1width)
n = Z0width;
- else if (d_width > (Z0width + Z1width) / 2)
+ else if (D_width > (Z0width + Z1width) / 2)
n = Z0width;
else
n = Z1width;
@@ -847,12 +1082,12 @@ int key;
Msg(0, "Illegal width");
break;
}
- if (n == d_width)
+ if (n == D_width)
break;
- if (ResizeDisplay(n, d_height) == 0)
+ if (ResizeDisplay(n, D_height) == 0)
{
- DoResize(d_width, d_height);
- Activate(d_fore ? d_fore->w_norefresh : 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 width to %d.", n);
@@ -867,11 +1102,11 @@ int key;
{
#define H0height 42
#define H1height 24
- if (d_height == H0height)
+ if (D_height == H0height)
n = H1height;
- else if (d_height == H1height)
+ else if (D_height == H1height)
n = H0height;
- else if (d_height > (H0height + H1height) / 2)
+ else if (D_height > (H0height + H1height) / 2)
n = H0height;
else
n = H1height;
@@ -881,12 +1116,12 @@ int key;
Msg(0, "Illegal height");
break;
}
- if (n == d_height)
+ if (n == D_height)
break;
- if (ResizeDisplay(d_width, n) == 0)
+ if (ResizeDisplay(D_width, n) == 0)
{
- DoResize(d_width, d_height);
- Activate(d_fore ? d_fore->w_norefresh : 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);
@@ -902,8 +1137,8 @@ int key;
InputColon();
break;
case RC_LASTMSG:
- if (d_status_lastmsg)
- Msg(0, "%s", d_status_lastmsg);
+ if (D_status_lastmsg)
+ Msg(0, "%s", D_status_lastmsg);
break;
case RC_SCREEN:
DoScreen("key", args);
@@ -940,7 +1175,20 @@ int key;
Msg(0, "%cflow%s", (fore->w_flow & FLOW_NOW) ? '+' : '-',
(fore->w_flow & FLOW_AUTOFLAG) ? "(auto)" : "");
break;
+ case RC_DEFWRITELOCK:
+ if (args[0][0] == 'a')
+ {
+ nwin_default.wlock = WLOCK_AUTO;
+ }
+ else
+ {
+ if (ParseOnOff(act, &n))
+ break;
+ nwin_default.wlock = n ? WLOCK_ON : WLOCK_OFF;
+ }
+ break;
case RC_WRITELOCK:
+#ifdef MULTIUSER
if (*args)
{
if (args[0][0] == 'a')
@@ -953,8 +1201,14 @@ int key;
break;
fore->w_wlock = n ? WLOCK_ON : WLOCK_OFF;
}
+ /*
+ * user may have permission to change the writelock setting,
+ * but he may never aquire the lock himself without write permission
+ */
+ if (!AclCheckPermWin(D_user, ACL_WRITE, fore))
+ fore->w_wlockuser = D_user;
}
- fore->w_wlockuser = d_user;
+#endif
Msg(0, "writelock %s", (fore->w_wlock == WLOCK_AUTO) ? "auto" :
((fore->w_wlock == WLOCK_OFF) ? "off" : "on"));
break;
@@ -1004,7 +1258,7 @@ int key;
break;
#ifdef COPY_PASTE
case RC_COPY:
- if (d_layfn != &WinLf)
+ if (D_layfn != &WinLf)
{
Msg(0, "Must be on a window layer");
break;
@@ -1012,27 +1266,53 @@ int key;
MarkRoutine();
break;
case RC_HISTORY:
- if (d_layfn != &WinLf)
- {
- Msg(0, "Must be on a window layer");
+ {
+ static char *pasteargs[] = {".", 0};
+ if (D_layfn != &WinLf)
+ {
+ Msg(0, "Must be on a window layer");
+ break;
+ }
+ if (GetHistory() == 0)
break;
- }
- if (GetHistory() == 0)
- break;
- if (d_user->u_copybuffer == NULL)
- break;
+ if (D_user->u_copybuffer == NULL)
+ break;
+ args = pasteargs;
+ }
/*FALLTHROUGH*/
case RC_PASTE:
{
- char *ss;
+ char *ss, *dbuf, dch;
int l = 0;
- if ((s = *args) == 0)
- s = ".";
- for (ss = s; (ch = *ss); ss++)
+ /*
+ * without args we prompt for one(!) register to be pasted in the window
+ */
+ if ((s = *args) == NULL)
+ {
+ Input("Paste from register:", 1, ins_reg_fn, INP_RAW);
+ break;
+ }
+ /*
+ * with two arguments we paste into a destination register
+ * (no window needed here).
+ */
+ if (args[1] && ((s = ParseChar(args[1], &dch)) == NULL || *s))
+ {
+ Msg(0, "%s: paste destination: character, ^x, or (octal) \\032 expected.",
+ rc_name);
+ break;
+ }
+ /*
+ * measure length of needed buffer
+ */
+ for (ss = s = *args; (ch = *ss); ss++)
{
if (ch == '.')
- l += d_user->u_copylen;
+ {
+ if (display)
+ l += D_user->u_copylen;
+ }
else
l += plop_tab[(int)(unsigned char)ch].len;
}
@@ -1046,45 +1326,103 @@ int key;
Msg(0, "empty buffer");
break;
}
- fore->w_pasteptr = 0;
- fore->w_pastelen = 0;
- if (fore->w_pastebuf)
- free(fore->w_pastebuf);
- fore->w_pastebuf = 0;
- if (s[1] == 0)
+ /*
+ * shortcut:
+ * if there is only one source and the destination is a window, then
+ * pass a pointer rather than duplicating the buffer.
+ */
+ if (s[1] == 0 && args[1] == 0)
{
+ if (fore == 0)
+ break;
+ fore->w_pasteptr = 0;
+ fore->w_pastelen = 0;
+ if (fore->w_pastebuf)
+ free(fore->w_pastebuf);
+ fore->w_pastebuf = 0; /* this flags we only have a pointer */
if (*s == '.')
- fore->w_pasteptr = d_user->u_copybuffer;
+ fore->w_pasteptr = D_user->u_copybuffer;
else
fore->w_pasteptr = plop_tab[(int)(unsigned char)*s].buf;
fore->w_pastelen = l;
break;
}
- if ((fore->w_pastebuf = (char *)malloc(l)) == 0)
+ /*
+ * if no shortcut, we construct a buffer
+ */
+ if ((dbuf = (char *)malloc(l)) == 0)
{
Msg(0, strnomem);
break;
}
l = 0;
+ /*
+ * concatenate all sources into our own buffer, copy buffer is
+ * special and is skipped if no display exists.
+ */
for (ss = s; (ch = *ss); ss++)
{
if (ch == '.')
{
- bcopy(d_user->u_copybuffer, fore->w_pastebuf + l, d_user->u_copylen);
- l += d_user->u_copylen;
+ 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, fore->w_pastebuf + l, plop_tab[(int)(unsigned char)ch].len);
+ 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;
}
}
- fore->w_pasteptr = fore->w_pastebuf;
- fore->w_pastelen = l;
+ /*
+ * 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;
+ }
+ if (fore->w_pastebuf)
+ free(fore->w_pastebuf);
+ fore->w_pastebuf = dbuf;
+ fore->w_pasteptr = fore->w_pastebuf;
+ fore->w_pastelen = l;
+ }
+ else
+ {
+ /*
+ * we have two arguments, the second is already in dch.
+ * use this as destination rather than the window.
+ */
+ 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;
+ }
+ else
+ {
+ struct plop *pp = plop_tab + (int)(unsigned char)dch;
+
+ if (pp->buf)
+ free(pp->buf);
+ pp->buf = dbuf;
+ pp->len = l;
+ }
+ }
break;
}
case RC_WRITEBUF:
- if (d_user->u_copybuffer == NULL)
+ if (D_user->u_copybuffer == NULL)
{
#ifdef NETHACK
if (nethackflag)
@@ -1097,24 +1435,34 @@ int key;
WriteFile(DUMP_EXCHANGE);
break;
case RC_READBUF:
- ReadFile();
+ if ((s = ReadFile(BufferFile, &n)))
+ {
+ if (D_user->u_copybuffer)
+ UserFreeCopyBuffer(D_user);
+ D_user->u_copylen = n;
+ D_user->u_copybuffer = s;
+ }
break;
case RC_REMOVEBUF:
KillBuffers();
break;
#endif /* COPY_PASTE */
+ case RC_DEFESCAPE:
+ if (ParseEscape(NULL, *args))
+ Msg(0, "%s: two characters required after defescape.", rc_name);
+ break;
case RC_ESCAPE:
- FreeKey((int)(unsigned char)d_user->u_Esc);
- FreeKey((int)(unsigned char)d_user->u_MetaEsc);
- if (ParseEscape(d_user, *args))
+ ClearAction(&ktab[(int)(unsigned char)D_user->u_Esc]);
+ ClearAction(&ktab[(int)(unsigned char)D_user->u_MetaEsc]);
+ if (ParseEscape(D_user, *args))
{
Msg(0, "%s: two characters required after escape.", rc_name);
break;
}
- FreeKey((int)(unsigned char)d_user->u_Esc);
- FreeKey((int)(unsigned char)d_user->u_MetaEsc);
- ktab[(int)(unsigned char)d_user->u_Esc].nr = RC_OTHER;
- ktab[(int)(unsigned char)d_user->u_MetaEsc].nr = RC_META;
+ ClearAction(&ktab[(int)(unsigned char)D_user->u_Esc]);
+ ClearAction(&ktab[(int)(unsigned char)D_user->u_MetaEsc]);
+ ktab[(int)(unsigned char)D_user->u_Esc].nr = RC_OTHER;
+ ktab[(int)(unsigned char)D_user->u_MetaEsc].nr = RC_META;
break;
case RC_CHDIR:
s = *args ? *args : home;
@@ -1159,7 +1507,7 @@ int key;
if (msgok)
{
/*
- * d_user typed ^A:echo... well, echo isn't FinishRc's job,
+ * D_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)))
@@ -1169,6 +1517,14 @@ int key;
}
break;
case RC_BELL:
+ case RC_BELL_MSG:
+ if (*args == 0)
+ {
+ char buf[256];
+ AddXChars(buf, sizeof(buf), BellString);
+ Msg(0, "bell_msg is '%s'", buf);
+ break;
+ }
(void)ParseSaveStr(act, &BellString);
break;
#ifdef COPY_PASTE
@@ -1186,18 +1542,25 @@ int key;
break;
#ifdef POW_DETACH
case RC_POW_DETACH_MSG:
+ if (*args == 0)
+ {
+ char buf[256];
+ AddXChars(buf, sizeof(buf), PowDetachString);
+ Msg(0, "pow_detach_msg is '%s'", buf);
+ break;
+ }
(void)ParseSaveStr(act, &PowDetachString);
break;
#endif
#if defined(UTMPOK) && defined(LOGOUTOK)
- case RC_DEFLOGIN:
- (void)ParseOnOff(act, &nwin_default.lflag);
- break;
case RC_LOGIN:
n = fore->w_slot != (slot_t)-1;
if (ParseSwitch(act, &n) == 0)
SlotToggle(n);
break;
+ case RC_DEFLOGIN:
+ (void)ParseOnOff(act, &nwin_default.lflag);
+ break;
#endif
case RC_DEFFLOW:
if (args[0] && args[1] && args[1][0] == 'i')
@@ -1206,14 +1569,14 @@ int key;
if ((intrc == VDISABLE) && (origintrc != VDISABLE))
{
#if defined(TERMIO) || defined(POSIX)
- intrc = d_NewMode.tio.c_cc[VINTR] = origintrc;
- d_NewMode.tio.c_lflag |= ISIG;
+ intrc = D_NewMode.tio.c_cc[VINTR] = origintrc;
+ D_NewMode.tio.c_lflag |= ISIG;
#else /* TERMIO || POSIX */
- intrc = d_NewMode.m_tchars.t_intrc = origintrc;
+ intrc = D_NewMode.m_tchars.t_intrc = origintrc;
#endif /* TERMIO || POSIX */
if (display)
- SetTTY(d_userfd, &d_NewMode);
+ SetTTY(D_userfd, &D_NewMode);
}
}
if (args[0] && args[0][0] == 'a')
@@ -1222,15 +1585,21 @@ int key;
(void)ParseOnOff(act, &nwin_default.flowflag);
break;
case RC_DEFWRAP:
- (void)ParseOnOff(act, &default_wrap);
+ (void)ParseOnOff(act, &nwin_default.wrap);
break;
- case RC_HARDSTATUS:
- RemoveStatus();
- (void)ParseSwitch(act, &use_hardstatus);
+ case RC_DEFC1:
+ (void)ParseOnOff(act, &nwin_default.c1);
+ break;
+ case RC_DEFGR:
+ (void)ParseOnOff(act, &nwin_default.gr);
break;
case RC_DEFMONITOR:
if (ParseOnOff(act, &n) == 0)
- default_monitor = (n == 0) ? MON_OFF : MON_ON;
+ nwin_default.monitor = (n == 0) ? MON_OFF : MON_ON;
+ break;
+ case RC_HARDSTATUS:
+ RemoveStatus();
+ (void)ParseSwitch(act, &use_hardstatus);
break;
case RC_CONSOLE:
n = (console_window != 0);
@@ -1373,14 +1742,14 @@ int key;
break;
case RC_SCROLLBACK:
(void)ParseNum(act, &n);
- ChangeScrollback(fore, n, d_width);
+ ChangeScrollback(fore, n, D_width);
if (msgok)
Msg(0, "scrollback set to %d", fore->w_histheight);
break;
#endif
case RC_SESSIONNAME:
if (*args == 0)
- Msg(0, "This session is named '%s'\n", SockNamePtr);
+ Msg(0, "This session is named '%s'\n", SockName);
else
{
char buf[MAXPATHLEN];
@@ -1395,7 +1764,7 @@ int key;
break;
}
sprintf(buf, "%s", SockPath);
- sprintf(buf + (SockNamePtr - SockPath), "%d.%s", getpid(), s);
+ sprintf(buf + (SockName - SockPath), "%d.%s", (int)getpid(), s);
free(s);
if ((access(buf, F_OK) == 0) || (errno != ENOENT))
{
@@ -1451,11 +1820,11 @@ int key;
# endif /* NEEDSETENV */
}
#else /* USESETENV */
-# if defined(linux) || defined(__386BSD__) || defined(BSDI)
+# if defined(linux) || defined(__convex__) || (BSD >= 199103)
setenv(args[0], args[1], 0);
# else
setenv(args[0], args[1]);
-# endif /* linux || __386BSD__ || BSDI */
+# endif /* linux || convex || BSD >= 199103 */
#endif /* USESETENV */
MakeNewEnv();
break;
@@ -1481,6 +1850,13 @@ int key;
debug1("markkeys %s\n", *args);
free(s);
break;
+ case RC_PASTEFONT:
+ if (ParseSwitch(act, &pastefont) == 0 && msgok)
+ Msg(0, "Will %spaste font settings", pastefont ? "" : "not ");
+ break;
+ case RC_CRLF:
+ (void)ParseOnOff(act, &join_with_cr);
+ break;
#endif
#ifdef NETHACK
case RC_NETHACK:
@@ -1491,6 +1867,13 @@ int key;
(void)ParseOnOff(act, &hardcopy_append);
break;
case RC_VBELL_MSG:
+ if (*args == 0)
+ {
+ char buf[256];
+ AddXChars(buf, sizeof(buf), VisualBellString);
+ Msg(0, "vbell_msg is '%s'", buf);
+ break;
+ }
(void)ParseSaveStr(act, &VisualBellString);
debug1(" new vbellstr '%s'\n", VisualBellString);
break;
@@ -1506,11 +1889,6 @@ int key;
if (msgok)
Msg(0, "Ttymode set to %03o", TtyMode);
break;
-#ifdef COPY_PASTE
- case RC_CRLF:
- (void)ParseOnOff(act, &join_with_cr);
- break;
-#endif
case RC_AUTODETACH:
(void)ParseOnOff(act, &auto_detach);
break;
@@ -1546,7 +1924,7 @@ int key;
break;
}
n = (unsigned char)ch;
- FreeKey(n);
+ ClearAction(&ktab[n]);
if (args[1])
{
if ((i = FindCommnr(args[1])) == RC_ILLEGAL)
@@ -1561,18 +1939,179 @@ int key;
ktab[n].args = SaveArgs(args + 2);
}
break;
+#ifdef MAPKEYS
+ case RC_BINDKEY:
+ {
+ struct action *newact;
+ int newnr, fl = 0, kf = 0, af = 0, df = 0, mf = 0;
+ struct display *odisp = display;
+ int used = 0;
+
+ for (; *args && **args == '-'; args++)
+ {
+ if (strcmp(*args, "-t") == 0)
+ fl = KMAP_NOTIMEOUT;
+ else if (strcmp(*args, "-k") == 0)
+ kf = 1;
+ else if (strcmp(*args, "-a") == 0)
+ af = 1;
+ else if (strcmp(*args, "-d") == 0)
+ df = 1;
+ else if (strcmp(*args, "-m") == 0)
+ mf = 1;
+ else if (strcmp(*args, "--") == 0)
+ {
+ args++;
+ break;
+ }
+ else
+ {
+ Msg(0, "%s: bindkey: invalid option %s", rc_name, *args);
+ return;
+ }
+ }
+ if (df && mf)
+ {
+ Msg(0, "%s: bindkey: -d does not work with -m", rc_name);
+ break;
+ }
+ if (*args == 0)
+ {
+ if (mf)
+ display_bindkey("Copy mode", mmtab);
+ else if (df)
+ display_bindkey("Default", dmtab);
+ else
+ display_bindkey("User", umtab);
+ break;
+ }
+ if (kf == 0)
+ {
+ if (af)
+ {
+ Msg(0, "%s: bindkey: -a only works with -k", rc_name);
+ break;
+ }
+ for (i = 0; i < KMAP_EXT; i++)
+ if (kmap_extras[i] == 0)
+ {
+ if (args[1])
+ break;
+ }
+ else
+ if (strcmp(kmap_extras[i], *args) == 0)
+ break;
+ if (i == KMAP_EXT)
+ {
+ Msg(0, args[1] ? "%s: bindkey: no more room for keybinding" : "%s: bindkey: keybinding not found", rc_name);
+ break;
+ }
+ if (df == 0 && dmtab[i + KMAP_KEYS + KMAP_AKEYS].nr != RC_ILLEGAL)
+ used = 1;
+ if (mf == 0 && mmtab[i + KMAP_KEYS + KMAP_AKEYS].nr != RC_ILLEGAL)
+ used = 1;
+ if ((df || mf) && umtab[i + KMAP_KEYS + KMAP_AKEYS].nr != RC_ILLEGAL)
+ used = 1;
+ i += KMAP_KEYS + KMAP_AKEYS;
+ }
+ else
+ {
+ for (i = T_CAPS; i < T_OCAPS; i++)
+ if (strcmp(term[i].tcname, *args) == 0)
+ break;
+ if (i == T_OCAPS)
+ {
+ Msg(0, "%s: bindkey: unknown key '%s'", rc_name, *args);
+ break;
+ }
+ if (af && i >= T_CURSOR && i < T_OCAPS)
+ i -= T_CURSOR - KMAP_KEYS;
+ else
+ i -= T_CAPS;
+ }
+ newact = df ? &dmtab[i] : mf ? &mmtab[i] : &umtab[i];
+ ClearAction(newact);
+ if (args[1])
+ {
+ if ((newnr = FindCommnr(args[1])) == RC_ILLEGAL)
+ {
+ Msg(0, "%s: bindkey: unknown command '%s'", rc_name, args[1]);
+ break;
+ }
+ if (CheckArgNum(newnr, args + 2))
+ break;
+ newact->nr = newnr;
+ if (args[2])
+ newact->args = SaveArgs(args + 2);
+ if (kf == 0 && args[1])
+ {
+ if (kmap_extras[i - (KMAP_KEYS+KMAP_AKEYS)])
+ free(kmap_extras[i - (KMAP_KEYS+KMAP_AKEYS)]);
+ kmap_extras[i - (KMAP_KEYS+KMAP_AKEYS)] = SaveStr(*args);
+ kmap_extras_fl[i - (KMAP_KEYS+KMAP_AKEYS)] = fl;
+ }
+ }
+ for (display = displays; display; display = display->d_next)
+ remap(i, args[1] ? 1 : 0);
+ if (kf == 0 && !args[1])
+ {
+ i -= KMAP_KEYS + KMAP_AKEYS;
+ if (!used && kmap_extras[i])
+ {
+ free(kmap_extras[i]);
+ kmap_extras[i] = 0;
+ kmap_extras_fl[i] = 0;
+ }
+ }
+ display = odisp;
+ }
+ break;
+ case RC_MAPTIMEOUT:
+ if (*args)
+ {
+ if (ParseNum(act, &n))
+ break;
+ if (n < 0 || n >= 1000)
+ {
+ Msg(0, "%s: maptimeout: illegal time %d", rc_name, n);
+ break;
+ }
+ maptimeout = n * 1000;
+ }
+ if (*args == 0 || msgok)
+ Msg(0, "maptimeout is %dms", maptimeout/1000);
+ break;
+ case RC_MAPNOTNEXT:
+ D_dontmap = 1;
+ break;
+ case RC_MAPDEFAULT:
+ D_mapdefault = 1;
+ break;
+#endif
#ifdef MULTIUSER
case RC_ACLCHG:
case RC_ACLADD:
{
struct user **u;
- u = FindUserPtr(args[0]);
- UserAdd(args[0], NULL, u);
- if (args[1] && args[2])
- AclSetPerm(*u, args[1], args[2]);
- else
- AclSetPerm(*u, "+rwx", "#?");
+ if (args[0][0] == '*' && args[0][1] == '\0' && args[1] && args[2])
+ {
+ for (u = &users; *u; u = &(*u)->u_next)
+ AclSetPerm(*u, args[1], args[2]);
+ break;
+ }
+ do
+ {
+ for (s = args[0]; *s && *s != ' ' && *s != '\t' && *s != ','; s++)
+ ;
+ *s ? (*s++ = '\0') : (*s = '\0');
+ u = FindUserPtr(args[0]);
+ UserAdd(args[0], NULL, u);
+ if (args[1] && args[2])
+ AclSetPerm(*u, args[1], args[2]);
+ else
+ AclSetPerm(*u, "+rwx", "#?");
+ } while (*(args[0] = s));
break;
}
case RC_ACLDEL:
@@ -1606,6 +2145,69 @@ int key;
execclone(args);
break;
#endif
+ case RC_GR:
+ if (ParseSwitch(act, &fore->w_gr) == 0 && msgok)
+ Msg(0, "Will %suse GR", fore->w_gr ? "" : "not ");
+ break;
+ case RC_C1:
+ if (ParseSwitch(act, &fore->w_c1) == 0 && msgok)
+ Msg(0, "Will %suse C1", fore->w_c1 ? "" : "not ");
+ break;
+#ifdef KANJI
+ case RC_KANJI:
+ 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
+ {
+ Msg(0, "kanji: illegal argument (%s)", args[i]);
+ break;
+ }
+ if (i == 0)
+ fore->w_kanji = n;
+ else
+ D_kanji = 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
+ {
+ Msg(0, "defkanji: illegal argument (%s)", *args);
+ break;
+ }
+ nwin_default.kanji = n;
+ break;
+#endif
+ case RC_PRINTCMD:
+ if (*args)
+ {
+ if (printcmd)
+ free(printcmd);
+ printcmd = 0;
+ if (**args)
+ printcmd = SaveStr(*args);
+ }
+ if (*args == 0 || msgok)
+ if (printcmd)
+ Msg(0, "using '%s' as print command", printcmd);
+ else
+ Msg(0, "using termcap entries for printing");
+ break;
default:
break;
}
@@ -1671,6 +2273,12 @@ char *buf, **args;
{
case '@':
*ap++ = "at";
+ /*
+ * If comments were removed before this shortcut expanded,
+ * we wouldn't need this hack.
+ */
+ if (p[1] == '#')
+ *p = '\\';
while (*(++p) == ' ' || *p == '\t')
;
argc++;
@@ -1694,6 +2302,8 @@ char *buf, **args;
args[argc] = 0;
return argc;
}
+ if (*p == '\\' && p[1] == '#')
+ p++;
if (++argc >= MAXARGS)
{
Msg(0, "%s: too many tokens.", rc_name);
@@ -1952,8 +2562,8 @@ char *p, *cp;
}
-static
-int IsNum(s, base)
+static int
+IsNum(s, base)
register char *s;
register int base;
{
@@ -1963,7 +2573,7 @@ register int base;
return 1;
}
-static int
+int
IsNumColon(s, base, p, psize)
int base, psize;
char *s, *p;
@@ -1994,7 +2604,7 @@ int n;
ShowWindows();
return;
}
- if (p == d_fore)
+ if (p == D_fore)
{
Msg(0, "This IS window %d (%s).", n, p->w_title);
return;
@@ -2002,7 +2612,7 @@ int n;
if (p->w_display)
{
Msg(0, "Window %d (%s) is on another display (%s@%s).", n, p->w_title,
- p->w_display->_d_user->u_name, p->w_display->_d_usertty);
+ p->w_display->d_user->u_name, p->w_display->d_usertty);
return;
}
SetForeWindow(p);
@@ -2018,15 +2628,15 @@ struct display *dis;
struct win *w;
{
/* release auto writelock when user has no other display here */
- if (w->w_wlock == WLOCK_AUTO && w->w_wlockuser == d_user)
+ if (w->w_wlock == WLOCK_AUTO && w->w_wlockuser == D_user)
{
struct display *d;
- for (d = displays; d; d = d->_d_next)
- if (( d != display) && (d->_d_fore == w))
+ for (d = displays; d; d = d->d_next)
+ if ((d != display) && (d->d_fore == w))
break;
debug3("%s %s autolock on win %d\n",
- d_user->u_name, d?"keeps":"releases", w->w_number);
+ D_user->u_name, d?"keeps":"releases", w->w_number);
if (!d)
{
w->w_wlockuser = NULL;
@@ -2047,40 +2657,44 @@ struct win *wi;
*/
if (display)
{
- fore = d_fore;
+ fore = D_fore;
if (fore)
{
ReleaseAutoWritelock(display, fore);
/* deactivate old window. */
if (fore->w_tstamp.seconds)
fore->w_tstamp.lastio = Now;
- d_other = fore;
+ D_other = fore;
fore->w_active = 0;
fore->w_display = 0;
}
else
{
/* put all the display layers on the window. */
- for (l = d_lay; l; l = l->l_next)
+ for (l = D_lay; l; l = l->l_next)
if (l->l_next == &BlankLayer)
{
l->l_next = wi->w_lay;
- wi->w_lay = d_lay;
- for (l = d_lay; l != wi->w_lay; l = l->l_next)
+ wi->w_lay = D_lay;
+ for (l = D_lay; l != wi->w_lay; l = l->l_next)
l->l_block |= wi->w_lay->l_block;
break;
}
}
- d_fore = wi;
- if (d_other == wi)
- d_other = 0;
- d_lay = wi->w_lay;
- d_layfn = d_lay->l_layfn;
- if ((wi->w_wlock == WLOCK_AUTO) && !wi->w_wlockuser)
+ D_fore = wi;
+ if (D_other == wi)
+ D_other = 0;
+ D_lay = wi->w_lay;
+ D_layfn = D_lay->l_layfn;
+ if ((wi->w_wlock == WLOCK_AUTO) &&
+#ifdef MULTIUSER
+ !AclCheckPermWin(D_user, ACL_WRITE, wi) &&
+#endif
+ !wi->w_wlockuser)
{
debug2("%s obtained auto writelock for window %d\n",
- d_user->u_name, wi->w_number);
- wi->w_wlockuser = d_user;
+ D_user->u_name, wi->w_number);
+ wi->w_wlockuser = D_user;
}
}
fore = wi;
@@ -2159,14 +2773,14 @@ struct win *wi;
display = wi->w_display;
if (display)
{
- if (wi == d_fore)
+ if (wi == D_fore)
{
RemoveStatus();
- if (d_lay != &wi->w_winlay)
+ if (D_lay != &wi->w_winlay)
ExitOverlayPage();
- d_fore = 0;
- d_lay = &BlankLayer;
- d_layfn = BlankLayer.l_layfn;
+ D_fore = 0;
+ D_lay = &BlankLayer;
+ D_layfn = BlankLayer.l_layfn;
}
}
@@ -2186,7 +2800,7 @@ struct win *wi;
* of windows for the most recently used window. If no window is alive at
* all, exit.
*/
- if (display && d_fore)
+ if (display && D_fore)
return;
if (windows == 0)
Finit(0);
@@ -2270,7 +2884,7 @@ ShowWindows()
ss = s;
*s++ = '*';
}
- else if (p == d_other)
+ else if (p == D_other)
*s++ = '-';
if (p->w_display && p->w_display != display)
*s++ = '&';
@@ -2307,12 +2921,12 @@ ShowWindows()
}
*s++ = ' ';
*s = '\0';
- if (ss - buf > d_width / 2)
+ if (ss - buf > D_width / 2)
{
- ss -= d_width / 2;
- if (s - ss < d_width)
+ ss -= D_width / 2;
+ if (s - ss < D_width)
{
- ss = s - d_width;
+ ss = s - D_width;
if (ss < buf)
ss = buf;
}
@@ -2349,7 +2963,7 @@ ShowInfo()
if (wp == 0)
{
- Msg(0, "(%d,%d)/(%d,%d) no window", d_x + 1, d_y + 1, d_width, d_height);
+ Msg(0, "(%d,%d)/(%d,%d) no window", D_x + 1, D_y + 1, D_width, D_height);
return;
}
#ifdef COPY_PASTE
@@ -2368,14 +2982,32 @@ ShowInfo()
(wp->w_logfp != NULL) ? '+' : '-',
(wp->w_monitor != MON_OFF) ? '+' : '-',
wp->w_norefresh ? '-' : '+');
- if (CG0)
+ if (D_CG0)
{
p = buf + strlen(buf);
- sprintf(p, " G%1d [", wp->w_Charset);
+ 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++)
- p[i + 5] = wp->w_charsets[i] ? wp->w_charsets[i] : 'B';
- p[9] = ']';
- p[10] = '\0';
+ {
+ 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++ = ']';
+#ifdef KANJI
+ strcpy(p, wp->w_kanji == EUC ? " euc" : wp->w_kanji == SJIS ? " sjis" : "");
+ p += strlen(p);
+#endif
+ *p = 0;
}
Msg(0, "%s", buf);
}
@@ -2567,7 +3199,6 @@ char *fn, **av;
break;
case 'M':
nwin.monitor = MON_ON;
-debug("nwin.monitor = MON_ON;\n");
break;
default:
Msg(0, "%s: screen: invalid option -%c.", fn, av[0][1]);
@@ -2625,11 +3256,13 @@ char *s, *array;
while (*s)
{
s = ParseChar(s, (char *) &key);
- if (*s != '=')
+ if (!s || *s != '=')
return -1;
do
{
s = ParseChar(++s, (char *) &value);
+ if (!s)
+ return -1;
array[value] = key;
}
while (*s == '=');
@@ -2660,7 +3293,7 @@ int len;
if (ktab[(int)(unsigned char)*buf].nr != RC_POW_DETACH)
{
if (display)
- write(d_userfd, "\007", 1);
+ write(D_userfd, "\007", 1);
#ifdef NETHACK
if (nethackflag)
Msg(0, "The blast of disintegration whizzes by you!");
@@ -2686,14 +3319,14 @@ int len;
}
if (pp->buf)
free(pp->buf);
- if ((pp->buf = (char *)malloc(d_user->u_copylen)) == NULL)
+ if ((pp->buf = (char *)malloc(D_user->u_copylen)) == NULL)
{
Msg(0, strnomem);
return;
}
- bcopy(d_user->u_copybuffer, pp->buf, d_user->u_copylen);
- pp->len = d_user->u_copylen;
- Msg(0, "Copied %d characters into register %c", d_user->u_copylen, *buf);
+ bcopy(D_user->u_copybuffer, pp->buf, D_user->u_copylen);
+ pp->len = D_user->u_copylen;
+ Msg(0, "Copied %d characters into register %c", D_user->u_copylen, *buf);
}
static void
@@ -2703,6 +3336,13 @@ int len;
{
struct plop *pp = plop_tab + (int)(unsigned char)*buf;
+
+ if (!fore)
+ return; /* Input() should not call us w/o fore, but you never know... */
+ if (*buf == '.')
+ {
+ Msg(0, "ins_reg_fn: Warning: pasting real register '.'!");
+ }
if (len)
{
*buf = 0;
@@ -2794,17 +3434,17 @@ int len;
if (CheckPassword)
{
#ifdef COPY_PASTE
- if (d_user->u_copybuffer)
- UserFreeCopyBuffer(d_user);
- d_user->u_copylen = strlen(Password);
- if ((d_user->u_copybuffer = (char *) malloc(d_user->u_copylen + 1)) == NULL)
+ if (D_user->u_copybuffer)
+ UserFreeCopyBuffer(D_user);
+ D_user->u_copylen = strlen(Password);
+ if ((D_user->u_copybuffer = (char *) malloc(D_user->u_copylen + 1)) == NULL)
{
Msg(0, strnomem);
- d_user->u_copylen = 0;
+ D_user->u_copylen = 0;
}
else
{
- strcpy(d_user->u_copybuffer, Password);
+ strcpy(D_user->u_copybuffer, Password);
Msg(0, "[ Password moved into copybuffer ]");
}
#else /* COPY_PASTE */
diff --git a/src/pty.c b/src/pty.c
index 31c523b..f763ac2 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -76,9 +76,46 @@ static char TtyProto[] = "/dev/ttyXY";
# endif /* hpux */
#endif
+static void initpty __P((int));
-#if defined(sequent) || defined(_SEQUENT_)
+/***************************************************************/
+static void
+initpty(f)
+int f;
+{
+#ifdef POSIX
+ tcflush(f, TCIOFLUSH);
+#else
+# ifdef TIOCFLUSH
+ (void) ioctl(f, TIOCFLUSH, (char *) 0);
+# endif
+#endif
+#ifdef LOCKPTY
+ (void) ioctl(f, TIOCEXCL, (char *) 0);
+#endif
+}
+
+/***************************************************************/
+
+#if defined(OSX) && !defined(PTY_DONE)
+#define PTY_DONE
+int
+OpenPTY(ttyn)
+char **ttyn;
+{
+ register int f;
+ if ((f = open_controlling_pty(TtyName)) < 0)
+ return -1;
+ initpty(f);
+ *ttyn = TtyName;
+ return f;
+#endif
+
+/***************************************************************/
+
+#if (defined(sequent) || defined(_SEQUENT_)) && !defined(PTY_DONE)
+#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
@@ -93,90 +130,78 @@ char **ttyn;
#endif
strncpy(PtyName, m, sizeof(PtyName));
strncpy(TtyName, s, sizeof(TtyName));
-#ifdef POSIX
- tcflush(f, TCIOFLUSH);
-#else
-# ifdef TIOCFLUSH
- (void) ioctl(f, TIOCFLUSH, (char *) 0);
-# endif
-#endif
-#ifdef LOCKPTY
- (void) ioctl(f, TIOCEXCL, (char *) 0);
-#endif
+ initpty(f);
*ttyn = TtyName;
return f;
}
+#endif
-#else
-# if defined(MIPS) && defined(HAVE_DEV_PTC)
-# ifdef __sgi /* __sgi -> IRIX 4.0 */
+/***************************************************************/
+#if defined(__sgi) && !defined(PTY_DONE)
+#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
int f;
char *name;
- sig_t (*sigcld)__P(SIGPROTOARG);
+ sigret_t (*sigcld)__P(SIGPROTOARG);
/*
* SIGCHLD set to SIG_DFL for _getpty() because it may fork() and
* exec() /usr/adm/mkpts
*/
sigcld = signal(SIGCHLD, SIG_DFL);
- name = _getpty(&f, O_RDWR | O_NDELAY, 0600, 0);
+ name = _getpty(&f, O_RDWR | O_NONBLOCK, 0600, 0);
signal(SIGCHLD, sigcld);
- if (name == NULL)
+ if (name == 0)
return -1;
-#ifdef LOCKPTY
- (void) ioctl(f, TIOCEXCL, (char *) 0);
-#endif
+ initpty(f);
*ttyn = name;
return f;
}
+#endif
-# else /* __sgi */
+/***************************************************************/
+#if defined(MIPS) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
+#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
register int f;
- register int my_minor;
struct stat buf;
strcpy(PtyName, "/dev/ptc");
- f = open(PtyName, O_RDWR | O_NDELAY);
- if (f < 0)
+ if ((f = open(PtyName, O_RDWR | O_NONBLOCK)) < 0)
return -1;
if (fstat(f, &buf) < 0)
{
close(f);
return -1;
}
- my_minor = minor(buf.st_rdev);
- sprintf(TtyName, "/dev/ttyq%d", my_minor);
-#ifdef LOCKPTY
- (void) ioctl(f, TIOCEXCL, (char *) 0);
-#endif
+ sprintf(TtyName, "/dev/ttyq%d", minor(buf.st_rdev));
+ initpty(f);
*ttyn = TtyName;
return f;
}
+#endif
-# endif /* __sgi */
-# else /* MIPS */
-# ifdef SVR4
+/***************************************************************/
+#if defined(SVR4) && !defined(PTY_DONE)
+#define PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
{
- char *m;
register int f;
- char *ptsname();
+ char *m, *ptsname();
int unlockpt __P((int)), grantpt __P((int));
- sig_t (*sigcld)__P(SIGPROTOARG);
+ sigret_t (*sigcld)__P(SIGPROTOARG);
if ((f = open("/dev/ptmx", O_RDWR)) == -1)
return -1;
@@ -186,8 +211,7 @@ char **ttyn;
* exec()s pt_chmod
*/
sigcld = signal(SIGCHLD, SIG_DFL);
-
- if ((m = ptsname(f)) == NULL || unlockpt(f) || grantpt(f))
+ if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f))
{
signal(SIGCHLD, sigcld);
close(f);
@@ -195,22 +219,20 @@ char **ttyn;
}
signal(SIGCHLD, sigcld);
strncpy(TtyName, m, sizeof(TtyName));
-#ifdef POSIX
- tcflush(f, TCIOFLUSH);
-#else
-# ifdef TIOCFLUSH
- (void) ioctl(f, TIOCFLUSH, (char *) 0);
-# endif
-#endif
-#ifdef LOCKPTY
- (void) ioctl(f, TIOCEXCL, (char *) 0);
-#endif
+ initpty(f);
*ttyn = TtyName;
return f;
}
+#endif
+
+/***************************************************************/
-# else /* not SVR4 */
-# if defined(_AIX) && defined(HAVE_DEV_PTC) /* RS6000 */
+#if defined(_AIX) && defined(HAVE_DEV_PTC) && !defined(PTY_DONE)
+#define PTY_DONE
+
+#ifdef _IBMR2
+int aixhack = -1;
+#endif
int
OpenPTY(ttyn)
@@ -222,24 +244,30 @@ char **ttyn;
strcpy (PtyName, "/dev/ptc");
if ((f = open (PtyName, O_RDWR)) < 0)
return -1;
- strcpy (TtyName, ttyname(f));
- strcpy (PtyName, TtyName);
- PtyName [7] = 'c';
+ strncpy(TtyName, ttyname(f), sizeof(TtyName));
if (eff_uid && access(TtyName, R_OK | W_OK))
{
close(f);
return -1;
}
-#ifdef LOCKPTY
- if (ioctl (f, TIOCEXCL, (char *) 0) == -1)
- return -1;
-#endif /* LOCKPTY */
+ initpty(f);
+# ifdef _IBMR2
+ if (aixhack >= 0)
+ close(aixhack);
+ if ((aixhack = open(TtyName, O_RDWR | O_NOCTTY)) < 0)
+ {
+ close(f);
+ return -1;
+ }
+# endif
*ttyn = TtyName;
return f;
}
+#endif
-# else /* _AIX, RS6000 */
+/***************************************************************/
+#ifndef PTY_DONE
int
OpenPTY(ttyn)
char **ttyn;
@@ -250,13 +278,13 @@ char **ttyn;
debug("OpenPTY: Using BSD style ptys.\n");
strcpy(PtyName, PtyProto);
strcpy(TtyName, TtyProto);
- for (p = PtyName; *p != 'X'; ++p)
+ for (p = PtyName; *p != 'X'; p++)
;
- for (q = TtyName; *q != 'X'; ++q)
+ for (q = TtyName; *q != 'X'; q++)
;
- for (l = PTYRANGE0; (*p = *l) != '\0'; ++l)
+ for (l = PTYRANGE0; (*p = *l) != '\0'; l++)
{
- for (d = PTYRANGE1; (p[1] = *d) != '\0'; ++d)
+ for (d = PTYRANGE1; (p[1] = *d) != '\0'; d++)
{
debug1("OpenPTY tries '%s'\n", PtyName);
if ((f = open(PtyName, O_RDWR)) == -1)
@@ -283,17 +311,11 @@ char **ttyn;
}
}
#endif
-#ifdef LOCKPTY
- (void) ioctl(f, TIOCEXCL, (char *) 0);
-#endif
+ initpty(f);
*ttyn = TtyName;
return f;
}
}
return -1;
}
-
-# endif /* _AIX, RS6000 */
-# endif /* SVR4 */
-# endif /* MIPS */
-#endif /* sequent || SEQUENT */
+#endif
diff --git a/src/putenv.c b/src/putenv.c
index 00b38f3..12210fb 100644
--- a/src/putenv.c
+++ b/src/putenv.c
@@ -58,11 +58,20 @@ RCS_ID("$Id$ FAU")
#include "config.h"
-#if defined(NEEDPUTENV)
+#ifdef NEEDPUTENV
-#define EXTRASIZE 5 /* increment to add to env. size */
+#if defined(__STDC__)
+# define __P(a) a
+#else
+# define __P(a) ()
+#endif
+
+char *malloc __P((int));
+char *realloc __P((char *, int));
+void free __P((char *));
+int sprintf __P((char *, char *, ...));
-char *malloc(), *realloc();
+#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. */
@@ -191,7 +200,7 @@ moreenv()
register char **env;
esize = envsize + EXTRASIZE;
- env = (char **)realloc(environ, esize * sizeof (*env));
+ env = (char **)realloc((char *)environ, esize * sizeof (*env));
if (env == 0)
return -1;
environ = env;
@@ -201,4 +210,3 @@ moreenv()
#endif /* NEEDPUTENV */
-
diff --git a/src/resize.c b/src/resize.c
index a65a3b1..72723a7 100644
--- a/src/resize.c
+++ b/src/resize.c
@@ -64,7 +64,7 @@ extern int nethackflag;
/*
* 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 D_other) + redisplay
* 2: modify all windows
*
* Note: Activate() is only called if change_flag == 1
@@ -84,26 +84,26 @@ int change_flag;
debug("CheckScreenSize: No display -> no check.\n");
return;
}
- oldlay = d_lay;
+ oldlay = D_lay;
#ifdef TIOCGWINSZ
- if (ioctl(d_userfd, TIOCGWINSZ, (char *)&glwz) != 0)
+ if (ioctl(D_userfd, TIOCGWINSZ, (char *)&glwz) != 0)
{
- debug2("CheckScreenSize: ioctl(%d, TIOCGWINSZ) errno %d\n", d_userfd, errno);
- wi = CO;
- he = LI;
+ debug2("CheckScreenSize: ioctl(%d, TIOCGWINSZ) errno %d\n", D_userfd, errno);
+ wi = D_CO;
+ he = D_LI;
}
else
{
wi = glwz.ws_col;
he = glwz.ws_row;
if (wi == 0)
- wi = CO;
+ wi = D_CO;
if (he == 0)
- he = LI;
+ he = D_LI;
}
#else
- wi = CO;
- he = LI;
+ wi = D_CO;
+ he = D_LI;
#endif
debug2("CheckScreenSize: screen is (%d,%d)\n", wi, he);
@@ -115,15 +115,15 @@ int change_flag;
if (p->w_display == 0 || p->w_display == display)
ChangeWindowSize(p, wi, he);
}
- if (d_width == wi && d_height == he)
+ if (D_width == wi && D_height == he)
{
debug("CheckScreenSize: No change -> return.\n");
return;
}
ChangeScreenSize(wi, he, change_flag);
if (change_flag == 1)
- Activate(d_fore ? d_fore->w_norefresh : 0);
- if (d_lay != oldlay)
+ Activate(D_fore ? D_fore->w_norefresh : 0);
+ if (D_lay != oldlay)
{
#ifdef NETHACK
if (nethackflag)
@@ -142,42 +142,42 @@ int change_fore;
struct win *p;
int wwi;
- if (d_width == wi && d_height == he)
+ if (D_width == wi && D_height == he)
{
debug("ChangeScreenSize: no change\n");
return;
}
- debug2("ChangeScreenSize from (%d,%d) ", d_width, d_height);
+ debug2("ChangeScreenSize from (%d,%d) ", D_width, D_height);
debug3("to (%d,%d) (change_fore: %d)\n",wi, he, change_fore);
- d_width = wi;
- d_height = he;
+ D_width = wi;
+ D_height = he;
CheckMaxSize(wi);
- if (CWS)
+ if (D_CWS)
{
- d_defwidth = CO;
- d_defheight = LI;
+ D_defwidth = D_CO;
+ D_defheight = D_LI;
}
else
{
- if (CZ0 && (wi == Z0width || wi == Z1width) &&
- (CO == Z0width || CO == Z1width))
- d_defwidth = CO;
+ if (D_CZ0 && (wi == Z0width || wi == Z1width) &&
+ (D_CO == Z0width || D_CO == Z1width))
+ D_defwidth = D_CO;
else
- d_defwidth = wi;
- d_defheight = he;
+ D_defwidth = wi;
+ D_defheight = he;
}
- debug2("Default size: (%d,%d)\n", d_defwidth, d_defheight);
+ debug2("Default size: (%d,%d)\n", D_defwidth, D_defheight);
if (change_fore)
DoResize(wi, he);
- if (CWS == NULL && displays->_d_next == 0)
+ if (D_CWS == NULL && displays->d_next == 0)
{
/* adapt all windows - to be removed ? */
for (p = windows; p; p = p->w_next)
{
debug1("Trying to change window %d.\n", p->w_number);
wwi = wi;
- if (CZ0 && (wi == Z0width || wi == Z1width))
+ if (D_CZ0 && (wi == Z0width || wi == Z1width))
{
if (p->w_width > (Z0width + Z1width) / 2)
wwi = Z0width;
@@ -198,15 +198,15 @@ int wi, he;
for(;;)
{
- oldlay = d_lay;
- for (; d_lay; d_lay = d_lay->l_next)
+ oldlay = D_lay;
+ for (; D_lay; D_lay = D_lay->l_next)
{
- d_layfn = d_lay->l_layfn;
+ D_layfn = D_lay->l_layfn;
if ((q = Resize(wi, he)))
break;
}
- d_lay = oldlay;
- d_layfn = d_lay->l_layfn;
+ D_lay = oldlay;
+ D_layfn = D_lay->l_layfn;
if (q == 0)
break;
ExitOverlayPage();
@@ -292,7 +292,7 @@ int wi, hi, fillblank;
onp = *arr;
}
if (*arr)
- free(*arr);
+ free((char *)*arr);
}
else
narr = *arr;
@@ -393,7 +393,7 @@ int wi, hi, fillblank;
{
while (--cp >= *arr)
free(*cp);
- free(*arr);
+ free((char *)*arr);
*arr = NULL;
return -1;
}
@@ -415,7 +415,7 @@ int hi;
for (t = hi, p = *arr; t--; p++)
if (*p && *p != null)
free(*p);
- free(*arr);
+ free((char *)*arr);
*arr = 0;
}
@@ -540,8 +540,8 @@ nomem: KillWindow(p);
Msg(0, "Out of memory -> Window destroyed !!");
return -1;
}
- /* this won't change the d_height of the scrollback history buffer, but
- * it will check the d_width of the lines.
+ /* this won't change the D_height of the scrollback history buffer, but
+ * it will check the D_width of the lines.
*/
#ifdef COPY_PASTE
ChangeScrollback(p, p->w_histheight, wi);
@@ -549,7 +549,7 @@ nomem: KillWindow(p);
if (p->w_tabs == 0)
{
- /* tabs get d_width+1 because 0 <= x <= wi */
+ /* tabs get D_width+1 because 0 <= x <= wi */
if ((p->w_tabs = malloc((unsigned) wi + 1)) == 0)
goto nomem;
t = 8;
diff --git a/src/screen.c b/src/screen.c
index 181e575..577b4bd 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -28,22 +28,19 @@ RCS_ID("$Id$ FAU")
#include <ctype.h>
#include <fcntl.h>
+
#ifdef sgi
# include <sys/sysmacros.h>
-#endif /* sgi */
-
-#ifdef ISC
-# include <sys/bsdtypes.h>
#endif
+
#include <sys/stat.h>
-#ifndef sgi
-# include <sys/file.h>
-#endif /* sgi */
#ifndef sun
# include <sys/ioctl.h>
-#endif /* sun */
+#endif
-#include <signal.h>
+#ifndef SIGINT
+# include <signal.h>
+#endif
#include "config.h"
@@ -51,7 +48,7 @@ RCS_ID("$Id$ FAU")
# include <sys/stropts.h>
#endif
-#ifdef SYSV
+#if defined(SYSV) && !defined(ISC)
# include <sys/utsname.h>
#endif
@@ -65,6 +62,10 @@ RCS_ID("$Id$ FAU")
# include <sys/pty.h>
#endif /* ISC */
+#if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX)
+# include <compat.h>
+#endif
+
#include "screen.h"
#include "patchlevel.h"
@@ -108,9 +109,10 @@ extern struct NewWindow nwin_undef, nwin_default, nwin_options;
static char *MakeWinMsg __P((char *, int));
static void SigChldHandler __P((void));
-static sig_t SigChld __P(SIGPROTOARG);
-static sig_t SigInt __P(SIGPROTOARG);
-static sig_t CoreDump __P((int));
+static sigret_t SigChld __P(SIGPROTOARG);
+static sigret_t SigInt __P(SIGPROTOARG);
+static sigret_t CoreDump __P(SIGPROTOARG);
+static sigret_t FinitHandler __P(SIGPROTOARG);
static void DoWait __P((void));
static void WindowDied __P((struct win *));
@@ -119,6 +121,7 @@ static void WindowDied __P((struct win *));
extern char Password[];
#endif
+int nversion; /* numerical version, used for secondary DA */
/* the attacher */
struct passwd *ppp;
@@ -127,14 +130,10 @@ char *attach_term;
char *LoginName;
struct mode attach_Mode;
-
-#ifdef SOCKDIR
-char *SockDir = SOCKDIR;
-#else
-char *SockDir = ".iscreen";
-#endif
-extern char SockPath[], *SockNamePtr, *SockName;
+char SockPath[MAXPATHLEN];
+char *SockName, *SockMatch; /* SockName is pointer in SockPath */
int ServerSocket = -1;
+
char **NewEnv = NULL;
char *RcFileName = NULL;
@@ -173,15 +172,18 @@ int MasterPid;
int real_uid, real_gid, eff_uid, eff_gid;
int default_startup;
int slowpaste;
-int ZombieKey;
+int ZombieKey_destroy, ZombieKey_resurrect;
#ifdef NETHACK
int nethackflag = 0;
#endif
+#ifdef MAPKEYS
+int maptimeout = 300000;
+#endif
-struct win *fore = NULL;
-struct win *windows = NULL;
+struct win *fore;
+struct win *windows;
struct win *console_window;
@@ -199,7 +201,7 @@ char strnomem[] = "Out of memory.";
#endif
-static int InterruptPlease = 0;
+static int InterruptPlease;
static int GotSigChld;
@@ -211,30 +213,30 @@ fd_set *rp, *wp;
FD_ZERO(rp);
FD_ZERO(wp);
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
{
- if (d_obufp != d_obuf)
- FD_SET(d_userfd, wp);
+ if (D_obufp != D_obuf)
+ FD_SET(D_userfd, wp);
- FD_SET(d_userfd, rp); /* Do that always */
+ FD_SET(D_userfd, rp); /* Do that always */
/* read from terminal if there is room in the destination buffer
*
* Removed, so we can always input a command sequence
*
- * if (d_fore == 0)
+ * if (D_fore == 0)
* continue;
- * if (W_UWP(d_fore))
+ * if (W_UWP(D_fore))
* {
* check pseudowin buffer
- * if (d_fore->w_pwin->p_inlen < sizeof(d_fore->w_pwin->p_inbuf))
- * FD_SET(d_userfd, rp);
+ * if (D_fore->w_pwin->p_inlen < sizeof(D_fore->w_pwin->p_inbuf))
+ * FD_SET(D_userfd, rp);
* }
* else
* {
* check window buffer
- * if (d_fore->w_inlen < sizeof(d_fore->w_inbuf))
- * FD_SET(d_userfd, rp);
+ * if (D_fore->w_inlen < sizeof(D_fore->w_inbuf))
+ * FD_SET(D_userfd, rp);
* }
*/
}
@@ -263,7 +265,7 @@ fd_set *rp, *wp;
#endif
display = p->w_display;
- if (p->w_active && d_status && !d_status_bell && !(use_hardstatus && HS))
+ if (p->w_active && D_status && !D_status_bell && !(use_hardstatus && D_HS))
continue;
if (p->w_outlen > 0)
continue;
@@ -273,7 +275,7 @@ fd_set *rp, *wp;
* Don't accept input from window or pseudowin if there is to much
* output pending on display .
*/
- if (p->w_active && (d_obufp - d_obuf) > d_obufmax)
+ if (p->w_active && (D_obufp - D_obuf) > D_obufmax)
{
debug1("too much output pending, window %d\n", p->w_number);
continue;
@@ -321,6 +323,7 @@ char **av;
struct timeval tv;
int nsel;
char buf[IOSIZE], *myname = (ac == 0) ? "screen" : av[0];
+ char *SockDir;
struct stat st;
int buflen, tmp;
#ifdef _MODE_T /* (jw) */
@@ -328,7 +331,7 @@ char **av;
#else
int oumask;
#endif
-#ifdef SYSV
+#if defined(SYSV) && !defined(ISC)
struct utsname utsnam;
#endif
struct NewWindow nwin;
@@ -338,6 +341,10 @@ char **av;
char *sockp;
#endif
+#if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX)
+ setcompat(COMPAT_POSIX|COMPAT_BSDPROT); /* turn on seteuid support */
+#endif
+
/*
* First, close all unused descriptors
* (otherwise, we might have problems with the select() call)
@@ -357,6 +364,7 @@ char **av;
#endif
sprintf(version, "%d.%.2d.%.2d%s (%s) %s", REV, VERS,
PATCHLEVEL, STATE, ORIGIN, DATE);
+ nversion = REV * 10000 + VERS * 100 + PATCHLEVEL;
debug2("-- screen debug started %s (%s)\n", *av, version);
#ifdef POSIX
debug("POSIX\n");
@@ -376,8 +384,11 @@ char **av;
#if defined(SIGWINCH) && defined(TIOCGWINSZ)
debug("Window changing enabled\n");
#endif
-#ifdef NOREUID
- debug("NOREUID\n");
+#ifdef HAVE_SETREUID
+ debug("SETREUID\n");
+#endif
+#ifdef HAVE_SETEUID
+ debug("SETEUID\n");
#endif
#ifdef hpux
debug("hpux\n");
@@ -540,7 +551,7 @@ char **av;
lsflag = 1;
if (ac > 1)
{
- SockName = *++av;
+ SockMatch = *++av;
ac--;
}
break;
@@ -586,13 +597,13 @@ char **av;
#endif
if (ap[2])
{
- SockName = ap + 2;
+ SockMatch = ap + 2;
if (ac != 1)
exit_with_usage(myname);
}
else if (ac > 1 && *av[1] != '-')
{
- SockName = *++av;
+ SockMatch = *++av;
ac--;
}
#ifdef MULTI
@@ -610,12 +621,12 @@ char **av;
if (!dflag)
dflag = 2;
if (ap[2])
- SockName = ap + 2;
+ SockMatch = ap + 2;
if (ac == 2)
{
if (*av[1] != '-')
{
- SockName = *++av;
+ SockMatch = *++av;
ac--;
}
}
@@ -640,13 +651,13 @@ char **av;
break;
case 'S':
if (ap[2])
- SockName = ap + 2;
+ SockMatch = ap + 2;
else
{
if (--ac == 0)
exit_with_usage(myname);
- SockName = *++av;
- if (!*SockName)
+ SockMatch = *++av;
+ if (!*SockMatch)
exit_with_usage(myname);
}
break;
@@ -660,7 +671,7 @@ char **av;
else
break;
}
- if (dflag && mflag && SockName && !(rflag || xflag))
+ if (dflag && mflag && SockMatch && !(rflag || xflag))
detached = 1;
nwin = nwin_options;
if (ac)
@@ -680,6 +691,24 @@ char **av;
#endif /* SIGBUS */
signal(SIGSEGV, CoreDump);
}
+
+ /* make the write() calls return -1 on all errors */
+#ifdef SIGXFSZ
+ /*
+ * Ronald F. Guilmette, Oct 29 '94, bug-gnu-utils@prep.ai.mit.edu:
+ * It appears that in System V Release 4, UNIX, if you are writing
+ * an output file and you exceed the currently set file size limit,
+ * you _don't_ just get the call to `write' returning with a
+ * failure code. Rather, you get a signal called `SIGXFSZ' which,
+ * if neither handled nor ignored, will cause your program to crash
+ * with a core dump.
+ */
+ signal(SIGXFSZ, SIG_IGN);
+#endif
+#ifdef SIGPIPE
+ signal(SIGPIPE, SIG_IGN);
+#endif
+
if (!ShellProg)
{
register char *sh;
@@ -691,36 +720,38 @@ char **av;
#ifdef NETHACK
nethackflag = (getenv("NETHACKOPTIONS") != NULL);
#endif
+
#ifdef MULTIUSER
own_uid = multi_uid = real_uid;
- if (SockName && (sockp = index(SockName, '/')))
+ if (SockMatch && (sockp = index(SockMatch, '/')))
{
if (eff_uid)
- Panic(0, "Must run suid root for multi support.");
+ Panic(0, "Must run suid root for multiuser support.");
*sockp = 0;
- multi = SockName;
- SockName = sockp + 1;
+ multi = SockMatch;
+ SockMatch = sockp + 1;
if (*multi)
{
struct passwd *mppp;
- if ((mppp = getpwnam(multi)) == (struct passwd *) 0)
+ if ((mppp = getpwnam(multi)) == (struct passwd *)0)
Panic(0, "Cannot identify account '%s'.", multi);
multi_uid = mppp->pw_uid;
multi_home = SaveStr(mppp->pw_dir);
-#ifdef MULTI
+# ifdef MULTI
if (rflag || lsflag)
{
xflag = 1;
rflag = 0;
}
-#endif
+# endif
detached = 0;
multiattach = 1;
}
}
- if (SockName && *SockName == 0)
- SockName = 0;
-#endif
+ if (SockMatch && *SockMatch == 0)
+ SockMatch = 0;
+#endif /* MULTIUSER */
+
if ((LoginName = getlogin()) && LoginName[0] != '\0')
{
if ((ppp = getpwnam(LoginName)) != (struct passwd *) 0)
@@ -741,12 +772,12 @@ char **av;
}
LoginName = ppp->pw_name;
}
- home = getenv("HOME"); /* may or may not return a result. jw. */
+ home = getenv("HOME");
#if !defined(SOCKDIR) && defined(MULTIUSER)
if (multi && !multiattach)
{
if (home && strcmp(home, ppp->pw_dir))
- Panic(0, "$HOME must match passwd entry for multi screens");
+ Panic(0, "$HOME must match passwd entry for multiuser screens.");
}
#endif
if (home == 0 || *home == '\0')
@@ -783,9 +814,9 @@ char **av;
Panic(0, "Cannot open '%s' - please check.", attach_tty);
close(n);
debug1("attach_tty is %s\n", attach_tty);
- if ((attach_term = getenv("TERM")) == 0)
+ if ((attach_term = getenv("TERM")) == 0 || *attach_term == 0)
Panic(0, "Please set a terminal type.");
- if (strlen(attach_term) > sizeof(d_termname) - 1)
+ if (strlen(attach_term) > sizeof(D_termname) - 1)
Panic(0, "$TERM too long - sorry.");
GetTTY(0, &attach_Mode);
#ifdef DEBUGGGGGGGGGGGGGGG
@@ -852,13 +883,17 @@ char **av;
else
{
SockDir = SOCKDIR;
- if (stat(SockDir, &st))
+ if (lstat(SockDir, &st))
{
if (mkdir(SockDir, eff_uid ? 0777 : 0755) == -1)
Panic(errno, "Cannot make directory '%s'", SockDir);
}
else
{
+ if (!S_ISDIR(st.st_mode))
+ Panic(0, "'%s' must be a directory.", SockDir);
+ if (eff_uid == 0 && st.st_uid != eff_uid)
+ Panic(0, "Directory '%s' must be owned by root.", SockDir);
n = eff_uid ? 0777 : 0755;
if ((st.st_mode & 0777) != n)
Panic(0, "Directory '%s' must have mode %03o.", SockDir, n);
@@ -880,11 +915,7 @@ char **av;
}
else
{
-#ifdef _POSIX_SOURCE
- if (S_ISDIR(st.st_mode) == 0)
-#else
- if ((st.st_mode & S_IFMT) != S_IFDIR)
-#endif
+ if (!S_ISDIR(st.st_mode))
Panic(0, "%s is not a directory.", SockPath);
#ifdef MULTIUSER
if (multi)
@@ -901,43 +932,39 @@ char **av;
if ((st.st_mode & 0777) != 0700)
Panic(0, "Directory %s must have mode 700.", SockPath);
}
- strcat(SockPath, "/");
- SockNamePtr = SockPath + strlen(SockPath);
+ SockName = SockPath + strlen(SockPath) + 1;
+ *SockName = 0;
(void) umask(oumask);
- debug2("SockPath: %s SockName: %s\n", SockPath, SockName ? SockName : "NULL");
+ debug2("SockPath: %s SockMatch: %s\n", SockPath, SockMatch ? SockMatch : "NULL");
#if defined(SYSV) && !defined(ISC)
if (uname(&utsnam) == -1)
- Panic(0, "uname() failed, errno = %d.", errno);
- else
- {
- strncpy(HostName, utsnam.nodename, MAXSTR);
- HostName[(sizeof(utsnam.nodename) <= MAXSTR) ?
- sizeof(utsnam.nodename) : MAXSTR] = '\0';
- }
+ Panic(errno, "uname");
+ strncpy(HostName, utsnam.nodename, sizeof(utsnam.nodename) < MAXSTR ? sizeof(utsnam.nodename) : MAXSTR - 1);
+ HostName[sizeof(utsnam.nodename) < MAXSTR ? sizeof(utsnam.nodename) : MAXSTR - 1] = '\0';
#else
(void) gethostname(HostName, MAXSTR);
-#endif
HostName[MAXSTR - 1] = '\0';
+#endif
if ((ap = index(HostName, '.')) != NULL)
*ap = '\0';
if (lsflag)
{
- int i;
+ int i, fo;
#ifdef MULTIUSER
if (multi)
real_uid = multi_uid;
+#endif
setuid(real_uid);
setgid(real_gid);
eff_uid = real_uid;
eff_gid = real_gid;
-#endif
- i = FindSocket(0, (int *)NULL);
- /* MakeClientSocket appended the last (Sock)Name there: */
- *SockNamePtr = '\0';
- if (i == 0)
+ i = FindSocket((int *)NULL, &fo, SockMatch);
+ if (quietflag)
+ exit(10 + i);
+ if (fo == 0)
{
#ifdef NETHACK
if (nethackflag)
@@ -946,7 +973,7 @@ char **av;
#endif /* NETHACK */
Panic(0, "No Sockets found in %s.\n", SockPath);
}
- Panic(0, "%d Socket%s in %s.\n", i, i > 1 ? "s" : "", SockPath);
+ Panic(0, "%d Socket%s in %s.\n", fo, fo > 1 ? "s" : "", SockPath);
/* NOTREACHED */
}
signal(SIG_BYE, AttacherFinit); /* prevent races */
@@ -970,10 +997,9 @@ char **av;
eexit(0);
/* NOTREACHED */
}
- if (!SockName && !mflag)
+ if (!SockMatch && !mflag)
{
register char *sty;
- int s;
if ((sty = getenv("STY")) != 0 && *sty != '\0')
{
@@ -981,19 +1007,13 @@ char **av;
setgid(real_gid);
eff_uid = real_uid;
eff_gid = real_gid;
- if ((s = MakeClientSocket(1, sty)) > 0)
- {
- nwin_options.args = av;
- SendCreateMsg(s, &nwin);
- close(s);
- }
+ nwin_options.args = av;
+ SendCreateMsg(sty, &nwin);
exit(0);
/* NOTREACHED */
}
}
nwin_compose(&nwin_default, &nwin_options, &nwin_default);
- if (SockName && !*SockName)
- SockName = NULL;
switch (MasterPid = fork())
{
case -1:
@@ -1011,20 +1031,18 @@ char **av;
#endif
if (detached)
exit(0);
- if (SockName)
- {
- /* user started us with -S option */
- sprintf(socknamebuf, "%d.%s", MasterPid, SockName);
- }
+ if (SockMatch)
+ sprintf(socknamebuf, "%d.%s", MasterPid, SockMatch);
else
- {
- sprintf(socknamebuf, "%d.%s.%s", MasterPid, stripdev(attach_tty),
- HostName);
- }
+ sprintf(socknamebuf, "%d.%s.%s", MasterPid, stripdev(attach_tty), HostName);
for (ap = socknamebuf; *ap; ap++)
if (*ap == '/')
*ap = '-';
- SockName = socknamebuf;
+#ifdef NAME_MAX
+ if (strlen(socknamebuf) > NAME_MAX)
+ socknamebuf[NAME_MAX] = 0;
+#endif
+ sprintf(SockPath + strlen(SockPath), "/%s", socknamebuf);
#ifdef SHADOWPW
setspent(); /* open shadow file while we are still root */
#endif /* SHADOWPW */
@@ -1063,7 +1081,11 @@ char **av;
}
#endif
if (!detached)
- n = dup(0);
+ {
+ /* reopen tty. must do this, because fd 0 may be RDONLY */
+ if ((n = secopen(attach_tty, O_RDWR, 0)) < 0)
+ Panic(0, "Cannot reopen '%s' - please check.", attach_tty);
+ }
else
n = -1;
freopen("/dev/null", "r", stdin);
@@ -1084,21 +1106,30 @@ char **av;
Panic(0, "Could not alloc display");
}
- if (SockName)
+ if (SockMatch)
{
/* user started us with -S option */
- sprintf(socknamebuf, "%d.%s", getpid(), SockName);
+ sprintf(socknamebuf, "%d.%s", (int)getpid(), SockMatch);
}
else
{
- sprintf(socknamebuf, "%d.%s.%s", getpid(), stripdev(attach_tty),
+ sprintf(socknamebuf, "%d.%s.%s", (int)getpid(), stripdev(attach_tty),
HostName);
}
for (ap = socknamebuf; *ap; ap++)
if (*ap == '/')
*ap = '-';
- SockName = socknamebuf;
+#ifdef NAME_MAX
+ if (strlen(socknamebuf) > NAME_MAX)
+ {
+ debug2("Socketname %s truncated to %d chars\n", socknamebuf, NAME_MAX);
+ socknamebuf[NAME_MAX] = 0;
+ }
+#endif
+ sprintf(SockPath + strlen(SockPath), "/%s", socknamebuf);
+
ServerSocket = MakeServerSocket();
+ InitKeytab();
#ifdef ETCSCREENRC
# ifdef ALLOW_SYSSCREENRC
if ((ap = getenv("SYSSCREENRC")))
@@ -1118,10 +1149,10 @@ char **av;
if (InitTermcap(0, 0))
{
debug("Could not init termcap - exiting\n");
- fcntl(d_userfd, F_SETFL, 0); /* Flush sets NDELAY */
+ fcntl(D_userfd, F_SETFL, 0); /* Flush sets FNBLOCK */
freetty();
- if (d_userpid)
- Kill(d_userpid, SIG_BYE);
+ if (D_userpid)
+ Kill(D_userpid, SIG_BYE);
eexit(1);
}
InitTerm(0);
@@ -1138,22 +1169,21 @@ char **av;
#endif /* LOADAV */
MakeNewEnv();
signal(SIGHUP, SigHup);
- signal(SIGINT, Finit);
- signal(SIGQUIT, Finit);
- signal(SIGTERM, Finit);
+ signal(SIGINT, FinitHandler);
+ signal(SIGQUIT, FinitHandler);
+ signal(SIGTERM, FinitHandler);
#ifdef BSDJOBS
signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
#endif
- InitKeytab();
if (display)
{
- brktty(d_userfd);
- SetMode(&d_OldMode, &d_NewMode);
+ brktty(D_userfd);
+ SetMode(&D_OldMode, &D_NewMode);
/* Note: SetMode must be called _before_ FinishRc. */
- SetTTY(d_userfd, &d_NewMode);
- if (fcntl(d_userfd, F_SETFL, FNDELAY))
- Msg(errno, "Warning: NDELAY fcntl failed");
+ SetTTY(D_userfd, &D_NewMode);
+ if (fcntl(D_userfd, F_SETFL, FNBLOCK))
+ Msg(errno, "Warning: NBLOCK fcntl failed");
}
else
brktty(-1); /* just try */
@@ -1218,8 +1248,8 @@ char **av;
}
else
{
- for (display = displays; display; display = display->_d_next)
- if (p != d_fore)
+ for (display = displays; display; display = display->d_next)
+ if (p != D_fore)
Msg(0, "Window %d: silence for %d seconds",
p->w_number, p->w_tstamp.seconds);
p->w_tstamp.lastio = Now;
@@ -1229,14 +1259,14 @@ char **av;
/*
* check to see if message line should be removed
*/
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
{
int time_left;
- if (d_status == 0)
+ if (D_status == 0)
continue;
debug("checking status...\n");
- time_left = d_status_time + (d_status_bell?VBellWait:MsgWait) - Now;
+ time_left = D_status_time + (D_status_bell?VBellWait:MsgWait) - Now;
if (time_left > 0)
{
if (tv.tv_sec == 0 || time_left < tv.tv_sec)
@@ -1250,6 +1280,31 @@ char **av;
}
}
/*
+ * check to see if a mapping timeout should happen
+ */
+#ifdef MAPKEYS
+ tv.tv_usec = 0;
+ for (display = displays; display; display = display->d_next)
+ if (D_seql)
+ {
+ int j;
+ struct kmap *km;
+
+ km = (struct kmap *)(D_seqp - D_seql - KMAP_SEQ);
+ j = *(D_seqp - 1 + (KMAP_OFF - KMAP_SEQ));
+ if (j == 0)
+ j = D_nseqs - (km - D_kmaps);
+ for (; j; km++, j--)
+ if (km->nr & KMAP_NOTIMEOUT)
+ break;
+ if (j)
+ continue;
+ tv.tv_sec = 0;
+ tv.tv_usec = maptimeout;
+ break;
+ }
+#endif
+ /*
* check for I/O on all available I/O descriptors
*/
#ifdef DEBUG
@@ -1262,14 +1317,57 @@ char **av;
SigChldHandler();
continue;
}
- if ((nsel = select(FD_SETSIZE, &r, &w, (fd_set *)0, tv.tv_sec ? &tv : (struct timeval *) 0)) < 0)
+ if ((nsel = select(FD_SETSIZE, &r, &w, (fd_set *)0, (tv.tv_sec || tv.tv_usec) ? &tv : (struct timeval *) 0)) < 0)
{
debug1("Bad select - errno %d\n", errno);
+#if defined(sgi) && defined(SVR4)
+ /* Ugly workaround for braindead IRIX5.2 select.
+ * read() should return EIO, not select()!
+ */
+ if (errno == EIO)
+ {
+ debug("IRIX5.2 workaround: searching for bad display\n");
+ for (display = displays; display; )
+ {
+ FD_ZERO(&r);
+ FD_ZERO(&w);
+ FD_SET(D_userfd, &r);
+ FD_SET(D_userfd, &w);
+ tv.tv_sec = tv.tv_usec = 0;
+ if (select(FD_SETSIZE, &r, &w, (fd_set *)0, &tv) == -1)
+ {
+ if (errno == EINTR)
+ continue;
+ SigHup(SIGARG);
+ break;
+ }
+ display = display->d_next;
+ }
+ }
+ else
+#endif
if (errno != EINTR)
Panic(errno, "select");
errno = 0;
nsel = 0;
}
+#ifdef MAPKEYS
+ else
+ for (display = displays; display; display = display->d_next)
+ {
+ if (D_seql == 0)
+ continue;
+ if ((nsel == 0 && tv.tv_sec == 0 && tv.tv_usec) || D_seqruns++ * 50000 > maptimeout)
+ {
+ debug1("Flushing map sequence (%d runs)\n", D_seqruns);
+ fore = D_fore;
+ D_seqp -= D_seql;
+ while (D_seql)
+ Process(&D_seqp, &D_seql);
+ D_seqp = D_kmaps[0].seq;
+ }
+ }
+#endif
#ifdef SELECT_BROKEN
/*
* Sequents select emulation counts an descriptor which is
@@ -1420,29 +1518,29 @@ char **av;
{
int maxlen;
- ndisplay = display->_d_next;
+ ndisplay = display->d_next;
/*
- * stuff d_obuf into user's tty
+ * stuff D_obuf into user's tty
*/
- if (FD_ISSET(d_userfd, &w))
+ if (FD_ISSET(D_userfd, &w))
{
int size = OUTPUT_BLOCK_SIZE;
- len = d_obufp - d_obuf;
+ len = D_obufp - D_obuf;
if (len < size)
size = len;
ASSERT(len >= 0);
- size = write(d_userfd, d_obuf, size);
+ size = write(D_userfd, D_obuf, size);
if (size >= 0)
{
len -= size;
if (len)
{
- bcopy(d_obuf + size, d_obuf, len);
+ bcopy(D_obuf + size, D_obuf, len);
debug2("ASYNC: wrote %d - remaining %d\n", size, len);
}
- d_obufp -= size;
- d_obuffree += size;
+ D_obufp -= size;
+ D_obuffree += size;
}
else
{
@@ -1459,35 +1557,26 @@ char **av;
* O.k. All streams are fed, now look what comes back
* to us. First of all: user input.
*/
- if (! FD_ISSET(d_userfd, &r))
+ if (! FD_ISSET(D_userfd, &r))
continue;
- if (d_status && !(use_hardstatus && HS))
+ if (D_status && !(use_hardstatus && D_HS))
RemoveStatus();
- if (d_fore == 0)
+ if (D_fore == 0)
maxlen = IOSIZE;
else
{
#ifdef PSEUDOS
- if (W_UWP(d_fore))
- maxlen = sizeof(d_fore->w_pwin->p_inbuf) - d_fore->w_pwin->p_inlen;
+ if (W_UWP(D_fore))
+ maxlen = sizeof(D_fore->w_pwin->p_inbuf) - D_fore->w_pwin->p_inlen;
else
#endif
- maxlen = sizeof(d_fore->w_inbuf) - d_fore->w_inlen;
+ maxlen = sizeof(D_fore->w_inbuf) - D_fore->w_inlen;
}
if (maxlen > IOSIZE)
maxlen = IOSIZE;
if (maxlen <= 0)
maxlen = 1; /* Allow one char for command keys */
- if (d_ESCseen)
- {
- if (maxlen == 1)
- maxlen = 2; /* Allow one char for command keys */
- buf[0] = d_user->u_Esc;
- buflen = read(d_userfd, buf + 1, maxlen - 1) + 1;
- d_ESCseen = 0;
- }
- else
- buflen = read(d_userfd, buf, maxlen);
+ buflen = read(D_userfd, buf, maxlen);
if (buflen < 0)
{
if (errno == EINTR)
@@ -1638,14 +1727,14 @@ char **av;
if (p->w_bell == BELL_ON)
{
p->w_bell = BELL_MSG;
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
Msg(0, MakeWinMsg(BellString, p->w_number));
if (p->w_monitor == MON_FOUND)
p->w_monitor = MON_DONE;
}
else if (p->w_bell == BELL_VISUAL)
{
- if (display && !d_status_bell)
+ if (display && !D_status_bell)
{
/*
* Stop the '!' appearing in the ^A^W display if it is an
@@ -1653,18 +1742,18 @@ char **av;
*/
p->w_bell = BELL_OFF;
Msg(0, VisualBellString);
- if (d_status)
- d_status_bell = 1;
+ if (D_status)
+ D_status_bell = 1;
}
}
if (p->w_monitor == MON_FOUND)
{
p->w_monitor = MON_MSG;
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
Msg(0, MakeWinMsg(ActivityString, p->w_number));
}
}
-#if defined(DEBUG) && !defined(_SEQUENT_)
+#if defined(DEBUG) && !defined(SELECT_BROKEN)
if (nsel)
debug1("*** Left over nsel: %d\n", nsel);
#endif
@@ -1676,14 +1765,15 @@ static void
WindowDied(p)
struct win *p;
{
- if (ZombieKey)
+ if (ZombieKey_destroy)
{
- char buf[100];
- struct tm *tp;
+ char buf[100], *s;
time_t now;
(void) time(&now);
- tp = localtime(&now);
+ s = ctime(&now);
+ if (s && *s)
+ s[strlen(s) - 1] = '\0';
debug3("window %d (%s) going into zombie state fd %d",
p->w_number, p->w_title, p->w_ptyfd);
#ifdef UTMPOK
@@ -1696,7 +1786,7 @@ struct win *p;
p->w_pid = 0;
ResetWindow(p);
p->w_y = p->w_bot;
- sprintf(buf, "\n=== Window terminated at %2d:%02d:%02d ===", tp->tm_hour, tp->tm_min, tp->tm_sec);
+ sprintf(buf, "\n\r=== Window terminated (%s) ===", s ? s : "?");
WriteString(p, buf, strlen(buf));
}
else
@@ -1730,43 +1820,39 @@ SigChldHandler()
debug2("SigChldHandler: stat '%s' o.k. (%03o)\n", SockPath, st.st_mode);
}
-static sig_t
-SigChld(SIGDEFARG)
+static sigret_t
+SigChld SIGDEFARG
{
debug("SigChld()\n");
GotSigChld = 1;
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
-sig_t
-SigHup(SIGDEFARG)
+sigret_t
+SigHup SIGDEFARG
{
if (display == 0)
return;
debug("SigHup()\n");
- if (d_userfd >= 0)
+ if (D_userfd >= 0)
{
- close(d_userfd);
- d_userfd = -1;
+ close(D_userfd);
+ D_userfd = -1;
}
- if (auto_detach || displays->_d_next)
+ if (auto_detach || displays->d_next)
Detach(D_DETACH);
else
Finit(0);
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
/*
* the backend's Interrupt handler
- * we cannot d_insert the intrc directly, as we never know
+ * we cannot D_insert the intrc directly, as we never know
* if fore is valid.
*/
-static sig_t
-SigInt(SIGDEFARG)
+static sigret_t
+SigInt SIGDEFARG
{
#if HAZARDOUS
char buf[1];
@@ -1782,45 +1868,44 @@ SigInt(SIGDEFARG)
debug("SigInt() careful\n");
InterruptPlease = 1;
#endif
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
-static sig_t
-CoreDump(sig)
-int sig;
+static sigret_t
+CoreDump SIGDEFARG
{
struct display *disp;
char buf[80];
-#ifdef SYSVSIGS
- signal(sig, SIG_IGN);
-#endif /* SYSV */
+#if defined(SYSVSIGS) && defined(SIGHASARG)
+ signal(sigsig, SIG_IGN);
+#endif
setgid(getgid());
setuid(getuid());
unlink("core");
- sprintf(buf, "\r\n[screen caught signal %d.%s]\r\n", sig,
+#ifdef SIGHASARG
+ sprintf(buf, "\r\n[screen caught signal %d.%s]\r\n", sigsig,
+#else
+ sprintf(buf, "\r\n[screen caught a fatal signal.%s]\r\n",
+#endif
#if defined(SHADOWPW) && !defined(DEBUG) && !defined(DUMPSHADOW)
""
#else /* SHADOWPW && !DEBUG */
" (core dumped)"
#endif /* SHADOWPW && !DEBUG */
);
- for (disp = displays; disp; disp = disp->_d_next)
+ for (disp = displays; disp; disp = disp->d_next)
{
- fcntl(disp->_d_userfd, F_SETFL, 0);
- write(disp->_d_userfd, buf, strlen(buf));
- Kill(disp->_d_userpid, SIG_BYE);
+ fcntl(disp->d_userfd, F_SETFL, 0);
+ write(disp->d_userfd, buf, strlen(buf));
+ Kill(disp->d_userpid, SIG_BYE);
}
#if defined(SHADOWPW) && !defined(DEBUG) && !defined(DUMPSHADOW)
- eexit(sig);
+ eexit(11);
#else /* SHADOWPW && !DEBUG */
abort();
#endif /* SHADOWPW && !DEBUG */
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
+ SIGRETURN;
}
static void
@@ -1880,7 +1965,7 @@ DoWait()
}
#endif
/* Try to restart process */
-# ifdef NETHACK
+# ifdef NETHACK
if (nethackflag)
Msg(0, "You regain consciousness.");
else
@@ -1913,7 +1998,14 @@ DoWait()
}
-sig_t
+static sigret_t
+FinitHandler SIGDEFARG
+{
+ Finit(1);
+ SIGRETURN;
+}
+
+void
Finit(i)
int i;
{
@@ -1930,19 +2022,19 @@ int i;
if (ServerSocket != -1)
{
debug1("we unlink(%s)\n", SockPath);
-#ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
+#ifdef USE_SETEUID
+ xseteuid(real_uid);
+ xsetegid(real_gid);
#endif
(void) unlink(SockPath);
-#ifndef NOREUID
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
+#ifdef USE_SETEUID
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
#endif
}
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
{
- if (d_status)
+ if (D_status)
RemoveStatus();
FinitTerm();
#ifdef UTMPOK
@@ -1950,25 +2042,23 @@ int i;
#endif
AddStr("[screen is terminating]\r\n");
Flush();
- SetTTY(d_userfd, &d_OldMode);
- fcntl(d_userfd, F_SETFL, 0);
+ SetTTY(D_userfd, &D_OldMode);
+ fcntl(D_userfd, F_SETFL, 0);
freetty();
- Kill(d_userpid, SIG_BYE);
+ Kill(D_userpid, SIG_BYE);
}
/*
* we _cannot_ call eexit(i) here,
* instead of playing with the Socket above. Sigh.
*/
exit(i);
-#ifndef SIGVOID
- return((sig_t) 0);
-#endif
}
void
eexit(e)
int e;
{
+ debug("eexit\n");
if (ServerSocket != -1)
{
debug1("we unlink(%s)\n", SockPath);
@@ -2005,7 +2095,7 @@ int mode;
return;
signal(SIGHUP, SIG_IGN);
debug1("Detach(%d)\n", mode);
- if (d_status)
+ if (D_status)
RemoveStatus();
FinitTerm();
switch (mode)
@@ -2054,7 +2144,7 @@ int mode;
break;
}
#ifdef UTMPOK
- if (displays->_d_next == 0)
+ if (displays->d_next == 0)
{
for (p = windows; p; p = p->w_next)
if (p->w_slot != (slot_t) -1)
@@ -2078,27 +2168,27 @@ int mode;
}
RestoreLoginSlot();
#endif
- if (d_fore)
+ if (D_fore)
{
- ReleaseAutoWritelock(display, d_fore);
- if (d_fore->w_tstamp.seconds)
- d_fore->w_tstamp.lastio = Now;
- d_fore->w_active = 0;
- d_fore->w_display = 0;
- d_lay = &BlankLayer;
- d_layfn = d_lay->l_layfn;
- d_user->u_detachwin = d_fore->w_number;
+ ReleaseAutoWritelock(display, D_fore);
+ if (D_fore->w_tstamp.seconds)
+ D_fore->w_tstamp.lastio = Now;
+ D_fore->w_active = 0;
+ D_fore->w_display = 0;
+ D_lay = &BlankLayer;
+ D_layfn = D_lay->l_layfn;
+ D_user->u_detachwin = D_fore->w_number;
}
- while (d_lay != &BlankLayer)
+ while (D_lay != &BlankLayer)
ExitOverlayPage();
- if (d_userfd >= 0)
+ if (D_userfd >= 0)
{
Flush();
- SetTTY(d_userfd, &d_OldMode);
- fcntl(d_userfd, F_SETFL, 0);
+ SetTTY(D_userfd, &D_OldMode);
+ fcntl(D_userfd, F_SETFL, 0);
}
freetty();
- pid = d_userpid;
+ pid = D_userpid;
debug2("display: %#x displays: %#x\n", (unsigned int)display, (unsigned int)displays);
FreeDisplay();
if (displays == 0)
@@ -2134,14 +2224,11 @@ MakeNewEnv()
for (op = environ; *op; ++op)
;
if (NewEnv)
- free(NewEnv);
+ free((char *)NewEnv);
NewEnv = np = (char **) malloc((unsigned) (op - environ + 7 + 1) * sizeof(char **));
if (!NewEnv)
Panic(0, strnomem);
- SockName = SockNamePtr;
- if (strlen(SockNamePtr) > MAXSTR - 5)
- SockName = "?";
- sprintf(stybuf, "STY=%s", SockNamePtr);
+ sprintf(stybuf, "STY=%s", strlen(SockName) <= MAXSTR - 5 ? SockName : "?");
*np++ = stybuf; /* NewEnv[0] */
*np++ = Term; /* NewEnv[1] */
np++; /* room for SHELL */
@@ -2202,17 +2289,14 @@ unsigned long p1, p2, p3, p4, p5, p6;
if (err)
{
p += strlen(p);
- if (err > 0 && err < sys_nerr)
- sprintf(p, ": %s", sys_errlist[err]);
- else
- sprintf(p, ": Error %d", err);
+ sprintf(p, ": %s", strerror(err));
}
debug2("Msg('%s') (%#x);\n", buf, (unsigned int)display);
if (display)
MakeStatus(buf);
else if (displays)
{
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
MakeStatus(buf);
}
else
@@ -2257,39 +2341,37 @@ unsigned long p1, p2, p3, p4, p5, p6;
if (err)
{
p += strlen(p);
- if (err > 0 && err < sys_nerr)
- sprintf(p, ": %s", sys_errlist[err]);
- else
- sprintf(p, ": Error %d", err);
+ sprintf(p, ": %s", strerror(err));
}
debug1("Panic('%s');\n", buf);
if (displays == 0)
printf("%s\r\n", buf);
else
- for (display = displays; display; display = display->_d_next)
+ for (display = displays; display; display = display->d_next)
{
- if (d_status)
+ if (D_status)
RemoveStatus();
FinitTerm();
Flush();
#ifdef UTMPOK
RestoreLoginSlot();
#endif
- SetTTY(d_userfd, &d_OldMode);
- fcntl(d_userfd, F_SETFL, 0);
- write(d_userfd, buf, strlen(buf));
- write(d_userfd, "\n", 1);
+ SetTTY(D_userfd, &D_OldMode);
+ fcntl(D_userfd, F_SETFL, 0);
+ write(D_userfd, buf, strlen(buf));
+ write(D_userfd, "\n", 1);
freetty();
- if (d_userpid)
- Kill(d_userpid, SIG_BYE);
+ if (D_userpid)
+ Kill(D_userpid, SIG_BYE);
}
#ifdef MULTIUSER
if (tty_oldmode >= 0)
{
-# ifdef NOREUID
- setuid(eff_uid);
+# ifdef USE_SETEUID
+ if (setuid(own_uid))
+ xseteuid(own_uid); /* XXX: may be a loop. sigh. */
# else
- setreuid(real_uid, eff_uid);
+ setuid(own_uid);
# endif
debug1("Panic: changing back modes from %s\n", attach_tty);
chmod(attach_tty, tty_oldmode);
@@ -2362,11 +2444,11 @@ int n;
t.tv_usec = 0;
t.tv_sec = n;
FD_ZERO(&r);
- FD_SET(d_userfd, &r);
+ FD_SET(D_userfd, &r);
if (select(FD_SETSIZE, &r, (fd_set *)0, (fd_set *)0, &t) > 0)
{
debug("display activity stopped sleep\n");
- read(d_userfd, &buf, 1);
+ read(D_userfd, &buf, 1);
}
debug1("DisplaySleep(%d) ending\n", n);
}
diff --git a/src/screen.h b/src/screen.h
index 5c03f78..017af90 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -107,6 +107,11 @@ struct mode
#else /* POSIX */
# ifdef TERMIO
struct termio tio;
+# ifdef CYTERMIO
+ int m_mapkey;
+ int m_mapscreen;
+ int m_backspace;
+# endif
# else /* TERMIO */
struct sgttyb m_ttyb;
struct tchars m_tchars;
@@ -114,6 +119,10 @@ struct mode
int m_ldisc;
int m_lmode;
# endif /* TERMIO */
+#if defined(KANJI) && defined(TIOCKSET)
+ struct jtchars m_jtchars;
+ int m_knjmode;
+# endif
#endif /* POSIX */
};
@@ -213,21 +222,6 @@ struct msg
extern char strnomem[];
-
-struct NewWindow
-{
- int StartAt; /* where to start the search for the slot */
- char *aka; /* aka string */
- char **args; /* argv vector */
- char *dir; /* directory for chdir */
- char *term; /* TERM to be set instead of "screen" */
- int aflag;
- int flowflag;
- int lflag;
- int histheight;
- int monitor;
-};
-
/*
* line modes used by Input()
*/
diff --git a/src/search.c b/src/search.c
index 1de4342..25610ed 100644
--- a/src/search.c
+++ b/src/search.c
@@ -50,7 +50,7 @@ int dir;
struct markdata *markdata;
if (dir == 0)
{
- markdata = (struct markdata *)d_lay->l_data;
+ markdata = (struct markdata *)D_lay->l_data;
if (markdata->isdir > 0)
searchend(0, 0);
else if (markdata->isdir < 0)
@@ -70,18 +70,18 @@ int len;
int x = 0, sx, ex, y;
struct markdata *markdata;
- markdata = (struct markdata *)d_lay->l_data;
+ markdata = (struct markdata *)D_lay->l_data;
markdata->isdir = 1;
if (len)
strcpy(markdata->isstr, buf);
sx = markdata->cx + 1;
- ex = d_width - 1;
- for (y = markdata->cy; y < fore->w_histheight + d_height; y++, sx = 0)
+ ex = D_width - 1;
+ for (y = markdata->cy; y < fore->w_histheight + D_height; y++, sx = 0)
{
if ((x = matchword(markdata->isstr, y, sx, ex)) >= 0)
break;
}
- if (y >= fore->w_histheight + d_height)
+ if (y >= fore->w_histheight + D_height)
{
GotoPos(markdata->cx, W2D(markdata->cy));
Msg(0, "Pattern not found");
@@ -98,12 +98,12 @@ int len;
int sx, ex, x = -1, y;
struct markdata *markdata;
- markdata = (struct markdata *)d_lay->l_data;
+ markdata = (struct markdata *)D_lay->l_data;
markdata->isdir = -1;
if (len)
strcpy(markdata->isstr, buf);
ex = markdata->cx - 1;
- for (y = markdata->cy; y >= 0; y--, ex = d_width - 1)
+ for (y = markdata->cy; y >= 0; y--, ex = D_width - 1)
{
sx = 0;
while ((sx = matchword(markdata->isstr, y, sx, ex)) >= 0)
@@ -128,7 +128,7 @@ int y, sx, ex;
char *ip, *ipe, *cp, *pp;
ip = iWIN(y) + sx;
- ipe = iWIN(y) + d_width;
+ ipe = iWIN(y) + D_width;
for (;sx <= ex; sx++)
{
cp = ip++;
@@ -166,7 +166,7 @@ int l, p, end, dir;
int tab[256];
int i, q;
char *s, c;
- int w = d_width;
+ int w = D_width;
debug2("is_bm: searching for %s len %d\n", str, l);
debug3("start at %d end %d dir %d\n", p, end, dir);
@@ -215,10 +215,10 @@ int n;
if (n == 0)
return;
- markdata = (struct markdata *)d_lay->l_next->l_data;
+ markdata = (struct markdata *)D_lay->l_next->l_data;
ASSERT(p);
- pos = markdata->cx + markdata->cy * d_width;
+ pos = markdata->cx + markdata->cy * D_width;
GotoPos(markdata->cx, W2D(markdata->cy));
switch (*p)
@@ -266,14 +266,14 @@ int n;
debug2("New char: %c - left %d\n", *p, sizeof(markdata->isistr) - markdata->isistrl);
}
if (*p && *p != '\b')
- pos = is_bm(markdata->isstr, markdata->isstrl, pos, d_width * (fore->w_histheight + d_height), markdata->isdir);
+ pos = is_bm(markdata->isstr, markdata->isstrl, pos, D_width * (fore->w_histheight + D_height), markdata->isdir);
if (pos >= 0)
{
- x = pos % d_width;
- y = pos / d_width;
+ x = pos % D_width;
+ y = pos / D_width;
LAY_CALL_UP
(
- RefreshLine(STATLINE, 0, d_width - 1, 0);
+ RefreshLine(STATLINE, 0, D_width - 1, 0);
revto(x, y);
if (W2D(markdata->cy) == STATLINE)
{
@@ -290,27 +290,31 @@ static int
is_redo(markdata)
struct markdata *markdata;
{
- int i, pos, dir;
+ int i, pos, npos, dir;
char c;
- pos = markdata->isstartpos;
+ npos = pos = markdata->isstartpos;
dir = markdata->isstartdir;
markdata->isstrl = 0;
for (i = 0; i < markdata->isistrl; i++)
{
c = markdata->isistr[i];
- if (c == '\022')
+ if (c == '\022') /* ^R */
pos += (dir = -1);
- else if (c == '\023')
+ else if (c == '\023') /* ^S */
pos += (dir = 1);
else
markdata->isstr[markdata->isstrl++] = c;
if (pos >= 0)
- pos = is_bm(markdata->isstr, markdata->isstrl, pos, d_width * (fore->w_histheight + d_height), dir);
+ {
+ npos = is_bm(markdata->isstr, markdata->isstrl, pos, D_width * (fore->w_histheight + D_height), dir);
+ if (npos >= 0)
+ pos = npos;
+ }
}
markdata->isstr[markdata->isstrl] = 0;
markdata->isdir = dir;
- return pos;
+ return npos;
}
void
@@ -318,9 +322,9 @@ ISearch(dir)
int dir;
{
struct markdata *markdata;
- markdata = (struct markdata *)d_lay->l_data;
+ markdata = (struct markdata *)D_lay->l_data;
markdata->isdir = markdata->isstartdir = dir;
- markdata->isstartpos = markdata->cx + markdata->cy * d_width;
+ markdata->isstartpos = markdata->cx + markdata->cy * D_width;
markdata->isistrl = markdata->isstrl = 0;
if (W2D(markdata->cy) == STATLINE)
{
diff --git a/src/socket.c b/src/socket.c
index 3d30a66..4c38fab 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -26,17 +26,15 @@ RCS_ID("$Id$ FAU")
#include "config.h"
#include <sys/types.h>
#include <sys/stat.h>
-#ifndef sgi
-# include <sys/file.h>
-#endif
-#ifndef NAMEDPIPE
-#include <sys/socket.h>
-#endif
#include <fcntl.h>
-#ifndef NAMEDPIPE
+#if !defined(NAMEDPIPE)
+#include <sys/socket.h>
#include <sys/un.h>
#endif
-#include <signal.h>
+
+#ifndef SIGINT
+# include <signal.h>
+#endif
#include "screen.h"
@@ -49,11 +47,14 @@ RCS_ID("$Id$ FAU")
#include "extern.h"
+static int CheckPid __P((int));
+static void ExecCreate __P((struct msg *));
#if defined(_SEQUENT_) && !defined(NAMEDPIPE)
# define connect sconnect /* _SEQUENT_ has braindamaged connect */
-static int sconnect __P((int, struct sockaddr *, int));
+static int sconnect __P((int, struct sockaddr *, int));
#endif
+
extern char *RcFileName, *extra_incap, *extra_outcap;
extern int ServerSocket, real_uid, real_gid, eff_uid, eff_gid;
extern int dflag, iflag, rflag, lsflag, quietflag, wipeflag, xflag;
@@ -74,8 +75,7 @@ extern char Password[];
#endif
extern char *getenv();
-char SockPath[MAXPATHLEN];
-char *SockNamePtr, *SockName;
+extern char SockPath[];
#ifdef MULTIUSER
# define SOCKMODE (S_IWRITE | S_IREAD | (displays ? S_IEXEC : 0) | (multi ? 1 : 0))
@@ -83,348 +83,304 @@ char *SockNamePtr, *SockName;
# define SOCKMODE (S_IWRITE | S_IREAD | (displays ? S_IEXEC : 0))
#endif
-int
-RecoverSocket()
-{
-#ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
-#endif
- (void) unlink(SockPath);
-#ifndef NOREUID
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
-#endif
- close(ServerSocket);
- if ((ServerSocket = MakeServerSocket()) < 0)
- return 0;
- return 1;
-}
/*
- * Socket mode 700 means we are Attached. 600 is detached.
- * We return how many sockets we found. If it was exactly one, we come
- * back with a SockPath set to it and open it in a fd pointed to by fdp.
- * If fdp == 0 we simply produce a list if all sockets.
+ * Socket directory manager
+ *
+ * fdp: pointer to store the first good socket.
+ * nfoundp: pointer to store the number of sockets found.
+ * match: string to match socket name.
+ *
+ * The socket directory must be in SockPath!
+ *
+ * Returns: number of good sockets.
+ *
+ * The first good socket is stored in fdp and its name is
+ * appended to SockPath.
+ * If none exists or fdp is NULL SockPath is not changed.
+ *
*/
-/* ARGSUSED */
+
int
-FindSocket(how, fdp)
-int how;
+FindSocket(fdp, nfoundp, match)
int *fdp;
+int *nfoundp;
+char *match;
{
- register int s, lasts = 0, found = 0, deadcount = 0, wipecount = 0;
- register int l = 0;
- register DIR *dirp;
- register struct dirent *dp;
- register char *Name;
+ DIR *dirp;
+ struct dirent *dp;
struct stat st;
- struct foundsock
+ int mode;
+ int sdirlen;
+ int matchlen = 0;
+ char *name, *n;
+ int firsts = -1, s;
+ char *firstn = 0;
+ int nfound = 0, ngood = 0, ndead = 0, nwipe = 0;
+ struct sent
{
- char *name;
+ struct sent *next;
int mode;
- } foundsock[100]; /* 100 is hopefully enough. */
- int foundsockcount = 0;
-
- /* User may or may not give us a (prefix) SockName. We want to search. */
- debug("FindSocket:\n");
- if (SockName)
+ char *name;
+ } *slist, **slisttail, *sent, *nsent;
+
+ if (match)
{
- debug1("We want to match '%s'\n", SockName);
- l = strlen(SockName);
+ matchlen = strlen(match);
#ifdef NAME_MAX
- if (l > NAME_MAX)
- l = NAME_MAX;
+ if (matchlen > NAME_MAX)
+ matchlen = NAME_MAX;
#endif
}
-#ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
-#endif
- debug1("FindSock searching... '%s'\n", SockPath);
/*
- * this is a hack: SockName may point to Filename(Sockpath)...
+ * SockPath contains the socket directory.
+ * At the end of FindSocket the socket name will be appended to it.
+ * Thus FindSocket() can only be called once!
*/
- found = *SockNamePtr;
- *SockNamePtr = '\0';
- if ((dirp = opendir(SockPath)) == NULL)
- {
- Panic(0, "Cannot opendir %s", SockPath);
- /* NOTREACHED */
- }
- *SockNamePtr = found;
- found = 0;
- while ((dp = readdir(dirp)) != NULL)
+ sdirlen = strlen(SockPath);
+
+#ifdef USE_SETEUID
+ xseteuid(real_uid);
+ xsetegid(real_gid);
+#endif
+
+ if ((dirp = opendir(SockPath)) == 0)
+ Panic(errno, "Cannot opendir %s\n", SockPath);
+
+ slist = 0;
+ slisttail = &slist;
+ while ((dp = readdir(dirp)))
{
- Name = dp->d_name;
- /*
- * there may be a file ".termcap" here.
- * Ignore it just like "." and "..".
- */
- debug1("- %s\n", Name);
- if (Name[0] == '.')
+ name = dp->d_name;
+ debug1("- %s\n", name);
+ if (*name == 0 || *name == '.')
continue;
- if (SockName && l)
+ if (matchlen)
{
- register char *n = Name;
-
- debug2("Attach found: '%s', needed '%s'\n", Name, SockName);
- /*
- * The SockNames "hf", "ttyhf", "1", "12345.tty", "12345.ttyhf.medusa"
- * all match the Name "12345.ttyhf.medusa".
- */
-
- if ((*SockName <= '0' || *SockName > '9') && (*n > '0' && *n <= '9'))
- {
- while (*++n)
- if (*n == '.')
- {
- n++;
- break;
- }
- if (strncmp("tty", SockName, 3) && !strncmp("tty", n, 3))
- n += 3;
- }
- if (strncmp(n, SockName, l))
+ n = name;
+ /* if we don't want to match digits swip them */
+ if ((*match <= '0' || *match > '9') && (*n > '0' && *n <= '9'))
{
- debug3("strncmp('%s', '%s', %d)\n", n, SockName, l);
- continue;
+ while (*n >= '0' && *n <= '9')
+ n++;
+ if (*n == '.')
+ n++;
}
+ /* the tty prefix is optional */
+ if (strncmp(match, "tty", 3) && strncmp(n, "tty", 3) == 0)
+ n += 3;
+ if (strncmp(match, n, matchlen))
+ continue;
+ debug1(" -> matched %s\n", match);
}
- /*
- * ATTENTION! MakeClientSocket adds SockName to SockPath!
- * Anyway, we need it earlier.
- */
- strcpy(SockNamePtr, Name);
+ sprintf(SockPath + sdirlen, "/%s", name);
+
if (stat(SockPath, &st))
- {
- debug1("could not stat! (%d)\n", errno);
- continue;
- }
+ continue;
+
#ifndef SOCK_NOT_IN_FS
# ifdef NAMEDPIPE
+# ifdef S_ISFIFO
if (!S_ISFIFO(st.st_mode))
- {
- debug1("'%s' is not a pipe, ignored\n", SockPath);
- continue;
- }
-# else /* NAMEDPIPE */
+ continue;
+# endif
+# else
# ifdef S_ISSOCK
if (!S_ISSOCK(st.st_mode))
- {
- debug1("'%s' is not a socket, ignored\n", SockPath);
- continue;
- }
+ continue;
# endif
-# endif /* NAMEDPIPE */
+# endif
#endif
+
if (st.st_uid != real_uid)
- {
- debug2("uid mismatch (%d - %d) - ignored\n", st.st_uid, real_uid);
- continue;
- }
- s = st.st_mode & 0777;
- debug2("FindSocket: %s has mode %04o...\n", Name, s);
+ continue;
+ mode = st.st_mode & 0777;
+ debug1(" has mode 0%03o\n", mode);
#ifdef MULTIUSER
- if (multi && ((s & 0677) == 0600))
+ if (multi && ((mode & 0677) != 0601))
continue;
#endif
- foundsock[foundsockcount].name = SaveStr(Name);
-#ifdef MULTIUSER
- foundsock[foundsockcount].mode = s ^ (multi ? 1 : 0);
-#else
- foundsock[foundsockcount].mode = s;
+ debug(" store it.\n");
+ if ((sent = (struct sent *)malloc(sizeof(struct sent))) == 0)
+ continue;
+ sent->next = 0;
+ sent->name = SaveStr(name);
+ sent->mode = mode;
+ *slisttail = sent;
+ slisttail = &sent->next;
+ nfound++;
+ s = MakeClientSocket(0);
+#ifdef USE_SETEUID
+ /* MakeClientSocket sets ids back to eff */
+ xseteuid(real_uid);
+ xsetegid(real_gid);
#endif
- {
- /*
- * marc parses the socketname again
- */
- int sockmpid = 0;
- char *nam = Name;
+ if (s == -1)
+ {
+ sent->mode = -3;
+ /* 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))
+ {
+ ndead++;
+ sent->mode = -1;
+ if (wipeflag)
+ {
+ if (unlink(SockPath) == 0)
+ {
+ sent->mode = -2;
+ nwipe++;
+ }
+ }
+ }
+ continue;
+ }
+ /* Shall we connect ? */
+ mode &= 0776;
- while (*nam)
- {
- if (*nam > '9' || *nam < '0')
- break;
- sockmpid = 10 * sockmpid + *nam - '0';
- nam++;
- }
- /*
- * A socket is counted as dead, when there is no
- * process belongin to it. If there is one, and the
- * socket mode indicates "single user detached", then
- * we should be able to connect.
- * If successfull, thats o.k. Otherwise we record that mode as -1.
- * MakeClientSocket() must be careful not to block forever.
- */
- if (((sockmpid > 2) && kill(sockmpid, 0) == -1 && errno == ESRCH) ||
- (((s & 0677) == 0600) && (s = MakeClientSocket(0, Name)) == -1))
- {
- foundsock[foundsockcount].mode = -1;
- deadcount++;
- }
- else
+ /*
+ * mode 600: socket is detached.
+ * mode 700: socket is attached.
+ * xflag implies rflag here.
+ *
+ * fail, when socket mode mode is not 600 or 700
+ * fail, when we want to detach, but it already is.
+ * fail, when we only want to attach, but mode 700 and not xflag.
+ * fail, if none of dflag, rflag, xflag is set.
+ */
+ if ((mode != 0700 && mode != 0600) ||
+ (dflag && mode == 0600) ||
+ (!dflag && rflag && mode == 0700 && !xflag) ||
+ (!dflag && !rflag && !xflag))
+ {
close(s);
- }
- if (++foundsockcount >= 100)
- break;
- }
- closedir(dirp);
-
- if (wipeflag)
- {
- for (s = 0; s < foundsockcount; s++)
+ continue;
+ }
+ ngood++;
+ if (fdp && firsts == -1)
{
- if (foundsock[s].mode == -1)
- {
- strcpy(SockNamePtr, foundsock[s].name);
- debug1("wiping '%s'\n", SockPath);
- if (unlink(SockPath) == 0)
- {
- foundsock[s].mode = -2;
- wipecount++;
- }
- }
+ firsts = s;
+ firstn = sent->name;
}
+ else
+ close(s);
}
-debug3("found=%d, dflag = %d, xflag = %d\n", found, dflag, xflag);
- for (s = 0; s < foundsockcount; s++)
- if ((foundsock[s].mode) == (dflag ? 0700 : 0600)
- || (xflag && foundsock[s].mode == 0700))
- {
- found++;
-debug2("mode = %d --> found = %d\n", foundsock[s].mode, found);
- lasts = s;
- }
- if (quietflag && (lsflag || (found != 1 && rflag != 2)))
- eexit(10 + found);
- debug2("attach: found=%d, foundsockcount=%d\n", found, foundsockcount);
- if (found == 1 && lsflag == 0)
- {
- if ((lasts = MakeClientSocket(0, SockName = foundsock[lasts].name)) == -1)
- found = 0;
- }
- else if (!quietflag && foundsockcount > 0)
+ (void)closedir(dirp);
+ if (nfound && (lsflag || ngood != 1) && !quietflag)
{
- switch (found)
- {
- case 0:
- if (lsflag)
- {
-#ifdef NETHACK
- if (nethackflag)
- printf("Your inventory:\n");
- else
-#endif
- printf((foundsockcount > 1) ?
- "There are screens on:\n" : "There is a screen on:\n");
- }
- else
- {
+ switch(ngood)
+ {
+ case 0:
#ifdef NETHACK
- if (nethackflag)
- printf("Nothing fitting exists in the game:\n");
- else
+ if (nethackflag)
+ printf(lsflag ? "Your inventory:\n" : "Nothing fitting exists in the game:\n");
+ else
#endif
- printf((foundsockcount > 1) ?
- "There are screens on:\n" : "There is a screen on:\n");
- }
- break;
- case 1:
+ printf(nfound > 1 ? "There are screens on:\n" : "There is a screen on:\n");
+ break;
+ case 1:
#ifdef NETHACK
- if (nethackflag)
- printf((foundsockcount > 1) ?
- "Prove thyself worthy or perish:\n" :
- "You see here a good looking screen:\n");
- else
+ if (nethackflag)
+ printf(nfound > 1 ? "Prove thyself worthy or perish:\n" : "You see here a good looking screen:\n");
+ else
#endif
- printf((foundsockcount > 1) ?
- "There are several screens on:\n" :
- "There is a possible screen on:\n");
- break;
- default:
+ printf(nfound > 1 ? "There are several screens on:\n" : "There is a possible screen on:\n");
+ break;
+ default:
#ifdef NETHACK
- if (nethackflag)
- printf((foundsockcount > 1) ?
- "You may whish for a screen, what do you want?\n" :
- "You see here a screen:\n");
- else
+ if (nethackflag)
+ printf("You may wish for a screen, what do you want?\n");
+ else
#endif
- printf((foundsockcount > 1) ?
- "There are several screens on:\n" : "There is a screen on:\n");
- break;
- }
- for (s = 0; s < foundsockcount; s++)
+ printf("There are several screens on:\n");
+ }
+ for (sent = slist; sent; sent = sent->next)
{
- switch (foundsock[s].mode)
+ switch (sent->mode)
{
case 0700:
- printf("\t%s\t(Attached)\n", foundsock[s].name);
+ printf("\t%s\t(Attached)\n", sent->name);
break;
case 0600:
- printf("\t%s\t(Detached)\n", foundsock[s].name);
+ printf("\t%s\t(Detached)\n", sent->name);
break;
#ifdef MULTIUSER
case 0701:
- printf("\t%s\t(Multi, attached)\n", foundsock[s].name);
+ printf("\t%s\t(Multi, attached)\n", sent->name);
break;
case 0601:
- printf("\t%s\t(Multi, detached)\n", foundsock[s].name);
+ printf("\t%s\t(Multi, detached)\n", sent->name);
break;
#endif
case -1:
-#if defined(__STDC__) || defined(_AIX) || defined(SVR4)
- printf("\t%s\t(Dead ??\?)\n", foundsock[s].name);
-#else
- printf("\t%s\t(Dead ???)\n", foundsock[s].name);
-#endif
+ /* No trigraphs, please */
+ printf("\t%s\t(Dead ?%c?)\n", sent->name, '?');
break;
case -2:
- printf("\t%s\t(Removed)\n", foundsock[s].name);
+ printf("\t%s\t(Removed)\n", sent->name);
break;
- default:
- printf("\t%s\t(Wrong mode)\n", foundsock[s].name);
+ case -3:
+ printf("\t%s\t(Unreachable)\n", sent->name);
break;
}
}
}
- if (deadcount && !quietflag)
+ if (ndead && !quietflag)
{
if (wipeflag)
- {
+ {
#ifdef NETHACK
- if (nethackflag)
- printf("You hear%s distant explosion%s.\n",
- (deadcount > 1) ? "" : " a", (deadcount > 1) ? "s" : "");
- else
+ if (nethackflag)
+ printf("You hear%s distant explosion%s.\n",
+ ndead > 1 ? "" : " a", ndead > 1 ? "s" : "");
+ else
#endif
- printf("%d Socket%s wiped out.\n", deadcount, (deadcount > 1)?"s":"");
+ printf("%d socket%s wiped out.\n", nwipe, ndead > 1 ? "s" : "");
}
else
{
#ifdef NETHACK
- if (nethackflag)
- printf("The dead screen%s touch%s you. Try 'screen -wipe'.\n",
- (deadcount > 1) ? "s" : "", (deadcount > 1) ? "" : "es");
- else
+ if (nethackflag)
+ printf("The dead screen%s touch%s you. Try 'screen -wipe'.\n",
+ ndead > 1 ? "s" : "", ndead > 1 ? "" : "es");
+ else
#endif
- printf("Remove dead Sockets with 'screen -wipe'.\n");
+ printf("Remove dead screens with 'screen -wipe'.\n");
}
}
-
- for (s = 0; s < foundsockcount; s++)
- Free(foundsock[s].name);
- if (found == 1 && fdp)
- *fdp = lasts;
-#ifndef NOREUID
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
+ if (firsts != -1)
+ {
+ sprintf(SockPath + sdirlen, "/%s", firstn);
+ *fdp = firsts;
+ }
+ else
+ SockPath[sdirlen] = 0;
+ for (sent = slist; sent; sent = nsent)
+ {
+ nsent = sent->next;
+ free(sent->name);
+ free((char *)sent);
+ }
+#ifdef USE_SETEUID
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
#endif
- if (fdp)
- return found;
- return foundsockcount - wipecount;
+ if (nfoundp)
+ *nfoundp = nfound - nwipe;
+ return ngood;
}
+
+
+/*
+**
+** Socket/pipe create routines
+**
+*/
#ifdef NAMEDPIPE
@@ -434,30 +390,19 @@ MakeServerSocket()
register int s;
struct stat st;
- strcpy(SockNamePtr, SockName);
-# ifdef NAME_MAX
- if (strlen(SockNamePtr) > NAME_MAX)
- {
- debug2("MakeClientSocket: '%s' truncated to %d chars\n",
- SockNamePtr, NAME_MAX);
- SockNamePtr[NAME_MAX] = '\0';
- }
-# endif /* NAME_MAX */
-
-# ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
-# endif /* NOREUID */
- if ((s = open(SockPath, O_WRONLY | O_NDELAY)) >= 0)
+# ifdef USE_SETEUID
+ xseteuid(real_uid);
+ xsetegid(real_gid);
+# endif
+ if ((s = open(SockPath, O_WRONLY | O_NONBLOCK)) >= 0)
{
debug("huii, my fifo already exists??\n");
if (quietflag)
{
- Kill(d_userpid, SIG_BYE);
+ Kill(D_userpid, SIG_BYE);
eexit(11);
}
- printf("There is already a screen running on %s.\n",
- Filename(SockPath));
+ Msg(0, "There is already a screen running on %s.", Filename(SockPath));
if (stat(SockPath, &st) == -1)
Panic(errno, "stat");
if (st.st_uid != real_uid)
@@ -468,70 +413,59 @@ MakeServerSocket()
Panic(0, "It is not detached.");
/* NOTREACHED */
}
-# ifndef NOREUID
+# ifdef USE_SETEUID
(void) unlink(SockPath);
- if (mknod(SockPath, S_IFIFO | SOCKMODE, 0))
- Panic(0, "mknod fifo %s failed", SockPath);
+ if (mkfifo(SockPath, SOCKMODE))
+ Panic(0, "mkfifo %s failed", SockPath);
# ifdef BROKEN_PIPE
- if ((s = open(SockPath, O_RDWR | O_NDELAY, 0)) < 0)
+ if ((s = open(SockPath, O_RDWR | O_NONBLOCK, 0)) < 0)
# else
- if ((s = open(SockPath, O_RDONLY | O_NDELAY, 0)) < 0)
+ if ((s = open(SockPath, O_RDONLY | O_NONBLOCK, 0)) < 0)
# endif
Panic(errno, "open fifo %s", SockPath);
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
return s;
-# else /* NOREUID */
+# else /* !USE_SETEUID */
if (UserContext() > 0)
{
(void) unlink(SockPath);
- if (mknod(SockPath, S_IFIFO | SOCKMODE, 0))
- UserReturn(0);
- UserReturn(1);
+ UserReturn(mkfifo(SockPath, SOCKMODE));
}
- if (UserStatus() <= 0)
- Panic(0, "mknod fifo %s failed", SockPath);
+ if (UserStatus())
+ Panic(0, "mkfifo %s failed", SockPath);
# ifdef BROKEN_PIPE
- if ((s = secopen(SockPath, O_RDWR | O_NDELAY, 0)) < 0)
+ if ((s = secopen(SockPath, O_RDWR | O_NONBLOCK, 0)) < 0)
# else
- if ((s = secopen(SockPath, O_RDONLY | O_NDELAY, 0)) < 0)
+ if ((s = secopen(SockPath, O_RDONLY | O_NONBLOCK, 0)) < 0)
# endif
Panic(errno, "open fifo %s", SockPath);
return s;
-# endif /* NOREUID */
+# endif /* !USE_SETEUID */
}
int
-MakeClientSocket(err, name)
+MakeClientSocket(err)
int err;
-char *name;
{
register int s = 0;
- strcpy(SockNamePtr, name);
-# ifdef NAME_MAX
- if (strlen(SockNamePtr) > NAME_MAX)
- {
- debug2("MakeClientSocket: '%s' truncated to %d chars\n",
- SockNamePtr, NAME_MAX);
- SockNamePtr[NAME_MAX] = '\0';
- }
-# endif /* NAME_MAX */
-
- if ((s = secopen(SockPath, O_WRONLY | O_NDELAY, 0)) >= 0)
+ if ((s = secopen(SockPath, O_WRONLY | O_NONBLOCK, 0)) >= 0)
{
(void) fcntl(s, F_SETFL, 0);
return s;
}
if (err)
- Msg(errno, "open: %s (but continuing...)", SockPath);
- debug1("MakeClientSocket() open %s failed\n", SockPath);
+ Msg(errno, "%s", SockPath);
+ debug2("MakeClientSocket() open %s failed (%d)\n", SockPath, errno);
return -1;
}
+
#else /* NAMEDPIPE */
+
int
MakeServerSocket()
{
@@ -542,35 +476,24 @@ MakeServerSocket()
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
Panic(errno, "socket");
a.sun_family = AF_UNIX;
- strcpy(SockNamePtr, SockName);
-# ifdef NAME_MAX
- if (strlen(SockNamePtr) > NAME_MAX)
- {
- debug2("MakeServerSocket: '%s' truncated to %d chars\n",
- SockNamePtr, NAME_MAX);
- SockNamePtr[NAME_MAX] = '\0';
- }
-# endif /* NAME_MAX */
-
strcpy(a.sun_path, SockPath);
-# ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
-# endif /* NOREUID */
+# ifdef USE_SETEUID
+ xseteuid(real_uid);
+ xsetegid(real_gid);
+# endif
if (connect(s, (struct sockaddr *) &a, strlen(SockPath) + 2) != -1)
{
debug("oooooh! socket already is alive!\n");
if (quietflag)
{
- Kill(d_userpid, SIG_BYE);
+ Kill(D_userpid, SIG_BYE);
/*
* oh, well. nobody receives that return code. papa
* dies by signal.
*/
eexit(11);
}
- printf("There is already a screen running on %s.\n",
- Filename(SockPath));
+ Msg(0, "There is already a screen running on %s.", Filename(SockPath));
if (stat(SockPath, &st) == -1)
Panic(errno, "stat");
if (st.st_uid != real_uid)
@@ -598,9 +521,9 @@ MakeServerSocket()
}
#else
chmod(SockPath, SOCKMODE);
-# ifdef NOREUID
+# ifndef USE_SETEUID
chown(SockPath, real_uid, real_gid);
-# endif /* NOREUID */
+# endif
#endif /* SOCK_NOT_IN_FS */
if (listen(s, 5) == -1)
Panic(errno, "listen");
@@ -608,17 +531,16 @@ MakeServerSocket()
fcntl(s, F_SETOWN, getpid());
debug1("Serversocket owned by %d\n", fcntl(s, F_GETOWN, 0));
# endif /* F_SETOWN */
-# ifndef NOREUID
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
-# endif /* NOREUID */
+# ifdef USE_SETEUID
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
+# endif
return s;
}
int
-MakeClientSocket(err, name)
+MakeClientSocket(err)
int err;
-char *name;
{
register int s;
struct sockaddr_un a;
@@ -626,21 +548,11 @@ char *name;
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
Panic(errno, "socket");
a.sun_family = AF_UNIX;
- strcpy(SockNamePtr, name);
-# ifdef NAME_MAX
- if (strlen(SockNamePtr) > NAME_MAX)
- {
- debug2("MakeClientSocket: '%s' truncated to %d chars\n",
- SockNamePtr, NAME_MAX);
- SockNamePtr[NAME_MAX] = '\0';
- }
-# endif /* NAME_MAX */
-
strcpy(a.sun_path, SockPath);
-# ifndef NOREUID
- setreuid(eff_uid, real_uid);
- setregid(eff_gid, real_gid);
-# else /* NOREUID */
+# ifdef USE_SETEUID
+ xseteuid(real_uid);
+ xsetegid(real_gid);
+# else
if (access(SockPath, W_OK))
{
if (err)
@@ -649,7 +561,7 @@ char *name;
close(s);
return -1;
}
-# endif /* NOREUID */
+# endif
if (connect(s, (struct sockaddr *) &a, strlen(SockPath) + 2) == -1)
{
if (err)
@@ -658,25 +570,39 @@ char *name;
close(s);
s = -1;
}
-# ifndef NOREUID
- setreuid(real_uid, eff_uid);
- setregid(real_gid, eff_gid);
-# endif /* NOREUID */
+# ifdef USE_SETEUID
+ xseteuid(eff_uid);
+ xsetegid(eff_gid);
+# endif
return s;
}
#endif /* NAMEDPIPE */
+/*
+**
+** Message send and receive routines
+**
+*/
+
void
-SendCreateMsg(s, nwin)
-int s;
+SendCreateMsg(sty, nwin)
+char *sty;
struct NewWindow *nwin;
{
+ int s;
struct msg m;
register char *p;
register int len, n;
char **av = nwin->args;
+#ifdef NAME_MAX
+ if (strlen(sty) > NAME_MAX)
+ sty[NAME_MAX] = 0;
+#endif
+ sprintf(SockPath + strlen(SockPath), "/%s", sty);
+ if ((s = MakeClientSocket(1)) == -1)
+ exit(1);
debug1("SendCreateMsg() to '%s'\n", SockPath);
bzero((char *)&m, sizeof(m));
m.type = MSG_CREATE;
@@ -701,13 +627,9 @@ struct NewWindow *nwin;
m.m.create.flowflag = nwin->flowflag;
m.m.create.lflag = nwin->lflag;
m.m.create.hheight = nwin->histheight;
-#ifdef SYSV
if (getcwd(m.m.create.dir, sizeof(m.m.create.dir)) == 0)
-#else
- if (getwd(m.m.create.dir) == 0)
-#endif
{
- Msg(errno, "%s", m.m.create.dir);
+ Msg(errno, "getcwd");
return;
}
if (nwin->term != nwin_undef.term)
@@ -716,6 +638,7 @@ struct NewWindow *nwin;
debug1("SendCreateMsg writing '%s'\n", m.m.create.line);
if (write(s, (char *) &m, sizeof m) != sizeof m)
Msg(errno, "write");
+ close(s);
}
void
@@ -754,15 +677,16 @@ unsigned long p1, p2, p3, p4, p5, p6;
debug1("SendErrorMsg: '%s'\n", m.m.message);
if (display == 0)
return;
- s = MakeClientSocket(1, SockName);
+ s = MakeClientSocket(0);
m.type = MSG_ERROR;
- strcpy(m.m_tty, d_usertty);
+ strcpy(m.m_tty, D_usertty);
debug1("SendErrorMsg(): writing to '%s'\n", SockPath);
(void) write(s, (char *) &m, sizeof m);
close(s);
sleep(2);
}
+
#ifdef PASSWORD
static int
CheckPasswd(pwd, pid, utty)
@@ -792,6 +716,7 @@ char *pwd, *utty;
}
#endif /* PASSWORD */
+
static void
ExecCreate(mp)
struct msg *mp;
@@ -802,7 +727,29 @@ struct msg *mp;
register char **pp = args, *p = mp->m.create.line;
nwin = nwin_undef;
- for (n = mp->m.create.nargs; n > 0; --n)
+ n = mp->m.create.nargs;
+ if (n > MAXARGS - 1)
+ n = MAXARGS - 1;
+ /* ugly hack alert... should be done by the frontend! */
+ if (n)
+ {
+ int l, num;
+ char buf[20];
+
+ l = strlen(p);
+ if (IsNumColon(p, 10, buf, sizeof(buf)))
+ {
+ if (*buf)
+ nwin.aka = buf;
+ num = atoi(p);
+ if (num < 0 || num > MAXWIN - 1)
+ num = 0;
+ nwin.StartAt = num;
+ p += l + 1;
+ n--;
+ }
+ }
+ for (; n > 0; n--)
{
*pp++ = p;
p += strlen(p) + 1;
@@ -829,13 +776,11 @@ int pid;
{
debug1("Checking pid %d\n", pid);
if (pid < 2)
- return(-1);
+ return -1;
if (eff_uid == real_uid)
return kill(pid, 0);
- if (UserContext() == 1)
- {
- UserReturn(kill(pid, 0));
- }
+ if (UserContext() > 0)
+ UserReturn(kill(pid, 0));
return UserStatus();
}
@@ -882,7 +827,7 @@ ReceiveMsg()
#ifdef NAMEDPIPE
debug("Ha, there was someone knocking on my fifo??\n");
if (fcntl(ServerSocket, F_SETFL, 0) == -1)
- Panic(errno, "DELAY fcntl");
+ Panic(errno, "BLOCK fcntl");
#else
struct sockaddr_un a;
@@ -912,7 +857,7 @@ ReceiveMsg()
# ifndef BROKEN_PIPE
/* Reopen pipe to prevent EOFs at the select() call */
close(ServerSocket);
- if ((ServerSocket = secopen(SockPath, O_RDONLY | O_NDELAY, 0)) < 0)
+ if ((ServerSocket = secopen(SockPath, O_RDONLY | O_NONBLOCK, 0)) < 0)
Panic(errno, "reopen fifo %s", SockPath);
# endif
#else
@@ -933,8 +878,8 @@ ReceiveMsg()
return;
}
debug2("*** RecMsg: type %d tty %s\n", m.type, m.m_tty);
- for (display = displays; display; display = display->_d_next)
- if (TTYCMP(d_usertty, m.m_tty) == 0)
+ for (display = displays; display; display = display->d_next)
+ if (TTYCMP(D_usertty, m.m_tty) == 0)
break;
debug2("display: %s display %sfound\n", m.m_tty, display ? "" : "not ");
if (!display)
@@ -950,7 +895,7 @@ ReceiveMsg()
}
/* Remove the status to prevent garbage on the screen */
- if (display && d_status)
+ if (display && D_status)
RemoveStatus();
switch (m.type)
@@ -972,28 +917,19 @@ ReceiveMsg()
ExecCreate(&m);
break;
case MSG_CONT:
- if (display && d_userpid != 0 && kill(d_userpid, 0) == 0)
+ if (display && D_userpid != 0 && kill(D_userpid, 0) == 0)
break; /* Intruder Alert */
- debug2("RecMsg: apid=%d,was %d\n", m.m.attach.apid, display ? d_userpid : 0);
+ debug2("RecMsg: apid=%d,was %d\n", m.m.attach.apid, display ? D_userpid : 0);
/* FALLTHROUGH */
case MSG_ATTACH:
if (CheckPid(m.m.attach.apid))
{
- debug1("Attach attempt with bad pid(%d)\n", m.m.attach.apid);
- Msg(0, "Attach attempt with bad pid(%d) !", m.m.attach.apid);
+ Msg(0, "Attach attempt with bad pid(%d)!", m.m.attach.apid);
break;
}
- if ((i = secopen(m.m_tty, O_RDWR | O_NDELAY, 0)) < 0)
+ if ((i = secopen(m.m_tty, O_RDWR | O_NONBLOCK, 0)) < 0)
{
- debug1("ALERT: Cannot open %s!\n", m.m_tty);
-#ifdef NETHACK
- if (nethackflag)
- Msg(errno,
- "You can't open (%s). Perhaps there's a Monster behind it",
- m.m_tty);
- else
-#endif
- Msg(errno, "Attach: Could not open %s", m.m_tty);
+ Msg(errno, "Attach: Could not open %s!", m.m_tty);
Kill(m.m.attach.apid, SIG_BYE);
break;
}
@@ -1012,7 +948,7 @@ ReceiveMsg()
#endif /* PASSWORD */
if (display)
{
- debug("RecMsg: hey, why you disturb, we are not detached. hangup!\n");
+ write(i, "Attaching to a not detached screen?\n", 36);
close(i);
Kill(m.m.attach.apid, SIG_BYE);
Msg(0, "Attach msg ignored: We are not detached.");
@@ -1026,12 +962,11 @@ ReceiveMsg()
write(i, "Access to session denied.\n", 26);
close(i);
Kill(m.m.attach.apid, SIG_BYE);
- Msg(0, "Attach: access denied for user %s", m.m.attach.auser);
+ Msg(0, "Attach: access denied for user %s.", m.m.attach.auser);
break;
}
#endif
- errno = 0;
debug2("RecMsg: apid %d is o.k. and we just opened '%s'\n", m.m.attach.apid, m.m_tty);
/* turn off iflag on a multi-attach... */
if (iflag && displays)
@@ -1039,12 +974,12 @@ ReceiveMsg()
iflag = 0;
display = displays;
#if defined(TERMIO) || defined(POSIX)
- d_NewMode.tio.c_cc[VINTR] = VDISABLE;
- d_NewMode.tio.c_lflag &= ~ISIG;
+ D_NewMode.tio.c_cc[VINTR] = VDISABLE;
+ D_NewMode.tio.c_lflag &= ~ISIG;
#else /* TERMIO || POSIX */
- d_NewMode.m_tchars.t_intrc = -1;
+ D_NewMode.m_tchars.t_intrc = -1;
#endif /* TERMIO || POSIX */
- SetTTY(d_userfd, &d_NewMode);
+ SetTTY(D_userfd, &D_NewMode);
}
/* create new display */
@@ -1053,12 +988,12 @@ ReceiveMsg()
{
write(i, "Could not make display.\n", 24);
close(i);
- Msg(errno, "Attach: could not make display for user %s", m.m.attach.auser);
+ Msg(0, "Attach: could not make display for user %s", m.m.attach.auser);
Kill(m.m.attach.apid, SIG_BYE);
break;
}
-#if defined(ultrix) || defined(pyr)
- brktty(d_userfd); /* for some strange reason this must be done */
+#if defined(ultrix) || defined(pyr) || defined(NeXT)
+ brktty(D_userfd); /* for some strange reason this must be done */
#endif
#if defined(pyr) || defined(xelos) || defined(sequent)
/*
@@ -1099,7 +1034,7 @@ ReceiveMsg()
break;
}
InitTerm(m.m.attach.adaptflag);
- if (displays->_d_next == 0)
+ if (displays->d_next == 0)
(void) chsock();
signal(SIGHUP, SigHup);
#ifdef UTMPOK
@@ -1108,31 +1043,31 @@ ReceiveMsg()
* and if we were detached by ^Z.
*/
RemoveLoginSlot();
- if (displays->_d_next == 0)
+ if (displays->d_next == 0)
for (wi = windows; wi; wi = wi->w_next)
if (wi->w_slot != (slot_t) -1)
SetUtmp(wi);
#endif
- SetMode(&d_OldMode, &d_NewMode);
- SetTTY(d_userfd, &d_NewMode);
+ SetMode(&D_OldMode, &D_NewMode);
+ SetTTY(D_userfd, &D_NewMode);
- d_fore = NULL;
- if (d_user->u_detachwin >= 0)
- fore = wtab[d_user->u_detachwin];
- if (!fore || fore->w_display
+ D_fore = NULL;
+ if (D_user->u_detachwin >= 0)
+ fore = wtab[D_user->u_detachwin];
#ifdef MULTIUSER
- || AclCheckPermWin(d_user, ACL_WRITE, fore)
+ if (!fore || fore->w_display || AclCheckPermWin(D_user, ACL_WRITE, fore))
+#else
+ if (!fore || fore->w_display)
#endif
- )
{
/* try to get another window */
#ifdef MULTIUSER
for (wi = windows; wi; wi = wi->w_next)
- if (!wi->w_display && !AclCheckPermWin(d_user, ACL_WRITE, fore))
+ if (!wi->w_display && !AclCheckPermWin(D_user, ACL_WRITE, fore))
break;
if (!wi)
for (wi = windows; wi; wi = wi->w_next)
- if (!wi->w_display && !AclCheckPermWin(d_user, ACL_READ, fore))
+ if (!wi->w_display && !AclCheckPermWin(D_user, ACL_READ, fore))
break;
if (!wi)
#endif
@@ -1144,9 +1079,9 @@ ReceiveMsg()
if (fore)
SetForeWindow(fore);
Activate(0);
- if (!d_fore)
+ if (!D_fore)
ShowWindows();
- if (displays->_d_next == 0 && console_window)
+ if (displays->d_next == 0 && console_window)
{
if (TtyGrabConsole(console_window->w_ptyfd, 1, "reattach") == 0)
Msg(0, "console %s is on window %d", HostName, console_window->w_number);
@@ -1166,7 +1101,7 @@ ReceiveMsg()
# endif /* POW_DETACH */
for (display = displays; display; display = next)
{
- next = display->_d_next;
+ next = display->d_next;
# ifdef POW_DETACH
if (m.type == MSG_POW_DETACH)
Detach(D_REMOTE_POWER);
@@ -1184,7 +1119,6 @@ ReceiveMsg()
#if defined(_SEQUENT_) && !defined(NAMEDPIPE)
#undef connect
-
/*
* sequent_ptx socket emulation must have mode 000 on the socket!
*/
@@ -1207,6 +1141,10 @@ struct sockaddr *sapp;
}
#endif
+
+/*
+ * Set the mode bits of the socket to the current status
+ */
int
chsock()
{
@@ -1222,3 +1160,24 @@ chsock()
return r;
}
+
+/*
+ * Try to recreate the socket/pipe
+ */
+int
+RecoverSocket()
+{
+ close(ServerSocket);
+ if (geteuid() != real_uid)
+ {
+ if (UserContext() > 0)
+ UserReturn(unlink(SockPath));
+ (void)UserStatus();
+ }
+ else
+ (void) unlink(SockPath);
+
+ if ((ServerSocket = MakeServerSocket()) < 0)
+ return 0;
+ return 1;
+}
diff --git a/src/tek.patch b/src/tek.patch
new file mode 100644
index 0000000..1c66e37
--- /dev/null
+++ b/src/tek.patch
@@ -0,0 +1,79 @@
+Zhang has developed a patch to the "screen" VT100 terminal emulation program
+that allows one to perform tektronics "tek40xx" style graphics in a
+screen window. I've tested it with gnuplot and it works quite well.
+
+Send flames or technical inquries to the patch author Xiaoguang
+Zhang (zhang@gmsds.ms.ornl.gov) and to screen@uni-erlangen.de
+
+=====================================================================
+
+*** ansi.h.orig Sun Nov 6 23:55:35 1994
+--- ansi.h Mon Dec 19 22:14:04 1994
+***************
+*** 55,61 ****
+ PRIN, /* Printer mode */
+ PRINESC, /* ESC seen in printer mode */
+ PRINCSI, /* CSI seen in printer mode */
+! PRIN4 /* CSI 4 seen in printer mode */
+ };
+
+ enum string_t
+--- 55,64 ----
+ PRIN, /* Printer mode */
+ PRINESC, /* ESC seen in printer mode */
+ PRINCSI, /* CSI seen in printer mode */
+! PRIN4, /* CSI 4 seen in printer mode */
+! TEK, /* Tektronics mode */
+! TEKESC, /* Tektronics escape */
+! TEKEND /* Tektronics ending sequence */
+ };
+
+ enum string_t
+*** ansi.c.orig Wed Dec 14 00:52:26 1994
+--- ansi.c Mon Dec 19 22:39:16 1994
+***************
+*** 698,703 ****
+--- 698,708 ----
+ case 'k':
+ StartString(AKA);
+ break;
++ case '\014':
++ curr->w_state = TEK;
++ RAW_PUTCHAR('\033');
++ RAW_PUTCHAR(c);
++ break;
+ default:
+ if (Special(c))
+ break;
+***************
+*** 758,763 ****
+--- 763,789 ----
+ goto tryagain;
+ }
+ }
++ break;
++ case TEK:
++ switch (c)
++ {
++ case '@':
++ if ((unsigned char)*(buf - 2) == ' ') /* XXX: Yucc! */
++ curr->w_state = TEKESC;
++ /* FALLTHROUGH */
++ default:
++ RAW_PUTCHAR(c);
++ break;
++ }
++ break;
++ case TEKESC:
++ curr->w_state = (c == '\037') ? TEKEND : TEK;
++ RAW_PUTCHAR(c);
++ break;
++ case TEKEND:
++ if (c == '\030')
++ curr->w_state = LIT;
++ RAW_PUTCHAR(c);
+ break;
+ case LIT:
+ default:
+
+=====================================================================
diff --git a/src/term.c b/src/term.c
index 4fdaeaf..2fa166d 100644
--- a/src/term.c
+++ b/src/term.c
@@ -25,6 +25,10 @@ RCS_ID("$Id$ FAU")
#include "term.h"
+#define KMAPDEF(s)
+#define KMAPADEF(s)
+#define KMAPMDEF(s)
+
struct term term[T_N] =
{
/* display size */
@@ -70,8 +74,10 @@ struct term term[T_N] =
{ "DC", T_STR },
/* erase */
+ { "ut", T_FLG },
{ "cl", T_STR },
{ "cd", T_STR },
+ { "CD", T_STR },
{ "ce", T_STR },
{ "cb", T_STR },
@@ -101,8 +107,8 @@ struct term term[T_N] =
{ "se", T_STR },
{ "me", T_STR },
{ "ms", T_FLG },
- { "sg", T_FLG },
- { "ug", T_FLG },
+ { "sg", T_NUM },
+ { "ug", T_NUM },
/* keypad/cursorkeys */
{ "ks", T_STR },
@@ -124,7 +130,6 @@ struct term term[T_N] =
/* cursor visibility */
{ "vi", T_STR },
{ "ve", T_STR },
- { "vs", T_STR },
/* margin handling */
{ "am", T_FLG },
@@ -135,9 +140,12 @@ struct term term[T_N] =
/* special settings */
{ "NF", T_FLG },
- { "xo", T_FLG },
+ { "nx", T_FLG },
{ "AN", T_FLG },
{ "OL", T_NUM },
+ { "KJ", T_STR },
+ { "VR", T_STR },
+ { "VN", T_STR },
/* d_font setting */
{ "G0", T_FLG },
@@ -152,30 +160,75 @@ struct term term[T_N] =
/* keycaps */
/* define T_CAPS */
/* nolist */
- { "km", T_FLG },
- { "k0", T_STR },
- { "k1", T_STR },
- { "k2", T_STR },
- { "k3", T_STR },
- { "k4", T_STR },
- { "k5", T_STR },
- { "k6", T_STR },
- { "k7", T_STR },
- { "k8", T_STR },
- { "k9", T_STR },
- { "k;", T_STR },
- { "kb", T_STR },
- { "kd", T_STR },
- { "kh", T_STR },
- { "kl", T_STR },
- { "ko", T_STR },
- { "kr", T_STR },
- { "ku", T_STR },
+ { "k0", T_STR }, KMAPDEF("\033[10~")
+ { "k1", T_STR }, KMAPDEF("\033OP")
+ { "k2", T_STR }, KMAPDEF("\033OQ")
+ { "k3", T_STR }, KMAPDEF("\033OR")
+ { "k4", T_STR }, KMAPDEF("\033OS")
+ { "k5", T_STR }, KMAPDEF("\033[15~")
+ { "k6", T_STR }, KMAPDEF("\033[17~")
+ { "k7", T_STR }, KMAPDEF("\033[18~")
+ { "k8", T_STR }, KMAPDEF("\033[19~")
+ { "k9", T_STR }, KMAPDEF("\033[20~")
+ { "k;", T_STR }, KMAPDEF("\033[21~")
+ { "F1", T_STR }, KMAPDEF("\033[23~")
+ { "F2", T_STR }, KMAPDEF("\033[24~")
+ { "kb", T_STR }, KMAPDEF("\010")
+ { "kh", T_STR }, KMAPDEF("\033[1~") KMAPMDEF("g")
{ "K1", T_STR },
{ "K2", T_STR },
{ "K3", T_STR },
{ "K4", T_STR },
{ "K5", T_STR },
+/* more keys for Andrew A. Chernov (ache@astral.msk.su) */
+ { "kA", T_STR },
+ { "ka", T_STR },
+ { "kB", T_STR },
+ { "kC", T_STR },
+ { "kD", T_STR }, KMAPDEF("\033[3~")
+ { "kE", T_STR },
+ { "kF", T_STR }, KMAPMDEF("\004")
+ { "kH", T_STR }, KMAPDEF("\033[4~") KMAPMDEF("G")
+ { "kI", T_STR }, KMAPDEF("\033[2~")
+ { "kL", T_STR },
+ { "kM", T_STR },
+ { "kN", T_STR }, KMAPDEF("\033[6~") KMAPMDEF("\006")
+ { "kP", T_STR }, KMAPDEF("\033[5~") KMAPMDEF("\002")
+ { "kR", T_STR }, KMAPMDEF("\025")
+ { "kS", T_STR },
+ { "kT", T_STR },
+ { "kt", T_STR },
+ { "@1", T_STR },
+ { "@7", T_STR },
+/* keys that can have two bindings */
+/* define T_CURSOR */
+ { "ku", T_STR }, KMAPDEF("\033[A") KMAPADEF("\033OA") KMAPMDEF("k")
+ { "kd", T_STR }, KMAPDEF("\033[B") KMAPADEF("\033OB") KMAPMDEF("j")
+ { "kr", T_STR }, KMAPDEF("\033[C") KMAPADEF("\033OC") KMAPMDEF("l")
+ { "kl", T_STR }, KMAPDEF("\033[D") KMAPADEF("\033OD") KMAPMDEF("h")
+/* define T_KEYPAD */
+ { "f0", T_STR }, KMAPDEF("0") KMAPADEF("\033Op")
+ { "f1", T_STR }, KMAPDEF("1") KMAPADEF("\033Oq")
+ { "f2", T_STR }, KMAPDEF("2") KMAPADEF("\033Or")
+ { "f3", T_STR }, KMAPDEF("3") KMAPADEF("\033Os")
+ { "f4", T_STR }, KMAPDEF("4") KMAPADEF("\033Ot")
+ { "f5", T_STR }, KMAPDEF("5") KMAPADEF("\033Ou")
+ { "f6", T_STR }, KMAPDEF("6") KMAPADEF("\033Ov")
+ { "f7", T_STR }, KMAPDEF("7") KMAPADEF("\033Ow")
+ { "f8", T_STR }, KMAPDEF("8") KMAPADEF("\033Ox")
+ { "f9", T_STR }, KMAPDEF("9") KMAPADEF("\033Oy")
+ { "f+", T_STR }, KMAPDEF("+") KMAPADEF("\033Ok")
+ { "f-", T_STR }, KMAPDEF("-") KMAPADEF("\033Om")
+ { "f*", T_STR }, KMAPDEF("*") KMAPADEF("\033Oj")
+ { "f/", T_STR }, KMAPDEF("/") KMAPADEF("\033Oo")
+ { "fq", T_STR }, KMAPDEF("=") KMAPADEF("\033OX")
+ { "f.", T_STR }, KMAPDEF(".") KMAPADEF("\033On")
+ { "f,", T_STR }, KMAPDEF(",") KMAPADEF("\033Ol")
+ { "fe", T_STR }, KMAPDEF("\015") KMAPADEF("\033OM")
+/* other things related to keycaps */
+/* define T_OCAPS */
+ { "km", T_FLG },
+ { "ko", T_STR },
{ "l0", T_STR },
{ "l1", T_STR },
{ "l2", T_STR },
@@ -187,23 +240,6 @@ struct term term[T_N] =
{ "l8", T_STR },
{ "l9", T_STR },
{ "la", T_STR },
-/* more keys for Andrew A. Chernov (ache@astral.msk.su) */
- { "kA", T_STR },
- { "ka", T_STR },
- { "kC", T_STR },
- { "kD", T_STR },
- { "kE", T_STR },
- { "kF", T_STR },
- { "kH", T_STR },
- { "kI", T_STR },
- { "kL", T_STR },
- { "kM", T_STR },
- { "kN", T_STR },
- { "kP", T_STR },
- { "kR", T_STR },
- { "kS", T_STR },
- { "kT", T_STR },
- { "kt", T_STR },
/* list */
/* define T_ECAPS */
/* define T_N */
diff --git a/src/term.h.dist b/src/term.h.dist
index cb1a7b9..710b155 100644
--- a/src/term.h.dist
+++ b/src/term.h.dist
@@ -19,95 +19,203 @@ union tcu
char *str;
};
-#define LI (d_tcs[0].num)
-#define CO (d_tcs[1].num)
-#define HC (d_tcs[2].flg)
-#define OS (d_tcs[3].flg)
-#define NS (d_tcs[4].flg)
-#define CM (d_tcs[5].str)
-#define HO (d_tcs[6].str)
-#define CR (d_tcs[7].str)
-#define UP (d_tcs[8].str)
-#define CUP (d_tcs[9].str)
-#define DO (d_tcs[10].str)
-#define CDO (d_tcs[11].str)
-#define BS (d_tcs[12].flg)
-#define BC (d_tcs[13].str)
-#define LE (d_tcs[14].str)
-#define CLE (d_tcs[15].str)
-#define ND (d_tcs[16].str)
-#define CRI (d_tcs[17].str)
-#define CS (d_tcs[18].str)
-#define NL (d_tcs[19].str)
-#define SF (d_tcs[20].str)
-#define SR (d_tcs[21].str)
-#define AL (d_tcs[22].str)
-#define CAL (d_tcs[23].str)
-#define DL (d_tcs[24].str)
-#define CDL (d_tcs[25].str)
-#define IN (d_tcs[26].flg)
-#define IM (d_tcs[27].str)
-#define EI (d_tcs[28].str)
-#define IC (d_tcs[29].str)
-#define CIC (d_tcs[30].str)
-#define DC (d_tcs[31].str)
-#define CDC (d_tcs[32].str)
-#define CL (d_tcs[33].str)
-#define CD (d_tcs[34].str)
-#define CE (d_tcs[35].str)
-#define CB (d_tcs[36].str)
-#define IS (d_tcs[37].str)
-#define TI (d_tcs[38].str)
-#define TE (d_tcs[39].str)
-#define BL (d_tcs[40].str)
-#define VB (d_tcs[41].str)
-#define CWS (d_tcs[42].str)
-#define CZ0 (d_tcs[43].str)
-#define CZ1 (d_tcs[44].str)
-#define T_ATTR 45
-#define MH (d_tcs[45].str)
-#define US (d_tcs[46].str)
-#define MD (d_tcs[47].str)
-#define MR (d_tcs[48].str)
-#define SO (d_tcs[49].str)
-#define MB (d_tcs[50].str)
-#define UE (d_tcs[51].str)
-#define SE (d_tcs[52].str)
-#define ME (d_tcs[53].str)
-#define MS (d_tcs[54].flg)
-#define SG (d_tcs[55].flg)
-#define UG (d_tcs[56].flg)
-#define KS (d_tcs[57].str)
-#define KE (d_tcs[58].str)
-#define CCS (d_tcs[59].str)
-#define CCE (d_tcs[60].str)
-#define PO (d_tcs[61].str)
-#define PF (d_tcs[62].str)
-#define HS (d_tcs[63].flg)
-#define WS (d_tcs[64].num)
-#define TS (d_tcs[65].str)
-#define FS (d_tcs[66].str)
-#define DS (d_tcs[67].str)
-#define VI (d_tcs[68].str)
-#define VE (d_tcs[69].str)
-#define VS (d_tcs[70].str)
-#define AM (d_tcs[71].flg)
-#define XV (d_tcs[72].flg)
-#define XN (d_tcs[73].flg)
-#define COP (d_tcs[74].flg)
-#define CLP (d_tcs[75].flg)
-#define CNF (d_tcs[76].flg)
-#define XO (d_tcs[77].flg)
-#define CAN (d_tcs[78].flg)
-#define COL (d_tcs[79].num)
-#define CG0 (d_tcs[80].flg)
-#define CS0 (d_tcs[81].str)
-#define CE0 (d_tcs[82].str)
-#define CC0 (d_tcs[83].str)
-#define AS (d_tcs[84].str)
-#define AE (d_tcs[85].str)
-#define AC (d_tcs[86].str)
-#define CB8 (d_tcs[87].str)
-#define T_CAPS 88
-#define T_ECAPS 139
-#define T_N 139
+#define d_LI d_tcs[0].num
+#define D_LI (D_tcs[0].num)
+#define d_CO d_tcs[1].num
+#define D_CO (D_tcs[1].num)
+#define d_HC d_tcs[2].flg
+#define D_HC (D_tcs[2].flg)
+#define d_OS d_tcs[3].flg
+#define D_OS (D_tcs[3].flg)
+#define d_NS d_tcs[4].flg
+#define D_NS (D_tcs[4].flg)
+#define d_CM d_tcs[5].str
+#define D_CM (D_tcs[5].str)
+#define d_HO d_tcs[6].str
+#define D_HO (D_tcs[6].str)
+#define d_CR d_tcs[7].str
+#define D_CR (D_tcs[7].str)
+#define d_UP d_tcs[8].str
+#define D_UP (D_tcs[8].str)
+#define d_CUP d_tcs[9].str
+#define D_CUP (D_tcs[9].str)
+#define d_DO d_tcs[10].str
+#define D_DO (D_tcs[10].str)
+#define d_CDO d_tcs[11].str
+#define D_CDO (D_tcs[11].str)
+#define d_BS d_tcs[12].flg
+#define D_BS (D_tcs[12].flg)
+#define d_BC d_tcs[13].str
+#define D_BC (D_tcs[13].str)
+#define d_LE d_tcs[14].str
+#define D_LE (D_tcs[14].str)
+#define d_CLE d_tcs[15].str
+#define D_CLE (D_tcs[15].str)
+#define d_ND d_tcs[16].str
+#define D_ND (D_tcs[16].str)
+#define d_CRI d_tcs[17].str
+#define D_CRI (D_tcs[17].str)
+#define d_CS d_tcs[18].str
+#define D_CS (D_tcs[18].str)
+#define d_NL d_tcs[19].str
+#define D_NL (D_tcs[19].str)
+#define d_SF d_tcs[20].str
+#define D_SF (D_tcs[20].str)
+#define d_SR d_tcs[21].str
+#define D_SR (D_tcs[21].str)
+#define d_AL d_tcs[22].str
+#define D_AL (D_tcs[22].str)
+#define d_CAL d_tcs[23].str
+#define D_CAL (D_tcs[23].str)
+#define d_DL d_tcs[24].str
+#define D_DL (D_tcs[24].str)
+#define d_CDL d_tcs[25].str
+#define D_CDL (D_tcs[25].str)
+#define d_IN d_tcs[26].flg
+#define D_IN (D_tcs[26].flg)
+#define d_IM d_tcs[27].str
+#define D_IM (D_tcs[27].str)
+#define d_EI d_tcs[28].str
+#define D_EI (D_tcs[28].str)
+#define d_IC d_tcs[29].str
+#define D_IC (D_tcs[29].str)
+#define d_CIC d_tcs[30].str
+#define D_CIC (D_tcs[30].str)
+#define d_DC d_tcs[31].str
+#define D_DC (D_tcs[31].str)
+#define d_CDC d_tcs[32].str
+#define D_CDC (D_tcs[32].str)
+#define d_UT d_tcs[33].flg
+#define D_UT (D_tcs[33].flg)
+#define d_CL d_tcs[34].str
+#define D_CL (D_tcs[34].str)
+#define d_CD d_tcs[35].str
+#define D_CD (D_tcs[35].str)
+#define d_CCD d_tcs[36].str
+#define D_CCD (D_tcs[36].str)
+#define d_CE d_tcs[37].str
+#define D_CE (D_tcs[37].str)
+#define d_CB d_tcs[38].str
+#define D_CB (D_tcs[38].str)
+#define d_IS d_tcs[39].str
+#define D_IS (D_tcs[39].str)
+#define d_TI d_tcs[40].str
+#define D_TI (D_tcs[40].str)
+#define d_TE d_tcs[41].str
+#define D_TE (D_tcs[41].str)
+#define d_BL d_tcs[42].str
+#define D_BL (D_tcs[42].str)
+#define d_VB d_tcs[43].str
+#define D_VB (D_tcs[43].str)
+#define d_CWS d_tcs[44].str
+#define D_CWS (D_tcs[44].str)
+#define d_CZ0 d_tcs[45].str
+#define D_CZ0 (D_tcs[45].str)
+#define d_CZ1 d_tcs[46].str
+#define D_CZ1 (D_tcs[46].str)
+#define T_ATTR 47
+#define d_MH d_tcs[47].str
+#define D_MH (D_tcs[47].str)
+#define d_US d_tcs[48].str
+#define D_US (D_tcs[48].str)
+#define d_MD d_tcs[49].str
+#define D_MD (D_tcs[49].str)
+#define d_MR d_tcs[50].str
+#define D_MR (D_tcs[50].str)
+#define d_SO d_tcs[51].str
+#define D_SO (D_tcs[51].str)
+#define d_MB d_tcs[52].str
+#define D_MB (D_tcs[52].str)
+#define d_UE d_tcs[53].str
+#define D_UE (D_tcs[53].str)
+#define d_SE d_tcs[54].str
+#define D_SE (D_tcs[54].str)
+#define d_ME d_tcs[55].str
+#define D_ME (D_tcs[55].str)
+#define d_MS d_tcs[56].flg
+#define D_MS (D_tcs[56].flg)
+#define d_SG d_tcs[57].num
+#define D_SG (D_tcs[57].num)
+#define d_UG d_tcs[58].num
+#define D_UG (D_tcs[58].num)
+#define d_KS d_tcs[59].str
+#define D_KS (D_tcs[59].str)
+#define d_KE d_tcs[60].str
+#define D_KE (D_tcs[60].str)
+#define d_CCS d_tcs[61].str
+#define D_CCS (D_tcs[61].str)
+#define d_CCE d_tcs[62].str
+#define D_CCE (D_tcs[62].str)
+#define d_PO d_tcs[63].str
+#define D_PO (D_tcs[63].str)
+#define d_PF d_tcs[64].str
+#define D_PF (D_tcs[64].str)
+#define d_HS d_tcs[65].flg
+#define D_HS (D_tcs[65].flg)
+#define d_WS d_tcs[66].num
+#define D_WS (D_tcs[66].num)
+#define d_TS d_tcs[67].str
+#define D_TS (D_tcs[67].str)
+#define d_FS d_tcs[68].str
+#define D_FS (D_tcs[68].str)
+#define d_DS d_tcs[69].str
+#define D_DS (D_tcs[69].str)
+#define d_VI d_tcs[70].str
+#define D_VI (D_tcs[70].str)
+#define d_VE d_tcs[71].str
+#define D_VE (D_tcs[71].str)
+#define d_AM d_tcs[72].flg
+#define D_AM (D_tcs[72].flg)
+#define d_XV d_tcs[73].flg
+#define D_XV (D_tcs[73].flg)
+#define d_XN d_tcs[74].flg
+#define D_XN (D_tcs[74].flg)
+#define d_COP d_tcs[75].flg
+#define D_COP (D_tcs[75].flg)
+#define d_CLP d_tcs[76].flg
+#define D_CLP (D_tcs[76].flg)
+#define d_CNF d_tcs[77].flg
+#define D_CNF (D_tcs[77].flg)
+#define d_NX d_tcs[78].flg
+#define D_NX (D_tcs[78].flg)
+#define d_CAN d_tcs[79].flg
+#define D_CAN (D_tcs[79].flg)
+#define d_COL d_tcs[80].num
+#define D_COL (D_tcs[80].num)
+#define d_CKJ d_tcs[81].str
+#define D_CKJ (D_tcs[81].str)
+#define d_CVR d_tcs[82].str
+#define D_CVR (D_tcs[82].str)
+#define d_CVN d_tcs[83].str
+#define D_CVN (D_tcs[83].str)
+#define d_CG0 d_tcs[84].flg
+#define D_CG0 (D_tcs[84].flg)
+#define d_CS0 d_tcs[85].str
+#define D_CS0 (D_tcs[85].str)
+#define d_CE0 d_tcs[86].str
+#define D_CE0 (D_tcs[86].str)
+#define d_CC0 d_tcs[87].str
+#define D_CC0 (D_tcs[87].str)
+#define d_AS d_tcs[88].str
+#define D_AS (D_tcs[88].str)
+#define d_AE d_tcs[89].str
+#define D_AE (D_tcs[89].str)
+#define d_AC d_tcs[90].str
+#define D_AC (D_tcs[90].str)
+#define d_CB8 d_tcs[91].str
+#define D_CB8 (D_tcs[91].str)
+#define T_CAPS 92
+#define T_CURSOR 131
+#define T_KEYPAD 135
+#define T_OCAPS 153
+#define T_ECAPS 166
+#define T_N 166
+
+#ifdef MAPKEYS
+# define KMAPDEFSTART 92
+# define NKMAPDEF 61
+# define KMAPADEFSTART 131
+# define NKMAPADEF 22
+# define KMAPMDEFSTART 106
+# define NKMAPMDEF 29
+#endif
diff --git a/src/term.sh b/src/term.sh
index 108bf2f..721a762 100644
--- a/src/term.sh
+++ b/src/term.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
if test -z "$AWK"; then
AWK=awk
@@ -42,11 +42,25 @@ sed < ${srcdir}/term.c \
-e '/"[A-Z]."/s/"/"C/' \
-e '/"/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
| $AWK '
+/^ [{] ".*KMAPDEF[(].*$/{
+ if (min == 0) min = s
+ max = s;
+}
+/^ [{] ".*KMAPADEF[(].*$/{
+ if (amin == 0) amin = s
+ amax = s;
+}
+/^ [{] ".*KMAPMDEF[(].*$/{
+ if (mmin == 0) mmin = s
+ mmax = s;
+}
/^ [{] ".*$/{
a=substr($2,2,length($2)-3);
b=substr($3,3,3);
-if (nolist == 0)
- printf "#define %s (d_tcs[%d].%s)\n",a,s,b
+if (nolist == 0) {
+ printf "#define d_%s d_tcs[%d].%s\n",a,s,b
+ printf "#define D_%s (D_tcs[%d].%s)\n",a,s,b
+ }
s++;
}
/\/* define/{
@@ -58,7 +72,95 @@ nolist = 1;
/\/* list/{
nolist = 0;
}
+END {
+ printf "\n#ifdef MAPKEYS\n"
+ printf "# define KMAPDEFSTART %d\n", min
+ printf "# define NKMAPDEF %d\n", max-min+1
+ printf "# define KMAPADEFSTART %d\n", amin
+ printf "# define NKMAPADEF %d\n", amax-amin+1
+ printf "# define KMAPMDEFSTART %d\n", mmin
+ printf "# define NKMAPMDEF %d\n", mmax-mmin+1
+ printf "#endif\n"
+}
' | sed -e s/NUM/num/ -e s/STR/str/ -e s/FLG/flg/ \
>> term.h
+
+rm -f kmapdef.c
+cat << EOF > kmapdef.c
+/*
+ * This file is automagically created from term.c -- DO NOT EDIT
+ */
+
+#include "config.h"
+
+#ifdef MAPKEYS
+
+EOF
+
+$AWK < ${srcdir}/term.c '
+/^ [{] ".*KMAP.*$/{
+ for (i = 0; i < 3; i++) {
+ q = $(5+i)
+ if (substr(q, 1, 5) == "KMAPD") {
+ if (min == 0) min = s
+ max = s
+ arr[s] = substr(q, 9, length(q)-9)
+ }
+ if (substr(q, 1, 5) == "KMAPA") {
+ if (amin == 0) amin = s
+ amax = s
+ anarr[s] = substr(q, 10, length(q)-10)
+ }
+ if (substr(q, 1, 5) == "KMAPM") {
+ if (mmin == 0) mmin = s
+ mmax = s
+ mnarr[s] = substr(q, 10, length(q)-10)
+ }
+ }
+}
+/^ [{] ".*$/{
+ s++;
+}
+END {
+ printf "char *kmapdef[] = {\n"
+ for (s = min; s <= max; s++) {
+ if (arr[s])
+ printf "%s", arr[s]
+ else
+ printf "0"
+ if (s < max)
+ printf ",\n"
+ else
+ printf "\n"
+ }
+ printf "};\n\n"
+ printf "char *kmapadef[] = {\n"
+ for (s = amin; s <= amax; s++) {
+ if (anarr[s])
+ printf "%s", anarr[s]
+ else
+ printf "0"
+ if (s < amax)
+ printf ",\n"
+ else
+ printf "\n"
+ }
+ printf "};\n\n"
+ printf "char *kmapmdef[] = {\n"
+ for (s = mmin; s <= mmax; s++) {
+ if (mnarr[s])
+ printf "%s", mnarr[s]
+ else
+ printf "0"
+ if (s < mmax)
+ printf ",\n"
+ else
+ printf "\n"
+ }
+ printf "};\n\n#endif\n"
+}
+' >> kmapdef.c
+
+chmod a-w kmapdef.c
chmod a-w term.h
diff --git a/src/termcap.c b/src/termcap.c
index edd4e29..b7d4042 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -36,11 +36,26 @@ static char *findcap __P((char *, char **, int));
static char *e_tgetstr __P((char *, char **));
static int e_tgetflag __P((char *));
static int e_tgetnum __P((char *));
+#ifdef MAPKEYS
+static int addmapseq __P((char *, int));
+static int remmapseq __P((char *));
+#ifdef DEBUG
+static void dumpmap __P((void));
+#endif
+#endif
+
extern struct term term[]; /* terminal capabilities */
extern struct NewWindow nwin_undef, nwin_default, nwin_options;
extern int force_vt, assume_LP;
extern int Z0width, Z1width;
+#ifdef MAPKEYS
+extern struct action umtab[];
+extern struct action mmtab[];
+extern struct action dmtab[];
+extern char *kmap_extras[];
+extern int kmap_extras_fl[];
+#endif
char Termcap[TERMCAP_BUFSIZE + 8]; /* new termcap +8:"TERMCAP=" */
static int Termcaplen;
@@ -69,7 +84,7 @@ char *s;
if (term[i].type != T_STR)
continue;
if (strcmp(term[i].tcname, s) == 0)
- return d_tcs[i].str;
+ return D_tcs[i].str;
}
return 0;
}
@@ -82,13 +97,14 @@ int he;
register char *s;
int i;
char tbuf[TERMCAP_BUFSIZE], *tp;
+ int t, xue, xse, xme;
ASSERT(display);
bzero(tbuf, sizeof(tbuf));
- debug1("InitTermcap: looking for tgetent('%s')\n", d_termname);
- if (tgetent(tbuf, d_termname) != 1)
+ debug1("InitTermcap: looking for tgetent('%s')\n", D_termname);
+ if (*D_termname == 0 || tgetent(tbuf, D_termname) != 1)
{
- Msg(0, "Cannot find termcap entry for %s.", d_termname);
+ Msg(0, "Cannot find termcap entry for '%s'.", D_termname);
return -1;
}
debug1("got it:\n%s\n",tbuf);
@@ -98,212 +114,461 @@ int he;
if (extra_outcap)
debug1("Extra outcap: %s\n", extra_outcap);
#endif
- tp = d_tentry;
+ tp = D_tentry;
for (i = 0; i < T_N; i++)
{
switch(term[i].type)
{
case T_FLG:
- d_tcs[i].flg = e_tgetflag(term[i].tcname);
+ D_tcs[i].flg = e_tgetflag(term[i].tcname);
break;
case T_NUM:
- d_tcs[i].num = e_tgetnum(term[i].tcname);
+ D_tcs[i].num = e_tgetnum(term[i].tcname);
break;
case T_STR:
- d_tcs[i].str = e_tgetstr(term[i].tcname, &tp);
+ D_tcs[i].str = e_tgetstr(term[i].tcname, &tp);
/* no empty strings, please */
- if (d_tcs[i].str && *d_tcs[i].str == 0)
- d_tcs[i].str = 0;
+ if (D_tcs[i].str && *D_tcs[i].str == 0)
+ D_tcs[i].str = 0;
break;
default:
Panic(0, "Illegal tc type in entry #%d", i);
/*NOTREACHED*/
}
}
- if (HC)
+ if (D_HC)
{
Msg(0, "You can't run screen on a hardcopy terminal.");
return -1;
}
- if (OS)
+ if (D_OS)
{
Msg(0, "You can't run screen on a terminal that overstrikes.");
return -1;
}
- if (NS)
- {
- Msg(0, "Terminal must support scrolling.");
- return -1;
- }
- if (!CL)
+ if (!D_CL)
{
Msg(0, "Clear screen capability required.");
return -1;
}
- if (!CM)
+ if (!D_CM)
{
Msg(0, "Addressable cursor capability required.");
return -1;
}
if ((s = getenv("COLUMNS")) && (i = atoi(s)) > 0)
- CO = i;
+ D_CO = i;
if ((s = getenv("LINES")) && (i = atoi(s)) > 0)
- LI = i;
+ D_LI = i;
if (wi)
- CO = wi;
+ D_CO = wi;
if (he)
- LI = he;
- if (CO <= 0)
- CO = 80;
- if (LI <= 0)
- LI = 24;
+ D_LI = he;
+ if (D_CO <= 0)
+ D_CO = 80;
+ if (D_LI <= 0)
+ D_LI = 24;
if (nwin_options.flowflag == nwin_undef.flowflag)
- nwin_default.flowflag = CNF ? FLOW_NOW * 0 :
- XO ? FLOW_NOW * 1 :
+ nwin_default.flowflag = D_CNF ? FLOW_NOW * 0 :
+ D_NX ? FLOW_NOW * 1 :
FLOW_AUTOFLAG;
- CLP |= assume_LP || !AM || XV || XN ||
- (!extra_incap && !strncmp(d_termname, "vt", 2));
- if (!(BL = e_tgetstr("bl", &tp)))
- if (!BL)
- BL = "\007";
- if (!BC)
- {
- if (BS)
- BC = "\b";
+ D_CLP |= assume_LP || !D_AM || D_XV || D_XN ||
+ (!extra_incap && !strncmp(D_termname, "vt", 2));
+ if (!D_BL)
+ D_BL = "\007";
+ if (!D_BC)
+ {
+ if (D_BS)
+ D_BC = "\b";
+ else
+ D_BC = D_LE;
+ }
+ if (!D_CR)
+ D_CR = "\r";
+ if (!D_NL)
+ D_NL = "\n";
+
+ /*
+ * Set up attribute handling.
+ * This is rather complicated because termcap has different
+ * attribute groups.
+ */
+
+ if (D_UG > 0)
+ D_US = D_UE = 0;
+ if (D_SG > 0)
+ D_SO = D_SE = 0;
+ /* Unfortunatelly there is no 'mg' capability.
+ * For now we think that mg > 0 if sg and ug > 0.
+ */
+ if (D_UG > 0 && D_SG > 0)
+ D_MH = D_MD = D_MR = D_MB = D_ME = 0;
+
+ xue = ATYP_U;
+ xse = ATYP_S;
+ xme = ATYP_M;
+
+ if (D_SO && D_SE == 0)
+ {
+ Msg(0, "Warning: 'so' but no 'se' capability.");
+ if (D_ME)
+ xse = xme;
+ else
+ D_SO = 0;
+ }
+ if (D_US && D_UE == 0)
+ {
+ Msg(0, "Warning: 'us' but no 'ue' capability.");
+ if (D_ME)
+ xue = xme;
else
- BC = LE;
- }
- if (!CR)
- CR = "\r";
- if (!NL)
- NL = "\n";
- if (SG <= 0 && UG <= 0)
- {
- /*
- * Does ME also reverse the effect of SO and/or US? This is not
- * clearly specified by the termcap manual. Anyway, we should at
- * least look whether ME and SE/UE are equal:
- */
- if (UE && ((SE && strcmp(SE, UE) == 0) || (ME && strcmp(ME, UE) == 0)))
- UE = 0;
- if (SE && (ME && strcmp(ME, SE) == 0))
- SE = 0;
-
- for (i = 0; i < NATTR; i++)
- d_attrtab[i] = d_tcs[T_ATTR + i].str;
- /* Set up missing entries */
- s = 0;
- for (i = NATTR-1; i >= 0; i--)
- if (d_attrtab[i])
- s = d_attrtab[i];
- for (i = 0; i < NATTR; i++)
+ D_US = 0;
+ }
+ if ((D_MH || D_MD || D_MR || D_MB) && D_ME == 0)
+ {
+ Msg(0, "Warning: 'm?' but no 'me' capability.");
+ D_MH = D_MD = D_MR = D_MB = 0;
+ }
+ /*
+ * Does ME also reverse the effect of SO and/or US? This is not
+ * clearly specified by the termcap manual. Anyway, we should at
+ * least look whether ME and SE/UE are equal:
+ */
+ if (D_UE && D_SE && strcmp(D_SE, D_UE) == 0)
+ xse = xue;
+ if (D_SE && D_ME && strcmp(D_ME, D_SE) == 0)
+ xse = xme;
+ if (D_UE && D_ME && strcmp(D_ME, D_UE) == 0)
+ xue = xme;
+
+ for (i = 0; i < NATTR; i++)
+ {
+ D_attrtab[i] = D_tcs[T_ATTR + i].str;
+ D_attrtyp[i] = i == ATTR_SO ? xse : (i == ATTR_US ? xue : xme);
+ }
+
+ /* Set up missing entries (attributes are priority ordered) */
+ s = 0;
+ t = 0;
+ for (i = 0; i < NATTR; i++)
+ if ((s = D_attrtab[i]))
+ {
+ t = D_attrtyp[i];
+ break;
+ }
+ for (i = 0; i < NATTR; i++)
+ {
+ if (D_attrtab[i] == 0)
{
- if (d_attrtab[i] == 0)
- d_attrtab[i] = s;
- else
- s = d_attrtab[i];
+ D_attrtab[i] = s;
+ D_attrtyp[i] = t;
}
+ else
+ {
+ s = D_attrtab[i];
+ t = D_attrtyp[i];
+ }
}
- else
- {
- MS = 1;
- for (i = 0; i < NATTR; i++)
- d_attrtab[i] = d_tcs[T_ATTR + i].str = 0;
- }
- if (!DO)
- DO = NL;
- if (!SF)
- SF = NL;
- if (IN)
- IC = IM = 0;
- if (EI == 0)
- IM = 0;
+
+ if (!D_DO)
+ D_DO = D_NL;
+ if (!D_SF)
+ D_SF = D_NL;
+ if (D_IN)
+ D_IC = D_IM = 0;
+ if (D_EI == 0)
+ D_IM = 0;
/* some strange termcap entries have IC == IM */
- if (IC && IM && strcmp(IC, IM) == 0)
- IC = 0;
- if (KE == 0)
- KS = 0;
- if (CCE == 0)
- CCS = 0;
- if (CG0)
- {
- if (CS0 == 0)
+ if (D_IC && D_IM && strcmp(D_IC, D_IM) == 0)
+ D_IC = 0;
+ if (D_KE == 0)
+ D_KS = 0;
+ if (D_CVN == 0)
+ D_CVR = 0;
+ if (D_VE == 0)
+ D_VI = 0;
+ if (D_CCE == 0)
+ D_CCS = 0;
+ if (D_CG0)
+ {
+ if (D_CS0 == 0)
#ifdef TERMINFO
- CS0 = "\033(%p1%c";
+ D_CS0 = "\033(%p1%c";
#else
- CS0 = "\033(%.";
+ D_CS0 = "\033(%.";
#endif
- if (CE0 == 0)
- CE0 = "\033(B";
+ if (D_CE0 == 0)
+ D_CE0 = "\033(B";
+ D_AC = 0;
}
- else if (AS && AE)
+ else if (D_AC || (D_AS && D_AE)) /* some kind of graphics */
{
- CG0 = 1;
- CS0 = AS;
- CE0 = AE;
- CC0 = AC;
+ D_CG0 = 1;
+ D_CS0 = (D_AS && D_AE) ? D_AS : "";
+ D_CE0 = (D_AS && D_AE) ? D_AE : "";
+ D_CC0 = D_AC;
}
else
{
- CS0 = CE0 = "";
- CC0 = "g.h.i'j-k-l-m-n+o~p\"q-r-s_t+u+v+w+x|y<z>";
+ D_CS0 = D_CE0 = "";
+ D_CC0 = 0;
+ D_AC = ""; /* enable default string */
}
+
for (i = 0; i < 256; i++)
- d_c0_tab[i] = i;
- if (CC0)
- for (i = strlen(CC0) & ~1; i >= 0; i -= 2)
- d_c0_tab[(int)(unsigned char)CC0[i]] = CC0[i + 1];
- debug1("ISO2022 = %d\n", CG0);
- if (PF == 0)
- PO = 0;
- debug2("terminal size is %d, %d (says TERMCAP)\n", CO, LI);
+ D_c0_tab[i] = i;
+ if (D_AC)
+ {
+ /* init with default string first */
+ s = "l+m+k+j+u+t+v+w+q-x|n+o~s_p\"r#`+a:f'g#~o.v-^+<,>h#I#0#y<z>";
+ for (i = strlen(s) & ~1; i >= 0; i -= 2)
+ D_c0_tab[(int)(unsigned char)s[i]] = s[i + 1];
+ }
+ if (D_CC0)
+ for (i = strlen(D_CC0) & ~1; i >= 0; i -= 2)
+ D_c0_tab[(int)(unsigned char)D_CC0[i]] = D_CC0[i + 1];
+ debug1("ISO2022 = %d\n", D_CG0);
+ if (D_PF == 0)
+ D_PO = 0;
+ debug2("terminal size is %d, %d (says TERMCAP)\n", D_CO, D_LI);
/* Termcap fields Z0 & Z1 contain width-changing sequences. */
- if (CZ1 == 0)
- CZ0 = 0;
+ if (D_CZ1 == 0)
+ D_CZ0 = 0;
Z0width = 132;
Z1width = 80;
CheckScreenSize(0);
- if (TS == 0 || FS == 0 || DS == 0)
- HS = 0;
- if (HS)
+ if (D_TS == 0 || D_FS == 0 || D_DS == 0)
+ D_HS = 0;
+ if (D_HS)
{
debug("oy! we have a hardware status line, says termcap\n");
- if (WS <= 0)
- WS = d_width;
+ if (D_WS <= 0)
+ D_WS = D_width;
+ }
+#ifdef KANJI
+ D_kanji = 0;
+ if (D_CKJ)
+ {
+ if (strcmp(D_CKJ, "euc") == 0)
+ D_kanji = EUC;
+ else if (strcmp(D_CKJ, "sjis") == 0)
+ D_kanji = SJIS;
}
+#endif
- d_UPcost = CalcCost(UP);
- d_DOcost = CalcCost(DO);
- d_NLcost = CalcCost(NL);
- d_LEcost = CalcCost(BC);
- d_NDcost = CalcCost(ND);
- d_CRcost = CalcCost(CR);
- d_IMcost = CalcCost(IM);
- d_EIcost = CalcCost(EI);
+ D_UPcost = CalcCost(D_UP);
+ D_DOcost = CalcCost(D_DO);
+ D_NLcost = CalcCost(D_NL);
+ D_LEcost = CalcCost(D_BC);
+ D_NDcost = CalcCost(D_ND);
+ D_CRcost = CalcCost(D_CR);
+ D_IMcost = CalcCost(D_IM);
+ D_EIcost = CalcCost(D_EI);
#ifdef AUTO_NUKE
- if (CAN)
+ if (D_CAN)
{
debug("termcap has AN, setting autonuke\n");
- d_auto_nuke = 1;
+ D_auto_nuke = 1;
}
#endif
- if (COL > 0)
+ if (D_COL > 0)
{
- debug1("termcap has OL (%d), setting limit\n", COL);
- d_obufmax = COL;
+ debug1("termcap has OL (%d), setting limit\n", D_COL);
+ D_obufmax = D_COL;
}
+#ifdef MAPKEYS
+ D_nseqs = 0;
+ for (i = 0; i < T_OCAPS - T_CAPS; i++)
+ remap(i, 1);
+ for (i = 0; i < KMAP_EXT; i++)
+ remap(i + (KMAP_KEYS+KMAP_AKEYS), 1);
+ D_seqp = D_kmaps[0].seq;
+#endif
- d_tcinited = 1;
+ D_tcinited = 1;
MakeTermcap(0);
return 0;
}
+#ifdef MAPKEYS
+
+int
+remap(n, map)
+int n;
+int map;
+{
+ char *s;
+ int fl = 0, domap = 0;
+ struct action *a1, *a2, *tab;
+
+ tab = umtab;
+ for (;;)
+ {
+ a1 = &tab[n];
+ a2 = 0;
+ if (n < KMAP_KEYS+KMAP_AKEYS)
+ {
+ if (n >= KMAP_KEYS)
+ n -= T_OCAPS-T_CURSOR;
+ s = D_tcs[n + T_CAPS].str;
+ if (n >= T_CURSOR-T_CAPS)
+ a2 = &tab[n + (T_OCAPS-T_CURSOR)];
+ }
+ else
+ {
+ s = kmap_extras[n - (KMAP_KEYS+KMAP_AKEYS)];
+ fl |= kmap_extras_fl[n - (KMAP_KEYS+KMAP_AKEYS)];
+ }
+ if (s == 0)
+ return 0;
+ if (a1 && a1->nr == RC_ILLEGAL)
+ a1 = 0;
+ if (a2 && a2->nr == RC_ILLEGAL)
+ a2 = 0;
+ if (a1 && a1->nr == RC_STUFF && strcmp(a1->args[0], s) == 0)
+ a1 = 0;
+ if (a2 && a2->nr == RC_STUFF && strcmp(a2->args[0], s) == 0)
+ a2 = 0;
+ domap |= a1 || a2;
+ if (tab == umtab)
+ tab = dmtab;
+ else if (tab == dmtab)
+ tab = mmtab;
+ else
+ break;
+ }
+
+ if (map == 0 && domap)
+ return 0;
+ if (map && !domap)
+ return 0;
+ debug3("%smapping %s %#x\n", map? "" :"un",s,n);
+ if (map)
+ return addmapseq(s, n | fl);
+ else
+ return remmapseq(s);
+}
+
+static int
+addmapseq(seq, nr)
+char *seq;
+int nr;
+{
+ int i, j = 0, k, mo, m;
+ char *p, *o;
+
+ k = strlen(seq);
+ if (k > sizeof(D_kmaps[0].seq) - 1)
+ return -1;
+ for (i = 0; i < D_nseqs; i++)
+ if ((j = strcmp(D_kmaps[i].seq, seq)) >= 0)
+ break;
+ if (i < D_nseqs && j == 0)
+ {
+ D_kmaps[i].nr = nr;
+ return 0;
+ }
+ if (D_nseqs >= sizeof(D_kmaps)/sizeof(*D_kmaps)) /* just in case... */
+ return -1;
+ for (j = D_nseqs - 1; j >= i; j--)
+ D_kmaps[j + 1] = D_kmaps[j];
+ p = D_kmaps[i].seq;
+ o = D_kmaps[i].off;
+ strcpy(p, seq);
+ bzero(o, k + 1);
+ D_kmaps[i].nr = nr;
+ D_nseqs++;
+
+ if (i + 1 < D_nseqs)
+ for (j = 0; *p; p++, o++, j++)
+ {
+ if (D_kmaps[i + 1].seq[j] != *p)
+ {
+ if (D_kmaps[i + 1].seq[j])
+ *o = 1;
+ break;
+ }
+ *o = D_kmaps[i + 1].off[j] ? D_kmaps[i + 1].off[j] + 1 : 0;
+ }
+
+ for (k = 0; k < i; k++)
+ for (m = j = 0, p = D_kmaps[k].seq, o = D_kmaps[k].off; *p; p++, o++, j++)
+ {
+ mo = m;
+ if (!m && *p != D_kmaps[i].seq[j])
+ m = 1;
+ if (*o == 0 && mo == 0 && m)
+ *o = i - k;
+ if (*o < i - k || (*o == i - k && m))
+ continue;
+ (*o)++;
+ }
+#ifdef DEBUG
+ dumpmap();
+#endif
+ return 0;
+}
+
+static int
+remmapseq(seq)
+char *seq;
+{
+ int i, j = 0, k;
+ char *p, *o;
+
+ for (i = 0; i < D_nseqs; i++)
+ if ((j = strcmp(D_kmaps[i].seq, seq)) >= 0)
+ break;
+ if (i == D_nseqs || j)
+ return -1;
+ for (k = 0; k < i; k++)
+ for (j = 0, p = D_kmaps[k].seq, o = D_kmaps[k].off; *p; p++, o++, j++)
+ {
+ if (k + *o == i)
+ *o = D_kmaps[i].off[j] ? D_kmaps[i].off[j] + *o - 1 : 0;
+ else if (k + *o > i)
+ (*o)--;
+ }
+ for (j = i + 1; j < D_nseqs; j++)
+ D_kmaps[j - 1] = D_kmaps[j];
+ D_nseqs--;
+#ifdef DEBUG
+ dumpmap();
+#endif
+ return 0;
+}
+
+#ifdef DEBUG
+static void
+dumpmap()
+{
+ char *p, *o;
+ int i,j,n;
+ debug("Mappings:\n");
+ for (i = 0; i < D_nseqs; i++)
+ {
+ for (j = 0, p = D_kmaps[i].seq, o = D_kmaps[i].off; *p; p++, o++, j++)
+ {
+ if (*p > ' ' && (unsigned char)*p < 0177)
+ {
+ debug2("%c[%d] ", *p, *o);
+ }
+ else
+ debug2("\\%03o[%d] ", (unsigned char)*p, *o);
+ }
+ n = D_kmaps[i].nr;
+ debug2(" ==> %d%s\n", n & ~KMAP_NOTIMEOUT, (n & KMAP_NOTIMEOUT) ? " (no timeout)" : "");
+ }
+}
+#endif
+
+#endif
static void
AddCap(s)
@@ -311,13 +576,13 @@ char *s;
{
register int n;
- if (tcLineLen + (n = strlen(s)) > 55 && Termcaplen < TERMCAP_BUFSIZE - 4)
+ if (tcLineLen + (n = strlen(s)) > 55 && Termcaplen < TERMCAP_BUFSIZE + 8 - 4)
{
strcpy(Termcap + Termcaplen, "\\\n\t:");
Termcaplen += 4;
tcLineLen = 0;
}
- if (Termcaplen + n < TERMCAP_BUFSIZE)
+ if (Termcaplen + n < TERMCAP_BUFSIZE + 8)
{
strcpy(Termcap + Termcaplen, s);
Termcaplen += n;
@@ -337,9 +602,9 @@ int aflag;
if (display)
{
- wi = d_width;
- he = d_height;
- tname = d_termname;
+ wi = D_width;
+ he = D_height;
+ tname = D_termname;
}
else
{
@@ -350,7 +615,7 @@ int aflag;
debug1("MakeTermcap(%d)\n", aflag);
if ((s = getenv("SCREENCAP")) && strlen(s) < TERMCAP_BUFSIZE)
{
- sprintf(Termcap, "TERMCAP=%s", s); /* TERMCAP_BUFSIZE + ... ? XXX */
+ sprintf(Termcap, "TERMCAP=%s", s);
sprintf(Term, "TERM=screen");
debug("getenvSCREENCAP o.k.\n");
return Termcap;
@@ -387,7 +652,7 @@ int aflag;
while (0); /* Goto free programming... */
tcLineLen = 100; /* Force NL */
sprintf(Termcap,
- "TERMCAP=SC|%s|VT 100/ANSI X3.64 virtual terminal|", Term + 5);
+ "TERMCAP=SC|%s|VT 100/ANSI X3.64 virtual terminal", Term + 5);
Termcaplen = strlen(Termcap);
debug1("MakeTermcap decided '%s'\n", p);
if (extra_outcap && *extra_outcap)
@@ -410,110 +675,149 @@ int aflag;
sprintf(buf, "li#%d:co#%d:", he, wi);
AddCap(buf);
AddCap("am:");
- if (aflag || (force_vt && !COP) || CLP || !AM)
+ if (aflag || (force_vt && !D_COP) || D_CLP || !D_AM)
{
AddCap("xn:");
AddCap("xv:");
AddCap("LP:");
}
- if (aflag || (CS && SR) || AL || CAL)
+ if (aflag || (D_CS && D_SR) || D_AL || D_CAL)
{
AddCap("sr=\\EM:");
AddCap("al=\\E[L:");
AddCap("AL=\\E[%dL:");
}
- else if (SR)
+ else if (D_SR)
AddCap("sr=\\EM:");
- if (aflag || CS)
+ if (aflag || D_CS)
AddCap("cs=\\E[%i%d;%dr:");
- if (aflag || CS || DL || CDL)
+ if (aflag || D_CS || D_DL || D_CDL)
{
AddCap("dl=\\E[M:");
AddCap("DL=\\E[%dM:");
}
- if (aflag || DC || CDC)
+ if (aflag || D_DC || D_CDC)
{
AddCap("dc=\\E[P:");
AddCap("DC=\\E[%dP:");
}
- if (aflag || CIC || IC || IM)
+ if (aflag || D_CIC || D_IC || D_IM)
{
AddCap("im=\\E[4h:");
AddCap("ei=\\E[4l:");
AddCap("mi:");
AddCap("IC=\\E[%d@:");
}
+#ifdef MAPKEYS
+ AddCap("ks=\\E[?1h\\E=:");
+ AddCap("ke=\\E[?1l\\E>:");
+#endif
if (display)
{
- if (US)
+ if (D_US)
{
AddCap("us=\\E[4m:");
AddCap("ue=\\E[24m:");
}
- if (SO)
+ if (D_SO)
{
AddCap("so=\\E[3m:");
AddCap("se=\\E[23m:");
}
- if (MB)
+ if (D_MB)
AddCap("mb=\\E[5m:");
- if (MD)
+ if (D_MD)
AddCap("md=\\E[1m:");
- if (MH)
+ if (D_MH)
AddCap("mh=\\E[2m:");
- if (MR)
+ if (D_MR)
AddCap("mr=\\E[7m:");
- if (MB || MD || MH || MR)
+ if (D_MB || D_MD || D_MH || D_MR)
AddCap("me=\\E[m:ms:");
- if (VB)
+ if (D_VB)
AddCap("vb=\\E[?5h\\E[?5l:");
- if (KS)
+#ifndef MAPKEYS
+ if (D_KS)
{
AddCap("ks=\\E=:");
AddCap("ke=\\E>:");
}
- if (CCS)
+ if (D_CCS)
{
AddCap("CS=\\E[?1h:");
AddCap("CE=\\E[?1l:");
}
- if (CG0)
+#endif
+ if (D_CG0)
{
AddCap("G0:");
AddCap("as=\\E(0:");
AddCap("ae=\\E(B:");
+ /* avoid `` because some shells dump core... */
+ AddCap("ac=\\140\\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:");
}
- if (PO)
+ if (D_PO)
{
AddCap("po=\\E[5i:");
AddCap("pf=\\E[4i:");
}
- if (CZ0)
+ if (D_CZ0)
{
AddCap("Z0=\\E[?3h:");
AddCap("Z1=\\E[?3l:");
}
- if (CWS)
+ if (D_CWS)
AddCap("WS=\\E[8;%d;%dt:");
- for (i = T_CAPS; i < T_ECAPS; i++)
+ }
+ for (i = T_CAPS; i < T_ECAPS; i++)
+ {
+#ifdef MAPKEYS
+ struct action *act;
+ if (i < T_OCAPS)
{
- switch(term[i].type)
+ if (i >= T_KEYPAD) /* don't put keypad codes in TERMCAP */
+ continue; /* - makes it too big */
+ if (i >= T_CURSOR && i < T_OCAPS)
+ {
+ act = &umtab[i - (T_CURSOR - T_OCAPS + T_CAPS)];
+ if (act->nr == RC_ILLEGAL)
+ act = &dmtab[i - (T_CURSOR - T_OCAPS + T_CAPS)];
+ }
+ else
{
- case T_STR:
- if (d_tcs[i].str == 0)
- break;
- MakeString(term[i].tcname, buf, sizeof(buf), d_tcs[i].str);
- AddCap(buf);
- break;
- case T_FLG:
- if (d_tcs[i].flg == 0)
- break;
- sprintf(buf, "%s:", term[i].tcname);
- AddCap(buf);
- break;
- default:
- break;
+ act = &umtab[i - T_CAPS];
+ if (act->nr == RC_ILLEGAL)
+ act = &dmtab[i - T_CAPS];
}
+ if (act->nr != RC_ILLEGAL)
+ {
+ if (act->nr == RC_STUFF)
+ {
+ MakeString(term[i].tcname, buf, sizeof(buf), act->args[0]);
+ AddCap(buf);
+ }
+ continue;
+ }
+ }
+#endif
+ if (display == 0)
+ continue;
+ switch(term[i].type)
+ {
+ case T_STR:
+ if (D_tcs[i].str == 0)
+ break;
+ MakeString(term[i].tcname, buf, sizeof(buf), D_tcs[i].str);
+ AddCap(buf);
+ break;
+ case T_FLG:
+ if (D_tcs[i].flg == 0)
+ break;
+ sprintf(buf, "%s:", term[i].tcname);
+ AddCap(buf);
+ break;
+ default:
+ break;
}
}
debug("MakeTermcap: end\n");
diff --git a/src/terminfo/checktc.c b/src/terminfo/checktc.c
index 1d5473e..ccc9485 100644
--- a/src/terminfo/checktc.c
+++ b/src/terminfo/checktc.c
@@ -38,9 +38,9 @@ main()
exit(1);
}
- if (s = getenv("COLUMNS"))
+ if ((s = getenv("COLUMNS")))
CO = atoi(s);
- if (s = getenv("LINES"))
+ if ((s = getenv("LINES")))
LI = atoi(s);
if (CO == 0)
CO = tgetnum("co");
@@ -101,7 +101,7 @@ main()
XN = tgetflag("xn");
printf("Termcap: terminal has %smagic margins", XN ? "" : "no ");
GotoPos(0, 5);
- if (XN = tgetflag("xn"))
+ if ((XN = tgetflag("xn")))
{
printf(" xn capability set, but terminal has no magic-margins");
GotoPos(CO-1, 4);
@@ -129,7 +129,7 @@ main()
RETURN();
}
}
- if (CS = tgetstr("cs", &tp))
+ if ((CS = tgetstr("cs", &tp)))
{
printf("Termcap: terminal has scrollregions");
GotoPos(0, 5);
@@ -141,7 +141,7 @@ main()
GotoPos(0, 10);
RETURN();
}
- if (SR = tgetstr("sr", &tp))
+ if ((SR = tgetstr("sr", &tp)))
{
GotoPos(0, 5);
printf(" sr capability set, but doesn't work");
diff --git a/src/terminfo/screen-sco.mail b/src/terminfo/sco.mail
index bd95e4f..bd95e4f 100644
--- a/src/terminfo/screen-sco.mail
+++ b/src/terminfo/sco.mail
diff --git a/src/terminfo/screencap b/src/terminfo/screencap
index 1cef287..2db7d21 100644
--- a/src/terminfo/screencap
+++ b/src/terminfo/screencap
@@ -1,14 +1,19 @@
SC|screen|VT 100/ANSI X3.64 virtual terminal:\
+ :am:xn:ms:mi:G0:km:\
:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
:do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
- :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:xv:\
- :li#24:co#80:LP:us=\E[4m:ue=\E[24m:so=\E[3m:se=\E[23m:\
- :mb=\E[5m:md=\E[1m:mr=\E[7m:me=\E[m:ms:sr=\EM:al=\E[L:\
+ :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
+ :li#24:co#80:us=\E[4m:ue=\E[24m:so=\E[3m:se=\E[23m:\
+ :mb=\E[5m:md=\E[1m:mr=\E[7m:me=\E[m:sr=\EM:al=\E[L:\
:AL=\E[%dL:dl=\E[M:DL=\E[%dM:cs=\E[%i%d;%dr:dc=\E[P:\
- :DC=\E[%dP:im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:\
- :ks=\E=:ke=\E>:G0:\
- :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:km:\
- :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:
+ :DC=\E[%dP:im=\E[4h:ei=\E[4l:IC=\E[%d@:\
+ :ks=\E[?1h\E=:ke=\E[?1l\E>:\
+ :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
+ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\
+ :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\
+ :kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:kP=\E[5~:kN=\E[6~:\
+ :as=^N:ae=^O:\
+ :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:
SW|screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols:\
:co#132:tc=screen:
diff --git a/src/terminfo/screeninfo.src b/src/terminfo/screeninfo.src
index 1835b61..62db2af 100644
--- a/src/terminfo/screeninfo.src
+++ b/src/terminfo/screeninfo.src
@@ -1,5 +1,5 @@
screen|VT 100/ANSI X3.64 virtual terminal,
- mir, msgr, xon, km,
+ am, km, mir, msgr, xenl,
cols#80, it#8, lines#24,
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,
@@ -7,16 +7,20 @@ screen|VT 100/ANSI X3.64 virtual terminal,
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, home=\E[H,
- ht=\t, hts=\EH, ich=\E[%p1%d@,
- il=\E[%p1%dL, il1=\E[L, ind=\n, is2=\E)0, kbs=\b,
- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE,
- rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E>,
+ ht=\t, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
+ ind=\n, is2=\E)0, kbs=\b, 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~,
+ kich1=\E[2~, kll=\E[4~, 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=, smso=\E[3m, smul=\E[4m,
- tbc=\E[3g,
+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m,
+ tbc=\E[3g, smacs=^N, rmacs=^O,
+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00,
screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols,
- mir, msgr, xon, km,
+ am, km, mir, msgr, xenl,
cols#132, it#8, lines#24,
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,
@@ -24,11 +28,15 @@ screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols,
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, home=\E[H,
- ht=\t, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
- il=\E[%p1%dL, il1=\E[L, ind=\n, is2=\E)0, kbs=\b,
- kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
- kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE,
- rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E>,
+ ht=\t, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
+ ind=\n, is2=\E)0, kbs=\b, 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~,
+ kich1=\E[2~, kll=\E[4~, 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=, smso=\E[3m, smul=\E[4m,
- tbc=\E[3g,
+ smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m,
+ tbc=\E[3g, smacs=^N, rmacs=^O,
+ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00,
diff --git a/src/tty.c.dist b/src/tty.c.dist
index d5d7f56..2e80b7a 100644
--- a/src/tty.c.dist
+++ b/src/tty.c.dist
@@ -31,6 +31,9 @@ RCS_ID("$Id$ FAU")
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
+#ifndef sgi
+# include <sys/file.h>
+#endif
#if !defined(sun) || defined(SUNOS3)
# include <sys/ioctl.h> /* collosions with termios.h */
#else
@@ -52,14 +55,22 @@ RCS_ID("$Id$ FAU")
extern struct display *display, *displays;
extern int iflag;
+/* Frank Schulz (fschulz@pyramid.com):
+ * I have no idea why VSTART is not defined and my fix is probably not
+ * the cleanest, but it works.
+ */
+#if !defined(VSTART) && defined(_VSTART)
+#define VSTART _VSTART
+#endif
+#if !defined(VSTOP) && defined(_VSTOP)
+#define VSTOP _VSTOP
+#endif
-static sig_t
-SigAlrmDummy(SIGDEFARG)
+static sigret_t
+SigAlrmDummy SIGDEFARG
{
debug("SigAlrmDummy()\n");
-#ifndef SIGVOID
- return (sig_t)0;
-#endif
+ SIGRETURN;
}
/*
@@ -71,12 +82,12 @@ OpenTTY(line)
char *line;
{
int f;
- sig_t (*sigalrm)__P(SIGPROTOARG);
+ sigret_t (*sigalrm)__P(SIGPROTOARG);
sigalrm = signal(SIGALRM, SigAlrmDummy);
alarm(2);
/* this open only succeeds, if real uid is allowed */
- if ((f = secopen(line, O_RDWR | O_NDELAY, 0)) == -1)
+ if ((f = secopen(line, O_RDWR | O_NONBLOCK, 0)) == -1)
{
Msg(errno, "Cannot open line '%s' for R/W", line);
alarm(0);
@@ -106,9 +117,9 @@ char *line;
if (display)
{
debug1("OpenTTY: using mode of display for %s\n", line);
- SetTTY(f, &d_NewMode);
+ SetTTY(f, &D_NewMode);
#ifdef DEBUG
- DebugTTY(&d_NewMode);
+ DebugTTY(&D_NewMode);
#endif
}
else
@@ -284,6 +295,11 @@ int ttyflag;
m->tio.c_cc[VSTATUS] = Ctrl('T');
#endif /* VSTATUS */
+ if (ttyflag)
+ {
+ m->tio.c_cc[VMIN] = 1;
+ m->tio.c_cc[VTIME] = 0;
+ }
# ifdef hpux
m->m_ltchars.t_suspc = Ctrl('Z');
m->m_ltchars.t_dsuspc = Ctrl('Y');
@@ -381,6 +397,11 @@ int ttyflag;
#if defined(VSWTCH) && VSWTCH < MAXCC
m->tio.c_cc[VSWTCH] = 0000;
#endif /* VSWTCH */
+ if (ttyflag)
+ {
+ m->tio.c_cc[VMIN] = 1;
+ m->tio.c_cc[VTIME] = 0;
+ }
# else /* TERMIO */
debug1("InitTTY: BSD: defaults a la SunOS 4.1.3 (%d)\n", ttyflag);
m->m_ttyb.sg_ispeed = B9600;
@@ -440,6 +461,12 @@ int ttyflag;
;
# endif /* TERMIO */
#endif /* POSIX */
+
+#if defined(KANJI) && defined(TIOCKSET)
+ m->m_jtchars.t_ascii = 'J';
+ m->m_jtchars.t_kanji = 'B';
+ m->m_knjmode = KM_ASCII | KM_SYSSJIS;
+#endif
}
void
@@ -456,6 +483,14 @@ struct mode *mp;
#else
# ifdef TERMIO
ioctl(fd, TCSETAW, (char *)&mp->tio);
+# ifdef CYTERMIO
+ if (mp->tio.c_line == 3)
+ {
+ ioctl(fd, LDSETMAPKEY, (char *)&mp->m_mapkey);
+ ioctl(fd, LDSETMAPSCREEN, (char *)&mp->m_mapscreen);
+ ioctl(fd, LDSETBACKSPACE, (char *)&mp->m_backspace);
+ }
+# endif
# else
/* ioctl(fd, TIOCSETP, (char *)&mp->m_ttyb); */
ioctl(fd, TIOCSETC, (char *)&mp->m_tchars);
@@ -465,6 +500,10 @@ struct mode *mp;
ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); /* moved here for apollo. jw */
# endif
#endif
+#if defined(KANJI) && defined(TIOCKSET)
+ ioctl(fd, TIOCKSETC, &mp->m_jtchars);
+ ioctl(fd, TIOCKSET, &mp->m_knjmode);
+#endif
if (errno)
Msg(errno, "SetTTY (fd %d): ioctl failed", fd);
}
@@ -483,6 +522,20 @@ struct mode *mp;
#else
# ifdef TERMIO
ioctl(fd, TCGETA, (char *)&mp->tio);
+# ifdef CYTERMIO
+ if (mp->tio.c_line == 3)
+ {
+ ioctl(fd, LDGETMAPKEY, (char *)&mp->m_mapkey);
+ ioctl(fd, LDGETMAPSCREEN, (char *)&mp->m_mapscreen);
+ ioctl(fd, LDGETBACKSPACE, (char *)&mp->m_backspace);
+ }
+ else
+ {
+ mp->m_mapkey = NOMAPKEY;
+ mp->m_mapscreen = NOMAPSCREEN;
+ mp->m_backspace = '\b';
+ }
+# endif
# else
ioctl(fd, TIOCGETP, (char *)&mp->m_ttyb);
ioctl(fd, TIOCGETC, (char *)&mp->m_tchars);
@@ -491,6 +544,10 @@ struct mode *mp;
ioctl(fd, TIOCGETD, (char *)&mp->m_ldisc);
# endif
#endif
+#if defined(KANJI) && defined(TIOCKSET)
+ ioctl(fd, TIOCKGETC, &mp->m_jtchars);
+ ioctl(fd, TIOCKGET, &mp->m_knjmode);
+#endif
if (errno)
Msg(errno, "GetTTY (fd %d): ioctl failed", fd);
}
@@ -502,17 +559,24 @@ struct mode *op, *np;
*np = *op;
#if defined(TERMIO) || defined(POSIX)
- np->tio.c_iflag &= ~ICRNL;
-# ifdef ONLCR
- np->tio.c_oflag &= ~ONLCR;
+# ifdef CYTERMIO
+ np->m_mapkey = NOMAPKEY;
+ np->m_mapscreen = NOMAPSCREEN;
+ np->tio.c_line = 0;
# endif
+#if defined(ICRNL)
+ np->tio.c_iflag &= ~ICRNL;
+#endif /* ICRNL */
+#if defined(ONLCR)
+ np->tio.c_oflag &= ~ONLCR;
+#endif /* ONLCR */
np->tio.c_lflag &= ~(ICANON | ECHO);
-#ifdef OSF1
/*
* From Andrew Myers (andru@tonic.lcs.mit.edu)
*/
- np->tio.c_lflag &= ~IEXTEN;
-#endif
+#if defined(IEXTEN)
+ np->tio.c_lflag &= ~IEXTEN;
+#endif /* IEXTEN */
/*
* Unfortunately, the master process never will get SIGINT if the real
@@ -533,8 +597,12 @@ struct mode *op, *np;
*/
np->tio.c_cc[VMIN] = 1;
np->tio.c_cc[VTIME] = 0;
- startc = op->tio.c_cc[VSTART];
- stopc = op->tio.c_cc[VSTOP];
+#if defined(VSTART) && VSTART < MAXCC
+ startc = op->tio.c_cc[VSTART];
+#endif /* VSTART */
+#if defined(VSTOP) && VSTOP < MAXCC
+ stopc = op->tio.c_cc[VSTOP];
+#endif /* VSTOP */
if (iflag)
origintrc = intrc = op->tio.c_cc[VINTR];
else
@@ -543,19 +611,35 @@ struct mode *op, *np;
intrc = np->tio.c_cc[VINTR] = VDISABLE;
}
np->tio.c_cc[VQUIT] = VDISABLE;
- if (d_flow == 0)
+ if (D_flow == 0)
{
np->tio.c_cc[VINTR] = VDISABLE;
- np->tio.c_cc[VSTART] = VDISABLE;
- np->tio.c_cc[VSTOP] = VDISABLE;
+#if defined(VSTART) && VSTART < MAXCC
+ np->tio.c_cc[VSTART] = VDISABLE;
+#endif /* VSTART */
+#if defined(VSTOP) && VSTOP < MAXCC
+ np->tio.c_cc[VSTOP] = VDISABLE;
+#endif /* VSTOP */
np->tio.c_iflag &= ~IXON;
}
#if defined(VDISCARD) && VDISCARD < MAXCC
np->tio.c_cc[VDISCARD] = VDISABLE;
#endif /* VDISCARD */
+#if defined(VLNEXT) && VLNEXT < MAXCC
+ np->tio.c_cc[VLNEXT] = VDISABLE;
+#endif /* VLNEXT */
+#if defined(VSTATUS) && VSTATUS < MAXCC
+ np->tio.c_cc[VSTATUS] = VDISABLE;
+#endif /* VSTATUS */
#if defined(VSUSP) && VSUSP < MAXCC
np->tio.c_cc[VSUSP] = VDISABLE;
#endif /* VSUSP */
+#if defined(VERASE) && VERASE < MAXCC
+ np->tio.c_cc[VERASE] = VDISABLE;
+#endif /* VERASE */
+#if defined(VKILL) && VKILL < MAXCC
+ np->tio.c_cc[VKILL] = VDISABLE;
+#endif /* VKILL */
# ifdef hpux
np->m_ltchars.t_suspc = VDISABLE;
np->m_ltchars.t_dsuspc = VDISABLE;
@@ -567,6 +651,12 @@ struct mode *op, *np;
#if defined(VDSUSP) && VDSUSP < MAXCC
np->tio.c_cc[VDSUSP] = VDISABLE;
#endif /* VDSUSP */
+#if defined(VREPRINT) && VREPRINT < MAXCC
+ np->tio.c_cc[VREPRINT] = VDISABLE;
+#endif /* VREPRINT */
+#if defined(VWERASE) && VWERASE < MAXCC
+ np->tio.c_cc[VWERASE] = VDISABLE;
+#endif /* VWERASE */
# endif /* hpux */
#else /* TERMIO || POSIX */
startc = op->m_tchars.t_startc;
@@ -580,8 +670,12 @@ struct mode *op, *np;
}
np->m_ttyb.sg_flags &= ~(CRMOD | ECHO);
np->m_ttyb.sg_flags |= CBREAK;
+# if defined(CYRILL) && defined(CSTYLE) && defined(CS_8BITS)
+ np->m_ttyb.sg_flags &= ~CSTYLE;
+ np->m_ttyb.sg_flags |= CS_8BITS;
+# endif
np->m_tchars.t_quitc = -1;
- if (d_flow == 0)
+ if (D_flow == 0)
{
np->m_tchars.t_intrc = -1;
np->m_tchars.t_startc = -1;
@@ -599,46 +693,54 @@ SetFlow(on)
int on;
{
ASSERT(display);
- if (d_flow == on)
+ if (D_flow == on)
return;
#if defined(TERMIO) || defined(POSIX)
if (on)
{
- d_NewMode.tio.c_cc[VINTR] = intrc;
- d_NewMode.tio.c_cc[VSTART] = startc;
- d_NewMode.tio.c_cc[VSTOP] = stopc;
- d_NewMode.tio.c_iflag |= IXON;
+ D_NewMode.tio.c_cc[VINTR] = intrc;
+#if defined(VSTART) && VSTART < MAXCC
+ D_NewMode.tio.c_cc[VSTART] = startc;
+#endif /* VSTART */
+#if defined(VSTOP) && VSTOP < MAXCC
+ D_NewMode.tio.c_cc[VSTOP] = stopc;
+#endif /* VSTOP */
+ D_NewMode.tio.c_iflag |= IXON;
}
else
{
- d_NewMode.tio.c_cc[VINTR] = VDISABLE;
- d_NewMode.tio.c_cc[VSTART] = VDISABLE;
- d_NewMode.tio.c_cc[VSTOP] = VDISABLE;
- d_NewMode.tio.c_iflag &= ~IXON;
+ D_NewMode.tio.c_cc[VINTR] = VDISABLE;
+#if defined(VSTART) && VSTART < MAXCC
+ D_NewMode.tio.c_cc[VSTART] = VDISABLE;
+#endif /* VSTART */
+#if defined(VSTOP) && VSTOP < MAXCC
+ D_NewMode.tio.c_cc[VSTOP] = VDISABLE;
+#endif /* VSTOP */
+ D_NewMode.tio.c_iflag &= ~IXON;
}
# ifdef POSIX
- if (tcsetattr(d_userfd, TCSANOW, &d_NewMode.tio))
+ if (tcsetattr(D_userfd, TCSANOW, &D_NewMode.tio))
# else
- if (ioctl(d_userfd, TCSETAW, (char *)&d_NewMode.tio) != 0)
+ if (ioctl(D_userfd, TCSETAW, (char *)&D_NewMode.tio) != 0)
# endif
debug1("SetFlow: ioctl errno %d\n", errno);
#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 = intrc;
+ D_NewMode.m_tchars.t_startc = startc;
+ D_NewMode.m_tchars.t_stopc = stopc;
}
else
{
- d_NewMode.m_tchars.t_intrc = -1;
- d_NewMode.m_tchars.t_startc = -1;
- d_NewMode.m_tchars.t_stopc = -1;
+ D_NewMode.m_tchars.t_intrc = -1;
+ D_NewMode.m_tchars.t_startc = -1;
+ D_NewMode.m_tchars.t_stopc = -1;
}
- if (ioctl(d_userfd, TIOCSETC, (char *)&d_NewMode.m_tchars) != 0)
+ if (ioctl(D_userfd, TIOCSETC, (char *)&D_NewMode.m_tchars) != 0)
debug1("SetFlow: ioctl errno %d\n", errno);
#endif /* POSIX || TERMIO */
- d_flow = on;
+ D_flow = on;
}
@@ -656,9 +758,9 @@ int fd;
{
#if defined(POSIX) && !defined(ultrix)
setsid(); /* will break terminal affiliation */
-# ifdef BSD
+# if defined(BSD) && defined(TIOCSCTTY)
ioctl(fd, TIOCSCTTY, (char *)0);
-# endif /* BSD */
+# endif /* BSD && TIOCSCTTY */
#else /* POSIX */
# ifdef SYSV
setpgrp(); /* will break terminal affiliation */
@@ -666,7 +768,7 @@ int fd;
# ifdef BSDJOBS
int devtty;
- if ((devtty = open("/dev/tty", O_RDWR | O_NDELAY)) >= 0)
+ if ((devtty = open("/dev/tty", O_RDWR | O_NONBLOCK)) >= 0)
{
if (ioctl(devtty, TIOCNOTTY, (char *)0))
debug2("brktty: ioctl(devtty=%d, TIOCNOTTY, 0) = %d\n", devtty, errno);
@@ -686,10 +788,15 @@ int fd;
mypid = getpid();
-# if defined(BSDI) || defined(__386BSD__) || defined(__osf__)
+ /* The next lines should be obsolete. Can anybody check if they
+ * are really needed on the BSD platforms?
+ */
+# if defined(__osf__) || (BSD >= 199103)
setsid(); /* should be already done */
+# ifdef TIOCSCTTY
ioctl(fd, TIOCSCTTY, (char *)0);
-# endif /* BSDI || __386BSD__ */
+# endif
+# endif
# ifdef POSIX
if (tcsetpgrp(fd, mypid))
@@ -738,7 +845,7 @@ int n, closeopen;
Msg(0, "Ouch, cannot reopen line %s, please try harder", wp->w_tty);
return;
}
- (void) fcntl(wp->w_ptyfd, F_SETFL, FNDELAY);
+ (void) fcntl(wp->w_ptyfd, F_SETFL, FNBLOCK);
}
else
{
@@ -824,8 +931,8 @@ char *rc_name;
Msg(0, "I need a display");
return -1;
}
- for (d = displays; d; d = d->_d_next)
- if (strcmp(d->_d_usertty, "/dev/console") == 0)
+ for (d = displays; d; d = d->d_next)
+ if (strcmp(d->d_usertty, "/dev/console") == 0)
break;
if (d)
{
diff --git a/src/tty.sh b/src/tty.sh
index e9f3775..f5db2fe 100644
--- a/src/tty.sh
+++ b/src/tty.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
# sh tty.sh tty.c
# This inserts all the needed #ifdefs for IF{} statements
# and generates tty.c
@@ -48,6 +48,9 @@ RCS_ID("$Id$ FAU")
#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
+#ifndef sgi
+# include <sys/file.h>
+#endif
#if !defined(sun) || defined(SUNOS3)
# include <sys/ioctl.h> /* collosions with termios.h */
#else
@@ -69,14 +72,22 @@ RCS_ID("$Id$ FAU")
extern struct display *display, *displays;
extern int iflag;
+/* Frank Schulz (fschulz@pyramid.com):
+ * I have no idea why VSTART is not defined and my fix is probably not
+ * the cleanest, but it works.
+ */
+#if !defined(VSTART) && defined(_VSTART)
+#define VSTART _VSTART
+#endif
+#if !defined(VSTOP) && defined(_VSTOP)
+#define VSTOP _VSTOP
+#endif
-static sig_t
-SigAlrmDummy(SIGDEFARG)
+static sigret_t
+SigAlrmDummy SIGDEFARG
{
debug("SigAlrmDummy()\n");
-#ifndef SIGVOID
- return (sig_t)0;
-#endif
+ SIGRETURN;
}
/*
@@ -88,12 +99,12 @@ OpenTTY(line)
char *line;
{
int f;
- sig_t (*sigalrm)__P(SIGPROTOARG);
+ sigret_t (*sigalrm)__P(SIGPROTOARG);
sigalrm = signal(SIGALRM, SigAlrmDummy);
alarm(2);
/* this open only succeeds, if real uid is allowed */
- if ((f = secopen(line, O_RDWR | O_NDELAY, 0)) == -1)
+ if ((f = secopen(line, O_RDWR | O_NONBLOCK, 0)) == -1)
{
Msg(errno, "Cannot open line '%s' for R/W", line);
alarm(0);
@@ -123,9 +134,9 @@ char *line;
if (display)
{
debug1("OpenTTY: using mode of display for %s\n", line);
- SetTTY(f, &d_NewMode);
+ SetTTY(f, &D_NewMode);
#ifdef DEBUG
- DebugTTY(&d_NewMode);
+ DebugTTY(&D_NewMode);
#endif
}
else
@@ -223,6 +234,11 @@ XIF{VWERASE} m->tio.c_cc[VWERASE] = Ctrl('W');
XIF{VLNEXT} m->tio.c_cc[VLNEXT] = Ctrl('V');
XIF{VSTATUS} m->tio.c_cc[VSTATUS] = Ctrl('T');
+ if (ttyflag)
+ {
+ m->tio.c_cc[VMIN] = 1;
+ m->tio.c_cc[VTIME] = 0;
+ }
# ifdef hpux
m->m_ltchars.t_suspc = Ctrl('Z');
m->m_ltchars.t_dsuspc = Ctrl('Y');
@@ -276,6 +292,11 @@ XIF{VEOF} m->tio.c_cc[VEOF] = Ctrl('D');
XIF{VEOL} m->tio.c_cc[VEOL] = 0377;
XIF{VEOL2} m->tio.c_cc[VEOL2] = 0377;
XIF{VSWTCH} m->tio.c_cc[VSWTCH] = 0000;
+ if (ttyflag)
+ {
+ m->tio.c_cc[VMIN] = 1;
+ m->tio.c_cc[VTIME] = 0;
+ }
# else /* TERMIO */
debug1("InitTTY: BSD: defaults a la SunOS 4.1.3 (%d)\n", ttyflag);
m->m_ttyb.sg_ispeed = B9600;
@@ -317,6 +338,12 @@ IF{LCRTBS} | LCRTBS
;
# endif /* TERMIO */
#endif /* POSIX */
+
+#if defined(KANJI) && defined(TIOCKSET)
+ m->m_jtchars.t_ascii = 'J';
+ m->m_jtchars.t_kanji = 'B';
+ m->m_knjmode = KM_ASCII | KM_SYSSJIS;
+#endif
}
void
@@ -333,6 +360,14 @@ struct mode *mp;
#else
# ifdef TERMIO
ioctl(fd, TCSETAW, (char *)&mp->tio);
+# ifdef CYTERMIO
+ if (mp->tio.c_line == 3)
+ {
+ ioctl(fd, LDSETMAPKEY, (char *)&mp->m_mapkey);
+ ioctl(fd, LDSETMAPSCREEN, (char *)&mp->m_mapscreen);
+ ioctl(fd, LDSETBACKSPACE, (char *)&mp->m_backspace);
+ }
+# endif
# else
/* ioctl(fd, TIOCSETP, (char *)&mp->m_ttyb); */
ioctl(fd, TIOCSETC, (char *)&mp->m_tchars);
@@ -342,6 +377,10 @@ struct mode *mp;
ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); /* moved here for apollo. jw */
# endif
#endif
+#if defined(KANJI) && defined(TIOCKSET)
+ ioctl(fd, TIOCKSETC, &mp->m_jtchars);
+ ioctl(fd, TIOCKSET, &mp->m_knjmode);
+#endif
if (errno)
Msg(errno, "SetTTY (fd %d): ioctl failed", fd);
}
@@ -360,6 +399,20 @@ struct mode *mp;
#else
# ifdef TERMIO
ioctl(fd, TCGETA, (char *)&mp->tio);
+# ifdef CYTERMIO
+ if (mp->tio.c_line == 3)
+ {
+ ioctl(fd, LDGETMAPKEY, (char *)&mp->m_mapkey);
+ ioctl(fd, LDGETMAPSCREEN, (char *)&mp->m_mapscreen);
+ ioctl(fd, LDGETBACKSPACE, (char *)&mp->m_backspace);
+ }
+ else
+ {
+ mp->m_mapkey = NOMAPKEY;
+ mp->m_mapscreen = NOMAPSCREEN;
+ mp->m_backspace = '\b';
+ }
+# endif
# else
ioctl(fd, TIOCGETP, (char *)&mp->m_ttyb);
ioctl(fd, TIOCGETC, (char *)&mp->m_tchars);
@@ -368,6 +421,10 @@ struct mode *mp;
ioctl(fd, TIOCGETD, (char *)&mp->m_ldisc);
# endif
#endif
+#if defined(KANJI) && defined(TIOCKSET)
+ ioctl(fd, TIOCKGETC, &mp->m_jtchars);
+ ioctl(fd, TIOCKGET, &mp->m_knjmode);
+#endif
if (errno)
Msg(errno, "GetTTY (fd %d): ioctl failed", fd);
}
@@ -379,17 +436,18 @@ struct mode *op, *np;
*np = *op;
#if defined(TERMIO) || defined(POSIX)
- np->tio.c_iflag &= ~ICRNL;
-# ifdef ONLCR
- np->tio.c_oflag &= ~ONLCR;
+# ifdef CYTERMIO
+ np->m_mapkey = NOMAPKEY;
+ np->m_mapscreen = NOMAPSCREEN;
+ np->tio.c_line = 0;
# endif
+IF{ICRNL} np->tio.c_iflag &= ~ICRNL;
+IF{ONLCR} np->tio.c_oflag &= ~ONLCR;
np->tio.c_lflag &= ~(ICANON | ECHO);
-#ifdef OSF1
/*
* From Andrew Myers (andru@tonic.lcs.mit.edu)
*/
- np->tio.c_lflag &= ~IEXTEN;
-#endif
+IF{IEXTEN} np->tio.c_lflag &= ~IEXTEN;
/*
* Unfortunately, the master process never will get SIGINT if the real
@@ -410,8 +468,8 @@ struct mode *op, *np;
*/
np->tio.c_cc[VMIN] = 1;
np->tio.c_cc[VTIME] = 0;
- startc = op->tio.c_cc[VSTART];
- stopc = op->tio.c_cc[VSTOP];
+XIF{VSTART} startc = op->tio.c_cc[VSTART];
+XIF{VSTOP} stopc = op->tio.c_cc[VSTOP];
if (iflag)
origintrc = intrc = op->tio.c_cc[VINTR];
else
@@ -420,15 +478,19 @@ struct mode *op, *np;
intrc = np->tio.c_cc[VINTR] = VDISABLE;
}
np->tio.c_cc[VQUIT] = VDISABLE;
- if (d_flow == 0)
+ if (D_flow == 0)
{
np->tio.c_cc[VINTR] = VDISABLE;
- np->tio.c_cc[VSTART] = VDISABLE;
- np->tio.c_cc[VSTOP] = VDISABLE;
+XIF{VSTART} np->tio.c_cc[VSTART] = VDISABLE;
+XIF{VSTOP} np->tio.c_cc[VSTOP] = VDISABLE;
np->tio.c_iflag &= ~IXON;
}
XIF{VDISCARD} np->tio.c_cc[VDISCARD] = VDISABLE;
+XIF{VLNEXT} np->tio.c_cc[VLNEXT] = VDISABLE;
+XIF{VSTATUS} np->tio.c_cc[VSTATUS] = VDISABLE;
XIF{VSUSP} np->tio.c_cc[VSUSP] = VDISABLE;
+XIF{VERASE} np->tio.c_cc[VERASE] = VDISABLE;
+XIF{VKILL} np->tio.c_cc[VKILL] = VDISABLE;
# ifdef hpux
np->m_ltchars.t_suspc = VDISABLE;
np->m_ltchars.t_dsuspc = VDISABLE;
@@ -438,6 +500,8 @@ XIF{VSUSP} np->tio.c_cc[VSUSP] = VDISABLE;
np->m_ltchars.t_lnextc = VDISABLE;
# else /* hpux */
XIF{VDSUSP} np->tio.c_cc[VDSUSP] = VDISABLE;
+XIF{VREPRINT} np->tio.c_cc[VREPRINT] = VDISABLE;
+XIF{VWERASE} np->tio.c_cc[VWERASE] = VDISABLE;
# endif /* hpux */
#else /* TERMIO || POSIX */
startc = op->m_tchars.t_startc;
@@ -451,8 +515,12 @@ XIF{VDSUSP} np->tio.c_cc[VDSUSP] = VDISABLE;
}
np->m_ttyb.sg_flags &= ~(CRMOD | ECHO);
np->m_ttyb.sg_flags |= CBREAK;
+# if defined(CYRILL) && defined(CSTYLE) && defined(CS_8BITS)
+ np->m_ttyb.sg_flags &= ~CSTYLE;
+ np->m_ttyb.sg_flags |= CS_8BITS;
+# endif
np->m_tchars.t_quitc = -1;
- if (d_flow == 0)
+ if (D_flow == 0)
{
np->m_tchars.t_intrc = -1;
np->m_tchars.t_startc = -1;
@@ -470,46 +538,46 @@ SetFlow(on)
int on;
{
ASSERT(display);
- if (d_flow == on)
+ if (D_flow == on)
return;
#if defined(TERMIO) || defined(POSIX)
if (on)
{
- d_NewMode.tio.c_cc[VINTR] = intrc;
- d_NewMode.tio.c_cc[VSTART] = startc;
- d_NewMode.tio.c_cc[VSTOP] = stopc;
- d_NewMode.tio.c_iflag |= IXON;
+ 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;
}
else
{
- d_NewMode.tio.c_cc[VINTR] = VDISABLE;
- d_NewMode.tio.c_cc[VSTART] = VDISABLE;
- d_NewMode.tio.c_cc[VSTOP] = VDISABLE;
- d_NewMode.tio.c_iflag &= ~IXON;
+ D_NewMode.tio.c_cc[VINTR] = VDISABLE;
+XIF{VSTART} D_NewMode.tio.c_cc[VSTART] = VDISABLE;
+XIF{VSTOP} D_NewMode.tio.c_cc[VSTOP] = VDISABLE;
+ D_NewMode.tio.c_iflag &= ~IXON;
}
# ifdef POSIX
- if (tcsetattr(d_userfd, TCSANOW, &d_NewMode.tio))
+ if (tcsetattr(D_userfd, TCSANOW, &D_NewMode.tio))
# else
- if (ioctl(d_userfd, TCSETAW, (char *)&d_NewMode.tio) != 0)
+ if (ioctl(D_userfd, TCSETAW, (char *)&D_NewMode.tio) != 0)
# endif
debug1("SetFlow: ioctl errno %d\n", errno);
#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 = intrc;
+ D_NewMode.m_tchars.t_startc = startc;
+ D_NewMode.m_tchars.t_stopc = stopc;
}
else
{
- d_NewMode.m_tchars.t_intrc = -1;
- d_NewMode.m_tchars.t_startc = -1;
- d_NewMode.m_tchars.t_stopc = -1;
+ D_NewMode.m_tchars.t_intrc = -1;
+ D_NewMode.m_tchars.t_startc = -1;
+ D_NewMode.m_tchars.t_stopc = -1;
}
- if (ioctl(d_userfd, TIOCSETC, (char *)&d_NewMode.m_tchars) != 0)
+ if (ioctl(D_userfd, TIOCSETC, (char *)&D_NewMode.m_tchars) != 0)
debug1("SetFlow: ioctl errno %d\n", errno);
#endif /* POSIX || TERMIO */
- d_flow = on;
+ D_flow = on;
}
@@ -527,9 +595,9 @@ int fd;
{
#if defined(POSIX) && !defined(ultrix)
setsid(); /* will break terminal affiliation */
-# ifdef BSD
+# if defined(BSD) && defined(TIOCSCTTY)
ioctl(fd, TIOCSCTTY, (char *)0);
-# endif /* BSD */
+# endif /* BSD && TIOCSCTTY */
#else /* POSIX */
# ifdef SYSV
setpgrp(); /* will break terminal affiliation */
@@ -537,7 +605,7 @@ int fd;
# ifdef BSDJOBS
int devtty;
- if ((devtty = open("/dev/tty", O_RDWR | O_NDELAY)) >= 0)
+ if ((devtty = open("/dev/tty", O_RDWR | O_NONBLOCK)) >= 0)
{
if (ioctl(devtty, TIOCNOTTY, (char *)0))
debug2("brktty: ioctl(devtty=%d, TIOCNOTTY, 0) = %d\n", devtty, errno);
@@ -557,10 +625,15 @@ int fd;
mypid = getpid();
-# if defined(BSDI) || defined(__386BSD__) || defined(__osf__)
+ /* The next lines should be obsolete. Can anybody check if they
+ * are really needed on the BSD platforms?
+ */
+# if defined(__osf__) || (BSD >= 199103)
setsid(); /* should be already done */
+# ifdef TIOCSCTTY
ioctl(fd, TIOCSCTTY, (char *)0);
-# endif /* BSDI || __386BSD__ */
+# endif
+# endif
# ifdef POSIX
if (tcsetpgrp(fd, mypid))
@@ -609,7 +682,7 @@ int n, closeopen;
Msg(0, "Ouch, cannot reopen line %s, please try harder", wp->w_tty);
return;
}
- (void) fcntl(wp->w_ptyfd, F_SETFL, FNDELAY);
+ (void) fcntl(wp->w_ptyfd, F_SETFL, FNBLOCK);
}
else
{
@@ -695,8 +768,8 @@ char *rc_name;
Msg(0, "I need a display");
return -1;
}
- for (d = displays; d; d = d->_d_next)
- if (strcmp(d->_d_usertty, "/dev/console") == 0)
+ for (d = displays; d; d = d->d_next)
+ if (strcmp(d->d_usertty, "/dev/console") == 0)
break;
if (d)
{
diff --git a/src/utmp.c b/src/utmp.c
index 75873fa..2c97446 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -30,11 +30,11 @@ RCS_ID("$Id$ FAU")
* linux should have GETUTENT, but their pututline() doesn't have
* a return value.
*
- * UTNOKEEP: A (ugly) hack for apollo, that does two things:
+ * UTNOKEEP: A (ugly) hack for apollo that does two things:
* 1) Always close and reopen the utmp file descriptor. (I don't know
* for what reason this is done...)
- * 2) Implement an unsortet utmp file much like GETUTENT.
- * (IMHO these two features should be split!)
+ * 2) Implement an unsorted utmp file much like GETUTENT.
+ * (split into UT_CLOSE and UT_UNSORTED)
*/
@@ -54,9 +54,17 @@ extern char *LoginName;
extern nethackflag;
#endif
+
+#ifdef UTNOKEEP
+# define UT_CLOSE
+# define UT_UNSORTED
+#endif
+
+
#ifdef UTMPOK
static slot_t TtyNameSlot __P((char *));
+
static int utmpok, utmpfd = -1;
static char UtmpName[] = UTMPFILE;
@@ -69,29 +77,27 @@ extern struct utmp *getutline(), *pututline();
# if defined(_SEQUENT_)
extern struct utmp *ut_add_user(), *ut_delete_user();
extern char *ut_find_host();
-# define UTHOST /* _SEQUENT_ has got ut_find_host() */
+# ifndef UTHOST
+# define UTHOST /* _SEQUENT_ has got ut_find_host() */
+# endif
# endif /* _SEQUENT_ */
# endif /* GETUTENT && !SVR4 */
-# if defined (GETTTYENT) && !defined(GETUTENT)
+# if !defined(GETUTENT) && !defined(UT_UNSORTED)
+# ifdef GETTTYENT
# include <ttyent.h>
-# endif /* GETUTENT */
-
-# if !defined(GETTTYENT) && !defined(GETUTENT) && !defined(UTNOKEEP)
-struct ttyent
-{
- char *ty_name;
-};
-static void setttyent __P((void));
+# else
+struct ttyent { char *ty_name; };
+static void setttyent __P((void));
static struct ttyent *getttyent __P((void));
-static char *tt, *ttnext;
-static char ttys[] = "/etc/ttys";
-# endif /* !GETTTYENT && !GETUTENT && !UTNOKEEP */
+# endif
+# endif /* !GETUTENT && !UT_UNSORTED */
#endif /* UTMPOK */
+
/*
* SlotToggle - modify the utmp slot of the fore window.
*
@@ -149,14 +155,21 @@ int how;
}
}
#else /* !UTMPOK */
+# ifdef UTMPFILE
Msg(0, "Unable to modify %s.\n", UTMPFILE);
+# else
+ Msg(0, "Unable to modify utmp-database.\n");
+# endif
#endif
}
+
+
#ifdef UTMPOK
+
void
InitUtmp()
{
@@ -169,10 +182,10 @@ InitUtmp()
utmpok = 0;
return;
}
-# ifdef GETUTENT
+#ifdef GETUTENT
close(utmpfd); /* it was just a test */
utmpfd = -1;
-# endif /* GETUTENT */
+#endif /* GETUTENT */
utmpok = 1;
}
@@ -188,12 +201,12 @@ CountUsers()
# endif /* GETUTENT */
int UserCount;
-# ifdef UTNOKEEP
+# ifdef UT_CLOSE
InitUtmp();
-# endif /* UTNOKEEP */
+# endif /* UT_CLOSE */
debug1("CountUsers() - utmpok=%d\n", utmpok);
if (!utmpok)
- return(0);
+ return 0;
UserCount = 0;
# ifdef GETUTENT
setutent();
@@ -202,16 +215,14 @@ CountUsers()
UserCount++;
# else /* GETUTENT */
(void) lseek(utmpfd, (off_t) 0, 0);
- while (read(utmpfd, &utmpbuf, sizeof(struct utmp)) > 0)
- {
- if (utmpbuf.ut_name[0] != '\0')
- UserCount++;
- }
+ while (read(utmpfd, &utmpbuf, sizeof(utmpbuf)) == sizeof(utmpbuf))
+ if (utmpbuf.ut_name[0] != '\0')
+ UserCount++;
# endif /* GETUTENT */
-# ifdef UTNOKEEP
+# ifdef UT_CLOSE
close(utmpfd);
-# endif /* UTNOKEEP */
- return(UserCount);
+# endif /* UT_CLOSE */
+ return UserCount;
}
#endif /* USRLIMIT */
@@ -219,119 +230,111 @@ CountUsers()
/*
* the utmp entry for tty is located and removed.
- * it is stored in d_utmp_logintty.
+ * it is stored in D_utmp_logintty.
*/
void
RemoveLoginSlot()
{
-# ifdef GETUTENT
+#ifdef GETUTENT
struct utmp *uu;
-# endif /* GETUTENT */
+#endif /* GETUTENT */
struct utmp u; /* 'empty' slot that we write back */
-# ifdef _SEQUENT_
+#ifdef _SEQUENT_
char *p;
-# endif /* _SEQUENT_ */
+#endif /* _SEQUENT_ */
ASSERT(display);
debug("RemoveLoginSlot: removing your logintty\n");
- d_loginslot = TtyNameSlot(d_usertty);
-# ifdef UTNOKEEP
+ D_loginslot = TtyNameSlot(D_usertty);
+ if (D_loginslot == (slot_t)0 || D_loginslot == (slot_t)-1)
+ return;
+#ifdef UT_CLOSE
InitUtmp();
-# endif /* UTNOKEEP */
+#endif /* UT_CLOSE */
if (!utmpok)
{
debug("RemoveLoginSlot: utmpok == 0\n");
return;
}
- if (d_loginslot == (slot_t)0 || d_loginslot == (slot_t)-1)
- {
- return;
- }
-# ifdef _SEQUENT_
- if (p = ut_find_host(d_loginslot))
- strncpy(d_loginhost, p, sizeof(d_loginhost) - 1);
- d_loginhost[sizeof(d_loginhost) - 1] = 0;
-# endif /* _SEQUENT_ */
- bzero((char *) &u, sizeof u);
+#ifdef _SEQUENT_
+ if (p = ut_find_host(D_loginslot))
+ strncpy(D_loginhost, p, sizeof(D_loginhost) - 1);
+ D_loginhost[sizeof(D_loginhost) - 1] = 0;
+#endif /* _SEQUENT_ */
-# ifdef GETUTENT
+ bzero((char *) &u, sizeof(u));
+
+#ifdef GETUTENT
setutent();
- strncpy(u.ut_line, d_loginslot, sizeof(u.ut_line));
+ strncpy(u.ut_line, D_loginslot, sizeof(u.ut_line));
if ((uu = getutline(&u)) == 0)
{
Msg(0, "Utmp slot not found -> not removed");
return;
}
- d_utmp_logintty = *uu;
-# ifdef _SEQUENT_
- if (ut_delete_user(d_loginslot, uu->ut_pid, 0, 0) == 0)
-# else /* _SEQUENT_ */
+ D_utmp_logintty = *uu;
+# ifdef _SEQUENT_
+ if (ut_delete_user(D_loginslot, uu->ut_pid, 0, 0) == 0)
+# else /* _SEQUENT_ */
u = *uu;
u.ut_type = DEAD_PROCESS;
u.ut_exit.e_termination = 0;
u.ut_exit.e_exit= 0;
if (pututline(&u) == 0)
-# endif /* _SEQUENT_ */
+# endif /* _SEQUENT_ */
-# else /* GETUTENT */
+#else /* GETUTENT */
- (void) lseek(utmpfd, (off_t) (d_loginslot * sizeof u), 0);
- bzero((char *)&d_utmp_logintty, sizeof u);
- if (read(utmpfd, (char *) &d_utmp_logintty, sizeof u) != sizeof u)
+ bzero((char *)&D_utmp_logintty, sizeof(u));
+ (void) lseek(utmpfd, (off_t) (D_loginslot * sizeof(u)), 0);
+ if (read(utmpfd, (char *) &D_utmp_logintty, sizeof(u)) != sizeof(u))
{
- Msg(errno, "cannot read %s ??", UTMPFILE);
+ Msg(errno, "cannot read %s ??", UtmpName);
sleep(1);
}
- (void) lseek(utmpfd, (off_t) (d_loginslot * sizeof u), 0);
-# ifdef UTNOKEEP
- /*
- * as the utmp file is not sorted, we want to mark this slot occupied,
- * as RestoreLoginSlot() will write exactly here.
- */
- bcopy((char *)&d_utmp_logintty, (char *)&u, sizeof u);
+# ifdef UT_UNSORTED
+ /* copy tty line */
+ bcopy((char *)&D_utmp_logintty, (char *)&u, sizeof(u));
bzero(u.ut_name, sizeof(u.ut_name));
bzero(u.ut_host, sizeof(u.ut_host));
-# endif /* UTNOKEEP */
- if (write(utmpfd, (char *) &u, sizeof u) != sizeof u)
+# endif /* UT_UNSORTED */
+ (void) lseek(utmpfd, (off_t) (D_loginslot * sizeof(u)), 0);
+ if (write(utmpfd, (char *) &u, sizeof(u)) != sizeof(u))
-# endif /* GETUTENT */
+#endif /* GETUTENT */
{
-# ifdef NETHACK
+#ifdef NETHACK
if (nethackflag)
- {
- Msg(errno, "%s is too hard to dig in", UTMPFILE);
- }
+ Msg(errno, "%s is too hard to dig in", UtmpName);
else
-# endif /* NETHACK */
- {
- Msg(errno, "Could not write %s", UTMPFILE);
- }
+#endif /* NETHACK */
+ Msg(errno, "Could not write %s", UtmpName);
}
-# ifdef UTNOKEEP
+#ifdef UT_CLOSE
close(utmpfd);
-# endif /* UTNOKEEP */
- debug1(" slot %d zapped\n", (int)d_loginslot);
+#endif /* UT_CLOSE */
+ debug1(" slot %d zapped\n", (int)D_loginslot);
}
/*
- * d_utmp_logintty is reinserted into utmp
+ * D_utmp_logintty is reinserted into utmp
*/
void
RestoreLoginSlot()
{
debug("RestoreLoginSlot()\n");
ASSERT(display);
-# ifdef UTNOKEEP
+#ifdef UT_CLOSE
InitUtmp();
-# endif /* UTNOKEEP */
- if (utmpok && d_loginslot != (slot_t)0 && d_loginslot != (slot_t)-1)
+#endif /* UT_CLOSE */
+ if (utmpok && D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1)
{
-# ifdef GETUTENT
-# ifdef _SEQUENT_
+#ifdef GETUTENT
+# ifdef _SEQUENT_
int fail;
- debug1(" logging you in again (slot %s)\n", d_loginslot);
+ debug1(" logging you in again (slot %s)\n", D_loginslot);
/*
* We have problems if we add the console and use ut_add_user()
* because the id will be 'scon' instead of 'co'. So we
@@ -339,56 +342,56 @@ RestoreLoginSlot()
* pututline all the time is that we want to set the host field.
* Unfortunatelly this can only be done with ut_add_user().
*/
- if (*d_loginhost)
+ if (*D_loginhost)
{
- fail = (ut_add_user(d_utmp_logintty.ut_name, d_loginslot, d_utmp_logintty.ut_pid,
- *d_loginhost ? d_loginhost : (char *)0) == 0);
+ fail = (ut_add_user(D_utmp_logintty.ut_name, D_loginslot, D_utmp_logintty.ut_pid,
+ *D_loginhost ? D_loginhost : (char *)0) == 0);
}
else
{
setutent();
- fail = (pututline(&d_utmp_logintty) == 0);
+ fail = (pututline(&D_utmp_logintty) == 0);
}
if (fail)
-# else /* _SEQUENT_ */
- debug1(" logging you in again (slot %s)\n", d_loginslot);
+# else /* _SEQUENT_ */
+ debug1(" logging you in again (slot %s)\n", D_loginslot);
setutent();
- if (pututline(&d_utmp_logintty)==0)
-# endif /* _SEQUENT */
-# else /* GETUTENT */
- debug1(" logging you in again (slot %d)\n", d_loginslot);
-# ifdef sequent
+ if (pututline(&D_utmp_logintty) == 0)
+# endif /* _SEQUENT */
+#else /* GETUTENT */
+ debug1(" logging you in again (slot %d)\n", D_loginslot);
+# ifdef sequent
/*
* call sequent undocumented routine to count logins
* and add utmp entry if possible
*/
- if (add_utmp(d_loginslot, &d_utmp_logintty) == -1)
-# else /* sequent */
- (void) lseek(utmpfd, (off_t) (d_loginslot * sizeof(struct utmp)), 0);
- if (write(utmpfd, (char *) &d_utmp_logintty, sizeof(struct utmp))
+ if (add_utmp(D_loginslot, &D_utmp_logintty) == -1)
+# else /* sequent */
+ (void) lseek(utmpfd, (off_t) (D_loginslot * sizeof(struct utmp)), 0);
+ if (write(utmpfd, (char *) &D_utmp_logintty, sizeof(struct utmp))
!= sizeof(struct utmp))
-# endif /* sequent */
-# endif /* GETUTENT */
+# endif /* sequent */
+#endif /* GETUTENT */
{
-# ifdef NETHACK
+#ifdef NETHACK
if (nethackflag)
- Msg(errno, "%s is too hard to dig in", UTMPFILE);
+ Msg(errno, "%s is too hard to dig in", UtmpName);
else
-# endif /* NETHACK */
- Msg(errno,"Could not write %s", UTMPFILE);
+#endif /* NETHACK */
+ Msg(errno,"Could not write %s", UtmpName);
}
}
-# ifdef UTNOKEEP
+#ifdef UT_CLOSE
close(utmpfd);
-# endif /* UTNOKEEP */
- d_loginslot = (slot_t) 0;
+#endif /* UT_CLOSE */
+ D_loginslot = (slot_t) 0;
}
/*
* Construct a utmp entry for window wi.
- * the hostname field reflects what we know about the d_user (i.e. display)
+ * the hostname field reflects what we know about the user (i.e. display)
* location. If d_loginhost is not set, then he is local and we write
* down the name of his terminal line; else he is remote and we keep
* the hostname here. The letter S and the window id will be appended.
@@ -401,48 +404,47 @@ struct win *wi;
{
register char *p;
register slot_t slot;
-# ifndef _SEQUENT_
+#ifndef _SEQUENT_
char *line;
-# endif
+#endif
struct utmp u;
int saved_ut;
-# ifdef UTHOST
-# ifdef _SEQUENT_
+#ifdef UTHOST
+# ifdef _SEQUENT_
char host[100+5];
-# else /* _SEQUENT_ */
- char host[sizeof(d_utmp_logintty.ut_host)+5];
-# endif /* _SEQUENT_ */
-# endif /* UTHOST */
+# else /* _SEQUENT_ */
+ char host[sizeof(D_utmp_logintty.ut_host)+5];
+# endif /* _SEQUENT_ */
+#endif /* UTHOST */
- wi->w_slot = (slot_t) 0;
+ wi->w_slot = (slot_t)0;
if (!utmpok)
return -1;
- if ((slot = TtyNameSlot(wi->w_tty)) == (slot_t) NULL)
+ if ((slot = TtyNameSlot(wi->w_tty)) == (slot_t)0)
{
debug1("SetUtmp failed (tty %s).\n",wi->w_tty);
return -1;
}
debug2("SetUtmp %d will get slot %d...\n", wi->w_number, (int)slot);
-# ifdef UTNOKEEP
- /* open here, as TtyNameSlot used (and closed) our filedescriptor */
+#ifdef UT_CLOSE
InitUtmp();
-# endif /* UTNOKEEP */
+#endif /* UT_CLOSE */
- bzero((char *) &u, sizeof u);
- if ((saved_ut = bcmp((char *) &wi->w_savut, (char *) &u, sizeof u)))
+ bzero((char *) &u, sizeof(u));
+ if ((saved_ut = bcmp((char *) &wi->w_savut, (char *) &u, sizeof(u))))
/* restore original, of which we will adopt all fields but ut_host */
- bcopy((char *) &wi->w_savut, (char *) &u, sizeof u);
+ bcopy((char *) &wi->w_savut, (char *) &u, sizeof(u));
-# ifdef UTHOST
+#ifdef UTHOST
host[sizeof(host)-5] = '\0';
if (display)
{
-# ifdef _SEQUENT_
- strncpy(host, d_loginhost, sizeof(host) - 5);
-# else /* _SEQUENT */
- strncpy(host, d_utmp_logintty.ut_host, sizeof(host) - 5);
-# endif /* _SEQUENT */
- if (d_loginslot != (slot_t)0 && d_loginslot != (slot_t)-1 && host[0] != '\0')
+# ifdef _SEQUENT_
+ strncpy(host, D_loginhost, sizeof(host) - 5);
+# else /* _SEQUENT */
+ strncpy(host, D_utmp_logintty.ut_host, sizeof(host) - 5);
+# endif /* _SEQUENT */
+ if (D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1 && host[0] != '\0')
{
/*
* we want to set our ut_host field to something like
@@ -466,7 +468,7 @@ struct win *wi;
}
else
{
- strncpy(host + 1, stripdev(d_usertty), sizeof(host) - 6);
+ strncpy(host + 1, stripdev(D_usertty), sizeof(host) - 6);
host[0] = ':';
}
}
@@ -474,24 +476,29 @@ struct win *wi;
strncpy(host, "local", sizeof(host) - 5);
sprintf(host + strlen(host), ":S.%c", '0' + wi->w_number);
debug1("rlogin hostname: '%s'\n", host);
-# if !defined(_SEQUENT_) && !defined(sequent)
+# if !defined(_SEQUENT_) && !defined(sequent)
strncpy(u.ut_host, host, sizeof(u.ut_host));
-# endif
-# endif /* UTHOST */
+# endif
+#endif /* UTHOST */
-# ifdef _SEQUENT_
+#ifdef _SEQUENT_
if (ut_add_user(saved_ut ? u.ut_user : LoginName, slot, saved_ut ? u.ut_pid : wi->w_pid, host) == 0)
-# else /* _SEQUENT_ */
+#else /* _SEQUENT_ */
if (!saved_ut)
{ /* make new utmp from scratch */
line = stripdev(wi->w_tty);
-# ifdef GETUTENT
+# ifdef GETUTENT
strncpy(u.ut_user, LoginName, sizeof(u.ut_user));
-# ifdef sgi
+ /* Now the tricky part... guess ut_id */
+# ifdef sgi
strncpy(u.ut_id, line + 3, sizeof(u.ut_id));
-# else /* sgi */
+# else /* sgi */
+# ifdef _IBMR2
+ strncpy(u.ut_id, line, sizeof(u.ut_id));
+# else
strncpy(u.ut_id, line + strlen(line) - 2, sizeof(u.ut_id));
-# endif /* sgi */
+# endif
+# endif /* sgi */
strncpy(u.ut_line, line, sizeof(u.ut_line));
u.ut_pid = wi->w_pid;
u.ut_type = USER_PROCESS;
@@ -499,47 +506,47 @@ struct win *wi;
} /* !saved_ut {-: */
setutent();
if (pututline(&u) == 0)
-# else /* GETUTENT */
+# else /* GETUTENT */
strncpy(u.ut_line, line, sizeof(u.ut_line));
strncpy(u.ut_name, LoginName, sizeof(u.ut_name));
-# if defined(linux) /* should have GETUTENT */
+# if defined(linux) /* should have GETUTENT */
u.ut_type = USER_PROCESS;
u.ut_pid = wi->w_pid;
strncpy(u.ut_id, line + 3, sizeof(u.ut_id));
-# endif /* linux */
+# endif /* linux */
(void) time((time_t *)&u.ut_time); /* cast needed for ultrix */
} /* !saved_ut */
-# ifdef sequent
+# ifdef sequent
/*
* call sequent undocumented routine to count logins and
* add utmp entry if possible
*/
if (add_utmp(slot, &u) == -1)
-# else /* sequent */
- (void) lseek(utmpfd, (off_t) (slot * sizeof u), 0);
- if (write(utmpfd, (char *) &u, sizeof u) != sizeof u)
-# endif /* sequent */
-# endif /* GETUTENT */
-# endif /* _SEQUENT_ */
+# else /* sequent */
+ (void) lseek(utmpfd, (off_t) (slot * sizeof(u)), 0);
+ if (write(utmpfd, (char *) &u, sizeof(u)) != sizeof(u))
+# endif /* sequent */
+# endif /* GETUTENT */
+#endif /* _SEQUENT_ */
{
-# ifdef NETHACK
+#ifdef NETHACK
if (nethackflag)
- Msg(errno, "%s is too hard to dig in", UTMPFILE);
+ Msg(errno, "%s is too hard to dig in", UtmpName);
else
-# endif /* NETHACK */
- Msg(errno,"Could not write %s", UTMPFILE);
-# ifdef UTNOKEEP
+#endif /* NETHACK */
+ Msg(errno,"Could not write %s", UtmpName);
+#ifdef UT_CLOSE
close(utmpfd);
-# endif /* UTNOKEEP */
+#endif /* UT_CLOSE */
return -1;
}
debug("SetUtmp successful\n");
wi->w_slot = slot;
-# ifdef UTNOKEEP
+#ifdef UT_CLOSE
close(utmpfd);
-# endif /* UTNOKEEP */
- bcopy((char *) &u, (char *) &wi->w_savut, sizeof u);
+#endif /* UT_CLOSE */
+ bcopy((char *) &u, (char *) &wi->w_savut, sizeof(u));
return 0;
}
@@ -554,22 +561,22 @@ int
RemoveUtmp(wi)
struct win *wi;
{
-# ifdef GETUTENT
+#ifdef GETUTENT
struct utmp *uu;
-# endif /* GETUTENT */
+#endif /* GETUTENT */
struct utmp u;
slot_t slot;
slot = wi->w_slot;
-# ifdef GETUTENT
+#ifdef GETUTENT
debug1("RemoveUtmp(%s)\n", (slot == (slot_t) 0) ?
"no slot (0)":((slot == (slot_t) -1) ? "no slot (-1)" : slot));
-# else /* GETUTENT */
+#else /* GETUTENT */
debug1("RemoveUtmp(wi.slot: %d)\n", slot);
-# endif /* GETUTENT */
-# ifdef UTNOKEEP
+#endif /* GETUTENT */
+#ifdef UT_CLOSE
InitUtmp();
-# endif /* UTNOKEEP */
+#endif /* UT_CLOSE */
if (!utmpok)
return -1;
if (slot == (slot_t) 0 || slot == (slot_t) -1)
@@ -578,13 +585,13 @@ struct win *wi;
wi->w_slot = (slot_t) -1;
return 0;
}
- bzero((char *) &u, sizeof u);
-# ifdef GETUTENT
+ bzero((char *) &u, sizeof(u));
+#ifdef GETUTENT
setutent();
-# ifdef sgi
- bcopy((char *) &wi->w_savut, (char *) &u, sizeof u);
+# ifdef sgi
+ bcopy((char *) &wi->w_savut, (char *) &u, sizeof(u));
uu = &u;
-# else
+# else
strncpy(u.ut_line, slot, sizeof(u.ut_line));
if ((uu = getutline(&u)) == 0)
{
@@ -592,49 +599,49 @@ struct win *wi;
return -1;
}
bcopy((char *)uu, (char *)&wi->w_savut, sizeof(wi->w_savut));
-# endif
-# ifdef _SEQUENT_
+# endif
+# ifdef _SEQUENT_
if (ut_delete_user(slot, uu->ut_pid, 0, 0) == 0)
-# else /* _SEQUENT_ */
+# else /* _SEQUENT_ */
u = *uu;
u.ut_type = DEAD_PROCESS;
u.ut_exit.e_termination = 0;
u.ut_exit.e_exit= 0;
if (pututline(&u) == 0)
-# endif /* _SEQUENT_ */
-# else /* GETUTENT */
+# endif /* _SEQUENT_ */
+#else /* GETUTENT */
(void) lseek(utmpfd, (off_t) (slot * sizeof(u)), 0);
- if (read(utmpfd, (char *) &wi->w_savut, sizeof(wi->w_savut)) != sizeof u)
+ if (read(utmpfd, (char *) &wi->w_savut, sizeof(u)) != sizeof(u))
{
bzero((char *)&wi->w_savut, sizeof(wi->w_savut));
- Msg(errno, "cannot read %s?", UTMPFILE);
+ Msg(errno, "cannot read %s?", UtmpName);
sleep(1);
}
- (void) lseek(utmpfd, (off_t) (slot * sizeof(u)), 0);
-# ifdef UTNOKEEP
+# ifdef UT_UNSORTED
bcopy((char *)&wi->w_savut, (char *)&u, sizeof(u));
bzero(u.ut_name, sizeof(u.ut_name));
bzero(u.ut_host, sizeof(u.ut_host));
-# endif /* UTNOKEEP */
+# endif /* UT_UNSORTED */
+ (void) lseek(utmpfd, (off_t) (slot * sizeof(u)), 0);
if (write(utmpfd, (char *) &u, sizeof(u)) != sizeof(u))
-# endif /* GETUTENT */
+#endif /* GETUTENT */
{
-# ifdef NETHACK
+#ifdef NETHACK
if (nethackflag)
- Msg(errno, "%s is too hard to dig in", UTMPFILE);
+ Msg(errno, "%s is too hard to dig in", UtmpName);
else
-# endif /* NETHACK */
- Msg(errno,"Could not write %s", UTMPFILE);
-# ifdef UTNOKEEP
+#endif /* NETHACK */
+ Msg(errno,"Could not write %s", UtmpName);
+#ifdef UT_CLOSE
close(utmpfd);
-# endif /* UTNOKEEP */
+#endif /* UT_CLOSE */
return -1;
}
debug("RemoveUtmp successfull\n");
wi->w_slot = (slot_t) -1;
-# ifdef UTNOKEEP
+#ifdef UT_CLOSE
close(utmpfd);
-# endif /* UTNOKEEP */
+#endif /* UT_CLOSE */
return 0;
}
@@ -651,67 +658,76 @@ char *nam;
{
char *name;
register slot_t slot;
-# ifdef UTNOKEEP
+#ifdef UT_UNSORTED
struct utmp u;
-# else
-# ifndef GETUTENT
+#else
+# ifndef GETUTENT
register struct ttyent *tp;
-# endif /* GETUTENT */
-# endif /* UTNOKEEP */
+# endif /* GETUTENT */
+#endif /* UT_UNSORTED */
debug1("TtyNameSlot(%s)\n", nam);
-# ifdef UTNOKEEP
+#ifdef UT_CLOSE
InitUtmp();
-# endif /* UTNOKEEP */
- if (!utmpok || nam == NULL)
+#endif /* UT_CLOSE */
+ if (!utmpok || nam == 0)
return (slot_t)0;
name = stripdev(nam);
-# ifdef GETUTENT
+#ifdef GETUTENT
slot = name;
-# else /* GETUTENT */
-# ifdef UTNOKEEP
+#else /* GETUTENT */
+# ifdef UT_UNSORTED
slot = 0;
+ (void) lseek(utmpfd, (off_t) 0, 0);
while ((read(utmpfd, (char *)&u, sizeof(u)) == sizeof(u))
&& (strcmp(u.ut_line, name)))
slot++;
- close(utmpfd);
-# else /* UTNOKEEP */
+# else /* UT_UNSORTED*/
slot = 1;
setttyent();
- while ((tp = getttyent()) != NULL && strcmp(name, tp->ty_name) != 0)
+ while ((tp = getttyent()) != 0 && strcmp(name, tp->ty_name) != 0)
slot++;
-# endif /* UTNOKEEP */
-# endif /* GETUTENT */
+# endif /* UTNOKEEP */
+#endif /* GETUTENT */
+
+#ifdef UT_CLOSE
+ close(utmpfd);
+#endif
return slot;
}
-# if !defined(GETTTYENT) && !defined(GETUTENT) && !defined(UTNOKEEP)
+#if !defined(GETTTYENT) && !defined(GETUTENT) && !defined(UT_UNSORTED)
+
+/*
+ * Cheap plastic imitation of ttyent routines.
+ */
+
+static char *tt, *ttnext;
+static char ttys[] = "/etc/ttys";
static void
setttyent()
{
- struct stat s;
- register int f;
- register char *p, *ep;
-
- if (ttnext)
+ if (ttnext == 0)
{
- ttnext = tt;
- return;
- }
- if ((f = open(ttys, O_RDONLY)) == -1 || fstat(f, &s) == -1)
- Panic(errno, ttys);
- if ((tt = malloc((unsigned) s.st_size + 1)) == 0)
- Panic(0, strnomem);
- if (read(f, tt, s.st_size) != s.st_size)
- Panic(errno, ttys);
- close(f);
- for (p = tt, ep = p + s.st_size; p < ep; ++p)
- if (*p == '\n')
+ struct stat s;
+ register int f;
+ register char *p, *ep;
+
+ if ((f = open(ttys, O_RDONLY)) == -1 || fstat(f, &s) == -1)
+ Panic(errno, ttys);
+ if ((tt = malloc((unsigned) s.st_size + 1)) == 0)
+ Panic(0, strnomem);
+ if (read(f, tt, s.st_size) != s.st_size)
+ Panic(errno, ttys);
+ close(f);
+ for (p = tt, ep = p + s.st_size; p < ep; p++)
+ if (*p == '\n')
+ *p = '\0';
*p = '\0';
- *p = '\0';
+ }
ttnext = tt;
}
@@ -727,13 +743,15 @@ getttyent()
return &t;
}
-# endif /* !GETTTYENT && !GETUTENT && !UTNOKEEP */
+#endif /* !GETTTYENT && !GETUTENT && !UT_UNSORTED*/
+
#endif /* UTMPOK */
+
/*********************************************************************
*
* getlogin() replacement (for SVR4 machines)
diff --git a/src/window.c b/src/window.c
index d2639d0..907614d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -32,22 +32,23 @@ RCS_ID("$Id$ FAU")
#endif
#include "config.h"
-#include "screen.h"
-#include "extern.h"
-#ifdef SVR4 /* for solaris 2.1 */
+#ifdef SVR4
# include <sys/stropts.h>
#endif
+#include "screen.h"
+#include "extern.h"
+
extern struct display *displays, *display;
extern struct win *windows, *fore, *wtab[], *console_window;
extern char *ShellArgs[];
extern char *ShellProg;
extern char screenterm[];
extern char HostName[];
-extern int default_monitor, TtyMode;
+extern int TtyMode;
extern struct LayFuncs WinLf;
-extern int real_uid, real_gid;
+extern int real_uid, real_gid, eff_uid, eff_gid;
extern char Termcap[];
extern char **NewEnv;
@@ -55,6 +56,10 @@ extern char **NewEnv;
extern struct winsize glwz;
#endif
+#ifdef _IBMR2
+extern int aixhack;
+#endif
+
static int OpenDevice __P((char *, int, int *, char **));
static int ForkWindow __P((char **, char *, char *, char *, struct win *));
@@ -68,13 +73,13 @@ static char DefaultPath[] = ":/usr/ucb:/bin:/usr/bin";
struct NewWindow nwin_undef =
{
-1, (char *)0, (char **)0, (char *)0, (char *)0, -1, -1,
- -1, -1, -1
+ -1, -1, -1, -1, -1, -1, -1, -1
};
struct NewWindow nwin_default =
{
0, 0, ShellArgs, 0, screenterm, 0, 1*FLOW_NOW,
- LOGINDEFAULT, DEFAULTHISTHEIGHT, -1
+ LOGINDEFAULT, DEFAULTHISTHEIGHT, MON_OFF, WLOCK_AUTO, 1, 1, 0, 0
};
struct NewWindow nwin_options;
@@ -93,6 +98,13 @@ struct NewWindow *def, *new, *res;
res->lflag = new->lflag != nwin_undef.lflag ? new->lflag : def->lflag;
res->histheight = new->histheight != nwin_undef.histheight ? new->histheight : def->histheight;
res->monitor = new->monitor != nwin_undef.monitor ? new->monitor : def->monitor;
+ res->wlock = new->wlock != nwin_undef.wlock ? new->wlock : def->wlock;
+ res->wrap = new->wrap != nwin_undef.wrap ? new->wrap : def->wrap;
+ res->c1 = new->c1 != nwin_undef.c1 ? new->c1 : def->c1;
+ res->gr = new->gr != nwin_undef.gr ? new->gr : def->gr;
+#ifdef KANJI
+ res->kanji = new->kanji != nwin_undef.kanji ? new->kanji : def->kanji;
+#endif
}
int
@@ -100,7 +112,7 @@ MakeWindow(newwin)
struct NewWindow *newwin;
{
register struct win **pp, *p;
- register int n;
+ register int n, i;
int f = -1;
struct NewWindow nwin;
int ttyflag;
@@ -112,6 +124,7 @@ struct NewWindow *newwin;
debug1("NewWindow: term %s\n", newwin->term?newwin->term:"NULL");
nwin_compose(&nwin_default, newwin, &nwin);
debug1("NWin: aka %s\n", nwin.aka ? nwin.aka : "NULL");
+ debug1("NWin: wlock %d\n", nwin.wlock);
pp = wtab + nwin.StartAt;
do
@@ -151,24 +164,42 @@ struct NewWindow *newwin;
return -1;
}
bzero((char *) p, (int) sizeof(struct win)); /* looks like a calloc above */
+
+ /* save the command line so that zombies can be resurrected */
+ for (i = 0; nwin.args[i] && i < MAXARGS - 1; i++)
+ p->w_cmdargs[i] = SaveStr(nwin.args[i]);
+ p->w_cmdargs[i] = 0;
+
+ if (!(p->w_dlist = (struct displaylist *)malloc(sizeof(struct displaylist))))
+ {
+ free((char *)p);
+ close(f);
+ Msg(0, strnomem);
+ return -1;
+ }
+ p->w_dlist->next = NULL;
#ifdef MULTIUSER
if (NewWindowAcl(p))
{
- free(p);
+ free((char *)p->w_dlist);
+ free((char *)p);
close(f);
Msg(0, strnomem);
return -1;
}
#endif
- p->w_wlock = WLOCK_AUTO;
- p->w_dupto = -1;
p->w_winlay.l_next = 0;
p->w_winlay.l_layfn = &WinLf;
p->w_winlay.l_data = (char *)p;
p->w_lay = &p->w_winlay;
p->w_display = display;
+ p->w_pdisplay = 0;
+#ifdef MULTIUSER
+ if (display && !AclCheckPermWin(D_user, ACL_WRITE, p))
+#else
if (display)
- p->w_wlockuser = d_user;
+#endif
+ p->w_wlockuser = D_user;
p->w_number = n;
p->w_ptyfd = f;
p->w_aflag = nwin.aflag;
@@ -185,12 +216,11 @@ struct NewWindow *newwin;
}
else
p->w_title = p->w_akachange = p->w_akabuf;
- if ((p->w_monitor = nwin.monitor) == -1)
- p->w_monitor = default_monitor;
+ p->w_monitor = nwin.monitor;
p->w_norefresh = 0;
strncpy(p->w_tty, TtyName, MAXSTR - 1);
- if (ChangeWindowSize(p, display ? d_defwidth : 80, display ? d_defheight : 24))
+ if (ChangeWindowSize(p, display ? D_defwidth : 80, display ? D_defheight : 24))
{
FreeWindow(p);
return -1;
@@ -198,7 +228,10 @@ struct NewWindow *newwin;
#ifdef COPY_PASTE
ChangeScrollback(p, nwin.histheight, p->w_width);
#endif
- ResetWindow(p); /* sets p->w_wrap */
+#ifdef KANJI
+ p->w_kanji = nwin.kanji;
+#endif
+ ResetWindow(p); /* sets w_wrap, w_c1, w_gr */
if (ttyflag == TTY_FLAG_PLAIN)
{
@@ -221,28 +254,91 @@ struct NewWindow *newwin;
/*
* Place the newly created window at the head of the most-recently-used list.
*/
- if (display && d_fore)
- d_other = d_fore;
+ if (display && D_fore)
+ D_other = D_fore;
*pp = p;
p->w_next = windows;
windows = p;
#ifdef UTMPOK
+ p->w_slot = (slot_t) -1;
+# ifdef LOGOUTOK
debug1("MakeWindow will %slog in.\n", nwin.lflag?"":"not ");
- if (nwin.lflag == 1)
+ if (nwin.lflag)
+# 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)
SetUtmp(p);
- else
- p->w_slot = (slot_t) 0;
}
- else
- p->w_slot = (slot_t) -1;
#endif
SetForeWindow(p);
Activate(p->w_norefresh);
return n;
}
+/*
+ * Resurrect a window from Zombie state.
+ * The command vector is therefore stored in the window structure.
+ * Note: The terminaltype defaults to screenterm again, the current
+ * working directory is lost.
+ */
+int
+RemakeWindow(p)
+struct win *p;
+{
+ int ttyflag;
+ char *TtyName;
+ int lflag, f;
+
+ lflag = nwin_default.lflag;
+ if ((f = OpenDevice(p->w_cmdargs[0], lflag, &ttyflag, &TtyName)) < 0)
+ return -1;
+
+ strncpy(p->w_tty, *TtyName ? TtyName : p->w_title, MAXSTR - 1);
+ p->w_ptyfd = f;
+
+ p->w_t.flags &= ~TTY_FLAG_PLAIN;
+ if (ttyflag == TTY_FLAG_PLAIN)
+ {
+ p->w_t.flags |= TTY_FLAG_PLAIN; /* Just in case... */
+ WriteString(p, p->w_cmdargs[0], strlen(p->w_cmdargs[0]));
+ WriteString(p, ": ", 2);
+ WriteString(p, p->w_title, strlen(p->w_title));
+ WriteString(p, "\r\n", 2);
+ p->w_pid = 0;
+ }
+ else
+ {
+ for (f = 0; p->w_cmdargs[f]; f++)
+ {
+ if (f)
+ WriteString(p, " ", 1);
+ WriteString(p, p->w_cmdargs[f], strlen(p->w_cmdargs[f]));
+ }
+ WriteString(p, "\r\n", 2);
+ p->w_pid = ForkWindow(p->w_cmdargs, (char *)0, nwin_default.term, TtyName, p);
+ if (p->w_pid < 0)
+ return -1;
+ }
+
+#ifdef UTMPOK
+ p->w_slot = (slot_t) -1;
+ debug1("RemakeWindow will %slog in.\n", lflag ? "" : "not ");
+# ifdef LOGOUTOK
+ if (lflag)
+# endif
+ {
+ p->w_slot = (slot_t) 0;
+ if (display)
+ SetUtmp(p);
+ }
+#endif
+ return p->w_number;
+}
+
void
FreeWindow(wp)
struct win *wp;
@@ -268,10 +364,18 @@ struct win *wp;
if (wp->w_logfp != NULL)
fclose(wp->w_logfp);
ChangeWindowSize(wp, 0, 0);
- for (d = displays; d; d = d->_d_next)
- if (d->_d_other == wp)
- d->_d_other = 0;
- free(wp);
+ for (d = displays; d; d = d->d_next)
+ if (d->d_other == wp)
+ d->d_other = 0;
+ while (wp->w_dlist)
+ {
+ struct displaylist* l;
+
+ l = wp->w_dlist->next;
+ free((char *)wp->w_dlist);
+ wp->w_dlist = l;
+ }
+ free((char *)wp);
}
static int
@@ -284,7 +388,7 @@ char **namep;
struct stat st;
int f;
- if ((stat(arg, &st)) == 0 && (st.st_mode & S_IFCHR))
+ if ((stat(arg, &st)) == 0 && S_ISCHR(st.st_mode))
{
if (access(arg, R_OK | W_OK) == -1)
{
@@ -319,7 +423,7 @@ char **namep;
}
#endif /* TIOCPKT */
}
- (void) fcntl(f, F_SETFL, FNDELAY);
+ (void) fcntl(f, F_SETFL, FNBLOCK);
#ifdef PTYGROUP
(void) chown(*namep, real_uid, PTYGROUP);
#else
@@ -371,7 +475,7 @@ struct win *win;
{
case -1:
Msg(errno, "fork");
- return -1;
+ break;
case 0:
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
@@ -381,20 +485,30 @@ struct win *win;
signal(SIGTTIN, SIG_DFL);
signal(SIGTTOU, SIG_DFL);
#endif
+#ifdef SIGPIPE
+ signal(SIGPIPE, SIG_DFL);
+#endif
+#ifdef SIGXFSZ
+ signal(SIGXFSZ, SIG_DFL);
+#endif
+
+ displays = 0; /* beware of Panic() */
if (setuid(real_uid) || setgid(real_gid))
{
- SendErrorMsg("Setuid/gid: %s", sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Setuid/gid: %s", strerror(errno));
+ exit(1);
}
+ eff_uid = real_uid;
+ eff_gid = real_gid;
if (dir && *dir && chdir(dir) == -1)
{
- SendErrorMsg("Cannot chdir to %s: %s", dir, sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Cannot chdir to %s: %s", dir, strerror(errno));
+ exit(1);
}
if (display)
{
- brktty(d_userfd);
+ brktty(D_userfd);
freetty();
}
else
@@ -403,7 +517,15 @@ struct win *win;
if (dfp && dfp != stderr)
fclose(dfp);
#endif
+#ifdef _IBMR2
+ close(0);
+ dup(aixhack);
+ close(aixhack);
+#endif
closeallfiles(win->w_ptyfd);
+#ifdef _IBMR2
+ aixhack = dup(0);
+#endif
#ifdef DEBUG
{
char buf[256];
@@ -436,9 +558,8 @@ struct win *win;
{
if ((newfd = open(ttyn, O_RDWR)) < 0)
{
- SendErrorMsg("Cannot open %s: %s",
- ttyn, sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Cannot open %s: %s", ttyn, strerror(errno));
+ exit(1);
}
}
else
@@ -456,20 +577,23 @@ struct win *win;
* the pseudo window process should not be surprised with a
* nonblocking filedescriptor. Poor Backend!
*/
- debug1("Clearing NDELAY on window-fd(%d)\n", win->w_ptyfd);
+ debug1("Clearing NBLOCK on window-fd(%d)\n", win->w_ptyfd);
if (fcntl(win->w_ptyfd, F_SETFL, 0))
- SendErrorMsg("Warning: ForkWindow clear NDELAY fcntl failed, %d", errno);
+ SendErrorMsg("Warning: ForkWindow clear NBLOCK fcntl failed, %d", errno);
}
#else /* PSEUDOS */
if ((newfd = open(ttyn, O_RDWR)) != 0)
{
- SendErrorMsg("Cannot open %s: %s", ttyn, sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Cannot open %s: %s", ttyn, strerror(errno));
+ exit(1);
}
dup(0);
dup(0);
#endif /* PSEUDOS */
close(win->w_ptyfd);
+#ifdef _IBMR2
+ close(aixhack);
+#endif
if (newfd >= 0)
{
@@ -477,26 +601,26 @@ struct win *win;
#if defined(SVR4) && !defined(sgi)
if (ioctl(newfd, I_PUSH, "ptem"))
{
- SendErrorMsg("Cannot I_PUSH ptem %s %s", ttyn, sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Cannot I_PUSH ptem %s %s", ttyn, strerror(errno));
+ exit(1);
}
if (ioctl(newfd, I_PUSH, "ldterm"))
{
- SendErrorMsg("Cannot I_PUSH ldterm %s %s", ttyn, sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Cannot I_PUSH ldterm %s %s", ttyn, strerror(errno));
+ exit(1);
}
if (ioctl(newfd, I_PUSH, "ttcompat"))
{
- SendErrorMsg("Cannot I_PUSH ttcompat %s %s", ttyn, sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Cannot I_PUSH ttcompat %s %s", ttyn, strerror(errno));
+ exit(1);
}
#endif
if (fgtty(newfd))
- SendErrorMsg("fgtty: %s (%d)", sys_errlist[errno], errno);
+ SendErrorMsg("fgtty: %s (%d)", strerror(errno), errno);
if (display)
{
debug("ForkWindow: using display tty mode for new child.\n");
- modep = &d_OldMode;
+ modep = &D_OldMode;
}
else
{
@@ -522,26 +646,36 @@ struct win *win;
# endif
}
#endif
+ debug("haha\n");
SetTTY(newfd, modep);
#ifdef TIOCSWINSZ
glwz.ws_col = w;
glwz.ws_row = h;
+ debug("hoho\n");
(void) ioctl(newfd, TIOCSWINSZ, (char *)&glwz);
#endif
}
+ debug("huhu\n");
#ifndef TIOCSWINSZ
sprintf(libuf, "LINES=%d", h);
sprintf(cobuf, "COLUMNS=%d", w);
NewEnv[5] = libuf;
NewEnv[6] = cobuf;
#endif
+ debug("hihi\n");
+#ifdef MAPKEYS
+ NewEnv[2] = MakeTermcap(display == 0 || win->w_aflag);
+#else
if (win->w_aflag)
NewEnv[2] = MakeTermcap(1);
else
NewEnv[2] = Termcap;
+#endif
+ debug("hyhy\n");
strcpy(shellbuf, "SHELL=");
strncpy(shellbuf + 6, ShellProg, MAXPATHLEN);
shellbuf[MAXPATHLEN + 6] = 0;
+ debug("hzhz\n");
NewEnv[4] = shellbuf;
debug1("ForkWindow: NewEnv[4] = '%s'\n", shellbuf);
if (term && *term && strcmp(screenterm, term) &&
@@ -553,11 +687,11 @@ struct win *win;
debug2("Makewindow %d with %s\n", win->w_number, tebuf);
tl = strlen(term);
NewEnv[1] = tebuf;
- if ((s1 = index(Termcap, '|')))
+ if ((s1 = index(NewEnv[2], '|')))
{
if ((s2 = index(++s1, '|')))
{
- if (strlen(Termcap) - (s2 - s1) + tl < 1024)
+ if (strlen(NewEnv[2]) - (s2 - s1) + tl < 1024)
{
bcopy(s2, s1 + tl, strlen(s2) + 1);
bcopy(term, s1, tl);
@@ -573,12 +707,16 @@ struct win *win;
debug1("calling execvpe %s\n", proc);
execvpe(proc, args, NewEnv);
debug1("exec error: %d\n", errno);
- SendErrorMsg("Cannot exec %s: %s", proc, sys_errlist[errno]);
+ SendErrorMsg("Cannot exec %s: %s", proc, strerror(errno));
exit(1);
default:
- return pid;
- } /* end fork switch */
- /* NOTREACHED */
+ break;
+ }
+#ifdef _IBMR2
+ close(aixhack);
+ aixhack = -1;
+#endif
+ return pid;
}
static void
@@ -590,9 +728,8 @@ char *prog, **args, **env;
char *shargs[MAXARGS + 1];
register int i, eaccess = 0;
- for (i = 0; i < 3; i++)
- if (!strncmp("../" + i, prog, 3 - i))
- path = "";
+ if (rindex(prog, '/'))
+ path = "";
if (!path && !(path = getenv("PATH")))
path = DefaultPath;
do
@@ -726,7 +863,7 @@ char **av;
if ((pwin->p_ptyfd = OpenDevice(av[0], 0, &l, &t)) < 0)
{
- free(pwin);
+ free((char *)pwin);
return -1;
}
strncpy(pwin->p_tty, t, MAXSTR - 1);
@@ -762,13 +899,13 @@ struct win *w;
struct pseudowin *pwin = w->w_pwin;
ASSERT(pwin);
- if (fcntl(w->w_ptyfd, F_SETFL, FNDELAY))
- Msg(errno, "Warning: FreePseudowin: NDELAY fcntl failed");
+ if (fcntl(w->w_ptyfd, F_SETFL, FNBLOCK))
+ Msg(errno, "Warning: FreePseudowin: NBLOCK fcntl failed");
(void) chmod(pwin->p_tty, 0666);
(void) chown(pwin->p_tty, 0, 0);
if (pwin->p_ptyfd >= 0)
close(pwin->p_ptyfd);
- free(pwin);
+ free((char *)pwin);
w->w_pwin = NULL;
}
@@ -777,9 +914,14 @@ struct win *w;
#ifdef MULTI
+/*
+ * Clone routines. To be removed...
+ */
+
static void CloneTermcap __P((struct display *));
extern char **environ;
+
int
execclone(av)
char **av;
@@ -795,6 +937,10 @@ char **av;
Msg(0, "No more PTYs.");
return -1;
}
+#ifdef _IBMR2
+ close(aixhack);
+ aixhack = -1;
+#endif
f = open(namep, O_RDWR);
if (f == -1)
{
@@ -804,15 +950,15 @@ char **av;
}
brktty(f);
signal(SIGHUP, SIG_IGN); /* No hangups, please */
- if (MakeDisplay(d_username, namep, d_termname, f, -1, &d_OldMode) == 0)
+ if (MakeDisplay(D_username, namep, D_termname, f, -1, &D_OldMode) == 0)
{
display = old;
Msg(0, "Could not make display.");
close(f);
return -1;
}
- SetMode(&d_OldMode, &d_NewMode);
- SetTTY(f, &d_NewMode);
+ SetMode(&D_OldMode, &D_NewMode);
+ SetTTY(f, &D_NewMode);
switch (fork())
{
case -1:
@@ -821,12 +967,15 @@ char **av;
Msg(errno, "fork");
return -1;
case 0:
- d_usertty[0] = 0; /* for SendErrorMsg */
+ D_usertty[0] = 0; /* for SendErrorMsg */
+ displays = 0; /* beware of Panic() */
if (setuid(real_uid) || setgid(real_gid))
{
- SendErrorMsg("Setuid/gid: %s", sys_errlist[errno]);
- eexit(1);
+ SendErrorMsg("Setuid/gid: %s", strerror(errno));
+ exit(1);
}
+ eff_uid = real_uid;
+ eff_gid = real_gid;
closeallfiles(sf);
close(1);
dup(sf);
@@ -861,7 +1010,7 @@ char **av;
debug("\n");
#endif
execvpe(*av, av, environ);
- SendErrorMsg("Cannot exec %s: %s", *av, sys_errlist[errno]);
+ SendErrorMsg("Cannot exec %s: %s", *av, strerror(errno));
exit(1);
default:
break;
@@ -870,7 +1019,7 @@ char **av;
CloneTermcap(old);
InitTerm(0);
Activate(0);
- if (d_fore == 0)
+ if (D_fore == 0)
ShowWindows();
return 0;
}
@@ -884,23 +1033,23 @@ struct display *old;
char *tp;
int i;
- tp = d_tentry;
+ tp = D_tentry;
for (i = 0; i < T_N; i++)
{
switch(term[i].type)
{
case T_FLG:
- d_tcs[i].flg = old->_d_tcs[i].flg;
+ D_tcs[i].flg = old->d_tcs[i].flg;
break;
case T_NUM:
- d_tcs[i].num = old->_d_tcs[i].num;
+ D_tcs[i].num = old->d_tcs[i].num;
break;
case T_STR:
- d_tcs[i].str = old->_d_tcs[i].str;
- if (d_tcs[i].str)
+ D_tcs[i].str = old->d_tcs[i].str;
+ if (D_tcs[i].str)
{
- strcpy(tp, d_tcs[i].str);
- d_tcs[i].str = tp;
+ strcpy(tp, D_tcs[i].str);
+ D_tcs[i].str = tp;
tp += strlen(tp) + 1;
}
break;
@@ -910,21 +1059,21 @@ struct display *old;
}
CheckScreenSize(0);
for (i = 0; i < NATTR; i++)
- d_attrtab[i] = old->_d_attrtab[i];
+ D_attrtab[i] = old->d_attrtab[i];
for (i = 0; i < 256; i++)
- d_c0_tab[i] = old->_d_c0_tab[i];
- d_UPcost = old->_d_UPcost;
- d_DOcost = old->_d_DOcost;
- d_NLcost = old->_d_NLcost;
- d_LEcost = old->_d_LEcost;
- d_NDcost = old->_d_NDcost;
- d_CRcost = old->_d_CRcost;
- d_IMcost = old->_d_IMcost;
- d_EIcost = old->_d_EIcost;
+ D_c0_tab[i] = old->d_c0_tab[i];
+ D_UPcost = old->d_UPcost;
+ D_DOcost = old->d_DOcost;
+ D_NLcost = old->d_NLcost;
+ D_LEcost = old->d_LEcost;
+ D_NDcost = old->d_NDcost;
+ D_CRcost = old->d_CRcost;
+ D_IMcost = old->d_IMcost;
+ D_EIcost = old->d_EIcost;
#ifdef AUTO_NUKE
- d_auto_nuke = old->_d_auto_nuke;
+ D_auto_nuke = old->d_auto_nuke;
#endif
- d_tcinited = 1;
+ D_tcinited = 1;
}
#endif
diff --git a/src/window.h b/src/window.h
index 73b1929..37cfc69 100644
--- a/src/window.h
+++ b/src/window.h
@@ -25,7 +25,26 @@
# define MAXWIN 10
#endif
-struct win;
+
+struct NewWindow
+{
+ int StartAt; /* where to start the search for the slot */
+ char *aka; /* aka string */
+ char **args; /* argv vector */
+ char *dir; /* directory for chdir */
+ char *term; /* TERM to be set instead of "screen" */
+ int aflag;
+ int flowflag;
+ int lflag;
+ int histheight;
+ int monitor;
+ int wlock; /* default writelock setting */
+ int wrap;
+ int c1;
+ int gr;
+ int kanji;
+};
+
#ifdef PSEUDOS
@@ -81,18 +100,29 @@ struct pseudowin
#endif /* PSEUDOS */
+struct displaylist
+{
+ struct displaylist *next;
+ struct display *d;
+};
+
+#define w_display w_dlist->d
+
+
struct win
{
struct win *w_next; /* next window */
#ifdef PSEUDOS
struct pseudowin *w_pwin; /* ptr to pseudo */
#endif
- struct display *w_display; /* pointer to our display */
+ struct displaylist *w_dlist; /* pointer to our display */
+ struct display *w_pdisplay; /* display for printer relay */
int w_number; /* window number */
- int w_active; /* is window fore ? */
+ int w_active; /* is window fore and has no layer? */
struct layer *w_lay; /* the layer of the window */
struct layer w_winlay; /* the layer of the window */
int w_pid; /* process at the other end of ptyfd */
+ char *w_cmdargs[MAXARGS]; /* command line argument vector */
int w_ptyfd; /* fd of the master pty */
int w_aflag; /* (used for DUMP_TERMCAP) */
char w_inbuf[IOSIZE];
@@ -118,14 +148,17 @@ struct win
int w_x, w_y; /* Cursor position */
int w_width, w_height; /* window size */
char w_Attr; /* character attributes */
- char w_Font; /* character font */
- int w_Charset; /* charset number */
+ char w_Font; /* character font GL */
+ 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_ss;
int w_saved;
int w_Saved_x, w_Saved_y;
char w_SavedAttr;
int w_SavedCharset;
+ int w_SavedCharsetR;
int w_SavedCharsets[4];
int w_top, w_bot; /* scrollregion */
int w_wrap; /* autowrap */
@@ -133,6 +166,10 @@ struct win
int w_insert; /* window is in insert mode */
int w_keypad; /* keypad mode */
int w_cursorkeys; /* appl. cursorkeys mode */
+ int w_revvid; /* reverse video */
+ int w_curinv; /* cursor invisible */
+ int w_autolf; /* automatic linefeed */
+ char *w_hstatus; /* hardstatus line */
#ifdef COPY_PASTE
char *w_pastebuf; /* this gets pasted in the window */
char *w_pasteptr; /* pointer in pastebuf */
@@ -145,6 +182,12 @@ struct win
#endif
enum state_t w_state; /* parser state */
enum string_t w_StringType;
+ int w_gr; /* enable GR flag */
+ int w_c1; /* enable C1 flag */
+#ifdef KANJI
+ int w_kanji; /* for input and paste */
+ int w_mbcs; /* saved char for multibytes charset */
+#endif
char w_string[MAXSTR];
char *w_stringp;
char *w_tabs; /* line with tabs */
@@ -157,9 +200,6 @@ struct win
time_t lastio; /* timestamp of last filedescriptor activity */
int seconds; /* tell us when lastio + seconds < time() */
} w_tstamp;
- int w_dupto; /* duplicate the output to this window */
- char w_vbwait;
- char w_cursor_invisible;
char w_norefresh; /* dont redisplay when switching to that win */
char w_wlock; /* WLOCK_AUTO, WLOCK_OFF, WLOCK_ON */
struct user *w_wlockuser; /* NULL when unlocked or user who writes */