From e6618a14fab6b993f328373d4180d32452d761b4 Mon Sep 17 00:00:00 2001 From: jnweiger Date: Fri, 16 Dec 2005 18:18:22 +0000 Subject: old version screen-3.9.4 Aug 5 1999 --- src/.iscreenrc | 169 ++ src/COPYING | 2 +- src/INSTALL | 6 +- src/Makefile | 1 + src/Makefile.in | 277 +-- src/NEWS | 153 +- src/NEWS.3.7 | 39 + src/README | 6 +- src/TODO | 8 + src/acls.c | 307 +++- src/acls.h | 19 - src/ansi.c | 2062 +++++++++++----------- src/ansi.h | 2 + src/attacher.c | 223 ++- src/braille.c | 942 ++++++++++ src/braille.h | 80 + src/braille_tsi.c | 317 ++++ src/comm.c | 352 ++-- src/comm.h.dist | 313 ++-- src/comm.sh | 33 +- src/config.h.in | 145 +- src/configure | 3914 ++++++++++++++++++++++++------------------ src/configure.in | 349 ++-- src/display.c | 1549 +++++++++++++---- src/display.h | 115 +- src/doc/README.DOTSCREEN | 151 ++ src/doc/make.help | 51 + src/doc/screen.1 | 1431 +++++++++++---- src/doc/screen.info | 296 ++-- src/doc/screen.info-1 | 644 +++---- src/doc/screen.info-2 | 1004 +++++------ src/doc/screen.info-3 | 1101 ++++++------ src/doc/screen.info-4 | 798 ++++++++- src/doc/screen.info-5 | 545 ++++++ src/doc/screen.texinfo | 978 +++++++++-- src/doc/window_to_display.ps | 2959 +++++++++++++++++++++++++++++++ src/etc/ccdefs | 45 + src/etc/gr-braille.tbl | 260 +++ src/etc/gs-braille.tbl | 261 +++ src/etc/newsyntax38 | 71 + src/etc/screenrc | 16 +- src/etc/us-braille.tbl | 260 +++ src/extern.h | 195 ++- src/fileio.c | 91 +- src/help.c | 519 ++++-- src/image.h | 27 +- src/input.c | 203 ++- src/layer.c | 933 ++++++++++ src/layer.h | 104 ++ src/loadav.c | 2 +- src/logfile.c | 318 ++++ src/logfile.h | 82 + src/mark.c | 494 +++--- src/mark.h | 2 + src/misc.c | 205 ++- src/nethack.c | 136 ++ src/os.h | 62 +- src/osdef.h.in | 19 +- src/osdef.sh | 25 + src/overlay.h | 68 - src/patchlevel.h | 206 ++- src/process.c | 2144 ++++++++++++++++------- src/pty.c | 52 +- src/resize.c | 295 +++- src/sched.c | 263 +++ src/sched.h | 20 + src/screen.c | 2047 ++++++++++------------ src/screen.h | 79 +- src/search.c | 83 +- src/socket.c | 541 +++--- src/tek.patch | 68 - src/teln.c | 562 ++++++ src/term.h.dist | 206 +-- src/term.sh | 2 +- src/termcap.c | 93 +- src/terminfo/README | 3 +- src/terminfo/sco.mail | 65 - src/tty.c.dist | 1213 ++++++++++--- src/tty.sh | 786 +++++++-- src/utmp.c | 829 ++++----- src/window.c | 1336 ++++++++++---- src/window.h | 193 ++- 82 files changed, 26601 insertions(+), 10224 deletions(-) create mode 100644 src/.iscreenrc create mode 100644 src/NEWS.3.7 create mode 100644 src/TODO create mode 100644 src/braille.c create mode 100644 src/braille.h create mode 100644 src/braille_tsi.c create mode 100644 src/doc/README.DOTSCREEN create mode 100644 src/doc/make.help create mode 100644 src/doc/screen.info-5 create mode 100644 src/doc/window_to_display.ps create mode 100755 src/etc/ccdefs create mode 100644 src/etc/gr-braille.tbl create mode 100644 src/etc/gs-braille.tbl create mode 100755 src/etc/newsyntax38 create mode 100644 src/etc/us-braille.tbl create mode 100644 src/layer.c create mode 100644 src/layer.h create mode 100644 src/logfile.c create mode 100644 src/logfile.h create mode 100644 src/nethack.c delete mode 100644 src/overlay.h create mode 100644 src/sched.c create mode 100644 src/sched.h delete mode 100644 src/tek.patch create mode 100644 src/teln.c delete mode 100644 src/terminfo/sco.mail (limited to 'src') diff --git a/src/.iscreenrc b/src/.iscreenrc new file mode 100644 index 0000000..802afbd --- /dev/null +++ b/src/.iscreenrc @@ -0,0 +1,169 @@ +# +# A sample .screenrc which I use for everyday work. +# +# some of the commands commented out here, have been moved to +# /local/etc/screenrc +# +# we want no password, right? +#password # This will ask us for a password. +password none # Same as not even mentioning it. +#password 12Bz/9hNlPLZk # "1234" +#password YahtrWblnJw # ypmatch jnweiger passwd. Well, ... :-) + +scrollback 200 # we have a 200 lines history buffer +markkeys "@=\177:@=^C" # our mad facit-twist terminal buffer overflow... +markkeys "h=^B:l=^F:\$=^E" # some missing emacs style bindings in copymode + +echo -n "booting screen" + +# let it flash, not horn! +#vbell on # "vbell" don't work any longer, sorry. +#vbell_msg " Wuff, Wuff!! " # this is the default message +#bell "Bimmmel No. %" # sounds the bell and shows a message + +# we want to login all windows we create. +#login on # "login", "nologin" don't work any longer, sorry 2. + +echo -n "." +# we have no termcap entry for screen on the target machine? Well then +# we tell a lie. +term screen # would be the obvious default here. +#term vt100 # screen will understand vt100 for 99%. + +# we want to survive hangups +# note that the default setting is off now! +autodetach on + +# when we open a window, where shall its CWD be? +chdir # without argument it's my $HOME + +echo -n "." +# I hate nonexisting status lines! Force screen to believe me. +#hardstatus off + +# now some Terminal setup: +# Printing in the leftmost column is not save. We express that fact as :LP@: +# +# Emacs tends to smear it's highlighted status bar across the screen, producing +# ugly areas of bright background, if termcap is'nt perfectly sober. +# Give a little :ms@: in the termcap, this may help. +# +# And who invented the initialisation for facit terminals? We tell him that +# we non't like smooth scroll, by specifying :ti=\E[?l:. +# \E[?3l 80 Zeichen +# \E[?3h 132 Zeichen +# LP Last column Printable +# \E[A cursor up +# \E[B cursor down +# \E[?4h smooth scroll +# \E[?4l jump scroll +# \E[%dL insert %d lines +# \E[K clear to end of line +# cs \E[%i%d;%dr for twist and xterm +# ms@ Move in Standout mode is NOT save. +# WS our private variable, it declares that the terminal can +# be resized by an escape-sequence +# The termcap statement takes 2 or three parameters. First parameter lists +# which TERMCAPs are affected by this statement. Second we specify changes +# in screen's view of that terminals. Third we may specify some capabilities +# that user-programs want to see in the $TERMCAP environment variable or in +# screen's termcap entry. +termcap vt* cl=\E[H\E[J\E[?1h:vi=\E[?35h:ve=\E[35l:ti=\E[?4l[vt100] +termcap facit ti=\E[?4l[facit] +termcap xterm* is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l:Z0=\E[?3h:Z1=\E[?3l + +echo -n "." +# "\E(B", "\E(0", "\E(1", "\E(2", ... to switch between charsets. +# screen internally emulates G1: "\E)..", G2: "\E*..", G3: "\E+.." +# you can switch between them, with: +# +# code | switch to +# ------+------ +# ^O | G0 +# ^N | G1 +# \En | G2 +# \Eo | G3 +#termcap facit|vt100|xterm* G0 + +# how do we resize windows? under sunview, this is standard, but xterm +# needs to be a specially hacked xterm, to make this work. +termcap xterm* WS=\E[8;%d;%dt + +# ICL 6402 testing: +termcap icl* G0:S0=\E$[start]:E0=\E%[end]:C0=j9kx5 GS=\E(0^O:GE=\E(B^O:G1=k:G2=l:G3=m:G4=j:GV=x:GH=q:GR=u:GL=t:GU=w:GD=v:GC=n + +# Flowcontrol produces trouble. ^S und ^Q will never reach screen, as our +# terminals catch them locally. Who can explain that to me?: +#flow on|off|auto [interrupt] + +# Long Lines get wrapped around (the back of your terminal). This is the +# default for vt100. But now programs make different asumptions about your +# terminal. You may find two linefeeds where you'd expect one, or you may +# be confronted with a truncated line. Currently there is no fix, but pressing +# C-A r and doing a redraw. +#wrap on + +# the autoaka allows you to see the currently executing shell command in the +# window name field. To use that, your shell prompt must contain ^[k^[\ or +# you will see the string "(init)" as a name. +# in my .cshrc I may use this for a wonderfull tcsh-prompt: +# set prompt="%{^[k^[\\%}%h %c2(%m)%# " +# +# defining a shellaka that contains a pipe-symbol (|) activites the +# autoaka feature. To the left of that | you specify a constant part of +# your prompt as a trigger, to the right you may place a default string +# as in +shellaka '> |tc' +# but beware! specifying a window name with the -t option has priority over +# the autoaka mechanism. Although specifying -t "> |foo" will work. +# shellaka tc + +# ... now a little bit of key bindings +# In case we don't have write permission for /etc/utmp (no s-bit) +# we create even local windows via rlogin. -> Et voila: a utmp-slot +# utmp-slots are strongly recomended to keep sccs and talk happy. +# (thus we have ^A# or. ^Ac for windowcreation with or without utmp-slot.) +# but if we run suid-root, we produce all the rlogins with -ln, +# as nobody shall refer to these pty's. +bind '!' screen -ln -k faui41 rlogin faui41 +bind '@' screen -ln -k vme2 rlogin faui4_vme2 +#bind '#' screen -k faui43 +bind '#' screen -ln -k faui43 rlogin faui43 +bind '$' screen -ln -k faui44 rlogin faui44 +bind '%' screen -ln -k faui45 rlogin faui45 +bind '\^' screen -ln -k sup1 rlogin fausup1 +bind '&' screen -ln -k sup2 rlogin fausup2 +bind '*' screen -ln -k faui48 rlogin faui48 +bind '(' screen -ln -k faui09 rlogin faui09 +bind ')' screen -ln -k faui10 rlogin faui10 +bind 'J' screen -ln -k 4j rlogin faui4j +bind 'P' screen -ln -k 4p rlogin faui4p +bind '^C' screen -ln -k 45c rlogin faui45c +bind '^D' screen -ln -k 45d rlogin faui45d +bind '^E' screen -ln -k 45e rlogin faui45e +bind '^I' screen -ln -k 45i rlogin faui45i + +# these two are logIn and logOut. As a toggle is too stupid. +#bind 'I' set login on +#bind 'O' set login off +bind 'L' + +# What happens, when you 'think emacs' and want to erase a whole +# line? You type ^A^K right? Under screen it should be ^Aa^K. But... +# killing the window would be a real punishment for a little mistyping. +bind k #wow! I even amange to type ^Ak by accident. +#bind ^k +#bind K kill + +echo -n "." +#screen 1:faui43 # My good old : syntax +#screen -k faui43 # The way Wayne Davison thinks about it. +#screen -ln -k faui43 # this one not logged in. +#screen -ln 2:faui09 rlogin faui09 -l jnweiger + +# Finally another bonus feature for people using strange terminal settings like +# different baud rate, etc. The next user will get standard settings +# as ^[c is a reset sequence. +#pow_detach_msg "" # is the default +pow_detach_msg "c" +echo "done." diff --git a/src/COPYING b/src/COPYING index 13c9d42..55d2947 100644 --- a/src/COPYING +++ b/src/COPYING @@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found. 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., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. diff --git a/src/INSTALL b/src/INSTALL index d382078..b6c4442 100644 --- a/src/INSTALL +++ b/src/INSTALL @@ -43,7 +43,7 @@ The path for ETCSCREENRC may also need to be adapted. 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 +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). @@ -89,7 +89,7 @@ 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, ...aak +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. @@ -107,4 +107,4 @@ database is up to date. See the README in the terminfo subdirectory. 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 index 9458230..06b972a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,2 +1,3 @@ install all Makefiles and config: + rm -f config.cache sh ./configure diff --git a/src/Makefile.in b/src/Makefile.in index f9fc599..81bc689 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -9,13 +9,14 @@ VPATH = @srcdir@ # Where to install screen. -prefix = /usr/local -exec_prefix = $(prefix) +prefix = @prefix@ +exec_prefix = @exec_prefix@ # don't forget to change mandir and infodir in doc/Makefile. bindir = $(exec_prefix)/bin VERSION = @VERSION@ +SCREEN = screen-$(VERSION) ETCSCREENRC = `sed < config.h -n -e '/define ETCSCREENRC/s/^.*"\([^"]*\)"/\1/p'` @@ -24,7 +25,7 @@ CFLAGS = -O LDFLAGS = LIBS = @LIBS@ -CPP_DEPEND=/lib/cpp -MM +CPP_DEPEND=$(CC) -MM INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -35,33 +36,33 @@ AWK = @AWK@ ### Chose some debug configuration options: # -DDEBUG # Turn on really heavy debug output. This is written to -# /tmp/debug/screen.{front,back} Look at these files and quote +# /tmp/debug/{SCREEN,screen}.. Look at these files and quote # questionable sections when sending bug-reports to the author. -# -DTMPTEST -# Change the socket directory to a location that does not interfere -# with the (suid-root) installed screen version. Use that in -# combination with -DDEBUG # -DDUMPSHADOW -# With shadow-pw screen would never dump core. Use this option if you -# still want to have a core. Use only for debugging. +# With shadow-pw screen would never dump core. Use this option if +# you still want to have a core. Use only for debugging. # -DFORKDEBUG # Swap roles of father and son when forking the SCREEN process. +# Note: "detach" will be less powerfull, but "pow_detach" may be +# more forcefull than usual. # Useful only for debugging. OPTIONS= -#OPTIONS= -DDEBUG -DTMPTEST +#OPTIONS= -DDEBUG 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 \ - kmapdef.c acls.c + kmapdef.c acls.c braille.c braille_tsi.c logfile.c layer.c \ + sched.c teln.c nethack.c OFILES= screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \ search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \ termcap.o input.o attacher.o pty.o process.o display.o comm.o \ - kmapdef.o acls.o + kmapdef.o acls.o braille.o braille_tsi.o logfile.o layer.o \ + sched.o teln.o nethack.o -all: screen screen.info +all: screen screen: $(OFILES) $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) @@ -69,17 +70,23 @@ screen: $(OFILES) .c.o: $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $< -install_bin: screen - $(INSTALL_PROGRAM) screen $(bindir)/screen-$(VERSION) - -chown root $(bindir)/screen-$(VERSION) && chmod 4755 $(bindir)/screen-$(VERSION) +install_bin: .version screen + -if [ -f $(bindir)/$(SCREEN) ] && [ ! -f $(bindir)/$(SCREEN).old ]; \ + then mv $(bindir)/$(SCREEN) $(bindir)/$(SCREEN).old; fi + $(INSTALL_PROGRAM) screen $(bindir)/$(SCREEN) + -chown root $(bindir)/$(SCREEN) && chmod 4755 $(bindir)/$(SCREEN) # This doesn't work if $(bindir)/screen is a symlink -if [ -f $(bindir)/screen ] && [ ! -f $(bindir)/screen.old ]; then mv $(bindir)/screen $(bindir)/screen.old; fi rm -f $(bindir)/screen - ln -s screen-$(VERSION) $(bindir)/screen + ln -s $(SCREEN) $(bindir)/screen +############################################################################### install: installdirs install_bin cd doc ; $(MAKE) install - -tic ${srcdir}/terminfo/screeninfo.src + -if [ -d /usr/lib/terminfo ]; then \ + PATH="$PATH:/usr/5bin" tic ${srcdir}/terminfo/screeninfo.src; \ + chmod 644 /usr/lib/terminfo/s/screen*; \ + fi # Better do this by hand. E.g. under RCS... # cat ${srcdir}/terminfo/screencap >> /etc/termcap @echo "termcap entry (${srcdir}/terminfo/screencap) should be installed manually." @@ -90,8 +97,8 @@ installdirs: $(srcdir)/etc/mkinstalldirs $(bindir) cd doc ; $(MAKE) installdirs -uninstall: - rm -f $(bindir)/screen-$(VERSION) +uninstall: .version + rm -f $(bindir)/$(SCREEN) rm -f $(bindir)/screen -mv $(bindir)/screen.old $(bindir)/screen rm -f $(ETCSCREENRC) @@ -99,9 +106,12 @@ uninstall: shadow: mkdir shadow; - cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo . + cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo ../etc . rm -f shadow/term.h shadow/tty.c shadow/comm.h shadow/osdef.h - + echo "install all Makefiles and config:" > shadow/Makefile + echo " rm -f config.cache" >> shadow/Makefile + echo " sh ./configure" >> shadow/Makefile + term.h: term.c term.sh AWK=$(AWK) srcdir=$(srcdir) sh $(srcdir)/term.sh @@ -123,78 +133,84 @@ dvi info screen.info: -cd doc; $(MAKE) $@ mostlyclean: - rm -f $(OFILES) screen + rm -f $(OFILES) screen config.cache osdef0.c osdef1.sed osdef2.sed clean celan: mostlyclean - rm -f tty.c term.h comm.h osdef.h + rm -f tty.c term.h comm.h osdef.h core # Delete all files from the current directory that are created by # configuring or building the program. # building of term.h/comm.h requires awk. Keep it in the distribution # we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC. -distclean: mostlyclean - rm -f screen-$(VERSION).tar screen-$(VERSION).TZ - rm -f config.status Makefile - rm -f osdef.h doc/Makefile - echo "install all Makefiles and config:" > Makefile - echo " sh ./configure" >> Makefile +#distclean: mostlyclean +# rm -f $(SCREEN).tar $(SCREEN).tar.gz +# rm -f config.status Makefile +# rm -f osdef.h doc/Makefile + +maintainer-clean: + @echo "This command is not even intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + # Delete everything from the current directory that can be # reconstructed with this Makefile. -realclean: distclean - rm -f tty.c term.h comm.h +realclean: .version mostlyclean + rm -f $(SCREEN).tar $(SCREEN).tar.gz + rm -f config.status Makefile doc/Makefile + rm -f tty.c term.h comm.h osdef.h rm -f config.h + echo "install all Makefiles and config:" > Makefile + echo " sh ./configure" >> Makefile -TAGS: $(CFILES) - ctags $(CFILES) *.h - ctags -e $(CFILES) *.h +tags TAGS: $(CFILES) + -ctags *.sh $(CFILES) *.h + -ctags -e *.sh $(CFILES) *.h -dist: screen-$(VERSION).tar.gz +dist: .version $(SCREEN).tar.gz -screen-$(VERSION).tar: term.h comm.h tty.c kmapdef.c +$(SCREEN).tar: .version term.h comm.h tty.c kmapdef.c -rm -rf dist mkdir dist - mkdir dist/screen-$(VERSION) - ln acls.h ansi.h display.h extern.h mark.h os.h overlay.h \ - patchlevel.h rcs.h screen.h window.h image.h \ - osdef.h.in term.sh tty.sh comm.sh osdef.sh \ - acls.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* 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 - sed -e 's@[ ]/local@ /usr/local@g' -e 's/^CFLAGS = -g/CFLAGS = -O/' < Makefile.in > dist/screen-$(VERSION)/Makefile.in - 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 sco.mail screencap \ + mkdir dist/$(SCREEN) + ln acls.h ansi.h display.h extern.h logfile.h mark.h os.h \ + layer.h patchlevel.h rcs.h screen.h window.h image.h \ + osdef.h.in term.sh tty.sh comm.sh osdef.sh braille.h \ + sched.h \ + $(CFILES) \ + ChangeLog COPYING INSTALL NEWS* TODO install.sh \ + dist/$(SCREEN) + cd dist/$(SCREEN); mv tty.c tty.c.dist + cd dist/$(SCREEN); mv kmapdef.c kmapdef.c.dist + ln configure.in configure dist/$(SCREEN) + sed -e 's@"/local/screens@"/tmp/screens@' -e 's@"/local@"/usr/local@g' < config.h.in > dist/$(SCREEN)/config.h.in + sed -e 's@[ ]/local@ /usr/local@g' -e 's/^CFLAGS = -g/CFLAGS = -O/' < Makefile.in > dist/$(SCREEN)/Makefile.in + ln term.h dist/$(SCREEN)/term.h.dist + ln comm.h dist/$(SCREEN)/comm.h.dist + ln README dist/$(SCREEN)/README + mkdir dist/$(SCREEN)/terminfo + cd terminfo; ln 8bits README checktc.c screencap \ screeninfo.src test.txt tetris.c \ - ../dist/screen-$(VERSION)/terminfo - 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)/.screenrc dist/screen-$(VERSION)/etc/screenrc - mkdir dist/screen-$(VERSION)/doc - sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/screen-$(VERSION)/doc/Makefile.in - cd doc; ln FAQ screen.1 screen.texinfo fdpat.ps \ - ../dist/screen-$(VERSION)/doc + ../dist/$(SCREEN)/terminfo + mkdir dist/$(SCREEN)/etc + cd etc; ln * ../dist/$(SCREEN)/etc + sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/$(SCREEN)/etc/etcscreenrc + cp $(HOME)/.screenrc dist/$(SCREEN)/etc/screenrc + mkdir dist/$(SCREEN)/doc + sed -e 's@/local/emacs@/usr/local@g' < doc/Makefile.in > dist/$(SCREEN)/doc/Makefile.in + cd doc; ln FAQ README.DOTSCREEN screen.1 screen.texinfo fdpat.ps make.help window_to_display.ps \ + ../dist/$(SCREEN)/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 and config:" > dist/screen-$(VERSION)/Makefile - echo " sh ./configure" >> dist/screen-$(VERSION)/Makefile - cd dist; tar chf ../screen-$(VERSION).tar screen-$(VERSION) + ../dist/$(SCREEN)/doc; fi + cd dist/$(SCREEN)/doc; ln -s ../install.sh . + cd dist/$(SCREEN); ln -s doc/FAQ . + echo "install all Makefiles and config:" > dist/$(SCREEN)/Makefile + echo " rm -f config.cache" >> dist/$(SCREEN)/Makefile + echo " sh ./configure" >> dist/$(SCREEN)/Makefile + cd dist; tar cf ../$(SCREEN).tar $(SCREEN) rm -rf dist -screen-$(VERSION).tar.gz: screen-$(VERSION).tar - gzip -f screen-$(VERSION).tar +$(SCREEN).tar.gz: $(SCREEN).tar + gzip -nf $(SCREEN).tar || gzip -f $(SCREEN).tar # Perform self-tests (if any). check: @@ -205,6 +221,23 @@ lint: saber: #load $(CFLAGS) screen.c ansi.c $(LIBS) +config: + rm -f config.cache + sh ./configure + + +############################################################################### + +.version: + @rev=`sed < patchlevel.h -n -e '/#define REV/s/#define REV *//p'`; \ + vers=`sed < patchlevel.h -n -e '/#define VERS/s/#define VERS *//p'`; \ + pat=`sed < patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVEL *//p'`; \ + if [ "$${rev}.$${vers}.$${pat}" != "$(VERSION)" ]; then \ + echo "This distribution is screen-$${rev}.$${vers}.$${pat}, but"; \ + echo "the Makefile is from $(VERSION). Please update!"; exit 1; fi + +############################################################################### + mdepend: $(CFILES) term.h @rm -f DEPEND ; \ for i in ${CFILES} ; do \ @@ -218,36 +251,76 @@ mdepend: $(CFILES) term.h done -depend: $(CFILES) term.h - cp Makefile Makefile~ - sed -e '/\#\#\# Dependencies/q' < Makefile > tmp_make +depend: depend.in + ./config.status || ./configure + +depend.in: $(CFILES) term.h + cp Makefile.in Makefile.in~ + sed -e '/\#\#\# Dependencies/q' < Makefile.in > tmp_make for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done - mv tmp_make Makefile + mv tmp_make Makefile.in -screen.o socket.o: Makefile +############################################################################### ### Dependencies: -screen.o: screen.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h patchlevel.h rcs.h screen.h term.h window.h -ansi.o: ansi.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -fileio.o: fileio.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -mark.o: mark.c acls.h ansi.h comm.h config.h display.h extern.h image.h mark.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -misc.o: misc.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -resize.o: resize.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -socket.o: socket.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -search.o: search.c acls.h ansi.h comm.h config.h display.h extern.h image.h mark.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -tty.o: tty.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h +screen.o: screen.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h braille.h \ + patchlevel.h logfile.h extern.h +ansi.o: ansi.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h braille.h extern.h \ + logfile.h +fileio.o: fileio.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +mark.o: mark.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h mark.h extern.h +misc.o: misc.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +resize.o: resize.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +socket.o: socket.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +search.o: search.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h mark.h extern.h +tty.o: tty.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h comm.h \ + layer.h term.h image.h display.h window.h extern.h term.o: term.c rcs.h term.h -window.o: window.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -utmp.o: utmp.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -loadav.o: loadav.c acls.h ansi.h comm.h config.h display.h extern.h image.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 acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -termcap.o: termcap.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -input.o: input.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -attacher.o: attacher.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -pty.o: pty.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -process.o: process.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -display.o: display.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h -comm.o: comm.c acls.h comm.h config.h rcs.h +window.o: window.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h logfile.h +utmp.o: utmp.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +loadav.o: loadav.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +putenv.o: putenv.c rcs.h config.h +help.o: help.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +termcap.o: termcap.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +input.o: input.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +attacher.o: attacher.c rcs.h config.h screen.h os.h osdef.h ansi.h \ + acls.h comm.h layer.h term.h image.h display.h window.h extern.h +pty.o: pty.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h comm.h \ + layer.h term.h image.h display.h window.h extern.h +process.o: process.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h logfile.h +display.o: display.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h braille.h +comm.o: comm.c rcs.h config.h acls.h comm.h kmapdef.o: kmapdef.c config.h -acls.o: acls.c acls.h ansi.h comm.h config.h display.h extern.h image.h os.h osdef.h overlay.h rcs.h screen.h term.h window.h +acls.o: acls.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h comm.h \ + layer.h term.h image.h display.h window.h extern.h +braille.o: braille.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h braille.h +braille_tsi.o: braille_tsi.c config.h screen.h os.h osdef.h ansi.h \ + acls.h comm.h layer.h term.h image.h display.h window.h extern.h \ + braille.h +logfile.o: logfile.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h logfile.h +layer.o: layer.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +sched.o: sched.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h logfile.h +teln.o: teln.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h +nethack.o: nethack.c rcs.h config.h screen.h os.h osdef.h ansi.h acls.h \ + comm.h layer.h term.h image.h display.h window.h extern.h diff --git a/src/NEWS b/src/NEWS index 5c17605..8d497a5 100644 --- a/src/NEWS +++ b/src/NEWS @@ -1,82 +1,101 @@ -[ See patchlevel.h for the differences between every patchlevel ] - ---------------------------- - What's new in screen-3.7 ? + What's new in screen-3.9 ? ---------------------------- -* Color support. Screen understands the following capabilities: - AF (setaf) = Set foreground color (ANSI compatible) - AB (setab) = Set background color (ANSI compatible) - AX = Does understand ANSI set default fg/bg color - (\E[39m / \E[49m) - The tweaks for the color xterm would be: - termcap xterm 'AF=\E[3%dm:AB=\E[4%dm' - terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm' - Caution: Screen exposes a bug in X11R6 color xterm. Either use the - patch ftp.uni-erlangen.de:pub/utilities/screen/color_xterm_patch - or a clean rewrite of xterm: rxvt. +* real multiuser support + A window can now be displayed on more than one attached displays. + Screen does all the necessary clipping if the window size doesn't + fit the display. + New command: + ^AF - fit the window size into the display size. + +* split screen support + A display may now host multiple windows. + New commands: + ^AS - split horizontally. This add another region to the display + ^A - move the focus to the next region + ^AX - kill the current region + ^AQ - kill all other regions + +* hardstatus emulation support + The last line of the display may now be used as a hardstatus + line if the terminal doesn't have the 'hs' capability. + New commands: + hardstatus [always]lastline + hardstatus [always]message + hardstatus [always]ignore -* Resize code completely rewritten. Long lines now get rewrapped, - no information gets lost when a window is narrowed and widened. This - affects both the visible window and its scrollback buffer. It is a - big improvement for the latter. In previous versions the scrollback - buffer was clipped when the window narrowed and padded with - whitespace when it widened. +* configurable window seperator and hardstatus strings + The window (region) seperator and the hardstatus can be set to an + arbitrary string containing screen's % escape sequences. + The window's hardstatus is just another escape sequence, '%h'. + New commands: + hardstatus string [string] + caption string [string] + The default strings are "%h" (hardstatus) and "%3n %t" (caption). -* Input handling changed. The command key can now be a prefix - of a function key sequence (hello wyse users :) ) +* permanent window seperator + The window seperator can be set to stay on screen even if + the display contains only one region + New commands: + caption always + caption splitonly -* An empty argument to the escape command is allowed to disable - command key processing. This is only allowed if some key - is bound to the "command" command. This example makes F1 the - new command key and allows the previous command key (usually ^A) - to be typed directly: - bindkey -k k1 command - escape "" +* many new escapes + %c - current time HH:MM (*CHANGE*: this was %w in screen-3.7) + %C - current time HH:MM in 24h format + %l - the load of the system + %h - hardstatus of the window + %w - all window names + %W - all window names except the current window + %u - all other users on this window + %? - the part to the next %? is displayed only if an escape + expands to an nonempty string. + %: - "else" part of %? + Some escapes like %c may be qualified with a '0' (like %0c) + to make screen use '0' instead of space as a filler. + Others understand a length qualifier, like %3n. + If escapes like the current time are used as hardstatus/caption + string screen will update them so that you can always have + the current time onscreen. -* New 'digraph' command (bound to ^A^V) - ^A^Va" or ^A^V0344 input an a-umlaut - This helps if you want to work in an ISO-latin1 environment but your - terminal's keyboard lacks a some of the more special characters. +* logfile timestamps and flush timeout + New commands: + logfile flush + logtstamp [on|off] + logtstamp string [string] + logtstamp after [secs] -* activity/bell message strings can now include the window title - and the current date/time: - %t - title - %n - number (a single % still works) - %d - day - %D - weekday name - %m - month - %M - month name - %y - year (2 digit) - %Y - year (4 digit) - %w - hour:minutes (24h format) - %W - hour:minutes (12h format) - %s - seconds - %a - am/pm - %A - AM/PM - Please do not use a single '%' character for window titles any more. - It is obsoleted by '%n' and will vanish in future releases. +* configurable breaktype + You can now choose one of TIOCSBRK, TCSBRK, tcsendbreak. + New commands: + breaktype + defbreaktype -* 'defhstatus' command to give every window a default - hardstatus line. '^E' is used as a string escape instead of '%'. - All the above substitution codes apply, but you must use ^E (octal - 005) here, as '%' is likely to appear in automaticaly generated - hardstatus lines. Try 'defhstatus "Screen: window ^E (^Et)"'. +* other new commands: + hstatus - set the window's hardstatus + defslowpaste + defsilence -* In screenrc files and colon command mode: Input parser changed to - also understand caret notation ('^') to mean "Control-" (as in - the ^E example above). +* optional builtin telnet. + This is useful if screen is used as frontend to a terminal + multiplexor. Use //telnet to access the builtin telnet program, + as in: 'screen //telnet host [port]' -* "logdir" command changed to "logfile". You can now specify the - filename instead of the directory. The same directives as - understood by the activity/bell messages can be used. - The default is "screenlog.%n". +* remote detach and reattach change: + '-d' is now ignored if the screen is already detached and you + want to reattach. You can also use '-RR' to make screen use + the first session found if more than one session is available. + Thus '-d -RR' or '-x -RR' always gets you a screen. -* Special terminfo workaround make delay processing work for - the first time! If you had trouble with padding, then try again. +* support for history compaction + You can tell screen to suppress trailing blank lines when + scolling up text into the history buffer. (Wayne Davison) + New command: + compacthist -* New incomprehensible capability XC added to specify character - translation depending on the terminal type. See the manual for - more details and examples. +* optional Braille support. If you can read Braille and have one of + the devices listed in README.DOTSCREEN, please compile with + -DHAVE_BRAILLE and let us know if this feature is useful. diff --git a/src/NEWS.3.7 b/src/NEWS.3.7 new file mode 100644 index 0000000..e398f95 --- /dev/null +++ b/src/NEWS.3.7 @@ -0,0 +1,39 @@ + + + ---------------------------- + What's new in screen-3.7 ? + ---------------------------- + +* Color support. Screen understands the following capabilities: + AF (setaf) = Set foreground color (ANSI compatible) + AB (setab) = Set background color (ANSI compatible) + AX = Does understand ANSI set default fg/bg color + (\E[39m / \E[49m) + The tweaks for the color xterm would be: + termcap xterm 'AF=\E[3%dm:AB=\E[4%dm' + terminfo xterm 'AF=\E[3%p1%dm:AB=\E[4%p1%dm' + +* New 'digraph' command (bound to ^A^V) + ^A^Va" or ^A^V0344 input an a-umlaut + +* activity/bell message strings can now include the window title: + %t - title + %n - number (a single % still works) + +* 'defhstatus' command to give everey window a default + hardstatus line. ^E is used as a string escape instead of % + (see above). Try 'defhstatus "Screen: window ^E (^Et)"' + +* Input parser changed to understand '^' (see ^E above). + +Note that the linux color xterm has a stupid bug: the characters +get the color of the cursor, therefore if you change color and move +the cursor around all the characters will get the new color... +Here is a patch: + pub/utilities/screen/color_xterm_patch +Btw.: rxvt works fine. + +* Optional Braille support. If you can read Braille and have one of + the devices listed in README.DOTSCREEN, please compile with + -DHAVE_BRAILLE and let us know if this feature is useful. + diff --git a/src/README b/src/README index 362674f..217573e 100644 --- a/src/README +++ b/src/README @@ -1,16 +1,16 @@ [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] + [A full description of all features is contained in the source package] -Short introduction to screen (Version 3.6.0) lvirden 8-8-93 - [note that this intro only describes the most common screen features] +Short introduction to screen (Version 3.6.0) lvirden 8-8-93 Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to screen@uni-erlangen.de -iscreen provides you with an ANSI/vt100 terminal emulator, which can multiplex +Screen provides you with an ANSI/vt100 terminal emulator, which can multiplex up to 10 pseudo-terminals. On startup, it executes $SHELL in window 0. Then it reads $HOME/.screenrc to learn configuration, keybindings, and possibly open more windows. diff --git a/src/TODO b/src/TODO new file mode 100644 index 0000000..2493216 --- /dev/null +++ b/src/TODO @@ -0,0 +1,8 @@ +- display size adaption (Activate) +- better kanji +- message protocol (send screen command) +- esc-sequence for screen commands +- process.c cleanup via comm splitting +- writelocks? +- partial? +- nonblock? diff --git a/src/acls.c b/src/acls.c index 5f476ce..c42065a 100644 --- a/src/acls.c +++ b/src/acls.c @@ -26,6 +26,24 @@ RCS_ID("$Id$ FAU") #include #include "config.h" + + +/* XXX: WHY IS THIS HERE?? :XXX */ + +#ifdef CHECKLOGIN +# ifdef _SEQUENT_ +# include /* needed by */ +# endif /* _SEQUENT_ */ +# include +# ifdef SHADOWPW +# include +# endif /* SHADOWPW */ +#endif /* CHECKLOGIN */ + +#ifndef NOSYSLOG +# include +#endif + #include "screen.h" /* includes acls.h */ #include "extern.h" @@ -37,6 +55,7 @@ RCS_ID("$Id$ FAU") extern struct comm comms[]; extern struct win *windows, *wtab[]; extern char NullStr[]; +extern char SockPath[]; extern struct display *display, *displays; struct user *users; @@ -52,9 +71,9 @@ static AclBits userbits; */ static char default_w_bit[ACL_BITS_PER_WIN] = { - 0, /* EXEC */ - 0, /* WRITE */ - 0 /* READ */ + 1, /* EXEC */ + 1, /* WRITE */ + 1 /* READ */ }; static char default_c_bit[ACL_BITS_PER_CMD] = @@ -70,6 +89,7 @@ static char default_c_bit[ACL_BITS_PER_CMD] = */ static int GrowBitfield __P((AclBits *, int, int, int)); +static struct usergroup **FindGroupPtr __P((struct usergroup **, struct user *, int)); static int AclSetPermCmd __P((struct user *, char *, struct comm *)); static int AclSetPermWin __P((struct user *, struct user *, char *, struct win *)); static int UserAcl __P((struct user *, struct user **, int, char **)); @@ -163,6 +183,8 @@ struct user **up; (*up)->u_password = SaveStr(pass); if (!(*up)->u_password) (*up)->u_password = NullStr; + (*up)->u_detachwin = -1; + (*up)->u_detachotherwin = -1; #ifdef MULTIUSER (*up)->u_group = NULL; @@ -278,6 +300,25 @@ struct user **up; return 0; } +#if 0 +/* change user's password */ +int +UserSetPass(name, pass, up) +char *name, *pass; +struct user **up; +{ + if (!up) + up = FindUserPtr(name); + if (!*up) + return UserAdd(name, pass, up); + if (!strcmp(name, "nobody")) /* he remains without password */ + return -1; + strncpy((*up)->u_password, pass ? pass : "", 20); + (*up)->u_password[20] = '\0'; + return 0; +} +#endif + /* * Remove a user from the list. * Destroy all his permissions and completely detach him from the session. @@ -363,20 +404,16 @@ UserFreeCopyBuffer(u) struct user *u; { struct win *w; + struct paster *pa; if (!u->u_copybuffer) return 1; for (w = windows; w; w = w->w_next) { - if (w->w_pasteptr >= u->u_copybuffer && - w->w_pasteptr - u->u_copybuffer < u->u_copylen) - { - if (w->w_pastebuf) - free((char *)w->w_pastebuf); - w->w_pastebuf = 0; - w->w_pasteptr = 0; - w->w_pastelen = 0; - } + pa = &w->w_paster; + if (pa->pa_pasteptr >= u->u_copybuffer && + pa->pa_pasteptr - u->u_copybuffer < u->u_copylen) + FreePaster(pa); } free((char *)u->u_copybuffer); u->u_copylen = 0; @@ -385,6 +422,171 @@ struct user *u; } #endif /* COPY_PASTE */ +#ifdef MULTIUSER +/* + * Traverses group nodes. It searches for a node that references user u. + * If recursive is true, nodes found in the users are also searched using + * depth first method. If none of the nodes references u, the address of + * the last next pointer is returned. This address will contain NULL. + */ +static struct usergroup ** +FindGroupPtr(gp, u, recursive) +struct usergroup **gp; +struct user *u; +int recursive; +{ + struct usergroup **g; + + ASSERT(recursive < 1000); /* Ouch, cycle detection failed */ + while (*gp) + { + if ((*gp)->u == u) + return gp; /* found him here. */ + if (recursive && + *(g = FindGroupPtr(&(*gp)->u->u_group, u, recursive + 1))) + return g; /* found him there. */ + gp = &(*gp)->next; + } + return gp; /* *gp is NULL */ +} + +/* + * Returns nonzero if failed or already linked. + * Both users are created on demand. + * Cyclic links are prevented. + */ +int +AclLinkUser(from, to) +char *from, *to; +{ + struct user **u1, **u2; + struct usergroup **g; + + if (!*(u1 = FindUserPtr(from)) && UserAdd(from, NULL, u1)) + return -1; + if (!*(u2 = FindUserPtr(to)) && UserAdd(to, NULL, u2)) + return -1; /* hmm, could not find both users. */ + + if (*FindGroupPtr(&(*u2)->u_group, *u1, 1)) + return 1; /* cyclic link detected! */ + if (*(g = FindGroupPtr(&(*u1)->u_group, *u2, 0))) + return 2; /* aha, we are already linked! */ + + if (!(*g = (struct usergroup *)malloc(sizeof(struct usergroup)))) + return -1; /* Could not alloc link. Poor screen */ + (*g)->u = (*u2); + (*g)->next = NULL; + return 0; +} + +/* + * The user pointer stored at *up will be substituted by a pointer + * to the named user's structure, if passwords match. + * returns NULL if successfull, an static error string otherwise + */ +char * +DoSu(up, name, pw1, pw2) +struct user **up; +char *name, *pw1, *pw2; +{ + struct user *u; + int sorry = 0; + + if (!(u = *FindUserPtr(name))) + sorry++; + else + { +#ifdef CHECKLOGIN + struct passwd *pp; +#ifdef SHADOWPW + struct spwd *ss; + int t, c; +#endif + char *pass = ""; + + if (!(pp = getpwnam(name))) + { + debug1("getpwnam(\"%s\") failed\n", name); + if (!(pw1 && *pw1 && *pw1 != '\377')) + { + debug("no unix account, no screen passwd\n"); + sorry++; + } + } + else + pass = pp->pw_passwd; +#ifdef SHADOWPW + for (t = 0; t < 13; t++) + { + c = pass[t]; + if (!(c == '.' || c == '/' || + (c >= '0' && c <= '9') || + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z'))) + break; + } + if (t < 13) + { + if (!(ss = getspnam(name))) + { + debug1("getspnam(\"%s\") failed\n", name); + sorry++; + } + else + pass = ss->sp_pwdp; + } +#endif /* SHADOWPW */ + + if (pw2 && *pw2 && *pw2 != '\377') /* provided a system password */ + { + if (!*pass || /* but needed none */ + strcmp(crypt(pw2, pass), pass)) + { + debug("System password mismatch\n"); + sorry++; + } + } + else /* no pasword provided */ + if (*pass) /* but need one */ + sorry++; +#endif + if (pw1 && *pw1 && *pw1 != '\377') /* provided a screen password */ + { + if (!*u->u_password || /* but needed none */ + strcmp(crypt(pw1, u->u_password), u->u_password)) + { + debug("screen password mismatch\n"); + sorry++; + } + } + else /* no pasword provided */ + if (*u->u_password) /* but need one */ + sorry++; + } + + debug2("syslog(LOG_NOTICE, \"screen %s: \"su %s\" ", SockPath, name); + debug2("%s for \"%s\"\n", sorry ? "failed" : "succeded", (*up)->u_name); +#ifndef NOSYSLOG +# ifdef BSD_42 + openlog("screen", LOG_PID); +# else + openlog("screen", LOG_PID, LOG_AUTH); +# endif /* BSD_42 */ + syslog(LOG_NOTICE, "%s: \"su %s\" %s for \"%s\"", SockPath, name, + sorry ? "failed" : "succeded", (*up)->u_name); + closelog(); +#else + debug("NOT LOGGED.\n"); +#endif /* NOSYSLOG */ + + if (sorry) + return "Sorry."; + else + *up = u; /* substitute user now */ + return NULL; +} +#endif /* MULTIUSER */ + /************************************************************************ * end of user managing code * ************************************************************************/ @@ -611,7 +813,7 @@ char *mode, *s; AclSetPermWin(uu, u, mode, (struct win *)1); else /* .. or all windows */ for (w = windows; w; w = w->w_next) - AclSetPermWin(NULL, u, mode, w); + AclSetPermWin((struct user *)0, u, mode, w); s++; break; case '?': @@ -630,7 +832,7 @@ char *mode, *s; if ((i = FindCommnr(s)) != RC_ILLEGAL) AclSetPermCmd(u, mode, &comms[i]); else if (((i = WindowByNoN(s)) >= 0) && wtab[i]) - AclSetPermWin(NULL, u, mode, wtab[i]); + AclSetPermWin((struct user *)0, u, mode, wtab[i]); else /* checking group name */ return -1; @@ -792,44 +994,65 @@ char **argv; return 0; } -#if 0 -void -AclWinSwap(a, b) -int a, b; +/* + * Preprocess argments, so that umask can be set with UsersAcl + * + * all current users umask ±rwxn + * one specific user umask user1±rwxn + * several users umask user1,user2,...±rwxn + * default_w_bits umask ?±rwxn + * default_c_bits umask ??±rwxn + */ +int +AclUmask(u, str, errp) +struct user *u; +char *str; +char **errp; { - int a_bit = 0, b_bit = 0; - AclGroupList **g; - AclBits p; + char mode[16]; + char *av[3]; + char *p, c = '\0'; - debug2("acl lists swapping windows %d and %d\n", a, b); - - for (g = &aclgrouproot; *g; g = &(*g)->next) + /* split str into user and bits section. */ + for (p = str; *p; p++) + if ((c = *p) == '+' || c == '-') + break; + if (!*p) { - p = (*g)->group->winbits; - /* see if there was a bit for window a. zap it */ - if (a >= 0) - if ((a_bit = ACLBIT(a) & ACLBYTE(p, a))) - ACLBYTE(p, a) &= ~ACLBIT(a); - /* see if there was a bit for window b. zap it */ - if (b >= 0) - if ((b_bit = ACLBIT(b) & ACLBYTE(p, b))) - ACLBYTE(p, b) &= ~ACLBIT(b); - /* b may cause a set */ - if (b_bit && a >= 0) - ACLBYTE(p, a) |= ACLBIT(a); - /* a may cause b set */ - if (a_bit && b >= 0) - ACLBYTE(p, b) |= ACLBIT(b); + *errp = "Bad argument. Should be ``[user[,user...]{+|-}rwxn''."; + return -1; + } + strncpy(mode, p, 15); + mode[15] = '\0'; + *p = '\0'; + + /* construct argument vector */ + if (!strcmp("??", str)) + { + str++; + av[2] = "?"; + } + else + av[2] = "#"; + av[1] = mode; + av[0] = *str ? str : "*"; + /* call UsersAcl */ + if (UsersAcl(u, 3, av)) + { + *errp = "UsersAcl failed. Hmmm."; + *p = c; + return -1; } + *p = c; + return 0; } -#else + void AclWinSwap(a, b) int a, b; { - debug2("AclWinSwap(%d, %d) DUMMY\n", a, b); + debug2("AclWinSwap(%d, %d) NOP.\n", a, b); } -#endif struct user *EffectiveAclUser = NULL; /* hook for AT command permission */ diff --git a/src/acls.h b/src/acls.h index c6a4ea7..756ca74 100644 --- a/src/acls.h +++ b/src/acls.h @@ -39,25 +39,6 @@ typedef unsigned char * AclBits; -/* a bitfield for windows and one for commands */ -typedef struct -{ - char name[20 + 1]; - AclBits wins, cmds; -} AclGroup; - -/* - * An AclGroupList is a chaind list of pointers to AclGroups. - * Each user has such a list to reference groups he is in. - * The aclgrouproot anchors all AclGroups. Delete and create - * groups there. - */ -typedef struct grouplist -{ - AclGroup *group; - struct grouplist *next; -} AclGroupList; - /* * How a user joins a group. * Here is the node to construct one list per user. diff --git a/src/ansi.c b/src/ansi.c index b965105..2bc0dec 100644 --- a/src/ansi.c +++ b/src/ansi.c @@ -25,7 +25,6 @@ RCS_ID("$Id$ FAU") #include -#include #include #ifndef sun /* we want to know about TIOCPKT. */ # include @@ -33,27 +32,30 @@ RCS_ID("$Id$ FAU") #include "config.h" #include "screen.h" +#include "braille.h" #include "extern.h" +#include "logfile.h" -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_destroy, ZombieKey_resurrect; -extern int real_uid, real_gid; -extern time_t Now; extern struct NewWindow nwin_default; /* for ResetWindow() */ -extern int nversion; +extern int nversion; /* numerical version of screen */ +extern int log_flush, logtstamp_on, logtstamp_after; +extern char *logtstamp_string; +extern char *captionstring; +extern char *hstatusstring; +#ifdef COPY_PASTE +extern int compacthist; +#endif int Z0width, Z1width; /* widths for Z0/Z1 switching */ +/* globals set in WriteString */ static struct win *curr; /* window we are working on */ static int rows, cols; /* window size of the curr window */ int visual_bell = 0; -int use_hardstatus = 1; +int use_hardstatus = 1; /* display status line in hs */ char *printcmd = 0; char *blank; /* line filled with spaces */ @@ -67,25 +69,48 @@ struct mchar mchar_null; struct mchar mchar_blank = {' ' /* , 0, 0, ... */}; struct mchar mchar_so = {' ', A_SO /* , 0, 0, ... */}; -static void WinProcess __P((char **, int *)); -static void WinRedisplayLine __P((int, int, int, int)); -static void WinClearLine __P((int, int, int)); -static int WinRewrite __P((int, int, int, int)); -static void WinSetCursor __P((void)); -static int WinResize __P((int, int)); -static void WinRestore __P((void)); +/* keep string_t and string_t_string in sync! */ +static char *string_t_string[] = +{ + "NONE", + "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 */ + "STATUS" /* User hardstatus line */ +}; + +/* keep state_t and state_t_string in sync! */ +static char *state_t_string[] = +{ + "LIT", /* Literal input */ + "ESC", /* Start of escape sequence */ + "ASTR", /* Start of control string */ + "STRESC", /* ESC seen in control string */ + "CSI", /* Reading arguments in "CSI Pn ;...*/ + "PRIN", /* Printer mode */ + "PRINESC", /* ESC seen in printer mode */ + "PRINCSI", /* CSI seen in printer mode */ + "PRIN4" /* CSI 4 seen in printer mode */ +}; + static int Special __P((int)); static void DoESC __P((int, int)); static void DoCSI __P((int, int)); -static void SetChar __P((int)); -static void StartString __P((enum string_t)); -static void SaveChar __P((int)); +static void StringStart __P((enum string_t)); +static void StringChar __P((int)); +static int StringEnd __P((void)); static void PrintStart __P((void)); static void PrintChar __P((int)); static void PrintFlush __P((void)); +#ifdef FONT static void DesignateCharset __P((int, int)); static void MapCharset __P((int)); static void MapCharsetR __P((int)); +#endif static void SaveCursor __P((void)); static void RestoreCursor __P((void)); static void BackSpace __P((void)); @@ -97,18 +122,13 @@ static void InsertChar __P((int)); static void DeleteChar __P((int)); static void DeleteLine __P((int)); static void InsertLine __P((int)); -static void ScrollUpMap __P((int)); -static void ScrollDownMap __P((int)); static void Scroll __P((char *, int, int, char *)); static void ForwardTab __P((void)); static void BackwardTab __P((void)); static void ClearScreen __P((void)); static void ClearFromBOS __P((void)); static void ClearToEOS __P((void)); -static void ClearFullLine __P((void)); -static void ClearToEOL __P((void)); -static void ClearFromBOL __P((void)); -static void ClearInLine __P((int, int, int)); +static void ClearLineRegion __P((int, int)); static void CursorRight __P((int)); static void CursorUp __P((int)); static void CursorDown __P((int)); @@ -117,277 +137,28 @@ static void ASetMode __P((int)); static void SelectRendition __P((void)); static void RestorePosRendition __P((void)); static void FillWithEs __P((void)); -static void UpdateLine __P((struct mline *, 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)); -static void CheckLP __P((int)); -#ifdef COPY_PASTE static void AddLineToHist __P((struct win *, struct mline *)); -#endif - - -/* - * The window layer functions - */ - -struct LayFuncs WinLf = -{ - WinProcess, - 0, - WinRedisplayLine, - WinClearLine, - WinRewrite, - WinSetCursor, - WinResize, - WinRestore -}; - -static void -WinProcess(bufpp, lenp) -char **bufpp; -int *lenp; -{ - int addlf, l2 = 0, f, *ilen, l = *lenp; - char *ibuf, *p, *buf = *bufpp; - - fore = D_fore; - /* if w_wlock is set, only one user may write, else we check acls */ - if (fore->w_ptyfd < 0) - { - while ((*lenp)-- > 0) - { - 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)) - { - SetCurr(fore); - Special('\007'); - *bufpp += *lenp; - *lenp = 0; - return; - } -#endif /* MULTIUSER */ -#ifdef PSEUDOS - if (W_UWP(fore)) - { - /* we send the user input to our pseudowin */ - ibuf = fore->w_pwin->p_inbuf; ilen = &fore->w_pwin->p_inlen; - f = sizeof(fore->w_pwin->p_inbuf) - *ilen; - } - else -#endif /* PSEUDOS */ - { - /* we send the user input to the window */ - ibuf = fore->w_inbuf; ilen = &fore->w_inlen; - f = sizeof(fore->w_inbuf) - *ilen; - } - - buf = *bufpp; - - while (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; -} - -static void -WinRedisplayLine(y, from, to, isblank) -int y, from, to, isblank; -{ - if (y < 0) - return; - fore = D_fore; - DisplayLine(isblank ? &mline_blank : &mline_null, &fore->w_mlines[y], - y, from, to); -} - -static int -WinRewrite(y, x1, x2, doit) -int y, x1, x2, doit; -{ - register int cost, dx; - register char *p, *f, *i; -#ifdef COLOR - register char *c; -#endif - - fore = D_fore; - if (y >= fore->w_height || x2 > fore->w_width) - return EXPENSIVE; - dx = x2 - x1; - if (doit) - { - i = fore->w_mlines[y].image + x1; - while (dx-- > 0) - PUTCHAR(*i++); - return 0; - } - p = fore->w_mlines[y].attr + x1; - f = fore->w_mlines[y].font + x1; -#ifdef COLOR - c = fore->w_mlines[y].color + x1; -#endif -#ifdef KANJI - if (D_rend.font == KANJI) - return EXPENSIVE; -#endif - - cost = dx = x2 - x1; - if (D_insert) - cost += D_EIcost + D_IMcost; - while(dx-- > 0) - { -#ifdef COLOR - if (*p++ != D_rend.attr || *f++ != D_rend.font || *c++ != D_rend.color) - return EXPENSIVE; -#else - if (*p++ != D_rend.attr || *f++ != D_rend.font) - return EXPENSIVE; -#endif - } - return cost; -} - -static void -WinClearLine(y, xs, xe) -int y, xs, xe; -{ - fore = D_fore; - DisplayLine(&fore->w_mlines[y], &mline_blank, y, xs, xe); -} - -static void -WinSetCursor() -{ - fore = D_fore; - GotoPos(fore->w_x, fore->w_y); -} +static void LogString __P((struct win *, char *, int)); +static void WReverseVideo __P((struct win *, int)); +static void MFixLine __P((struct win *, int, struct mchar *)); +static void MScrollH __P((struct win *, int, int, int, int)); +static void MScrollV __P((struct win *, int, int, int)); +static void MClear __P((struct win *, int, int, int, int)); +static void MInsChar __P((struct win *, struct mchar *, int, int)); +static void MPutChar __P((struct win *, struct mchar *, int, int)); +static void MWrapChar __P((struct win *, struct mchar *, int, int, int, int)); +static int WindowChangedCheck __P((char *, int, int *)); -static int -WinResize(wi, he) -int wi, he; -{ - fore = D_fore; - if (fore) - ChangeWindowSize(fore, wi, he, fore->w_histheight); - return 0; -} -static void -WinRestore() -{ - 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); - CursorVisibility(fore->w_curinv ? -1 : fore->w_curvvis); - fore->w_active = 1; -} - -/* - * Activate - make fore window active - * norefresh = -1 forces a refresh, disregard all_norefresh then. - */ void -Activate(norefresh) -int norefresh; +ResetAnsiState(p) +struct win *p; { - debug1("Activate(%d)\n", norefresh); - if (display == 0) - return; - if (D_status) - { - Msg(0, "%s", ""); /* wait till mintime (keep gcc quiet) */ - RemoveStatus(); - } - fore = D_fore; - if (fore) - { - ASSERT(fore->w_display == display); - 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(" to (%d,%d) -> resize window\n", fore->w_width, fore->w_height); - DoResize(D_width, D_height); - } - } - Redisplay(norefresh + all_norefresh); + p->w_state = LIT; + p->w_StringType = NONE; } void @@ -415,16 +186,47 @@ register struct win *p; for (i = 8; i < p->w_width; i += 8) p->w_tabs[i] = 1; p->w_rend = mchar_null; +#ifdef FONT ResetCharsets(p); +#endif } -#ifdef KANJI +/* adds max 22 bytes */ +int +GetAnsiStatus(w, buf) +struct win *w; +char *buf; +{ + char *p = buf; + + if (w->w_state == LIT) + return 0; + + strcpy(p, state_t_string[w->w_state]); + p += strlen(p); + if (w->w_intermediate) + { + *p++ = '-'; + if (w->w_intermediate > 0xff) + p += AddXChar(p, w->w_intermediate >> 8); + p += AddXChar(p, w->w_intermediate & 0xff); + } + if (w->w_state == ASTR || w->w_state == STRESC) + sprintf(p, "-%s", string_t_string[w->w_StringType]); + p += strlen(p); + return p - buf; +} + + +#ifdef FONT + +# ifdef KANJI static char *kanjicharsets[3] = { "BBBB02", /* jis */ "B\002IB01", /* euc */ "BIBB01" /* sjis */ }; -#endif +# endif void ResetCharsets(p) @@ -464,50 +266,22 @@ char *s; p->w_FontL = p->w_charsets[p->w_Charset]; p->w_FontR = p->w_charsets[p->w_CharsetR]; } - -static void -FixLine() -{ - struct mline *ml = &curr->w_mlines[curr->w_y]; - if (curr->w_rend.attr && ml->attr == null) - { - if ((ml->attr = (char *)malloc(curr->w_width + 1)) == 0) - { - ml->attr = null; - curr->w_rend.attr = 0; - Msg(0, "Warning: no space for attr - turned off"); - } - bzero(ml->attr, curr->w_width + 1); - } - if ((curr->w_FontL || curr->w_FontR) && ml->font == null) - { - if ((ml->font = (char *)malloc(curr->w_width + 1)) == 0) - { - ml->font = null; - curr->w_FontL = 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; - curr->w_rend.font = 0; - Msg(0, "Warning: no space for font - turned off"); - } - bzero(ml->font, curr->w_width + 1); - } -#ifdef COLOR - if (curr->w_rend.color && ml->color == null) - { - if ((ml->color = (char *)malloc(curr->w_width + 1)) == 0) - { - ml->color = null; - curr->w_rend.color = 0; - Msg(0, "Warning: no space for color - turned off"); - } - bzero(ml->color, curr->w_width + 1); - } #endif -} + +/*****************************************************************/ /* * Here comes the vt100 emulator + * - writes logfiles, + * - sets timestamp and flags activity in window. + * - record program output in window scrollback + * - translate program output for the display and put it into the obuf. + * + * Output is only supressed, where obuf is beyond maximum and the flag + * nonblock is set. Then we set nonblock from 1 to 2 and output a '~' + * character instead. nonblock should be reset to 1 by a successfull + * write. Where nonblock isn't set, the obufmax is ignored. */ void WriteString(wp, buf, len) @@ -515,42 +289,52 @@ struct win *wp; register char *buf; register int len; { - register int c, font; + register int c; +#ifdef FONT + register int font; +#endif + struct canvas *cv; if (!len) return; - if (wp->w_logfp != NULL) - if ((int)fwrite(buf, len, 1, wp->w_logfp) < 1) - { - Msg(errno, "Error writing logfile"); - fclose(wp->w_logfp); - wp->w_logfp = NULL; - } - /* - * SetCurr() here may prevent output, as it may set display = 0 - */ - SetCurr(wp); - if (display) + if (wp->w_log) + LogString(wp, buf, len); + + /* set global variables (yuck!) */ + curr = wp; + cols = curr->w_width; + rows = curr->w_height; + + /* The status should be already gone, so this is "Just in Case" */ + for (cv = wp->w_layer.l_cvlist; cv; cv = cv->c_lnext) { - if (D_status && !(use_hardstatus && D_HS)) + display = cv->c_display; + if (D_status == STATUS_ON_WIN) RemoveStatus(); - } - else - { - if (curr->w_tstamp.seconds) - curr->w_tstamp.lastio = Now; - - if (curr->w_monitor == MON_ON || curr->w_monitor == MON_DONE) + if (D_nonblock == 1 && (D_obufp - D_obuf > D_obufmax)) { - debug2("ACTIVITY %d %d\n", curr->w_monitor, curr->w_bell); - curr->w_monitor = MON_FOUND; + /* one last surprising '~' means: lost data */ + AddChar('~'); + /* private flag that prevents more output */ + D_nonblock = 2; } } + if (curr->w_silence) + SetTimeout(&curr->w_silenceev, curr->w_silencewait * 1000); + + if (curr->w_monitor == MON_ON) + { + debug2("ACTIVITY %d %d\n", curr->w_monitor, curr->w_bell); + curr->w_monitor = MON_FOUND; + } + do { c = (unsigned char)*buf++; +#ifdef FONT curr->w_rend.font = curr->w_FontL; /* Default: GL */ +#endif /* The next part is only for speedup * (therefore no mchars are used) */ @@ -559,65 +343,40 @@ register int len; curr->w_FontL != KANJI && curr->w_FontL != KANA && !curr->w_mbcs && #endif c >= ' ' && - ((c & 0x80) == 0 || ((c >= 0xa0 || !curr->w_c1) && !curr->w_gr)) && - !curr->w_insert && !curr->w_ss && curr->w_x < cols - 1) + ((c & 0x80) == 0 || ((c >= 0xa0 || !curr->w_c1) && !curr->w_gr)) && !curr->w_ss && + !curr->w_insert && curr->w_x < cols - 1) { register int currx; - register char *imp, *atp, *fop, at, fo; + register char *imp, *atp, at; +#ifdef FONT + register char *fop, fo; +#endif #ifdef COLOR register char *cop, co; #endif - register char **xtable = 0; - register char *c0tab = 0; if (c == '\177') continue; - FixLine(); + MFixLine(curr, curr->w_y, &curr->w_rend); currx = curr->w_x; imp = curr->w_mlines[curr->w_y].image + currx; atp = curr->w_mlines[curr->w_y].attr + currx; - fop = curr->w_mlines[curr->w_y].font + currx; at = curr->w_rend.attr; +#ifdef FONT + fop = curr->w_mlines[curr->w_y].font + currx; fo = curr->w_rend.font; +#endif #ifdef COLOR cop = curr->w_mlines[curr->w_y].color + currx; co = curr->w_rend.color; #endif - if (display) - { - if (D_x != currx || D_y != curr->w_y) - GotoPos(currx, curr->w_y); - /* This is not SetRendition because the compiler would - * not use registers if at/fo/co would be an mchar */ - if (at != D_rend.attr) - SetAttr(at); -#ifdef COLOR - if (co != D_rend.color) - SetColor(co); -#endif - if (fo != D_rend.font) - SetFont(fo); - if (D_insert) - InsertMode(0); - if (D_xtable) - xtable = D_xtable[(int)(unsigned char)D_rend.font]; - if (D_rend.font == '0') - c0tab = D_c0_tab; - } while (currx < cols - 1) { - if (display) - { - if (xtable && xtable[c]) - AddStr(xtable[c]); - else if (c0tab) - AddChar(c0tab[c]); - else - AddChar(c); - } *imp++ = c; *atp++ = at; +#ifdef FONT *fop++ = fo; +#endif #ifdef COLOR *cop++ = co; #endif @@ -630,9 +389,12 @@ skip: if (--len == 0) if (c < ' ' || ((c & 0x80) && ((c < 0xa0 && curr->w_c1) || curr->w_gr))) break; } - curr->w_x = currx; - if (display) - D_x = currx; + currx -= curr->w_x; + if (currx > 0) + { + LPutStr(&curr->w_layer, imp - currx, currx, &curr->w_rend, curr->w_x, curr->w_y); + curr->w_x += currx; + } if (len == 0) break; } @@ -706,10 +468,11 @@ skip: if (--len == 0) break; } /* special xterm hack: accept SetStatus sequence. Yucc! */ + /* allow ^E for title escapes */ if (!(curr->w_StringType == OSC && c < ' ' && c != '\005')) if (!curr->w_c1 || c != ('\\' ^ 0xc0)) { - SaveChar(c); + StringChar(c); break; } c = '\\'; @@ -718,78 +481,31 @@ skip: if (--len == 0) switch (c) { case '\\': - curr->w_state = LIT; - *curr->w_stringp = '\0'; - switch (curr->w_StringType) + if (StringEnd() == 0 || len <= 1) + break; + /* check if somewhere a status is displayed */ + for (cv = curr->w_layer.l_cvlist; cv; cv = cv->c_lnext) { - 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) - if (display != old) - MakeStatus(curr->w_string); - display = old; - } - /*FALLTHROUGH*/ - case PM: - if (!display) - break; - MakeStatus(curr->w_string); - if (D_status && !(use_hardstatus && D_HS) && len > 1) - { - if (len > IOSIZE + 1) - len = IOSIZE + 1; - curr->w_outlen = len - 1; - bcopy(buf, curr->w_outbuf, curr->w_outlen - 1); - return; - } - break; - case DCS: - if (display) - AddStr(curr->w_string); - break; - case AKA: - if (curr->w_title == curr->w_akabuf && !*curr->w_string) + display = cv->c_display; + if (D_status == STATUS_ON_WIN) break; - ChangeAKA(curr, curr->w_string, 20); - if (!*curr->w_string) - curr->w_autoaka = curr->w_y + 1; - break; - default: - break; + } + if (cv) + { + if (len > IOSIZE + 1) + len = IOSIZE + 1; + curr->w_outlen = len - 1; + bcopy(buf, curr->w_outbuf, len - 1); + return; /* wait till status is gone */ } break; case '\033': - SaveChar('\033'); + StringChar('\033'); break; default: curr->w_state = ASTR; - SaveChar('\033'); - SaveChar(c); + StringChar('\033'); + StringChar(c); break; } break; @@ -803,23 +519,23 @@ skip: if (--len == 0) curr->w_state = CSI; break; case ']': - StartString(OSC); + StringStart(OSC); break; case '_': - StartString(APC); + StringStart(APC); break; case 'P': - StartString(DCS); + StringStart(DCS); break; case '^': - StartString(PM); + StringStart(PM); break; case '!': - StartString(GM); + StringStart(GM); break; case '"': case 'k': - StartString(AKA); + StringStart(AKA); break; default: if (Special(c)) @@ -831,12 +547,14 @@ skip: if (--len == 0) if (c >= ' ' && c <= '/') { if (curr->w_intermediate) + { #ifdef KANJI - if (curr->w_intermediate == '$') - c |= '$' << 8; - else + if (curr->w_intermediate == '$') + c |= '$' << 8; + else #endif - c = -1; + c = -1; + } curr->w_intermediate = c; } else if (c >= '0' && c <= '~') @@ -887,18 +605,12 @@ skip: if (--len == 0) break; case LIT: default: -#ifdef KANJI - if (c <= ' ' || c == 0x7f || (c >= 0x80 && c < 0xa0 && curr->w_c1)) - curr->w_mbcs = 0; -#endif if (c < ' ') { if (c == '\033') { curr->w_intermediate = 0; curr->w_state = ESC; - if (display && D_lp_missing && (D_CIC || D_IC || D_IM)) - UpdateLine(&mline_blank, D_bot, cols - 2, cols - 1); if (curr->w_autoaka < 0) curr->w_autoaka = 0; } @@ -914,13 +626,11 @@ skip: if (--len == 0) case 0xc0 ^ 'E': case 0xc0 ^ 'H': case 0xc0 ^ 'M': - case 0xc0 ^ 'N': - case 0xc0 ^ 'O': + case 0xc0 ^ 'N': /* SS2 */ + case 0xc0 ^ 'O': /* SS3 */ DoESC(c ^ 0xc0, 0); break; case 0xc0 ^ '[': - if (display && D_lp_missing && (D_CIC || D_IC || D_IM)) - UpdateLine(&mline_blank, D_bot, cols - 2, cols - 1); if (curr->w_autoaka < 0) curr->w_autoaka = 0; curr->w_NumArgs = 0; @@ -929,7 +639,7 @@ skip: if (--len == 0) curr->w_state = CSI; break; case 0xc0 ^ 'P': - StartString(DCS); + StringStart(DCS); break; default: break; @@ -937,8 +647,9 @@ skip: if (--len == 0) break; } +#ifdef FONT font = curr->w_rend.font = (c >= 0x80 ? curr->w_FontR : curr->w_FontL); -#ifdef KANJI +# ifdef KANJI if (font == KANA && curr->w_kanji == SJIS && curr->w_mbcs == 0) { /* Lets see if it is the first byte of a kanji */ @@ -950,8 +661,6 @@ skip: if (--len == 0) break; } } - if (font == KANJI && c == ' ') - font = curr->w_rend.font = 0; if (font == KANJI || curr->w_mbcs) { int t = c; @@ -999,112 +708,93 @@ skip: if (--len == 0) curr->w_mbcs = t; } kanjiloop: -#endif +# endif if (curr->w_gr) { c &= 0x7f; if (c < ' ') /* this is ugly but kanji support */ goto tryagain; /* prevents nicer programming */ } +#endif /* FONT */ if (c == '\177') break; - if (display) - SetRendition(&curr->w_rend); + curr->w_rend.image = c; if (curr->w_x < cols - 1) { if (curr->w_insert) InsertAChar(c); else { - if (display) - PUTCHAR(c); - SetChar(c); + MPutChar(curr, &curr->w_rend, curr->w_x, curr->w_y); + LPutChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y); curr->w_x++; } } else if (curr->w_x == cols - 1) { - if (display && curr->w_wrap && (D_CLP || !force_vt || D_COP)) - { - RAW_PUTCHAR(c); /* don't care about D_insert */ - SetChar(c); - curr->w_x++; - if (D_AM && !D_CLP) - { - SetChar(0); - LineFeed(0); /* terminal auto-wrapped */ - } - } - else - { - if (display) - { - if (D_CLP || curr->w_y != D_bot) - { - RAW_PUTCHAR(c); - GotoPos(curr->w_x, curr->w_y); - } - else - CheckLP(c); - } - SetChar(c); - if (curr->w_wrap) - curr->w_x++; - } + MPutChar(curr, &curr->w_rend, curr->w_x, curr->w_y); + LPutChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y); + if (curr->w_wrap) + curr->w_x++; } - else /* curr->w_x > cols - 1 */ + else { - SetChar(0); /* we wrapped */ - if (curr->w_insert) - { - LineFeed(2); /* cr+lf, handle LP */ - InsertAChar(c); - } - else - { - if (display && D_AM && D_x != cols) /* write char again */ - { - SetRenditionMline(&curr->w_mlines[curr->w_y], cols - 1); -#ifdef KANJI - if (curr->w_y == D_bot) - D_mbcs = D_lp_mbcs; -#endif - RAW_PUTCHAR(curr->w_mlines[curr->w_y].image[cols - 1]); - SetRendition(&curr->w_rend); - if (curr->w_y == D_bot) - D_lp_missing = 0; /* just wrote it */ - } - LineFeed((display == 0 || D_AM) ? 0 : 2); - if (display) - PUTCHAR(c); - SetChar(c); - curr->w_x = 1; - } + MWrapChar(curr, &curr->w_rend, curr->w_y, curr->w_top, curr->w_bot, curr->w_insert); + LWrapChar(&curr->w_layer, &curr->w_rend, curr->w_y, curr->w_top, curr->w_bot, curr->w_insert); + if (curr->w_y != curr->w_bot && curr->w_y != curr->w_height - 1) + curr->w_y++; + curr->w_x = 1; } -#ifdef KANJI +#ifdef FONT +# ifdef KANJI if (curr->w_mbcs) { c = curr->w_mbcs; curr->w_mbcs = 0; goto kanjiloop; /* what a hack! */ } -#endif +# endif if (curr->w_ss) { curr->w_FontL = curr->w_charsets[curr->w_Charset]; curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; - SetFont(curr->w_FontL); + curr->w_rend.font = curr->w_FontL; + LSetRendition(&curr->w_layer, &curr->w_rend); curr->w_ss = 0; } +#endif /* FONT */ break; } } while (--len); - curr->w_outlen = 0; - if (curr->w_state == PRIN) + if (!printcmd && curr->w_state == PRIN) PrintFlush(); } +static void +LogString(p, buf, len) +struct win *p; +char *buf; +int len; +{ + if (!p->w_log) + return; + if (logtstamp_on && p->w_logsilence >= logtstamp_after * 2) + { + char *t = MakeWinMsg(logtstamp_string, p, '%'); + logfwrite(p->w_log, t, strlen(t)); /* long time no write */ + } + p->w_logsilence = 0; + if (logfwrite(p->w_log, buf, len) < 1) + { + WMsg(p, errno, "Error writing logfile"); + logfclose(p->w_log); + p->w_log = 0; + } + if (!log_flush) + logfflush(p->w_log); +} + static int Special(c) register int c; @@ -1123,30 +813,19 @@ register int c; LineFeed(1); return 1; case '\007': - if (display == 0) - curr->w_bell = BELL_ON; - else - { - if (!visual_bell) - PutStr(D_BL); - else - { - if (!D_VB) - curr->w_bell = BELL_VISUAL; - else - PutStr(D_VB); - } - } + WBell(curr, visual_bell); return 1; case '\t': ForwardTab(); return 1; +#ifdef FONT case '\017': /* SI */ MapCharset(G0); return 1; case '\016': /* SO */ MapCharset(G1); return 1; +#endif } return 0; } @@ -1185,24 +864,30 @@ int c, intermediate; case 'c': ClearScreen(); ResetWindow(curr); + LKeypadMode(&curr->w_layer, 0); + LCursorkeysMode(&curr->w_layer, 0); +#ifndef TIOCPKT + NewAutoFlow(curr, 1); +#endif + /* XXX SetRendition(&mchar_null); InsertMode(0); - KeypadMode(0); - CursorkeysMode(0); ChangeScrollRegion(0, rows - 1); + */ break; case '=': - KeypadMode(curr->w_keypad = 1); + LKeypadMode(&curr->w_layer, curr->w_keypad = 1); #ifndef TIOCPKT NewAutoFlow(curr, 0); #endif /* !TIOCPKT */ break; case '>': - KeypadMode(curr->w_keypad = 0); + LKeypadMode(&curr->w_layer, curr->w_keypad = 0); #ifndef TIOCPKT NewAutoFlow(curr, 1); #endif /* !TIOCPKT */ break; +#ifdef FONT case 'n': /* LS2 */ MapCharset(G2); break; @@ -1212,6 +897,7 @@ int c, intermediate; case '~': MapCharsetR(G1); /* LS1R */ break; + /* { */ case '}': MapCharsetR(G2); /* LS2R */ break; @@ -1221,7 +907,7 @@ int c, intermediate; case 'N': /* SS2 */ 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_FontL = curr->w_charsets[curr->w_ss = G2]; + curr->w_FontR = curr->w_FontL = curr->w_charsets[curr->w_ss = G2]; else curr->w_ss = 0; break; @@ -1232,13 +918,9 @@ int c, intermediate; else curr->w_ss = 0; break; +#endif /* FONT */ case 'g': /* VBELL, private screen sequence */ - if (display == 0) - curr->w_bell = BELL_ON; - else if (!D_VB) - curr->w_bell = BELL_VISUAL; - else - PutStr(D_VB); + WBell(curr, 1); break; } break; @@ -1250,6 +932,7 @@ int c, intermediate; break; } break; +#ifdef FONT case '(': DesignateCharset(c, G0); break; @@ -1262,7 +945,7 @@ int c, intermediate; case '+': DesignateCharset(c, G3); break; -#ifdef KANJI +# ifdef KANJI /* * ESC $ ( Fn: invoke multi-byte charset, Fn, to G0 * ESC $ Fn: same as above. (old sequence) @@ -1283,7 +966,8 @@ int c, intermediate; case '$'<<8 | '+': DesignateCharset(c & 037, G3); break; -#endif +# endif +#endif /* FONT */ } } @@ -1312,7 +996,7 @@ int c, intermediate; a2 = 1; if (a2 > cols) a2 = cols; - GotoPos(--a2, --a1); + LGotoPos(&curr->w_layer, --a2, --a1); curr->w_x = a2; curr->w_y = a1; if (curr->w_autoaka) @@ -1331,7 +1015,7 @@ int c, intermediate; break; case 2: ClearScreen(); - GotoPos(curr->w_x, curr->w_y); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); break; } break; @@ -1341,16 +1025,20 @@ int c, intermediate; switch (a1) { case 0: - ClearToEOL(); + ClearLineRegion(curr->w_x, cols - 1); break; case 1: - ClearFromBOL(); + ClearLineRegion(0, curr->w_x); break; case 2: - ClearFullLine(); + ClearLineRegion(0, cols - 1); break; } break; + case 'X': + a1 = curr->w_x + (a1 ? a1 - 1 : 0); + ClearLineRegion(curr->w_x, a1 < cols ? a1 : cols - 1); + break; case 'A': CursorUp(a1 ? a1 : 1); break; @@ -1363,6 +1051,27 @@ int c, intermediate; case 'D': CursorLeft(a1 ? a1 : 1); break; + case 'E': + curr->w_x = 0; + CursorDown(a1 ? a1 : 1); /* positions cursor */ + break; + case 'F': + curr->w_x = 0; + CursorUp(a1 ? a1 : 1); /* positions cursor */ + break; + case 'G': + case '`': /* HPA */ + curr->w_x = a1 ? a1 - 1 : 0; + if (curr->w_x >= cols) + curr->w_x = cols - 1; + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); + break; + case 'd': /* VPA */ + curr->w_y = a1 ? a1 - 1 : 0; + if (curr->w_y >= rows) + curr->w_y = rows - 1; + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); + break; case 'm': SelectRendition(); break; @@ -1381,18 +1090,15 @@ int c, intermediate; break; curr->w_top = a1 - 1; curr->w_bot = a2 - 1; - ChangeScrollRegion(curr->w_top, curr->w_bot); + /* ChangeScrollRegion(curr->w_top, curr->w_bot); */ if (curr->w_origin) { - GotoPos(0, curr->w_top); curr->w_y = curr->w_top; curr->w_x = 0; } else - { - GotoPos(0, 0); - curr->w_y = curr->w_x = 0; - } + curr->w_y = curr->w_x = 0; + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); break; case 's': SaveCursor(); @@ -1405,18 +1111,9 @@ int c, intermediate; a1 = curr->w_width; if (a2 < 1) a2 = curr->w_height; - if (display && D_CWS == NULL) - { - a2 = curr->w_height; - if (D_CZ0 == NULL || (a1 != Z0width && a1 != Z1width)) - a1 = curr->w_width; - } - if (a1 == curr->w_width && a2 == curr->w_height) - break; - ChangeWindowSize(curr, a1, a2, curr->w_histheight); - SetCurr(curr); - if (display) - Activate(0); + WChangeSize(curr, a1, a2); + cols = curr->w_width; + rows = curr->w_height; break; case 'u': RestoreCursor(); @@ -1451,15 +1148,9 @@ int c, intermediate; case 'l': ASetMode(0); break; - case 'i': - { - struct display *odisplay = display; - if (display == 0 && displays && displays->d_next == 0) - display = displays; - if (display && a1 == 5) - PrintStart(); - display = odisplay; - } + case 'i': /* MC Media Control */ + if (a1 == 5) + PrintStart(); break; case 'n': if (a1 == 5) /* Report terminal status */ @@ -1479,13 +1170,14 @@ int c, intermediate; if (a1 == 6 || a1 == 7) { curr->w_curinv = 7 - a1; - CursorVisibility(curr->w_curinv ? -1 : curr->w_curvvis); + LCursorVisibility(&curr->w_layer, curr->w_curinv ? -1 : curr->w_curvvis); } break; - case 'S': /* obscure code from a 97801 term */ + case 'S': /* code from a 97801 term / DEC vt400 */ ScrollRegion(a1 ? a1 : 1); break; - case 'T': /* obscure code from a 97801 term */ + case 'T': /* code from a 97801 term / DEC vt400 */ + case '^': /* SD as per ISO 6429 */ ScrollRegion(a1 ? -a1 : -1); break; } @@ -1501,7 +1193,7 @@ int c, intermediate; switch (a1) { case 1: /* CKM: cursor key mode */ - CursorkeysMode(curr->w_cursorkeys = i); + LCursorkeysMode(&curr->w_layer, curr->w_cursorkeys = i); #ifndef TIOCPKT NewAutoFlow(curr, !i); #endif /* !TIOCPKT */ @@ -1509,50 +1201,30 @@ int c, intermediate; case 2: /* ANM: ansi/vt52 mode */ if (i) { -#ifdef KANJI +#ifdef FONT +# ifdef KANJI if (curr->w_kanji) break; -#endif +# endif curr->w_charsets[0] = curr->w_charsets[1] = curr->w_charsets[2] = curr->w_charsets[2] = curr->w_FontL = curr->w_FontR = ASCII; curr->w_Charset = 0; curr->w_CharsetR = 2; curr->w_ss = 0; +#endif } break; case 3: /* COLM: column mode */ i = (i ? Z0width : Z1width); - if (curr->w_width != i && (display == 0 || (D_CZ0 || D_CWS))) - { - ChangeWindowSize(curr, i, curr->w_height, curr->w_histheight); - SetCurr(curr); /* update rows/cols */ - if (display) - Activate(0); - } + WChangeSize(curr, i, curr->w_height); + cols = curr->w_width; + rows = curr->w_height; break; /* 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. - * (screen uses \Eg as special vbell sequence) - */ - if (i) - ReverseVideo(1); - else - { - if (display && D_CVR) - ReverseVideo(0); - else - if (curr->w_revvid) - { - if (display && D_VB) - PutStr(D_VB); - else - curr->w_bell = BELL_VISUAL; - } - } + if (i != curr->w_revvid) + WReverseVideo(curr, i); curr->w_revvid = i; break; case 6: /* OM: origin mode */ @@ -1563,8 +1235,7 @@ int c, intermediate; } else curr->w_y = curr->w_x = 0; - if (display) - GotoPos(curr->w_x, curr->w_y); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); break; case 7: /* AWM: auto wrap mode */ curr->w_wrap = i; @@ -1576,13 +1247,21 @@ int c, intermediate; /* case 13: SCFDM: space compression / field delimiting */ /* case 14: TEM: transmit execution mode */ /* case 16: EKEM: edit key execution mode */ + /* case 18: PFF: Printer term form feed */ + /* case 19: PEX: Printer extend screen / scroll. reg */ case 25: /* TCEM: text cursor enable mode */ curr->w_curinv = !i; - CursorVisibility(curr->w_curinv ? -1 : curr->w_curvvis); + LCursorVisibility(&curr->w_layer, curr->w_curinv ? -1 : curr->w_curvvis); break; - /* case 40: 132 col enable */ + /* case 34: RLM: Right to left mode */ + /* case 35: HEBM: hebrew keyboard map */ + /* case 36: HEM: hebrew encoding */ + /* case 38: TeK Mode */ + /* case 40: 132 col enable */ /* case 42: NRCM: 7bit NRC character mode */ - /* case 44: margin bell enable */ + /* case 44: margin bell enable */ + /* case 66: NKM: Numeric keypad appl mode */ + /* case 68: KBUM: Keyboard usage mode (data process) */ } } break; @@ -1599,25 +1278,8 @@ int c, intermediate; } -/* - * Store char in mline. Be sure, that w_Font is set correctly! - */ - -static void -SetChar(c) -register int c; -{ - register struct win *p = curr; - register struct mline *ml; - - FixLine(); - ml = &p->w_mlines[p->w_y]; - p->w_rend.image = c; - copy_mchar2mline(&p->w_rend, ml, p->w_x); -} - static void -StartString(type) +StringStart(type) enum string_t type; { curr->w_StringType = type; @@ -1626,7 +1288,7 @@ enum string_t type; } static void -SaveChar(c) +StringChar(c) int c; { if (curr->w_stringp >= curr->w_string + MAXSTR - 1) @@ -1635,44 +1297,99 @@ int c; *(curr->w_stringp)++ = c; } +/* + * Do string processing. Returns -1 if output should be suspended + * until status is gone. + */ +static int +StringEnd() +{ + struct canvas *cv; + + curr->w_state = LIT; + *curr->w_stringp = '\0'; + switch (curr->w_StringType) + { + case OSC: /* special xterm compatibility hack */ + if (curr->w_stringp - curr->w_string < 2 || + curr->w_string[0] < '0' || + curr->w_string[0] > '2' || + curr->w_string[1] != ';') + 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); + WindowChanged(curr, 'h'); + break; + case PM: + case GM: + for (display = displays; display; display = display->d_next) + { + for (cv = D_cvlist; cv; cv = cv->c_next) + if (cv->c_layer->l_bottom == &curr->w_layer) + break; + if (cv || curr->w_StringType == GM) + MakeStatus(curr->w_string); + } + return -1; + case DCS: + LAY_DISPLAYS(&curr->w_layer, AddStr(curr->w_string)); + break; + case AKA: + if (curr->w_title == curr->w_akabuf && !*curr->w_string) + break; + ChangeAKA(curr, curr->w_string, 20); + if (!*curr->w_string) + curr->w_autoaka = curr->w_y + 1; + break; + default: + break; + } + return 0; +} + static void PrintStart() { - int pi[2]; + curr->w_pdisplay = 0; - if (printcmd == 0 && D_PO == 0) - return; + /* find us a nice display to print on, fore prefered */ + for (display = displays; display; display = display->d_next) + if (curr == D_fore && (printcmd || D_PO)) + break; + if (!display) + { + struct canvas *cv; + for (cv = curr->w_layer.l_cvlist; cv; cv = cv->c_lnext) + { + display = cv->c_display; + if (printcmd || D_PO) + break; + } + if (!cv) + { + display = displays; + if (!display || display->d_next || !(printcmd || D_PO)) + 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]; + if (printcmd && curr->w_pdisplay->d_printfd < 0) + curr->w_pdisplay->d_printfd = printpipe(curr, printcmd); } static void @@ -1687,8 +1404,6 @@ int c; static void PrintFlush() { - struct display *odisp = display; - display = curr->w_pdisplay; if (display && printcmd) { @@ -1700,7 +1415,7 @@ PrintFlush() r = write(display->d_printfd, bp, len); if (r <= 0) { - Msg(errno, "printing aborted"); + WMsg(curr, errno, "printing aborted"); close(display->d_printfd); display->d_printfd = -1; break; @@ -1717,7 +1432,6 @@ PrintFlush() Flush(); } curr->w_stringp = curr->w_string; - display = odisp; } @@ -1727,31 +1441,36 @@ struct win *win; int on; { debug1("NewAutoFlow: %d\n", on); - SetCurr(win); if (win->w_flow & FLOW_AUTOFLAG) win->w_flow = FLOW_AUTOFLAG | (FLOW_AUTO|FLOW_NOW) * on; else win->w_flow = (win->w_flow & ~FLOW_AUTO) | FLOW_AUTO * on; - if (display) - SetFlow(win->w_flow & FLOW_NOW); + LSetFlow(&win->w_layer, win->w_flow & FLOW_NOW); } + +#ifdef FONT + static void DesignateCharset(c, n) int c, n; { curr->w_ss = 0; -#ifdef KANJI +# ifdef KANJI if (c == ('@' & 037)) c = KANJI; -#endif +# 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_FontL = c); + { + curr->w_FontL = c; + curr->w_rend.font = curr->w_FontL; + LSetRendition(&curr->w_layer, &curr->w_rend); + } if (curr->w_CharsetR == n) curr->w_FontR = c; } @@ -1765,7 +1484,9 @@ int n; if (curr->w_Charset != n) { curr->w_Charset = n; - SetFont(curr->w_FontL = curr->w_charsets[n]); + curr->w_FontL = curr->w_charsets[n]; + curr->w_rend.font = curr->w_FontL; + LSetRendition(&curr->w_layer, &curr->w_rend); } } @@ -1782,6 +1503,8 @@ int n; curr->w_gr = 1; } +#endif /* FONT */ + static void SaveCursor() { @@ -1789,30 +1512,33 @@ SaveCursor() curr->w_Saved_x = curr->w_x; curr->w_Saved_y = curr->w_y; curr->w_SavedRend= curr->w_rend; +#ifdef FONT curr->w_SavedCharset = curr->w_Charset; curr->w_SavedCharsetR = curr->w_CharsetR; bcopy((char *) curr->w_charsets, (char *) curr->w_SavedCharsets, 4 * sizeof(int)); +#endif } static void RestoreCursor() { - if (curr->w_saved) - { - GotoPos(curr->w_Saved_x, curr->w_Saved_y); - curr->w_x = curr->w_Saved_x; - curr->w_y = curr->w_Saved_y; - curr->w_rend = curr->w_SavedRend; - 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; - curr->w_FontL = curr->w_charsets[curr->w_Charset]; - curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; - SetRendition(&curr->w_rend); - } + if (!curr->w_saved) + return; + LGotoPos(&curr->w_layer, curr->w_Saved_x, curr->w_Saved_y); + curr->w_x = curr->w_Saved_x; + curr->w_y = curr->w_Saved_y; + curr->w_rend = curr->w_SavedRend; +#ifdef FONT + 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; + curr->w_FontL = curr->w_charsets[curr->w_Charset]; + curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; +#endif + LSetRendition(&curr->w_layer, &curr->w_rend); } static void @@ -1827,19 +1553,16 @@ BackSpace() curr->w_x = cols - 1; curr->w_y--; } - if (display) - GotoPos(curr->w_x, curr->w_y); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void Return() { - if (curr->w_x > 0) - { - curr->w_x = 0; - if (display) - GotoPos(curr->w_x, curr->w_y); - } + if (curr->w_x == 0) + return; + curr->w_x = 0; + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void @@ -1853,17 +1576,17 @@ int out_mode; { if (curr->w_y < rows-1) curr->w_y++; - if (out_mode && display) - GotoPos(curr->w_x, curr->w_y); + if (out_mode) + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); return; } - ScrollUpMap(1); + MScrollV(curr, 1, curr->w_top, curr->w_bot); if (curr->w_autoaka > 1) curr->w_autoaka--; - if (out_mode && display) + if (out_mode) { - ScrollV(0, curr->w_top, cols - 1, curr->w_bot, 1); - GotoPos(curr->w_x, curr->w_y); + LScrollV(&curr->w_layer, 1, curr->w_top, curr->w_bot); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } } @@ -1872,11 +1595,9 @@ ReverseLineFeed() { if (curr->w_y == curr->w_top) { - ScrollDownMap(1); - if (!display) - return; - ScrollV(0, curr->w_top, cols - 1, curr->w_bot, -1); - GotoPos(curr->w_x, curr->w_y); + MScrollV(curr, -1, curr->w_top, curr->w_bot); + LScrollV(&curr->w_layer, -1, curr->w_top, curr->w_bot); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } else if (curr->w_y > 0) CursorUp(1); @@ -1888,24 +1609,11 @@ int c; { register int y = curr->w_y, x = curr->w_x; - if (x == cols) - x--; save_mline(&curr->w_mlines[y], cols); - if (cols - x - 1 > 0) - bcopy_mline(&curr->w_mlines[y], x, x + 1, cols - x - 1); - SetChar(c); + curr->w_rend.image = c; + MInsChar(curr, &curr->w_rend, x, y); curr->w_x = x + 1; - if (!display) - return; - if (D_CIC || D_IC || D_IM) - { - InsertMode(curr->w_insert); - INSERTCHAR(c); - if (y == D_bot) - D_lp_missing = 0; - } - else - UpdateLine(&mline_old, y, x, cols - 1); + LInsChar(&curr->w_layer, &curr->w_rend, x, y, &mline_old); } static void @@ -1919,16 +1627,9 @@ int n; if (x == cols) x--; save_mline(&curr->w_mlines[y], cols); - if (n >= cols - x) - n = cols - x; - else - bcopy_mline(&curr->w_mlines[y], x, x + n, cols - x - n); - - ClearInLine(y, x, x + n - 1); - if (!display) - return; - ScrollH(y, x, curr->w_width - 1, -n, &mline_old); - GotoPos(x, y); + MScrollH(curr, -n, y, x, curr->w_width - 1); + LScrollH(&curr->w_layer, -n, y, x, curr->w_width - 1, &mline_old); + LGotoPos(&curr->w_layer, x, y); } static void @@ -1940,137 +1641,46 @@ int n; if (x == cols) x--; save_mline(&curr->w_mlines[y], cols); - - if (n >= cols - x) - n = cols - x; - else - bcopy_mline(&curr->w_mlines[y], x + n, x, cols - x - n); - ClearInLine(y, cols - n, cols - 1); - if (!display) - return; - ScrollH(y, x, curr->w_width - 1, n, &mline_old); - GotoPos(x, y); + MScrollH(curr, n, y, x, curr->w_width - 1); + LScrollH(&curr->w_layer, n, y, x, curr->w_width - 1, &mline_old); + LGotoPos(&curr->w_layer, x, y); } static void DeleteLine(n) int n; { - register int old = curr->w_top; - if (curr->w_y < curr->w_top || curr->w_y > curr->w_bot) return; if (n > curr->w_bot - curr->w_y + 1) n = curr->w_bot - curr->w_y + 1; - curr->w_top = curr->w_y; - ScrollUpMap(n); - curr->w_top = old; - if (!display) - return; - ScrollV(0, curr->w_y, cols - 1, curr->w_bot, n); - GotoPos(curr->w_x, curr->w_y); + MScrollV(curr, n, curr->w_y, curr->w_bot); + LScrollV(&curr->w_layer, n, curr->w_y, curr->w_bot); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void InsertLine(n) int n; { - register int old = curr->w_top; - if (curr->w_y < curr->w_top || curr->w_y > curr->w_bot) return; if (n > curr->w_bot - curr->w_y + 1) n = curr->w_bot - curr->w_y + 1; - curr->w_top = curr->w_y; - ScrollDownMap(n); - curr->w_top = old; - if (!display) - return; - ScrollV(0, curr->w_y, cols - 1, curr->w_bot, -n); - GotoPos(curr->w_x, curr->w_y); + MScrollV(curr, -n, curr->w_y, curr->w_bot); + LScrollV(&curr->w_layer, -n, curr->w_y, curr->w_bot); + LGotoPos(&curr->w_layer, 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) -int n; -{ - char tmp[256 * sizeof(struct mline)]; - register int i, cnt1, cnt2; - struct mline *ml; -#ifdef COPY_PASTE - register int ii; -#endif - - i = curr->w_top + n; - cnt1 = n * sizeof(struct mline); - cnt2 = (curr->w_bot - i + 1) * sizeof(struct mline); -#ifdef COPY_PASTE - for(ii = curr->w_top; ii < i; ii++) - AddLineToHist(curr, &curr->w_mlines[ii]); -#endif - ml = curr->w_mlines + i; - for (i = n; i; --i) - { - --ml; - clear_mline(ml, 0, cols + 1); - } - Scroll((char *) ml, cnt1, cnt2, tmp); -} - -static void -ScrollDownMap(n) -int n; -{ - char tmp[256 * sizeof(struct mline)]; - register int i, cnt1, cnt2; - struct mline *ml; - - i = curr->w_top; - cnt1 = (curr->w_bot - i - n + 1) * sizeof(struct mline); - cnt2 = n * sizeof(struct mline); - ml = curr->w_mlines + i; - Scroll((char *) ml, cnt1, cnt2, tmp); - for (i = n; i; --i) - { - clear_mline(ml, 0, cols + 1); - ml++; - } + MScrollV(curr, n, curr->w_top, curr->w_bot); + LScrollV(&curr->w_layer, n, curr->w_top, curr->w_bot); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } -static void -Scroll(cp, cnt1, cnt2, tmp) -char *cp, *tmp; -int cnt1, cnt2; -{ - if (!cnt1 || !cnt2) - return; - if (cnt1 <= cnt2) - { - bcopy(cp, tmp, cnt1); - bcopy(cp + cnt1, cp, cnt2); - bcopy(tmp, cp + cnt2, cnt1); - } - else - { - bcopy(cp + cnt1, tmp, cnt2); - bcopy(cp, cp + cnt2, cnt1); - bcopy(tmp, cp, cnt2); - } -} static void ForwardTab() @@ -2086,8 +1696,8 @@ ForwardTab() x++; while (x < cols - 1 && !curr->w_tabs[x]) x++; - GotoPos(x, curr->w_y); curr->w_x = x; + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void @@ -2099,106 +1709,56 @@ BackwardTab() x--; while (x > 0 && !curr->w_tabs[x]) x--; - GotoPos(x, curr->w_y); curr->w_x = x; + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void ClearScreen() { - register int i; - register struct mline *ml = curr->w_mlines; - - for (i = 0; i < rows; ++i) - { + LClear(&curr->w_layer, 0, 0, curr->w_width - 1, curr->w_height - 1, 1); #ifdef COPY_PASTE - AddLineToHist(curr, ml); + MScrollV(curr, curr->w_height, 0, curr->w_height - 1); +#else + MClear(curr, 0, 0, curr->w_width - 1, curr->w_height - 1); #endif - clear_mline(ml, 0, cols + 1); - ml++; - } - if (display) - ClearDisplay(); } static void ClearFromBOS() { - register int n, y = curr->w_y, x = curr->w_x; + register int y = curr->w_y, x = curr->w_x; - if (display) - Clear(0, 0, 0, cols - 1, x, y, 1); - for (n = 0; n < y; ++n) - ClearInLine(n, 0, cols - 1); - ClearInLine(y, 0, x); + LClear(&curr->w_layer, 0, 0, x, y, 1); + MClear(curr, 0, 0, x, y); RestorePosRendition(); } static void ClearToEOS() { - register int n, y = curr->w_y, x = curr->w_x; + register int y = curr->w_y, x = curr->w_x; if (x == 0 && y == 0) { ClearScreen(); return; } - if (display) - 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); + LClear(&curr->w_layer, x, y, cols - 1, rows - 1, 1); + MClear(curr, x, y, cols - 1, rows - 1); RestorePosRendition(); } static void -ClearFullLine() +ClearLineRegion(from, to) +int from, to; { register int y = curr->w_y; - - if (display) - Clear(0, y, 0, cols - 1, cols - 1, y, 1); - ClearInLine(y, 0, cols - 1); + LClear(&curr->w_layer, from, y, to, y, 1); + MClear(curr, from, y, to, y); RestorePosRendition(); } -static void -ClearToEOL() -{ - register int y = curr->w_y, x = curr->w_x; - - if (display) - Clear(x, y, 0, cols - 1, cols - 1, y, 1); - ClearInLine(y, x, cols - 1); - RestorePosRendition(); -} - -static void -ClearFromBOL() -{ - register int y = curr->w_y, x = curr->w_x; - - if (display) - Clear(0, y, 0, cols - 1, x, y, 1); - ClearInLine(y, 0, x); - RestorePosRendition(); -} - -static void -ClearInLine(y, x1, x2) -int y, x1, x2; -{ - register int n; - - if (x1 == cols) - x1--; - if (x2 == cols - 1) - x2++; - if ((n = x2 - x1 + 1) != 0) - clear_mline(&curr->w_mlines[y], x1, n); -} - static void CursorRight(n) register int n; @@ -2212,7 +1772,7 @@ register int n; } if ((curr->w_x += n) >= cols) curr->w_x = cols - 1; - GotoPos(curr->w_x, curr->w_y); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void @@ -2227,7 +1787,7 @@ register int n; else if ((curr->w_y -= n) < curr->w_top) curr->w_y = curr->w_top; - GotoPos(curr->w_x, curr->w_y); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void @@ -2242,7 +1802,7 @@ register int n; else if ((curr->w_y += n) > curr->w_bot) curr->w_y = curr->w_bot; - GotoPos(curr->w_x, curr->w_y); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void @@ -2251,7 +1811,7 @@ register int n; { if ((curr->w_x -= n) < 0) curr->w_x = 0; - GotoPos(curr->w_x, curr->w_y); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } static void @@ -2264,16 +1824,18 @@ int on; { switch (curr->w_args[i]) { - case 4: + /* case 2: KAM: Lock keyboard */ + case 4: /* IRM: Insert mode */ curr->w_insert = on; - InsertMode(on); + LAY_DISPLAYS(&curr->w_layer, InsertMode(on)); break; - case 20: + /* case 12: SRM: Echo mode on */ + case 20: /* LNM: Linefeed mode */ curr->w_autolf = on; break; case 34: curr->w_curvvis = !on; - CursorVisibility(curr->w_curinv ? -1 : curr->w_curvvis); + LCursorVisibility(&curr->w_layer, curr->w_curinv ? -1 : curr->w_curvvis); break; default: break; @@ -2316,12 +1878,11 @@ SelectRendition() a |= j; } while (++i < curr->w_NumArgs); - if (curr->w_rend.attr != a) - SetAttr(curr->w_rend.attr = a); + curr->w_rend.attr = a; #ifdef COLOR - if (curr->w_rend.color != c) - SetColor(curr->w_rend.color = c); + curr->w_rend.color = c; #endif + LSetRendition(&curr->w_layer, &curr->w_rend); } static void @@ -2330,6 +1891,7 @@ FillWithEs() register int i; register char *p, *ep; + ClearLayer(&curr->w_layer, 1); curr->w_y = curr->w_x = 0; for (i = 0; i < rows; ++i) { @@ -2339,62 +1901,10 @@ FillWithEs() while (p < ep) *p++ = 'E'; } - if (display) - Redisplay(0); -} - - -static void -UpdateLine(oml, y, from, to) -struct mline *oml; -int from, to, y; -{ - ASSERT(display); - DisplayLine(oml, &curr->w_mlines[y], y, from, to); - RestorePosRendition(); + RedisplayLayer(&curr->w_layer, 1); } -static void -CheckLP(n_ch) -int n_ch; -{ - register int x; - register struct mline *ml; - - ASSERT(display); - ml = &curr->w_mlines[D_bot]; - x = cols - 1; - - curr->w_rend.image = n_ch; - - D_lpchar = curr->w_rend; - D_lp_missing = 0; - - if (cmp_mchar_mline(&curr->w_rend, ml, x)) - return; -#ifdef KANJI - D_lp_mbcs = D_mbcs; - D_mbcs = 0; -#endif - if (!cmp_mchar(&mchar_blank, &curr->w_rend)) /* is new not blank */ - D_lp_missing = 1; - if (!cmp_mchar_mline(&mchar_blank, ml, x)) /* is old char not blank? */ - { - /* old char not blank, new blank, try to delete */ - if (D_UT) - SetRendition(&mchar_null); - if (D_CE) - PutStr(D_CE); - else if (D_DC) - PutStr(D_DC); - else if (D_CDC) - CPutStr(D_CDC, 1); - else - D_lp_missing = 1; - } -} - /* * Ugly autoaka hack support: * ChangeAKA() sets a new aka @@ -2415,14 +1925,9 @@ int l; if (p->w_akachange != p->w_akabuf) if (p->w_akachange[0] == 0 || p->w_akachange[-1] == ':') p->w_title = p->w_akabuf + strlen(p->w_akabuf) + 1; - - /* yucc */ - if (p->w_hstatus) - { - display = p->w_display; - if (display) - RefreshStatus(); - } + WindowChanged(p, 't'); + WindowChanged((struct win *)0, 'w'); + WindowChanged((struct win *)0, 'W'); } static void @@ -2474,25 +1979,11 @@ FindAKA() wp->w_autoaka = 0; } -void -SetCurr(wp) -struct win *wp; -{ - curr = wp; - if (curr == 0) - return; - cols = curr->w_width; - rows = curr->w_height; - display = curr->w_active ? curr->w_display : 0; -} - static void RestorePosRendition() { - if (!display) - return; - GotoPos(curr->w_x, curr->w_y); - SetRendition(&curr->w_rend); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); + LSetRendition(&curr->w_layer, &curr->w_rend); } /* Send a terminal report as if it were typed. */ @@ -2514,6 +2005,294 @@ int n1, n2; } } + + +/* + *====================================================================* + *====================================================================* + */ + +/********************************************************************** + * + * Memory subsystem. + * + */ + +static void +MFixLine(p, y, mc) +struct win *p; +int y; +struct mchar *mc; +{ + struct mline *ml = &p->w_mlines[y]; + if (mc->attr && ml->attr == null) + { + if ((ml->attr = (char *)malloc(p->w_width + 1)) == 0) + { + ml->attr = null; + mc->attr = p->w_rend.attr = 0; + WMsg(p, 0, "Warning: no space for attr - turned off"); + } + bzero(ml->attr, p->w_width + 1); + } +#ifdef FONT + if (mc->font && ml->font == null) + { + if ((ml->font = (char *)malloc(p->w_width + 1)) == 0) + { + ml->font = null; + p->w_FontL = p->w_charsets[p->w_ss ? p->w_ss : p->w_Charset] = 0; + p->w_FontR = p->w_charsets[p->w_ss ? p->w_ss : p->w_CharsetR] = 0; + mc->font = p->w_rend.font = 0; + WMsg(p, 0, "Warning: no space for font - turned off"); + } + bzero(ml->font, p->w_width + 1); + } +#endif +#ifdef COLOR + if (mc->color && ml->color == null) + { + if ((ml->color = (char *)malloc(p->w_width + 1)) == 0) + { + ml->color = null; + mc->color = p->w_rend.color = 0; + WMsg(p, 0, "Warning: no space for color - turned off"); + } + bzero(ml->color, p->w_width + 1); + } +#endif +} + +/*****************************************************************/ + +static void +MScrollH(p, n, y, xs, xe) +struct win *p; +int n, y, xs, xe; +{ + struct mline *ml; + + if (n == 0) + return; + ml = &p->w_mlines[y]; + if (n > 0) + { + if (xe - xs + 1 > n) + bcopy_mline(ml, xs + n, xs, xe + 1 - xs - n); + else + n = xe - xs + 1; + clear_mline(ml, xe + 1 - n, n); + } + else + { + n = -n; + if (xe - xs + 1 > n) + bcopy_mline(ml, xs, xs + n, xe + 1 - xs - n); + else + n = xe - xs + 1; + clear_mline(ml, xs, n); + } +} + +static void +MScrollV(p, n, ys, ye) +struct win *p; +int n; +int ys, ye; +{ + int i, cnt1, cnt2; + struct mline *tmp[256]; + struct mline *ml; + + if (n == 0) + return; + if (n > 0) + { + if (n > 256) + { + MScrollV(p, n - 256, ys, ye); + n = 256; + } + if (ye - ys + 1 < n) + n = ye - ys + 1; +#ifdef COPY_PASTE + if (compacthist) + { + ye = MFindUsedLine(p, ye, ys); + if (ye - ys + 1 < n) + n = ye - ys + 1; + if (n <= 0) + return; + } +#endif + /* Clear lines */ + ml = p->w_mlines + ys; + for (i = ys; i < ys + n; i++, ml++) + { +#ifdef COPY_PASTE + if (ys == p->w_top) + AddLineToHist(p, ml); +#endif + if (ml->attr != null) + free(ml->attr); + ml->attr = null; +#ifdef FONT + if (ml->font != null) + free(ml->font); + ml->font = null; +#endif +#ifdef COLOR + if (ml->color != null) + free(ml->color); + ml->color = null; +#endif + bclear(ml->image, p->w_width + 1); + } + /* switch 'em over */ + cnt1 = n * sizeof(struct mline); + cnt2 = (ye - ys + 1 - n) * sizeof(struct mline); + if (cnt1 && cnt2) + Scroll((char *)(p->w_mlines + ys), cnt1, cnt2, (char *)tmp); + } + else + { + if (n < -256) + { + MScrollV(p, n + 256, ys, ye); + n = -256; + } + n = -n; + if (ye - ys + 1 < n) + n = ye - ys + 1; + + ml = p->w_mlines + ye; + /* Clear lines */ + for (i = ye; i > ye - n; i--, ml--) + { + if (ml->attr != null) + free(ml->attr); + ml->attr = null; +#ifdef FONT + if (ml->font != null) + free(ml->font); + ml->font = null; +#endif +#ifdef COLOR + if (ml->color != null) + free(ml->color); + ml->color = null; +#endif + bclear(ml->image, p->w_width + 1); + } + cnt1 = n * sizeof(struct mline); + cnt2 = (ye - ys + 1 - n) * sizeof(struct mline); + if (cnt1 && cnt2) + Scroll((char *)(p->w_mlines + ys), cnt2, cnt1, (char *)tmp); + } +} + +static void +Scroll(cp, cnt1, cnt2, tmp) +char *cp, *tmp; +int cnt1, cnt2; +{ + if (!cnt1 || !cnt2) + return; + if (cnt1 <= cnt2) + { + bcopy(cp, tmp, cnt1); + bcopy(cp + cnt1, cp, cnt2); + bcopy(tmp, cp + cnt2, cnt1); + } + else + { + bcopy(cp + cnt1, tmp, cnt2); + bcopy(cp, cp + cnt2, cnt1); + bcopy(tmp, cp, cnt2); + } +} + +static void +MClear(p, xs, ys, xe, ye) +struct win *p; +int xs, ys, xe, ye; +{ + int n, y; + int xxe; + struct mline *ml; + + /* check for magic margin condition */ + if (xs >= p->w_width) + xs = p->w_width - 1; + if (xe >= p->w_width) + xe = p->w_width - 1; + + ml = p->w_mlines + ys; + for (y = ys; y <= ye; y++, ml++) + { + xxe = (y == ye) ? xe : p->w_width - 1; + n = xxe - xs + 1; + if (n > 0) + clear_mline(ml, xs, n); + xs = 0; + } +} + +static void +MInsChar(p, c, x, y) +struct win *p; +struct mchar *c; +int x, y; +{ + int n; + struct mline *ml; + + ASSERT(x >= 0 && x < p->w_width); + MFixLine(p, y, c); + ml = p->w_mlines + y; + n = p->w_width - x - 1; + if (n > 0) + bcopy_mline(ml, x, x + 1, n); + copy_mchar2mline(c, ml, x); +} + +static void +MPutChar(p, c, x, y) +struct win *p; +struct mchar *c; +int x, y; +{ + struct mline *ml; + + MFixLine(p, y, c); + ml = &p->w_mlines[y]; + copy_mchar2mline(c, ml, x); +} + + +static void +MWrapChar(p, c, y, top, bot, ins) +struct win *p; +struct mchar *c; +int y, top, bot; +int ins; +{ + struct mline *ml; + + MFixLine(p, y, c); + ml = &p->w_mlines[y]; + copy_mchar2mline(&mchar_null, ml, p->w_width); + if (y == bot) + MScrollV(p, 1, top, bot); + else if (y < p->w_height - 1) + y++; + MFixLine(p, y, c); + ml = &p->w_mlines[y]; + if (ins && p->w_width > 1) + bcopy_mline(ml, 0, 1, p->w_width - 1); + copy_mchar2mline(c, ml, 0); +} + #ifdef COPY_PASTE static void AddLineToHist(wp, ml) @@ -2532,9 +2311,11 @@ struct mline *ml; if (o != null) free(o); +#ifdef FONT q = ml->font; o = hml->font; hml->font = q; ml->font = null; if (o != null) free(o); +#endif #ifdef COLOR q = ml->color; o = hml->color; hml->color = q; ml->color = null; @@ -2547,3 +2328,238 @@ struct mline *ml; } #endif +int +MFindUsedLine(p, ye, ys) +struct win *p; +int ys, ye; +{ + int y; + struct mline *ml = p->w_mlines + ye; + + debug2("MFindUsedLine: %d %d\n", ye, ys); + for (y = ye; y >= ys; y--, ml--) + { + if (bcmp((char*)ml->image, blank, p->w_width)) + break; + if (ml->attr != null && bcmp((char*)ml->attr, null, p->w_width)) + break; +#ifdef COLOR + if (ml->color != null && bcmp((char*)ml->color, null, p->w_width)) + break; +#endif + } + debug1("MFindUsedLine returning %d\n", y); + return y; +} + + +/* + *====================================================================* + *====================================================================* + */ + +/* + * Tricky: send only one bell even if the window is displayed + * more than one times. + */ +void +WBell(p, visual) +struct win *p; +int visual; +{ + struct canvas *cv; + for (display = displays; display; display = display->d_next) + { + for (cv = D_cvlist; cv; cv = cv->c_next) + if (cv->c_layer->l_bottom == &p->w_layer) + break; + if (cv && !visual) + PutStr(D_BL); + else if (cv && D_VB) + PutStr(D_VB); + else + p->w_bell = visual ? BELL_VISUAL : BELL_FOUND; + } +} + +/* + * This should be reverse video. + * Only change video if window is fore. + * Because it is used in some termcaps to emulate + * a visual bell we do this hack here. + * (screen uses \Eg as special vbell sequence) + */ +static void +WReverseVideo(p, on) +struct win *p; +int on; +{ + struct canvas *cv; + for (cv = p->w_layer.l_cvlist; cv; cv = cv->c_lnext) + { + display = cv->c_display; + if (cv != D_forecv) + continue; + ReverseVideo(on); + if (!on && p->w_revvid && !D_CVR) + { + if (D_VB) + PutStr(D_VB); + else + p->w_bell = BELL_VISUAL; + } + } +} + +void +WMsg(p, err, str) +struct win *p; +int err; +char *str; +{ + extern struct layer *flayer; + struct layer *oldflayer = flayer; + flayer = &p->w_layer; + LMsg(err, str); + flayer = oldflayer; +} + +void +WChangeSize(p, w, h) +struct win *p; +int w, h; +{ + int wok = 0; + struct canvas *cv; + + if (p->w_layer.l_cvlist == 0) + { + /* window not displayed -> works always */ + ChangeWindowSize(p, w, h, p->w_histheight); + return; + } + for (cv = p->w_layer.l_cvlist; cv; cv = cv->c_lnext) + { + display = cv->c_display; + if (p != D_fore) + continue; /* change only fore */ + if (D_CWS) + break; + if (D_CZ0 && (w == Z0width || w == Z1width)) + wok = 1; + } + if (cv == 0 && wok == 0) /* can't change any display */ + return; + if (!D_CWS) + h = p->w_height; + ChangeWindowSize(p, w, h, p->w_histheight); + for (display = displays; display; display = display->d_next) + { + if (p == D_fore) + { + if (D_cvlist && D_cvlist->c_next == 0) + ResizeDisplay(w, h); + else + ResizeDisplay(w, D_height); + ResizeLayersToCanvases(); /* XXX Hmm ? */ + continue; + } + for (cv = D_cvlist; cv; cv = cv->c_next) + if (cv->c_layer->l_bottom == &p->w_layer) + break; + if (cv) + Redisplay(0); + } +} + +static int +WindowChangedCheck(s, what, hp) +char *s; +int what; +int *hp; +{ + int h = 0; + while(*s) + { + if (*s++ != '%') + continue; + while (*s >= '0' && *s <= '9') + s++; + if (*s == 'h') + h = 1; + if (*s == what || what == 'd') + break; + if (*s) + s++; + } + if (hp) + *hp = h; + return *s ? 1 : 0; +} + +void +WindowChanged(p, what) +struct win *p; +int what; +{ + int inwstr, inhstr; + int inwstrh, inhstrh; + int got, ox, oy; + struct display *olddisplay = display; + struct canvas *cv; + + inwstr = inhstr = 0; + + inwstr = WindowChangedCheck(captionstring, what, &inwstrh); + inhstr = WindowChangedCheck(hstatusstring, what, &inhstrh); + + if (p == 0) + { + for (display = displays; display; display = display->d_next) + { + ox = D_x; + oy = D_y; + for (cv = D_cvlist; cv; cv = cv->c_next) + { + p = Layer2Window(cv->c_layer); + if (inwstr || (inwstrh && p && p->w_hstatus && *p->w_hstatus && WindowChangedCheck(p->w_hstatus, what, (int *)0))) + if (cv->c_ye + 1 < D_height) + RefreshLine(cv->c_ye + 1, 0, D_width - 1, 0); + } + p = D_fore; + if (inhstr || (inhstrh && p && p->w_hstatus && *p->w_hstatus && WindowChangedCheck(p->w_hstatus, what, (int *)0))) + RefreshHStatus(); + if (ox != -1 && ox != -1) + GotoPos(ox, oy); + } + display = olddisplay; + return; + } + + if (p->w_hstatus && *p->w_hstatus && (inwstrh || inhstrh) && WindowChangedCheck(p->w_hstatus, what, (int *)0)) + { + inwstr |= inwstrh; + inhstr |= inhstrh; + } + if (!inwstr && !inhstr) + return; + for (display = displays; display; display = display->d_next) + { + got = 0; + ox = D_x; + oy = D_y; + for (cv = D_cvlist; cv; cv = cv->c_next) + { + if (Layer2Window(cv->c_layer) != p) + continue; + got = 1; + if (inwstr && cv->c_ye + 1 < D_height) + RefreshLine(cv->c_ye + 1, 0, D_width - 1, 0); + } + if (got && inhstr && p == D_fore) + RefreshHStatus(); + if (ox != -1 && ox != -1) + GotoPos(ox, oy); + } + display = olddisplay; +} diff --git a/src/ansi.h b/src/ansi.h index c4ae0ce..6d2f03d 100644 --- a/src/ansi.h +++ b/src/ansi.h @@ -46,6 +46,7 @@ /* * Parser state */ +/* keep state_t and state_t_string in sync! */ enum state_t { LIT, /* Literal input */ @@ -59,6 +60,7 @@ enum state_t PRIN4 /* CSI 4 seen in printer mode */ }; +/* keep string_t and string_t_string in sync! */ enum string_t { NONE, diff --git a/src/attacher.c b/src/attacher.c index 62d8804..639cf8b 100644 --- a/src/attacher.c +++ b/src/attacher.c @@ -26,9 +26,7 @@ RCS_ID("$Id$ FAU") #include #include -#if !defined(sun) || defined(SUNOS3) #include -#endif #include #include #include "config.h" @@ -38,9 +36,6 @@ RCS_ID("$Id$ FAU") #include static sigret_t AttacherSigInt __P(SIGPROTOARG); -#ifdef PASSWORD -static void trysend __P((int, struct msg *, char *)); -#endif #if defined(SIGWINCH) && defined(TIOCGWINSZ) static sigret_t AttacherWinch __P(SIGPROTOARG); #endif @@ -53,15 +48,17 @@ static void screen_builtin_lck __P((void)); #ifdef DEBUG static sigret_t AttacherChld __P(SIGPROTOARG); #endif +#ifdef MULTIUSER +static sigret_t AttachSigCont __P(SIGPROTOARG); +#endif extern int real_uid, real_gid, eff_uid, eff_gid; extern char *SockName, *SockMatch, SockPath[]; extern struct passwd *ppp; -extern char *attach_tty, *attach_term, *LoginName; +extern char *attach_tty, *attach_term, *LoginName, *preselect; extern int xflag, dflag, rflag, quietflag, adaptflag; extern struct mode attach_Mode; extern int MasterPid; -extern int nethackflag; #ifdef MULTIUSER extern char *multi; @@ -73,6 +70,18 @@ static int multipipe[2]; #endif +#ifdef MULTIUSER +static int ContinuePlease; + +static sigret_t +AttachSigCont SIGDEFARG +{ + debug("SigCont()\n"); + ContinuePlease = 1; + SIGRETURN; +} +#endif + /* * Send message to a screen backend. @@ -167,6 +176,7 @@ int how; bzero((char *) &m, sizeof(m)); m.type = how; + m.protocol_revision = MSG_REVISION; strncpy(m.m_tty, attach_tty, sizeof(m.m_tty) - 1); m.m_tty[sizeof(m.m_tty) - 1] = 0; @@ -194,7 +204,7 @@ int how; switch (n) { case 0: - if (rflag == 2) + if (rflag && (rflag & 1) == 0) return 0; if (quietflag) eexit(10); @@ -206,9 +216,12 @@ int how; case 1: break; default: - if (quietflag) - eexit(10 + n); - Panic(0, "Type \"screen [-d] -r [pid.]tty.host\" to resume one of them."); + if (rflag < 3) + { + if (quietflag) + eexit(10 + n); + Panic(0, "Type \"screen [-d] -r [pid.]tty.host\" to resume one of them."); + } /* NOTREACHED */ } } @@ -223,7 +236,10 @@ int how; setuid(real_uid); #if defined(MULTIUSER) && defined(USE_SETEUID) else - xseteuid(real_uid); /* multi_uid, allow backend to send signals */ + { + /* This call to xsetuid should also set the saved uid */ + xseteuid(real_uid); /* multi_uid, allow backend to send signals */ + } #endif setgid(real_gid); eff_uid = real_uid; @@ -243,6 +259,17 @@ int how; Panic(errno, "stat %s", SockPath); if ((st.st_mode & 0600) != 0600) Panic(0, "Socket is in wrong mode (%03o)", (int)st.st_mode); + + /* + * Change: if -x or -r ignore failing -d + */ + if ((xflag || rflag) && dflag && (st.st_mode & 0700) == 0600) + dflag = 0; + + /* + * Without -x, the mode must match. + * With -x the mode is irrelevant unless -d. + */ if ((dflag || !xflag) && (st.st_mode & 0700) != (dflag ? 0700 : 0600)) Panic(0, "That screen is %sdetached.", dflag ? "already " : "not "); #ifdef REMOTE_DETACH @@ -276,6 +303,10 @@ int how; strncpy(m.m.attach.auser, LoginName, sizeof(m.m.attach.auser) - 1); m.m.attach.auser[sizeof(m.m.attach.auser) - 1] = 0; + m.m.attach.esc = DefaultEsc; + m.m.attach.meta_esc = DefaultMetaEsc; + strncpy(m.m.attach.preselect, preselect ? preselect : "", sizeof(m.m.attach.preselect) - 1); + m.m.attach.preselect[sizeof(m.m.attach.preselect) - 1] = 0; m.m.attach.apid = getpid(); m.m.attach.adaptflag = adaptflag; m.m.attach.lines = m.m.attach.columns = 0; @@ -284,23 +315,23 @@ int how; if ((s = getenv("COLUMNS"))) m.m.attach.columns = atoi(s); -#ifdef PASSWORD - if (how == MSG_ATTACH || how == MSG_CONT) - trysend(lasts, &m, m.m.attach.password); - else +#ifdef MULTIUSER + /* setup CONT signal handler to repair the terminal mode */ + if (multi && (how == MSG_ATTACH || how == MSG_CONT)) + signal(SIGCONT, AttachSigCont); #endif - { - if (write(lasts, (char *) &m, sizeof(m)) != sizeof(m)) - Panic(errno, "write"); - close(lasts); - } + + if (write(lasts, (char *) &m, sizeof(m)) != sizeof(m)) + Panic(errno, "write"); + close(lasts); debug1("Attach(%d): sent\n", m.type); #ifdef MULTIUSER if (multi && (how == MSG_ATTACH || how == MSG_CONT)) { -# ifndef PASSWORD - pause(); -# endif + while (!ContinuePlease) + pause(); /* wait for SIGCONT */ + signal(SIGCONT, SIG_DFL); + ContinuePlease = 0; # ifndef USE_SETEUID close(multipipe[1]); # else @@ -318,77 +349,11 @@ int how; } -#ifdef PASSWORD - -static int trysendstatok, trysendstatfail; - -static sigret_t -trysendok SIGDEFARG -{ - trysendstatok = 1; -} - -static sigret_t -trysendfail SIGDEFARG -{ -# ifdef SYSVSIGS - signal(SIG_PW_FAIL, trysendfail); -# endif /* SYSVSIGS */ - trysendstatfail = 1; -} - -static char screenpw[9]; - -static void -trysend(fd, m, pwto) -int fd; -struct msg *m; -char *pwto; -{ - char *npw = NULL; - sigret_t (*sighup)__P(SIGPROTOARG); - sigret_t (*sigusr1)__P(SIGPROTOARG); - int tries; - - sigusr1 = signal(SIG_PW_OK, trysendok); - sighup = signal(SIG_PW_FAIL, trysendfail); - for (tries = 0; ; ) - { - strncpy(pwto, screenpw, 9); - trysendstatok = trysendstatfail = 0; - if (write(fd, (char *) m, sizeof(*m)) != sizeof(*m)) - Panic(errno, "write"); - close(fd); - while (trysendstatok == 0 && trysendstatfail == 0) - pause(); - if (trysendstatok) - { - signal(SIG_PW_OK, sigusr1); - signal(SIG_PW_FAIL, sighup); - if (trysendstatfail) - kill(getpid(), SIG_PW_FAIL); - return; - } - if (++tries > 1 || (npw = getpass("Screen Password:")) == 0 || *npw == 0) - { -#ifdef NETHACK - if (nethackflag) - Panic(0, "The guard slams the door in your face."); - else +#if defined(DEBUG) || !defined(DO_NOT_POLL_MASTER) +static int AttacherPanic; #endif - Panic(0, "Password incorrect."); - } - strncpy(screenpw, npw, 8); - if ((fd = MakeClientSocket(0)) == -1) - Panic(0, "Cannot contact screen again. Sigh."); - } -} -#endif /* PASSWORD */ - #ifdef DEBUG -static int AttacherPanic; - static sigret_t AttacherChld SIGDEFARG { @@ -397,6 +362,17 @@ AttacherChld SIGDEFARG } #endif +static sigret_t +AttacherSigAlarm SIGDEFARG +{ +#ifdef DEBUG + static int tick_cnt = 0; + if ((tick_cnt = (tick_cnt + 1) % 4) == 0) + debug("tick\n"); +#endif + SIGRETURN; +} + /* * the frontend's Interrupt handler * we forward SIGINT to the poor backend @@ -433,6 +409,7 @@ AttacherFinit SIGDEFARG debug1("attach_tty is %s\n", attach_tty); m.m.detach.dpid = getpid(); m.type = MSG_HANGUP; + m.protocol_revision = MSG_REVISION; if ((s = MakeClientSocket(0)) >= 0) { write(s, (char *)&m, sizeof(m)); @@ -474,6 +451,23 @@ AttacherFinitBye SIGDEFARG } #endif +#if defined(DEBUG) && defined(SIG_NODEBUG) +static sigret_t +AttacherNoDebug SIGDEFARG +{ + debug("AttacherNoDebug()\n"); + signal(SIG_NODEBUG, AttacherNoDebug); + if (dfp) + { + debug("debug: closing debug file.\n"); + fflush(dfp); + fclose(dfp); + dfp = NULL; + } + SIGRETURN; +} +#endif /* SIG_NODEBUG */ + static int SuspendPlease; static sigret_t @@ -524,6 +518,9 @@ Attacher() #ifdef POW_DETACH signal(SIG_POWER_BYE, AttacherFinitBye); #endif +#if defined(DEBUG) && defined(SIG_NODEBUG) + signal(SIG_NODEBUG, AttacherNoDebug); +#endif #ifdef LOCK signal(SIG_LOCK, DoLock); #endif @@ -544,8 +541,11 @@ Attacher() #endif for (;;) { -#ifdef DEBUG - sleep(1); +#ifndef DO_NOT_POLL_MASTER + signal(SIGALRM, AttacherSigAlarm); + alarm(15); + pause(); + alarm(0); if (kill(MasterPid, 0) < 0 && errno != EPERM) { debug1("attacher: Panic! MasterPid %d does not exist.\n", MasterPid); @@ -554,16 +554,17 @@ Attacher() #else pause(); #endif -/* - debug("attacher: ding!\n"); -*/ -#ifdef DEBUG +#if defined(DEBUG) || !defined(DO_NOT_POLL_MASTER) if (AttacherPanic) { +# ifdef FORKDEBUG + exit(0); +# else fcntl(0, F_SETFL, 0); SetTTY(0, &attach_Mode); printf("\nSuddenly the Dungeon collapses!! - You die...\n"); eexit(1); +# endif } #endif #ifdef BSDJOBS @@ -663,14 +664,7 @@ LockTerminal() exit(errno); } if (pid == -1) - { -#ifdef NETHACK - if (nethackflag) - Msg(errno, "Cannot fork terminal - lock failed"); - else -#endif - Msg(errno, "Cannot lock terminal - fork failed"); - } + Msg(errno, "Cannot lock terminal - fork failed"); else { #ifdef BSDWAIT @@ -735,21 +729,6 @@ screen_builtin_lck() char fullname[100], *cp1, message[100 + 100]; char *pass, mypass[9]; -#ifdef undef - /* get password entry */ - if ((ppp = getpwuid(real_uid)) == NULL) - { - fprintf(stderr, "screen_builtin_lck: No passwd entry.\007\n"); - sleep(2); - return; - } - if (!isatty(0)) - { - fprintf(stderr, "screen_builtin_lck: Not a tty.\007\n"); - sleep(2); - return; - } -#endif pass = ppp->pw_passwd; if (pass == 0 || *pass == 0) { @@ -781,6 +760,7 @@ screen_builtin_lck() debug("screen_builtin_lck looking in gcos field\n"); strncpy(fullname, ppp->pw_gecos, sizeof(fullname) - 9); fullname[sizeof(fullname) - 9] = 0; + if ((cp1 = index(fullname, ',')) != NULL) *cp1 = '\0'; if ((cp1 = index(fullname, '&')) != NULL) @@ -804,7 +784,6 @@ screen_builtin_lck() AttacherFinit(SIGARG); /* NOTREACHED */ } - debug3("getpass(%d): %x == %s\n", errno, (unsigned int)cp1, cp1); if (pass) { if (!strncmp(crypt(cp1, pass), pass, strlen(pass))) diff --git a/src/braille.c b/src/braille.c new file mode 100644 index 0000000..55f8e4a --- /dev/null +++ b/src/braille.c @@ -0,0 +1,942 @@ +/* + * A braille interface to unix tty terminals + * + * Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu + * Bill Barry barryb@dots.physics.orst.edu + * + * Copyright (c) 1995 by Science Access Project, Oregon State University. + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING); if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + **************************************************************** + */ +#include "rcs.h" +RCS_ID("$Id$") + +#include +#include +#include +#include + +#include "config.h" +#include "screen.h" +#include "extern.h" +#include "braille.h" + +#ifdef HAVE_BRAILLE + + +extern int bd_init_powerbraille_40 __P((void)); +extern int bd_init_powerbraille_80 __P((void)); +extern int bd_init_navigator_40 __P((void)); + +extern struct layer *flayer; +extern struct display *displays, *display; +extern char *rc_name; + + + + +/* global variables */ + +struct braille_display bd; + +struct bd_type { + char *name; + int (*init) __P((void)); +}; + +static struct bd_type bd_typelist[] = +{ + {"powerbraille_40", bd_init_powerbraille_40}, + {"powerbraille_80", bd_init_powerbraille_80}, + {"navigator_40" , bd_init_navigator_40} +}; + +static void position_braille_cursor __P((void)); +static int initialize_braille_display_type __P((char *)); +static int open_braille_device __P(()); +static int load_braille_table __P((char *)); +static void bd_signal __P((void)); +static void bd_bc_left __P((void)); +static void bd_bc_right __P((void)); +static void bd_bc_up __P((void)); +static void bd_bc_down __P((void)); +static void bd_upper_left __P((void)); +static void bd_upper_right __P((void)); +static void bd_lower_left __P((void)); +static void bd_lower_right __P((void)); +static int bd_do_search __P((int, int, int)); +static void bd_normalize __P((int, int)); +static void bd_readev_fn __P((struct event *, char *)); +static void bd_writeev_fn __P((struct event *, char *)); +static void bd_selectev_fn __P((struct event *, char *)); + +static unsigned char btable_local [] = +{ + 0xC8,0xC1,0xC3,0xC9,0xD9,0xD1,0xCB,0xDB, + 0xD3,0xCA,0xDA,0xC5,0xC7,0xCD,0xDD,0xD5, + 0xCF,0xDF,0xD7,0xCE,0xDE,0xE5,0xE7,0xFA, + 0xED,0xFD,0xF5,0xEA,0xF3,0xFB,0xD8,0xF8, + 0x00,0x2E,0x10,0x3C,0x2B,0x29,0x2F,0x04, + 0x37,0x3E,0x21,0x2C,0x20,0x24,0x28,0x0C, + 0x34,0x02,0x06,0x12,0x32,0x22,0x16,0x36, + 0x26,0x14,0x31,0x30,0x23,0x3F,0x1C,0x39, + 0x48,0x41,0x43,0x49,0x59,0x51,0x4B,0x5B, + 0x53,0x4A,0x5A,0x45,0x47,0x4D,0x5D,0x55, + 0x4F,0x5F,0x57,0x4E,0x5E,0x65,0x67,0x7A, + 0x6D,0x7D,0x75,0x6A,0x73,0x7B,0x58,0x38, + 0x08,0x01,0x03,0x09,0x19,0x11,0x0B,0x1B, + 0x13,0x0A,0x1A,0x05,0x07,0x0D,0x1D,0x15, + 0x0F,0x1F,0x17,0x0E,0x1E,0x25,0x27,0x3A, + 0x2D,0x3D,0x35,0x2A,0x33,0x3B,0x18,0x78, + 0x88,0x81,0x83,0x89,0x99,0x91,0x8B,0x9B, + 0x93,0x8A,0x9A,0x85,0x87,0x8D,0x9D,0x95, + 0x8F,0x9F,0x97,0x8E,0x9E,0xA5,0xA7,0xBA, + 0xAD,0xBD,0xB5,0xAA,0xB3,0xBB,0x98,0xB8, + 0x40,0x6E,0x50,0x7C,0x6B,0x69,0x6F,0x44, + 0x77,0x7E,0x61,0x6C,0x60,0x64,0x68,0x4C, + 0x74,0x42,0x46,0x52,0x72,0x62,0x56,0x76, + 0x66,0x54,0x71,0x70,0x63,0x7F,0x5C,0x79, + 0xC0,0xEE,0xD0,0xFC,0xEB,0xE9,0xEF,0xC4, + 0xF7,0xFE,0xE1,0xEC,0xE0,0xE4,0xE8,0xCC, + 0xF4,0xC2,0xC6,0xD2,0xF2,0xE2,0xD6,0xF6, + 0xE6,0xD4,0xF1,0xF0,0xE3,0xFF,0xDC,0xF9, + 0x80,0xAE,0x90,0xBC,0xAB,0xA9,0xAF,0x84, + 0xB7,0xBE,0xA1,0xAC,0xA0,0xA4,0xA8,0x8C, + 0xB4,0x82,0x86,0x92,0xB2,0xA2,0x96,0xB6, + 0xA6,0x94,0xB1,0xB0,0xA3,0xBF,0x9C,0xB9 +}; + +void +InitBraille() +{ + bd.bd_start_braille=0; + bd.bd_port = 0; + bd.bd_braille_table = SaveStr("internal us-braille.tbl"); + bd.bd_type = 0; + bd.bd_baud = 9600; + bd.bd_bell = 1; + bd.bd_eightdot = 1; + bd.bd_info = 0; + bd.bd_link = 1; + bd.bd_ncells = 0; + bd.bd_width = 0; + bd.bd_ncrc = 1; + bd.bd_scroll = 1; + bd.bd_skip = 0; + bd.bd_using_braille = 0; + bd.bd_obuflen = 0; + bd.bd_fd = -1; + bcopy((char *)btable_local, bd.bd_btable, 256); +} + +static int +initialize_braille_display_type(s) +char *s; +{ + int i; + + for (i = 0; i < sizeof(bd_typelist)/sizeof(*bd_typelist); i++) + if (!strcmp(s, bd_typelist[i].name)) + break; + if (i == sizeof(bd_typelist)/sizeof(*bd_typelist)) + { + Msg(0, "No entry for bd_type: %s ", s); + return -1; + } + bd.bd_type = bd_typelist[i].name; + if ((*bd_typelist[i].init)()) + return -1; + + if (!bd.bd_width) + bd.bd_width = bd.bd_ncells; + + return 0; +} + +void +StartBraille() +{ + bd.bd_dpy = displays; + + debug("StartBraille called\n"); + evdeq(&bd.bd_readev); + evdeq(&bd.bd_writeev); + evdeq(&bd.bd_selectev); + bd.bd_using_braille = 0; + + if (!bd.bd_start_braille) + return; + + if (bd.bd_type == 0 || bd.bd_port == 0) + return; + + if (bd.bd_fd < 0 && open_braille_device()) + { + Msg(0, "bd_port turned off"); + free(bd.bd_port); + bd.bd_port = 0; + return; + } + + /* check if braille display is connected and turned on */ + if (bd.bd_response_test()) + { + Msg(0, "Make sure that braille display is connected and turned on. "); + Msg(0, "start_braille turned off"); + bd.bd_start_braille = 0; + } + else + { + bd.bd_using_braille = 1; + bd.bd_readev.fd = bd.bd_writeev.fd = bd.bd_fd; + bd.bd_readev.type = EV_READ; + bd.bd_writeev.type = EV_WRITE; + bd.bd_selectev.type = EV_ALWAYS; + bd.bd_readev.data = bd.bd_writeev.data = bd.bd_selectev.data = (char *)&bd; + bd.bd_readev.handler = bd_readev_fn; + bd.bd_writeev.handler = bd_writeev_fn; + bd.bd_selectev.handler = bd_selectev_fn; + evenq(&bd.bd_readev); + bd.bd_writeev.condpos = &bd.bd_obuflen; + bd.bd_writeev.condneg = 0; + evenq(&bd.bd_writeev); + bd.bd_selectev.pri = -20; + evenq(&bd.bd_selectev); + } +} + + +static int +load_braille_table(tablename) +char *tablename; +{ + int i, j, c, p; + FILE *fp; + char buffer[80], a[10]; + + if ((fp = fopen(tablename, "r")) == 0) + { + Msg(0, "Braille table not found: %s ", tablename); + return -1; + } + bzero(bd.bd_btable, 256); + while (fgets(buffer, sizeof(buffer), fp)) + { + if (buffer[0] == '#') + continue; + sscanf(buffer,"%d %x %s", &i, &j, a); + for (j=1, p=1, c=0; j<9; j++, p*=2) + if (a[j] == '0' + j) + c += p; + bd.bd_btable[i] = c; + } + fclose(fp); + return 0; +} + + +static int +open_braille_device(s) +char *s; +{ + char str[256]; + + sprintf(str, "%d cs8 -istrip ixon ixoff", bd.bd_baud); + bd.bd_fd = OpenTTY(bd.bd_port, str); + if (bd.bd_fd == -1) + { + Msg(errno, "open comm port failed: %s ", bd.bd_port); + return -1; + } + fcntl(bd.bd_fd, F_SETFL, FNBLOCK); + return 0; +} + + +static void +position_braille_cursor() +{ + int sx = bd.bd_sx; + int bx = BD_FORE->w_bd_x; + int eol = BD_FORE->w_width; + int w = bd.bd_width; + + if (bd.bd_scroll) + bx = sx - w + bd.bd_ncrc; /* keep rc centered in window */ + else + bx = w * (int)(sx / w); /* increase bc in integral steps */ + + if (bx > eol - w) + bx = eol - w; + if (bx < 0) + bx = 0; + BD_FORE->w_bd_x = bx; + BD_FORE->w_bd_y = bd.bd_sy; +} + + +void +RefreshBraille() +{ + int i, y, xs, xe; + int cursor_pos; + + if (!bd.bd_using_braille) + return; + if (!BD_FORE) + return; + bcopy(bd.bd_line, bd.bd_oline, bd.bd_ncells); + bd.bd_refreshing = 1; + flayer = bd.bd_dpy->d_forecv->c_layer; + bd.bd_sx = flayer->l_x; + bd.bd_sy = flayer->l_y; + display = bd.bd_dpy; + if ((D_obufp != D_obuf) && bd.bd_link) + { + /* jump to real cursor */ + debug("calling position_braille_cursor\n"); + position_braille_cursor(); + } + bclear(bd.bd_line, bd.bd_ncells); + + y = BD_FORE->w_bd_y; + xs = BD_FORE->w_bd_x; + + if (bd.bd_info & 1) + { + sprintf(bd.bd_line, "%02d%02d", (BD_FORE->w_bd_x + 1) % 100, (BD_FORE->w_bd_y + 1) % 100); + bd.bd_line[4] = ' '; + } + if (bd.bd_info & 2) + { + sprintf(bd.bd_line + bd.bd_ncells - 4, "%02d%02d",(bd.bd_sx +1) % 100, (bd.bd_sy +1) % 100); + } + + xe = xs + bd.bd_width - 1; + + if (xs > flayer->l_width - 1) + xs = flayer->l_width - 1; + if (xe > flayer->l_width - 1) + xe = flayer->l_width - 1; + + if (D_status) + { + sprintf(bd.bd_line, "**%-*.*s", bd.bd_ncells - 2, bd.bd_ncells - 2, D_status_lastmsg ? D_status_lastmsg : "unknown msg"); + xs = xe = -1; + } + else if (xs <= xe) + { + RedisplayLine(-1, xs, xe, 1); + RedisplayLine(y, xs, xe, 1); + } + + debug1("Braille: got >%s<\n", bd.bd_line); + + bd.bd_refreshing = 0; + + if (y == bd.bd_sy && xs <= bd.bd_sx && bd.bd_sx <= xe) + cursor_pos = bd.bd_sx - xs + (bd.bd_info & 1 ? 4 : 0); + else + cursor_pos = bd.bd_ncells; + for (i = 0; i < bd.bd_ncells; i++) + if (bd.bd_line[i] != bd.bd_oline[i]) + break; + if (bd.bd_cursorpos != cursor_pos || i < bd.bd_ncells) + bd.write_line_braille(bd.bd_line, bd.bd_ncells, cursor_pos); + bd.bd_cursorpos = cursor_pos; +} + + +/********************************************************************** + * + */ + +/* + * So, why is there a Flush() down below? The reason is simple: the + * cursor warp (if bd_link is on) checks the obuf to see if something + * happened. If there would be no Flush, screen would warp the + * bd cursor if a bd movement command tries to ring the bell. + * (In other words: this is a gross hack!) + */ +static void +bd_signal() +{ + if (!bd.bd_bell) + return; + display = bd.bd_dpy; + if (D_obufp != D_obuf) + PutStr(D_BL); + else + { + PutStr(D_BL); + Flush(); + } +} + +static int +bd_do_search(y, xs, xe) +int y, xs, xe; +{ + int oy = BD_FORE->w_bd_y; + + if (!bd.bd_skip) /* no skip mode, found it */ + { + if (xs > xe) + return 0; + bd.bd_searchmin = xs; + bd.bd_searchmax = xe; + return 1; + } + flayer = bd.bd_dpy->d_forecv->c_layer; + bd.bd_searchmax = -1; + bd.bd_searchmin = flayer->l_width; + if (xs <= xe) + { + BD_FORE->w_bd_y = y; /* stupid hack */ + bd.bd_refreshing = bd.bd_searching = 1; + bd.bd_searchstart = xs; + bd.bd_searchend = xe; + RedisplayLine(-1, xs, xe, 1); + RedisplayLine(y, xs, xe, 1); + bd.bd_refreshing = bd.bd_searching = 0; + BD_FORE->w_bd_y = oy; + } + return bd.bd_searchmax >= 0; +} + +static void +bd_normalize(x, y) +int x, y; +{ + if (x > BD_FORE->w_width - bd.bd_width) + x = BD_FORE->w_width - bd.bd_width; + if (x < 0) + x = 0; + if (y < 0) + { + bd_signal(); + y = 0; + } + if (y >= BD_FORE->w_height) + { + bd_signal(); + y = BD_FORE->w_height - 1; + } + if (x != BD_FORE->w_bd_x || y != BD_FORE->w_bd_y) + bd.bd_moved = 1; + BD_FORE->w_bd_x = x; + BD_FORE->w_bd_y = y; +} + +static void +bd_bc_left() +{ + int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y; + int ex; + + ex = bx - 1; + bx = 0; + for (; by >= 0; by--) + { + if (bd_do_search(by, 0, ex)) + { + if (!bd.bd_skip && by != BD_FORE->w_bd_y) + bd_signal(); + bx = bd.bd_searchmax + 1 - bd.bd_width; + break; + } + ex = BD_FORE->w_width - 1; + } + bd_normalize(bx, by); +} + +static void +bd_bc_right() +{ + int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y; + int sx; + + sx = bx + bd.bd_width; + bx = BD_FORE->w_width - bd.bd_width; + for (; by < BD_FORE->w_height; by++) + { + if (bd_do_search(by, sx, BD_FORE->w_width - 1)) + { + if (!bd.bd_skip && by != BD_FORE->w_bd_y) + bd_signal(); + bx = bd.bd_searchmin; + break; + } + sx = 0; + } + bd_normalize(bx, by); +} + +static void +bd_bc_up() +{ + int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y; + + for (by--; by >= 0; by--) + if (bd_do_search(by, bx, bx + bd.bd_width - 1)) + break; + bd_normalize(bx, by); +} + +static void +bd_bc_down() +{ + int bx = BD_FORE->w_bd_x, by = BD_FORE->w_bd_y; + + for (by++; by < BD_FORE->w_height; by++) + if (bd_do_search(by, bx, bx + bd.bd_width - 1)) + break; + bd_normalize(bx, by); +} + + +static void +bd_upper_left() +{ + bd_normalize(0, 0); +} + + +static void +bd_upper_right() +{ + bd_normalize(BD_FORE->w_width - bd.bd_width, 0); +} + + +static void +bd_lower_left() +{ + bd_normalize(0, BD_FORE->w_height - 1); +} + + +static void +bd_lower_right() +{ + bd_normalize(BD_FORE->w_width - bd.bd_width, BD_FORE->w_height -1); +} + +/********************************************************************** + * + */ + + +static void +bd_check(x, c) +int x, c; +{ + if (c == ' ') + return; + if (x < bd.bd_searchstart || x > bd.bd_searchend) + return; + if (x > bd.bd_searchmax) + bd.bd_searchmax = x; + if (x < bd.bd_searchmin) + bd.bd_searchmin = x; +} + + + +/*ARGSUSED*/ +void +BGotoPos(la, x, y) +struct layer *la; +int x, y; +{ +} + +/*ARGSUSED*/ +void +BCDisplayLine(la, ml, y, xs, xe, isblank) +struct layer *la; +struct mline *ml; +int y, xs, xe; +int isblank; +{ + int x; + int sx, ex; + char *l; + + if (y != BD_FORE->w_bd_y) + return; + if (bd.bd_searching) + { + for (x = xs; x <= xe; x++) + bd_check(x, ml->image[x]); + return; + } + l = bd.bd_line; + sx = BD_FORE->w_bd_x; + ex = sx + bd.bd_width - 1; + if (bd.bd_info & 1) + l += 4; + for (x = xs; x <= xe; x++) + if (x >= sx && x <= ex) + l[x - sx] = ml->image[x]; +} + +/*ARGSUSED*/ +void +BPutChar(la, c, x, y) +struct layer *la; +struct mchar *c; +int x, y; +{ + int sx, ex; + char *l; + + if (y != BD_FORE->w_bd_y) + return; + if (bd.bd_searching) + { + bd_check(x, c->image); + return; + } + l = bd.bd_line; + sx = BD_FORE->w_bd_x; + ex = sx + bd.bd_width - 1; + if (bd.bd_info & 1) + l += 4; + if (x >= sx && x <= ex) + l[x - sx] = c->image; +} + +/*ARGSUSED*/ +void +BPutStr(la, s, n, r, x, y) +struct layer *la; +char *s; +int n; +struct mchar *r; +int x, y; +{ + int sx, ex; + char *l; + + if (y != BD_FORE->w_bd_y) + return; + if (bd.bd_searching) + { + for (; n > 0; n--, s++, x++) + bd_check(x, *s); + return; + } + l = bd.bd_line; + sx = BD_FORE->w_bd_x; + ex = sx + bd.bd_width - 1; + if (bd.bd_info & 1) + l += 4; + for (; n > 0; n--, s++, x++) + if (x >= sx && x <= ex) + l[x - sx] = *s; +} + + + +/********************************************************************** + * + */ + +static char *infonames[] = {"none", "bc", "sc", "bc+sc"}; + +void +DoBrailleAction(act, msgok) +struct action *act; +int msgok; +{ + int nr, dosig; + int n, l, o; + char *s, **args; + struct stat st; + + nr = act->nr; + args = act->args; + dosig = display && !*rc_name; + + switch(nr) + { + case RC_BD_BELL: + if (ParseSwitch(act, &bd.bd_bell) || !msgok) + { + bd_signal(); + break; + } + Msg(0, bd.bd_bell ? "bd_bell is on." : "bd_bell is off."); + break; + + case RC_BD_EIGHTDOT: + if (ParseSwitch(act, &bd.bd_eightdot) || !msgok) + break; + Msg(0, "switched to %d-dots system.", bd.bd_eightdot ? 8 : 6); + break; + + case RC_BD_INFO: + n = bd.bd_info; + if (*args) + { + if (strlen(*args) == 4) + n = args[0][n] - '0'; + else if (ParseNum(act, &n)) + break; + } + if (n < 0 && n > 3) + { + Msg(0, "Out of range; 0 <= bd_info >= 3 "); + break; + } + /* bd_width at the beginning is unknown */ + if (bd.bd_width == 0) + break; + + o = (bd.bd_info * 2 + 2) & 12; + l = (n * 2 + 2) & 12; + if (l >= bd.bd_ncells) + { + Msg(0, "bd_info is too large for braille display."); + break; + } + if (l >= bd.bd_width + o) + { + Msg(0, "bd_info is too large for bd_width."); + break; + } + bd.bd_width += o - l; + bd.bd_info = n; + + if (msgok) + Msg(0, "bd_info is %s.", infonames[n]); + position_braille_cursor(); + break; + + case RC_BD_LINK: + if (*args == 0 && bd.bd_moved) + bd.bd_link = 0; + if (ParseSwitch(act, &bd.bd_link)) + break; + if (bd.bd_link) + { + bd.bd_moved = 0; + if (dosig) + bd_signal(); + position_braille_cursor(); + } + if (msgok) + Msg(0, bd.bd_link ? "bd_link is on." : "bd_link is off."); + break; + + case RC_BD_SKIP: + if (ParseSwitch(act, &bd.bd_skip)) + break; + if (bd.bd_skip && dosig) + bd_signal(); + if (msgok) + Msg(0, bd.bd_skip ? "bd_skip is on." : "bd_skip is off."); + break; + + case RC_BD_SCROLL: + if (ParseSwitch(act, &bd.bd_scroll) || !msgok) + { + position_braille_cursor(); + break; + } + Msg(0, bd.bd_scroll ? "bd_scroll is on." : "bd_scroll is off."); + break; + + case RC_BD_NCRC: + n = bd.bd_ncrc; + if (*args) + { + if (args[0][0] == '+') + n = (n + atoi(*args + 1)) % bd.bd_width + 1; + else if (args[0][0] == '-') + n = (n - atoi(*args + 1)) % bd.bd_width + 1; + else if (ParseNum(act, &n)) + break; + } + if (n < 1 || n > bd.bd_width) + { + Msg(0, "Out of range; 1 <= bd_ncrc >= %d", bd.bd_width); + break; + } + bd.bd_ncrc = n; + if (msgok) + Msg(0, "bd_ncrc status is: %d ", bd.bd_ncrc); + position_braille_cursor(); + break; + + case RC_BD_BRAILLE_TABLE: + s = 0; + if (*args) + { + if (ParseSaveStr(act, &s)) + break; + if (load_braille_table(s)) + { + free(s); + break; + } + if (bd.bd_braille_table) + free(bd.bd_braille_table); + bd.bd_braille_table = s; + } + if (msgok) + Msg(0, "bd_braille_table is: %s ", bd.bd_braille_table); + break; + + case RC_BD_PORT: + s = 0; + if (*args) + { + if (ParseSaveStr(act, &s)) + break; + + if (stat(s, &st) || !S_ISCHR(st.st_mode) || access(s, R_OK|W_OK)) + { + Msg(0, "Cannot access braille device port %s", s); + free(s); + break; + } + if (bd.bd_fd >= 0) + close(bd.bd_fd); + bd.bd_fd = -1; + if (bd.bd_port) + free(bd.bd_port); + bd.bd_port = s; + } + if (msgok) + Msg(0, "bd_port is: %s ", bd.bd_port ? bd.bd_port : "not set"); + StartBraille(); + break; + + case RC_BD_TYPE: + s = 0; + if (*args) + if (ParseSaveStr(act, &s) || initialize_braille_display_type(s)) + break; + if (msgok) + Msg(0, "bd_type is: %s ", bd.bd_type ? bd.bd_type : "not set"); + StartBraille(); + break; + + case RC_BD_START_BRAILLE: + if (ParseSwitch(act, &bd.bd_start_braille)) + break; + if (msgok) + Msg(0, bd.bd_start_braille ? "bd_start_braille is on." : "bd_start_braille is off."); + StartBraille(); + break; + + case RC_BD_WIDTH: + n = bd.bd_width; + if (*args) + { + if (ParseNum(act, &n)) + break; + } + if (n <= 0) + { + Msg(0, "Invalid value for bd_width: %d ", n); + break; + } + l = (bd.bd_info * 2 + 2) & 12; + if (n > bd.bd_ncells - l || n < l) + { + Msg(0, "bd_info is too large for bd_width."); + break; + } + bd.bd_width = n; + if (msgok) + Msg(0, "bd_width is: %d ", bd.bd_width); + break; + + case RC_BD_BC_LEFT: + bd_bc_left(); + break; + + case RC_BD_BC_RIGHT: + bd_bc_right(); + break; + + case RC_BD_BC_UP: + bd_bc_up(); + break; + + case RC_BD_BC_DOWN: + bd_bc_down(); + break; + + case RC_BD_UPPER_LEFT: + bd_upper_left(); + break; + + case RC_BD_UPPER_RIGHT: + bd_upper_right(); + break; + + case RC_BD_LOWER_LEFT: + bd_lower_left(); + break; + + case RC_BD_LOWER_RIGHT: + bd_lower_right(); + break; + + default: + break; + } +} + +static void +bd_readev_fn(ev, data) +struct event *ev; +char *data; +{ + bd.buttonpress(); +} + +static void +bd_writeev_fn(ev, data) +struct event *ev; +char *data; +{ + int len; + + if (bd.bd_obuflen == 0) + return; + if ((len = write(bd.bd_fd, bd.bd_obuf, bd.bd_obuflen)) < 0) + len = bd.bd_obuflen; /* dead braille display */ + if ((bd.bd_obuflen -= len)) + bcopy(bd.bd_obuf + len, bd.bd_obuf, bd.bd_obuflen); +} + +static void +bd_selectev_fn(ev, data) +struct event *ev; +char *data; +{ + RefreshBraille(); +} + +#endif /* HAVE_BRAILLE */ diff --git a/src/braille.h b/src/braille.h new file mode 100644 index 0000000..51fa2ea --- /dev/null +++ b/src/braille.h @@ -0,0 +1,80 @@ +/* + * Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu + * Bill Barry barryb@dots.physics.orst.edu + * Randy Lundquist randyl@dots.physics.orst.edu + * + * Modifications Copyright (c) 1995 by + * Science Access Project, Oregon State University. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING); if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + **************************************************************** + * $Id$ FAU + */ + +extern void StartBraille __P((void)); + +struct braille_display +{ + struct display *bd_dpy; /* display we are connected to */ + int bd_start_braille; /* screenrc var to request to turn braille on */ + int bd_using_braille; /* all is fine, use braille */ + struct event bd_readev; + struct event bd_writeev; + struct event bd_selectev; + int bd_fd; /* file descriptor */ + int bd_obuflen; /* current number of charactors in output buffer */ + char bd_obuf[IOSIZE]; + int bd_info; /* default, no info, 0,1,2,3 */ + int bd_ncrc; /* default 1, numbers of cells on the right side of real cursor, 1...bd_width */ + int bd_skip; /* default off, on/off */ + int bd_link; /* default, linked, on/off */ + int bd_width; /* length of braille display to use, <=bd_ncells */ + int bd_scroll; /* default on, scroll on/off */ + char *bd_braille_table; /* braille code */ + + int bd_bell; /* bell used for navigation on/off */ + int bd_ncells; /* real number of cells on braille display */ + int bd_eightdot; /* eightdot on/off */ + int bd_baud; /* communication baudrate between port and braille display */ + char *bd_port; /* serial port to use */ + char *bd_type; /* kind of braille display */ + double bd_version; /* rom version of braille display */ + char bd_btable[256]; /* braille translation table */ + + /* functions which communicate with braille displays */ + int (*write_line_braille) __P((char [],int, int)); + void (*buttonpress) __P((void)); + int (*bd_response_test) __P((void)); + + int bd_refreshing; /* are we doing a refresh? */ + char bd_line[40+1]; /* bd_ncells chars displayed on braille */ + int bd_cursorpos; /* cursor position on braille */ + char bd_oline[40+1]; /* bd_ncells chars displayed on braille */ + int bd_sx, bd_sy; /* screen cursor pos */ + int bd_moved; /* used braille move keys */ + + int bd_searching; /* are we seaching (bd_skip is on) */ + int bd_searchmax; /* search: max x */ + int bd_searchmin; /* search: min x */ + int bd_searchstart; + int bd_searchend; +}; + +extern struct braille_display bd; + +#define BD_FORE bd.bd_dpy->d_fore + diff --git a/src/braille_tsi.c b/src/braille_tsi.c new file mode 100644 index 0000000..390db07 --- /dev/null +++ b/src/braille_tsi.c @@ -0,0 +1,317 @@ +/* bd-tsi.c, TSI specific key bindings and display commands + * + * dotscreen + * A braille interface to unix tty terminals + * Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu + * Bill Barry barryb@dots.physics.orst.edu + * + * Copyright (c) 1995 by Science Access Project, Oregon State University. + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING); if not, write to the + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + **************************************************************** + * $Id$ + */ + +#include "config.h" +#include "screen.h" +#include "extern.h" +#include "braille.h" + +#ifdef HAVE_BRAILLE + +extern struct display *display; + +struct key2rc { + int key; + int nr; + char *arg1; + char *arg2; +}; + + +static int tsi_ctype = 1; /* cursor type, 0,1,2 */ + +static int tsi_line_type; /* indicates number of cells on powerbraille + display 01=20 cells 02=40 cells 03=80 cells */ + +static int display_status_tsi __P((void)); +static int write_line_tsi __P((char *, int, int)); +static void buttonpress_tsi __P((struct key2rc *)); +static void buttonpress_navigator_40 __P((void)); +static void buttonpress_powerbraille_40 __P((void)); +static void buttonpress_powerbraille_80 __P((void)); + +int +bd_init_powerbraille_40() +{ + bd.write_line_braille = write_line_tsi; + bd.buttonpress = buttonpress_powerbraille_40; + bd.bd_response_test = display_status_tsi; + bd.bd_ncells = 40; + tsi_line_type = 2; + return 0; +} + +int +bd_init_powerbraille_80() +{ + bd.write_line_braille = write_line_tsi; + bd.buttonpress = buttonpress_powerbraille_80; + bd.bd_response_test = display_status_tsi; + bd.bd_ncells = 80; + tsi_line_type = 3; + return 0; +} + +int +bd_init_navigator_40() +{ + bd.write_line_braille = write_line_tsi; + bd.buttonpress = buttonpress_navigator_40; + bd.bd_response_test = display_status_tsi; + bd.bd_ncells = 40; + tsi_line_type = 2; + return 0; +} + +static int +display_status_tsi() +{ + char obuf[3],ibuf[20]; + int r; + + obuf[0] = 0xff; + obuf[1] = 0xff; + obuf[2] = 0x0a; + r = read(bd.bd_fd, ibuf, 20); /* flush the input port */ + r = write(bd.bd_fd, obuf, 3); + if (r != 3) + return -1; + + /* we have written to the display asking for a response + we wait 1 second for the response, read it and if no + response we wait 2 seconds, if still no response, + return -1 to indicate no braille display available */ + sleep(1); + r = read(bd.bd_fd, ibuf, 2); + if (r == -1) + { + sleep(2); + r = read(bd.bd_fd, ibuf, 2); + } + debug2("first chars from braille display %d %d\n",ibuf[0],ibuf[1]); + if (r != 2 || ibuf[0] != 0 || ibuf[1] != 5) + return -1; + + r= read(bd.bd_fd,ibuf,2); + if (r != 2) + return -1; + debug2("braille display size:%d dots:%d\n", ibuf[0], ibuf[1]); + bd.bd_ncells = (unsigned char)ibuf[0]; + if (bd.bd_ncells <= 1) + return -1; + r = read(bd.bd_fd,ibuf,1); + if (r != 1) + return -1; + if (r != -1) + if (ibuf[0] == 'V') + r = read(bd.bd_fd, ibuf, 3); + else + r = read(bd.bd_fd, ibuf + 1, 2) + 1; + if (r != 3) + return -1; + ibuf[3] = 0; + debug1("braille display version %s\n", ibuf); + bd.bd_version = atof(ibuf); + return 0; +} + + +static int +write_line_tsi (bstr,line_length, cursor_pos) +char *bstr; +int line_length, cursor_pos; +{ + int obp, i; + bd.bd_obuf[0] = 0xff; + bd.bd_obuf[1] = 0xff; + bd.bd_obuf[2] = tsi_line_type; + bd.bd_obuf[3] = 0x07; + bd.bd_obuf[4] = cursor_pos; + bd.bd_obuf[5] = tsi_ctype; + obp=6; + + for (i=0; i < line_length; i++) + { + bd.bd_obuf[2*i+obp] = 0; + bd.bd_obuf[2*i+1+obp] = bd.bd_btable[(int)(unsigned char)bstr[i]]; + } + for (i=line_length; i < bd.bd_ncells; i++) + { + bd.bd_obuf[2*i+obp] = 0; + bd.bd_obuf[2*i+1+obp] = bd.bd_btable[(int)' ']; + } + + bd.bd_obuflen = 2*bd.bd_ncells + obp ; + return 0; +} + +static struct key2rc keys_navigator_40[] = { + {0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */ + {0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */ + {0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */ + {0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */ + {0x2000, RC_BD_BC_LEFT, 0, 0}, /* 6 */ + {0x8000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */ + {0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */ + {0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */ + {0x6000, RC_BD_UPPER_LEFT, 0, 0}, /* 6, 7 */ + {0xc000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */ + {0x12000, RC_BD_LOWER_LEFT, 0, 0}, /* 6, 9 */ + {0x18000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */ + {0xa000, RC_BD_INFO, "1032", 0}, /* bc 6, 8 */ + {0x14000000, RC_BD_INFO, "2301", 0}, /* sc 1, 3 */ + {0x4008000, RC_BD_INFO, "3330", 0}, /* bc+sc 1, 8 */ + {0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */ + {0x8004000, RC_BD_EIGHTDOT, 0, 0}, /* 2, 7 */ + {0x40000000, RC_STUFF, "\015", 0}, /* 5 */ + {0x20000, RC_BD_LINK, 0, 0}, /* 10 */ + {0x10002000, RC_BD_SCROLL, 0, 0}, /* 3, 6 */ + {0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */ + {0x14000, RC_BD_SKIP, 0, 0}, /* 7, 9*/ + {-1, RC_ILLEGAL, 0, 0} +}; + +static struct key2rc keys_powerbraille_40[] = { + {0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */ + {0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */ + {0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */ + {0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */ + {0x2000, RC_BD_BC_LEFT, 0, 0}, /* 6 */ + {0x8000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */ + {0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */ + {0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */ + {0x8002000, RC_BD_UPPER_LEFT, 0, 0}, /* 2, 6 */ + {0xc000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */ + {0x20002000, RC_BD_LOWER_LEFT, 0, 0}, /* 3, 6 */ + {0x18000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */ + {0x8008000, RC_BD_INFO, "1032", 0}, /* bc 2, 8 */ + {0x6000, RC_BD_INFO, "2301", 0}, /* 6, 7 */ + {0x8004000, RC_BD_INFO, "3330", 0}, /* bc+sc 2, 7 */ + {0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */ + {0x20008000, RC_BD_EIGHTDOT, 0, 0}, /* 4, 6 */ + {0x40000000, RC_STUFF, "\015", 0}, /* 5 */ + {0x20000, RC_BD_LINK, 0, 0}, /* 10 */ + {0xa000, RC_BD_SCROLL, 0, 0}, /* 6, 8 */ + {0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */ + {0x20004000, RC_BD_SKIP, 0, 0}, /* 4, 7 */ + {-1, RC_ILLEGAL, 0, 0} +}; + + +static struct key2rc keys_powerbraille_80[] = { + {0x4000000, RC_STUFF, "-k", "kl"}, /* 1 */ + {0x10000000, RC_STUFF, "-k", "kr"}, /* 3 */ + {0x8000000, RC_STUFF, "-k", "ku"}, /* 2 */ + {0x20000000, RC_STUFF, "-k", "kd"}, /* 4 */ + {0x40000, RC_BD_BC_LEFT, 0, 0}, /* 6 */ + {0x100000, RC_BD_BC_RIGHT, 0, 0}, /* 8 */ + {0x4000, RC_BD_BC_UP, 0, 0}, /* 7 */ + {0x10000, RC_BD_BC_DOWN, 0, 0}, /* 9 */ + {0x44000, RC_BD_UPPER_LEFT, 0, 0}, /* 6, 7 */ + {0x104000, RC_BD_UPPER_RIGHT, 0, 0}, /* 7, 8 */ + {0x50000, RC_BD_LOWER_LEFT, 0, 0}, /* 6, 9 */ + {0x110000, RC_BD_LOWER_RIGHT, 0, 0}, /* 8, 9 */ + {0x8100000, RC_BD_INFO, "1032", 0}, /* 2, 8 */ + {0x8040000, RC_BD_INFO, "2301", 0}, /* 2, 6 */ + {0x140000, RC_BD_INFO, "3330", 0}, /* 6, 8 */ + {0x8010000, RC_BD_BELL, 0, 0}, /* 2, 9 */ + {0x8004000, RC_BD_EIGHTDOT, 0, 0}, /* 2, 7 */ + {0x40000000, RC_STUFF, "\015", 0}, /* 5 */ + {0x20000, RC_BD_LINK, 0, 0}, /* 10 */ + {0x20004000, RC_BD_SCROLL, 0, 0}, /* 4, 7 */ + {0x20010000, RC_BD_NCRC, "+", 0}, /* 4, 9 */ + {0x40010000, RC_BD_SKIP, 0, 0}, /* 5, 9 */ + {-1, RC_ILLEGAL, 0, 0} +}; + +static void +buttonpress_tsi(tab) +struct key2rc *tab; +{ + int i, nb; + int bkeys; + unsigned char buf[10]; + nb = read(bd.bd_fd, buf, 10); + debug1("buttonpress_tsi: read %d bytes\n", nb); + for (i=0, bkeys=0; i < nb; i++) + { + switch (buf[i] & 0xE0) + { + case 0x00: bkeys += ((int)(buf[i] & 0x1f) ); break; + case 0x20: bkeys += ((int)(buf[i] & 0x1f) << 5 ); break; + case 0x40: bkeys += ((int)(buf[i] & 0x1f) << 9 ); break; + case 0x60: bkeys += ((int)(buf[i] & 0x1f) << 13 ); break; + case 0xA0: bkeys += ((int)(buf[i] & 0x1f) << 18 ); break; + case 0xC0: bkeys += ((int)(buf[i] & 0x1f) << 22 ); break; + case 0xE0: bkeys += ((int)(buf[i] & 0x1f) << 26 ); break; + default: break; + } + } + debug1("bkeys %x\n", bkeys); + for (i = 0; tab[i].key != -1; i++) + if (bkeys == tab[i].key) + break; + debug1("bkey index %d\n", i); + if (tab[i].key != -1 && tab[i].nr != RC_ILLEGAL) + { + char *args[3]; + + struct action act; + args[0] = tab[i].arg1; + args[1] = tab[i].arg2; + args[2] = 0; + act.nr = tab[i].nr; + act.args = args; + display = bd.bd_dpy; + DoAction(&act, -2); + } +} + + +static void +buttonpress_navigator_40() +{ + buttonpress_tsi(keys_navigator_40); +} + +static void +buttonpress_powerbraille_40() +{ + buttonpress_tsi(keys_powerbraille_40); +} + +static void +buttonpress_powerbraille_80() +{ + buttonpress_tsi(keys_powerbraille_80); +} + +#endif /* HAVE_BRAILLE */ + + diff --git a/src/comm.c b/src/comm.c index 3970fc2..64fa8ce 100644 --- a/src/comm.c +++ b/src/comm.c @@ -3,6 +3,15 @@ * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) * Copyright (c) 1987 Oliver Laumann * +#ifdef HAVE_BRAILLE + * Modified by: + * Authors: Hadi Bargi Rangin bargi@dots.physics.orst.edu + * Bill Barry barryb@dots.physics.orst.edu + * + * Modifications Copyright (c) 1995 by + * Science Access Project, Oregon State University. +#endif + * * 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) @@ -28,196 +37,251 @@ RCS_ID("$Id$ FAU") #include "acls.h" #include "comm.h" +#define bcopy :-( /* or include screen.h here */ + /* Must be in alpha order ! */ struct comm comms[RC_LAST + 1] = { #ifdef MULTIUSER - { "acladd", ARGS_ONE }, - { "aclchg", ARGS_THREE }, - { "acldel", ARGS_ONE }, - { "aclgrp", ARGS_ONE }, -#endif - { "activity", ARGS_ONE }, - { "aka", NEED_FORE|ARGS_ZEROONE }, /* TO BE REMOVED */ - { "allpartial", NEED_DISPLAY|ARGS_ONE }, - { "at", NEED_DISPLAY|ARGS_TWO|ARGS_ORMORE }, - { "autodetach", ARGS_ONE }, + { "acladd", ARGS_1234 }, + { "aclchg", ARGS_23 }, + { "acldel", ARGS_1 }, + { "aclgrp", ARGS_12 }, + { "aclumask", ARGS_1|ARGS_ORMORE }, +#endif + { "activity", ARGS_1 }, +#ifdef MULTIUSER + { "addacl", ARGS_1234 }, +#endif + { "allpartial", NEED_DISPLAY|ARGS_1 }, + { "at", NEED_DISPLAY|ARGS_2|ARGS_ORMORE }, + { "autodetach", ARGS_1 }, #ifdef AUTO_NUKE - { "autonuke", NEED_DISPLAY|ARGS_ONE }, + { "autonuke", NEED_DISPLAY|ARGS_1 }, #endif - { "bell", ARGS_ZEROONE }, - { "bell_msg", ARGS_ZEROONE }, - { "bind", ARGS_ONE|ARGS_ORMORE }, + +#ifdef HAVE_BRAILLE +/* keywords for braille display (bd) */ + { "bd_bc_down", ARGS_0 }, + { "bd_bc_left", ARGS_0 }, + { "bd_bc_right", ARGS_0 }, + { "bd_bc_up", ARGS_0 }, + { "bd_bell", ARGS_01 }, + { "bd_braille_table", ARGS_01 }, + { "bd_eightdot", ARGS_01 }, + { "bd_info", ARGS_01 }, + { "bd_link", ARGS_01 }, + { "bd_lower_left", ARGS_0 }, + { "bd_lower_right", ARGS_0 }, + { "bd_ncrc", ARGS_01 }, + { "bd_port", ARGS_01 }, + { "bd_scroll", ARGS_01 }, + { "bd_skip", ARGS_01 }, + { "bd_start_braille", ARGS_01 }, + { "bd_type", ARGS_01 }, + { "bd_upper_left", ARGS_0 }, + { "bd_upper_right", ARGS_0 }, + { "bd_width", ARGS_01 }, +#endif + + { "bell", ARGS_01 }, + { "bell_msg", ARGS_01 }, + { "bind", ARGS_1|ARGS_ORMORE }, #ifdef MAPKEYS - { "bindkey", ARGS_ZERO|ARGS_ORMORE }, + { "bindkey", ARGS_0|ARGS_ORMORE }, #endif - { "break", NEED_FORE|ARGS_ZEROONE }, + { "break", NEED_FORE|ARGS_01 }, + { "breaktype", NEED_FORE|ARGS_01 }, #ifdef COPY_PASTE - { "bufferfile", ARGS_ZEROONE }, + { "bufferfile", ARGS_01 }, #endif - { "c1", NEED_FORE|ARGS_ZEROONE }, - { "charset", NEED_FORE|ARGS_ONE }, - { "chdir", ARGS_ZEROONE }, - { "clear", NEED_FORE|ARGS_ZERO }, -#ifdef MULTI - { "clone", NEED_DISPLAY|ARGS_ONE|ARGS_ORMORE }, + { "c1", NEED_FORE|ARGS_01 }, + { "caption", ARGS_12 }, +#ifdef MULTIUSER + { "chacl", ARGS_23 }, +#endif + { "charset", NEED_FORE|ARGS_1 }, + { "chdir", ARGS_01 }, + { "clear", NEED_FORE|ARGS_0 }, + { "colon", NEED_DISPLAY|ARGS_01 }, + { "command", NEED_DISPLAY|ARGS_0 }, +#ifdef COPY_PASTE + { "compacthist", ARGS_01 }, #endif - { "colon", NEED_DISPLAY|ARGS_ZEROONE }, - { "command", NEED_DISPLAY|ARGS_ZERO }, - { "console", NEED_FORE|ARGS_ZEROONE }, + { "console", NEED_FORE|ARGS_01 }, #ifdef COPY_PASTE - { "copy", NEED_FORE|ARGS_ZERO }, - { "crlf", ARGS_ZEROONE }, + { "copy", NEED_FORE|ARGS_0 }, + { "crlf", ARGS_01 }, #endif - { "debug", ARGS_ZEROONE }, + { "debug", ARGS_01 }, #ifdef AUTO_NUKE - { "defautonuke", ARGS_ONE }, -#endif - { "defc1", ARGS_ONE }, - { "defcharset", ARGS_ZEROONE }, - { "defescape", ARGS_ONE }, - { "defflow", ARGS_ONETWO }, - { "defgr", ARGS_ONE }, - { "defhstatus", ARGS_ZEROONE }, + { "defautonuke", ARGS_1 }, +#endif + { "defbreaktype", ARGS_01 }, + { "defc1", ARGS_1 }, + { "defcharset", ARGS_01 }, + { "defescape", ARGS_1 }, + { "defflow", ARGS_12 }, + { "defgr", ARGS_1 }, + { "defhstatus", ARGS_01 }, #ifdef KANJI - { "defkanji", ARGS_ONE }, + { "defkanji", ARGS_1 }, #endif #if defined(UTMPOK) && defined(LOGOUTOK) - { "deflogin", ARGS_ONE }, + { "deflogin", ARGS_1 }, #endif - { "defmode", ARGS_ONE }, - { "defmonitor", ARGS_ONE }, - { "defobuflimit", ARGS_ONE }, + { "defmode", ARGS_1 }, + { "defmonitor", ARGS_1 }, + { "defobuflimit", ARGS_1 }, #ifdef COPY_PASTE - { "defscrollback", ARGS_ONE }, -#endif - { "defwrap", ARGS_ONE }, - { "defwritelock", ARGS_ONE }, - { "detach", NEED_DISPLAY|ARGS_ZERO }, - { "digraph", NEED_DISPLAY|ARGS_ZEROONE }, - { "displays", NEED_DISPLAY|ARGS_ZERO }, - { "dumptermcap", NEED_FORE|ARGS_ZERO }, - { "echo", ARGS_ONETWO }, - { "escape", NEED_DISPLAY|ARGS_ONE }, + { "defscrollback", ARGS_1 }, +#endif + { "defshell", ARGS_1 }, + { "defsilence", ARGS_1 }, + { "defslowpaste", ARGS_1 }, + { "defwrap", ARGS_1 }, + { "defwritelock", ARGS_1 }, +#ifdef DETACH + { "detach", NEED_DISPLAY|ARGS_0 }, +#endif + { "digraph", NEED_DISPLAY|ARGS_01 }, + { "displays", NEED_DISPLAY|ARGS_0 }, + { "dumptermcap", NEED_FORE|ARGS_0 }, + { "echo", ARGS_12 }, + { "escape", NEED_DISPLAY|ARGS_1 }, #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", NEED_DISPLAY|ARGS_ZEROONE }, - { "height", NEED_DISPLAY|ARGS_ZEROONE }, - { "help", NEED_DISPLAY|ARGS_ZERO }, + { "exec", NEED_FORE|ARGS_0|ARGS_ORMORE }, +#endif + { "fit", NEED_DISPLAY|ARGS_0 }, + { "flow", NEED_FORE|ARGS_01 }, + { "focus", NEED_DISPLAY|ARGS_0 }, + { "gr", NEED_FORE|ARGS_01 }, + { "hardcopy", NEED_FORE|ARGS_0 }, + { "hardcopy_append", ARGS_1 }, + { "hardcopydir", ARGS_1 }, + { "hardstatus", ARGS_012 }, + { "height", NEED_DISPLAY|ARGS_01 }, + { "help", NEED_DISPLAY|ARGS_0 }, #ifdef COPY_PASTE - { "history", NEED_FORE|ARGS_ZERO }, + { "history", NEED_FORE|ARGS_0 }, #endif - { "info", NEED_DISPLAY|ARGS_ZERO }, + { "hstatus", NEED_FORE|ARGS_1 }, + { "info", NEED_DISPLAY|ARGS_0 }, #ifdef KANJI - { "kanji", NEED_FORE|ARGS_ONETWO }, + { "kanji", NEED_FORE|ARGS_12 }, #endif - { "kill", NEED_FORE|ARGS_ZERO }, - { "lastmsg", NEED_DISPLAY|ARGS_ZERO }, - { "license", NEED_DISPLAY|ARGS_ZERO }, + { "kill", NEED_FORE|ARGS_0 }, + { "lastmsg", NEED_DISPLAY|ARGS_0 }, + { "license", NEED_DISPLAY|ARGS_0 }, #ifdef LOCK - { "lockscreen", NEED_DISPLAY|ARGS_ZERO }, + { "lockscreen", NEED_DISPLAY|ARGS_0 }, #endif - { "log", NEED_FORE|ARGS_ZEROONE }, - { "logfile", ARGS_ZEROONE }, + { "log", NEED_FORE|ARGS_01 }, + { "logfile", ARGS_012 }, #if defined(UTMPOK) && defined(LOGOUTOK) - { "login", NEED_FORE|ARGS_ZEROONE }, + { "login", NEED_FORE|ARGS_01 }, #endif + { "logtstamp", ARGS_012 }, #ifdef MAPKEYS - { "mapdefault", NEED_DISPLAY|ARGS_ZERO }, - { "mapnotnext", NEED_DISPLAY|ARGS_ZERO }, - { "maptimeout", ARGS_ZEROONE }, + { "mapdefault", NEED_DISPLAY|ARGS_0 }, + { "mapnotnext", NEED_DISPLAY|ARGS_0 }, + { "maptimeout", ARGS_01 }, #endif #ifdef COPY_PASTE - { "markkeys", ARGS_ONE }, + { "markkeys", ARGS_1 }, #endif - { "meta", NEED_DISPLAY|ARGS_ZERO }, - { "monitor", NEED_FORE|ARGS_ZEROONE }, - { "msgminwait", ARGS_ONE }, - { "msgwait", ARGS_ONE }, + { "meta", NEED_DISPLAY|ARGS_0 }, + { "monitor", NEED_FORE|ARGS_01 }, + { "msgminwait", ARGS_1 }, + { "msgwait", ARGS_1 }, #ifdef MULTIUSER - { "multiuser", ARGS_ONE }, + { "multiuser", ARGS_1 }, #endif #ifdef NETHACK - { "nethack", ARGS_ONE }, + { "nethack", ARGS_1 }, +#endif + { "next", NEED_DISPLAY|ARGS_0 }, +#ifdef MULTI + { "nonblock", NEED_DISPLAY|ARGS_01 }, #endif - { "next", NEED_DISPLAY|NEED_FORE|ARGS_ZERO }, - { "number", NEED_FORE|ARGS_ZEROONE }, - { "obuflimit", NEED_DISPLAY|ARGS_ZEROONE }, - { "other", NEED_DISPLAY|NEED_FORE|ARGS_ZERO }, - { "partial", NEED_FORE|ARGS_ZEROONE }, + { "number", NEED_FORE|ARGS_01 }, + { "obuflimit", NEED_DISPLAY|ARGS_01 }, + { "only", NEED_DISPLAY|ARGS_0 }, + { "other", NEED_DISPLAY|ARGS_0 }, + { "partial", NEED_FORE|ARGS_01 }, #ifdef PASSWORD - { "password", ARGS_ZEROONE }, + { "password", ARGS_01 }, #endif #ifdef COPY_PASTE - { "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_ZEROONE }, -#endif - { "prev", NEED_DISPLAY|NEED_FORE|ARGS_ZERO }, - { "printcmd", ARGS_ZEROONE }, - { "process", NEED_DISPLAY|ARGS_ZEROONE }, - { "quit", ARGS_ZERO }, + { "paste", NEED_DISPLAY|ARGS_012 }, + { "pastefont", ARGS_01 }, +#endif + { "pow_break", NEED_FORE|ARGS_01 }, +#if defined(DETACH) && defined(POW_DETACH) + { "pow_detach", NEED_DISPLAY|ARGS_0 }, + { "pow_detach_msg", ARGS_01 }, +#endif + { "prev", NEED_DISPLAY|ARGS_0 }, + { "printcmd", ARGS_01 }, + { "process", NEED_DISPLAY|ARGS_01 }, + { "quit", ARGS_0 }, #ifdef COPY_PASTE - { "readbuf", NEED_DISPLAY|ARGS_ZERO }, + { "readbuf", NEED_DISPLAY|ARGS_0 }, #endif - { "readreg", ARGS_ZEROONETWO }, - { "redisplay", NEED_DISPLAY|ARGS_ZERO }, - { "register", ARGS_TWO }, + { "readreg", ARGS_012 }, + { "redisplay", NEED_DISPLAY|ARGS_0 }, + { "register", ARGS_2 }, + { "remove", NEED_DISPLAY|ARGS_0 }, #ifdef COPY_PASTE - { "removebuf", ARGS_ZERO }, + { "removebuf", ARGS_0 }, #endif - { "reset", NEED_FORE|ARGS_ZERO }, - { "screen", ARGS_ZERO|ARGS_ORMORE }, + { "reset", NEED_FORE|ARGS_0 }, + { "screen", ARGS_0|ARGS_ORMORE }, #ifdef COPY_PASTE - { "scrollback", NEED_FORE|ARGS_ONE }, -#endif - { "select", ARGS_ZEROONE }, - { "sessionname", ARGS_ZEROONE }, - { "setenv", ARGS_ZEROONETWO }, - { "shell", ARGS_ONE }, - { "shellaka", ARGS_ONE }, /* TO BE REMOVED */ - { "shelltitle", ARGS_ONE }, - { "silence", NEED_FORE|ARGS_ZEROONE }, - { "silencewait", ARGS_ONE }, - { "sleep", ARGS_ONE }, - { "slowpaste", ARGS_ONE }, - { "sorendition", ARGS_ZEROONETWO }, - { "startup_message", ARGS_ONE }, - { "stuff", NEED_DISPLAY|ARGS_ONE }, + { "scrollback", NEED_FORE|ARGS_1 }, +#endif + { "select", ARGS_01 }, + { "sessionname", ARGS_01 }, + { "setenv", ARGS_012 }, + { "shell", ARGS_1 }, + { "shelltitle", ARGS_1 }, + { "silence", NEED_FORE|ARGS_01 }, + { "silencewait", ARGS_1 }, + { "sleep", ARGS_1 }, + { "slowpaste", NEED_FORE|ARGS_01 }, + { "sorendition", ARGS_012 }, + { "split", NEED_DISPLAY|ARGS_0 }, + { "startup_message", ARGS_1 }, + { "stuff", NEED_DISPLAY|ARGS_12 }, +#ifdef MULTIUSER + { "su", NEED_DISPLAY|ARGS_012 }, +#endif #ifdef BSDJOBS - { "suspend", NEED_DISPLAY|ARGS_ZERO }, -#endif - { "term", ARGS_ONE }, - { "termcap", ARGS_TWOTHREE }, - { "termcapinfo", ARGS_TWOTHREE }, - { "terminfo", ARGS_TWOTHREE }, - { "time", ARGS_ZERO }, - { "title", NEED_FORE|ARGS_ZEROONE }, - { "unsetenv", ARGS_ONE }, - { "vbell", ARGS_ZEROONE }, - { "vbell_msg", ARGS_ZEROONE }, - { "vbellwait", ARGS_ONE }, - { "version", ARGS_ZERO }, - { "wall", NEED_DISPLAY|ARGS_ONE|ARGS_ORMORE }, - { "width", NEED_DISPLAY|ARGS_ZEROONE }, - { "windows", NEED_DISPLAY|ARGS_ZERO }, - { "wrap", NEED_FORE|ARGS_ZEROONE }, + { "suspend", NEED_DISPLAY|ARGS_0 }, +#endif + { "term", ARGS_1 }, + { "termcap", ARGS_23 }, + { "termcapinfo", ARGS_23 }, + { "terminfo", ARGS_23 }, + { "time", ARGS_0 }, + { "title", NEED_FORE|ARGS_01 }, + { "umask", ARGS_1|ARGS_ORMORE }, + { "unsetenv", ARGS_1 }, + { "vbell", ARGS_01 }, + { "vbell_msg", ARGS_01 }, + { "vbellwait", ARGS_1 }, + { "verbose", ARGS_01 }, + { "version", ARGS_0 }, + { "wall", NEED_DISPLAY|ARGS_1}, + { "width", ARGS_01 }, + { "windows", NEED_DISPLAY|ARGS_0 }, + { "wrap", NEED_FORE|ARGS_01 }, #ifdef COPY_PASTE - { "writebuf", NEED_DISPLAY|ARGS_ZERO }, + { "writebuf", NEED_DISPLAY|ARGS_0 }, #endif - { "writelock", NEED_FORE|ARGS_ZEROONE }, - { "xoff", NEED_DISPLAY|ARGS_ZERO }, - { "xon", NEED_DISPLAY|ARGS_ZERO }, - { "zombie", ARGS_ZEROONE } + { "writelock", NEED_FORE|ARGS_01 }, + { "xoff", NEED_DISPLAY|ARGS_0 }, + { "xon", NEED_DISPLAY|ARGS_0 }, + { "zombie", ARGS_01 } }; diff --git a/src/comm.h.dist b/src/comm.h.dist index bbe0052..d004f71 100644 --- a/src/comm.h.dist +++ b/src/comm.h.dist @@ -13,23 +13,28 @@ struct comm #define ARGS_MASK (3) -#define ARGS_ZERO (0) -#define ARGS_ONE (1) -#define ARGS_TWO (2) -#define ARGS_THREE (3) +#define ARGS_0 (0) +#define ARGS_1 (1) +#define ARGS_2 (2) +#define ARGS_3 (3) -#define ARGS_PLUSONE (1<<2) -#define ARGS_PLUSTWO (1<<3) -#define ARGS_ORMORE (1<<4) +#define ARGS_PLUS1 (1<<2) +#define ARGS_PLUS2 (1<<3) +#define ARGS_PLUS3 (1<<4) +#define ARGS_ORMORE (1<<5) -#define NEED_FORE (1<<5) /* this command needs a fore window */ -#define NEED_DISPLAY (1<<6) /* this command needs a display */ +#define NEED_FORE (1<<6) /* this command needs a fore window */ +#define NEED_DISPLAY (1<<7) /* this command needs a display */ -#define ARGS_ZEROONE (ARGS_ZERO|ARGS_PLUSONE) -#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_ZERO|ARGS_PLUSONE|ARGS_PLUSTWO) +#define ARGS_01 (ARGS_0 | ARGS_PLUS1) +#define ARGS_02 (ARGS_0 | ARGS_PLUS2) +#define ARGS_12 (ARGS_1 | ARGS_PLUS1) +#define ARGS_23 (ARGS_2 | ARGS_PLUS1) +#define ARGS_34 (ARGS_3 | ARGS_PLUS1) +#define ARGS_012 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2) +#define ARGS_123 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2) +#define ARGS_124 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS3) +#define ARGS_1234 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3) struct action { @@ -43,135 +48,153 @@ struct action #define RC_ACLCHG 1 #define RC_ACLDEL 2 #define RC_ACLGRP 3 -#define RC_ACTIVITY 4 -#define RC_AKA 5 -#define RC_ALLPARTIAL 6 -#define RC_AT 7 -#define RC_AUTODETACH 8 -#define RC_AUTONUKE 9 -#define RC_BELL 10 -#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_CHARSET 17 -#define RC_CHDIR 18 -#define RC_CLEAR 19 -#define RC_CLONE 20 -#define RC_COLON 21 -#define RC_COMMAND 22 -#define RC_CONSOLE 23 -#define RC_COPY 24 -#define RC_CRLF 25 -#define RC_DEBUG 26 -#define RC_DEFAUTONUKE 27 -#define RC_DEFC1 28 -#define RC_DEFCHARSET 29 -#define RC_DEFESCAPE 30 -#define RC_DEFFLOW 31 -#define RC_DEFGR 32 -#define RC_DEFHSTATUS 33 -#define RC_DEFKANJI 34 -#define RC_DEFLOGIN 35 -#define RC_DEFMODE 36 -#define RC_DEFMONITOR 37 -#define RC_DEFOBUFLIMIT 38 -#define RC_DEFSCROLLBACK 39 -#define RC_DEFWRAP 40 -#define RC_DEFWRITELOCK 41 -#define RC_DETACH 42 -#define RC_DIGRAPH 43 -#define RC_DISPLAYS 44 -#define RC_DUMPTERMCAP 45 -#define RC_ECHO 46 -#define RC_ESCAPE 47 -#define RC_EXEC 48 -#define RC_FLOW 49 -#define RC_GR 50 -#define RC_HARDCOPY 51 -#define RC_HARDCOPY_APPEND 52 -#define RC_HARDCOPYDIR 53 -#define RC_HARDSTATUS 54 -#define RC_HEIGHT 55 -#define RC_HELP 56 -#define RC_HISTORY 57 -#define RC_INFO 58 -#define RC_KANJI 59 -#define RC_KILL 60 -#define RC_LASTMSG 61 -#define RC_LICENSE 62 -#define RC_LOCKSCREEN 63 -#define RC_LOG 64 -#define RC_LOGFILE 65 -#define RC_LOGIN 66 -#define RC_MAPDEFAULT 67 -#define RC_MAPNOTNEXT 68 -#define RC_MAPTIMEOUT 69 -#define RC_MARKKEYS 70 -#define RC_META 71 -#define RC_MONITOR 72 -#define RC_MSGMINWAIT 73 -#define RC_MSGWAIT 74 -#define RC_MULTIUSER 75 -#define RC_NETHACK 76 -#define RC_NEXT 77 -#define RC_NUMBER 78 -#define RC_OBUFLIMIT 79 -#define RC_OTHER 80 -#define RC_PARTIAL 81 -#define RC_PASSWORD 82 -#define RC_PASTE 83 -#define RC_PASTEFONT 84 -#define RC_POW_BREAK 85 -#define RC_POW_DETACH 86 -#define RC_POW_DETACH_MSG 87 -#define RC_PREV 88 -#define RC_PRINTCMD 89 -#define RC_PROCESS 90 -#define RC_QUIT 91 -#define RC_READBUF 92 -#define RC_READREG 93 -#define RC_REDISPLAY 94 -#define RC_REGISTER 95 -#define RC_REMOVEBUF 96 -#define RC_RESET 97 -#define RC_SCREEN 98 -#define RC_SCROLLBACK 99 -#define RC_SELECT 100 -#define RC_SESSIONNAME 101 -#define RC_SETENV 102 -#define RC_SHELL 103 -#define RC_SHELLAKA 104 -#define RC_SHELLTITLE 105 -#define RC_SILENCE 106 -#define RC_SILENCEWAIT 107 -#define RC_SLEEP 108 -#define RC_SLOWPASTE 109 -#define RC_SORENDITION 110 -#define RC_STARTUP_MESSAGE 111 -#define RC_STUFF 112 -#define RC_SUSPEND 113 -#define RC_TERM 114 -#define RC_TERMCAP 115 -#define RC_TERMCAPINFO 116 -#define RC_TERMINFO 117 -#define RC_TIME 118 -#define RC_TITLE 119 -#define RC_UNSETENV 120 -#define RC_VBELL 121 -#define RC_VBELL_MSG 122 -#define RC_VBELLWAIT 123 -#define RC_VERSION 124 -#define RC_WALL 125 -#define RC_WIDTH 126 -#define RC_WINDOWS 127 -#define RC_WRAP 128 -#define RC_WRITEBUF 129 -#define RC_WRITELOCK 130 -#define RC_XOFF 131 -#define RC_XON 132 -#define RC_ZOMBIE 133 +#define RC_ACLUMASK 4 +#define RC_ACTIVITY 5 +#define RC_ADDACL 6 +#define RC_ALLPARTIAL 7 +#define RC_AT 8 +#define RC_AUTODETACH 9 +#define RC_AUTONUKE 10 +#define RC_BELL 11 +#define RC_BELL_MSG 12 +#define RC_BIND 13 +#define RC_BINDKEY 14 +#define RC_BREAK 15 +#define RC_BREAKTYPE 16 +#define RC_BUFFERFILE 17 +#define RC_C1 18 +#define RC_CAPTION 19 +#define RC_CHACL 20 +#define RC_CHARSET 21 +#define RC_CHDIR 22 +#define RC_CLEAR 23 +#define RC_COLON 24 +#define RC_COMMAND 25 +#define RC_COMPACTHIST 26 +#define RC_CONSOLE 27 +#define RC_COPY 28 +#define RC_CRLF 29 +#define RC_DEBUG 30 +#define RC_DEFAUTONUKE 31 +#define RC_DEFBREAKTYPE 32 +#define RC_DEFC1 33 +#define RC_DEFCHARSET 34 +#define RC_DEFESCAPE 35 +#define RC_DEFFLOW 36 +#define RC_DEFGR 37 +#define RC_DEFHSTATUS 38 +#define RC_DEFKANJI 39 +#define RC_DEFLOGIN 40 +#define RC_DEFMODE 41 +#define RC_DEFMONITOR 42 +#define RC_DEFOBUFLIMIT 43 +#define RC_DEFSCROLLBACK 44 +#define RC_DEFSHELL 45 +#define RC_DEFSILENCE 46 +#define RC_DEFSLOWPASTE 47 +#define RC_DEFWRAP 48 +#define RC_DEFWRITELOCK 49 +#define RC_DETACH 50 +#define RC_DIGRAPH 51 +#define RC_DISPLAYS 52 +#define RC_DUMPTERMCAP 53 +#define RC_ECHO 54 +#define RC_ESCAPE 55 +#define RC_EXEC 56 +#define RC_FIT 57 +#define RC_FLOW 58 +#define RC_FOCUS 59 +#define RC_GR 60 +#define RC_HARDCOPY 61 +#define RC_HARDCOPY_APPEND 62 +#define RC_HARDCOPYDIR 63 +#define RC_HARDSTATUS 64 +#define RC_HEIGHT 65 +#define RC_HELP 66 +#define RC_HISTORY 67 +#define RC_HSTATUS 68 +#define RC_INFO 69 +#define RC_KANJI 70 +#define RC_KILL 71 +#define RC_LASTMSG 72 +#define RC_LICENSE 73 +#define RC_LOCKSCREEN 74 +#define RC_LOG 75 +#define RC_LOGFILE 76 +#define RC_LOGIN 77 +#define RC_LOGTSTAMP 78 +#define RC_MAPDEFAULT 79 +#define RC_MAPNOTNEXT 80 +#define RC_MAPTIMEOUT 81 +#define RC_MARKKEYS 82 +#define RC_META 83 +#define RC_MONITOR 84 +#define RC_MSGMINWAIT 85 +#define RC_MSGWAIT 86 +#define RC_MULTIUSER 87 +#define RC_NETHACK 88 +#define RC_NEXT 89 +#define RC_NONBLOCK 90 +#define RC_NUMBER 91 +#define RC_OBUFLIMIT 92 +#define RC_ONLY 93 +#define RC_OTHER 94 +#define RC_PARTIAL 95 +#define RC_PASSWORD 96 +#define RC_PASTE 97 +#define RC_PASTEFONT 98 +#define RC_POW_BREAK 99 +#define RC_POW_DETACH 100 +#define RC_POW_DETACH_MSG 101 +#define RC_PREV 102 +#define RC_PRINTCMD 103 +#define RC_PROCESS 104 +#define RC_QUIT 105 +#define RC_READBUF 106 +#define RC_READREG 107 +#define RC_REDISPLAY 108 +#define RC_REGISTER 109 +#define RC_REMOVE 110 +#define RC_REMOVEBUF 111 +#define RC_RESET 112 +#define RC_SCREEN 113 +#define RC_SCROLLBACK 114 +#define RC_SELECT 115 +#define RC_SESSIONNAME 116 +#define RC_SETENV 117 +#define RC_SHELL 118 +#define RC_SHELLTITLE 119 +#define RC_SILENCE 120 +#define RC_SILENCEWAIT 121 +#define RC_SLEEP 122 +#define RC_SLOWPASTE 123 +#define RC_SORENDITION 124 +#define RC_SPLIT 125 +#define RC_STARTUP_MESSAGE 126 +#define RC_STUFF 127 +#define RC_SU 128 +#define RC_SUSPEND 129 +#define RC_TERM 130 +#define RC_TERMCAP 131 +#define RC_TERMCAPINFO 132 +#define RC_TERMINFO 133 +#define RC_TIME 134 +#define RC_TITLE 135 +#define RC_UMASK 136 +#define RC_UNSETENV 137 +#define RC_VBELL 138 +#define RC_VBELL_MSG 139 +#define RC_VBELLWAIT 140 +#define RC_VERBOSE 141 +#define RC_VERSION 142 +#define RC_WALL 143 +#define RC_WIDTH 144 +#define RC_WINDOWS 145 +#define RC_WRAP 146 +#define RC_WRITEBUF 147 +#define RC_WRITELOCK 148 +#define RC_XOFF 149 +#define RC_XON 150 +#define RC_ZOMBIE 151 -#define RC_LAST 133 +#define RC_LAST 151 diff --git a/src/comm.sh b/src/comm.sh index 9aa0a20..d5fd8b0 100644 --- a/src/comm.sh +++ b/src/comm.sh @@ -27,23 +27,28 @@ struct comm #define ARGS_MASK (3) -#define ARGS_ZERO (0) -#define ARGS_ONE (1) -#define ARGS_TWO (2) -#define ARGS_THREE (3) +#define ARGS_0 (0) +#define ARGS_1 (1) +#define ARGS_2 (2) +#define ARGS_3 (3) -#define ARGS_PLUSONE (1<<2) -#define ARGS_PLUSTWO (1<<3) -#define ARGS_ORMORE (1<<4) +#define ARGS_PLUS1 (1<<2) +#define ARGS_PLUS2 (1<<3) +#define ARGS_PLUS3 (1<<4) +#define ARGS_ORMORE (1<<5) -#define NEED_FORE (1<<5) /* this command needs a fore window */ -#define NEED_DISPLAY (1<<6) /* this command needs a display */ +#define NEED_FORE (1<<6) /* this command needs a fore window */ +#define NEED_DISPLAY (1<<7) /* this command needs a display */ -#define ARGS_ZEROONE (ARGS_ZERO|ARGS_PLUSONE) -#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_ZERO|ARGS_PLUSONE|ARGS_PLUSTWO) +#define ARGS_01 (ARGS_0 | ARGS_PLUS1) +#define ARGS_02 (ARGS_0 | ARGS_PLUS2) +#define ARGS_12 (ARGS_1 | ARGS_PLUS1) +#define ARGS_23 (ARGS_2 | ARGS_PLUS1) +#define ARGS_34 (ARGS_3 | ARGS_PLUS1) +#define ARGS_012 (ARGS_0 | ARGS_PLUS1 | ARGS_PLUS2) +#define ARGS_123 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2) +#define ARGS_124 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS3) +#define ARGS_1234 (ARGS_1 | ARGS_PLUS1 | ARGS_PLUS2 | ARGS_PLUS3) struct action { diff --git a/src/config.h.in b/src/config.h.in index ff5a310..b2ccd11 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -15,7 +15,8 @@ * * You should have received a copy of the GNU General Public License * along with this program (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * **************************************************************** * $Id$ FAU @@ -30,7 +31,11 @@ * User Configuration Section */ - +/* + * Maximum of simultaneously allowed windows per screen session. + * Defaults to 10, if undefined here. + */ +#define MAXWIN 40 /* * Define SOCKDIR to be the directory to contain the named sockets @@ -40,17 +45,13 @@ * "sticky" bit is on, but this isn't required. * If SOCKDIR is not defined screen will put the named sockets in * the user's home directory. Notice that this can cause you problems - * if some user's HOME directories are NFS-mounted and don't support - * named sockets. + * if some user's HOME directories are AFS- or NFS-mounted. Especially + * AFS is unlikely to support named sockets. + * * Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison). - * Do not define TMPTEST unless it's for debugging purpose. */ -#ifndef TMPTEST -# define SOCKDIR "/tmp/screens" -#else -# define SOCKDIR "/tmp/testscreens" -#endif +#define SOCKDIR (eff_uid ? "/tmp/uscreens" : "/tmp/screens") /* * Screen sources two startup files. First a global file with a path @@ -69,6 +70,17 @@ */ #define ALLOW_SYSSCREENRC 1 +/* + * Define CHECKLOGIN to force Screen users to enter their Unix password + * in addition to the screen password. + * + * Define NOSYSLOG if yo do not have logging facilities. Currently + * syslog() will be used to trace ``su'' commands only. + */ +#define CHECKLOGIN 1 +#undef NOSYSLOG + + /* * define PTYMODE if you do not like the default of 0622, which allows * public write to your pty. @@ -95,19 +107,31 @@ */ #undef TOPSTAT +/* + * define DETACH can detach a session. An absolute 'must'. + */ +#define DETACH + /* * here come the erlangen extensions to screen: * define LOCK if you want to use a lock program for a screenlock. * define PASSWORD for secure reattach of your screen. * define COPY_PASTE to use the famous hacker's treasure zoo. - * define POW_DETACH to have a detach_and_logout key. + * define POW_DETACH to have a detach_and_logout key (requires DETACH). * define REMOTE_DETACH (-d option) to move screen between terminals. * define AUTO_NUKE to enable Tim MacKenzies clear screen nuking * define PSEUDOS to allow window input/output filtering * define MULTI to allow multiple attaches. * define MULTIUSER to allow other users attach to your session * (if they are in the acl, of course) - * (jw) + * define MAPKEYS to include input keyboard translation. + * define FONT to support ISO2022/alternet charset support + * define COLOR to include ansi color support. This may expose + * a bug in x11r6-color-xterm. + * define KANJI to include support for japanese character sets. + * Needs FONT to work. + * define BUILTIN_TELNET to add telnet support to screen. + * Syntax: screen //telnet host [port] */ #undef SIMPLESCREEN #ifndef SIMPLESCREEN @@ -122,8 +146,20 @@ # define MULTIUSER # define MAPKEYS # define COLOR +# define FONT +# define KANJI #endif /* SIMPLESCREEN */ -#define KANJI + +#undef BUILTIN_TELNET + + +/* + * If you have a braille display you should define HAVE_BRAILLE. + * The code inside #ifdef HAVE_BRAILLE was contributed by Hadi Bargi + * Rangin (bargi@dots.physics.orst.edu). + */ +#undef HAVE_BRAILLE + /* * As error messages are mostly meaningless to the user, we @@ -153,11 +189,16 @@ * 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 and script will run perfectly without s-bit. - * If LOGOUTOK is undefined and UTMPOK is defined, all windows are initially - * and permanently logged in. + * xterm will run perfectly without s-bit. + * + * If LOGOUTOK is undefined and UTMPOK is defined, all windows are + * initially and permanently logged in. + * + * Set CAREFULUTMP to one (1) if you want that users have at least one + * window per screen session logged in. */ #define LOGOUTOK 1 +#undef CAREFULUTMP /* @@ -170,6 +211,36 @@ */ #undef USRLIMIT +/* + * both must be defined if you want to favor tcsendbreak over + * other calls to generate a break condition on serial lines. + * (Do not bother, if you are not using plain tty windows.) + */ +#define POSIX_HAS_A_GOOD_TCSENDBREAK +#define SUNOS4_AND_WE_TRUST_TCSENDBREAK + +/* + * to lower the interrupt load on the host machine, you may want to + * adjust the VMIN and VTIME settings used for plain tty windows. + * See the termio(4) manual page (Non-Canonical Mode Input Processing) + * for details. + * if undefined, VMIN=1, VTIME=0 is used as a default - this gives you + * best user responsiveness, but highest interrupt frequency. + * (Do not bother, if you are not using plain tty windows.) + */ +#define TTYVMIN 100 +#define TTYVTIME 2 + +/* + * looks like the above values are ignored by setting FNDELAY. + * This is default for all pty/ttys, you may disable it for + * ttys here. After playing with it for a while, one may find out + * that this feature may cause screen to lock up. + */ +#ifdef bsdi +# define TTY_DISABLE_FNBLOCK /* select barfs without it ... */ +#endif + /* * Some terminals, e.g. Wyse 120, use a bitfield to select attributes. @@ -300,9 +371,10 @@ #endif /* - * Define DIRENT if your system has instead of + * Define HAVE_DIRENT_H if your system has instead of + * */ -#undef DIRENT +#undef HAVE_DIRENT_H /* * If your system has getutent(), pututline(), etc. to write to the @@ -315,6 +387,11 @@ */ #undef UTHOST +/* + * Define if you have the utempter utmp helper program + */ +#undef HAVE_UTEMPTER + /* * If ttyslot() breaks getlogin() by returning indexes to utmp entries * of type DEAD_PROCESS, then our getlogin() replacement should be @@ -326,7 +403,6 @@ * 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 HAVE_SETREUID @@ -367,8 +443,10 @@ * undefined, screen uses its own (probably slower) version of bcopy(). * * SYSV machines may have a working memcpy() -- Oh, this is - * quite unlikely. Tell me if you see one. (Juergen) - * But then, memmove() should work, if at all available. + * quite unlikely. Tell me if you see one. + * "But then, memmove() should work, if at all available" he thought... + * Boing, never say "works everywhere" unless you checked SCO UNIX. + * Their memove fails the test in the configure script. Sigh. (Juergen) */ #undef USEBCOPY #undef USEMEMCPY @@ -434,9 +512,9 @@ #undef NAME_MAX /* - * define NEED_RENAME if your system doesn't have a rename() function + * define HAVE_RENAME if your system has a rename() function */ -#undef NEED_RENAME +#undef HAVE_RENAME /* * define HAVE__EXIT if your system has the _exit() call. @@ -453,17 +531,38 @@ */ #undef HAVE_UTIMES +/* + * define HAVE_FCHOWN if your system has the fchown() call. + */ +#undef HAVE_FCHOWN + +/* + * define HAVE_FCHMOD if your system has the fchmod() call. + */ +#undef HAVE_FCHMOD + /* * define HAVE_VSNPRINTF if your system has vsnprintf() (GNU lib). */ #undef HAVE_VSNPRINTF +/* + * define HAVE_GETCWD if your system has the getcwd() call. + */ +#undef HAVE_GETCWD + /* * define HAVE_DEV_PTC if you have a /dev/ptc character special * device. */ #undef HAVE_DEV_PTC +/* + * define HAVE_SVR4_PTYS if you have a /dev/ptmx character special + * device and support the ptsname(), grantpt(), unlockpt() functions. + */ +#undef HAVE_SVR4_PTYS + /* * define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen * to unusual environments. E.g. For SunOs the defaults are "qpr" and diff --git a/src/configure b/src/configure index 728f8e8..be6c524 100755 --- a/src/configure +++ b/src/configure @@ -1,66 +1,56 @@ -#!/bin/sh -# From configure.in Revision: 1.17 -#!/bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 1.11 -# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. - -# 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 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. - -# Save the original args to write them into config.status later. -configure_args="$*" - -# 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" +#! /bin/sh + +# From configure.in Revision: 1.18 # Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE -exec_prefix= +cache_file=./config.cache +exec_prefix=NONE host=NONE no_create= nonopt=NONE -norecursion= -prefix= -program_prefix= -program_suffix= -program_transform_name= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, silent= +site= srcdir= target=NONE verbose= -x_includes= -x_libraries= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -73,35 +63,52 @@ do 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 + # Accept the important Cygnus configure options, so we can diagnose typos. + case "$ac_option" in - -build | --build | --buil | --bui | --bu | --b) + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) + -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that aren't valid shell variable names. + # Reject names that are not 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 + { echo "configure: error: $ac_feature: invalid feature name" 1>&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. + # Reject names that are not 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 + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in @@ -110,7 +117,6 @@ do 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) @@ -121,12 +127,62 @@ do exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) - with_gas=yes ;; # Obsolete; use --with-gas. + # Obsolete; use --with-gas. + with_gas=yes ;; -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF -$ac_usage +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --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 +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi exit 0 ;; -host | --host | --hos | --ho) @@ -134,16 +190,64 @@ EOF -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + -nfp | --nfp | --nf) - with_fp=no ;; # Obsolete; use --without-fp. + # Obsolete; use --without-fp. + with_fp=no ;; -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 ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; @@ -185,11 +289,40 @@ EOF | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) @@ -199,14 +332,14 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 1.11" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that aren't valid shell variable names. + # Reject names that are not 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 + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in @@ -217,14 +350,16 @@ EOF -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that aren't valid shell variable names. + # Reject names that are not 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 + { echo "configure: error: $ac_package: invalid package name" 1>&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) + # Obsolete; use --with-x. + with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) @@ -240,15 +375,15 @@ EOF | --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 + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&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 + echo "configure: warning: $ac_option: invalid host type" 1>&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 + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; @@ -257,31 +392,56 @@ EOF done if test -n "$ac_prev"; then - echo "configure: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" >&2; exit 1 + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&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 +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 -# 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 +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +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" ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_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 +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +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 "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -295,7 +455,7 @@ ac_unique_file=screen.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes - # Try the directory containing this script, then `..'. + # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. @@ -303,18 +463,59 @@ if test -z "$srcdir"; then if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi +else + ac_srcdir_defaulted=no fi 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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else - echo "configure: can not find sources in ${srcdir}" >&2; exit 1 + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file fi + 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' +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi @@ -324,184 +525,449 @@ 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" -test -n "$silent" || echo "this is screen version $VERSION" +echo "this is screen version $VERSION" 1>&6 -if test -z "$prefix" -then - test -n "$silent" || echo "checking for screen to derive installation directory prefix" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$IFS:" + +if test "x$prefix" = xNONE; then +echo $ac_n "checking for prefix by $ac_c" 1>&6 +# Extract the first word of "screen", so it can be a program name with args. +set dummy screen; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:537: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_SCREEN'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$SCREEN" in + /*) + ac_cv_path_SCREEN="$SCREEN" # Let the user override the test with a path. + ;; + *) + 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/screen; then - # Not all systems have dirname. - prefix=`echo $ac_dir|sed 's%/[^/][^/]*$%%'` + if test -f $ac_dir/$ac_word; then + ac_cv_path_SCREEN="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -n "$verbose" && echo " chose installation directory prefix ${prefix}" + ;; +esac +fi +SCREEN="$ac_cv_path_SCREEN" +if test -n "$SCREEN"; then + echo "$ac_t""$SCREEN" 1>&6 +else + echo "$ac_t""no" 1>&6 fi -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:" + if test -n "$ac_cv_path_SCREEN"; then + prefix=`echo $ac_cv_path_SCREEN|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` + fi +fi + +if test "x$prefix" = xNONE; then +echo $ac_n "checking for prefix by $ac_c" 1>&6 +# Extract the first word of "gzip", so it can be a program name with args. +set dummy gzip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:575: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GZIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GZIP" in + /*) + ac_cv_path_GZIP="$GZIP" # Let the user override the test with a path. + ;; + *) + 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%/[^/][^/]*$%%'` + if test -f $ac_dir/$ac_word; then + ac_cv_path_GZIP="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -n "$verbose" && echo " chose installation directory prefix ${prefix}" + ;; +esac +fi +GZIP="$ac_cv_path_GZIP" +if test -n "$GZIP"; then + echo "$ac_t""$GZIP" 1>&6 +else + echo "$ac_t""no" 1>&6 fi + if test -n "$ac_cv_path_GZIP"; then + prefix=`echo $ac_cv_path_GZIP|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` + fi +fi + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:612: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + 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 + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi if test -z "$CC"; then - # Extract the first word of `gcc', so it can be a program name with args. - set ac_dummy gcc; ac_word=$2 - test -n "$silent" || echo "checking for $ac_word" + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:641: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - CC="gcc" + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 fi -test -z "$CC" && CC="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 <&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:689: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:723: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:728: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c < conftest.out 2>&1 -if egrep yes conftest.out >/dev/null 2>&1; then - GCC=1 # For later tests. +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:737: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:752: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no fi rm -f conftest* -test -n "$silent" || echo "checking how to run the C preprocessor" +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:780: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi 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. +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" - cat > conftest.${ac_ext} < conftest.$ac_ext < +#include 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"` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.${ac_ext} < conftest.$ac_ext < +#include 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"` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" fi -test -n "$verbose" && echo " setting CPP to $CPP" +echo "$ac_t""$CPP" 1>&6 -if test -n "$GCC"; then - test -n "$silent" || echo "checking whether -traditional is needed" - ac_pattern="Autoconf.*'x'" - ac_prog='#include -Autoconf TIOCGETP' - cat > conftest.${ac_ext} <&6 +echo "configure:842: checking whether ${CC-cc} needs -traditional" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_pattern="Autoconf.*'x'" + cat > conftest.$ac_ext < +Autoconf TIOCGETP EOF -eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1" -if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then rm -rf conftest* - ac_need_trad=1 - + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no fi rm -f conftest* - if test -z "$ac_need_trad"; then - ac_prog='#include -Autoconf TCGETA' - cat > conftest.${ac_ext} < conftest.$ac_ext < +Autoconf TCGETA EOF -eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1" -if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then rm -rf conftest* - ac_need_trad=1 - + ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi - test -n "$ac_need_trad" && CC="$CC -traditional" fi -test -n "$silent" || echo "checking for POSIXized ISC" +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:888: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then - ISC=1 # If later tests want to check for ISC. - -{ -test -n "$verbose" && \ -echo " defining _POSIX_SOURCE" -echo "#define" _POSIX_SOURCE "1" >> confdefs.h -DEFS="$DEFS -D_POSIX_SOURCE=1" -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} -" -} + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF - if test -n "$GCC"; then + if test "$GCC" = yes; then CC="$CC -posix" else CC="$CC -Xp" fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + + +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + +if test $CC != cc ; then +echo "Your $CC failed - restarting with CC=cc" 1>&6 + +echo "" 1>&6 + +CC=cc +export CC +exec $0 $configure_args +fi + +fi +rm -fr conftest* fi -cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext </dev/null; then +if { (eval echo configure:948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then : else - echo "configure: Can't run the compiler - sorry" >&2; exit 1 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + exec 5>&2 +eval $ac_link +echo "CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;" 1>&6 + +echo "$ac_compile" 1>&6 + +{ echo "configure: error: Can't run the compiler - sorry" 1>&2; exit 1; } fi rm -fr conftest* +fi -cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext </dev/null; then - echo "configure: Your compiler does not set the exit status - sorry" >&2; exit 1 - +if { (eval echo configure:981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + { echo "configure: error: Your compiler does not set the exit status - sorry" 1>&2; exit 1; } +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -fr conftest* +fi + for ac_prog in mawk gawk nawk awk do -if test -z "$AWK"; then - # 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" +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:997: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else 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" + ac_cv_prog_AWK="$ac_prog" break fi done IFS="$ac_save_ifs" fi - -test -n "$AWK" && test -n "$verbose" && echo " setting AWK to $AWK" +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi test -n "$AWK" && break done -# Make sure to not get the incompatible SysV /etc/install and -# /usr/sbin/install, which might be in PATH before a BSD-like install, -# 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', 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}:" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1056: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + 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) ;; + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in installbsd scoinst install; do + for ac_prog in ginstall 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 @@ -573,7 +1072,7 @@ if test -z "${INSTALL}"; then # OSF/1 installbsd also uses dspmsg, but is usable. : else - INSTALL="$ac_dir/$ac_prog -c" + ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi @@ -581,155 +1080,136 @@ if test -z "${INSTALL}"; then ;; esac done - IFS="$ac_save_ifs" -fi + IFS="$ac_save_IFS" -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 -c"; 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 + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi fi -test -n "$verbose" && echo " setting INSTALL to $INSTALL" +echo "$ac_t""$INSTALL" 1>&6 -# Use test -z because SunOS4 sh mishandles ${INSTALL_PROGRAM-'${INSTALL}'}. +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. # 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 -f etc/toolcheck; then -test -n "$silent" || echo "checking for buggy tools" -sh etc/toolcheck +echo "checking for buggy tools" 1>&6 +echo "configure:1108: checking for buggy tools" >&5 +sh etc/toolcheck 1>&6 fi if test -n "$ISC"; then - -{ -test -n "$verbose" && \ -echo " defining ISC" -echo "#define" ISC "1" >> confdefs.h -DEFS="$DEFS -DISC=1" -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} -" -} + cat >> confdefs.h <<\EOF +#define ISC 1 +EOF LIBS="$LIBS -linet" fi if test -f /sysV68 ; then - -{ -test -n "$verbose" && \ -echo " defining sysV68" -echo "#define" sysV68 "1" >> confdefs.h -DEFS="$DEFS -DsysV68=1" -ac_sed_defs="${ac_sed_defs}\${ac_dA}sysV68\${ac_dB}sysV68\${ac_dC}1\${ac_dD} -\${ac_uA}sysV68\${ac_uB}sysV68\${ac_uC}1\${ac_uD} -\${ac_eA}sysV68\${ac_eB}sysV68\${ac_eC}1\${ac_eD} -" -} +cat >> confdefs.h <<\EOF +#define sysV68 1 +EOF fi +echo "checking for MIPS" 1>&6 +echo "configure:1128: checking for MIPS" >&5 +if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then oldlibs="$LIBS" -LIBS="$LIBS -lmld" -test -n "$silent" || echo "checking for MIPS" -cat > conftest.${ac_ext} <&6 +echo "configure:1133: checking mld library" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - test -f /bin/mx && LIBS="$oldlibs" # not on alpha + LIBS="$oldlibs" +fi +rm -f conftest* if test -r /dev/ptc; then +cat >> confdefs.h <<\EOF +#define MIPS 1 +EOF -{ -test -n "$verbose" && \ -echo " defining MIPS" -echo "#define" MIPS "1" >> confdefs.h -DEFS="$DEFS -DMIPS=1" -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} -" -} - -test -n "$silent" || echo "checking for wait3" -cat > conftest.${ac_ext} <&6 +echo "configure:1157: checking wait3" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - test -n "$silent" || echo "checking for wait2" -cat > conftest.${ac_ext} <&6 +echo "configure:1173: checking wait2" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining USE_WAIT2" -echo "#define" USE_WAIT2 "1" >> confdefs.h -DEFS="$DEFS -DUSE_WAIT2=1" -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} -" -} + cat >> confdefs.h <<\EOF +#define USE_WAIT2 1 +EOF LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd" - +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - fi rm -f conftest* - fi - - -else - rm -rf conftest* - LIBS="$oldlibs" fi -rm -f conftest* -test -n "$silent" || echo "checking for Ultrix" -cat > conftest.${ac_ext} <&6 +echo "configure:1201: checking for Ultrix" >&5 +cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then rm -rf conftest* ULTRIX=1 - fi rm -f conftest* @@ -737,49 +1217,45 @@ rm -f conftest* 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} <&6 +echo "configure:1222: checking Pyramid OSX" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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} -" -} - + cat >> confdefs.h <<\EOF +#define OSX 1 +EOF else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - LIBS="oldlibs" + LIBS="$oldlibs" fi rm -f conftest* - fi -test -n "$silent" || echo "checking for butterfly" -cat > conftest.${ac_ext} <&6 +echo "configure:1247: checking for butterfly" >&5 +cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then rm -rf conftest* butterfly=1 - fi rm -f conftest* @@ -788,208 +1264,207 @@ if test -z "$butterfly"; then if test -n "$ULTRIX"; then test -z "$GCC" && CC="$CC -YBSD" fi -test -n "$silent" || echo "checking for POSIX.1" -cat > conftest.${ac_ext} <&6 +echo "configure:1269: checking for POSIX.1" >&5 +cat > conftest.$ac_ext < #include main () { #ifdef _POSIX_VERSION - yes + yes; #endif EOF -eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then 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" -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} -" -} + echo "- you have a POSIX system" 1>&6 + cat >> confdefs.h <<\EOF +#define POSIX 1 +EOF posix=1 - fi rm -f conftest* fi -test -n "$silent" || echo "checking for System V" -cat > conftest.${ac_ext} <&6 +echo "configure:1295: checking for System V" >&5 +cat > conftest.$ac_ext < #include #include -int main() { return 0; } -int t() { int x = SIGCHLD | FNDELAY;; return 0; } +int main() { +int x = SIGCHLD | FNDELAY; +; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:1306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining SYSV" -echo "#define" SYSV "1" >> confdefs.h -DEFS="$DEFS -DSYSV=1" -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} -" -} + cat >> confdefs.h <<\EOF +#define SYSV 1 +EOF fi rm -f conftest* - -test -n "$silent" || echo "checking for sequent/ptx" -cat > conftest.${ac_ext} <&6 +echo "configure:1320: checking for sequent/ptx" >&5 +cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then rm -rf conftest* LIBS="$LIBS -lsocket -linet";seqptx=1 - fi rm -f conftest* oldlibs="$LIBS" LIBS="$LIBS -lelf" -test -n "$silent" || echo "checking for SVR4" -cat > conftest.${ac_ext} <&6 +echo "configure:1340: checking SVR4" >&5 +cat > conftest.$ac_ext < -int main() { return 0; } -int t() { ; return 0; } +int main() { + +; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:1350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - test -n "$silent" || echo "checking for dwarf.h" -cat > conftest.${ac_ext} <&6 +echo "configure:1354: checking for dwarf.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < EOF -# 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"` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` 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" -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" -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} -" -} - - + eval "ac_cv_header_$ac_safe=yes" else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - test -n "$silent" || echo "checking for elf.h" -cat > conftest.${ac_ext} <&6 + cat >> confdefs.h <<\EOF +#define SVR4 1 +EOF + cat >> confdefs.h <<\EOF +#define BUGGYGETLOGIN 1 +EOF + +else + echo "$ac_t""no" 1>&6 +ac_safe=`echo "elf.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for elf.h""... $ac_c" 1>&6 +echo "configure:1391: checking for elf.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < EOF -# 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"` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` 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" -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" -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} -" -} - - + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define SVR4 1 +EOF + cat >> confdefs.h <<\EOF +#define BUGGYGETLOGIN 1 +EOF +else + echo "$ac_t""no" 1>&6 fi -rm -f conftest* +fi else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$oldlibs" fi rm -f conftest* - -test -n "$silent" || echo "checking for Solaris" -cat > conftest.${ac_ext} <&6 +echo "configure:1440: checking for Solaris 2.x" >&5 +cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then rm -rf conftest* - LIBS="$LIBS -lkstat" - + LIBS="$LIBS -lsocket -lnsl -lkstat" fi rm -f conftest* -test -n "$silent" || echo "checking for BSD job control" -cat > conftest.${ac_ext} <&6 +echo "configure:1460: checking BSD job jontrol" >&5 +cat > conftest.$ac_ext < #include -int main() { return 0; } -int t() { +int main() { + #ifdef POSIX tcsetpgrp(0, 0); #else @@ -1000,127 +1475,128 @@ setpgrp(); int y = TIOCNOTTY; #endif #endif + ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:1482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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" -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} -" -} - + echo "- you have jobcontrol" 1>&6 + cat >> confdefs.h <<\EOF +#define BSDJOBS 1 +EOF else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - test -n "$silent" || echo "- you don't have jobcontrol" + echo "- you don't have jobcontrol" 1>&6 + fi rm -f conftest* - -test -n "$silent" || echo "checking for setreuid" -cat > conftest.${ac_ext} <&6 +echo "configure:1499: checking setreuid" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -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} -" -} - + cat >> confdefs.h <<\EOF +#define HAVE_SETREUID 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - -test -n "$silent" || echo "checking for seteuid" -cat > conftest.${ac_ext} <&6 +echo "configure:1526: checking seteuid" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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} -" -} - + cat >> confdefs.h <<\EOF +#define HAVE_SETEUID 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* -test -n "$silent" || echo "checking for select" -cat > conftest.${ac_ext} <&6 +echo "configure:1555: checking select" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$LIBS -lnet -lnsl" -test -n "$silent" || echo "checking for select with $LIBS" -cat > conftest.${ac_ext} <&6 +echo "configure:1572: checking select with $LIBS" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - echo "configure: !!! no select - no screen" >&2; exit 1 + { echo "configure: error: !!! no select - no screen" 1>&2; exit 1; } fi rm -f conftest* - fi rm -f conftest* - -test -n "$silent" || echo "checking fifos" -cat > conftest.${ac_ext} <&6 +echo "configure:1595: checking fifos" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -1180,19 +1656,30 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - test -n "$silent" || echo "- your fifos are usable";fifo=1 - +if { (eval echo configure:1660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "- your fifos are usable" 1>&6 + fifo=1 else - test -n "$silent" || echo "- your fifos are not usable" + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "- your fifos are not usable" 1>&6 + fi rm -fr conftest* +fi + rm -f /tmp/conftest* if test -n "$fifo"; then -test -n "$silent" || echo "checking for broken fifo implementation" -cat > conftest.${ac_ext} <&6 +echo "configure:1678: checking for broken fifo implementation" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -1232,31 +1719,34 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - test -n "$silent" || echo "- your implementation is ok" +if { (eval echo configure:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "- your implementation is ok" 1>&6 else - 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" -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} -" -} + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "- you have a broken implementation" 1>&6 + cat >> confdefs.h <<\EOF +#define BROKEN_PIPE 1 +EOF fifobr=1 fi rm -fr conftest* +fi + rm -f /tmp/conftest* fi -test -n "$silent" || echo "checking sockets" -cat > conftest.${ac_ext} <&6 +echo "configure:1745: checking sockets" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -1301,19 +1791,30 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - test -n "$silent" || echo "- your sockets are usable";sock=1 - +if { (eval echo configure:1795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "- your sockets are usable" 1>&6 + sock=1 else - test -n "$silent" || echo "- your sockets are not usable" + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "- your sockets are not usable" 1>&6 + fi rm -fr conftest* +fi + rm -f /tmp/conftest* if test -n "$sock"; then -test -n "$silent" || echo "checking socket implementation" -cat > conftest.${ac_ext} <&6 +echo "configure:1813: checking socket implementation" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -1342,26 +1843,24 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - test -n "$silent" || echo "- you are normal" +if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "- you are normal" 1>&6 else - test -n "$silent" || echo "- unix domain sockets are not kept in the filesystem" + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "- unix domain sockets are not kept in the filesystem" 1>&6 -{ -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" -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} -" -} +cat >> confdefs.h <<\EOF +#define SOCK_NOT_IN_FS 1 +EOF socknofs=1 fi rm -fr conftest* +fi + rm -f /tmp/conftest* fi @@ -1369,60 +1868,46 @@ fi if test -n "$fifo"; then if test -n "$sock"; then if test -n "$nore"; then - 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" -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} -" -} + echo "- hmmm... better take the fifos" 1>&6 + + cat >> confdefs.h <<\EOF +#define NAMEDPIPE 1 +EOF elif test -n "$fifobr"; then - test -n "$silent" || echo "- as your fifos are broken lets use the sockets." + echo "- as your fifos are broken lets use the sockets." 1>&6 + else - 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" -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} -" -} + echo "- both sockets and fifos usable. let's take fifos." 1>&6 + + cat >> confdefs.h <<\EOF +#define NAMEDPIPE 1 +EOF fi else - test -n "$silent" || echo "- using named pipes" - -{ -test -n "$verbose" && \ -echo " defining NAMEDPIPE" -echo "#define" NAMEDPIPE "1" >> confdefs.h -DEFS="$DEFS -DNAMEDPIPE=1" -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} -" -} + echo "- using named pipes" 1>&6 + + cat >> confdefs.h <<\EOF +#define NAMEDPIPE 1 +EOF fi elif test -n "$sock"; then - test -n "$silent" || echo "- using unix-domain sockets" + echo "- using unix-domain sockets" 1>&6 + else - echo "configure: you have neither usable sockets nor usable pipes -> no screen" >&2; exit 1 + { echo "configure: error: you have neither usable sockets nor usable pipes -> no screen" 1>&2; exit 1; } fi -test -n "$silent" || echo "checking select return value" -cat > conftest.${ac_ext} <&6 +echo "configure:1906: checking select return value" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -1447,7 +1932,7 @@ main() #ifdef __FreeBSD__ /* From Andrew A. Chernov (ache@astral.msk.su): - * opening RDWR fifo fails in BSD 4.4, but select return values is + * opening RDWR fifo fails in BSD 4.4, but select return values are * right. */ exit(0); @@ -1511,97 +1996,116 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - test -n "$silent" || echo "- select is ok" +if { (eval echo configure:2000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "- select is ok" 1>&6 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" -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} -" -} + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "- it is not usable" 1>&6 + cat >> confdefs.h <<\EOF +#define SELECT_BROKEN 1 +EOF fi rm -fr conftest* +fi -test -n "$silent" || echo "checking for tgetent" + +echo "checking for tgetent" 1>&6 +echo "configure:2019: checking for tgetent" >&5 olibs="$LIBS" LIBS="-lcurses $olibs" -test -n "$silent" || echo "checking for libcurses" -cat > conftest.${ac_ext} <&6 +echo "configure:2023: checking libcurses" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="-ltermcap $olibs" -test -n "$silent" || echo "checking for libtermcap" -cat > conftest.${ac_ext} <&6 +echo "configure:2046: checking libtermcap" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="-ltermlib $olibs" -test -n "$silent" || echo "checking for libtermlib" -cat > conftest.${ac_ext} <&6 +echo "configure:2063: checking libtermlib" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="-lncurses $olibs" -test -n "$silent" || echo "checking for libncurses" -cat > conftest.${ac_ext} <&6 +echo "configure:2080: checking libncurses" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - echo "configure: !!! no tgetent - no screen" >&2; exit 1 + { echo "configure: error: !!! no tgetent - no screen" 1>&2; exit 1; } fi rm -f conftest* - fi rm -f conftest* - fi rm -f conftest* - fi rm -f conftest* - -cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext </dev/null; then - test -n "$silent" || echo "- you use the termcap database" +if { (eval echo configure:2117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "- you use the termcap database" 1>&6 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" -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} -" -} + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "- you use the terminfo database" 1>&6 + cat >> confdefs.h <<\EOF +#define TERMINFO 1 +EOF fi rm -fr conftest* -test -n "$silent" || echo "checking for ospeed" -cat > conftest.${ac_ext} <&6 +echo "configure:2135: checking ospeed" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining NEED_OSPEED" -echo "#define" NEED_OSPEED "1" >> confdefs.h -DEFS="$DEFS -DNEED_OSPEED=1" -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} -" -} + cat >> confdefs.h <<\EOF +#define NEED_OSPEED 1 +EOF fi rm -f conftest* - -test -n "$silent" || echo "checking for /dev/ptc" +echo "checking for /dev/ptc" 1>&6 +echo "configure:2158: checking for /dev/ptc" >&5 if test -r /dev/ptc; then +cat >> confdefs.h <<\EOF +#define HAVE_DEV_PTC 1 +EOF -{ -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 + +echo "checking for SVR4 ptys" 1>&6 +echo "configure:2167: checking for SVR4 ptys" >&5 +if test -c /dev/ptmx ; then +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_SVR4_PTYS 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* fi -test -n "$silent" || echo "checking for ptyranges" +echo "checking for ptyranges" 1>&6 +echo "configure:2191: checking for ptyranges" >&5 if test -d /dev/ptym ; then pdir='/dev/ptym' else pdir='/dev' fi -if test -c /dev/ptyp19; then -ptys=`echo /dev/ptyp??` +cat > conftest.$ac_ext <&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ptys=`echo /dev/ptyp??` else -ptys=`echo $pdir/pty??` + rm -rf conftest* + ptys=`echo $pdir/pty??` fi +rm -f conftest* + if test "$ptys" != "$pdir/pty??" ; then 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'` +cat >> confdefs.h <> confdefs.h -DEFS="$DEFS -DPTYRANGE0=\"$p0\"" -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 "#define" PTYRANGE1 "\"$p1\"" >> confdefs.h -DEFS="$DEFS -DPTYRANGE1=\"$p1\"" -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} -" -} +cat >> confdefs.h <&6 +echo "configure:2229: checking default tty permissions/group" >&5 rm -f conftest_grp -cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -1745,51 +2263,45 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then +if { (eval echo configure:2267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && 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} -" -} + echo "- pty mode: 0620" 1>&6 - -{ -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} -" -} + cat >> confdefs.h <<\EOF +#define PTYMODE 0620 +EOF + + cat >> confdefs.h <&6 + fi else - test -n "$silent" || echo "- can't determine - assume ptys are world accessable" + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "- can't determine - assume ptys are world accessable" 1>&6 + fi rm -fr conftest* +fi + rm -f conftest_grp -test -n "$silent" || echo "checking for getutent" -cat > conftest.${ac_ext} <&6 +echo "configure:2301: checking getutent" >&5 +cat > conftest.$ac_ext < /* to get time_t on SCO */ #include #if defined(SVR4) && !defined(DGUX) @@ -1802,31 +2314,28 @@ cat > conftest.${ac_ext} <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining GETUTENT" -echo "#define" GETUTENT "1" >> confdefs.h -DEFS="$DEFS -DGETUTENT=1" -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} -" -} - + cat >> confdefs.h <<\EOF +#define GETUTENT 1 +EOF else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* olibs="$LIBS" LIBS="$LIBS -lgen" -test -n "$silent" || echo "checking for getutent with -lgen" -cat > conftest.${ac_ext} <&6 +echo "configure:2335: checking getutent with -lgen" >&5 +cat > conftest.$ac_ext < #include #if defined(SVR4) && !defined(DGUX) @@ -1839,37 +2348,32 @@ cat > conftest.${ac_ext} <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining GETUTENT" -echo "#define" GETUTENT "1" >> confdefs.h -DEFS="$DEFS -DGETUTENT=1" -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} -" -} - + cat >> confdefs.h <<\EOF +#define GETUTENT 1 +EOF else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$olibs" fi rm -f conftest* - fi rm -f conftest* - -test -n "$silent" || echo "checking for ut_host" -cat > conftest.${ac_ext} <&6 +echo "configure:2373: checking ut_host" >&5 +cat > conftest.$ac_ext < #include #if defined(SVR4) && !defined(DGUX) @@ -1879,188 +2383,217 @@ cat > conftest.${ac_ext} < #endif -int main() { return 0; } -int t() { struct utmp u; u.ut_host[0] = 0;; return 0; } +int main() { +struct utmp u; u.ut_host[0] = 0; +; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:2391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining UTHOST" -echo "#define" UTHOST "1" >> confdefs.h -DEFS="$DEFS -DUTHOST=1" -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} -" -} - + cat >> confdefs.h <<\EOF +#define UTHOST 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +ac_safe=`echo "utempter.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for utempter.h""... $ac_c" 1>&6 +echo "configure:2404: checking for utempter.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2414: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_utempter=yes +else + echo "$ac_t""no" 1>&6 +have_utempter=no +fi +if test "$have_utempter" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_UTEMPTER 1 +EOF + LIBS="$LIBS -lutempter" +fi -test -n "$silent" || echo "checking for libutil(s)" +echo "checking for libutil(s)" 1>&6 +echo "configure:2445: checking for libutil(s)" >&5 test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils" test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil" -test -n "$silent" || echo "checking for getloadavg" -cat > conftest.${ac_ext} <&6 +echo "configure:2450: checking getloadavg" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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} -" -} + cat >> confdefs.h <<\EOF +#define LOADAV_GETLOADAVG 1 +EOF load=1 - else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 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} <&6 +echo "configure:2473: checking getloadavg with -lkvm" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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} -" -} + cat >> confdefs.h <<\EOF +#define LOADAV_GETLOADAVG 1 +EOF load=1 - else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$olibs" fi rm -f conftest* - fi fi rm -f conftest* - if test -z "$load" ; then -cat > conftest.${ac_ext} < conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then rm -rf conftest* load=1 - fi rm -f conftest* fi if test -z "$load" ; then -test -n "$silent" || echo "checking for kernelfile" +echo "checking for kernelfile" 1>&6 +echo "configure:2519: checking for kernelfile" >&5 for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do if test -f $core || test -c $core; then break fi done if test ! -f $core && test ! -c $core ; then - test -n "$silent" || echo "- no kernelfile found" + echo "- no kernelfile found" 1>&6 + else - test -n "$silent" || echo "- using kernelfile '$core'" - -{ -test -n "$verbose" && \ -echo " defining" LOADAV_UNIX to be "\"$core\"" -echo "#define" LOADAV_UNIX "\"$core\"" >> confdefs.h -DEFS="$DEFS -DLOADAV_UNIX=\"$core\"" -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 "- using kernelfile '$core'" 1>&6 + + if test -r $core ; then + cat >> confdefs.h < conftest.${ac_ext} <&6 +echo "configure:2538: checking for nlist.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < EOF -# 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"` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2548: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` 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" -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} -" -} + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define NLIST_STRUCT 1 +EOF - test -n "$silent" || echo "checking for n_un in struct nlist" -cat > conftest.${ac_ext} <&6 +echo "configure:2569: checking n_un in struct nlist" >&5 + cat > conftest.$ac_ext < -int main() { return 0; } -int t() { struct nlist n; n.n_un.n_name = 0;; return 0; } +int main() { +struct nlist n; n.n_un.n_name = 0; +; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:2578: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; 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" -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} -" -} - + cat >> confdefs.h <<\EOF +#define NLIST_NAME_UNION 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - - +else + echo "$ac_t""no" 1>&6 fi -rm -f conftest* - test -n "$silent" || echo "checking for nlist declaration" - cat > conftest.${ac_ext} <&6 +echo "configure:2595: checking for nlist declaration" >&5 + cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "nlist(( | )( | )*.*\(|\()" conftest.out >/dev/null 2>&1; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "nlist(( | )( | )*.*\(|\()" >/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" -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} -" -} - + cat >> confdefs.h <<\EOF +#define NLIST_DECLARED 1 +EOF fi rm -f conftest* - test -n "$silent" || echo "checking for avenrun symbol" + echo "checking for avenrun symbol" 1>&6 +echo "configure:2619: checking for avenrun symbol" >&5 for av in avenrun _avenrun _Loadavg ; do - cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -2128,31 +2657,45 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then +if { (eval echo configure:2661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then avensym=$av;break - +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -fr conftest* +fi + done if test -z "$avensym" ; then - test -n "$silent" || echo "- no avenrun symbol found" + echo "- no avenrun symbol found" 1>&6 + else - test -n "$silent" || echo "- using avenrun symbol '$avensym'" - -{ -test -n "$verbose" && \ -echo " defining" LOADAV_AVENRUN to be "\"$avensym\"" -echo "#define" LOADAV_AVENRUN "\"$avensym\"" >> confdefs.h -DEFS="$DEFS -DLOADAV_AVENRUN=\"$avensym\"" -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} -" -} + echo "- using avenrun symbol '$avensym'" 1>&6 + + cat >> confdefs.h <&6 + + echo "because $core is not readable by you." 1>&6 + + echo "To configure the load average display feature" 1>&6 + + echo "re-run configure as root if possible." 1>&6 + + echo "If you are not the system administrator then disregard" 1>&6 + + echo "this warning. You can still use screen without" 1>&6 + + echo "the load average display feature." 1>&6 + + fi fi fi @@ -2163,7 +2706,7 @@ cat > conftest.c </dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out +eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' > conftest.out" . ./conftest.out rm -f conftest* -if test -n "$load" ; then -{ -test -n "$verbose" && \ -echo " defining LOADAV" -echo "#define" LOADAV "1" >> confdefs.h -DEFS="$DEFS -DLOADAV=1" -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} -" -} +if test -n "$load" ; then cat >> confdefs.h <<\EOF +#define LOADAV 1 +EOF fi -if test -n "$loadtype" ; then -{ -test -n "$verbose" && \ -echo " defining" LOADAV_TYPE to be "$loadtype" -echo "#define" LOADAV_TYPE "$loadtype" >> confdefs.h -DEFS="$DEFS -DLOADAV_TYPE=$loadtype" -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} -" -} +if test -n "$loadtype" ; then cat >> confdefs.h <> confdefs.h -DEFS="$DEFS -DLOADAV_NUM=$loadnum" -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} -" -} +if test -n "$loadnum" ; then cat >> confdefs.h <> confdefs.h -DEFS="$DEFS -DLOADAV_SCALE=$loadscale" -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} -" -} +if test -n "$loadscale" ; then cat >> confdefs.h <&6 -{ -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} -" -} +cat >> confdefs.h <<\EOF +#define SIGVOID 1 +EOF else -test -n "$silent" || echo "checking for return type of signal handlers" -cat > conftest.${ac_ext} <&6 +echo "configure:2776: checking return type of signal handlers" >&5 +cat > conftest.$ac_ext < #include @@ -2277,63 +2782,58 @@ cat > conftest.${ac_ext} <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - -{ -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} -" -} - + cat >> confdefs.h <<\EOF +#define SIGVOID 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - -test -n "$silent" || echo "checking for sigset" -cat > conftest.${ac_ext} <&6 +echo "configure:2802: checking sigset" >&5 +cat > conftest.$ac_ext < #include -int main() { return 0; } -int t() { +int main() { + #ifdef SIGVOID sigset(0, (void (*)())0); #else sigset(0, (int (*)())0); #endif + ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:2820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining USESIGSET" -echo "#define" USESIGSET "1" >> confdefs.h -DEFS="$DEFS -DUSESIGSET=1" -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} -" -} - + cat >> confdefs.h <<\EOF +#define USESIGSET 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - -test -n "$silent" || echo "checking signal implementation" -cat > conftest.${ac_ext} <&6 +echo "configure:2832: checking signal implementation" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext < @@ -2370,152 +2870,207 @@ main() } EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then +if { (eval echo configure:2874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then : else - -{ -test -n "$verbose" && \ -echo " defining SYSVSIGS" -echo "#define" SYSVSIGS "1" >> confdefs.h -DEFS="$DEFS -DSYSVSIGS=1" -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} -" -} + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + cat >> confdefs.h <<\EOF +#define SYSVSIGS 1 +EOF fi rm -fr conftest* +fi + fi -test -n "$silent" || echo "checking for crypt and sec libraries" +echo "checking for crypt and sec libraries" 1>&6 +echo "configure:2894: checking for crypt and sec libraries" >&5 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" - -cat > conftest.${ac_ext} <&6 +echo "configure:2899: checking crypt" >&5 +cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if { (eval echo configure:2908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - LIBS="$LIBS -lsocket -lcrypt_i -lc -lx" - + LIBS="$oldlibs" fi rm -f conftest* - - +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" -test -n "$silent" || echo "checking for IRIX sun library" -cat > conftest.${ac_ext} <&6 +echo "configure:2922: checking IRIX sun library" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then : else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$oldlibs" fi rm -f conftest* +echo "checking syslog" 1>&6 +echo "configure:2942: checking syslog" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + oldlibs="$LIBS" +LIBS="$LIBS -lbsd" +echo "checking syslog in libbsd.a" 1>&6 +echo "configure:2960: checking syslog in libbsd.a" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "- found." 1>&6 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="oldlibs" +echo "- bad news: syslog missing." 1>&6 + cat >> confdefs.h <<\EOF +#define NOSYSLOG 1 +EOF +fi +rm -f conftest* +fi +rm -f conftest* -test -n "$silent" || echo "checking for wait union" -cat > conftest.${ac_ext} < conftest.$ac_ext <&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + LIBS="$LIBS -lsocket -lcrypt_i" +fi +rm -f conftest* + + +echo "checking wait union" 1>&6 +echo "configure:3005: checking wait union" >&5 +cat > conftest.$ac_ext < #include -int main() { return 0; } -int t() { +int main() { + union wait x; int y; #ifdef WEXITSTATUS y = WEXITSTATUS(x); #endif + ; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:3022: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining BSDWAIT" -echo "#define" BSDWAIT "1" >> confdefs.h -DEFS="$DEFS -DBSDWAIT=1" -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} -" -} - + cat >> confdefs.h <<\EOF +#define BSDWAIT 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - if test -z "$butterfly"; then -test -n "$silent" || echo "checking for termio or termios" -cat > conftest.${ac_ext} <&6 +echo "configure:3036: checking for termio or termios" >&5 +cat > conftest.$ac_ext < 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"` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` 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" -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} -" -} - + cat >> confdefs.h <<\EOF +#define TERMIO 1 +EOF else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* if test -n "$posix"; then -cat > conftest.${ac_ext} < conftest.$ac_ext < 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"` +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` 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" -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} -" -} - + cat >> confdefs.h <<\EOF +#define TERMIO 1 +EOF +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* fi @@ -2524,60 +3079,57 @@ fi rm -f conftest* fi -test -n "$silent" || echo "checking for getspnam" -cat > conftest.${ac_ext} <&6 +echo "configure:3084: checking getspnam" >&5 +cat > conftest.$ac_ext < -int main() { return 0; } -int t() { getspnam("x");; return 0; } +int main() { +getspnam("x"); +; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:3093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining SHADOWPW" -echo "#define" SHADOWPW "1" >> confdefs.h -DEFS="$DEFS -DSHADOWPW=1" -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} -" -} - + cat >> confdefs.h <<\EOF +#define SHADOWPW 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - -test -n "$silent" || echo "checking for getttyent" -cat > conftest.${ac_ext} <&6 +echo "configure:3106: checking getttyent" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining GETTTYENT" -echo "#define" GETTTYENT "1" >> confdefs.h -DEFS="$DEFS -DGETTTYENT=1" -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} -" -} - + cat >> confdefs.h <<\EOF +#define GETTTYENT 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -f conftest* - -test -n "$silent" || echo "checking whether memcpy/memmove/bcopy handles overlapping arguments" -cat > conftest.${ac_ext} <&6 +echo "configure:3128: checking whether memcpy/memmove/bcopy handles overlapping arguments" >&5 +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext </dev/null; then - -{ -test -n "$verbose" && \ -echo " defining USEBCOPY" -echo "#define" USEBCOPY "1" >> confdefs.h -DEFS="$DEFS -DUSEBCOPY=1" -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} -" -} - +if { (eval echo configure:3149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + cat >> confdefs.h <<\EOF +#define USEBCOPY 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -fr conftest* +fi + -cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext </dev/null; then - -{ -test -n "$verbose" && \ -echo " defining USEMEMMOVE" -echo "#define" USEMEMMOVE "1" >> confdefs.h -DEFS="$DEFS -DUSEMEMMOVE=1" -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} -" -} - +if { (eval echo configure:3184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + cat >> confdefs.h <<\EOF +#define USEMEMMOVE 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -fr conftest* +fi -cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext </dev/null; then - -{ -test -n "$verbose" && \ -echo " defining USEMEMCPY" -echo "#define" USEMEMCPY "1" >> confdefs.h -DEFS="$DEFS -DUSEMEMCPY=1" -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} -" -} - +if { (eval echo configure:3220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + cat >> confdefs.h <<\EOF +#define USEMEMCPY 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 fi rm -fr conftest* +fi + -test -n "$silent" || echo "checking for long file names" +echo $ac_n "checking long file names""... $ac_c" 1>&6 +echo "configure:3235: checking long file names" >&5 (echo 1 > /tmp/conftest9012345) 2>/dev/null (echo 2 > /tmp/conftest9012346) 2>/dev/null val=`cat /tmp/conftest9012345 2>/dev/null` -if test -f /tmp/conftest9012345 && test "$val" = 1; then : -else -{ -test -n "$verbose" && \ -echo " defining" NAME_MAX to be "14" -echo "#define" NAME_MAX "14" >> confdefs.h -DEFS="$DEFS -DNAME_MAX=14" -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} -" -} +if test -f /tmp/conftest9012345 && test "$val" = 1; then +echo "$ac_t""yes" 1>&6 +else +echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define NAME_MAX 14 +EOF fi rm -f /tmp/conftest* -test -n "$silent" || echo "checking for vsprintf" -cat > conftest.${ac_ext} <&6 +echo "configure:3251: checking for vsprintf" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining USEVARARGS" -echo "#define" USEVARARGS "1" >> confdefs.h -DEFS="$DEFS -DUSEVARARGS=1" -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} -" -} - + echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF +#define USEVARARGS 1 +EOF +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 fi rm -f conftest* - -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} <&6 +echo "configure:3279: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < -#include -int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:3292: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining DIRENT" -echo "#define" DIRENT "1" >> confdefs.h -DEFS="$DEFS -DDIRENT=1" -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} -" -} - ac_dir_header=dirent.h - -fi -rm -f conftest* -fi -if test -z "$ac_dir_header"; then - test -n "$silent" || echo "checking for sys/ndir.h" -cat > conftest.${ac_ext} < -#include -int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } -EOF -if eval $ac_compile; then + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining SYSNDIR" -echo "#define" SYSNDIR "1" >> confdefs.h -DEFS="$DEFS -DSYSNDIR=1" -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} -" -} - ac_dir_header=sys/ndir.h - + eval "ac_cv_header_dirent_$ac_safe=no" fi rm -f conftest* fi -if test -z "$ac_dir_header"; then - test -n "$silent" || echo "checking for sys/dir.h" -cat > conftest.${ac_ext} < -#include -int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <> confdefs.h -DEFS="$DEFS -DSYSDIR=1" -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} -" -} - ac_dir_header=sys/dir.h - -fi -rm -f conftest* + ac_header_dirent=$ac_hdr; break +else + echo "$ac_t""no" 1>&6 fi -if test -z "$ac_dir_header"; then - test -n "$silent" || echo "checking for ndir.h" -cat > conftest.${ac_ext} < -#include -int main() { return 0; } -int t() { DIR *dirp = 0;; return 0; } +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:3317: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining NDIR" -echo "#define" NDIR "1" >> confdefs.h -DEFS="$DEFS -DNDIR=1" -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} -" -} - ac_dir_header=ndir.h - + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -fi +LIBS="$ac_save_LIBS" -test -n "$silent" || echo "checking for closedir return value" -cat > conftest.${ac_ext} < -#include <$ac_dir_header> -int closedir(); main() { exit(closedir(opendir(".")) != 0); } -EOF -eval $ac_compile -if test -s conftest && (./conftest; exit) 2>/dev/null; then - : +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" else - -{ -test -n "$verbose" && \ -echo " defining VOID_CLOSEDIR" -echo "#define" VOID_CLOSEDIR "1" >> confdefs.h -DEFS="$DEFS -DVOID_CLOSEDIR=1" -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} -" -} - + echo "$ac_t""no" 1>&6 fi -rm -fr conftest* - -test -n "$silent" || echo "checking for Xenix" -cat > conftest.${ac_ext} <&6 +echo "configure:3358: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext < conftest.out 2>&1" -if egrep "yes" conftest.out >/dev/null 2>&1; then +if { (eval echo configure:3377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - XENIX=1 - + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" -if test -n "$XENIX"; then +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 LIBS="$LIBS -lx" - case "$DEFS" in - *SYSNDIR*) ;; - *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx. - esac +else + echo "$ac_t""no" 1>&6 +fi + fi -test -n "$silent" || echo "checking for setenv" -cat > conftest.${ac_ext} <&6 +echo "configure:3401: checking for setenv" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining USESETENV" -echo "#define" USESETENV "1" >> confdefs.h -DEFS="$DEFS -DUSESETENV=1" -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} -" -} - + echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF +#define USESETENV 1 +EOF else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - test -n "$silent" || echo "checking for putenv" -cat > conftest.${ac_ext} <&6 +echo $ac_n "checking for putenv""... $ac_c" 1>&6 +echo "configure:3422: checking for putenv" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining NEEDPUTENV" -echo "#define" NEEDPUTENV "1" >> confdefs.h -DEFS="$DEFS -DNEEDPUTENV=1" -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} -" -} - - -fi -rm -f conftest* - -fi -rm -f conftest* - - -test -n "$silent" || echo "checking for rename" -cat > conftest.${ac_ext} <&6 else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - -{ -test -n "$verbose" && \ -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} <&6;cat >> confdefs.h <<\EOF +#define NEEDPUTENV 1 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} <> 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} <&6 +echo "configure:3451: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif -int main() { return 0; } -int t() { strerror(0);; return 0; } +; return 0; } EOF -if eval $ac_compile; then +if { (eval echo configure:3479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 "$silent" || echo "checking for utimes" -cat > conftest.${ac_ext} <&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - -{ -test -n "$verbose" && \ -echo " defining HAVE_UTIMES" -echo "#define" HAVE_UTIMES "1" >> confdefs.h -DEFS="$DEFS -DHAVE_UTIMES=1" -ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_UTIMES\${ac_dB}HAVE_UTIMES\${ac_dC}1\${ac_dD} -\${ac_uA}HAVE_UTIMES\${ac_uB}HAVE_UTIMES\${ac_uC}1\${ac_uD} -\${ac_eA}HAVE_UTIMES\${ac_eB}HAVE_UTIMES\${ac_eC}1\${ac_eD} -" -} - - + eval "ac_cv_func_$ac_func=no" fi rm -f conftest* +fi -test -n "$silent" || echo "checking for vsnprintf" -cat > conftest.${ac_ext} <&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <> confdefs.h -DEFS="$DEFS -DHAVE_VSNPRINTF=1" -ac_sed_defs="${ac_sed_defs}\${ac_dA}HAVE_VSNPRINTF\${ac_dB}HAVE_VSNPRINTF\${ac_dC}1\${ac_dD} -\${ac_uA}HAVE_VSNPRINTF\${ac_uB}HAVE_VSNPRINTF\${ac_uC}1\${ac_uD} -\${ac_eA}HAVE_VSNPRINTF\${ac_eB}HAVE_VSNPRINTF\${ac_eC}1\${ac_eD} -" -} - - + +else + echo "$ac_t""no" 1>&6 fi -rm -f conftest* +done -test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lsec -lseq" +test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" -cat > conftest.${ac_ext} <&2; exit 1; } +else + cat > conftest.$ac_ext </dev/null; then +if { (eval echo configure:3514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then : else - echo "configure: Can't run the compiler - internal error. Sorry." >&2; exit 1 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + { echo "configure: error: Can't run the compiler - internal error. Sorry." 1>&2; exit 1; } fi rm -fr conftest* -if test -n "$prefix"; then - -{ -test -n "$verbose" && \ -echo " defining" ETCSCREENRC to be "\"$prefix/etc/screenrc\"" -echo "#define" ETCSCREENRC "\"$prefix/etc/screenrc\"" >> confdefs.h -DEFS="$DEFS -DETCSCREENRC=\"$prefix/etc/screenrc\"" -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 - -# The preferred way to propogate these variables is regular @ substitutions. if test -n "$prefix"; then - ac_prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" -else - prefix=/usr/local +cat >> confdefs.h < confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : else - exec_prefix='${prefix}' # Let make expand it. + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. @@ -3146,36 +3590,36 @@ if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi -# Quote sed substitution magic chars in DEFS. -cat >conftest.def < config.status < $CONFIG_STATUS </dev/null | sed 1q`: # -# $0 $configure_args +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. -ac_cs_usage="Usage: config.status [--recheck] [--version] [--help]" +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do 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 ;; + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "config.status generated by autoconf version 1.11" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -3183,44 +3627,116 @@ do esac done -trap 'rm -fr Makefile doc/Makefile config.h conftest*; exit 1' 1 2 15 -VERSION='$VERSION' -CC='$CC' -CPP='$CPP' -AWK='$AWK' -INSTALL='$INSTALL' -INSTALL_PROGRAM='$INSTALL_PROGRAM' -INSTALL_DATA='$INSTALL_DATA' -LIBS='$LIBS' -srcdir='$srcdir' -top_srcdir='$top_srcdir' -prefix='$prefix' -exec_prefix='$exec_prefix' -ac_prsub='$ac_prsub' -ac_vpsub='$ac_vpsub' -extrasub='$extrasub' -EOF -cat >> config.status <<\EOF - ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile doc/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@VERSION@%$VERSION%g +s%@SCREEN@%$SCREEN%g +s%@GZIP@%$GZIP%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@AWK@%$AWK%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. -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. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else - ac_dir_suffix= + ac_dir_suffix= ac_dots= fi - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` case "$ac_given_srcdir" in .) srcdir=. - if test -z "$ac_dir_suffix"; then top_srcdir=. + if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. @@ -3228,152 +3744,154 @@ for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then top_srcdir="$ac_dots$ac_given_srcdir" ;; esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" rm -f "$ac_file" - comment_str="Generated automatically from `echo $ac_file|sed 's|.*/||'`.in by configure." + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in - *.c | *.h | *.C | *.cc | *.m ) echo "/* $comment_str */" > "$ac_file" ;; - * ) echo "# $comment_str" > "$ac_file" ;; + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; esac - sed -e " -$ac_prsub -$ac_vpsub -$extrasub -s%@VERSION@%$VERSION%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@AWK@%$AWK%g -s%@INSTALL@%$INSTALL%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@LIBS@%$LIBS%g + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g 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 +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done +rm -f conftest.s* -# 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. +# These sed commands 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. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s!^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*!\1#\2' +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' -ac_dD='!g' +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_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' -ac_uD='\4!g' +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_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' ac_eC=' ' -ac_eD='!g' -rm -f conftest.sed +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then EOF -# Turn off quoting long enough to insert the sed commands. -rm -f conftest.sh -cat > conftest.sh <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + EOF -# Break up $ac_sed_defs (now in conftest.sh) because some shells have a limit -# on the size of here documents. +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr -# Maximum number of lines to put in a single here document. -ac_max_sh_lines=9 +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail while : do - # wc gives bogus results for an empty file on some AIX systems. - ac_lines=`grep -c . conftest.sh` + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - rm -f conftest.s1 conftest.s2 - 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 <> config.status - cat conftest.s1 >> config.status - echo 'CONFEOF' >> config.status - rm -f conftest.s1 conftest.sh - mv conftest.s2 conftest.sh + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals done -rm -f conftest.sh - -# Now back to your regularly scheduled config.status. -cat >> config.status <<\EOF -# This sed command replaces #undef's with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it in -# config.h. -cat >> conftest.sed <<\CONFEOF -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. -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 +rm -f conftest.vals - 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 +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.h1 >> conftest.h - rm -f conftest.h1 + cat conftest.in >> conftest.h + rm -f conftest.in 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 + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi rm -f $ac_file mv conftest.h $ac_file fi fi; done -rm -f conftest.sed - - -exit 0 EOF -chmod +x config.status -# Some shells look in PATH for config.status without the "./". -test -n "$no_create" || ${CONFIG_SHELL-/bin/sh} ./config.status +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF # a hook for preserving undef directive in config.h -if test -z "$no_create" ; then -mv config.h conftest -sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h -rm -f conftest -fi -cat >> config.status << EOF mv config.h conftest sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h rm -f conftest + +exit 0 EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + echo "" if test -z "$AWK"; then diff --git a/src/configure.in b/src/configure.in index 2b7f2dc..c02de6d 100644 --- a/src/configure.in +++ b/src/configure.in @@ -12,19 +12,20 @@ AC_CONFIG_HEADER(config.h) dnl dnl Define some useful macros dnl -define(AC_PROGRAM_SOURCE, +AC_DEFUN(AC_PROGRAM_SOURCE, [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c </dev/null | sed -e '1,/_CUT_HERE_/d' > conftest.out +eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' > conftest.out" . ./conftest.out rm -f conftest* ])dnl dnl define(AC_NOTE, -[test -n "$silent" || echo "$1"])dnl +[echo "$1" 1>&AC_FD_MSG +])dnl dnl dnl Extract version from patchlevel.h @@ -35,23 +36,38 @@ pat=`sed < ${srcdir}/patchlevel.h -n -e '/#define PATCHLEVEL/s/#define PATCHLEVE VERSION="$rev.$vers.$pat" AC_NOTE(this is screen version $VERSION) AC_SUBST(VERSION) -AC_PREFIX(screen) -AC_PREFIX(gzip) +AC_PREFIX_PROGRAM(screen) +AC_PREFIX_PROGRAM(gzip) AC_PROG_CC AC_PROG_CPP -AC_GCC_TRADITIONAL +AC_PROG_GCC_TRADITIONAL AC_ISC_POSIX -AC_TEST_PROGRAM(main(){exit(0);},,AC_ERROR(Can't run the compiler - sorry)) +AC_TRY_RUN(main(){exit(0);},,[ +if test $CC != cc ; then +AC_NOTE(Your $CC failed - restarting with CC=cc) +AC_NOTE() +CC=cc +export CC +exec $0 $configure_args +fi +]) + +AC_TRY_RUN(main(){exit(0);},, +exec 5>&2 +eval $ac_link +AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;) +AC_NOTE($ac_compile) +AC_MSG_ERROR(Can't run the compiler - sorry)) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ main() { int __something_strange_(); __something_strange_(0); } -],AC_ERROR(Your compiler does not set the exit status - sorry)) +],AC_MSG_ERROR(Your compiler does not set the exit status - sorry)) AC_PROG_AWK @@ -59,7 +75,7 @@ AC_PROG_INSTALL if test -f etc/toolcheck; then AC_CHECKING(for buggy tools) -sh etc/toolcheck +sh etc/toolcheck 1>&AC_FD_MSG fi dnl @@ -80,16 +96,21 @@ if test -f /sysV68 ; then AC_DEFINE(sysV68) fi +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 oldlibs="$LIBS" -LIBS="$LIBS -lmld" -AC_COMPILE_CHECK(MIPS,,, -test -f /bin/mx && LIBS="$oldlibs" # not on alpha +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" +AC_CHECKING(mld library) +AC_TRY_LINK(,,,LIBS="$oldlibs") +dnl dnl if test -r /dev/ptc; then AC_DEFINE(MIPS) -AC_COMPILE_CHECK(wait3, , [wait3();], , -AC_COMPILE_CHECK(wait2, , [wait2();], +AC_CHECKING(wait3) +AC_TRY_LINK(,[wait3();], , +AC_CHECKING(wait2) +AC_TRY_LINK(,[wait2();], dnl John Rouillard (rouilj@sni-usa.com): dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no dnl job control etc. @@ -97,28 +118,30 @@ dnl Detect RISCOS if wait2 is present, but not wait3. AC_DEFINE(USE_WAIT2) LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd" )) fi -,LIBS="$oldlibs") +fi + AC_CHECKING(for Ultrix) -AC_PROGRAM_EGREP(yes, +AC_EGREP_CPP(yes, [#if defined(ultrix) || defined(__ultrix) - yes + 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") +AC_CHECKING(Pyramid OSX) +AC_TRY_LINK(,[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. AC_CHECKING(for butterfly) -AC_PROGRAM_EGREP(yes, +AC_EGREP_CPP(yes, [#if defined(butterfly) - yes + yes; #endif ], butterfly=1) @@ -127,64 +150,70 @@ if test -n "$ULTRIX"; then test -z "$GCC" && CC="$CC -YBSD" fi AC_CHECKING(for POSIX.1) -AC_PROGRAM_EGREP(yes, +AC_EGREP_CPP(yes, [#include #include main () { #ifdef _POSIX_VERSION - yes + yes; #endif ], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1) fi -AC_COMPILE_CHECK([System V], +AC_CHECKING(for System V) +AC_TRY_COMPILE( [#include #include #include ], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV)) AC_CHECKING(for sequent/ptx) -AC_PROGRAM_EGREP(yes, +AC_EGREP_CPP(yes, [#ifdef _SEQUENT_ - yes + yes; #endif ], LIBS="$LIBS -lsocket -linet";seqptx=1) oldlibs="$LIBS" LIBS="$LIBS -lelf" -AC_COMPILE_CHECK(SVR4,[#include +AC_CHECKING(SVR4) +AC_TRY_LINK([#include ],, -AC_HEADER_CHECK(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN), -AC_HEADER_CHECK(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))) +AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN), +AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))) ,LIBS="$oldlibs") -AC_CHECKING(for Solaris) -AC_PROGRAM_EGREP(yes, -[#if defined(sun) && defined(SVR4) +AC_CHECKING(for Solaris 2.x) +AC_EGREP_CPP(yes, +[#if defined(SVR4) && defined(sun) yes #endif -], LIBS="$LIBS -lkstat") +], LIBS="$LIBS -lsocket -lnsl -lkstat") dnl dnl **** typedefs **** dnl +dnl (currently not used) +dnl dnl AC_CHECKING(for pid_t) -dnl AC_PROGRAM_EGREP(pid_t,[#include +dnl AC_EGREP_CPP(pid_t,[#include dnl ],AC_DEFINE(PID_T_DEFINED)) dnl dnl AC_CHECKING(for sig_t) -dnl AC_PROGRAM_EGREP(sig_t,[#include +dnl AC_EGREP_CPP(sig_t,[#include dnl #include dnl ],AC_DEFINE(SIG_T_DEFINED)) dnl dnl AC_CHECKING(for uid_t) -dnl AC_PROGRAM_EGREP(uid_t,[#include +dnl AC_EGREP_CPP(uid_t,[#include dnl ],AC_DEFINE(UID_T_DEFINED)) +dnl dnl dnl **** Job control **** dnl -AC_COMPILE_CHECK([BSD job control], +AC_CHECKING(BSD job jontrol) +AC_TRY_LINK( [#include #include ], [ @@ -203,7 +232,8 @@ int y = TIOCNOTTY; dnl dnl **** setreuid(), seteuid() **** dnl -AC_COMPILE_CHECK(setreuid, , [ +AC_CHECKING(setreuid) +AC_TRY_LINK(,[ #ifdef __hpux setresuid(0, 0, 0); #else @@ -216,28 +246,32 @@ dnl linux seteuid was broken before V1.1.11 dnl NeXT, AUX, ISC, 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, , [ +AC_CHECKING(seteuid) +AC_TRY_LINK(,[ #if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news) 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);],, +AC_CHECKING(select) +AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, LIBS="$LIBS -lnet -lnsl" -AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],, -AC_ERROR(!!! no select - no screen)) +AC_CHECKING(select with $LIBS) +AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, +AC_MSG_ERROR(!!! no select - no screen)) ) dnl dnl **** FIFO tests **** dnl AC_CHECKING(fifos) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #include #include #include @@ -293,13 +327,13 @@ main() exit(1); exit(0); } -], AC_NOTE(- your fifos are usable);fifo=1, +], AC_NOTE(- your fifos are usable) fifo=1, AC_NOTE(- your fifos are not usable)) rm -f /tmp/conftest* if test -n "$fifo"; then AC_CHECKING(for broken fifo implementation) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #include #include #include @@ -347,7 +381,7 @@ dnl may need LIBS="$LIBS -lsocket" here dnl AC_CHECKING(sockets) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #include #include #include @@ -388,13 +422,13 @@ main() exit(1); exit(0); } -], AC_NOTE(- your sockets are usable);sock=1, +], AC_NOTE(- your sockets are usable) sock=1, AC_NOTE(- your sockets are not usable)) rm -f /tmp/conftest* if test -n "$sock"; then AC_CHECKING(socket implementation) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #include #include #include @@ -447,7 +481,7 @@ if test -n "$fifo"; then elif test -n "$sock"; then AC_NOTE(- using unix-domain sockets, of course) else - AC_ERROR(you have neither usable sockets nor usable pipes -> no screen) + AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen) fi dnl @@ -455,7 +489,7 @@ dnl **** check the select implementation **** dnl AC_CHECKING(select return value) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #include #include #include @@ -478,7 +512,7 @@ main() #ifdef __FreeBSD__ /* From Andrew A. Chernov (ache@astral.msk.su): - * opening RDWR fifo fails in BSD 4.4, but select return values is + * opening RDWR fifo fails in BSD 4.4, but select return values are * right. */ exit(0); @@ -549,7 +583,8 @@ dnl AC_CHECKING(for tgetent) olibs="$LIBS" LIBS="-lcurses $olibs" -AC_COMPILE_CHECK(libcurses,,[ +AC_CHECKING(libcurses) +AC_TRY_LINK(,[ #ifdef __hpux __sorry_hpux_libcurses_is_totally_broken_in_10_10(); #else @@ -557,20 +592,24 @@ tgetent((char *)0, (char *)0); #endif ],, LIBS="-ltermcap $olibs" -AC_COMPILE_CHECK(libtermcap,,tgetent((char *)0, (char *)0);,, +AC_CHECKING(libtermcap) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, LIBS="-ltermlib $olibs" -AC_COMPILE_CHECK(libtermlib,,tgetent((char *)0, (char *)0);,, +AC_CHECKING(libtermlib) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, LIBS="-lncurses $olibs" -AC_COMPILE_CHECK(libncurses,,tgetent((char *)0, (char *)0);,, -AC_ERROR(!!! no tgetent - no screen))))) +AC_CHECKING(libncurses) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, +AC_MSG_ERROR(!!! no tgetent - no screen))))) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ main() { 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)) +AC_CHECKING(ospeed) +AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED)) dnl dnl **** PTY specific things **** @@ -580,6 +619,11 @@ if test -r /dev/ptc; then AC_DEFINE(HAVE_DEV_PTC) fi +AC_CHECKING(for SVR4 ptys) +if test -c /dev/ptmx ; then +AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],AC_DEFINE(HAVE_SVR4_PTYS)) +fi + AC_CHECKING(for ptyranges) if test -d /dev/ptym ; then pdir='/dev/ptym' @@ -587,16 +631,21 @@ else pdir='/dev' fi dnl SCO uses ptyp%d -if test -c /dev/ptyp19; then -ptys=`echo /dev/ptyp??` -else -ptys=`echo $pdir/pty??` -fi +AC_EGREP_CPP(yes, +[#ifdef M_UNIX + yes; +#endif +], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`) +dnl if test -c /dev/ptyp19; then +dnl ptys=`echo /dev/ptyp??` +dnl else +dnl ptys=`echo $pdir/pty??` +dnl fi if test "$ptys" != "$pdir/pty??" ; then 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\") +AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0") +AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1") fi dnl **** pty mode/group handling **** @@ -604,7 +653,7 @@ dnl dnl support provided by Luke Mewburn , 931222 AC_CHECKING(default tty permissions/group) rm -f conftest_grp -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #include #include #include @@ -649,8 +698,9 @@ rm -f conftest_grp dnl dnl **** utmp handling **** dnl -dnl linux has a void pututline, grrr, gcc will error when evaluating it. -AC_COMPILE_CHECK(getutent, [#include /* to get time_t on SCO */ +AC_CHECKING(getutent) +AC_TRY_LINK([ +#include /* to get time_t on SCO */ #include #if defined(SVR4) && !defined(DGUX) #include @@ -662,10 +712,12 @@ AC_COMPILE_CHECK(getutent, [#include /* to get time_t on SCO */ #define pututline _pututline #endif ], -[int x = DEAD_PROCESS; struct utmp *y = pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), +[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), olibs="$LIBS" LIBS="$LIBS -lgen" -AC_COMPILE_CHECK(getutent with -lgen, [#include +AC_CHECKING(getutent with -lgen) +AC_TRY_LINK([ +#include #include #if defined(SVR4) && !defined(DGUX) #include @@ -677,9 +729,11 @@ AC_COMPILE_CHECK(getutent with -lgen, [#include #define pututline _pututline #endif ], -[int x = DEAD_PROCESS; struct utmp *y = pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs") +[int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), LIBS="$olibs") ) -AC_COMPILE_CHECK(ut_host, [#include +AC_CHECKING(ut_host) +AC_TRY_COMPILE([ +#include #include #if defined(SVR4) && !defined(DGUX) #include @@ -688,7 +742,11 @@ AC_COMPILE_CHECK(ut_host, [#include #include #endif ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST)) - +AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no) +if test "$have_utempter" = yes; then + AC_DEFINE(HAVE_UTEMPTER) + LIBS="$LIBS -lutempter" +fi dnl dnl **** loadav **** @@ -697,20 +755,22 @@ 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_CHECKING(getloadavg) +AC_TRY_LINK(,[getloadavg((double *)0, 0);], 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_CHECKING(getloadavg with -lkvm) +AC_TRY_LINK(,[getloadavg((double *)0, 0);], AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs") fi ) if test -z "$load" ; then -AC_PROGRAM_EGREP(yes, +AC_EGREP_CPP(yes, [#if defined(NeXT) || defined(apollo) || defined(linux) - yes + yes; #endif ], load=1) fi @@ -725,15 +785,17 @@ if test ! -f $core && test ! -c $core ; then AC_NOTE(- no kernelfile found) else AC_NOTE(- using kernelfile '$core') - AC_DEFINE_UNQUOTED(LOADAV_UNIX,\"$core\") - AC_HEADER_CHECK(nlist.h, + if test -r $core ; then + AC_DEFINE_UNQUOTED(LOADAV_UNIX,"$core") + AC_CHECK_HEADER(nlist.h, [AC_DEFINE(NLIST_STRUCT) - AC_COMPILE_CHECK(n_un in struct nlist, [#include ], + AC_CHECKING(n_un in struct nlist) + AC_TRY_COMPILE([#include ], [struct nlist n; n.n_un.n_name = 0;], AC_DEFINE(NLIST_NAME_UNION))]) AC_CHECKING(for nlist declaration) - AC_PROGRAM_EGREP([nlist(( | )( | )*.*\(|\()],[ + AC_EGREP_CPP([nlist(( | )( | )*.*\(|\()],[ #ifdef NLIST_STRUCT # include #else @@ -743,7 +805,7 @@ else AC_CHECKING(for avenrun symbol) for av in avenrun _avenrun _Loadavg ; do - AC_TEST_PROGRAM([ + AC_TRY_RUN([ #include #ifdef NLIST_STRUCT #include @@ -781,9 +843,18 @@ main() AC_NOTE(- no avenrun symbol found) else AC_NOTE(- using avenrun symbol '$avensym') - AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,\"$avensym\") + AC_DEFINE_UNQUOTED(LOADAV_AVENRUN,"$avensym") load=1 fi + else + AC_NOTE( Can't configure the load average display feature) + AC_NOTE( because $core is not readable by you.) + AC_NOTE( To configure the load average display feature,) + AC_NOTE( re-run configure as root if possible.) + AC_NOTE( If you are not the system administrator then disregard) + AC_NOTE( this warning. You can still use screen without) + AC_NOTE( the load average display feature.) + fi fi fi @@ -791,7 +862,7 @@ AC_PROGRAM_SOURCE([ #include #include ],[ -#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || (!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k)) +#if ((defined(hp300) && !defined(__hpux)) || defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) || defined(sgi) || defined(SVR4) || defined(sony_news) || !(defined(__osf__) && defined(__alpha)) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) || defined(m88k)) loadtype=long # if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) || defined(AUX) loadscale=65536 @@ -801,8 +872,8 @@ loadscale=65536 loadscale=FSCALE # else # ifdef sgi -loadscale=1024 loadtype=int +loadscale=1024 # else # if defined(MIPS) || defined(SVR4) || defined(m88k) loadscale=256 @@ -828,7 +899,6 @@ if test -n "$loadtype" ; then AC_DEFINE_UNQUOTED(LOADAV_TYPE,$loadtype) fi if test -n "$loadnum" ; then AC_DEFINE_UNQUOTED(LOADAV_NUM,$loadnum) fi if test -n "$loadscale" ; then AC_DEFINE_UNQUOTED(LOADAV_SCALE,$loadscale) fi - dnl dnl **** signal handling **** dnl @@ -840,17 +910,19 @@ AC_DEFINE(SIGVOID) else -AC_COMPILE_CHECK([return type of signal handlers], +AC_CHECKING(return type of signal handlers) +AC_TRY_COMPILE( [#include #include #ifdef signal #undef signal #endif extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID)) -AC_COMPILE_CHECK(sigset, [ +AC_CHECKING(sigset) +AC_TRY_LINK([ #include #include -], [ +],[ #ifdef SIGVOID sigset(0, (void (*)())0); #else @@ -858,7 +930,7 @@ sigset(0, (int (*)())0); #endif ], AC_DEFINE(USESIGSET)) AC_CHECKING(signal implementation) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #include #include @@ -901,26 +973,35 @@ dnl 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" +oldlibs="$LIBS" +LIBS="$LIBS -lcrypt" +AC_CHECKING(crypt) +AC_TRY_LINK(,,,LIBS="$oldlibs") 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" - -dnl SCO stuff -AC_PROGRAM_EGREP(yes, -[#ifdef M_UNIX - yes -#endif -], LIBS="$LIBS -lsocket -lcrypt_i -lc -lx") - oldlibs="$LIBS" LIBS="$LIBS -lsun" -AC_COMPILE_CHECK(IRIX sun library,,,,LIBS="$oldlibs") +AC_CHECKING(IRIX sun library) +AC_TRY_LINK(,,,LIBS="$oldlibs") + +AC_CHECKING(syslog) +AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS" +LIBS="$LIBS -lbsd" +AC_CHECKING(syslog in libbsd.a) +AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="oldlibs" +AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])]) +AC_EGREP_CPP(yes, +[#ifdef M_UNIX + yes; +#endif +], LIBS="$LIBS -lsocket -lcrypt_i") dnl dnl **** misc things **** dnl -AC_COMPILE_CHECK(wait union,[#include +AC_CHECKING(wait union) +AC_TRY_COMPILE([#include #include ],[ union wait x; @@ -932,21 +1013,22 @@ AC_COMPILE_CHECK(wait union,[#include if test -z "$butterfly"; then AC_CHECKING(for termio or termios) -AC_TEST_CPP([#include ], AC_DEFINE(TERMIO), +AC_TRY_CPP([#include ], AC_DEFINE(TERMIO), if test -n "$posix"; then -AC_TEST_CPP([#include ], AC_DEFINE(TERMIO)) +AC_TRY_CPP([#include ], AC_DEFINE(TERMIO)) fi ) fi -dnl AC_HEADER_CHECK(shadow.h, AC_DEFINE(SHADOWPW)) -AC_COMPILE_CHECK(getspnam, [#include ], [getspnam("x");], - AC_DEFINE(SHADOWPW)) +dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW)) +AC_CHECKING(getspnam) +AC_TRY_LINK([#include ], [getspnam("x");],AC_DEFINE(SHADOWPW)) -AC_COMPILE_CHECK(getttyent, , [getttyent();], AC_DEFINE(GETTTYENT)) +AC_CHECKING(getttyent) +AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT)) AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ main() { char buf[10]; strcpy(buf, "abcdefghi"); @@ -960,7 +1042,7 @@ main() { exit(0); /* libc version works properly. */ }], AC_DEFINE(USEBCOPY)) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #define bcopy(s,d,l) memmove(d,s,l) main() { char buf[10]; @@ -976,7 +1058,7 @@ main() { }], AC_DEFINE(USEMEMMOVE)) -AC_TEST_PROGRAM([ +AC_TRY_RUN([ #define bcopy(s,d,l) memcpy(d,s,l) main() { char buf[10]; @@ -991,56 +1073,49 @@ main() { exit(0); /* libc version works properly. */ }], AC_DEFINE(USEMEMCPY)) -AC_CHECKING(for long file names) +AC_MSG_CHECKING(long file names) (echo 1 > /tmp/conftest9012345) 2>/dev/null (echo 2 > /tmp/conftest9012346) 2>/dev/null val=`cat /tmp/conftest9012345 2>/dev/null` -if test -f /tmp/conftest9012345 && test "$val" = 1; then : -else AC_DEFINE(NAME_MAX, 14) +if test -f /tmp/conftest9012345 && test "$val" = 1; then +AC_MSG_RESULT(yes) +else +AC_MSG_RESULT(no) +AC_DEFINE(NAME_MAX, 14) fi rm -f /tmp/conftest* -AC_COMPILE_CHECK(vsprintf, , [vsprintf(0,0,0);], AC_DEFINE(USEVARARGS)) +AC_MSG_CHECKING(for vsprintf) +AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no)) -AC_DIR_HEADER -AC_XENIX_DIR +AC_HEADER_DIRENT -AC_COMPILE_CHECK(setenv, , [setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_DEFINE(USESETENV), -AC_COMPILE_CHECK(putenv, , [putenv((char *)0);unsetenv((char *)0);], , -AC_DEFINE(NEEDPUTENV) +AC_MSG_CHECKING(for setenv) +AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV), +AC_MSG_RESULT(no) +AC_MSG_CHECKING(for putenv) +AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV) )) -AC_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)) -AC_COMPILE_CHECK(utimes, ,[utimes(0,0);], AC_DEFINE(HAVE_UTIMES)) -AC_COMPILE_CHECK(vsnprintf, ,[vsnprintf(0,0,0);], AC_DEFINE(HAVE_VSNPRINTF)) +AC_CHECK_FUNCS(rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd) dnl dnl **** the end **** dnl dnl Ptx bug workaround -- insert -lc after -ltermcap -test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lsec -lseq" +test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" -AC_TEST_PROGRAM(main(){exit(0);},,AC_ERROR(Can't run the compiler - internal error. Sorry.)) +AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.)) if test -n "$prefix"; then -AC_DEFINE_UNQUOTED(ETCSCREENRC,\"$prefix/etc/screenrc\") +AC_DEFINE_UNQUOTED(ETCSCREENRC,"$prefix/etc/screenrc") fi -AC_OUTPUT(Makefile doc/Makefile) - +AC_OUTPUT(Makefile doc/Makefile, [[ # a hook for preserving undef directive in config.h -if test -z "$no_create" ; then -mv config.h conftest -sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h -rm -f conftest -fi -cat >> config.status << EOF mv config.h conftest sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h rm -f conftest -EOF +]]) echo "" if test -z "$AWK"; then diff --git a/src/display.c b/src/display.c index 2fb17b4..cf2ebf6 100644 --- a/src/display.c +++ b/src/display.c @@ -31,21 +31,41 @@ RCS_ID("$Id$ FAU") #include "config.h" #include "screen.h" #include "extern.h" +#include "braille.h" static int CountChars __P((int)); static int PutChar __P((int)); static int BlankResize __P((int, int)); +static int CallRewrite __P((int, int, int, int)); +static void FreeCanvas __P((struct canvas *)); +static void disp_readev_fn __P((struct event *, char *)); +static void disp_writeev_fn __P((struct event *, char *)); +static void disp_status_fn __P((struct event *, char *)); +static void disp_hstatus_fn __P((struct event *, char *)); +static void cv_winid_fn __P((struct event *, char *)); +#ifdef MAPKEYS +static void disp_map_fn __P((struct event *, char *)); +#endif +static void WriteLP __P((int, int)); +static void INSERTCHAR __P((int)); +static void RAW_PUTCHAR __P((int)); +extern struct layer *flayer; extern struct win *windows; +extern struct LayFuncs WinLf; extern int use_hardstatus; -extern int MsgMinWait; +extern int MsgWait, MsgMinWait; extern int Z0width, Z1width; extern char *blank, *null; extern struct mline mline_blank, mline_null; extern struct mchar mchar_null, mchar_blank, mchar_so; +/* XXX shouldn't be here */ +extern char *hstatusstring; +extern char *captionstring; + /* * tputs needs this to calculate the padding */ @@ -68,6 +88,8 @@ int defobuflimit = OBUF_MAX; #ifdef AUTO_NUKE int defautonuke = 0; #endif +int captionalways; +int hardstatusemu = HSTATUS_IGNORE; /* * Default layer management @@ -94,23 +116,18 @@ void DefClearLine(y, xs, xe) int y, xs, xe; { - DisplayLine(&mline_null, &mline_blank, y, xs, xe); + LClearLine(flayer, y, xs, xe, (struct mline *)0); } /*ARGSUSED*/ int -DefRewrite(y, xs, xe, doit) +DefRewrite(y, xs, xe, rend, doit) int y, xs, xe, doit; +struct mchar *rend; { return EXPENSIVE; } -void -DefSetCursor() -{ - GotoPos(0, 0); -} - /*ARGSUSED*/ int DefResize(wi, he) @@ -122,13 +139,13 @@ int wi, he; void DefRestore() { - InsertMode(0); - ChangeScrollRegion(0, D_height - 1); - KeypadMode(0); - CursorkeysMode(0); - CursorVisibility(0); - SetRendition(&mchar_null); - SetFlow(FLOW_NOW); + LAY_DISPLAYS(flayer, InsertMode(0)); + /* ChangeScrollRegion(0, D_height - 1); */ + LKeypadMode(flayer, 0); + LCursorkeysMode(flayer, 0); + LCursorVisibility(flayer, 0); + LSetRendition(flayer, &mchar_null); + LSetFlow(flayer, FLOW_NOW); } /* @@ -142,30 +159,25 @@ struct LayFuncs BlankLf = DefRedisplayLine, DefClearLine, DefRewrite, - DefSetCursor, BlankResize, DefRestore }; -struct layer BlankLayer = -{ - 0, - 0, - &BlankLf, - 0 -}; - /*ARGSUSED*/ static int BlankResize(wi, he) int wi, he; { + flayer->l_width = wi; + flayer->l_height = he; return 0; } /* - * Generate new display + * Generate new display, start with a blank layer. + * The termcap arrays are not initialised here. + * The new display is placed in the displays list. */ struct display * @@ -175,14 +187,14 @@ int fd, pid; struct mode *Mode; { struct user **u; + struct baud_values *b; if (!*(u = FindUserPtr(uname)) && UserAdd(uname, (char *)0, u)) return 0; /* could not find or add user */ #ifdef MULTI - if ((display = (struct display *)malloc(sizeof(*display))) == 0) + if ((display = (struct display *)calloc(1, sizeof(*display))) == 0) return 0; - bzero((char *) display, sizeof(*display)); #else if (displays) return 0; @@ -193,106 +205,102 @@ struct mode *Mode; D_flow = 1; D_nonblock = 0; D_userfd = fd; + D_readev.fd = D_writeev.fd = fd; + D_readev.type = EV_READ; + D_writeev.type = EV_WRITE; + D_readev.data = D_writeev.data = (char *)display; + D_readev.handler = disp_readev_fn; + D_writeev.handler = disp_writeev_fn; + evenq(&D_readev); + D_writeev.condpos = &D_obuflen; + D_writeev.condneg = &D_obuffree; + evenq(&D_writeev); + D_statusev.type = EV_TIMEOUT; + D_statusev.data = (char *)display; + D_statusev.handler = disp_status_fn; + D_hstatusev.type = EV_TIMEOUT; + D_hstatusev.data = (char *)display; + D_hstatusev.handler = disp_hstatus_fn; +#ifdef MAPKEYS + D_mapev.type = EV_TIMEOUT; + D_mapev.data = (char *)display; + D_mapev.handler = disp_map_fn; +#endif D_OldMode = *Mode; Resize_obuf(); /* Allocate memory for buffer */ D_obufmax = defobuflimit; + D_obuflenmax = D_obuflen - D_obufmax; #ifdef AUTO_NUKE D_auto_nuke = defautonuke; #endif D_obufp = D_obuf; D_printfd = -1; D_userpid = pid; -#if defined(POSIX) || defined(TERMIO) -# ifdef POSIX - switch (cfgetospeed(&D_OldMode.tio)) + +#ifdef POSIX + if ((b = lookup_baud((int)cfgetospeed(&D_OldMode.tio)))) + D_dospeed = b->idx; +#else +# ifdef TERMIO + if ((b = lookup_baud(D_OldMode.tio.c_cflag & CBAUD))) + D_dospeed = b->idx; # else - switch (D_OldMode.tio.c_cflag & CBAUD) + D_dospeed = (short)D_OldMode.m_ttyb.sg_ospeed; # endif - { -#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 /* POSIX || TERMIO */ - D_dospeed = (short) D_OldMode.m_ttyb.sg_ospeed; -#endif /* POSIX || TERMIO */ + debug1("New displays ospeed = %d\n", D_dospeed); strncpy(D_usertty, utty, sizeof(D_usertty) - 1); D_usertty[sizeof(D_usertty) - 1] = 0; strncpy(D_termname, term, sizeof(D_termname) - 1); D_termname[sizeof(D_termname) - 1] = 0; D_user = *u; - D_lay = &BlankLayer; - D_layfn = BlankLayer.l_layfn; + D_processinput = ProcessInput; return display; } + void FreeDisplay() { struct win *p; + struct canvas *cv, *cvp; #ifdef MULTI struct display *d, **dp; #endif +#ifdef FONT FreeTransTable(); +#endif + if (D_userfd >= 0) + { + Flush(); + SetTTY(D_userfd, &D_OldMode); + fcntl(D_userfd, F_SETFL, 0); + } freetty(); if (D_tentry) free(D_tentry); D_tentry = 0; + if (D_processinputdata) + free(D_processinputdata); + D_processinputdata = 0; D_tcinited = 0; + evdeq(&D_hstatusev); + evdeq(&D_statusev); + evdeq(&D_readev); + evdeq(&D_writeev); +#ifdef MAPKEYS + evdeq(&D_mapev); +#endif +#ifdef HAVE_BRAILLE + if (bd.bd_dpy == display) + { + bd.bd_start_braille = 0; + StartBraille(); + } +#endif + #ifdef MULTI for (dp = &displays; (d = *dp) ; dp = &d->d_next) if (d == display) @@ -303,22 +311,329 @@ FreeDisplay() if (D_obuf) free(D_obuf); *dp = display->d_next; - free((char *)display); + cv = display->d_cvlist; #else /* MULTI */ ASSERT(display == displays); ASSERT(display == &TheDisplay); + cv = display->d_cvlist; + display->d_cvlist = 0; 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; } + for (; cv; cv = cvp) + { + cvp = cv->c_next; + FreeCanvas(cv); + } +#ifdef MULTI + free((char *)display); +#endif display = 0; } +int +MakeDefaultCanvas() +{ + struct canvas *cv; + + ASSERT(display); + if ((cv = (struct canvas *)calloc(1, sizeof *cv)) == 0) + return -1; + cv->c_xs = 0; + cv->c_xe = D_width - 1; + cv->c_ys = 0; + cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - captionalways; + cv->c_xoff = 0; + cv->c_yoff = 0; + cv->c_next = 0; + cv->c_display = display; + cv->c_vplist = 0; + cv->c_captev.type = EV_TIMEOUT; + cv->c_captev.data = (char *)cv; + cv->c_captev.handler = cv_winid_fn; + + cv->c_blank.l_cvlist = cv; + cv->c_blank.l_width = cv->c_xe - cv->c_xs + 1; + cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1; + cv->c_blank.l_x = cv->c_blank.l_y = 0; + cv->c_blank.l_layfn = &BlankLf; + cv->c_blank.l_data = 0; + cv->c_blank.l_next = 0; + cv->c_blank.l_bottom = &cv->c_blank; + cv->c_blank.l_blocking = 0; + cv->c_layer = &cv->c_blank; + cv->c_lnext = 0; + + D_cvlist = cv; + RethinkDisplayViewports(); + D_forecv = cv; /* default input focus */ + return 0; +} + +void +FreeCanvas(cv) +struct canvas *cv; +{ + struct viewport *vp, *nvp; + struct win *p; + + p = Layer2Window(cv->c_layer); + SetCanvasWindow(cv, 0); + if (p) + WindowChanged(p, 'u'); + if (flayer == cv->c_layer) + flayer = 0; + for (vp = cv->c_vplist; vp; vp = nvp) + { + vp->v_canvas = 0; + nvp = vp->v_next; + vp->v_next = 0; + free(vp); + } + evdeq(&cv->c_captev); + free(cv); +} + +int +AddCanvas() +{ + int hh, h, i, j; + struct canvas *cv, **cvpp; + + for (cv = D_cvlist, j = 0; cv; cv = cv->c_next) + j++; + j++; /* new canvas */ + h = D_height - (D_has_hstatus == HSTATUS_LASTLINE); + if (h / j <= 1) + return -1; + + for (cv = D_cvlist; cv; cv = cv->c_next) + if (cv == D_forecv) + break; + ASSERT(cv); + cvpp = &cv->c_next; + + if ((cv = (struct canvas *)calloc(1, sizeof *cv)) == 0) + return -1; + + cv->c_xs = 0; + cv->c_xe = D_width - 1; + cv->c_ys = 0; + cv->c_ye = D_height - 1; + cv->c_xoff = 0; + cv->c_yoff = 0; + cv->c_display = display; + cv->c_vplist = 0; + cv->c_captev.type = EV_TIMEOUT; + cv->c_captev.data = (char *)cv; + cv->c_captev.handler = cv_winid_fn; + + cv->c_blank.l_cvlist = cv; + cv->c_blank.l_width = cv->c_xe - cv->c_xs + 1; + cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1; + cv->c_blank.l_x = cv->c_blank.l_y = 0; + cv->c_blank.l_layfn = &BlankLf; + cv->c_blank.l_data = 0; + cv->c_blank.l_next = 0; + cv->c_blank.l_bottom = &cv->c_blank; + cv->c_blank.l_blocking = 0; + cv->c_layer = &cv->c_blank; + cv->c_lnext = 0; + + cv->c_next = *cvpp; + *cvpp = cv; + + i = 0; + for (cv = D_cvlist; cv; cv = cv->c_next) + { + hh = h / j-- - 1; + cv->c_ys = i; + cv->c_ye = i + hh - 1; + cv->c_yoff = i; + i += hh + 1; + h -= hh + 1; + } + + RethinkDisplayViewports(); + ResizeLayersToCanvases(); + return 0; +} + +void +RemCanvas() +{ + int hh, h, i, j; + struct canvas *cv, **cvpp; + int did = 0; + + h = D_height - (D_has_hstatus == HSTATUS_LASTLINE); + for (cv = D_cvlist, j = 0; cv; cv = cv->c_next) + j++; + if (j == 1) + return; + i = 0; + j--; + for (cvpp = &D_cvlist; (cv = *cvpp); cvpp = &cv->c_next) + { + if (cv == D_forecv && !did) + { + *cvpp = cv->c_next; + FreeCanvas(cv); + cv = *cvpp; + D_forecv = cv ? cv : D_cvlist; + D_fore = Layer2Window(D_forecv->c_layer); + flayer = D_forecv->c_layer; + if (cv == 0) + break; + did = 1; + } + hh = h / j-- - 1; + if (!captionalways && i == 0 && j == 0) + hh++; + cv->c_ys = i; + cv->c_ye = i + hh - 1; + cv->c_yoff = i; + i += hh + 1; + h -= hh + 1; + } + RethinkDisplayViewports(); + ResizeLayersToCanvases(); +} + +void +OneCanvas() +{ + struct canvas *mycv = D_forecv; + struct canvas *cv, **cvpp; + + for (cvpp = &D_cvlist; (cv = *cvpp);) + { + if (cv == mycv) + { + cv->c_ys = 0; + cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - captionalways; + cv->c_yoff = 0; + cvpp = &cv->c_next; + } + else + { + *cvpp = cv->c_next; + FreeCanvas(cv); + } + } + RethinkDisplayViewports(); + ResizeLayersToCanvases(); +} + +int +RethinkDisplayViewports() +{ + struct canvas *cv; + struct viewport *vp, *vpn; + + /* free old viewports */ + for (cv = display->d_cvlist; cv; cv = cv->c_next) + { + for (vp = cv->c_vplist; vp; vp = vpn) + { + vp->v_canvas = 0; + vpn = vp->v_next; + bzero(vp, sizeof(*vp)); + free(vp); + } + cv->c_vplist = 0; + } + display->d_vpxmin = -1; + display->d_vpxmax = -1; + + for (cv = display->d_cvlist; cv; cv = cv->c_next) + { + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; +#ifdef HOLE + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = (cv->c_ys + cv->c_ye) / 2; + vp->v_xe = cv->c_xe; + vp->v_ye = cv->c_ye; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; + + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; + vp->v_canvas = cv; + vp->v_xs = (cv->c_xs + cv->c_xe) / 2; + vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4; + vp->v_xe = cv->c_xe; + vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; + + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4; + vp->v_xe = (3 * cv->c_xs + cv->c_xe) / 4 - 1; + vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; + + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = cv->c_ys; + vp->v_xe = cv->c_xe; + vp->v_ye = (3 * cv->c_ys + cv->c_ye) / 4 - 1; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; +#else + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = cv->c_ys; + vp->v_xe = cv->c_xe; + vp->v_ye = cv->c_ye; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; +#endif + + if (cv->c_xs < display->d_vpxmin || display->d_vpxmin == -1) + display->d_vpxmin = cv->c_xs; + if (cv->c_xe > display->d_vpxmax || display->d_vpxmax == -1) + display->d_vpxmax = cv->c_xe; + } + return 0; +} + +void +RethinkViewportOffsets(cv) +struct canvas *cv; +{ + struct viewport *vp; + + for (vp = cv->c_vplist; vp; vp = vp->v_next) + { + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + } +} + /* * if the adaptflag is on, we keep the size of this display, else * we may try to restore our old window sizes. @@ -336,11 +651,11 @@ int adapt; if (D_IM && strcmp(D_IM, D_EI)) PutStr(D_EI); D_insert = 0; - /* Check for toggle */ #ifdef MAPKEYS PutStr(D_KS); PutStr(D_CCS); #else + /* Check for toggle */ if (D_KS && strcmp(D_KS, D_KE)) PutStr(D_KE); if (D_CCS && strcmp(D_CCS, D_CCE)) @@ -372,16 +687,22 @@ FinitTerm() if (D_tcinited) { ResizeDisplay(D_defwidth, D_defheight); - DefRestore(); + InsertMode(0); + ChangeScrollRegion(0, D_height - 1); + KeypadMode(0); + CursorkeysMode(0); + CursorVisibility(0); SetRendition(&mchar_null); + SetFlow(FLOW_NOW); #ifdef MAPKEYS PutStr(D_KE); PutStr(D_CCE); #endif if (D_hstatus) - PutStr(D_DS); + ShowHStatus((char *)0); D_x = D_y = -1; GotoPos(0, D_height - 1); + AddChar('\r'); AddChar('\n'); PutStr(D_TE); } @@ -389,7 +710,7 @@ FinitTerm() } -void +static void INSERTCHAR(c) int c; { @@ -443,11 +764,11 @@ int c; } D_lp_missing = 1; D_rend.image = c; + D_lpchar = D_rend; #ifdef KANJI D_lp_mbcs = D_mbcs; D_mbcs = 0; #endif - D_lpchar = D_rend; } /* @@ -455,12 +776,14 @@ int c; * NOTE: charset Nr. 0 has a conversion table, but c1, c2, ... don't. */ -void +STATIC void RAW_PUTCHAR(c) int c; { ASSERT(display); -#ifdef KANJI + +#ifdef FONT +# ifdef KANJI if (D_rend.font == KANJI) { int t = c; @@ -497,11 +820,14 @@ int c; c |= 0x80; } kanjiloop: -#endif +# endif if (D_xtable && D_xtable[(int)(unsigned char)D_rend.font] && D_xtable[(int)(unsigned char)D_rend.font][(int)(unsigned char)c]) AddStr(D_xtable[(int)(unsigned char)D_rend.font][(int)(unsigned char)c]); else AddChar(D_rend.font != '0' ? c : D_c0_tab[(int)(unsigned char)c]); +#else /* FONT */ + AddChar(c); +#endif /* FONT */ if (++D_x >= D_width) { @@ -566,7 +892,7 @@ int on; if (display && on != D_insert && D_IM) { D_insert = on; - if (D_insert) + if (on) PutStr(D_IM); else PutStr(D_EI); @@ -586,7 +912,7 @@ int on; if (display && D_keypad != on && D_KS) { D_keypad = on; - if (D_keypad) + if (on) PutStr(D_KS); else PutStr(D_KE); @@ -605,7 +931,7 @@ int on; if (display && D_cursorkeys != on && D_CCS) { D_cursorkeys = on; - if (D_cursorkeys) + if (on) PutStr(D_CCS); else PutStr(D_CCE); @@ -662,14 +988,74 @@ CalcCost(s) register char *s; { ASSERT(display); - if (!s) + if (s) + { + StrCost = 0; + ospeed = D_dospeed; + tputs(s, 1, CountChars); + return StrCost; + } + else return EXPENSIVE; - StrCost = 0; - ospeed = D_dospeed; - tputs(s, 1, CountChars); - return StrCost; } +static int +CallRewrite(y, xs, xe, doit) +int y, xs, xe, doit; +{ + struct canvas *cv, *cvlist, *cvlnext; + struct viewport *vp; + struct layer *oldflayer; + int cost; + + debug3("CallRewrite %d %d %d\n", y, xs, xe); + ASSERT(display); + ASSERT(xe >= xs); + + vp = 0; + for (cv = D_cvlist; cv; cv = cv->c_next) + { + if (y < cv->c_ys || y > cv->c_ye || xe < cv->c_xs || xs > cv->c_xe) + continue; + for (vp = cv->c_vplist; vp; vp = vp->v_next) + if (y >= vp->v_ys && y <= vp->v_ye && xe >= vp->v_xs && xs <= vp->v_xe) + break; + if (vp) + break; + } + if (doit) + { + oldflayer = flayer; + flayer = cv->c_layer; + cvlist = flayer->l_cvlist; + cvlnext = cv->c_lnext; + flayer->l_cvlist = cv; + cv->c_lnext = 0; + Rewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 1); + flayer->l_cvlist = cvlist; + cv->c_lnext = cvlnext; + flayer = oldflayer; + return 0; + } + if (cv == 0 || cv->c_layer == 0) + return EXPENSIVE; /* not found or nothing on it */ + if (xs < vp->v_xs || xe > vp->v_xe) + return EXPENSIVE; /* crosses viewport boundaries */ + if (y - vp->v_yoff < 0 || y - vp->v_yoff >= cv->c_layer->l_height) + return EXPENSIVE; /* line not on layer */ + if (xs - vp->v_xoff < 0 || xe - vp->v_xoff >= cv->c_layer->l_width) + return EXPENSIVE; /* line not on layer */ + oldflayer = flayer; + flayer = cv->c_layer; + debug3("Calling Rewrite %d %d %d\n", y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff); + cost = Rewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 0); + flayer = oldflayer; + if (D_insert) + cost += D_EIcost + D_IMcost; + return cost; +} + + void GotoPos(x2, y2) int x2, y2; @@ -688,10 +1074,12 @@ int x2, y2; y1 = D_y; if (x1 == D_width) - if (D_CLP && D_AM) - x1 = -1; /* don't know how the terminal treats this */ - else - x1--; + { + if (D_CLP && D_AM) + x1 = -1; /* don't know how the terminal treats this */ + else + x1--; + } if (x2 == D_width) x2--; dx = x2 - x1; @@ -737,7 +1125,7 @@ int x2, y2; xm = M_RI; } /* Speedup: dx <= Rewrite() */ - if (dx < costx && (m = Rewrite(y1, x1, x2, 0)) < costx) + if (dx < costx && (m = CallRewrite(y1, x1, x2 - 1, 0)) < costx) { costx = m; xm = M_RW; @@ -760,7 +1148,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 ? CallRewrite(y1, 0, x2 - 1, 0) : 0) + D_CRcost) < costx) { costx = m; xm = M_CR; @@ -828,7 +1216,7 @@ int x2, y2; /* FALLTHROUGH */ case M_RW: if (x1 < x2) - (void) Rewrite(y1, x1, x2, 1); + (void) CallRewrite(y1, x1, x2 - 1, 1); break; default: break; @@ -870,7 +1258,12 @@ Clear(x1, y1, xs, xe, x2, y2, uselayfn) int x1, y1, xs, xe, x2, y2, uselayfn; { int y, xxe; + struct canvas *cv; + struct viewport *vp; + debug2("Clear %d,%d", x1, y1); + debug2(" %d-%d", xs, xe); + debug3(" %d,%d uselayfn=%d\n", x2, y2, uselayfn); ASSERT(display); if (x1 == D_width) x1--; @@ -930,9 +1323,37 @@ int x1, y1, xs, xe, x2, y2, uselayfn; continue; } if (uselayfn) - ClearLine(y, x1, xxe); - else - DisplayLine(&mline_null, &mline_blank, y, x1, xxe); + { + vp = 0; + for (cv = D_cvlist; cv; cv = cv->c_next) + { + if (y < cv->c_ys || y > cv->c_ye || xxe < cv->c_xs || x1 > cv->c_xe) + continue; + for (vp = cv->c_vplist; vp; vp = vp->v_next) + if (y >= vp->v_ys && y <= vp->v_ye && xxe >= vp->v_xs && x1 <= vp->v_xe) + break; + if (vp) + break; + } + if (cv && cv->c_layer && x1 >= vp->v_xs && xxe <= vp->v_xe && + y - vp->v_yoff >= 0 && y - vp->v_yoff < cv->c_layer->l_height && + xxe - vp->v_xoff >= 0 && x1 - vp->v_xoff < cv->c_layer->l_width) + { + struct layer *oldflayer = flayer; + struct canvas *cvlist, *cvlnext; + flayer = cv->c_layer; + cvlist = flayer->l_cvlist; + cvlnext = cv->c_lnext; + flayer->l_cvlist = cv; + cv->c_lnext = 0; + ClearLine(y - vp->v_yoff, x1 - vp->v_xoff, xxe - vp->v_xoff); + flayer->l_cvlist = cvlist; + cv->c_lnext = cvlnext; + flayer = oldflayer; + continue; + } + } + DisplayLine(&mline_null, &mline_blank, y, x1, xxe); } } @@ -946,9 +1367,19 @@ Redisplay(cur_only) int cur_only; { register int i, stop; + struct canvas *cv; ASSERT(display); - DefRestore(); + + /* XXX do em all? */ + InsertMode(0); + ChangeScrollRegion(0, D_height - 1); + KeypadMode(0); + CursorkeysMode(0); + CursorVisibility(0); + SetRendition(&mchar_null); + SetFlow(FLOW_NOW); + ClearDisplay(); stop = D_height; i = 0; @@ -958,15 +1389,32 @@ int cur_only; stop++; } else - RedisplayLine(-1, 0, D_width - 1, 1); - for (; i < stop; i++) - RedisplayLine(i, 0, D_width - 1, 1); - RefreshStatus(); - Restore(); - SetCursor(); + { + debug("Signalling full refresh!\n"); + for (cv = D_cvlist; cv; cv = cv->c_next) + { + CV_CALL(cv, RedisplayLine(-1, -1, -1, 1)); + display = cv->c_display; /* just in case! */ + } + } + RefreshArea(0, i, D_width - 1, stop - 1, 1); + RefreshHStatus(); + + CV_CALL(D_forecv, Restore();SetCursor()); +} + +void +RedisplayDisplays(cur_only) +int cur_only; +{ + struct display *olddisplay = display; + for (display = displays; display; display = display->d_next) + Redisplay(cur_only); + display = olddisplay; } +/* XXX: use oml! */ void ScrollH(y, xs, xe, n, oml) int y, xs, xe, n; @@ -1034,7 +1482,7 @@ struct mline *oml; if (D_lp_missing && y == D_bot) { if (n > 0) - FixLP(D_width - 1 - n, y); + WriteLP(D_width - 1 - n, y); D_lp_missing = 0; } } @@ -1057,9 +1505,9 @@ int xs, ys, xe, ye, n; Clear(xs, ys, xs, xe, xe, ye, 0); return; } - if (xs != 0 || xe != D_width - 1) + if (xs > D_vpxmin || xe < D_vpxmax) { - Redisplay(0); + RefreshArea(xs, ys, xe, ye, 0); return; } @@ -1086,10 +1534,10 @@ int xs, ys, xe, ye, n; oldtop = D_top; oldbot = D_bot; - if (D_bot != ye) + if (ys < D_top || D_bot != ye) ChangeScrollRegion(ys, ye); - alok = (D_AL || D_CAL || (ye == D_bot && up)); - dlok = (D_DL || D_CDL || (ye == D_bot && !up)); + alok = (D_AL || D_CAL || (ys >= D_top && ye == D_bot && up)); + dlok = (D_DL || D_CDL || (ys >= D_top && ye == D_bot && !up)); if (D_top != ys && !(alok && dlok)) ChangeScrollRegion(ys, ye); @@ -1097,18 +1545,20 @@ int xs, ys, xe, ye, n; (oldbot != D_bot || (oldbot == D_bot && up && D_top == ys && D_bot == ye))) { - FixLP(D_width - 1, oldbot); + WriteLP(D_width - 1, oldbot); if (oldbot == D_bot) /* have scrolled */ { if (--n == 0) { +/* XXX ChangeScrollRegion(oldtop, oldbot); +*/ return; } } } - aldlfaster = (n > 1 && ye == D_bot && ((up && D_CDL) || (!up && D_CAL))); + aldlfaster = (n > 1 && ys >= D_top && ye == D_bot && ((up && D_CDL) || (!up && D_CAL))); if (D_UT) SetRendition(&mchar_null); @@ -1150,14 +1600,16 @@ int xs, ys, xe, ye, n; } else { - Redisplay(0); + RefreshArea(xs, ys, xe, ye, 0); return; } if (D_lp_missing && missy != D_bot) - FixLP(D_width - 1, missy); + WriteLP(D_width - 1, missy); +/* XXX ChangeScrollRegion(oldtop, oldbot); if (D_lp_missing && missy != D_bot) - FixLP(D_width - 1, missy); + WriteLP(D_width - 1, missy); +*/ } void @@ -1169,7 +1621,6 @@ register int new; if (!display || (old = D_rend.attr) == new) return; #if defined(TERMINFO) && defined(USE_SGR) - debug1("USE_SGR defined, sa is %s\n", D_SA ? D_SA : "undefined"); if (D_SA) { char *tparm(); @@ -1222,6 +1673,7 @@ register int new; D_atyp = typ; } +#ifdef FONT void SetFont(new) int new; @@ -1255,6 +1707,7 @@ int new; else CPutStr(D_CS0, new); } +#endif #ifdef COLOR void @@ -1270,7 +1723,7 @@ int new; f = new & 0xf; b = (new >> 4) & 0xf; - if (!D_CAX && ((f == 0 && f != of) || (b == 0 && b != ob))) + if (!D_CAX && (D_CAF || D_CAB) && ((f == 0 && f != of) || (b == 0 && b != ob))) { int oattr; @@ -1304,8 +1757,10 @@ struct mchar *mc; if (D_rend.color != mc->color) SetColor(mc->color); #endif +#ifdef FONT if (D_rend.font != mc->font) SetFont(mc->font); +#endif } void @@ -1321,8 +1776,10 @@ int x; if (D_rend.color != ml->color[x]) SetColor(ml->color[x]); #endif +#ifdef FONT if (D_rend.font != ml->font[x]) SetFont(ml->font[x]); +#endif } void @@ -1338,6 +1795,8 @@ char *msg; if (!D_tcinited) { debug("tc not inited, just writing msg\n"); + if (D_processinputdata) + return; /* XXX: better */ AddStr(msg); AddStr("\r\n"); Flush(); @@ -1353,9 +1812,16 @@ char *msg; max = D_WS; if (D_status) { + /* same message? */ + if (strcmp(msg, D_status_lastmsg) == 0) + { + debug("same message - increase timeout"); + SetTimeout(&D_statusev, MsgWait * 1000); + return; + } 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); } @@ -1367,158 +1833,228 @@ char *msg; else if ((unsigned char)*s >= ' ' && *s != 0177) *t++ = *s; *t = '\0'; - if (t > msg) + if (t == msg) + return; + 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); - else - buf = malloc(t - msg + 1); - if (buf) - { - 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 || !D_HS) + char *buf; + 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; + } + } + if (t - msg < D_status_buflen) + strcpy(D_status_lastmsg, msg); + D_status_len = t - msg; + D_status_lastx = D_x; + D_status_lasty = D_y; + if (!use_hardstatus || D_has_hstatus == HSTATUS_IGNORE || D_has_hstatus == HSTATUS_MESSAGE) + { + if (D_status_delayed != -1 && t - msg < D_status_buflen) + { + D_status_delayed = 1; /* not yet... */ + D_status = 0; + return; + } + D_status = STATUS_ON_WIN; + debug1("using STATLINE %d\n", STATLINE); + GotoPos(0, STATLINE); + SetRendition(&mchar_so); + InsertMode(0); + AddStr(msg); + if (D_status_len < max) { - debug1("using STATLINE %d\n", STATLINE); - GotoPos(0, STATLINE); - SetRendition(&mchar_so); - InsertMode(0); - AddStr(msg); + /* Wayne Davison: add extra space for readability */ + D_status_len++; + SetRendition(&mchar_null); + AddChar(' '); if (D_status_len < max) { - /* Wayne Davison: add extra space for readability */ D_status_len++; - SetRendition(&mchar_null); AddChar(' '); - if (D_status_len < max) - { - D_status_len++; - AddChar(' '); - AddChar('\b'); - } AddChar('\b'); } - D_x = -1; + AddChar('\b'); } - else - { - debug("using HS\n"); - SetRendition(&mchar_null); - InsertMode(0); - if (D_hstatus) - PutStr(D_DS); - CPutStr(D_TS, 0); - AddStr(msg); - PutStr(D_FS); - D_hstatus = 1; - } - Flush(); - (void) time(&D_status_time); + D_x = -1; + } + else + { + D_status = STATUS_ON_HS; + ShowHStatus(msg); } + D_status_delayed = 0; + Flush(); + (void) time(&D_status_time); + SetTimeout(&D_statusev, MsgWait * 1000); + evenq(&D_statusev); +#ifdef HAVE_BRAILLE + RefreshBraille(); /* let user see multiple Msg()s */ +#endif } void RemoveStatus() { - struct win *p; + struct display *olddisplay; + struct layer *oldflayer; + int where; if (!display) return; - if (!D_status) + if (!(where = D_status)) return; - /* - * UGLY HACK ALERT - this should NOT be in display.c - * We need to find the window that caused an activity or bell - * message, to reenable this function there. - */ - for (p = windows; p; p = p->w_next) - { - if (p->w_display != display) - continue; - if (p->w_monitor == MON_MSG) - { - debug1("RemoveStatus clearing monitor win %d\n", p->w_number); - p->w_monitor = MON_DONE; - } - if (p->w_bell == BELL_MSG) - { - debug1("RemoveStatus clearing bell win %d\n", p->w_number); - p->w_bell = BELL_DONE; - } - } D_status = 0; D_status_bell = 0; - if (!use_hardstatus || !D_HS) + evdeq(&D_statusev); + olddisplay = display; + oldflayer = flayer; + if (where == STATUS_ON_WIN) { GotoPos(0, STATLINE); RefreshLine(STATLINE, 0, D_status_len - 1, 0); GotoPos(D_status_lastx, D_status_lasty); } else + RefreshHStatus(); + flayer = D_forecv->c_layer; + if (flayer) + SetCursor(); + display = olddisplay; + flayer = oldflayer; +} + +/* refresh the display's hstatus line */ +void +ShowHStatus(str) +char *str; +{ + int l, i, ox, oy; + + if (D_status == STATUS_ON_WIN && D_has_hstatus == HSTATUS_LASTLINE && STATLINE == D_height-1) + return; /* sorry, in use */ + + if (D_HS && D_has_hstatus == HSTATUS_HS) { - /* + if (!D_hstatus && (str == 0 || *str == 0)) + return; + debug("ShowHStatus: using HS\n"); SetRendition(&mchar_null); + InsertMode(0); if (D_hstatus) - PutStr(D_DS); - */ - RefreshStatus(); + PutStr(D_DS); + D_hstatus = 0; + if (str == 0 || *str == 0) + return; + CPutStr(D_TS, 0); + if (strlen(str) > D_WS) + AddStrn(str, D_WS); + else + AddStr(str); + PutStr(D_FS); + D_hstatus = 1; + } + else if (D_has_hstatus == HSTATUS_LASTLINE) + { + debug("ShowHStatus: using last line\n"); + ox = D_x; + oy = D_y; + str = str ? str : ""; + l = strlen(str); + if (l > D_width) + l = D_width; + GotoPos(0, D_height - 1); + SetRendition(captionalways || D_cvlist == 0 || D_cvlist->c_next ? &mchar_null: &mchar_so); + for (i = 0; i < l; i++) + PUTCHARLP(str[i]); + if (!captionalways && D_cvlist && !D_cvlist->c_next) + while (l++ < D_width) + PUTCHARLP(' '); + if (l < D_width) + Clear(l, D_height - 1, l, D_width - 1, D_width - 1, D_height - 1, 0); + if (ox != -1 && oy != -1) + GotoPos(ox, oy); + D_hstatus = *str ? 1 : 0; + SetRendition(&mchar_null); + } + else if (str && *str && D_has_hstatus == HSTATUS_MESSAGE) + { + debug("ShowHStatus: using message\n"); + Msg(0, "%s", str); } - SetCursor(); } + /* - * Refreshes the harstatus of the _window_. Shouldn't be here... + * Refreshes the harstatus of the fore window. Shouldn't be here... */ - void -RefreshStatus() +RefreshHStatus() { char *buf; - if (D_HS) + evdeq(&D_hstatusev); + if (D_status == STATUS_ON_HS) + return; + buf = MakeWinMsgEv(hstatusstring, D_fore, '%', &D_hstatusev); + if (buf && *buf) { - SetRendition(&mchar_null); - if (D_hstatus) - PutStr(D_DS); - if (D_fore && D_fore->w_hstatus) - { - buf = MakeWinMsg(D_fore->w_hstatus, D_fore, '\005', 0); - CPutStr(D_TS, 0); - if (strlen(buf) > D_WS) - AddStrn(buf, D_WS); - else - AddStr(buf); - PutStr(D_FS); - D_hstatus = 1; - } + ShowHStatus(buf); + if (D_has_hstatus != HSTATUS_IGNORE && D_hstatusev.timeout.tv_sec) + evenq(&D_hstatusev); } - else if (D_fore && D_fore->w_hstatus) + else + ShowHStatus((char *)0); +} + +/*********************************************************************/ +/* + * Here come the routines that refresh an arbitrary part of the screen. + */ + +void +RefreshArea(xs, ys, xe, ye, isblank) +int xs, ys, xe, ye, isblank; +{ + int y; + ASSERT(display); + debug2("Refresh Area: %d,%d", xs, ys); + debug3(" - %d,%d (isblank=%d)\n", xe, ye, isblank); + if (!isblank && xs == 0 && xe == D_width - 1 && ye == D_height - 1 && (ys == 0 || D_CD)) { - buf = MakeWinMsg(D_fore->w_hstatus, D_fore, '\005', 0); - Msg(0, "%s", buf); + Clear(xs, ys, xs, xe, xe, ye, 0); + isblank = 1; } + for (y = ys; y <= ye; y++) + RefreshLine(y, xs, xe, isblank); } void RefreshLine(y, from, to, isblank) int y, from, to, isblank; { + struct viewport *vp, *lvp; + struct canvas *cv, *lcv, *cvlist, *cvlnext; + struct layer *oldflayer; + int xx, yy; + char *buf; + struct win *p; + ASSERT(display); + debug2("RefreshLine %d %d", y, from); debug2(" %d %d\n", to, isblank); - if (isblank == 0 && D_CE && to == D_width - 1) + + if (D_status == STATUS_ON_WIN && y == STATLINE) + return; /* can't refresh status */ + + if (isblank == 0 && D_CE && to == D_width - 1 && from < to) { GotoPos(from, y); if (D_UT) @@ -1526,19 +2062,127 @@ int y, from, to, isblank; PutStr(D_CE); isblank = 1; } - RedisplayLine(y, from, to, isblank); + while (from <= to) + { + lcv = 0; + lvp = 0; + for (cv = display->d_cvlist; cv; cv = cv->c_next) + { + if (y < cv->c_ys || y > cv->c_ye || to < cv->c_xs || from > cv->c_xe) + continue; + debug2("- canvas hit: %d %d", cv->c_xs, cv->c_ys); + debug2(" %d %d\n", cv->c_xe, cv->c_ye); + for (vp = cv->c_vplist; vp; vp = vp->v_next) + { + debug2(" - vp: %d %d", vp->v_xs, vp->v_ys); + debug2(" %d %d\n", vp->v_xe, vp->v_ye); + /* find leftmost overlapping vp */ + if (y >= vp->v_ys && y <= vp->v_ye && from <= vp->v_xe && to >= vp->v_xs && (lvp == 0 || lvp->v_xs > vp->v_xs)) + { + lcv = cv; + lvp = vp; + } + } + } + if (lvp == 0) + break; + if (from < lvp->v_xs) + { + if (!isblank) + DisplayLine(&mline_null, &mline_blank, y, from, lvp->v_xs - 1); + from = lvp->v_xs; + } + + /* call RedisplayLine on canvas lcv viewport lvp */ + yy = y - lvp->v_yoff; + xx = to < lvp->v_xe ? to : lvp->v_xe; + + if (lcv->c_layer && yy == lcv->c_layer->l_height) + { + GotoPos(from, y); + SetRendition(&mchar_blank); + while (from <= lvp->v_xe && from - lvp->v_xoff < lcv->c_layer->l_width) + { + PUTCHARLP('-'); + from++; + } + if (from >= lvp->v_xe + 1) + continue; + } + if (lcv->c_layer == 0 || yy >= lcv->c_layer->l_height || from - lvp->v_xoff >= lcv->c_layer->l_width) + { + if (!isblank) + DisplayLine(&mline_null, &mline_blank, y, from, lvp->v_xe); + from = lvp->v_xe + 1; + continue; + } + + if (xx - lvp->v_xoff >= lcv->c_layer->l_width) + xx = lcv->c_layer->l_width + lvp->v_xoff - 1; + oldflayer = flayer; + flayer = lcv->c_layer; + cvlist = flayer->l_cvlist; + cvlnext = lcv->c_lnext; + flayer->l_cvlist = lcv; + lcv->c_lnext = 0; + RedisplayLine(yy, from - lvp->v_xoff, xx - lvp->v_xoff, isblank); + flayer->l_cvlist = cvlist; + lcv->c_lnext = cvlnext; + flayer = oldflayer; + + from = xx + 1; + } + if (from > to) + return; /* all done */ + + if (y == D_height - 1 && D_has_hstatus == HSTATUS_LASTLINE) + { + RefreshHStatus(); + return; + } + + for (cv = display->d_cvlist; cv; cv = cv->c_next) + if (y == cv->c_ye + 1) + break; + if (cv == 0) + { + if (!isblank) + DisplayLine(&mline_null, &mline_blank, y, from, to); + return; + } + + p = Layer2Window(cv->c_layer); + buf = MakeWinMsgEv(captionstring, p, '%', &cv->c_captev); + if (cv->c_captev.timeout.tv_sec) + evenq(&cv->c_captev); + xx = strlen(buf); + GotoPos(from, y); + SetRendition(&mchar_so); + while (from <= to && from < xx) + { + PUTCHARLP(buf[from]); + from++; + } + while (from++ <= to) + PUTCHARLP(' '); } -void -FixLP(x2, y2) -register int x2, y2; +/*********************************************************************/ + +/* clear lp_missing by writing the char on the screen. The + * position must be safe. + */ +static void +WriteLP(x2, y2) +int x2, y2; { struct mchar oldrend; ASSERT(display); + ASSERT(D_lp_missing); oldrend = D_rend; #ifdef KANJI - if (D_lpchar.font == KANJI && (D_mbcs = D_lp_mbcs) != 0) + if (D_lpchar.font == KANJI && (D_mbcs = D_lp_mbcs) != 0 && x2 > 0) x2--; #endif GotoPos(x2, y2); @@ -1561,29 +2205,33 @@ int from, to, y; 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 || !cmp_mline(oml, ml, to)) - { - if ((D_IC || D_IM) && from < to) - { - to -= 2; - last2flag = 1; - D_lp_missing = 0; - } - else - { - to--; - delete_lp = (D_CE || D_DC || D_CDC); - D_lp_missing = !cmp_mchar_mline(&mchar_blank, ml, to); - copy_mline2mchar(&D_lpchar, ml, to); - } - } - else - to--; + { + if (D_lp_missing || !cmp_mline(oml, ml, to)) + { + if ((D_IC || D_IM) && from < to) + { + to -= 2; + last2flag = 1; + D_lp_missing = 0; + } + else + { + to--; + delete_lp = (D_CE || D_DC || D_CDC); + D_lp_missing = !cmp_mchar_mline(&mchar_blank, ml, to); + copy_mline2mchar(&D_lpchar, ml, to); + } + } + else + to--; + } for (x = from; x <= to; x++) { +#if 0 /* no longer needed */ if (x || D_x != D_width || D_y != y - 1) +#endif { - if (x < to || x != D_width - 1 || ml->image[x + 1] == ' ') + if (x < to || x != D_width - 1 || ml->image[x + 1]) if (cmp_mline(oml, ml, x)) continue; GotoPos(x, y); @@ -1602,8 +2250,11 @@ int from, to, y; PUTCHAR(ml->image[++x]); #endif } - if (to == D_width - 1 && y < D_height - 1 && D_x == D_width && ml->image[to + 1] == ' ') +#if 0 /* not needed any longer */ + /* compare != 0 because ' ' can happen when clipping occures */ + if (to == D_width - 1 && y < D_height - 1 && D_x == D_width && ml->image[to + 1]) GotoPos(0, y + 1); +#endif if (last2flag) { GotoPos(x, y); @@ -1616,9 +2267,7 @@ int from, to, y; else if (delete_lp) { if (D_UT) - { - SetRendition(&mchar_null); - } + SetRendition(&mchar_null); if (D_DC) PutStr(D_DC); else if (D_CDC) @@ -1629,12 +2278,119 @@ int from, to, y; } void -SetLastPos(x,y) -int x,y; +InsChar(c, x, xe, y, oml) +struct mchar *c; +int x, xe, y; +struct mline *oml; { - ASSERT(display); - D_x = x; + GotoPos(x, y); + if (y == D_bot && !D_CLP) + { + if (x == D_width - 1) + { + D_lpchar = *c; + return; + } + if (xe == D_width - 1) + D_lp_missing = 0; + } + if (x == xe) + { + if (xe != D_width - 1) + InsertMode(0); + SetRendition(c); + RAW_PUTCHAR(c->image); + return; + } + if (!(D_IC || D_CIC || D_IM) || xe != D_width - 1) + { + RefreshLine(y, x, xe, 0); + GotoPos(x + 1, y); + /* UpdateLine(oml, y, x, xe); */ + return; + } + InsertMode(1); + if (!D_insert) + { + if (D_IC) + PutStr(D_IC); + else + CPutStr(D_CIC, 1); + } + SetRendition(c); + RAW_PUTCHAR(c->image); +} + +void +WrapChar(c, x, y, xs, ys, xe, ye, ins) +struct mchar *c; +int x, y; +int xs, ys, xe, ye; +int ins; +{ + debug("WrapChar:"); + debug2(" x %d y %d", x, y); + debug2(" Dx %d Dy %d", D_x, D_y); + debug2(" xs %d ys %d", xs, ys); + debug3(" xe %d ye %d ins %d\n", xe, ye, ins); + if (xs != 0 || x != D_width || !D_AM) + { + if (y == ye) + ScrollV(xs, ys, xe, ye, 1); + else if (y < D_height - 1) + y++; + GotoPos(xs, y); + if (ins) + { + InsChar(c, xs, xe, y, 0); + return; + } + SetRendition(c); + AddChar(c->image); + D_x++; + return; + } + if (y == ye) /* we have to scroll */ + { + debug("- scrolling\n"); + ChangeScrollRegion(ys, ye); + if (D_bot != y) + { + debug("- have to call ScrollV\n"); + ScrollV(xs, ys, xe, ye, 1); + y--; + } + } + else if (y == D_bot) + ChangeScrollRegion(ys, ye); /* remove unusable region */ + if (D_x != D_width || D_y != y) + { + if (D_CLP && y >= 0) /* don't even try if !LP */ + RefreshLine(y, D_width - 1, D_width - 1, 0); + debug2("- refresh last char -> x,y now %d,%d\n", D_x, D_y); + if (D_x != D_width || D_y != y) /* sorry, no bonus */ + { + if (y == ye) + ScrollV(xs, ys, xe, ye, 1); + GotoPos(xs, y == ye || y == D_height - 1 ? y : y + 1); + } + } + debug("- writeing new char"); + if (y != ye && y < D_height - 1) + y++; + if (ins != D_insert) + InsertMode(ins); + if (ins && !D_insert) + { + InsChar(c, 0, xe, y, 0); + debug2(" -> done with insert (%d,%d)\n", D_x, D_y); + return; + } + SetRendition(c); + AddChar(c->image); D_y = y; + D_x = 1; + debug2(" -> done (%d,%d)\n", D_x, D_y); } int @@ -1648,6 +2404,13 @@ int wi, he; debug("ResizeDisplay: No change\n"); return 0; } + if (D_width != wi && (D_height == he || !D_CWS) && D_CZ0 && (wi == Z0width || wi == Z1width)) + { + debug("ResizeDisplay: using Z0/Z1\n"); + PutStr(wi == Z0width ? D_CZ0 : D_CZ1); + ChangeScreenSize(wi, D_height, 0); + return (he == D_height) ? 0 : -1; + } if (D_CWS) { debug("ResizeDisplay: using WS\n"); @@ -1655,13 +2418,6 @@ int wi, he; ChangeScreenSize(wi, he, 0); return 0; } - else if (D_CZ0 && (wi == Z0width || wi == Z1width)) - { - debug("ResizeDisplay: using Z0/Z1\n"); - PutStr(wi == Z0width ? D_CZ0 : D_CZ1); - ChangeScreenSize(wi, D_height, 0); - return (he == D_height) ? 0 : -1; - } return -1; } @@ -1671,6 +2427,10 @@ int newtop, newbot; { if (display == 0) return; + if (newtop == -1) + newtop = 0; + if (newbot == -1) + newbot = D_height - 1; if (D_CS == 0) { D_top = 0; @@ -1687,73 +2447,6 @@ int newtop, newbot; } -/* - * Layer creation / removal - */ - -int -InitOverlayPage(datasize, lf, block) -int datasize; -struct LayFuncs *lf; -int block; -{ - char *data; - 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); - if ((newlay = (struct layer *)malloc(sizeof(struct layer))) == 0) - { - Msg(0, "No memory for layer struct"); - return -1; - } - data = 0; - if (datasize) - { - if ((data = malloc(datasize)) == 0) - { - 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_data = data; - newlay->l_next = D_lay; - if (D_fore) - { - D_fore->w_lay = newlay; /* XXX: CHECK */ - D_fore->w_active = 0; /* XXX: CHECK */ - } - D_lay = newlay; - D_layfn = newlay->l_layfn; - Restore(); - return 0; -} - -void -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; - if (oldlay->l_data) - free(oldlay->l_data); - 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(); -} - - /* * Output buffering routines */ @@ -1765,6 +2458,7 @@ char *str; register char c; ASSERT(display); + while ((c = *str++)) AddChar(c); } @@ -1821,6 +2515,8 @@ Flush() } D_obuffree += l; D_obufp = D_obuf; + if (D_nonblock > 1) + D_nonblock = 1; /* reenable flow control for WriteString */ if (fcntl(D_userfd, F_SETFL, FNBLOCK)) debug1("Warning: NBLOCK fcntl failed: %d\n", errno); } @@ -1838,6 +2534,7 @@ freetty() free(D_obuf); D_obuf = 0; D_obuflen = 0; + D_obuflenmax = -D_obufmax; } /* @@ -1868,6 +2565,7 @@ Resize_obuf() if (!D_obuf) Panic(0, "Out of memory"); D_obufp = D_obuf + ind; + D_obuflenmax = D_obuflen - D_obufmax; debug1("ResizeObuf: resized to %d\n", D_obuflen); } @@ -1904,10 +2602,13 @@ NukePending() PutStr(D_ME); else { +#ifdef COLOR + if (D_CAF) + AddStr("\033[m"); /* why is D_ME not set? */ +#endif PutStr(D_SE); PutStr(D_UE); } - /* FIXME: reset color! */ /* Check for toggle */ if (D_IM && strcmp(D_IM, D_EI)) PutStr(D_EI); @@ -1968,3 +2669,153 @@ int x; return j; } #endif + +static void +disp_writeev_fn(ev, data) +struct event *ev; +char *data; +{ + int len, size = OUTPUT_BLOCK_SIZE; + + display = (struct display *)data; + len = D_obufp - D_obuf; + if (len < size) + size = len; + ASSERT(len >= 0); + size = write(D_userfd, D_obuf, size); + if (size >= 0) + { + len -= size; + if (len) + { + bcopy(D_obuf + size, D_obuf, len); + debug2("ASYNC: wrote %d - remaining %d\n", size, len); + } + /* Great, reenable flow control for WriteString now. */ + if ((D_nonblock > 1) && (len < D_obufmax/2)) + D_nonblock = 1; + D_obufp -= size; + D_obuffree += size; + } + else + { + if (errno != EINTR) +# ifdef EWOULDBLOCK + if (errno != EWOULDBLOCK) +# endif + Msg(errno, "Error writing output to display"); + } +} + +static void +disp_readev_fn(ev, data) +struct event *ev; +char *data; +{ + int size; + char buf[IOSIZE]; + struct canvas *cv; + + display = (struct display *)data; + + /* Hmmmm... a bit ugly... */ + if (D_forecv) + for (cv = D_forecv->c_layer->l_cvlist; cv; cv = cv->c_lnext) + { + display = cv->c_display; + if (D_status == STATUS_ON_WIN) + RemoveStatus(); + } + + display = (struct display *)data; + if (D_fore == 0) + size = IOSIZE; + else + { +#ifdef PSEUDOS + if (W_UWP(D_fore)) + size = sizeof(D_fore->w_pwin->p_inbuf) - D_fore->w_pwin->p_inlen; + else +#endif + size = sizeof(D_fore->w_inbuf) - D_fore->w_inlen; + } + + if (size > IOSIZE) + size = IOSIZE; + if (size <= 0) + size = 1; /* Always allow one char for command keys */ + + size = read(D_userfd, buf, size); + if (size < 0) + { + if (errno == EINTR) + return; + debug1("Read error: %d - SigHup()ing!\n", errno); + SigHup(SIGARG); + sleep(1); + return; + } + else if (size == 0) + { + debug("Found EOF - SigHup()ing!\n"); + SigHup(SIGARG); + sleep(1); + return; + } + (*D_processinput)(buf, size); +} + +static void +disp_status_fn(ev, data) +struct event *ev; +char *data; +{ + display = (struct display *)data; + if (D_status) + RemoveStatus(); +} + +static void +disp_hstatus_fn(ev, data) +struct event *ev; +char *data; +{ + display = (struct display *)data; + RefreshHStatus(); +} + +static void +cv_winid_fn(ev, data) +struct event *ev; +char *data; +{ + int ox, oy; + struct canvas *cv = (struct canvas *)data; + + display = cv->c_display; + ox = D_x; + oy = D_y; + if (cv->c_ye + 1 < D_height) + RefreshLine(cv->c_ye + 1, 0, D_width - 1, 0); + if (ox != -1 && oy != -1) + GotoPos(ox, oy); +} + +#ifdef MAPKEYS +static void +disp_map_fn(ev, data) +struct event *ev; +char *data; +{ + char *p; + int l; + display = (struct display *)data; + debug("Flushing map sequence\n"); + if (!(l = D_seql)) + return; + p = D_seqp - l; + D_seqp = D_kmaps[0].seq; + D_seql = 0; + ProcessInput2(p, l); +} +#endif diff --git a/src/display.h b/src/display.h index 0976c97..2392776 100644 --- a/src/display.h +++ b/src/display.h @@ -22,7 +22,6 @@ * $Id$ FAU */ - #ifdef MAPKEYS struct kmap { @@ -44,15 +43,48 @@ struct kmap struct win; /* forward declaration */ +struct canvas +{ + struct canvas *c_next; /* next canvas on display */ + struct display *c_display; /* back pointer to display */ + struct viewport *c_vplist; + struct layer *c_layer; /* layer on this canvas */ + struct canvas *c_lnext; /* next canvas that displays layer */ + struct layer c_blank; /* bottom layer, always blank */ + int c_xoff; /* canvas x offset on display */ + int c_yoff; /* canvas y offset on display */ + int c_xs; + int c_xe; + int c_ys; + int c_ye; + struct event c_captev; /* caption changed event */ +}; + +struct viewport +{ + struct viewport *v_next; /* next vp on canvas */ + struct canvas *v_canvas; /* back pointer to canvas */ + int v_xoff; /* layer x offset on display */ + int v_yoff; /* layer y offset on display */ + int v_xs; /* vp upper left */ + int v_xe; /* vp upper right */ + int v_ys; /* vp lower left */ + int v_ye; /* vp lower right */ +}; + 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 canvas *d_cvlist; /* the canvases of this display */ + struct canvas *d_forecv; /* current input focus */ + void (*d_processinput) __P((char *, int)); + char *d_processinputdata; /* data for processinput */ + int d_vpxmin, d_vpxmax; /* min/max used position on 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_nonblock; /* 1: don't block if obufmax reached */ + /* 2: obufmax is reached, discard */ char d_termname[20 + 1]; /* $TERM */ char *d_tentry; /* buffer for tgetstr */ char d_tcinited; /* termcap inited flag */ @@ -72,27 +104,34 @@ struct display int d_cursorkeys; /* application cursorkeys flag */ int d_revvid; /* reverse video */ int d_curvis; /* cursor visibility */ + int d_has_hstatus; /* display has hardstatus line */ int d_hstatus; /* hardstatus used */ int d_lp_missing; /* last character on bot line missing */ struct mchar d_lpchar; /* missing char */ time_t d_status_time; /* time of status display */ - char d_status; /* is status displayed? */ + int 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_status_delayed; /* status not displayed yet */ + struct event d_statusev; /* timeout event */ + struct event d_hstatusev; /* hstatus changed event */ int d_ESCseen; /* Was the last char an ESC (^a) */ int d_userpid; /* pid of attacher */ char d_usertty[MAXPATHLEN]; /* tty we are attached to */ int d_userfd; /* fd of the tty */ + struct event d_readev; /* userfd read event */ + struct event d_writeev; /* userfd write event */ 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 */ + int d_obuflenmax; /* len - max */ char *d_obufp; /* pointer in buffer */ int d_obuffree; /* free bytes in buffer */ #ifdef AUTO_NUKE @@ -102,7 +141,7 @@ struct display 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 */ + struct event d_mapev; /* timeout event */ int d_dontmap; /* do not map next */ int d_mapdefault; /* do map next to default */ struct kmap d_kmaps[KMAP_KEYS+KMAP_EXT]; /* keymaps */ @@ -111,14 +150,17 @@ struct display char *d_attrtab[NATTR]; /* attrib emulation table */ char d_attrtyp[NATTR]; /* attrib group table */ short d_dospeed; /* baudrate of tty */ +#ifdef FONT char d_c0_tab[256]; /* conversion for C0 */ char ***d_xtable; /* char translation table */ +#endif int d_UPcost, d_DOcost, d_LEcost, d_NDcost; int d_CRcost, d_IMcost, d_EIcost, d_NLcost; int d_printfd; /* fd for vt100 print sequence */ #ifdef UTMPOK slot_t d_loginslot; /* offset, where utmp_logintty belongs */ struct utmp d_utmp_logintty; /* here the original utmp structure is stored */ + int d_loginttymode; # ifdef _SEQUENT_ char d_loginhost[100+1]; # endif /* _SEQUENT_ */ @@ -134,8 +176,12 @@ extern struct display TheDisplay; #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_cvlist DISPLAY(d_cvlist) +#define D_forecv DISPLAY(d_forecv) +#define D_processinput DISPLAY(d_processinput) +#define D_processinputdata DISPLAY(d_processinputdata) +#define D_vpxmin DISPLAY(d_vpxmin) +#define D_vpxmax DISPLAY(d_vpxmax) #define D_fore DISPLAY(d_fore) #define D_other DISPLAY(d_other) #define D_nonblock DISPLAY(d_nonblock) @@ -160,6 +206,7 @@ extern struct display TheDisplay; #define D_cursorkeys DISPLAY(d_cursorkeys) #define D_revvid DISPLAY(d_revvid) #define D_curvis DISPLAY(d_curvis) +#define D_has_hstatus DISPLAY(d_has_hstatus) #define D_hstatus DISPLAY(d_hstatus) #define D_lp_missing DISPLAY(d_lp_missing) #define D_lpchar DISPLAY(d_lpchar) @@ -171,6 +218,9 @@ extern struct display TheDisplay; #define D_status_buflen DISPLAY(d_status_buflen) #define D_status_lastx DISPLAY(d_status_lastx) #define D_status_lasty DISPLAY(d_status_lasty) +#define D_status_delayed DISPLAY(d_status_delayed) +#define D_statusev DISPLAY(d_statusev) +#define D_hstatusev DISPLAY(d_hstatusev) #define D_ESCseen DISPLAY(d_ESCseen) #define D_userpid DISPLAY(d_userpid) #define D_usertty DISPLAY(d_usertty) @@ -181,13 +231,13 @@ extern struct display TheDisplay; #define D_obuf DISPLAY(d_obuf) #define D_obuflen DISPLAY(d_obuflen) #define D_obufmax DISPLAY(d_obufmax) +#define D_obuflenmax DISPLAY(d_obuflenmax) #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) @@ -208,17 +258,50 @@ extern struct display TheDisplay; #define D_printfd DISPLAY(d_printfd) #define D_loginslot DISPLAY(d_loginslot) #define D_utmp_logintty DISPLAY(d_utmp_logintty) +#define D_loginttymode DISPLAY(d_loginttymode) #define D_loginhost DISPLAY(d_loginhost) +#define D_readev DISPLAY(d_readev) +#define D_writeev DISPLAY(d_writeev) +#define D_mapev DISPLAY(d_mapev) -#define GRAIN 4096 /* Allocation grain size for output buffer */ -#define OBUF_MAX 256 /* default for obuflimit */ +#define GRAIN 4096 /* Allocation grain size for output buffer */ +#define OBUF_MAX 256 /* default for obuflimit */ #define OUTPUT_BLOCK_SIZE 256 /* Block size of output to tty */ -#define AddChar(c) do { \ - if (--D_obuffree == 0) \ - Resize_obuf(); \ - *D_obufp++ = (c); \ -} while (0) +#define AddChar(c) \ +do \ + { \ + if (--D_obuffree == 0) \ + Resize_obuf(); \ + *D_obufp++ = (c); \ + } \ +while (0) + +#define CV_CALL(cv, cmd) \ +{ \ + struct display *olddisplay = display; \ + struct layer *oldflayer = flayer; \ + struct layer *l = cv->c_layer; \ + struct canvas *cvlist = l->l_cvlist; \ + struct canvas *cvlnext = cv->c_lnext; \ + flayer = l; \ + l->l_cvlist = cv; \ + cv->c_lnext = 0; \ + cmd; \ + flayer = oldflayer; \ + l->l_cvlist = cvlist; \ + cv->c_lnext = cvlnext; \ + display = olddisplay; \ +} + +#define STATUS_OFF 0 +#define STATUS_ON_WIN 1 +#define STATUS_ON_HS 2 +#define HSTATUS_IGNORE 0 +#define HSTATUS_LASTLINE 1 +#define HSTATUS_MESSAGE 2 +#define HSTATUS_HS 3 +#define HSTATUS_ALWAYS (1<<2) diff --git a/src/doc/README.DOTSCREEN b/src/doc/README.DOTSCREEN new file mode 100644 index 0000000..f17fa37 --- /dev/null +++ b/src/doc/README.DOTSCREEN @@ -0,0 +1,151 @@ +From bargi@dots.physics.orst.edu Thu Aug 31 23:42 MET 1995 +Received: from faui45.informatik.uni-erlangen.de (root@faui45.informatik.uni-erlangen.de [131.188.34.45]) by immd4.informatik.uni-erlangen.de with ESMTP + id XAA14775 (8.6.12/7.4f-FAU);; Thu, 31 Aug 1995 23:42:15 +0200 +Received: from dots.physics.orst.edu (bargi@dots.PHYSICS.ORST.EDU [128.193.96.106]) by uni-erlangen.de with ESMTP + id XAA03048 (8.6.12/7.4f-FAU); for ; Thu, 31 Aug 1995 23:42:03 +0200 +Received: (from bargi@localhost) by dots.physics.orst.edu (8.6.11/8.6.9) id OAA15627; Thu, 31 Aug 1995 14:41:47 -0700 +From: Hadi Bargi Rangin +Message-Id: <199508312141.OAA15627@dots.physics.orst.edu> +Subject: README.DOTSCREEN +To: screen@uni-erlangen.de +Date: Thu, 31 Aug 1995 14:41:47 -0700 (PDT) +Cc: bargi@dots.physics.orst.edu (Hadi Bargi Rangin) +X-Mailer: ELM [version 2.4 PL24] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +Content-Length: 5423 +Status: RO + +Hallo, + + leider war readme file fuer dotscreen nicht in unserem dotscreen-Packet, +deshalb schicke ich es Euch nachtraeglich. Nachdem Ihr unseren packet +getestet habt, koennen wir Euch anrufen und vielleicht mehr ueber die +Einzelnheiten sprechen, ob wir unsere Weiterentwicklung koordinieren +wollen. + +Danke, + +Gruss, +Hadi + +=============================================================================== +Quick introduction to dotscreen +------------------------------- + +1. Introduction +2. Is dotscreen different as screen? +3. Installation instructions +4. Functions description +5. Further development + + +1. Introduction +=============== + +Dotscreen, is a system which allow a person direct access to unix via +a braille display. The emphasis is on direct, because the braille +display is connected directly to the serial port on the unix +machine. You no longer must use a dos machine running a terminal +emulation logged into a unix machine. Dotscreen is built on top of +screen, a powerful full-screen window manager for unix tty terminals. +Screen keeps track of what is being displayed in each window that it +is managing so that it can easily switch back and forth between these +windows. Dotscreen makes this stored window information available via +a braille display. Dotscreen only allows access to tty terminal +sessions, it does not allow access to X-Windows, however, it will run +in an xterm window. Currently, it works with the TSI Navigator 40 and +the TSI PowerBraille 40 braille displays. We plan to support other +displays as demand and information about other displays is made +available to us + +2. Is dotscreen different than screen? +====================================== + +All of screens functions still work in dotscreen. A few of the +functions are not accessible via braille, but we expect to remedy that +in future releases. + +3. Installation instructions +============================ + +Please read the INSTALL file for full installation instructions. +In addition to those instructions, note that you must create +a .screenrc file and that file must contain the type of braille +display that you are using and the serial device that the display +is connected to. A minimal .screenrc file should contain something +like the following four lines, (these are only examples, please +customize them for your configuration) + + +# example of .screenrc when using braille display +bd_start_braille on +bd_type powerbraille_40 +bd_port /dev/ttyS0 +bd_braille_table /home/gardner/us-braille.tbl +# end of example + + +4. Functions description +======================== + +The basic operation of screen is described in README. The braille +navigation commands are similar to commands usually found on dos +braille screenreaders. Also, because dotscreen is built on top of +screen, the user can switch back and forth easily between many running +applications. The braille commands can be changed any time after +starting screen using the internal screen "C-a :" command line. All +braille commands begin with "bd_"; following is the list of braille +commands: + +bd_start_braille on/off # Starts/stops using braille features on screen +bd_link on/off # links/unlinks braille cursor to/from screen cursor +bd_bell on/off # turn on/off sending bell-signal to terminal +bd_scroll on/off # enables/disables scrolling +bd_skip on/off # skip/don't skip balnk lines +bd_width # number of braille cells that user want to use, + # this value is always <= total number of cells +bd_ncrc # number of cells displayed on the right side + # of physical cursor (default = 1) +bd_info # displays braille/screen cursor position + # depending on its value, (no info: 0, only + # bc-info: 1, only sc-info: 2, bc- and sc-info: 3 +bd_port # serial port which braille display is connected to +bd_braille_table # braille table to be used. German, US and GS + # braille tables are provided +bd_type + # braille display type being used + +Note: currently valid value for some parameters: +bd_type: + 1. navigator_40 + 2. powerbraille_40. + +bd_braille_table: + 1. gr-braille.tbl German braille code + 2. us-braille.tbl US computer braille code + 3. gs-braille.tbl GS braille code + +Since the braille tables are in files, you should give the full +pathnames of the files either in .screenrc or using the +internal screen "C-a :" command line. + +5. Further development +====================== + +As mentioned above, currently Dotscreen works with Telesensory braille +displays the PowerBraille and the Navigator because Telesensory has +given us the information needed to program their braille display. We +plan to add support for other braille displays when and if we get the +requisite information from the braille display manufacturer. +Also some things such as cursor navigation from the braille display +have not been implemented. If you find a feature missing that +you wish to have, please contact us. + +This software has been developed within the Science Access Project at +Oregon State University under the direction of John Gardner. + +Authors: Hadi Bargi Rangin (bargi@dots.physics.orst.edu) + Bill Barry (barryb@dots.physics.orst.edu) + diff --git a/src/doc/make.help b/src/doc/make.help new file mode 100644 index 0000000..5871773 --- /dev/null +++ b/src/doc/make.help @@ -0,0 +1,51 @@ +###### +###### +###### The following lines should be obsolete because of the 'configure' script. +###### It is here only for reference if 'configure' needs human help. +###### + + +### 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= -D__NetBSD__ # NetBsd Machines like this (a.kalb@rrze) +#M_CFLAGS= -Dapollo -A cpu,mathchip -A nansi # Apollo DN3000/4000/4500 +#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 +#M_CFLAGS= -K pentium # Thanh Ma tma@encore.com Unixware, SVR4-2 + +### Choose one of the LIBS setting below: +#LIBS= -ltermcap -lc -lsocket -linet -lsec -lseq # Sequent/ptx +#LIBS= -lcurses -lelf -lcrypt -lsocket -lnsl # Solaris, when it sucks +#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 +#LIBS= -lcurses -lelf -lcrypt -lgen # Thanh Ma, Unixware, SVR4-2 diff --git a/src/doc/screen.1 b/src/doc/screen.1 index b93322e..84711a1 100644 --- a/src/doc/screen.1 +++ b/src/doc/screen.1 @@ -1,5 +1,5 @@ .\" vi:set wm=5 -.TH SCREEN 1 "21 Aug 1998" +.TH SCREEN 1 "10 Jun 1999" .if n .ds Q \&" .if n .ds U \&" .if t .ds Q `` @@ -20,7 +20,10 @@ screen \- screen manager with VT100/ANSI terminal emulation ] ] .br .B screen \-r -[ [\fIpid.\fP]\fItty\fP[\fI.host\fP] ] +[[\fIpid\fP\fB.\fP]\fItty\fP[\fB.\fP\fIhost\fP]] +.br +.B screen \-r +\fIsessionowner\fP\fB/\fP[[\fIpid\fP\fB.\fP]\fItty\fP[\fB.\fP\fIhost\fP]] .ta .5i 1.8i @@ -31,7 +34,7 @@ multiplexes a physical terminal between several processes (typically interactive shells). Each virtual terminal provides the functions of a DEC VT100 terminal and, in addition, several control functions -from the ANSI X3.64 (ISO 6429) and ISO 2022 standards +from the ISO 6492 (ECMA 48, ANSI X3.64) and ISO 2022 standards (e.\|g. insert/delete line and support for multiple character sets). There is a scrollback history buffer for each virtual terminal and a copy-and-paste mechanism that allows moving text regions between @@ -46,8 +49,11 @@ 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 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. -When a program terminates, +in whatever manner you wish, 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 +.I screen +session is detached from the user's terminal. When a program terminates, .I screen (per default) kills the window that contained it. If this window was in the foreground, the display switches to the previous @@ -63,6 +69,17 @@ now on), and is followed by one other keystroke. The command character and all the key bindings can be fully customized to be anything you like, though they are always two characters in length. .PP +.I Screen +does not understand the prefix \*QC-\*U to mean control. +Please use the caret notation (\*Q^A\*U instead of \*QC-a\*U) as arguments +to e.g. the +.I escape +command or the +.I -e +option. +.I Screen +will also print out control characters in caret notation. +.PP The standard way to create a new window is to type \*QC-a c\*U. This creates a new window running a shell and switches to that window immediately, regardless of the state of the process running @@ -120,8 +137,9 @@ automatic margins turned \fIoff\fP. This will ensure an accurate and optimal update of the screen in all circumstances. Most terminals nowadays have \*Qmagic\*U margins (automatic margins plus usable last column). This is the VT100 style type and perfectly suited for -\fIscreen\fP. -If all you've got is a \*Qtrue\*U auto-margin terminal \fIscreen\fP +.IR screen . +If all you've got is a \*Qtrue\*U auto-margin terminal +.I 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 @@ -155,12 +173,34 @@ does not start but detaches the elsewhere running .I screen session. It has the same effect as typing \*QC-a d\*U from -.I screen's +.IR 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. -Note: It is a good idea to have the status of your sessions checked by means of +If no session can be detached, this option is ignored. In combination with the +\fB\-r\fP/\fB\-R\fP option more powerful effects can be achieved: +.TP 8 +.B \-d \-r +Reattach a session and if necessary detach it first. +.TP 8 +.B \-d \-R +Reattach a session and if necessary detach or even create it first. +.TP 8 +.B \-d \-RR +Reattach a session and if necessary detach or create it. Use the first +session if more than one session is available. +.TP 8 +.B \-D \-r +Reattach a session. If necessary detach and logout remotely first. +.TP 8 +.B \-D \-R +Attach here and now. In detail this means: If a session is running, then +reattach. If necessary detach and logout remotely first. +If it was not running create it and notify the user. This is the +author's favorite. +.TP 8 +.B \-D \-RR +Attach here and now. Whatever that means, just do it. +.IP "" 5 +Note: It is always a good idea to check the status of your sessions by means of \*Qscreen \-list\*U. .TP 5 .BI "\-e " xy @@ -202,17 +242,22 @@ strings identifying your .I screen sessions. 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. +`attached' are running and have a controlling terminal. If the session runs in +multiuser mode, it is marked `multi'. Sessions marked as `unreachable' either +live on a different host or are `dead'. +An unreachable session is considered dead, when its name +matches either the name of the local host, or the specified parameter, if any. +See the \fB-r\fP flag for a description how to construct matches. +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 .I screen your auto-margin terminal has a writable last-position on -the screen. -This can also be set in your .screenrc by specifying `LP' in a \*Qtermcap\*U -command. +the screen. This can also be set in your .screenrc by specifying `LP' in a +\*Qtermcap\*U command. .TP 5 .B \-m causes @@ -222,7 +267,18 @@ a new session is enforced, regardless whether .I screen is called from within another .I screen -session or not. +session or not. This flag has a special meaning in connection +with the `-d' option: +.TP 8 +.B \-m \-d +Start +.I screen +in \*Qdetached\*U mode. This creates a new session but doesn't +attach to it. This is useful for system startup scripts. +.TP 8 +.B \-m \-D +This also starts screen in \*Qdetached\*U mode, but doesn't fork +a new process. The command exits if the session terminates. .TP 5 .B \-O selects a more optimal output mode for your terminal rather than true VT100 @@ -230,27 +286,42 @@ emulation (only affects auto-margin terminals without `LP'). This can also be set in your .screenrc by specifying `OP' in a \*Qtermcap\*U command. .TP 5 +.B \-q +Suppress printing of error messages. In combination with \*Q-ls\*U the exit +value is as follows: 9 indicates a directory without sessions. 10 +indicates a directory with running but not attachable sessions. 11 (or more) +indicates 1 (or more) usable sessions. +In combination with \*Q-r\*U the exit value is as follows: 10 indicates that +there is no session to resume. 12 (or more) indicates that there are 2 (or +more) sessions to resume and you should specify which one to choose. +In all other cases \*Q-q\*U has no effect. +.TP 5 .BR \-r " [" \fIpid.tty.host ] +.PD 0 +.TP 5 +.BR \-r " \fIsessionowner/[" \fIpid.tty.host ] +.PD resumes a detached .I screen -session. -No other options (except \*Q-d -r\*U or \*Q-D -r\*U) may be specified, though -an optional prefix of [\fIpid.\fP]\fItty.host\fP +session. No other options (except combinations with \fB\-d\fP/\fB\-D\fP) may +be specified, though an optional prefix of [\fIpid.\fP]\fItty.host\fP may be needed to distinguish between multiple detached .I screen -sessions. +sessions. The second form is used to connect to another user's screen session +which runs in multiuser mode. This indicates that screen should look for +sessions in another user's directory. This requires setuid-root. .TP 5 .B \-R attempts to resume the first detached .I screen -session it finds. -If successful, all other command-line options are ignored. +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 .I screen is run as a login-shell. +For combinations with the \fB\-d\fP/\fB\-D\fP option see there. .TP 5 .B \-s sets the default shell to the program specified, instead of the value @@ -270,9 +341,12 @@ See also the \*Qshelltitle\*U .screenrc command. .B \-v Print version number. .TP 5 -.B \-wipe +.BR \-wipe " [" \fImatch ] does the same as \*Qscreen -ls\*U, but removes destroyed sessions instead of marking them as `dead'. +An unreachable session is considered dead, when its name matches either +the name of the local host, or the explicitly given parameter, if any. +See the \fB-r\fP flag for a description how to construct matches. .TP 5 .B \-x Attach to a not detached @@ -303,13 +377,17 @@ Prompt for a window name or number to switch to. .PD 0 .IP "\fB ... \fP ..." .IP "\fBC-a 9\fP (select 9)" +.IP "\fBC-a -\fP (select -)" +.PD +Switch to window number 0 \- 9, or to the blank window. +.IP "\fBC-a tab\fP (focus)" .PD -Switch to window number 0 \- 9. +Switch the input focus to the next region. .IP "\fBC-a C-a\fP (other)" Toggle to the window displayed previously. 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 command becomes \*Q]]\*U, not \*Q]C-a\*U. +unless overridden. For instance, if you use the option \*Q\fB\-e]x\fP\*U, +this command becomes \*Q]]\*U. .IP "\fBC-a a\fP (meta)" Send the command character (C-a) to window. See \fIescape\fP command. .IP "\fBC-a A\fP (title)" @@ -342,6 +420,8 @@ Detach and logout. .IP "\fBC-a C-f\fP (flow)" .PD Toggle flow \fIon\fP, \fIoff\fP or \fIauto\fP. +.IP "\fBC-a F\fP (fit)" +Resize the window to the current region size. .IP "\fBC-a C-g\fP (vbell)" Toggles .I screen's @@ -397,6 +477,8 @@ Switch to the previous window (opposite of \fBC-a n\fP). .IP "\fBC-a C-q\fP (xon)" .PD Send a control-q to the current window. +.IP "\fBC-a Q\fP (only)" +Delete all regions but the current one. .IP "\fBC-a r\fP" .PD 0 .IP "\fBC-a C-r\fP (wrap)" @@ -408,6 +490,8 @@ automatic margins on and off). .IP "\fBC-a C-s\fP (xoff)" .PD Send a control-s to the current window. +.IP "\fBC-a S\fP (split)" +Split the current region into two new ones. .IP "\fBC-a t\fP" .PD 0 .IP "\fBC-a C-t\fP (time)" @@ -431,6 +515,8 @@ Toggle 80/132 columns. .IP "\fBC-a C-x\fP (lockscreen)" .PD Lock this terminal. +.IP "\fBC-a X\fP (remove)" +Kill the current region. .IP "\fBC-a z\fP" .PD 0 .IP "\fBC-a C-z\fP (suspend)" @@ -458,7 +544,7 @@ 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)" @@ -476,6 +562,11 @@ Shows where 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. +.\" XXX removed in 3.8.0 XXX +.\" .IP "\fBC-a ~\fP (select -)" +.\" Switch to the control window. +.IP "\fBC-a *\fP (displays)" +Show a listing of all currently attached displays. .SH CUSTOMIZATION @@ -487,7 +578,7 @@ 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 +is not running setuid-root, the user can specify any mode 700 directory in the environment variable $SCREENDIR. .PP When @@ -496,12 +587,12 @@ 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 +global screenrc file .I screen searches for the environment variable $SYSSCREENRC (this override feature may be disabled at compile-time). The user specific -screenrc file is searched in $ISCREENRC, then $SCREENRC, then $HOME/.iscreenrc -and finally defaults to $HOME/.screenrc. The command line option \fB-c\fP takes +screenrc file is searched in $SCREENRC, then $HOME/.screenrc. +The command line option \fB-c\fP takes precedence over the above user screenrc files. .PP Commands in these files are used to set options, bind functions to @@ -514,51 +605,66 @@ 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 protected from variable substitution. .PP +Two configuration files are shipped as examples with your screen distribution: +\*Qetc/screenrc\*U and \*Qetc/etcscreenrc\*U. They contain a number of +useful examples for various commands. +.PP Customization can also be done 'on-line'. To enter the command mode type `C-a :'. Note that commands starting with \*Qdef\*U change default values, while others change current settings. .PP The following commands are available: -.sp +.sp .ne 3 .BI acladd " usernames" +.RI [ crypted-pw ] +.br +.BI addacl " usernames" .PP 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 +user or a comma separated list of users. This command enables to attach to the .I screen session and performs the equivalent of `aclchg \fIusernames\fP +rwx \&"#?\&"'. executed. To add a user with restricted access, use the `aclchg' command below. +If an optional second parameter is supplied, it should be a crypted password +for the named user(s). `Addacl' is a synonym to `acladd'. Multi user mode only. -.sp +.sp .ne 3 .BI aclchg " usernames permbits list" +.br +.BI chacl " 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 +Change permissions for a comma separated list of users. Permission bits are +represented as `r', `w' and `x'. Prefixing `+' grants the permission, `-' +removes it. The third parameter is a comma separated 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. +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 +To allow read-only 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. +Rights of the special username +.B nobody +cannot be changed (see the \*Qsu\*U command). +`Chacl' is a synonym to `aclchg'. Multi user mode only. .sp .ne 3 @@ -571,6 +677,42 @@ user's displays are detached from the session. He cannot attach again. Multi user mode only. .sp .ne 3 +.BI aclgrp " username" +.RI [ groupname ] +.PP +Creates groups of users that share common access rights. The name of the +group is the username of the group leader. Each member of the group inherits +the permissions that are granted to the group leader. That means, if a user +fails an access check, another check is made for the group leader. +A user is removed from all groups the special value \*Qnone\*U is used for +.IR groupname . +If the second parameter is omitted all groups the user is in are listed. +.sp +.ne 3 +.B aclumask +.RI [[ users ] +bits +.RI |[ users ] -bits " .... ]" +.B umask +.RI [[ users ] +bits +.RI |[ users ] -bits " .... ]" +.PP +This specifies the access other users have to windows that will be created by +the caller of the command. +.I Users +may be no, one or a comma separated list of known usernames. If no users are +specified, a list of all currently known users is assumed. +.I Bits +is any combination of access control bits allowed defined with the +\*Qaclchg\*U command. The special username \*Q?\*U predefines the access +that not yet known users will be granted to any window initially. +The special username \*Q??\*U predefines the access that not yet known +users are granted to any command. +Rights of the special username +.B nobody +cannot be changed (see the \*Qsu\*U command). +`Umask' is a synonym to `aclumask'. +.sp +.ne 3 .BI activity " message" .PP When any activity occurs in a background window that is being monitored, @@ -593,11 +735,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. 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. +default redraw behavior of newly created windows. .sp .ne 3 .BR "at " "[\fIidentifier\fP][" "#\fP|\fP*\fP|\fP%\fP] " @@ -605,34 +747,56 @@ default redraw behaviour of newly created windows. .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 +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 +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. Caution: Permission is checked for the owners or the -affected display(s), not for the initiator of the `at' command. +what happened. Permission is checked for initiator of the \*Qat\*U command, +not for the owners of the affected display(s). +Note that the '#' character works as a comment introducer when it is preceded by +whitespace. This can be escaped by prefixing a '\e'. +Permission is checked for the initiator of the \*Qat\*U command, not for the +owners of the affected display(s). +.br +Caveat: +When matching against windows, the command is executed at least +once per window. Commands that change the internal arrangement of windows +(like \*Qother\*U) may be called again. In shared windows the command will +be repeated for each attached display. Beware, when issuing toggle commands +like \*Qlogin\*U! +Some commands (e.g. \*Qstuff\*U, \*Qprocess\*U or \*Qpaste\*U) require that +a display is associated with the target windows. These commands may not work +correctly under \*Qat\*U looping over windows. .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 .ne 3 +.BR "autofixterm on" | off +.PP +Sets whether +.I screen +will add missing capabilities to the termcap/info entry. It is on +by default. +.sp +.ne 3 .BR "autonuke on" | off .PP Sets whether a clear screen sequence should nuke all the output @@ -640,13 +804,13 @@ that has not been written to the terminal. See also \*Qobuflimit\*U. .sp .ne 3 -.BI "bell " message +.B bell_msg +.RI [ message ] .PP When a bell character is sent to a background window, .I screen displays a notification in the message line. -The notification message can be re-defined by means of the \*Qbell\*U -command. +The notification message can be re-defined by this command. Each occurrence of `%' in \fImessage\fP 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 @@ -655,11 +819,12 @@ The default message is .sp 'Bell in window %' .sp -An empty message can be supplied to the \*Qbell\*U command to suppress -output of a message line (bell ""). +An empty message can be supplied to the \*Qbell_msg\*U command to suppress +output of a message line (bell_msg ""). +Without parameter, the current message is shown. .sp .ne 3 -.BI "bind " key +.BI "bind " key .RI [ command " [" args ]] .PP Bind a command to a key. @@ -683,17 +848,22 @@ Some examples: .PP .nf bind ' ' windows + bind ^k + bind k + bind K kill bind ^f screen telnet foobar bind \e033 screen -ln -t root -h 1000 9 su .fi .PP would bind the space key to the command that displays a list of windows (so that the command usually invoked by \*QC-a C-w\*U -would also be available as \*QC-a space\*U), -bind \*QC-f\*U to the command \*Qcreate a window with a TELNET +would also be available as \*QC-a space\*U). The next three lines +remove the default kill binding from \*QC-a C-k\*U and \*QC-a k\*U. +\*QC-a K\*U is then bound to the kill command. Then it +binds \*QC-f\*U to the command \*Qcreate a window with a TELNET connection to foobar\*U, and bind \*Qescape\*U to the command that creates an non-login window with a.\|k.\|a. \*Qroot\*U in slot #9, with -a super-user shell and a scrollback buffer of 1000 lines. +a superuser shell and a scrollback buffer of 1000 lines. .sp .ne 3 .B bindkey @@ -735,15 +905,15 @@ 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. +option tells screen not to do inter-character timing. One cannot +turn off the timing if a termcap capability 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. +is omitted the key-binding is removed from the table. .br Here are some examples of keyboard bindings: .sp @@ -761,13 +931,13 @@ Make the "F1" key switch to window one. .nf bindkey -t foo stuff barfoo .fi -Make "foo" an abrevation of the word "barfoo". Timeout is disabled +Make "foo" an abbreviation 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 +This key-binding makes \*Q^T\*U an escape character for key-bindings. 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). @@ -783,17 +953,31 @@ escape (besides ^A). .RI [ duration ] .PP Send a break signal for \fIduration\fP*0.25 seconds to this window. -Most useful if a character device is -attached to the window rather than a shell process. +For non-Posix systems the time interval may be rounded up to full seconds. +Most useful if a character device is attached to the window rather than +a shell process (See also chapter \*QWINDOW TYPES\*U). The maximum duration of +a break signal is limited to 15 seconds. +.sp +.ne 3 +.B breaktype +.RI [ tcsendbreak | TIOCSBRK +.RI | TCSBRK ] +.PP +Choose one of the available methods of generating a break signal for +terminal devices. This command should affect the current window only. +But it still behaves identical to \*Qdefbreaktype\*U. This will be changed in +the future. +Calling \*Qbreaktype\*U with no parameter displays the break method for the +current window. .sp .ne 3 .B bufferfile .RI [ exchange-file ] .PP Change the filename used for reading and writing with the paste buffer. -If the optional argument to the \*Qbufferfile\*U command is omitted, +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 following example will paste the system's password file into the .I screen window (using the paste buffer, where a copy remains): @@ -816,6 +1000,27 @@ Users with fonts that have usable characters in the c1 positions may want to turn this off. .sp .ne 3 +.BR "caption always" | splitonly +.RI [ string ] +.br +.B "caption string" +.RI [ string ] +.PP +This command controls the display of the window captions. Normally +a caption is only used if more than one window is shown on the +display (split screen mode). But if the type is set to +.B always +screen shows a caption even if only one window is displayed. The default +is +.BR splitonly . +.P +The second form changes the text used for the caption. You can use +all escapes from the \*QSTRING ESCAPES\*U chapter. Screen uses +a default of `%3n %t'. +.P +You can mix both forms by providing a string as an additional argument. +.sp +.ne 3 .BI "charset " set .PP Change the current character set slot designation and charset @@ -861,28 +1066,37 @@ Clears the current window and saves its image to the scrollback buffer. .B colon .RI [ prefix ] .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 +.sp +.ne 3 +.BR "compacthist " [ on | off ] +.PP +This tells screen weather to suppress trailing blank lines when +scrolling up text into the history buffer. +.sp .ne 3 .BR "console " [ on | off ] .PP -Grabs or ungrabs the machines console output to a window. +Grabs or un-grabs the machines console output to a window. +.IR Note : +Only the owner of /dev/console can grab the console output. +This command is only available if the machine supports the ioctl TIOCCONS. .sp .ne 3 .B copy @@ -895,7 +1109,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 @@ -904,23 +1118,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. @@ -936,36 +1150,36 @@ 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 +(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 paste buffer. @@ -976,7 +1190,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. @@ -988,13 +1202,13 @@ 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, @@ -1007,16 +1221,16 @@ the paste buffer. Now try: and notice the difference in the amount of text copied. .br .ti -2n -\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 +\fBJ\fP joins lines. It toggles between 4 modes: lines separated by a +newline character (012), lines glued seamless, lines separated by a single +whitespace and comma separated lines. 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 @@ -1027,10 +1241,10 @@ the contents of the paste buffer will not be overwritten, but is appended to. .br .ti -2n \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. +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 @@ -1054,20 +1268,22 @@ All keys not described here exit copy mode. No longer exists, use \*Qreadreg\*U instead. .sp .ne 3 -.BR "crlf on" | off +.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. +When no parameter is given, the state is toggled. .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 correctly. Debug output from attacher processes can only +be turned off once and forever. .sp .ne 3 .BR "defc1 on" | off @@ -1083,6 +1299,26 @@ Note that you can use the special `AN' terminal capability if you want to have a dependency on the terminal type. .sp .ne 3 +.B defbreaktype +.RI [ tcsendbreak | TIOCSBRK +.RI | TCSBRK ] +.PP +Choose one of the available methods of generating a break signal for +terminal devices. The preferred methods are +.IR tcsendbreak " and " TIOCSBRK . +The third, +.IR TCSBRK , +blocks the complete +.I screen +session for the duration +of the break, but it may be the only way to generate long breaks. +.IR Tcsendbreak " and " TIOCSBRK +may or may not produce long breaks with spikes (e.g. 4 per +second). This is not only system dependant, this also differs between +serial board drivers. +Calling \*Qdefbreaktype\*U with no parameter displays the current setting. +.sp +.ne 3 .BR "defcharset " [ \fIset ] .PP Like the \fBcharset\fP command except that the default setting for @@ -1092,22 +1328,22 @@ argument. .ne 3 .BI "defescape " xy .PP -Set the default command characters. This is equivalent to the +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 +.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 @@ -1125,7 +1361,7 @@ display the window number or title or the like. .I Status may contain the same directives as in the window messages, but the directive escape character is '^E' (octal 005) instead of '%'. -This was done to make a misinterpretion of program generated +This was done to make a misinterpretation of program generated hardstatus lines impossible. If the parameter .I status @@ -1141,7 +1377,7 @@ windows is changed. Initial setting is `off', i.e. `jis'. .ne 3 .BR "deflogin on" | off .PP -Same as the \fBlogin\fP command except that the default setting for new windows +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 @@ -1154,7 +1390,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 @@ -1167,21 +1403,38 @@ 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 +.BI "defshell " command +.PP +Synonym to the \fBshell\fP command. See there. +.sp +.ne 3 +.BR "defsilence on" | off +.PP +Same as the \fBsilence\fP command except that the default setting for new +windows is changed. Initial setting is `off'. +.sp +.ne 3 +.BI "defslowpaste " msec" +.PP +Same as the \fBslowpaste\fP command except that the default setting for new +windows is changed. Initial setting is 0 milliseconds, meaning `off'. +.sp +.ne 3 .BR "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. +Same as the \fBwritelock\fP command except that the default setting for new +windows is changed. Initially writelocks will off. .sp .ne 3 .BR "defzombie " [\fIkeys\fP] @@ -1192,7 +1445,7 @@ See there. .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 @@ -1206,6 +1459,12 @@ with the option. (See also section \*QCOMMAND-LINE OPTIONS\*U.) .sp .ne 3 +.B displays +.PP +Shows a tabular listing of all currently connected user front-ends (displays). +This is most useful for multiuser sessions. +.sp +.ne 3 .BR "digraph " [ \fIpreset ] .PP This command prompts the user for a digraph sequence. The next @@ -1214,7 +1473,7 @@ resulting character is inserted in the input stream. For example, if the user enters 'a"', an a-umlaut will be inserted. If the first character entered is a 0 (zero), .I screen -will treat the following charcters (up to three) as an octal +will treat the following characters (up to three) as an octal number instead. The optional argument .I preset is treated as user input, thus one can create an \*Qumlaut\*U key. @@ -1225,35 +1484,37 @@ to generate an a-umlaut by typing CTRL-K a. .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 -\*Qsleep\*U. +day'. Typically installed in a global /local/etc/screenrc. +The option \*Q-n\*U may be used to suppress the line feed. +See also \*Qsleep\*U. Echo is also useful for online checking of environment variables. .sp .ne 3 .BI "escape " xy .PP Set the command character to \fIx\fP and the character generating a literal -command character to \fIy\fP (just like in the \-e option). +command character (by triggering the \*Qmeta\*U command) to \fIy\fP (similar +to the \-e option). Each argument is either a single character, a two-character sequence of the form \*Q^x\*U (meaning \*QC-x\*U), a backslash followed by an octal number (specifying the ASCII code of the character), or a backslash followed @@ -1265,38 +1526,42 @@ 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 -newcommand's stdin/stdout/stderr, the process already running (shell) and -screen itself (window) is controlled by the filedescriptor pattern fdpat. +Run a unix subprocess (specified by an executable path \fInewcommand\fP and its +optional arguments) in the current window. The flow of data between +newcommands stdin/stdout/stderr, the process originally started in the window +(let us call it "application-process") 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 .IR screen . An exclamation mark (!) causes the file -descriptor to be connected to the already running process. A colon (:) combines +descriptor to be connected to the application-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 -the end of fdpat. +User input will go to newcommand unless newcommand receives the +application-process' +output (fdpats first character is `!' or `:') or a pipe symbol (|) is added +(as a fourth character) to the end of fdpat. .br Invoking `exec' without arguments shows name and arguments of the currently -running subprocess in this window. +running subprocess in this window. Only one subprocess a time can be running +in each window. .br When a subprocess is running the `kill' command will affect it instead of the windows process. .br -Refer to the postscript file `fdpat.ips' for a confusing illustration +Refer to the postscript file `doc/fdpat.ps' for a confusing illustration of all 21 possible combinations. Each drawing shows the digits 2,1,0 representing the three file descriptors of newcommand. The box marked -`W' is usual pty that has the application-process on its slave side. +`W' is the usual pty that has the application-process 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 omitted here and can always be replaced by `!'. .sp @@ -1308,7 +1573,7 @@ exec /bin/sh .br !/bin/sh .PP -Creates another shell in the same window, while the original 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 @@ -1318,15 +1583,15 @@ exec ! stty 19200 .br !!stty 19200 .PP -Set the speed of the window's tty. If your stty command operates on stdout, then -add another `!'. +Set the speed of the window's tty. If your stty command operates on stdout, +then add another `!'. .IP exec !..| less .br |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 window's process. This works, because .I less listens on stderr (a behavior that @@ -1347,21 +1612,34 @@ This will cause "Bell in window x" messages, whenever the string "Error" appears in the window. .sp .ne 3 +.B fit +.PP +Change the window size to the size of the current region. This +command is needed because screen doesn't adapt the window size +automatically if the window is displayed more than once. +.sp +.ne 3 .B flow .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 +.B focus +.PP +Move the input focus to the next region. This is done in a cyclic +way so that the top region is selected after the bottom one. +.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 +Turn GR charset switching on/off. Whenever screen sees an input +character with the 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. @@ -1371,15 +1649,15 @@ otherwise the ISO88591 charset would not work. .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 @@ -1393,14 +1671,52 @@ current working directory. .sp .ne 3 .BR "hardstatus " [ on | off ] -.PP -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 -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. +.br +.BR "hardstatus \fR[\fBalways\fR]\fBlastline" | message | ignore +.RI [ string ] +.br +.B "hardstatus string" +.RI [ string ] +.PP +This command configures the use and emulation of the terminal's +hardstatus line. The first form +toggles whether +.I screen +will use the hardware status line to display messages. If the +flag is set to `off', these messages +are overlaid in reverse video mode at the display line. The default +setting is `on'. +.P +The second form tells +.I screen +what to do if the terminal doesn't +have a hardstatus line (i.e. the termcap/terminfo capabilities +"hs", "ts", "fs" and "ds" are not set). If the type +\*Qlastline\*U is used, +.I screen +will reserve the last line of the +display for +the hardstatus. \*Qmessage\*U uses +.I screen's +message mechanism and +\*Qignore\*U tells +.I screen +never to display the hardstatus. +If you prepend the word \*Qalways\*U to the type, +.I screen +will use the type even if the terminal supports a hardstatus. +.P +The third form specifies the contents of the hardstatus line. +'%h' is used as default string, i.e. the stored hardstatus of the +current window (settable via \\E]0;^G or \\E_\\\\) is displayed. +You can customize this to any string you like including +the escapes from the \*QSTRING ESCAPES\*U chapter. If you leave +out the argument +.IR string , +the current string is displayed. +.P +You can mix the second and third form by providing the string as +additional argument. .sp .ne 3 .BR "height " [ \fIlines\fP ] @@ -1411,8 +1727,10 @@ is given it toggles between 24 and 42 lines display. .ne 3 .B help .PP -Not really a online help, but -displays a help screen showing you all the key bindings. +Not really a online help, but +displays a help +.I screen +showing you all the key bindings. The first pages list all the internal commands followed by their current bindings. Subsequent pages will display the custom commands, one command per key. @@ -1424,29 +1742,56 @@ 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 +.BI "hstatus " status +.PP +Change the window's hardstatus line to the string \fIstatus\fP. .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, -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)), -the currently active character set (\fIG0\fP, \fIG1\fP, \fIG2\fP, -or \fIG3\fP), and in square brackets the terminal character sets that are -currently designated as \fIG0\fP through \fIG3\fP. +the terminal width and height plus the size of the scrollback buffer in lines, +like in \*Q(80,24)+50\*U, the current state of window XON/XOFF flow control +is shown like this (See also section FLOW CONTROL): + +.nf + +flow automatic flow control, currently on. + -flow automatic flow control, currently off. + +(+)flow flow control enabled. Agrees with automatic control. + -(+)flow flow control disabled. Disagrees with automatic control. + +(-)flow flow control enabled. Disagrees with automatic control. + -(-)flow flow control disabled. Agrees with automatic control. +.fi + +The current line wrap setting (`+wrap' indicates enabled, `\-wrap' not) is +also shown. The flags `ins', `org', `app', `log', `mon' or `nored' are +displayed when the window is in insert mode, origin mode, +application-keypad mode, has output logging, +insert mode, origin mode, application-keypad mode, output logging, +activity monitoring or partial redraw enabled. + +The currently active character set (\fIG0\fP, \fIG1\fP, \fIG2\fP, +or \fIG3\fP) and in square brackets the terminal character sets that are +currently designated as \fIG0\fP through \fIG3\fP is shown. + +Additional modes depending on the type of the window are displayed at the end of the status line (See also chapter \*QWINDOW TYPES\*U). +.br +If the state machine of the terminal emulator is in a non-default state, +the info line is started with a string identifying the current state. +.br For system information use the \*Qtime\*U command. .sp .ne 3 @@ -1459,9 +1804,12 @@ No longer exists, use \*Qpaste\*U instead. .BR jis | euc | sjis .RB [ jis | euc | sjis\fR] .PP -Tell screen how to process kanji input/output. The first argument +Tell +.I screen +how to process kanji input/output. The first argument sets the kanji type of the current window. Each window can emulate -a different type. The optional second parameter tells screen +a different type. The optional second parameter tells +.I screen how to write the kanji codes to the connected terminal. The preferred method of setting the display type is to use the \*QKJ\*U termcap entry. @@ -1472,15 +1820,19 @@ window. .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 -.I screen -switches to the previously displayed window. -When the last window is destroyed, +(shell) running in the window receives a HANGUP condition, +the window structure is removed and +.I screen +(your display) switches to another +window. When the last window is destroyed, .I screen exits. +After a kill +.I screen +switches to the previously displayed window. +.br Note: .I Emacs users should keep this command in mind, when killing a line. @@ -1492,7 +1844,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 @@ -1501,7 +1853,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 @@ -1510,29 +1862,40 @@ 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. +.br +Warning: +When you leave other shells unlocked and you have no password set on +.IR screen , +the lock is void: One could easily re-attach from an unlocked +shell. This feature should rather be called `lockterminal'. .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. This filename can be changed with the `logfile' command. 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 .ne 3 .BI "logfile " filename +.br +.BI "logfile flush " secs .PP Defines the name the logfiles will get. The default is -\*Qscreenlog.%n\*U. +\*Qscreenlog.%n\*U. The second form changes the number of seconds +.I screen +will wait before flushing the logfile buffer to the file-system. The +default value is 10 seconds. .sp .ne 3 .BR "login " [ on | off ] @@ -1543,18 +1906,43 @@ 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 +.BR "logtstamp " [ on | off ] +.br +.B "logtstamp after" +.RI [ secs ] +.br +.B "logtstamp string" +.RI [ string ] +.PP +This command controls logfile time-stamp mechanism of +.I screen. +If +time-stamps are turned \*Qon\*U, +.I screen +adds a string containing +the current time to the logfile after two minutes of inactivity. +When output continues and more than another two minutes have passed, +a second time-stamp is added to document the restart of the +output. You can change this timeout with the second form +of the command. The third form is used for customizing the time-stamp +string (`-- %n:%t -- time-stamp -- %M/%d/%y %c:%s --\\n' by +default). +.sp +.ne 3 .B mapdefault .PP -Tell screen that the next input character should only be looked up +Tell +.I screen +that the next input character should only be looked up in the default bindkey table. See also \*Qbindkey\*U. .sp .ne 3 @@ -1566,7 +1954,7 @@ Like mapdefault, but don't even look in the default bindkey table. .B maptimeout .RI [ timo ] .PP -Set the intercharacter timer for input sequence detection to a timeout +Set the inter-character timer for input sequence detection to a timeout of .I timo ms. The default timeout is 300ms. Maptimeout with no arguments shows @@ -1578,11 +1966,17 @@ See also \*Qbindkey\*U. .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 binding. +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: \*Qmarkkeys +@=L=H\*U 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. .sp .ne 3 .B meta @@ -1602,15 +1996,15 @@ 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 @@ -1620,8 +2014,10 @@ is not disturbed by other activity. The default is 5 seconds. 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. +`aclchg', `aclgrp' and `acldel' +can be used to enable (and disable) other users accessing this +.I screen +session. .sp .ne 3 .BR "nethack on" | off @@ -1633,11 +2029,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 +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 +default setting is then determined by the presence of the environment variable $NETHACKOPTIONS. .sp .ne 3 @@ -1647,9 +2043,18 @@ Switch to the next window. This command can be used repeatedly to cycle through the list of windows. .sp .ne 3 +.B nonblock +.RB [ on | off ] +.PP +Enable or disable flow control for the current user interface (display). +It is used to prevent a slow display from slowing down the processing of +data output by a window. This command may be helpful when multiple displays +show the same window. Nonblock is initially off for all displays. +.sp +.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 @@ -1663,9 +2068,15 @@ display (like xterm), you can set it to some higher value. If no argument is specified, the current setting is displayed. .sp .ne 3 +.B only +.PP +Kill all regions but the current one. +.sp +.ne 3 .B other .PP -Switch to the window displayed previously. +Switch to the window displayed previously. If this window does no longer exist, +\fIother\fP has the same effect as \fInext\fP. .sp .ne 3 .BR "partial on" | off @@ -1673,7 +2084,7 @@ Switch to the window displayed previously. 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 immediately affect all windows use the \fIallpartial\fP command. -Default is `off', of course. This default is fixed, as there is currently no +Default is `off', of course. This default is fixed, as there is currently no \fIdefpartial\fP command. .sp .ne 3 @@ -1699,27 +2110,29 @@ Default is `none', this disables password checking. .PP 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 the user is prompted for a single +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 +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 +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 +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 +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 +Tell +.I screen +to include font information in the paste buffer. The +default is not to do so. This command is especially useful for multi character fonts like kanji. .sp .ne 3 @@ -1730,20 +2143,22 @@ 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 .ne 3 -.BI "pow_detach_msg " message +.B pow_detach_msg +.RI [ 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. +Without parameter, the current message is shown. .sp .ne 3 .B prev @@ -1757,7 +2172,9 @@ This command can be used repeatedly to cycle through the list of windows. .PP If .I cmd -is not an empty string, screen will not use the terminal capabilities +is not an empty string, +.I 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 @@ -1776,7 +2193,8 @@ access to your terminal, they will be able to fire off print commands. .ne 3 .BR process " [" \fIkey ] .PP -Stuff the contents of the specified register into \fIscreen\fP's +Stuff the contents of the specified register into +.IR screen '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 user's keyboard. This command can be used to bind multiple actions to a single key. @@ -1794,20 +2212,22 @@ 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 paste buffer. +Reads the contents of the current screen-exchange file into the paste buffer. See also \*Qbufferfile\*U command. .sp .ne 3 -.B readreg +.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 +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): +The following example will paste the system's password file into +the +.I screen +window (using register p, where a copy remains): .PP .nf C-a : readreg p /etc/passwd @@ -1827,14 +2247,19 @@ Save the specified \fIstring\fP to the register \fIkey\fP. See also the \*Qpaste\*U command. .sp .ne 3 +.B "remove" +.PP +Kill the current region. This is a no-op if there is only one region. +.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. @@ -1845,8 +2270,10 @@ an application. Establish a new window. The flow-control options (\fB\-f\fP, \fB\-fn\fP and \fB\-fa\fP), title (a.\|k.\|a.) option (\fB\-t\fP), login options (\fB-l\fP and \fB-ln\fP) -, terminal type option (\fB-T \fP) and scrollback option (\fB-h\fP ) -may be specified for each command. +, terminal type option (\fB-T\fP ), the all-capability-flag (\fB-a\fP) +and scrollback option (\fB-h\fP ) may be specified with each command. +The option (\fB-M\fP) turns monitoring on for this window. +The option (\fB-L\fP) turns output logging on for this window. If an optional number \fIn\fP in the range 0..9 is given, the window number \fIn\fP is assigned to the newly created window (or, if this number is already in-use, the next available number). @@ -1857,53 +2284,65 @@ Thus, if your \*Q.screenrc\*U contains the lines .nf # example for .screenrc: screen 1 - screen -fn -t foobar 2 telnet foobar + screen -fn -t foobar -L 2 telnet foobar .fi .sp .I 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 \*Qfoobar\*U -in window #2). Note, that unlike previous versions of +in window #2) and will write a logfile (\*Qscreenlog.2\*U) of the telnet +session. +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, opens a default window #0. +.br +Screen has built in some functionality of \*Qcu\*U and \*Qtelnet\*U. +See also chapter \*QWINDOW TYPES\*U. .sp .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 -.BR "select " [ \fIn ] +.BR "select " [ \fIWindowID ] .PP -Switch to the window with the number \fIn\fP. -If no window number is specified, you get prompted for an -identifier. This can be title (alphanumeric window name) or a number. +Switch to the window identified by \fIWindowID\fP. +This can be a prefix of a window title (alphanumeric window name) or a window +number. +The parameter is optional and if omitted, you get prompted for an identifier. 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 .I screen -was compiled with a higher MAXWIN setting). +was compiled with a higher +MAXWIN setting). +.\" XXX removed in 3.8.0 XXX +.\" The special command \*Qselect -\*U switches to a control window which +.\" can be used to enter +.\" .I screen +.\" commands directly at the colon (:) prompt. .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. @@ -1935,7 +2374,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 @@ -1953,33 +2392,44 @@ Keyboard activity will end the sleep. It may be used to give users a chance to read the messages output by \*Qecho\*U. .sp .ne 3 -.B "slowpaste \fIusec\fP" +.B "slowpaste \fImsec\fP" .PP -Define the speed at which text is inserted by the paste ("C-a ]") command. +Define the speed at which text is inserted into the current window 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 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. +will make a pause of \fImsec\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 sorendition .RB [ "\fIattr\fR " [ \fIcolor ]] .PP -Change the way screen does highlighting for text marking and printing -messages. +Change the way +.I screen +does highlighting for text marking and printing messages. .I Attr is a hexadecimal number and describes the attributes (inverse, underline, ...) the text will get. .I Color is a 2 digit number and changes the -forground/background of the highlighted text. -Some knowledge of screen's internal character representation is +foreground/background of the highlighted text. +Some knowledge of +.IR screen 's +internal character representation is needed to make the characters appear in the desired way. The default is currently 10 99 (standout, default colors). .sp .ne 3 +.B split +.PP +Split the current region into two new ones. All regions on the +display are resized to make room for the new region. The blank +window is displayed on the new region. +.sp +.ne 3 .B "startup_message on\fP|\fBoff" .PP Select whether you want to see the copyright notice during startup. @@ -1994,16 +2444,39 @@ Stuff the 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 +large buffers with the \*Qstuff\*U command. It is most useful for key bindings. See also \*Qbindkey\*U. .sp .ne 3 +.B su +.RB [ username " [" password +.RB [ password2 ]] +.PP +Substitute the user of a display. The command prompts for all parameters that +are omitted. If passwords are specified as parameters, they have to be +specified un-crypted. The first password is matched against the systems +passwd database, the second password is matched against the +.I screen +password as set with the commands \*Qacladd\*U or \*Qpassword\*U. +\*QSu\*U may be useful for the +.I screen +administrator to test multiuser setups. +.\" XXX removed in 3.8.0 XXX +.\" but it is mainly used implicitly +.\" by the \*Qconnect\*U command to identify users that access a remote session. +When the identification fails, the user has access to the commands available +for user +.BR nobody . +These are \*Qdetach\*U, \*Qlicense\*U, \*Qversion\*U, \*Qhelp\*U and +\*Qdisplays\*U. +.sp +.ne 3 .B "suspend" .PP Suspend .IR screen . -The windows are in the `detached' state, while -.IR screen +The windows are in the `detached' state, while +.I screen is suspended. This feature relies on the shell being able to do job control. .sp .ne 3 @@ -2011,10 +2484,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. @@ -2032,14 +2505,16 @@ rlogin othermachine\*U rather than setting and resetting the default. .BI termcapinfo " term terminal-tweaks" .RI [ window-tweaks ] .PP -Use this command to modify your terminal's termcap entry without going through -all the hassles involved in creating a custom termcap entry. +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 works with terminfo-database rather than with -termcap, -.I screen -will understand the `terminfo' command, which has the same effects as -the `termcap' command. Two separate commands are provided, as there are subtle +You have to place these commands in one of the screenrc startup files, as +they are meaningless once the terminal emulator is booted. +.br +If your system works uses the terminfo database rather than termcap, +.I screen +will understand the `terminfo' command, which has the same effects as the +`termcap' command. Two separate commands are provided, as there are subtle syntactic differences, e.g. when parameter interpolation (using `%') is required. Note that termcap names of the capabilities have to be used with the `terminfo' command. @@ -2126,7 +2601,7 @@ 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 +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 @@ -2138,29 +2613,45 @@ releases. Unset an environment variable. .sp .ne 3 -.BR "vbell on" | off +.B vbell +.RB [ on | off ] .PP -If your terminal does not support -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'). +Sets the visual bell setting for this window. Omitting the parameter +toggles the setting. If vbell is switched on, but your terminal does not +support a visual bell, a `vbell-message' is displayed in the status line when +the bell character (^G) is received. +Visual bell support of a terminal is defined by the termcap variable `vb' +(terminfo: 'flash'). +.br +Per default, vbell is off, thus the audible bell is used. +See also `bell_msg'. .sp .ne 3 -.BI "vbell_msg " message +.B vbell_msg +.RI [ message ] .PP Sets the visual bell message. \fImessage\fP is printed to the status line if -the window receives a bell character (^G) and vbell is set to \*Qon\*U. +the window receives a bell character (^G), vbell is set to \*Qon\*U, but the +terminal does not support a visual bell. The default message is \*QWuff, Wuff!!\*U. +Without parameter, the current message is shown. .sp .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 .ne 3 +.B verbose +.RB [ on | off ] +.PP +If verbose is switched on, the command name is echoed, whenever a window +is created (or resurrected from zombie state). Default is off. +Without parameter, the current setting is shown. +.sp +.ne 3 .B version .PP Print the current version and the compile date in the status line. @@ -2174,8 +2665,8 @@ status line. .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 @@ -2191,7 +2682,7 @@ 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 terminal's status line only the @@ -2224,7 +2715,7 @@ 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 @@ -2242,14 +2733,16 @@ current window. .BR "defzombie " [\fIkeys\fP] .PP Per default -.I screen +.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 +The \fBkill\fP command 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, +.I 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. @@ -2281,6 +2774,173 @@ echo '^Hello world from window '$WINDOW'\e\e' where '' is an \fIescape\fP, '^' is a literal up-arrow, and '\e\e' turns into a single backslash. +.SH "WINDOW TYPES" +Screen provides three different window types. New windows are created with +.IR screen 's +.B screen +command (see also the entry in chapter \*QCUSTOMIZATION\*U). The first +parameter to the +.B screen +command defines which type of window is created. The different window types are +all special cases of the normal type. They have been added in order +to allow +.I screen +to be used efficiently as a console multiplexer with 100 or more windows. + +.IP \(bu 3 +The normal window contains a shell (default, if no parameter is given) or any +other system command that could be executed from a shell (e.g. +.BR slogin , +etc...) + +.IP \(bu +If a tty (character special device) name (e.g. \*Q/dev/ttya\*U) +is specified as the first parameter, then the window is directly connected to +this device. +This window type is similar to \*Qscreen cu -l /dev/ttya\*U. +Read and write access is required on the device node, an exclusive open is +attempted on the node to mark the connection line as busy. +An optional parameter is allowed consisting of a comma separated list of flags +in the notation used by stty(1): +.RS +.IP +Usually 300, 1200, 9600 or 19200. This affects transmission as well as receive speed. +.IP "cs8 or cs7" +Specify the transmission of eight (or seven) bits per byte. +.IP "ixon or -ixon" +Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending data. +.IP "ixoff or -ixon" +Enables (or disables) software flow-control for receiving data. +.IP "istrip or -istrip" +Clear (or keep) the eight bit in each received byte. +.PP +You may want to specify as many of these options as applicable. Unspecified +options cause the terminal driver to make up the parameter values of the +connection. These values are system dependant and may be in defaults or values +saved from a previous connection. +.PP +For tty windows, the +.B info +command shows some of the modem control lines +in the status line. These may include `RTS', `CTS', 'DTR', `DSR', `CD' and more. +This depends on the available ioctl()'s and system header files as well as the +on the physical capabilities of the serial board. +Signals that are logical low (inactive) have their name preceded by +an exclamation mark (!), otherwise the signal is logical high (active). +Signals not supported by the hardware but available to the ioctl() interface +are usually shown low. +.br +When the CLOCAL status bit is true, the whole set of modem signals is placed +inside curly braces ({ and }). +When the CRTSCTS or TIOCSOFTCAR bit is set, the signals `CTS' or `CD' +are shown in parenthesis, respectively. + + +For tty windows, the command +.B break +causes the Data transmission line (TxD) to go low for a specified period of +time. This is expected to be interpreted as break signal on the other side. +No data is sent and no modem control line is changed when a +.B break +is issued. +.RE +.IP \(bu +If the first parameter is \*Q//telnet\*U, the second parameter is expected to +be a host name, and an optional third parameter may specify a TCP port number +(default decimal 23). Screen will connect to a server listening on the remote +host and use the telnet protocol to communicate with that server. +.br +.br +For telnet windows, the command +.B info +shows details about the connection in square brackets ([ and ]) at the end of +the status line. +.RS +.IP b +BINARY. The connection is in binary mode. +.IP e +ECHO. Local echo is disabled. +.IP c +SGA. The connection is in `character mode' (default: `line mode'). +.IP t +TTYPE. The terminal type has been requested by the remote host. +Screen sends the name \*Qscreen\*U unless instructed otherwise (see also +the command `term'). +.IP w +NAWS. The remote site is notified about window size changes. +.IP f +LFLOW. The remote host will send flow control information. +(Ignored at the moment.) +.PP +Additional flags for debugging are x, t and n (XDISPLOC, TSPEED and +NEWENV). +.PP +For telnet windows, the command +.B break +sends the telnet code IAC BREAK (decimal 243) to the remote host. + + +This window type is only available if +.I screen +was compiled with the BUILTIN_TELNET option defined. +.RE + + +.SH "STRING ESCAPES" +Screen provides an escape mechanism to insert information like the +current time into messages or file names. The escape character +is '%' with one exception: inside of a window's hardstatus '^%' ('^E') +is used instead. + +Here is the full list of supported escapes: +.IP % +the escape character itself +.IP a +either 'am' or 'pm' +.IP A +either 'AM' or 'PM' +.IP c +current time HH:MM in 24h format +.IP C +current time HH:MM in 12h format +.IP d +day number +.IP D +weekday name +.IP h +hardstatus of the window +.IP l +current load of the system +.IP m +month number +.IP M +month name +.IP n +window number +.IP s +seconds +.IP t +window title +.IP u +all other users on this window +.IP w +all window numbers and names +.IP W +all window numbers and names except the current one +.IP y +last two digits of the year number +.IP Y +full year number +.IP ? +the part to the next '%?' is displayed only if an escape expands to an +nonempty string +.IP : +else part of '%?' +.P +The 'c' and 'C' escape may be qualified with a '0' to make +.I screen +use zero instead of space as fill character. The 'n' escape understands +a length qualifier (e.g. '%3n'). .SH "FLOW-CONTROL" Each window has a flow-control setting that determines how @@ -2479,7 +3139,7 @@ PROMPT_COMMAND='echo -n -e "\e033k\e033\e134"' Each window in a .I screen session emulates a VT100 terminal, with some extra functions added. The -VT100 emulator is hardcoded, no other terminal types can be emulated. +VT100 emulator is hard-coded, no other terminal types can be emulated. .br Usually .I screen @@ -2500,10 +3160,10 @@ 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 @@ -2556,7 +3216,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. @@ -2579,9 +3239,9 @@ 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 @@ -2594,13 +3254,17 @@ 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. +Data sent to the printer is not displayed in the window. The +.I info +command displays a line starting `PRIN' while the printer is active. .PP .I Screen maintains a hardstatus line for every window. If a window gets selected, the display's hardstatus will be updated to match the window's hardstatus line. If the display has no hardstatus -the line will be displayed as a standard screen message. +the line will be displayed as a standard +.I screen +message. The hardstatus line can be changed with the ANSI Application Program Command (APC): \*QESC_ESC\e\*U. As a convenience for xterm users the sequence \*QESC]0..2;^G\*U is @@ -2611,7 +3275,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 @@ -2730,7 +3394,7 @@ Designate character set as G3 Direct Cursor Addressing .TP 27 .B "ESC [ \fPPn\fB ; \fPPn\fB f" -Direct Cursor Addressing +same as above .TP 27 .B "ESC [ \fPPn\fB J" Erase in Display @@ -2768,6 +3432,21 @@ Cursor Right .B "ESC [ \fPPn\fB D" Cursor Left .TP 27 +.B "ESC [ \fPPn\fB E" +Cursor next line +.TP 27 +.B "ESC [ \fPPn\fB F" +Cursor previous line +.TP 27 +.B "ESC [ \fPPn\fB G" +Cursor horizontal position +.TP 27 +.B "ESC [ \fPPn\fB `" +same as above +.TP 27 +.B "ESC [ \fPPn\fB d" +Cursor vertical position +.TP 27 .B "ESC [ \fPPs\fB ;\fP...\fB; \fPPs\fB m" Select Graphic Rendition .TP 27 @@ -2879,6 +3558,9 @@ Scroll Scrolling Region Up .B "ESC [ \fPPn\fB T" Scroll Scrolling Region Down .TP 27 +.B "ESC [ \fPPn\fB ^" +same as above +.TP 27 .B "ESC [ \fPPs\fB ;\fP...\fB; \fPPs\fB h" Set Mode .TP 27 @@ -2935,11 +3617,13 @@ Send Cursor Position Report .SH "INPUT TRANSLATION" -In order to do a full VT100 emulation \fIscreen\fP has to detect +In order to do a full VT100 emulation +.I 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. \fIScreen\fP has a very flexible way of doing -this by making it posible to map arbitrary commands on arbitrary +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 \fBstuff\fP in the command table). @@ -3028,8 +3712,9 @@ Keypad enter fe stuff \e015 .SH SPECIAL TERMINAL CAPABILITIES The following table describes all terminal capabilities -that are recognized by \fIscreen\fP and are not in the -termcap(5) manual. +that are recognized by +.I screen +and are not in the termcap(5) manual. You can place these capabilities in your termcap entries (in `/etc/termcap') or use them with the commands `termcap', `terminfo' and `termcapinfo' in your screenrc files. It is often not possible to place @@ -3039,8 +3724,9 @@ these capabilities in the terminfo database. .TP 13 .BI LP " (bool)" Terminal has VT100 style margins (`magic margins'). Note that -this capability is obsolete because \fIscreen\fP uses the standard 'xn' -instead. +this capability is obsolete because +.I screen +uses the standard 'xn' instead. .TP 13 .BI Z0 " (str)" Change width to 132 columns. @@ -3073,10 +3759,10 @@ Use the string as a conversion table for font '0'. See the 'ac' capability for more details. .TP 13 .BI CS " (str)" -Switch cursorkeys to application mode. +Switch cursor-keys to application mode. .TP 13 .BI CE " (str)" -Switch cursorkeys back to normal mode. +Switch cursor-keys back to normal mode. .TP 13 .BI AN " (bool)" Turn on autonuke. See the 'autonuke' command for more details. @@ -3089,7 +3775,7 @@ Set the kanji type of the terminal. Valid strings are \*Qjis\*U, \*Qeuc\*U and \*Qsjis\*U. .TP 13 .BI AF " (str)" -Change character forground color in an ANSI conform way. This +Change character foreground color in an ANSI conform way. This capability will almost always be set to '\eE[3%dm' ('\eE[3%p1%dm' on terminfo machines). .TP 13 @@ -3122,12 +3808,14 @@ Syntax: The things in braces may be repeated any number of times. -A \fI\fP tells \fIscreen\fP how to map characters +A \fI\fP tells +.I screen +how to map characters in font \fI\fP ('B': Ascii, 'A': UK, 'K': german, etc.) to strings. Every \fI\fP describes to what string a single character will be translated. A template mechanism is used, as most of the time the codes have a lot in common (for example -strings to switch to and from another charset). Each occurence +strings to switch to and from another charset). Each occurrence of '%' in \fI