home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / screen35 / part02 < prev    next >
Encoding:
Text File  |  1993-07-25  |  110.3 KB  |  3,962 lines

  1. Newsgroups: comp.sources.unix
  2. From: mlschroe@immd4.informatik.uni-erlangen.de (Michael Schroeder)
  3. Subject: v26i301: screen-3.5 - screen manager with VT100/ANSI terminal emulation, V3.5, Part02/10
  4. Sender: unix-sources-moderator@gw.home.vix.com
  5. Approved: vixie@gw.home.vix.com
  6.  
  7. Submitted-By: mlschroe@immd4.informatik.uni-erlangen.de (Michael Schroeder)
  8. Posting-Number: Volume 26, Issue 301
  9. Archive-Name: screen-3.5/part02
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 2 (of 10)."
  18. # Contents:  ChangeLog Makefile.in acl.c config.h config.h.in extern.h
  19. #   os.h patchlevel.h resize.c search.c
  20. # Wrapped by vixie@gw.home.vix.com on Sun Jul 25 12:57:14 1993
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'ChangeLog' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'ChangeLog'\"
  24. else
  25. echo shar: Extracting \"'ChangeLog'\" \(11159 characters\)
  26. sed "s/^X//" >'ChangeLog' <<'END_OF_FILE'
  27. X13.05.93 -- 3.3.3
  28. X=================
  29. X
  30. X* defautonuke, silence commands added.
  31. X
  32. X* exec command added.
  33. X
  34. X* hardcopydir, logdir commands added.
  35. X
  36. X* Made a superb configure script.
  37. X
  38. X* BROKEN_PIPE, SOCK_NOT_IN_FS added for braindamaged systems.
  39. X
  40. X* multi display, multi user support.
  41. X
  42. X* process command. CS, CE switch cursorkeycap in application mode.
  43. X
  44. X* lockprg pow_detaches on SIGHUP
  45. X
  46. X* ins_reg copy_reg commands.
  47. X
  48. X* new iscreenrc syntax.
  49. X
  50. X* split up screen.c and ansi.c
  51. X
  52. X21.10.92 -- 3.2.9
  53. X================
  54. X
  55. X* ChangeLog: replaces CHANGES and is in GNUish format.
  56. X
  57. X* Makefile (CFLAGS, M_CFLAGS, LIBS, OPTIONS): moved user config here, 
  58. X    merged all Makefiles, GNUified
  59. X
  60. X* socket.c (FindSocket): ignoring bad files in $SCREENDIR
  61. X
  62. X* config/config.linux: ported.
  63. X
  64. X* utmp.c, exec.c, loadav.c: split apart from screen.c/fileio.c
  65. X
  66. X15.07.92 -- 3.2.8
  67. X=================
  68. X
  69. X* ansi.c (WriteString): automatic character set switching for 8bit support
  70. X
  71. X3.2.3-3.2.7
  72. X===========
  73. X
  74. X* concept changes: Display structure, Multi attacher 
  75. X
  76. X...
  77. X
  78. X3.2.2
  79. X=====
  80. X
  81. X* screen.c (main): -m option, "_M_ake always new session", ignore $STY
  82. X
  83. X* screen.c (main):  -Ssessionname 
  84. X* fileio.c (RcLine): ^A:sessionname give your session a nicer name.
  85. X
  86. X* screen.c (main): supporting detached startup via screen -d -m -Ssockname
  87. X
  88. X* fileio.c (stripdev): moved, could not compile
  89. X
  90. X* overlay.h: "stackable overlay concept"
  91. X
  92. X* search.c: vi-like / and ? search AND emacs-like ^S and ^R incremental search
  93. X    in scrollback
  94. X
  95. X* mark.c: I meant BSDI not BSD
  96. X
  97. X* concept change: struct display and struct newwin introduced.
  98. X
  99. X* screen.c (main): -v option prints version.
  100. X
  101. X* screen.c (MakeWindow): ^A:screen /dev/ttya opens a character device 
  102. X    instead of forking ShellProg with a pty pair.
  103. X
  104. X3.2.0
  105. X=====
  106. X
  107. XUltrix port
  108. X
  109. XIrix 3.3 SGI port
  110. X
  111. Xshadow password suite supported
  112. X
  113. Xdata loss on stdin overflow fixed
  114. X
  115. X"refresh off" keyword added.
  116. X
  117. X3.1.1
  118. X------
  119. X
  120. XiScreen is now under the GNU copyleft license. See file COPYING.
  121. X
  122. Xcommand line option -A. $LINES, $COLUMNS improved.
  123. X
  124. XC-A : vbellwait <sec>
  125. X
  126. XXENIX support (Ronald Khoo)
  127. X
  128. XSYSV has uname() instead of gethostname().
  129. X
  130. Xhpux has setresuid.
  131. X
  132. XClearScreen now saves image to scrollback buffer.
  133. X
  134. Xmips has setenv.
  135. X
  136. Xnumerous bugfixes.
  137. X
  138. X3.1 finally released version.
  139. X=============================
  140. X
  141. X3.0.99: last minute changes:
  142. X----------------------------
  143. X
  144. XMIPS support (J{rvinen Markku)
  145. X
  146. XSVR4 support (Marc Boucher)
  147. X
  148. Xsecopen() secfopen() calls replace stat/access/open.
  149. XC-a : echo improved.
  150. X'register int'
  151. X
  152. XChanges up to Screen 3.0 Patchlevel 7
  153. X=====================================
  154. X
  155. XBetter terminfo support: Screen now checks if a termcap/info
  156. Xentry which the name "screen.$TERM" does exist. Look in the
  157. X"VIRTUAL TERMINAL" section of the manual for more details.
  158. X
  159. XMany security improvements.
  160. X
  161. XScrollRegion() bug fixed which caused slow scrolling if AL
  162. Xor DL was used.
  163. X
  164. XPyramid and Ultrix support added. (Tim and Larry)
  165. X  
  166. XENVIRONMENT support.
  167. X  /local/etc/screenrc checks for $SYSSCREENRC
  168. X  $HOME/.screenrc checks for $ISCREENRC and $SCREENRC
  169. X  /local/screens checks for $ISCREENDIR and $SCREENDIR
  170. X  .screenrc understands ${VAR} and $VAR .
  171. X
  172. Xscreen 3.0 Patchlevel 6
  173. X=======================
  174. X
  175. X.screenrc:
  176. X  screen now only opens the windows you explicitly ask for. if you 
  177. X  specify none, you still get one window, of course.
  178. X
  179. Xscreen 3.0. Patchlevel 5
  180. X========================
  181. X
  182. XAnsi prototyping by Christos.
  183. X
  184. Xcopy mode: CTRL-U / CTRL-D exchanged. code cleanup.
  185. X
  186. Xchanges to screen 3.0 patchlevel 4
  187. X==================================
  188. X
  189. Xmarkkeys "string"
  190. X  allows to rebind the keys used in copy/history mode.
  191. X  string is made up of pairs "<oldchar>=<newchar>" which are separated
  192. X  by a colon. Oldchar and newchar are either single ascii characters, 
  193. X  or the two character sequence ^x, where x is an ascii character, or
  194. X  a 3 digit octal value prepended with '\'. the string "\040=.:^M=q"
  195. X  rebinds '.' to set marks, and the return rey will abort copy mode.
  196. X
  197. Xset scrollback 100
  198. X  resizes the scrollback history buffer to 100 lines. a default of 50
  199. X  is installed. 
  200. X
  201. XA Howard Chu like scrollback history is installed. Many vi-like keys
  202. X  are added to the copy mode. The '?' key reports on cursor position.
  203. X
  204. Xscreen 3.0 Patchlevel 3
  205. X=======================
  206. X
  207. XWriteString fixed, it did kill the display variable.
  208. X
  209. XYet another LP bugfix.
  210. X
  211. Xnon vt100 semi-graphics character support.
  212. X
  213. Xwaynes patch fixed
  214. X
  215. Xscreen 3.0 Patchlevel 2
  216. X=======================
  217. X
  218. Xwayne patches cursor motion outside scrollregions.
  219. X
  220. X.screenrc 
  221. X  monitor on|off
  222. X
  223. Xchanges in Screen 3.0 Patchlevel 1
  224. X==================================
  225. X
  226. Xscreen -wipe
  227. X
  228. X^A : set vbell_msg "Wuff Wuff"
  229. X
  230. XThousand enhancements: help resizible, copy'n'paste in main
  231. X  socket loop, and no more '\0' hackin'. :WS=\E8;%d;%dt:
  232. X
  233. Xscreen can now resize windows under sunview.
  234. X
  235. X^A : set crlf on|off
  236. X  effects markroutine join.
  237. X
  238. Xscreen learned about sized windows under X
  239. X
  240. Xscreen -ls (-d) -q
  241. X  quiet option. We count the number of detached (attached) sessions and set
  242. X  a return value of 10+n. The -q option inhibits all startup
  243. X  warnings/messages. i.e. screen -R -q may return with code 12 or higher
  244. X  or start a new/old session.
  245. X
  246. Xpow_detach_msg "text string"
  247. X  new command, allows messages, terminal reset, etc. on logout caused
  248. X  by pow_detach.
  249. X
  250. X^A : learned a new keyword "set":
  251. X  commands like "login on" , "vbell off", ... affect the default for
  252. X  windows to be created. But commands like "set login off" affect
  253. X  the actual setting of this window. and not the default.
  254. X  such commands may be bound to keys. example: 
  255. X  bind 'O' set login off
  256. X  is valid in your .screenrc as well as typed at the ':' prompt.
  257. X  a bonus is ":set all" which is synonym to ":help".
  258. X  At the Colon prompt also KeyNames can be entered, alothough that makes
  259. X  not always sense.
  260. X
  261. X^A x uses a builtin lockprg, if 
  262. X  a) we don't find our lockprg, or
  263. X  b) user supplies us with the environmet variable LOCKPRG set to "builtin"
  264. X  the builtin locks until your login password is typed. on systems using
  265. X  "shadow password files" you are prompted for a password.
  266. X
  267. Xmarkroutine can append joined.
  268. X
  269. Xscreen removes the "controlling tty" from utmp while ptys are attached.
  270. X
  271. Xmarkroutine performs CR+NL when '\n' is pressed
  272. X
  273. Xscreen may die quietly, when no TERMCAP entry for "screen" is
  274. Xfound, and screen is run under X-windows
  275. X
  276. X_SEQUENT_ marks sequent386_ptx
  277. X
  278. Xscreen runs now under SunOS4.1.1 (we need setsid()!).
  279. X
  280. Xbug in SetForeWindow fixed.
  281. X
  282. Xrare markroutine bug fixed.
  283. X
  284. Xwe dont open every file the attacher tells us.
  285. X
  286. Xwe have now our wonderful "Wuff, Wuff" visual_bell
  287. X
  288. Xwe have now the interprocess-communication-buffer. secure version.
  289. X
  290. X'^A =' removes the interprocess-communication-buffer.
  291. X
  292. Xmarkroutine as in 2.1
  293. X
  294. Xmarkroutine: 'a' toggles append mode,
  295. X             '>' like ' ', but immediately WriteFile(DUMP_EXCHANGE) then.
  296. X             'A' like ' ', but first switch to append mode.
  297. X
  298. X.screenrc understands "screen 2:faui09 rlogin faui09 -l jnweiger"
  299. X                  and "password none"
  300. X                  and "vbell [on|off]"
  301. X
  302. X'^A :' allows .screenrc commands "online".
  303. X
  304. Xscreen now receives new $TERM from attacher, when it is reattached 
  305. X
  306. XMakeClientSocket() fifo version does now test for access.
  307. X
  308. X.screenrc learns "hardstatus {on|off}"
  309. X
  310. Xtermcap's VB is used for vbell if available.
  311. X
  312. XAttach() code rewritten:
  313. X    screen now lists socket directory, if it does not find a suitable socket
  314. X    screen -d [host.tty] detaches a running screen. 
  315. X
  316. Xscreen -[ls|list]
  317. X    list all sockets that we find in our sockdir
  318. X
  319. Xwhen the socket has been removed, send a SIGCHLD to the poor SCREEN 
  320. Xprocess and it will try to recover. then try a 'screen -r' again.
  321. Xall the socket stuff lives now in an extra file.
  322. X
  323. XMajor changes in version 2.4:
  324. X=============================
  325. X
  326. X*  Test version that presents the erlangen extensions from 2.0 in a 2.3
  327. X   screen.
  328. X
  329. X*  window resize support
  330. X
  331. X*  screen locking C-a x
  332. X
  333. X*  support for SYSV
  334. X
  335. X*  password protection
  336. X
  337. X*  copy & paste across screens
  338. X
  339. X*  remote detach and power detach
  340. X
  341. XMajor changes in version 2.3:
  342. X
  343. X*  Terminal emulation has been significantly enhanced and bugfixed.
  344. X
  345. X*  We now fully update the last character on the screen for true auto-
  346. X   margin terminals, though there may be some delay before the character
  347. X   can be safely added to the screen.  If your terminal has character
  348. X   insert it will be used to shorten the delay.
  349. X
  350. X*  Added the "termcap" .screenrc command to tweak your terminal's termcap
  351. X   entry AND to customize the termcap generated for the virtual terminals.
  352. X   See also the -L and -O command-line options, and the SCREENCAP environ-
  353. X   ment variable.
  354. X
  355. X*  Fixed screen's character handling when detached or suspended to NOT block
  356. X   the child processes in their windows -- output continues to be processed
  357. X   in the background.
  358. X
  359. X*  Added a.k.a.s (window-name aliases) that allow you to customize the
  360. X   window-information line, including being able to change the name on-
  361. X   the-fly to reflect what's currently running in the window (see the
  362. X   -k option, shellaka command, and ALSO KNOWN AS discussion in the doc).
  363. X
  364. X*  Added the ability to log the output of a window to a file (see the
  365. X   "C-a H" (log) command).
  366. X
  367. X*  Flow-control can now be set for each window and switched interactively
  368. X   (see the "flow" command, -f option, and FLOW CONTROL discussion).
  369. X
  370. X*  Individual windows can be included or excluded from mention in the
  371. X   /etc/utmp file (see the "login" command and -l option).
  372. X
  373. X*  Added an activity monitor, which allows you to have a window watched for
  374. X   the start of any output and alert you when it occurs (see the "C-a M"
  375. X   (monitor) command).
  376. X
  377. X*  Enhanced the information in the window-information line to keep track of
  378. X   windows that have: logging turned on '(L)'; beeped in the background '!';
  379. X   became active while being monitored '@' (see the "C-a w" (windows) command).
  380. X
  381. X*  Added an on-line help display that lists all the commands and their
  382. X   key bindings (see the "C-a ?" (help) command).
  383. X
  384. X*  Extended handling of the beep message (and also the new activity message)
  385. X   to allow '~' to specify a literal beep (see the "beep" and "activity"
  386. X   .screenrc commands).
  387. X
  388. X*  You can now set the default action on receipt of a hangup signal:  detach
  389. X   or terminate (see the "autodetach" .screenrc command).
  390. X
  391. X*  Routing of characters to their virtual terminals has been enhanced to
  392. X   not drop characters nor (in rare circumstances) hang up screen.
  393. X
  394. X*  The NFS compatibility has been enhanced.
  395. X
  396. XMajor changes in version 2.0a:
  397. X
  398. X*  Screen allows you to `detach' the "screen" session from the physical
  399. X   terminal and resume it at a later point in time (possibly on a
  400. X   different terminal or in a different login session).
  401. X
  402. X  To get an impression of this functionality do the following:
  403. X
  404. X     - call "screen" and create a couple of windows
  405. X     - type Control-A Control-D (screen terminates; you are back
  406. X       in the shell)
  407. X     - call "screen -r" to resume the detached screen
  408. X
  409. X*  Screen supports multiple character sets and the ISO 2022 control
  410. X   functions to designate and switch between character sets.
  411. X   This allows you, for instance, to make use of the VT100 graphics
  412. X   character set or national character sets.
  413. END_OF_FILE
  414. if test 11159 -ne `wc -c <'ChangeLog'`; then
  415.     echo shar: \"'ChangeLog'\" unpacked with wrong size!
  416. fi
  417. # end of 'ChangeLog'
  418. fi
  419. if test -f 'Makefile.in' -a "${1}" != "-c" ; then 
  420.   echo shar: Will not clobber existing file \"'Makefile.in'\"
  421. else
  422. echo shar: Extracting \"'Makefile.in'\" \(10044 characters\)
  423. sed "s/^X//" >'Makefile.in' <<'END_OF_FILE'
  424. X#
  425. X# Makefile template for screen 
  426. X#
  427. X# See machine dependant config.h for more configuration options.
  428. X#
  429. X
  430. Xsrcdir = @srcdir@
  431. XVPATH = @srcdir@
  432. X
  433. X# Where to install screen.
  434. X
  435. Xprefix = /usr/local
  436. Xexec_prefix = $(prefix)
  437. X
  438. Xbindir  = $(exec_prefix)/bin
  439. Xmandir  = $(prefix)/man
  440. X
  441. XVERSION = @VERSION@
  442. X
  443. XETCSCREENRC = `sed < config.h -n -e '/^.define ETCSCREENRC/s/^.*"\([^"]*\)"/\1/p'`
  444. X
  445. XCC = @CC@
  446. XCFLAGS = -O
  447. XLDFLAGS =
  448. XLIBS = @LIBS@
  449. X
  450. XCPP_DEPEND=/lib/cpp -MM
  451. X
  452. XINSTALL = @INSTALL@
  453. XINSTALL_PROGRAM = @INSTALL_PROGRAM@
  454. XINSTALL_DATA = @INSTALL_DATA@
  455. X
  456. XAWK = @AWK@
  457. X
  458. X### Chose some debug configuration options:
  459. X# -DDEBUG
  460. X#    Turn on really heavy debug output. This is written to 
  461. X#    /tmp/debug/screen.{front,back} Look at these files and quote 
  462. X#    questionable sections when sending bug-reports to the author.
  463. X# -DTMPTEST
  464. X#    Change the socket directory to a location that does not interfere
  465. X#    with the (suid-root) installed screen version. Use that in
  466. X#    combination with -DDEBUG
  467. X# -DDUMPSHADOW
  468. X#    With shadow-pw screen would never dump core. Use this option if you
  469. X#    still want to have a core. Use only for debugging.
  470. X# -DFORKDEBUG
  471. X#    Swap roles of father and son when forking the SCREEN process. 
  472. X#    Useful only for debugging.
  473. XOPTIONS=
  474. X#OPTIONS= -DDEBUG -DTMPTEST
  475. X
  476. X
  477. X######
  478. X######
  479. X###### The following lines should be obsolete because of the 'configure' script.
  480. X######
  481. X######
  482. X
  483. X
  484. X### If you choose to compile with the tried and true:
  485. X#CC= cc
  486. X#CFLAGS= -O
  487. X#CFLAGS= -g 
  488. X### gcc specific CFLAGS:
  489. X#CC= gcc
  490. X# If your system include files are bad, don't use -Wall
  491. X#CFLAGS= -O6 -g #-Wall 
  492. X#CFLAGS = -g -fstrength-reduce -fcombine-regs -finline-functions #-Wall
  493. X
  494. X### On some machines special CFLAGS are required:
  495. X#M_CFLAGS=
  496. X#M_CFLAGS= -Dapollo -A cpu,mathchip -A nansi    # Apollo DN3000/4000/4500
  497. X#M_CFLAGS= -DBSDI                # bsd386
  498. X#M_CFLAGS= -DISC -D_POSIX_SOURCE        # isc
  499. X#M_CFLAGS= -systype bsd43 -DMIPS        # mips
  500. X#M_CFLAGS= -fforce-mem -fforce-addr\
  501. X# -fomit-frame-pointer -finline-functions -bsd     # NeXT
  502. X#M_CFLAGS= -qlanglvl=ansi            # RS6000/AIX
  503. X#M_CFLAGS= -qlanglvl=ansi -D_AIX32        # RS6000/AIX 3.2
  504. X#M_CFLAGS= -ansi                # sgi/IRIX 3.x ansi 
  505. X#M_CFLAGS= -xansi                # sgi/IRIX 4.x ext ansi 
  506. X#M_CFLAGS= -YBSD                # Ultrix 4.x
  507. X#M_CFLAGS= -DSVR4=1    # Bob Kline rvk@blink.att.com 80386 Unix SVR4.0
  508. X#M_CFLAGS= -D_CX_UX    # Ken Beal kbeal@amber.ssd.csd.harris.com Harris CX/UX
  509. X
  510. X### Choose one of the LIBS setting below:
  511. X#LIBS= -ltermcap -lc -lsocket -linet -lsec -lseq    # Sequent/ptx
  512. X#LIBS= -ltermcap             # SunOS, Linux, Apollo,
  513. X#                      gould_np1, NeXT, Ultrix
  514. X#LIBS= -ltermcap -lelf            # SVR4
  515. X#LIBS= -ltermlib -linet -lcposix    # isc
  516. X#LIBS= -ltermcap -lmld            # mips (nlist is in mld)
  517. X#LIBS= -ltermlib -lsun -lmld #-lc_s    # sgi/IRIX
  518. X#LIBS= -lcurses                # RS6000/AIX
  519. X#LIBS= -lcrypt_d -ltinfo        # sco32
  520. X#LIBS= -lcrypt_i -ltinfo        # sco32
  521. X#LIBS= -lcrypt -lsec            # sco322 (msilano@sra.com)
  522. X#LIBS= -ltermcap -lcrypt.o -ldir -lx    # SCO XENIX 2.3.4
  523. X#LIBS= -ltermcap -lcrypt -ldir -l2.3 -lx    # SCO UNIX XENIX cross dev.
  524. X#LIBS= -ltermcap -lelf -lcrypt -lsocket -lnet -lnsl    # Bob Kline SVR4
  525. X
  526. X######
  527. X######
  528. X###### end of obsolete lines
  529. X######
  530. X######
  531. X
  532. X
  533. XSHELL=/bin/sh
  534. X
  535. XCFILES=    screen.c ansi.c fileio.c mark.c misc.c resize.c socket.c \
  536. X    search.c tty.c term.c window.c utmp.c loadav.c putenv.c help.c \
  537. X    termcap.c input.c attacher.c pty.c process.c display.c comm.c acl.c
  538. XOFILES=    screen.o ansi.o fileio.o mark.o misc.o resize.o socket.o \
  539. X    search.o tty.o term.o window.o utmp.o loadav.o putenv.o help.o \
  540. X    termcap.o input.o attacher.o pty.o process.o display.o comm.o acl.o
  541. X
  542. Xall:    screen 
  543. X
  544. Xscreen: $(OFILES)
  545. X    $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
  546. X
  547. X.c.o:
  548. X    $(CC) -c $(CFLAGS) $(M_CFLAGS) $(DEFS) $(OPTIONS) $<
  549. X
  550. Xinstall_bin: screen
  551. X    $(INSTALL_PROGRAM) screen $(bindir)/screen-$(VERSION)
  552. X    -chown root $(bindir)/screen-$(VERSION)
  553. X    -chmod 4755 $(bindir)/screen-$(VERSION)
  554. X    -if [ -f $(bindir)/screen ] && [ ! -f $(bindir)/screen.old ]; then mv $(bindir)/screen $(bindir)/screen.old; fi
  555. X    rm -f $(bindir)/screen
  556. X    ln -s $(bindir)/screen-$(VERSION) $(bindir)/screen
  557. X
  558. Xinstall: install_bin
  559. X    -$(INSTALL_DATA) etcscreenrc $(ETCSCREENRC)
  560. X    -$(INSTALL_DATA) doc/screen.1 $(mandir)/man1/screen.1
  561. X    -tic terminfo/screeninfo.src
  562. X# Better do this by hand. E.g. under RCS...
  563. X#    cat terminfo/screencap >> /etc/termcap
  564. X
  565. Xuninstall:
  566. X    rm -f $(bindir)/screen-$(VERSION)
  567. X    rm -f $(bindir)/screen
  568. X    mv $(bindir)/screen.old $(bindir)/screen
  569. X    rm -f $(ETCSCREENRC)
  570. X    rm -f $(mandir)/man1/screen.1
  571. X
  572. Xshadow:
  573. X    mkdir shadow;
  574. X    cd shadow; ln -s ../*.[ch] ../*.in ../*.sh ../configure ../doc ../terminfo .
  575. X    rm -f shadow/term.h shadow/tty.c shadow/comm.h
  576. X
  577. Xterm.h: term.c term.sh
  578. X    AWK=$(AWK) ; . ./term.sh
  579. X
  580. Xtty.c:    tty.sh 
  581. X    sh tty.sh tty.c
  582. X
  583. Xcomm.h: comm.c comm.sh config.h
  584. X    AWK=$(AWK) ; CC="$(CC)" ; . ./comm.sh
  585. X
  586. Xdocs:
  587. X    cd doc; $(MAKE)
  588. X
  589. Xdvi:
  590. X    cd doc; $(MAKE) dvi
  591. X
  592. Xinfo:    
  593. X    cd doc; $(MAKE) info
  594. X
  595. Xclean celan:
  596. X    rm -f $(OFILES) tty.c term.h comm.h screen
  597. X
  598. X# Delete all files from the current directory that are created by 
  599. X# configuring or building the program.
  600. X# building of term.h/comm.h requires awk. Keep it in the distribution
  601. X# we keep config.h, as this file knows where 'make dist' finds the ETCSCREENRC.
  602. Xdistclean:    mostlyclean
  603. X    rm -f screen-$(VERSION).tar screen-$(VERSION).TZ
  604. X    rm -f config.status Makefile
  605. X
  606. X# Delete everything from the current directory that can be
  607. X# reconstructed with this Makefile.
  608. Xrealclean:    distclean
  609. X    rm -f config.h
  610. X
  611. Xmostlyclean:
  612. X    rm -f $(OFILES) screen
  613. X
  614. XTAGS: $(CFILES)
  615. X    ctags $(CFILES) *.h
  616. X    ctags -e $(CFILES) *.h
  617. X
  618. Xdist: screen-$(VERSION).tar.z
  619. X
  620. Xscreen-$(VERSION).tar: term.h comm.h tty.c
  621. X    -rm -rf dist
  622. X    mkdir dist
  623. X    mkdir dist/screen-$(VERSION)
  624. X    ln acl.h ansi.h display.h extern.h mark.h os.h overlay.h \
  625. X       patchlevel.h rcs.h screen.h window.h \
  626. X       term.sh tty.sh comm.sh newsyntax \
  627. X       acl.c ansi.c attacher.c comm.c display.c window.c fileio.c help.c \
  628. X       input.c loadav.c mark.c misc.c process.c pty.c putenv.c \
  629. X       screen.c search.c socket.c term.c termcap.c utmp.c resize.c \
  630. X       ChangeLog COPYING INSTALLATION WHAT-IS-NEW \
  631. X       dist/screen-$(VERSION)
  632. X    ln configure.in configure dist/screen-$(VERSION)
  633. X    sed -e 's/"\/local/"\/usr\/local/g' < config.h.in > dist/screen-$(VERSION)/config.h.in
  634. X    sed -e 's/[     ]\/local/ \/usr\/local/g' -e 's/^CFLAGS = -g/CFLAGS = -O/' < Makefile.in > dist/screen-$(VERSION)/Makefile.in
  635. X    ln term.h dist/screen-$(VERSION)/term.h.dist
  636. X    ln comm.h dist/screen-$(VERSION)/comm.h.dist
  637. X    ln tty.c dist/screen-$(VERSION)/tty.c.dist
  638. X    mkdir dist/screen-$(VERSION)/terminfo
  639. X    cd terminfo; ln 8bits README checktc.c screen-sco.mail screencap \
  640. X      screeninfo.src test.txt tetris.c \
  641. X      ../dist/screen-$(VERSION)/terminfo
  642. X    sed -e 's/^startup/#startup/' -e 's/^autodetach/#autodetach/' < $(ETCSCREENRC) > dist/screen-$(VERSION)/etcscreenrc 
  643. X    cp $(HOME)/.iscreenrc dist/screen-$(VERSION)/.iscreenrc
  644. X    mkdir dist/screen-$(VERSION)/doc
  645. X    ln doc/fdpat.ips dist/screen-$(VERSION)/doc/fdpat.ps
  646. X    cd doc; ln Makefile readme.quick screen.1 screen.texinfo \
  647. X      ../dist/screen-$(VERSION)/doc
  648. X    cd dist; tar chf ../screen-$(VERSION).tar screen-$(VERSION)
  649. X    rm -rf dist
  650. X
  651. Xscreen-$(VERSION).tar.z: screen-$(VERSION).tar
  652. X    gzip -f screen-$(VERSION).tar
  653. X
  654. X# Perform self-tests (if any).
  655. Xcheck:
  656. X
  657. Xlint:
  658. X    lint -I. $(CFILES)
  659. X
  660. Xsaber:
  661. X    #load $(CFLAGS) screen.c ansi.c $(LIBS)
  662. X
  663. Xmdepend: $(CFILES) term.h
  664. X    @rm -f DEPEND ; \
  665. X    for i in ${CFILES} ; do \
  666. X      echo "$$i" ; \
  667. X      echo `echo "$$i" | sed -e 's/.c$$/.o/'`": $$i" `\
  668. X            cc -E $$i |\
  669. X            grep '^# .*"\./.*\.h"' |\
  670. X            sort -t'"' -u +1 -2 |\
  671. X            sed -e 's/.*"\.\/\(.*\)".*/\1/'\
  672. X          ` >> DEPEND ; \
  673. X    done
  674. X
  675. X
  676. Xdepend: $(CFILES) term.h
  677. X    cp Makefile Makefile~
  678. X    sed -e '/\#\#\# Dependencies/q' < Makefile > tmp_make
  679. X    for i in $(CFILES); do echo $$i; $(CPP_DEPEND) $$i >> tmp_make; done 
  680. X    mv tmp_make Makefile
  681. X
  682. X
  683. X### Dependencies:
  684. Xscreen.o: screen.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  685. X  display.h window.h patchlevel.h extern.h 
  686. Xansi.o: ansi.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  687. X  display.h window.h extern.h 
  688. Xfileio.o: fileio.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  689. X  display.h window.h extern.h 
  690. Xmark.o: mark.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  691. X  display.h window.h mark.h extern.h 
  692. Xmisc.o: misc.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  693. X  display.h window.h extern.h 
  694. Xresize.o: resize.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  695. X  display.h window.h extern.h 
  696. Xsocket.o: socket.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  697. X  display.h window.h extern.h 
  698. Xsearch.o: search.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  699. X  display.h window.h mark.h extern.h 
  700. Xtty.o: tty.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  701. X  display.h window.h extern.h 
  702. Xterm.o: term.c rcs.h term.h 
  703. Xwindow.o: window.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  704. X  display.h window.h extern.h 
  705. Xutmp.o: utmp.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  706. X  display.h window.h extern.h 
  707. Xloadav.o: loadav.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  708. X  display.h window.h extern.h 
  709. Xputenv.o: putenv.c rcs.h config.h 
  710. Xhelp.o: help.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  711. X  display.h window.h extern.h 
  712. Xtermcap.o: termcap.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
  713. X  term.h display.h window.h extern.h 
  714. Xinput.o: input.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  715. X  display.h window.h extern.h 
  716. Xattacher.o: attacher.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
  717. X  term.h display.h window.h extern.h 
  718. Xpty.o: pty.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  719. X  display.h window.h extern.h 
  720. Xprocess.o: process.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
  721. X  term.h display.h window.h extern.h 
  722. Xdisplay.o: display.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h \
  723. X  term.h display.h window.h extern.h 
  724. Xcomm.o: comm.c rcs.h config.h comm.h 
  725. Xacl.o: acl.c rcs.h config.h screen.h os.h ansi.h comm.h overlay.h term.h \
  726. X  display.h window.h extern.h acl.h 
  727. END_OF_FILE
  728. if test 10044 -ne `wc -c <'Makefile.in'`; then
  729.     echo shar: \"'Makefile.in'\" unpacked with wrong size!
  730. fi
  731. # end of 'Makefile.in'
  732. fi
  733. if test -f 'acl.c' -a "${1}" != "-c" ; then 
  734.   echo shar: Will not clobber existing file \"'acl.c'\"
  735. else
  736. echo shar: Extracting \"'acl.c'\" \(11329 characters\)
  737. sed "s/^X//" >'acl.c' <<'END_OF_FILE'
  738. X/* Copyright (c) 1993
  739. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  740. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  741. X * Copyright (c) 1987 Oliver Laumann
  742. X *
  743. X * This program is free software; you can redistribute it and/or modify
  744. X * it under the terms of the GNU General Public License as published by
  745. X * the Free Software Foundation; either version 2, or (at your option)
  746. X * any later version.
  747. X *
  748. X * This program is distributed in the hope that it will be useful,
  749. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  750. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  751. X * GNU General Public License for more details.
  752. X *
  753. X * You should have received a copy of the GNU General Public License
  754. X * along with this program (see the file COPYING); if not, write to the
  755. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  756. X *
  757. X ****************************************************************
  758. X */
  759. X#include "rcs.h"
  760. XRCS_ID("$Id: acl.c,v 1.5 1993/07/16 14:04:12 mlschroe Exp $ FAU")
  761. X
  762. X#include "config.h"
  763. X#include "screen.h"    /* includes acl.h */
  764. X#include "extern.h"
  765. X
  766. X
  767. X/************************************************************************
  768. X * user managing code, this does not really belong into the acl stuff   *
  769. X ************************************************************************/
  770. X
  771. Xextern struct comm comms[];
  772. Xextern struct win *windows, *wtab[];
  773. Xextern struct display *display, *displays;
  774. Xstatic struct user *userroot;
  775. X
  776. X#ifdef MULTIUSER
  777. X/* record given user ids here */
  778. Xstatic AclBits userbits;
  779. X
  780. X/* rights a new unknown user will have on windows and cmds */
  781. Xstatic char default_w_bit[ACL_BITS_PER_WIN] = 
  782. X{ 
  783. X  1,    /* EXEC */
  784. X  1,     /* WRITE */
  785. X  1     /* READ */
  786. X};
  787. X
  788. Xstatic char default_c_bit[ACL_BITS_PER_CMD] = 
  789. X{ 
  790. X  1    /* EXEC */
  791. X};
  792. X
  793. X/* rights of all users per newly created window */
  794. Xstatic AclBits default_w_userbits[ACL_BITS_PER_WIN];
  795. X
  796. X/*
  797. Xstatic AclBits default_c_userbits[ACL_BITS_PER_CMD];
  798. X*/
  799. X
  800. Xstatic int maxusercount = 0;
  801. X
  802. Xstatic int GrowBitfield __P((AclBits *, int, int, int));
  803. X
  804. X
  805. X
  806. Xstatic int
  807. XGrowBitfield(bfp, len, delta, defaultbit)
  808. XAclBits *bfp;
  809. Xint len, delta, defaultbit;
  810. X{
  811. X  AclBits n, o = *bfp;
  812. X  int i;
  813. X
  814. X  if (!(n = (AclBits)calloc(1, (unsigned long)(&ACLBYTE((char *)0, len + delta + 1)))))
  815. X    return -1;
  816. X  for (i = 0; i < (len + delta); i++)
  817. X    {
  818. X      if (((i <  len) && (ACLBIT(i) & ACLBYTE(o, i))) ||
  819. X          ((i >= len) && (defaultbit)))
  820. X    ACLBYTE(n, i) |= ACLBIT(i);
  821. X    }
  822. X  if (len)
  823. X    free(o);
  824. X  *bfp = n;
  825. X  return 0;
  826. X}
  827. X
  828. X#endif /* MULTIUSER */
  829. X
  830. X/* 
  831. X * Returns an nonzero Address. Its contents is either a User-ptr, 
  832. X * or NULL which may be replaced by a User-ptr to create the entry.
  833. X */
  834. Xstruct user **
  835. XFindUserPtr(name)
  836. Xchar *name;
  837. X{
  838. X  struct user **u;
  839. X
  840. X  for (u = &userroot; *u; u = &(*u)->u_next)
  841. X    if (!strcmp((*u)->u_name, name))
  842. X      break;
  843. X#ifdef MULTIUSER
  844. X  debug3("FindUserPtr %s %sfound, id %d\n", name, (*u)?"":"not ", 
  845. X         (*u)?(*u)->id:-1);
  846. X#else
  847. X  debug2("FindUserPtr %s %sfound\n", name, (*u)?"":"not ");
  848. X#endif
  849. X  return u;
  850. X}
  851. X
  852. X/*
  853. X * Add a new user. His password may be NULL or "" if none. 
  854. X * He is in no groups and thus has no rights.
  855. X */
  856. Xint
  857. XUserAdd(name, pass, up)
  858. Xchar *name, *pass;
  859. Xstruct user **up;
  860. X{
  861. X  if (!up)
  862. X    up = FindUserPtr(name);
  863. X  if (*up)
  864. X    return 1;        /* he is already there */
  865. X  *up = (struct user *)calloc(1, sizeof(struct user));
  866. X  if (!*up)
  867. X    return -1;        /* he still does not exist */
  868. X  strncpy((*up)->u_name, name, 20);
  869. X  if (pass)
  870. X    strncpy((*up)->u_password, pass, 20);
  871. X
  872. X#ifdef MULTIUSER
  873. X  /* now find an unused index */
  874. X  for ((*up)->id = 0; (*up)->id < maxusercount; (*up)->id++)
  875. X    if (!(ACLBIT((*up)->id) & ACLBYTE(userbits, (*up)->id)))
  876. X      break;
  877. X  debug2("UserAdd %s id %d\n", name, (*up)->id);
  878. X  if ((*up)->id == maxusercount)
  879. X    {
  880. X      int i, j;
  881. X      struct win *w;
  882. X
  883. X      debug2("growing all bitfields %d += %d\n", maxusercount, USER_CHUNK);
  884. X      /* the bitfields are full, grow a chunk */
  885. X      /* first, the used_uid_indicator: */
  886. X      if (GrowBitfield(&userbits, maxusercount, USER_CHUNK, 0))
  887. X        {
  888. X      free(*up); *up = NULL; return -1;
  889. X    }
  890. X      /* second, default command bits  */
  891. X      /* (only if we generate commands dynamically) */
  892. X/*
  893. X      for (j = 0; j < ACL_BITS_PER_CMD; j++)
  894. X    if (GrowBitfield(&default_c_userbits[j], maxusercount, USER_CHUNK, 
  895. X        default_c_bit[j]))
  896. X      {
  897. X        free(*up); *up = NULL; return -1;
  898. X      }
  899. X*/
  900. X      /* third, the bits for each commands */
  901. X      for (i = 0; i <= RC_LAST; i++)
  902. X        for (j = 0; j < ACL_BITS_PER_CMD; j++)
  903. X      if (GrowBitfield(&comms[i].userbits[j], maxusercount, USER_CHUNK,
  904. X          default_c_bit[j]))
  905. X        {
  906. X          free(*up); *up = NULL; return -1;
  907. X        }
  908. X      /* fourth, default window and bits */
  909. X      for (j = 0; j < ACL_BITS_PER_WIN; j++)
  910. X    if (GrowBitfield(&default_w_userbits[j], maxusercount, USER_CHUNK,
  911. X        default_w_bit[j]))
  912. X      {
  913. X        free(*up); *up = NULL; return -1;
  914. X      }
  915. X      /* fifth, the bits for each window */
  916. X      for (w = windows; w; w = w->w_next)
  917. X        for (j = 0; j < ACL_BITS_PER_WIN; j++)
  918. X      if (GrowBitfield(&w->w_userbits[j], maxusercount, USER_CHUNK,
  919. X          default_w_bit[j]))
  920. X        {
  921. X          free(*up); *up = NULL; return -1;
  922. X        }
  923. X      maxusercount += USER_CHUNK;
  924. X    }
  925. X  ACLBYTE(userbits, (*up)->id) |= ACLBIT((*up)->id);    
  926. X#else /* MULTIUSER */
  927. X  debug1("UserAdd %s\n", name);
  928. X#endif /* MULTIUSER */
  929. X  return 0;
  930. X}
  931. X
  932. X/* change user's password */
  933. Xint 
  934. XUserSetPass(name, pass, up)
  935. Xchar *name, *pass;
  936. Xstruct user **up;
  937. X{
  938. X  if (!up)
  939. X    up = FindUserPtr(name);
  940. X  if (!*up)
  941. X    return UserAdd(name, pass, up);
  942. X  strncpy((*up)->u_password, pass ? pass : "", 20);
  943. X  (*up)->u_password[20] = '\0';
  944. X  return 0;
  945. X}
  946. X
  947. X/* 
  948. X * Remove a user from the list. 
  949. X * Decrease reference count of all his groups
  950. X * Free his grouplist.
  951. X */
  952. Xint 
  953. XUserDel(name, up)
  954. Xchar *name;
  955. Xstruct user **up;
  956. X{
  957. X  struct user *u;
  958. X  struct display *old, *next;
  959. X
  960. X  if (!up)
  961. X    up = FindUserPtr(name);
  962. X  if (!(u = *up))
  963. X    return -1;            /* he who does not exist cannot be removed */
  964. X  old = display;
  965. X  for (display = displays; display; display = next)
  966. X    {
  967. X      next = display->_d_next;
  968. X      if (d_user != u)
  969. X    continue;
  970. X      if (display == old)
  971. X    old = 0;
  972. X      Detach(D_REMOTE);
  973. X    }
  974. X  display = old;
  975. X  *up = u->u_next;
  976. X#ifdef MULTIUSER
  977. X  ACLBYTE(userbits, u->id) &= ~ACLBIT(u->id);
  978. X  AclSetPerm(u, "-rwx", "#?");
  979. X#endif
  980. X  debug1("FREEING user structure for %s\n", u->u_name);
  981. X  free(u);
  982. X  return 0;
  983. X}
  984. X
  985. X/************************************************************************
  986. X *                     end of user managing code                        *
  987. X ************************************************************************/
  988. X
  989. X
  990. X#ifdef MULTIUSER
  991. X
  992. Xextern char *multi;    /* username */
  993. X
  994. X/* This gives the users default rights to the new window */
  995. Xint
  996. XNewWindowAcl(w)
  997. Xstruct win *w;
  998. X{
  999. X  int i, j;
  1000. X
  1001. X  debug1("NewWindowAcl default_w_userbits for window %d\n", w->w_number);
  1002. X  for (j = 0; j < ACL_BITS_PER_WIN; j++)
  1003. X    {
  1004. X      /* we start with len 0 for the new bitfield size and add maxusercount */
  1005. X      if (GrowBitfield(&w->w_userbits[j], 0, maxusercount, 0))
  1006. X    {
  1007. X      while (--j >= 0)
  1008. X        free(w->w_userbits[j]);
  1009. X      return -1;
  1010. X    }
  1011. X      for (i = 0; i < maxusercount; i++)
  1012. X        if (ACLBIT(i) & ACLBYTE(default_w_userbits[j], i))
  1013. X      ACLBYTE(w->w_userbits[j], i) |= ACLBIT(i);
  1014. X    }
  1015. X  return 0;
  1016. X}
  1017. X
  1018. X/* if mode starts with '-' we remove the users exec bit for cmd */
  1019. Xint
  1020. XAclSetPermCmd(u, mode, cmd)
  1021. Xstruct user *u;
  1022. Xchar *mode;
  1023. Xstruct comm *cmd;
  1024. X{
  1025. X  int neg = 0;
  1026. X
  1027. X  if (!multi)
  1028. X    return 0;
  1029. X  debug3("AclSetPermCmd %s %s %s\n", u->u_name, mode, cmd->name);
  1030. X  while (*mode)
  1031. X    {
  1032. X      switch (*mode++)
  1033. X        {
  1034. X    case '-': 
  1035. X      neg = 1;
  1036. X      continue;
  1037. X        case '+':
  1038. X      neg = 0;
  1039. X      continue;
  1040. X        case 'e': 
  1041. X        case 'x': 
  1042. X      if (neg)
  1043. X        ACLBYTE(cmd->userbits[ACL_EXEC], u->id) &= ~ACLBIT(u->id);
  1044. X      else
  1045. X        ACLBYTE(cmd->userbits[ACL_EXEC], u->id) |= ACLBIT(u->id);
  1046. X      break;
  1047. X        case 'r':
  1048. X    case 'w':
  1049. X      break;
  1050. X        default:
  1051. X      return -1;
  1052. X    }
  1053. X    }
  1054. X  return 0;
  1055. X}
  1056. X
  1057. X/* mode strings of the form +rwx -w+rx r -wx are parsed and evaluated */
  1058. Xint
  1059. XAclSetPermWin(u, mode, win)
  1060. Xstruct user *u;
  1061. Xchar *mode;
  1062. Xstruct win *win;
  1063. X{
  1064. X  int neg = 0;
  1065. X  int bit;
  1066. X
  1067. X  if (!multi)
  1068. X    return 0;
  1069. X  debug3("AclSetPermWin %s %s %d\n", u->u_name, mode, win->w_number);
  1070. X  while (*mode)
  1071. X    {
  1072. X      switch (*mode++)
  1073. X        {
  1074. X    case '-': 
  1075. X      neg = 1;
  1076. X      continue;
  1077. X        case '+':
  1078. X      neg = 0;
  1079. X      continue;
  1080. X        case 'r': 
  1081. X      bit = ACL_READ;
  1082. X      break;
  1083. X    case 'w':
  1084. X      bit = ACL_WRITE;
  1085. X      break;
  1086. X        case 'x':
  1087. X      bit = ACL_EXEC;
  1088. X      break;
  1089. X    default:
  1090. X      return -1;
  1091. X        }
  1092. X      if (neg)
  1093. X    ACLBYTE(win->w_userbits[bit], u->id) &= ~ACLBIT(u->id);
  1094. X      else
  1095. X    ACLBYTE(win->w_userbits[bit], u->id) |= ACLBIT(u->id);
  1096. X    }
  1097. X  return 0;
  1098. X}
  1099. X
  1100. X/* string is broken down into comand and window names, mode applies */
  1101. Xint
  1102. XAclSetPerm(u, mode, s)
  1103. Xstruct user *u;
  1104. Xchar *mode, *s;
  1105. X{
  1106. X  struct win *w;
  1107. X  int i;
  1108. X  char *p;
  1109. X
  1110. X  while (*s)
  1111. X    {
  1112. X      switch (*s)
  1113. X    {
  1114. X    case '*':    /* all windows and all commands */
  1115. X      return AclSetPerm(u, mode, "#?");
  1116. X    case '#':    /* all windows */
  1117. X      for (w = windows; w; w = w->w_next)
  1118. X        AclSetPermWin(u, mode, w);
  1119. X      s++;
  1120. X      break;
  1121. X    case '?':    /* all windows and all commands */
  1122. X      for (i = 0; i <= RC_LAST; i++)
  1123. X        AclSetPermCmd(u, mode, &comms[i]);
  1124. X      s++;
  1125. X      break;
  1126. X    default:
  1127. X      for (p = s; *p && *p != ' ' && *p != '\t' && *p != ','; p++)
  1128. X        ;
  1129. X      if (*p)
  1130. X        *p++ = '\0';
  1131. X      else
  1132. X        *p = '\0';
  1133. X      if ((i = FindCommnr(s)) != RC_ILLEGAL)
  1134. X        AclSetPermCmd(u, mode, &comms[i]);
  1135. X      else if (((i = WindowByNoN(s)) >= 0) && wtab[i])
  1136. X        AclSetPermWin(u, mode, wtab[i]);
  1137. X      else
  1138. X        /* checking group name */
  1139. X        return -1;
  1140. X      s = p; 
  1141. X    }    
  1142. X    }
  1143. X  return 0;
  1144. X}
  1145. X
  1146. X#if 0
  1147. Xvoid
  1148. XAclWinSwap(a, b)
  1149. Xint a, b;
  1150. X{
  1151. X  int a_bit = 0, b_bit = 0;
  1152. X  AclGroupList **g;
  1153. X  AclBits p;
  1154. X
  1155. X  debug2("acl lists swapping windows %d and %d\n", a, b);
  1156. X  
  1157. X  for (g = &aclgrouproot; *g; g = &(*g)->next) 
  1158. X    {
  1159. X      p = (*g)->group->winbits;
  1160. X      /* see if there was a bit for window a. zap it */
  1161. X      if (a >= 0)
  1162. X    if ((a_bit = ACLBIT(a) & ACLBYTE(p, a)))
  1163. X      ACLBYTE(p, a) &= ~ACLBIT(a);
  1164. X      /* see if there was a bit for window b. zap it */
  1165. X      if (b >= 0)
  1166. X    if ((b_bit = ACLBIT(b) & ACLBYTE(p, b)))
  1167. X      ACLBYTE(p, b) &= ~ACLBIT(b);
  1168. X      /* b may cause a set */
  1169. X      if (b_bit && a >= 0)
  1170. X        ACLBYTE(p, a) |= ACLBIT(a);
  1171. X      /* a may cause b set */
  1172. X      if (a_bit && b >= 0)
  1173. X        ACLBYTE(p, b) |= ACLBIT(b);
  1174. X    }
  1175. X}
  1176. X#else
  1177. Xvoid
  1178. XAclWinSwap(a, b)
  1179. Xint a, b;
  1180. X{
  1181. X  debug2("AclWinSwap(%d, %d) DUMMY\n", a, b);
  1182. X}
  1183. X#endif
  1184. X
  1185. Xint 
  1186. XAclCheckPermWin(u, mode, w)
  1187. Xstruct user *u;
  1188. Xint mode;
  1189. Xstruct win *w;
  1190. X{
  1191. X  if (!multi)
  1192. X    return 0;
  1193. X  if (mode < 0 || mode >= ACL_BITS_PER_WIN)
  1194. X    return -1;
  1195. X  debug3("AclCheckPermWin(%s, %d, %d) = ", u->u_name, mode, w->w_number);
  1196. X  debug1("%d\n", !(ACLBYTE(w->w_userbits[mode], u->id) & ACLBIT(u->id)));
  1197. X  return         !(ACLBYTE(w->w_userbits[mode], u->id) & ACLBIT(u->id));
  1198. X}
  1199. X
  1200. Xint 
  1201. XAclCheckPermCmd(u, mode, c)
  1202. Xstruct user *u;
  1203. Xint mode;
  1204. Xstruct comm *c;
  1205. X{
  1206. X  if (!multi)
  1207. X    return 0;
  1208. X  if (mode < 0 || mode >= ACL_BITS_PER_CMD)
  1209. X    return -1;
  1210. X  debug3("AclCheckPermCmd(%s %d %s) = ", u->u_name, mode, c->name); 
  1211. X  debug1("%d\n", !(ACLBYTE(c->userbits[mode], u->id) & ACLBIT(u->id)));
  1212. X  return         !(ACLBYTE(c->userbits[mode], u->id) & ACLBIT(u->id));
  1213. X}
  1214. X
  1215. X#endif /* MULTIUSER */
  1216. END_OF_FILE
  1217. if test 11329 -ne `wc -c <'acl.c'`; then
  1218.     echo shar: \"'acl.c'\" unpacked with wrong size!
  1219. fi
  1220. # end of 'acl.c'
  1221. fi
  1222. if test -f 'config.h' -a "${1}" != "-c" ; then 
  1223.   echo shar: Will not clobber existing file \"'config.h'\"
  1224. else
  1225. echo shar: Extracting \"'config.h'\" \(10841 characters\)
  1226. sed "s/^X//" >'config.h' <<'END_OF_FILE'
  1227. X/* config.h.  Generated automatically by configure.  */
  1228. X/* Copyright (c) 1993
  1229. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  1230. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  1231. X * Copyright (c) 1987 Oliver Laumann
  1232. X *
  1233. X * This program is free software; you can redistribute it and/or modify
  1234. X * it under the terms of the GNU General Public License as published by
  1235. X * the Free Software Foundation; either version 2, or (at your option)
  1236. X * any later version.
  1237. X *
  1238. X * This program is distributed in the hope that it will be useful,
  1239. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1240. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1241. X * GNU General Public License for more details.
  1242. X *
  1243. X * You should have received a copy of the GNU General Public License
  1244. X * along with this program (see the file COPYING); if not, write to the
  1245. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1246. X *
  1247. X ****************************************************************
  1248. X * $Id: config.h.in,v 1.4 1993/06/28 16:00:32 mlschroe Exp $ FAU
  1249. X */
  1250. X
  1251. X
  1252. X
  1253. X
  1254. X
  1255. X/**********************************************************************
  1256. X *
  1257. X *    User Configuration Section
  1258. X */
  1259. X
  1260. X
  1261. X
  1262. X/*
  1263. X * Define HOMESOCKDIR if you want screen to put the named sockets in
  1264. X * the user's home directory. Notice that this can cause you problems
  1265. X * if some user's HOME directories are NFS-mounted and don't support
  1266. X * named sockets. In such a case do not define HOMESOCKDIR and screen
  1267. X * will create the socket directories in SOCKDIR. This should be in a
  1268. X * common subdirectory, such as /local or /tmp. It makes things a
  1269. X * little more secure if you choose a directory which is not writable
  1270. X * by everyone or where the "sticky" bit is on, but this isn't required.
  1271. X * Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison).
  1272. X * Do not define TMPTEST unless it's for debugging purpose.
  1273. X */
  1274. X#undef HOMESOCKDIR
  1275. X
  1276. X#ifndef HOMESOCKDIR
  1277. X# ifndef TMPTEST
  1278. X#  define SOCKDIR "/usr/local/screens"
  1279. X# else
  1280. X#  define SOCKDIR "/tmp/testscreens"
  1281. X# endif
  1282. X#endif
  1283. X
  1284. X/*
  1285. X * Screen sources two startup files. First a global file with a path
  1286. X * specified here, second your local $HOME/.screenrc
  1287. X * Don't define this, if you don't want it.
  1288. X */
  1289. X#define ETCSCREENRC "/usr/local/etc/screenrc"
  1290. X
  1291. X/* 
  1292. X * define PTYMODE if you do not like the default of 0622, which allows 
  1293. X * public write to your pty.
  1294. X * define PTYGROUP to some numerical group-id if you do not want the
  1295. X * tty to be in "your" group.
  1296. X * Note, screen is unable to change mode or group of the pty if it
  1297. X * is not installed with sufficient privilege. (e.g. set-uid-root)
  1298. X */
  1299. X#undef PTYMODE
  1300. X#undef PTYGROUP
  1301. X
  1302. X/*
  1303. X * If screen is NOT installed set-uid root, screen can provide tty
  1304. X * security by exclusively locking the ptys.  While this keeps other
  1305. X * users from opening your ptys, it also keeps your own subprocesses
  1306. X * from being able to open /dev/tty.  Define LOCKPTY to add this
  1307. X * exclusive locking.
  1308. X */
  1309. X#undef LOCKPTY
  1310. X
  1311. X/*
  1312. X * If you'd rather see the status line on the first line of your
  1313. X * terminal rather than the last, define TOPSTAT.
  1314. X */
  1315. X#undef TOPSTAT
  1316. X
  1317. X/*
  1318. X * here come the erlangen extensions to screen:
  1319. X * define LOCK if you want to use a lock program for a screenlock.
  1320. X * define PASSWORD for secure reattach of your screen.
  1321. X * define COPY_PASTE to use the famous hacker's treasure zoo.
  1322. X * define POW_DETACH to have a detach_and_logout key.
  1323. X * define REMOTE_DETACH (-d option) to move screen between terminals.
  1324. X * define AUTO_NUKE to enable Tim MacKenzies clear screen nuking
  1325. X * define PSEUDOS to allow window input/output filtering
  1326. X * define MULTI to allow multiple attaches.
  1327. X * define MULTIUSER to allow other users attach to your session
  1328. X *                  (if they are in the acl, of course)
  1329. X * (jw)
  1330. X */
  1331. X#undef SIMPLESCREEN
  1332. X#ifndef SIMPLESCREEN
  1333. X# define LOCK
  1334. X# define PASSWORD
  1335. X# define COPY_PASTE
  1336. X# define REMOTE_DETACH
  1337. X# define POW_DETACH
  1338. X# define AUTO_NUKE
  1339. X# define PSEUDOS
  1340. X# define MULTI
  1341. X# define MULTIUSER
  1342. X#endif /* SIMPLESCREEN */
  1343. X
  1344. X/*
  1345. X * As error messages are mostly meaningless to the user, we
  1346. X * try to throw out phrases that are somewhat more familiar
  1347. X * to ...well, at least familiar to us NetHack players.
  1348. X */
  1349. X#ifndef NONETHACK
  1350. X# define NETHACK
  1351. X#endif /* NONETHACK */
  1352. X
  1353. X/*
  1354. X * If screen is installed with permissions to update /etc/utmp (such
  1355. X * as if it is installed set-uid root), define UTMPOK.
  1356. X */
  1357. X#define UTMPOK
  1358. X
  1359. X/* Set LOGINDEFAULT to one (1)
  1360. X * if you want entries added to /etc/utmp by default, else set it to
  1361. X * zero (0).
  1362. X */
  1363. X#define LOGINDEFAULT    1
  1364. X
  1365. X
  1366. X/*
  1367. X * If UTMPOK is defined and your system (incorrectly) counts logins by
  1368. X * counting non-null entries in /etc/utmp (instead of counting non-null
  1369. X * entries with no hostname that are not on a pseudo tty), define USRLIMIT
  1370. X * to have screen put an upper-limit on the number of entries to write
  1371. X * into /etc/utmp.  This helps to keep you from exceeding a limited-user
  1372. X * license.
  1373. X */
  1374. X#undef USRLIMIT
  1375. X
  1376. X
  1377. X
  1378. X/**********************************************************************
  1379. X *
  1380. X *    End of User Configuration Section
  1381. X *
  1382. X *      Rest of this file is modified by 'configure'
  1383. X *      Change at your own risk!
  1384. X *
  1385. X */
  1386. X
  1387. X/*
  1388. X * Some defines to identify special unix variants
  1389. X */
  1390. X#ifndef SVR4
  1391. X#undef SVR4
  1392. X#endif
  1393. X#ifndef MIPS
  1394. X#undef MIPS
  1395. X#endif
  1396. X
  1397. X/*
  1398. X * Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).
  1399. X */
  1400. X#define POSIX 1
  1401. X
  1402. X/*
  1403. X * Define BSDJOBS if you have BSD-style job control (both process
  1404. X * groups and a tty that deals correctly with them).
  1405. X */
  1406. X#define BSDJOBS 1
  1407. X
  1408. X/*
  1409. X * Define TERMIO if you have struct termio instead of struct sgttyb.
  1410. X * This is usually the case for SVID systems, where BSD uses sgttyb.
  1411. X * POSIX systems should define this anyway, even though they use
  1412. X * struct termios.
  1413. X */
  1414. X#define TERMIO 1
  1415. X
  1416. X/*
  1417. X * Define TERMINFO if your machine emulates the termcap routines
  1418. X * with the terminfo database.
  1419. X * Thus the .screenrc file is parsed for
  1420. X * the command 'terminfo' and not 'termcap'.
  1421. X */
  1422. X#undef TERMINFO
  1423. X
  1424. X/*
  1425. X * If your library does not define ospeed, define this.
  1426. X */
  1427. X#undef NEED_OSPEED
  1428. X
  1429. X/*
  1430. X * Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)
  1431. X */
  1432. X#ifndef SYSV
  1433. X#undef SYSV
  1434. X#endif
  1435. X
  1436. X/*
  1437. X * Define SIGVOID if your signal handlers return void.  On older
  1438. X * systems, signal returns int, but on newer ones, it returns void.
  1439. X */
  1440. X#define SIGVOID 1 
  1441. X
  1442. X/*
  1443. X * Define USESIGSET if you have sigset for BSD 4.1 reliable signals.
  1444. X */
  1445. X#undef USESIGSET
  1446. X
  1447. X/*
  1448. X * Define SYSVSIGS if signal handlers must be reinstalled after
  1449. X * they have been called.
  1450. X */
  1451. X#undef SYSVSIGS
  1452. X
  1453. X/*
  1454. X * Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
  1455. X *
  1456. X * Only allow BSDWAIT i.e. wait3 on nonposix systems, since
  1457. X * posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl
  1458. X * 
  1459. X */
  1460. X#ifndef POSIX
  1461. X#define BSDWAIT 1
  1462. X#endif
  1463. X
  1464. X/*
  1465. X * On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com 
  1466. X */
  1467. X#ifdef BSDWAIT
  1468. X#undef USE_WAIT2
  1469. X#endif
  1470. X
  1471. X/*
  1472. X * Define DIRENT if your system has <dirent.h> instead of <sys/dir.h>
  1473. X */
  1474. X#define DIRENT 1
  1475. X
  1476. X/*
  1477. X * If your system has getutent(), pututline(), etc. to write to the
  1478. X * utmp file, define GETUTENT.
  1479. X */
  1480. X#undef GETUTENT
  1481. X
  1482. X/*
  1483. X * Define UTHOST if the utmp file has a host field.
  1484. X */
  1485. X#define UTHOST 1
  1486. X
  1487. X/*
  1488. X * If ttyslot() breaks getlogin() by returning indexes to utmp entries
  1489. X * of type DEAD_PROCESS, then our getlogin() replacement should be
  1490. X * selected by defining BUGGYGETLOGIN.
  1491. X */
  1492. X#undef BUGGYGETLOGIN
  1493. X
  1494. X/*
  1495. X * If your system does not have the calls setreuid() and setregid(),
  1496. X * define NOREUID to force screen to use a forked process to safely
  1497. X * create output files without retaining any special privileges.
  1498. X * (Output logging will be disabled, however.)
  1499. X */
  1500. X#undef NOREUID
  1501. X
  1502. X/*
  1503. X * If you want the "time" command to display the current load average
  1504. X * define LOADAV. Maybe you must install screen with the needed
  1505. X * privileges to read /dev/kmem.
  1506. X * Note that NLIST_ stuff is only checked, when getloadavg() is not available.
  1507. X */
  1508. X#undef LOADAV
  1509. X
  1510. X#define LOADAV_NUM 3
  1511. X#define LOADAV_TYPE double
  1512. X#define LOADAV_SCALE 1
  1513. X#undef LOADAV_GETLOADAVG
  1514. X#undef LOADAV_UNIX
  1515. X#undef LOADAV_AVENRUN
  1516. X
  1517. X#undef NLIST_STRUCT
  1518. X#undef NLIST_NAME_UNION
  1519. X
  1520. X/*
  1521. X * If your system has the new format /etc/ttys (like 4.3 BSD) and the
  1522. X * getttyent(3) library functions, define GETTTYENT.
  1523. X */
  1524. X#define GETTTYENT 1
  1525. X
  1526. X/*
  1527. X * Define USEBCOPY if the bcopy/memcpy from your system's C library
  1528. X * supports the overlapping of source and destination blocks.  When
  1529. X * undefined, screen uses its own (probably slower) version of bcopy().
  1530. X * 
  1531. X * SYSV machines may have a working memcpy() -- Oh, this is 
  1532. X * quite unlikely. Tell me if you see one. (Juergen)
  1533. X * But then, memmove() should work, if at all available.
  1534. X */
  1535. X#define USEBCOPY 1
  1536. X#define USEMEMCPY 1
  1537. X#define USEMEMMOVE 1
  1538. X
  1539. X/*
  1540. X * If your system has vsprintf() and requires the use of the macros in
  1541. X * "varargs.h" to use functions with variable arguments,
  1542. X * define USEVARARGS.
  1543. X */
  1544. X#undef USEVARARGS
  1545. X
  1546. X/*
  1547. X * If the select return value doesn't treat a descriptor that is
  1548. X * usable for reading and writing as two hits, define SELECT_BROKEN.
  1549. X */
  1550. X#undef SELECT_BROKEN
  1551. X
  1552. X/*
  1553. X * Define this if your system supports named pipes.
  1554. X */
  1555. X#undef NAMEDPIPE
  1556. X
  1557. X/*
  1558. X * Define this if your system exits select() immediatly if a pipe is
  1559. X * opened read-only and no writer has opened it.
  1560. X */
  1561. X#undef BROKEN_PIPE
  1562. X
  1563. X/*
  1564. X * Define this if the unix-domain socket implementation doesn't
  1565. X * create a socket in the filesystem.
  1566. X */
  1567. X#undef SOCK_NOT_IN_FS
  1568. X
  1569. X/*
  1570. X * If your system has setenv() and unsetenv() define USESETENV
  1571. X */
  1572. X#define USESETENV 1
  1573. X
  1574. X/*
  1575. X * If your system does not come with a setenv()/putenv()/getenv()
  1576. X * functions, you may bring in our own code by defining NEEDPUTENV.
  1577. X */
  1578. X#undef NEEDPUTENV
  1579. X
  1580. X/*
  1581. X * If the passwords are stored in a shadow file and you want the
  1582. X * builtin lock to work properly, define SHADOWPW.
  1583. X */
  1584. X#undef SHADOWPW
  1585. X
  1586. X/*
  1587. X * If you are on a SYS V machine that restricts filename length to 14 
  1588. X * characters, you may need to enforce that by setting NAME_MAX to 14
  1589. X */
  1590. X#undef NAME_MAX        /* KEEP_UNDEF_HERE override system value */
  1591. X#undef NAME_MAX
  1592. X
  1593. X/* 
  1594. X * define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen
  1595. X * to unusual environments. E.g. For SunOs the defaults are "qpr" and 
  1596. X * "0123456789abcdef". For SunOs 4.1.2 
  1597. X * #define PTYRANGE0 "pqrstuvwxyzPQRST" 
  1598. X * is recommended by Dan Jacobson.
  1599. X */
  1600. X#define PTYRANGE0 "pqv"
  1601. X#define PTYRANGE1 "0123456789abcdef"
  1602. X
  1603. X/*
  1604. X * some defines to prevent redeclarations/retypedefs
  1605. X */
  1606. X#define CRYPT_DECLARED 1
  1607. X#define GETHOSTNAME_DECLARED 1
  1608. X#define KILLSTUFF_DECLARED 1
  1609. X#define MEMFUNCS_DECLARED 1
  1610. X#undef MKNOD_DECLARED
  1611. X#undef NLIST_DECLARED
  1612. X#define PUTENV_DECLARED 1
  1613. X#define REUID_DECLARED 1
  1614. X#define SETPGID_DECLARED 1
  1615. X#define VPRNT_DECLARED 1
  1616. X#define WAITSTUFF_DECLARED 1
  1617. X#define GETDTABLESIZE_DECLARED 1
  1618. X#define SELECT_DECLARED 1
  1619. X#define INDEX_DECLARED 1
  1620. X
  1621. X#define SIG_T_DEFINED 1
  1622. X#define PID_T_DEFINED 1
  1623. X#define UID_T_DEFINED 1
  1624. END_OF_FILE
  1625. if test 10841 -ne `wc -c <'config.h'`; then
  1626.     echo shar: \"'config.h'\" unpacked with wrong size!
  1627. fi
  1628. # end of 'config.h'
  1629. fi
  1630. if test -f 'config.h.in' -a "${1}" != "-c" ; then 
  1631.   echo shar: Will not clobber existing file \"'config.h.in'\"
  1632. else
  1633. echo shar: Extracting \"'config.h.in'\" \(10663 characters\)
  1634. sed "s/^X//" >'config.h.in' <<'END_OF_FILE'
  1635. X/* Copyright (c) 1993
  1636. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  1637. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  1638. X * Copyright (c) 1987 Oliver Laumann
  1639. X *
  1640. X * This program is free software; you can redistribute it and/or modify
  1641. X * it under the terms of the GNU General Public License as published by
  1642. X * the Free Software Foundation; either version 2, or (at your option)
  1643. X * any later version.
  1644. X *
  1645. X * This program is distributed in the hope that it will be useful,
  1646. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1647. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1648. X * GNU General Public License for more details.
  1649. X *
  1650. X * You should have received a copy of the GNU General Public License
  1651. X * along with this program (see the file COPYING); if not, write to the
  1652. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1653. X *
  1654. X ****************************************************************
  1655. X * $Id: config.h.in,v 1.4 1993/06/28 16:00:32 mlschroe Exp $ FAU
  1656. X */
  1657. X
  1658. X
  1659. X
  1660. X
  1661. X
  1662. X/**********************************************************************
  1663. X *
  1664. X *    User Configuration Section
  1665. X */
  1666. X
  1667. X
  1668. X
  1669. X/*
  1670. X * Define HOMESOCKDIR if you want screen to put the named sockets in
  1671. X * the user's home directory. Notice that this can cause you problems
  1672. X * if some user's HOME directories are NFS-mounted and don't support
  1673. X * named sockets. In such a case do not define HOMESOCKDIR and screen
  1674. X * will create the socket directories in SOCKDIR. This should be in a
  1675. X * common subdirectory, such as /local or /tmp. It makes things a
  1676. X * little more secure if you choose a directory which is not writable
  1677. X * by everyone or where the "sticky" bit is on, but this isn't required.
  1678. X * Screen will name the subdirectories "S-$USER" (e.g /tmp/S-davison).
  1679. X * Do not define TMPTEST unless it's for debugging purpose.
  1680. X */
  1681. X#undef HOMESOCKDIR
  1682. X
  1683. X#ifndef HOMESOCKDIR
  1684. X# ifndef TMPTEST
  1685. X#  define SOCKDIR "/usr/local/screens"
  1686. X# else
  1687. X#  define SOCKDIR "/tmp/testscreens"
  1688. X# endif
  1689. X#endif
  1690. X
  1691. X/*
  1692. X * Screen sources two startup files. First a global file with a path
  1693. X * specified here, second your local $HOME/.screenrc
  1694. X * Don't define this, if you don't want it.
  1695. X */
  1696. X#define ETCSCREENRC "/usr/local/etc/screenrc"
  1697. X
  1698. X/* 
  1699. X * define PTYMODE if you do not like the default of 0622, which allows 
  1700. X * public write to your pty.
  1701. X * define PTYGROUP to some numerical group-id if you do not want the
  1702. X * tty to be in "your" group.
  1703. X * Note, screen is unable to change mode or group of the pty if it
  1704. X * is not installed with sufficient privilege. (e.g. set-uid-root)
  1705. X */
  1706. X#undef PTYMODE
  1707. X#undef PTYGROUP
  1708. X
  1709. X/*
  1710. X * If screen is NOT installed set-uid root, screen can provide tty
  1711. X * security by exclusively locking the ptys.  While this keeps other
  1712. X * users from opening your ptys, it also keeps your own subprocesses
  1713. X * from being able to open /dev/tty.  Define LOCKPTY to add this
  1714. X * exclusive locking.
  1715. X */
  1716. X#undef LOCKPTY
  1717. X
  1718. X/*
  1719. X * If you'd rather see the status line on the first line of your
  1720. X * terminal rather than the last, define TOPSTAT.
  1721. X */
  1722. X#undef TOPSTAT
  1723. X
  1724. X/*
  1725. X * here come the erlangen extensions to screen:
  1726. X * define LOCK if you want to use a lock program for a screenlock.
  1727. X * define PASSWORD for secure reattach of your screen.
  1728. X * define COPY_PASTE to use the famous hacker's treasure zoo.
  1729. X * define POW_DETACH to have a detach_and_logout key.
  1730. X * define REMOTE_DETACH (-d option) to move screen between terminals.
  1731. X * define AUTO_NUKE to enable Tim MacKenzies clear screen nuking
  1732. X * define PSEUDOS to allow window input/output filtering
  1733. X * define MULTI to allow multiple attaches.
  1734. X * define MULTIUSER to allow other users attach to your session
  1735. X *                  (if they are in the acl, of course)
  1736. X * (jw)
  1737. X */
  1738. X#undef SIMPLESCREEN
  1739. X#ifndef SIMPLESCREEN
  1740. X# define LOCK
  1741. X# define PASSWORD
  1742. X# define COPY_PASTE
  1743. X# define REMOTE_DETACH
  1744. X# define POW_DETACH
  1745. X# define AUTO_NUKE
  1746. X# define PSEUDOS
  1747. X# define MULTI
  1748. X# define MULTIUSER
  1749. X#endif /* SIMPLESCREEN */
  1750. X
  1751. X/*
  1752. X * As error messages are mostly meaningless to the user, we
  1753. X * try to throw out phrases that are somewhat more familiar
  1754. X * to ...well, at least familiar to us NetHack players.
  1755. X */
  1756. X#ifndef NONETHACK
  1757. X# define NETHACK
  1758. X#endif /* NONETHACK */
  1759. X
  1760. X/*
  1761. X * If screen is installed with permissions to update /etc/utmp (such
  1762. X * as if it is installed set-uid root), define UTMPOK.
  1763. X */
  1764. X#define UTMPOK
  1765. X
  1766. X/* Set LOGINDEFAULT to one (1)
  1767. X * if you want entries added to /etc/utmp by default, else set it to
  1768. X * zero (0).
  1769. X */
  1770. X#define LOGINDEFAULT    1
  1771. X
  1772. X
  1773. X/*
  1774. X * If UTMPOK is defined and your system (incorrectly) counts logins by
  1775. X * counting non-null entries in /etc/utmp (instead of counting non-null
  1776. X * entries with no hostname that are not on a pseudo tty), define USRLIMIT
  1777. X * to have screen put an upper-limit on the number of entries to write
  1778. X * into /etc/utmp.  This helps to keep you from exceeding a limited-user
  1779. X * license.
  1780. X */
  1781. X#undef USRLIMIT
  1782. X
  1783. X
  1784. X
  1785. X/**********************************************************************
  1786. X *
  1787. X *    End of User Configuration Section
  1788. X *
  1789. X *      Rest of this file is modified by 'configure'
  1790. X *      Change at your own risk!
  1791. X *
  1792. X */
  1793. X
  1794. X/*
  1795. X * Some defines to identify special unix variants
  1796. X */
  1797. X#ifndef SVR4
  1798. X#undef SVR4
  1799. X#endif
  1800. X#ifndef MIPS
  1801. X#undef MIPS
  1802. X#endif
  1803. X
  1804. X/*
  1805. X * Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).
  1806. X */
  1807. X#undef POSIX
  1808. X
  1809. X/*
  1810. X * Define BSDJOBS if you have BSD-style job control (both process
  1811. X * groups and a tty that deals correctly with them).
  1812. X */
  1813. X#undef BSDJOBS
  1814. X
  1815. X/*
  1816. X * Define TERMIO if you have struct termio instead of struct sgttyb.
  1817. X * This is usually the case for SVID systems, where BSD uses sgttyb.
  1818. X * POSIX systems should define this anyway, even though they use
  1819. X * struct termios.
  1820. X */
  1821. X#undef TERMIO
  1822. X
  1823. X/*
  1824. X * Define TERMINFO if your machine emulates the termcap routines
  1825. X * with the terminfo database.
  1826. X * Thus the .screenrc file is parsed for
  1827. X * the command 'terminfo' and not 'termcap'.
  1828. X */
  1829. X#undef TERMINFO
  1830. X
  1831. X/*
  1832. X * If your library does not define ospeed, define this.
  1833. X */
  1834. X#undef NEED_OSPEED
  1835. X
  1836. X/*
  1837. X * Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)
  1838. X */
  1839. X#ifndef SYSV
  1840. X#undef SYSV
  1841. X#endif
  1842. X
  1843. X/*
  1844. X * Define SIGVOID if your signal handlers return void.  On older
  1845. X * systems, signal returns int, but on newer ones, it returns void.
  1846. X */
  1847. X#undef SIGVOID 
  1848. X
  1849. X/*
  1850. X * Define USESIGSET if you have sigset for BSD 4.1 reliable signals.
  1851. X */
  1852. X#undef USESIGSET
  1853. X
  1854. X/*
  1855. X * Define SYSVSIGS if signal handlers must be reinstalled after
  1856. X * they have been called.
  1857. X */
  1858. X#undef SYSVSIGS
  1859. X
  1860. X/*
  1861. X * Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
  1862. X *
  1863. X * Only allow BSDWAIT i.e. wait3 on nonposix systems, since
  1864. X * posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl
  1865. X * 
  1866. X */
  1867. X#ifndef POSIX
  1868. X#undef BSDWAIT
  1869. X#endif
  1870. X
  1871. X/*
  1872. X * On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com 
  1873. X */
  1874. X#ifdef BSDWAIT
  1875. X#undef USE_WAIT2
  1876. X#endif
  1877. X
  1878. X/*
  1879. X * Define DIRENT if your system has <dirent.h> instead of <sys/dir.h>
  1880. X */
  1881. X#undef DIRENT
  1882. X
  1883. X/*
  1884. X * If your system has getutent(), pututline(), etc. to write to the
  1885. X * utmp file, define GETUTENT.
  1886. X */
  1887. X#undef GETUTENT
  1888. X
  1889. X/*
  1890. X * Define UTHOST if the utmp file has a host field.
  1891. X */
  1892. X#undef UTHOST
  1893. X
  1894. X/*
  1895. X * If ttyslot() breaks getlogin() by returning indexes to utmp entries
  1896. X * of type DEAD_PROCESS, then our getlogin() replacement should be
  1897. X * selected by defining BUGGYGETLOGIN.
  1898. X */
  1899. X#undef BUGGYGETLOGIN
  1900. X
  1901. X/*
  1902. X * If your system does not have the calls setreuid() and setregid(),
  1903. X * define NOREUID to force screen to use a forked process to safely
  1904. X * create output files without retaining any special privileges.
  1905. X * (Output logging will be disabled, however.)
  1906. X */
  1907. X#undef NOREUID
  1908. X
  1909. X/*
  1910. X * If you want the "time" command to display the current load average
  1911. X * define LOADAV. Maybe you must install screen with the needed
  1912. X * privileges to read /dev/kmem.
  1913. X * Note that NLIST_ stuff is only checked, when getloadavg() is not available.
  1914. X */
  1915. X#undef LOADAV
  1916. X
  1917. X#undef LOADAV_NUM
  1918. X#undef LOADAV_TYPE
  1919. X#undef LOADAV_SCALE
  1920. X#undef LOADAV_GETLOADAVG
  1921. X#undef LOADAV_UNIX
  1922. X#undef LOADAV_AVENRUN
  1923. X
  1924. X#undef NLIST_STRUCT
  1925. X#undef NLIST_NAME_UNION
  1926. X
  1927. X/*
  1928. X * If your system has the new format /etc/ttys (like 4.3 BSD) and the
  1929. X * getttyent(3) library functions, define GETTTYENT.
  1930. X */
  1931. X#undef GETTTYENT
  1932. X
  1933. X/*
  1934. X * Define USEBCOPY if the bcopy/memcpy from your system's C library
  1935. X * supports the overlapping of source and destination blocks.  When
  1936. X * undefined, screen uses its own (probably slower) version of bcopy().
  1937. X * 
  1938. X * SYSV machines may have a working memcpy() -- Oh, this is 
  1939. X * quite unlikely. Tell me if you see one. (Juergen)
  1940. X * But then, memmove() should work, if at all available.
  1941. X */
  1942. X#undef USEBCOPY
  1943. X#undef USEMEMCPY
  1944. X#undef USEMEMMOVE
  1945. X
  1946. X/*
  1947. X * If your system has vsprintf() and requires the use of the macros in
  1948. X * "varargs.h" to use functions with variable arguments,
  1949. X * define USEVARARGS.
  1950. X */
  1951. X#undef USEVARARGS
  1952. X
  1953. X/*
  1954. X * If the select return value doesn't treat a descriptor that is
  1955. X * usable for reading and writing as two hits, define SELECT_BROKEN.
  1956. X */
  1957. X#undef SELECT_BROKEN
  1958. X
  1959. X/*
  1960. X * Define this if your system supports named pipes.
  1961. X */
  1962. X#undef NAMEDPIPE
  1963. X
  1964. X/*
  1965. X * Define this if your system exits select() immediatly if a pipe is
  1966. X * opened read-only and no writer has opened it.
  1967. X */
  1968. X#undef BROKEN_PIPE
  1969. X
  1970. X/*
  1971. X * Define this if the unix-domain socket implementation doesn't
  1972. X * create a socket in the filesystem.
  1973. X */
  1974. X#undef SOCK_NOT_IN_FS
  1975. X
  1976. X/*
  1977. X * If your system has setenv() and unsetenv() define USESETENV
  1978. X */
  1979. X#undef USESETENV
  1980. X
  1981. X/*
  1982. X * If your system does not come with a setenv()/putenv()/getenv()
  1983. X * functions, you may bring in our own code by defining NEEDPUTENV.
  1984. X */
  1985. X#undef NEEDPUTENV
  1986. X
  1987. X/*
  1988. X * If the passwords are stored in a shadow file and you want the
  1989. X * builtin lock to work properly, define SHADOWPW.
  1990. X */
  1991. X#undef SHADOWPW
  1992. X
  1993. X/*
  1994. X * If you are on a SYS V machine that restricts filename length to 14 
  1995. X * characters, you may need to enforce that by setting NAME_MAX to 14
  1996. X */
  1997. X#undef NAME_MAX        /* KEEP_UNDEF_HERE override system value */
  1998. X#undef NAME_MAX
  1999. X
  2000. X/* 
  2001. X * define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen
  2002. X * to unusual environments. E.g. For SunOs the defaults are "qpr" and 
  2003. X * "0123456789abcdef". For SunOs 4.1.2 
  2004. X * #define PTYRANGE0 "pqrstuvwxyzPQRST" 
  2005. X * is recommended by Dan Jacobson.
  2006. X */
  2007. X#undef PTYRANGE0
  2008. X#undef PTYRANGE1
  2009. X
  2010. X/*
  2011. X * some defines to prevent redeclarations/retypedefs
  2012. X */
  2013. X#undef CRYPT_DECLARED
  2014. X#undef GETHOSTNAME_DECLARED
  2015. X#undef KILLSTUFF_DECLARED
  2016. X#undef MEMFUNCS_DECLARED
  2017. X#undef MKNOD_DECLARED
  2018. X#undef NLIST_DECLARED
  2019. X#undef PUTENV_DECLARED
  2020. X#undef REUID_DECLARED
  2021. X#undef SETPGID_DECLARED
  2022. X#undef VPRNT_DECLARED
  2023. X#undef WAITSTUFF_DECLARED
  2024. X#undef GETDTABLESIZE_DECLARED
  2025. X#undef SELECT_DECLARED
  2026. X#undef INDEX_DECLARED
  2027. X
  2028. X#undef SIG_T_DEFINED
  2029. X#undef PID_T_DEFINED
  2030. X#undef UID_T_DEFINED
  2031. END_OF_FILE
  2032. if test 10663 -ne `wc -c <'config.h.in'`; then
  2033.     echo shar: \"'config.h.in'\" unpacked with wrong size!
  2034. fi
  2035. # end of 'config.h.in'
  2036. fi
  2037. if test -f 'extern.h' -a "${1}" != "-c" ; then 
  2038.   echo shar: Will not clobber existing file \"'extern.h'\"
  2039. else
  2040. echo shar: Extracting \"'extern.h'\" \(13269 characters\)
  2041. sed "s/^X//" >'extern.h' <<'END_OF_FILE'
  2042. X/* Copyright (c) 1993
  2043. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  2044. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  2045. X * Copyright (c) 1987 Oliver Laumann
  2046. X *
  2047. X * This program is free software; you can redistribute it and/or modify
  2048. X * it under the terms of the GNU General Public License as published by
  2049. X * the Free Software Foundation; either version 2, or (at your option)
  2050. X * any later version.
  2051. X *
  2052. X * This program is distributed in the hope that it will be useful,
  2053. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2054. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2055. X * GNU General Public License for more details.
  2056. X *
  2057. X * You should have received a copy of the GNU General Public License
  2058. X * along with this program (see the file COPYING); if not, write to the
  2059. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2060. X *
  2061. X ****************************************************************
  2062. X * $Id: extern.h,v 1.1 1993/07/23 14:41:32 vixie Exp vixie $ FAU
  2063. X */
  2064. X
  2065. X/****************************************************************
  2066. X * Thanks to Christos S. Zoulas (christos@ee.cornell.edu) who 
  2067. X * mangled the screen source through 'gcc -Wall'.
  2068. X ****************************************************************
  2069. X */
  2070. X
  2071. X#ifndef MEMFUNCS_DECLARED /* bsd386 */
  2072. X# ifndef SYSV
  2073. Xextern void  bzero __P((char *, int));
  2074. Xextern void  bcopy __P((char *, char *, int));
  2075. X# else
  2076. Xextern char *memset __P((char *, int, size_t));
  2077. Xextern char *memcpy __P((char *, char *, int));
  2078. X#  ifdef USEBCOPY
  2079. Xextern void  bcopy __P((char *, char *, int));
  2080. X#  endif
  2081. X# endif
  2082. X#endif /* MEMFUNCS_DECLARED */
  2083. X#ifndef WAITSTUFF_DECLARED
  2084. X# ifdef BSDWAIT
  2085. Xstruct rusage;
  2086. Xunion wait;
  2087. Xextern int   wait3 __P((union wait *, int, struct rusage *));
  2088. X# else /* BSDWAIT */
  2089. Xextern pid_t waitpid __P((int, int *, int));
  2090. X# endif /* BSDWAIT */
  2091. X#endif /* WAITSTUFF_DECLARED */
  2092. X#ifndef GETDTABLESIZE_DECLARED
  2093. Xextern int   getdtablesize __P((void));
  2094. X#endif /* GETDTABLESIZE_DECLARED */
  2095. X#ifndef REUID_DECLARED
  2096. X# if !defined(NOREUID)
  2097. X#  ifdef hpux
  2098. Xextern int   setresuid __P((uid_t, uid_t, uid_t));
  2099. Xextern int   setresgid __P((gid_t, gid_t, gid_t));
  2100. X#  else
  2101. Xextern int   setreuid __P((uid_t, uid_t));
  2102. Xextern int   setregid __P((gid_t, gid_t));
  2103. X#  endif
  2104. X# endif
  2105. X#endif /* REUID_DECLARED */
  2106. X#ifndef CRYPT_DECLARED
  2107. Xextern char *crypt __P((char *, char *));
  2108. X#endif /* CRYPT_DECLARED */
  2109. X#ifdef sun
  2110. X# ifdef SVR4 /* Solaris 2 */
  2111. Xextern pid_t   getpgrp __P((int));
  2112. X# else
  2113. Xextern int   getpgrp __P((int));
  2114. X# endif
  2115. X#endif
  2116. X#ifndef MKNOD_DECLARED
  2117. X# ifdef POSIX
  2118. Xextern int   mknod __P((const char *, mode_t, dev_t));
  2119. X# else
  2120. Xextern int   mknod __P((char *, int, int));
  2121. X# endif
  2122. X#endif /* MKNOD_DECLARED */
  2123. X#ifndef PUTENV_DECLARED
  2124. Xextern int   putenv __P((char *));
  2125. X#endif /* PUTENV_DECLARED */
  2126. X#ifndef KILLSTUFF_DECLARED
  2127. Xextern int   kill __P((int, int));
  2128. X# ifndef SYSV
  2129. Xextern int   killpg __P((int, int));
  2130. X# endif
  2131. X#endif /* KILLSTUFF_DECLARED */
  2132. Xextern int   tgetent __P((char *, char *));
  2133. Xextern int   tgetnum __P((char *));
  2134. Xextern int   tgetflag __P((char *));
  2135. Xextern void  tputs __P((char *, int, void (*)(int)));
  2136. X# ifdef POSIX
  2137. Xextern pid_t setsid __P((void));
  2138. X#  ifndef SETPGID_DECLARED
  2139. Xextern int   setpgid __P((int, int));
  2140. X#  endif /* SETPGID_DECLARED */
  2141. X#  if defined(BSDI) || defined(__386BSD__) || defined(_CX_UX) || defined(SVR4)
  2142. Xextern int   tcsetpgrp __P((int, pid_t));
  2143. X#  else
  2144. Xextern int   tcsetpgrp __P((int, int));
  2145. X#  endif
  2146. Xextern pid_t getpid __P((void));
  2147. X# endif /* POSIX */
  2148. X#ifndef __STDC__
  2149. Xextern uid_t getuid __P((void)); 
  2150. Xextern uid_t geteuid __P((void));
  2151. X#endif
  2152. Xextern gid_t getgid __P((void)); 
  2153. Xextern gid_t getegid __P((void));
  2154. Xextern int   isatty __P((int)); 
  2155. X#ifdef notdef
  2156. Xextern int   chown __P((const char *, uid_t, gid_t)); 
  2157. X#endif
  2158. X#ifndef GETHOSTNAME_DECLARED
  2159. Xextern int   gethostname __P((char *, size_t));
  2160. X#endif /* GETHOSTNAME_DECLARED */
  2161. X#ifndef __STDC__
  2162. Xextern off_t lseek __P((int, off_t, int));
  2163. X#endif
  2164. X#ifndef POSIX
  2165. X# if defined(sun) && !defined(__GNUC__)        /* sun's exit returns ??? */
  2166. Xextern int   exit __P((int));
  2167. X# else
  2168. Xextern void  exit __P((int));
  2169. X# endif
  2170. X#endif /*POSIX*/
  2171. Xextern char *getwd __P((char *));
  2172. X#ifndef POSIX
  2173. Xextern char *getenv __P((const char *));
  2174. X#endif
  2175. X#ifndef __STDC__
  2176. Xextern time_t time __P((time_t *));
  2177. X#endif
  2178. X
  2179. X#ifndef _AIX        /* should be GETPASS_DEFINED */
  2180. X# if defined(linux) || defined(SVR4) || defined(__386BSD__) || defined(BSDI)
  2181. Xextern char *getpass __P((const char *));
  2182. X# else
  2183. Xextern char *getpass __P((char *));
  2184. X# endif
  2185. X#endif
  2186. Xextern char *getlogin(), *ttyname();
  2187. Xextern int   fflush(); 
  2188. X#if !defined(__STDC__) || !defined(POSIX)
  2189. Xextern char *malloc(), *realloc();
  2190. X#endif
  2191. X
  2192. X#ifndef INDEX_DECLARED
  2193. X# if defined(SVR4) && defined(sun)
  2194. Xextern char *index __P((const char *, int));
  2195. Xextern char *rindex __P((const char *, int));
  2196. X# else
  2197. Xextern char *index __P((char *, int));
  2198. Xextern char *rindex __P((char *, int));
  2199. X# endif
  2200. X#endif /* INDEX_DECLARED */
  2201. X
  2202. X
  2203. X/************************************************************
  2204. X *  Screens function declarations
  2205. X */
  2206. X
  2207. X/* screen.c */
  2208. Xextern void  main __P((int, char **));
  2209. Xextern sig_t SigHup __P(SIGPROTOARG);
  2210. Xextern void  eexit __P((int));
  2211. Xextern void  Detach __P((int));
  2212. Xextern void  Kill __P((int, int));
  2213. X#ifdef USEVARARGS
  2214. Xextern void  Msg __P((int, char *, ...))
  2215. X# ifdef __GNUC__
  2216. X__attribute__ ((format (printf, 2, 3)))
  2217. X# endif
  2218. X;
  2219. Xextern void  Panic __P((int, char *, ...))
  2220. X# ifdef __GNUC__
  2221. X__attribute__ ((format (printf, 2, 3)))
  2222. X# endif
  2223. X;
  2224. X#else
  2225. Xextern void  Msg __P(());
  2226. Xextern void  Panic __P(());
  2227. X#endif
  2228. Xextern void  DisplaySleep __P((int));
  2229. Xextern sig_t Finit __P((int));
  2230. Xextern void  MakeNewEnv __P((void));
  2231. X
  2232. X/* ansi.c */
  2233. Xextern void  Activate __P((int));
  2234. Xextern void  ResetWindow __P((struct win *));
  2235. Xextern void  WriteString __P((struct win *, char *, int));
  2236. Xextern void  NewAutoFlow __P((struct win *, int));
  2237. Xextern void  Redisplay __P((int));
  2238. Xextern void  CheckLP __P((int));
  2239. Xextern void  MakeBlankLine __P((char *, int));
  2240. Xextern void  SetCurr __P((struct win *));
  2241. Xextern void  ChangeAKA __P((struct win *, char *, int));
  2242. Xextern void  AddLineToHist __P((struct win *, char **, char **, char **));
  2243. X
  2244. X/* fileio.c */
  2245. Xextern void  StartRc __P((char *));
  2246. Xextern void  FinishRc __P((char *));
  2247. Xextern void  RcLine __P((char *));
  2248. Xextern FILE *secfopen __P((char *, char *));
  2249. Xextern int   secopen __P((char *, int, int));
  2250. Xextern void  WriteFile __P((int));
  2251. Xextern void  ReadFile __P((void));
  2252. Xextern void  KillBuffers __P((void));
  2253. Xextern char *expand_vars __P((char *));
  2254. X
  2255. X/* tty.c */
  2256. Xextern int   OpenTTY __P((char *));
  2257. Xextern void  InitTTY __P((struct mode *, int));
  2258. Xextern void  GetTTY __P((int, struct mode *));
  2259. Xextern void  SetTTY __P((int, struct mode *));
  2260. Xextern void  SetMode __P((struct mode *, struct mode *));
  2261. Xextern void  SetFlow __P((int));
  2262. Xextern void  SendBreak __P((struct win *, int, int));
  2263. Xextern int   TtyGrabConsole __P((int, int, char *));
  2264. X#ifdef DEBUG
  2265. Xextern void  DebugTTY __P((struct mode *));
  2266. X#endif /* DEBUG */
  2267. Xextern int   fgtty __P((int));
  2268. Xextern void  brktty __P((int));
  2269. X
  2270. X/* mark.c */
  2271. Xextern int   GetHistory __P((void));
  2272. Xextern void  MarkRoutine __P((void));
  2273. Xextern void  revto_line __P((int, int, int));
  2274. Xextern void  revto __P((int, int));
  2275. X
  2276. X/* search.c */
  2277. Xextern void  Search __P((int));
  2278. Xextern void  ISearch __P((int));
  2279. X
  2280. X/* input.c */
  2281. Xextern void  inp_setprompt __P((char *, char *));
  2282. Xextern void  Input __P((char *, int, void (*)(), int));
  2283. X
  2284. X/* help.c */
  2285. Xextern void  exit_with_usage __P((char *));
  2286. Xextern void  display_help __P((void));
  2287. Xextern void  display_copyright __P((void));
  2288. X
  2289. X/* window.c */
  2290. Xextern int   MakeWindow __P((struct NewWindow *));
  2291. Xextern void  FreeWindow __P((struct win *));
  2292. X#ifdef PSEUDOS
  2293. Xextern int   winexec __P((char **));
  2294. Xextern void  FreePseudowin __P((struct win *));
  2295. X#endif
  2296. Xextern void  nwin_compose __P((struct NewWindow *, struct NewWindow *, struct NewWindow *));
  2297. X
  2298. X/* utmp.c */
  2299. X#ifdef UTMPOK
  2300. Xextern void  InitUtmp __P((void));
  2301. Xextern void  RemoveLoginSlot __P((void));
  2302. Xextern void  RestoreLoginSlot __P((void));
  2303. Xextern int   SetUtmp __P((struct win *));
  2304. Xextern int   RemoveUtmp __P((struct win *));
  2305. X#endif /* UTMPOK */
  2306. Xextern void  SlotToggle __P((int));
  2307. X#ifdef USRLIMIT
  2308. Xextern int   CountUsers __P((void));
  2309. X#endif
  2310. X
  2311. X/* loadav.c */
  2312. X#ifdef LOADAV
  2313. Xextern void  InitLoadav __P((void));
  2314. Xextern void  AddLoadav __P((char *));
  2315. X#endif
  2316. X
  2317. X/* pty.c */
  2318. Xextern int   OpenPTY __P((char **));
  2319. X
  2320. X/* process.c */
  2321. Xextern void  InitKeytab __P((void));
  2322. Xextern void  ProcessInput __P((char *, int));
  2323. Xextern int   FindCommnr __P((char *));
  2324. Xextern void  DoAction __P((struct action *, int));
  2325. Xextern void  KillWindow __P((struct win *));
  2326. Xextern void  SetForeWindow __P((struct win *));
  2327. Xextern int   Parse __P((char *, char **));
  2328. Xextern int   ParseEscape __P((char *));
  2329. Xextern void  DoScreen __P((char *, char **));
  2330. Xextern void  ShowWindows __P((void));
  2331. Xextern int   WindowByNoN __P((char *));
  2332. X#ifdef COPY_PASTE
  2333. Xextern int   CompileKeys __P((char *, char *));
  2334. X#endif
  2335. X
  2336. X/* termcap.c */
  2337. Xextern int   InitTermcap __P((int, int));
  2338. Xextern char *MakeTermcap __P((int));
  2339. Xextern char *gettermcapstring __P((char *));
  2340. X
  2341. X/* attacher.c */
  2342. Xextern int   Attach __P((int));
  2343. Xextern void  Attacher __P((void));
  2344. Xextern sig_t AttacherFinit __P(SIGPROTOARG);
  2345. X
  2346. X/* display.c */
  2347. Xextern struct display *MakeDisplay __P((char *, char *, char *, int, int, struct mode *));
  2348. Xextern void  FreeDisplay __P((void));
  2349. Xextern void  DefProcess __P((char **, int *));
  2350. Xextern void  DefRedisplayLine __P((int, int, int, int));
  2351. Xextern void  DefClearLine __P((int, int, int));
  2352. Xextern int   DefRewrite __P((int, int, int, int));
  2353. Xextern void  DefSetCursor __P((void));
  2354. Xextern int   DefResize __P((int, int));
  2355. Xextern void  DefRestore __P((void));
  2356. Xextern void  PutStr __P((char *));
  2357. Xextern void  CPutStr __P((char *, int));
  2358. Xextern void  InitTerm __P((int));
  2359. Xextern void  FinitTerm __P((void));
  2360. Xextern void  INSERTCHAR __P((int));
  2361. Xextern void  PUTCHAR __P((int));
  2362. Xextern void  PUTCHARLP __P((int));
  2363. Xextern void  RAW_PUTCHAR __P((int));
  2364. Xextern void  ClearDisplay __P((void));
  2365. Xextern void  Clear __P((int, int, int, int));
  2366. Xextern void  RefreshLine __P((int, int, int, int));
  2367. Xextern void  DisplayLine __P((char *, char *, char *, char *, char *, char *, int, int, int));
  2368. Xextern void  FixLP __P((int, int));
  2369. Xextern void  GotoPos __P((int, int));
  2370. Xextern int   CalcCost __P((char *));
  2371. Xextern void  ScrollRegion __P((int, int, int));
  2372. Xextern void  ChangeScrollRegion __P((int, int));
  2373. Xextern void  InsertMode __P((int));
  2374. Xextern void  KeypadMode __P((int));
  2375. Xextern void  CursorkeysMode __P((int));
  2376. Xextern void  SetFont __P((int));
  2377. Xextern void  SetAttr __P((int));
  2378. Xextern void  SetAttrFont __P((int, int));
  2379. Xextern void  MakeStatus __P((char *));
  2380. Xextern void  RemoveStatus __P((void));
  2381. Xextern void  SetLastPos __P((int, int));
  2382. Xextern int   ResizeDisplay __P((int, int));
  2383. Xextern int   InitOverlayPage __P((int, struct LayFuncs *, int));
  2384. Xextern void  ExitOverlayPage __P((void));
  2385. Xextern void  AddStr __P((char *));
  2386. Xextern void  AddStrn __P((char *, int));
  2387. Xextern void  Flush __P((void));
  2388. Xextern void  freetty __P((void));
  2389. Xextern void  Resize_obuf __P((void));
  2390. X#ifdef AUTO_NUKE
  2391. Xextern void  NukePending __P((void));
  2392. X#endif
  2393. X
  2394. X/* resize.c */
  2395. Xextern int   ChangeScrollback __P((struct win *, int, int));
  2396. Xextern int   ChangeWindowSize __P((struct win *, int, int));
  2397. Xextern void  ChangeScreenSize __P((int, int, int));
  2398. Xextern void  CheckScreenSize __P((int));
  2399. Xextern void  DoResize __P((int, int));
  2400. Xextern char *xrealloc __P((char *, int));
  2401. X
  2402. X/* socket.c */
  2403. Xextern int   FindSocket __P((int, int *));
  2404. Xextern int   MakeClientSocket __P((int, char *));
  2405. Xextern int   MakeServerSocket __P((void));
  2406. Xextern int   RecoverSocket __P((void));
  2407. Xextern int   chsock __P((void));
  2408. Xextern void  ReceiveMsg __P(());
  2409. Xextern void  SendCreateMsg __P((int, struct NewWindow *));
  2410. X#ifdef USEVARARGS
  2411. Xextern void  SendErrorMsg __P((char *, ...))
  2412. X# ifdef __GNUC__
  2413. X__attribute__ ((format (printf, 1, 2)))
  2414. X# endif
  2415. X;
  2416. X#else
  2417. Xextern void  SendErrorMsg __P(());
  2418. X#endif
  2419. X
  2420. X/* misc.c */
  2421. Xextern char *SaveStr __P((const char *));
  2422. Xextern void  centerline __P((char *));
  2423. Xextern char *Filename __P((char *));
  2424. Xextern char *stripdev __P((char *));
  2425. X#if !defined(MEMFUNCS_DECLARED) && !defined(bcopy)
  2426. Xextern void  bcopy __P((char *, char *, int));
  2427. X#endif /* !MEMFUNCS_DECLARED && !bcopy */
  2428. Xextern void  bclear __P((char *, int));
  2429. Xextern void  closeallfiles __P((int));
  2430. Xextern int   UserContext __P((void));
  2431. Xextern void  UserReturn __P((int));
  2432. Xextern int   UserStatus __P((void));
  2433. X
  2434. X/* acl.c */
  2435. X#ifdef MULTIUSER
  2436. Xextern int   AclInit __P((char *));
  2437. Xextern int   AclSetPass __P((char *, char *));
  2438. Xextern int   AclDelUser __P((char *));
  2439. Xextern int   AclAddGroup __P((char *));
  2440. Xextern int   AclSetGroupPerm __P((char *, char *));
  2441. Xextern int   AclDelGroup __P((char *));
  2442. Xextern int   AclUserAddGroup __P((char *, char *));
  2443. Xextern int   AclUserDelGroup __P((char *, char *));
  2444. Xextern int   AclCheckPermWin __P((struct user *, int, struct win *));
  2445. Xextern int   AclCheckPermCmd __P((struct user *, int, struct comm *));
  2446. Xextern int   AclSetPerm __P((struct user *, char *, char *));
  2447. Xextern void  AclWinSwap __P((int, int));
  2448. Xextern int   NewWindowAcl __P((struct win *));
  2449. X#endif /* MULTIUSER */
  2450. Xextern struct user **FindUserPtr __P((char *));
  2451. Xextern int   UserAdd __P((char *, char *, struct user **));
  2452. Xextern int   UserDel __P((char *, struct user **));
  2453. END_OF_FILE
  2454. if test 13269 -ne `wc -c <'extern.h'`; then
  2455.     echo shar: \"'extern.h'\" unpacked with wrong size!
  2456. fi
  2457. # end of 'extern.h'
  2458. fi
  2459. if test -f 'os.h' -a "${1}" != "-c" ; then 
  2460.   echo shar: Will not clobber existing file \"'os.h'\"
  2461. else
  2462. echo shar: Extracting \"'os.h'\" \(7722 characters\)
  2463. sed "s/^X//" >'os.h' <<'END_OF_FILE'
  2464. X/* Copyright (c) 1993
  2465. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  2466. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  2467. X * Copyright (c) 1987 Oliver Laumann
  2468. X *
  2469. X * This program is free software; you can redistribute it and/or modify
  2470. X * it under the terms of the GNU General Public License as published by
  2471. X * the Free Software Foundation; either version 2, or (at your option)
  2472. X * any later version.
  2473. X *
  2474. X * This program is distributed in the hope that it will be useful,
  2475. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2476. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2477. X * GNU General Public License for more details.
  2478. X *
  2479. X * You should have received a copy of the GNU General Public License
  2480. X * along with this program (see the file COPYING); if not, write to the
  2481. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2482. X *
  2483. X ****************************************************************
  2484. X * $Id: os.h,v 1.1 1993/07/23 15:59:24 vixie Exp vixie $ FAU
  2485. X */
  2486. X
  2487. X#include <stdio.h>
  2488. X#include <errno.h>
  2489. X#include <sys/param.h>
  2490. X
  2491. X#if defined(BSDI) || defined(__386BSD__) || defined(_CX_UX)
  2492. X# include <signal.h>
  2493. X#endif /* BSDI || __386BSD__ || _CX_UX */
  2494. X
  2495. X#ifdef ISC
  2496. X# ifdef ENAMETOOLONG
  2497. X#  undef ENAMETOOLONG
  2498. X# endif
  2499. X# ifdef ENOTEMPTY
  2500. X#  undef ENOTEMPTY
  2501. X# endif
  2502. X# include <net/errno.h>
  2503. X#endif
  2504. X
  2505. X#ifdef hpux
  2506. X# ifndef GETUTENT
  2507. X#  define GETUTENT 1
  2508. X# endif 
  2509. X#endif
  2510. X
  2511. X#if defined(pyr) || defined(MIPS) || defined(GOULD_NP1) || defined(B43)
  2512. Xextern int errno;
  2513. X#endif
  2514. X#ifndef linux /* all done in <errno.h> */
  2515. Xextern int sys_nerr;
  2516. Xextern char *sys_errlist[];
  2517. X#endif /* linux */
  2518. X
  2519. X#ifdef sun
  2520. X# define getpgrp __getpgrp
  2521. X# define exit __exit
  2522. X#endif
  2523. X
  2524. X#ifdef POSIX
  2525. X# include <unistd.h>
  2526. X# if defined(__STDC__)
  2527. X#  include <stdlib.h>
  2528. X# endif /* __STDC__ */
  2529. X#endif /* POSIX */
  2530. X
  2531. X#ifdef sun
  2532. X# undef getpgrp
  2533. X# undef exit
  2534. X#endif /* sun */
  2535. X
  2536. X#ifdef POSIX
  2537. X# include <termios.h>
  2538. X# ifdef hpux
  2539. X#  include <bsdtty.h>
  2540. X# endif /* hpux */
  2541. X#else /* POSIX */
  2542. X# ifdef TERMIO
  2543. X#  include <termio.h>
  2544. X# else /* TERMIO */
  2545. X#  include <sgtty.h>
  2546. X# endif /* TERMIO */
  2547. X#endif /* POSIX */
  2548. X
  2549. X#ifndef SYSV
  2550. X# ifdef NEWSOS
  2551. X#  define strlen ___strlen___
  2552. X#  include <strings.h>
  2553. X#  undef strlen
  2554. X# else /* NEWSOS */
  2555. X#  include <strings.h>
  2556. X# endif /* NEWSOS */
  2557. X#else /* BSD */
  2558. X# if defined(SVR4) || defined(NEWSOS)
  2559. X#  define strlen ___strlen___
  2560. X#  include <string.h>
  2561. X#  undef strlen
  2562. X#  ifndef NEWSOS
  2563. X    extern size_t strlen(const char *);
  2564. X#  endif /* NEWSOS */
  2565. X# else /* SVR4 */
  2566. X#  include <string.h>
  2567. X# endif /* SVR4 */
  2568. X#endif /* BSD */
  2569. X
  2570. X#if (defined(TIOCGWINSZ) || defined(TIOCSWINSZ)) && defined(M_UNIX)
  2571. X# include <sys/stream.h>
  2572. X# include <sys/ptem.h>
  2573. X#endif
  2574. X
  2575. X#ifdef UTMPOK
  2576. X# ifdef SVR4
  2577. X#  include <utmpx.h>
  2578. X#  define UTMPFILE    UTMPX_FILE
  2579. X#  define utmp        utmpx
  2580. X#  define getutent    getutxent
  2581. X#  define getutid    getutxid
  2582. X#  define getutline    getutxline
  2583. X#  define pututline    pututxline
  2584. X#  define setutent    setutxent
  2585. X#  define endutent    endutxent
  2586. X#  ifdef sun
  2587. X#   define ut_time    ut_xtime
  2588. X#  endif
  2589. X# else /* SVR4 */
  2590. X#  include <utmp.h>
  2591. X# endif /* SVR4 */
  2592. X# if defined(apollo) || defined(linux)
  2593. X   /* 
  2594. X    * We don't have GETUTENT, so we dig into utmp ourselves.
  2595. X    * But we save the permanent filedescriptor and
  2596. X    * open utmp just when we need to. 
  2597. X    * This code supports an unsorted utmp. jw.
  2598. X    */
  2599. X#  define UTNOKEEP
  2600. X# endif /* apollo || linux */
  2601. X#endif
  2602. X
  2603. X#ifndef UTMPFILE
  2604. X# ifdef UTMP_FILE
  2605. X#  define UTMPFILE    UTMP_FILE
  2606. X# else
  2607. X#  ifdef _PATH_UTMP
  2608. X#   define UTMPFILE    _PATH_UTMP
  2609. X#  else
  2610. X#   define UTMPFILE    "/etc/utmp"
  2611. X#  endif /* _PATH_UTMP */
  2612. X# endif
  2613. X#endif
  2614. X
  2615. X#ifndef UTMPOK
  2616. X#  ifdef USRLIMIT
  2617. X#     undef USRLIMIT
  2618. X#  endif
  2619. X#endif
  2620. X
  2621. X#ifndef LOGINDEFAULT
  2622. X#  define LOGINDEFAULT 0
  2623. X#endif
  2624. X
  2625. X#ifndef F_OK
  2626. X#define F_OK 0
  2627. X#endif
  2628. X#ifndef X_OK
  2629. X#define X_OK 1
  2630. X#endif
  2631. X#ifndef W_OK
  2632. X#define W_OK 2
  2633. X#endif
  2634. X#ifndef R_OK
  2635. X#define R_OK 4
  2636. X#endif
  2637. X
  2638. X#ifndef S_IFIFO
  2639. X#define S_IFIFO  0010000
  2640. X#endif
  2641. X#ifndef S_IREAD
  2642. X#define S_IREAD  0000400
  2643. X#endif
  2644. X#ifndef S_IWRITE
  2645. X#define S_IWRITE 0000200
  2646. X#endif
  2647. X#ifndef S_IEXEC
  2648. X#define S_IEXEC  0000100
  2649. X#endif
  2650. X
  2651. X#if defined(S_IFIFO) && defined(S_IFMT) && !defined(S_ISFIFO)
  2652. X#define S_ISFIFO(mode) ((mode & S_IFMT) == S_IFIFO)
  2653. X#endif
  2654. X#if defined(S_IFSOCK) && defined(S_IFMT) && !defined(S_ISSOCK)
  2655. X#define S_ISSOCK(mode) ((mode & S_IFMT) == S_IFSOCK)
  2656. X#endif
  2657. X
  2658. X#ifndef TERMCAP_BUFSIZE
  2659. X# define TERMCAP_BUFSIZE 1024
  2660. X#endif
  2661. X
  2662. X#ifndef MAXPATHLEN
  2663. X# define MAXPATHLEN 1024
  2664. X#endif
  2665. X
  2666. X#ifndef SIG_T_DEFINED
  2667. X# ifdef SIGVOID
  2668. X#  if defined(ultrix)
  2669. X#   define sig_t void
  2670. X#  else /* nice compilers: */
  2671. X    typedef void sig_t;
  2672. X#  endif
  2673. X# else
  2674. X   typedef int sig_t; /* (* sig_t) */
  2675. X# endif
  2676. X#endif /* SIG_T_DEFINED */
  2677. X
  2678. X#if defined(SVR4) || (defined(SYSV) && defined(ISC)) || defined(_AIX) || defined(linux) || defined(ultrix) || defined(__386BSD__) || defined(BSDI)
  2679. X# define SIGPROTOARG   (int)
  2680. X# define SIGDEFARG     int sigsig
  2681. X# define SIGARG        0
  2682. X#else
  2683. X# define SIGPROTOARG   (void)
  2684. X# define SIGDEFARG
  2685. X# define SIGARG
  2686. X#endif
  2687. X
  2688. X#ifndef SIGCHLD
  2689. X#define SIGCHLD SIGCLD
  2690. X#endif
  2691. X
  2692. X#ifdef USESIGSET
  2693. X# define signal sigset
  2694. X#endif /* USESIGSET */
  2695. X
  2696. X#ifndef PID_T_DEFINED
  2697. Xtypedef int pid_t;
  2698. X#endif
  2699. X
  2700. X#ifndef UID_T_DEFINED
  2701. Xtypedef int gid_t;
  2702. Xtypedef int uid_t;
  2703. X#endif
  2704. X
  2705. X#ifdef GETUTENT
  2706. X  typedef char *slot_t;
  2707. X#else
  2708. X  typedef int slot_t;
  2709. X#endif
  2710. X
  2711. X#ifdef SYSV
  2712. X# define index strchr
  2713. X# define rindex strrchr
  2714. X# define bzero(poi,len) memset(poi,0,len)
  2715. X# define bcmp memcmp
  2716. X# define killpg(pgrp,sig) kill( -(pgrp), sig)
  2717. X#endif /* SYSV */
  2718. X
  2719. X#ifndef USEBCOPY
  2720. X# ifdef USEMEMCPY
  2721. X#  define bcopy(s,d,len) memcpy(d,s,len)
  2722. X# else
  2723. X#  ifdef USEMEMMOVE
  2724. X#   define bcopy(s,d,len) memmove(d,s,len)
  2725. X#  else
  2726. X#   define NEED_OWN_BCOPY
  2727. X#  endif
  2728. X# endif
  2729. X#endif
  2730. X
  2731. X#if defined(_POSIX_SOURCE) && defined(ISC)
  2732. X# ifndef O_NDELAY
  2733. X#  define O_NDELAY O_NONBLOCK
  2734. X# endif
  2735. X#endif
  2736. X
  2737. X#ifdef hpux
  2738. X# define setreuid(ruid, euid) setresuid(ruid, euid, -1)
  2739. X# define setregid(rgid, egid) setresgid(rgid, egid, -1)
  2740. X#endif
  2741. X
  2742. X#if !defined(m68k) && !defined(M_XENIX)
  2743. X# include <sys/wait.h>
  2744. X#endif
  2745. X
  2746. X#ifndef WTERMSIG
  2747. X# ifndef BSDWAIT /* if wait is NOT a union: */
  2748. X#  define WTERMSIG(status) (status & 0177)
  2749. X# else
  2750. X#  define WTERMSIG(status) status.w_T.w_Termsig 
  2751. X# endif
  2752. X#endif
  2753. X
  2754. X#ifndef WSTOPSIG
  2755. X# ifndef BSDWAIT /* if wait is NOT a union: */
  2756. X#  define WSTOPSIG(status) ((status >> 8) & 0377)
  2757. X# else
  2758. X#  define WSTOPSIG(status) status.w_S.w_Stopsig 
  2759. X# endif
  2760. X#endif
  2761. X
  2762. X/* NET-2 uses WCOREDUMP */
  2763. X#if defined(WCOREDUMP) && !defined(WIFCORESIG)
  2764. X# define WIFCORESIG(status) WCOREDUMP(status)
  2765. X#endif
  2766. X
  2767. X#ifndef WIFCORESIG
  2768. X# ifndef BSDWAIT /* if wait is NOT a union: */
  2769. X#  define WIFCORESIG(status) (status & 0200)
  2770. X# else
  2771. X#  define WIFCORESIG(status) status.w_T.w_Coredump
  2772. X# endif
  2773. X#endif
  2774. X
  2775. X#ifndef WEXITSTATUS
  2776. X# ifndef BSDWAIT /* if wait is NOT a union: */
  2777. X#  define WEXITSTATUS(status) ((status >> 8) & 0377)
  2778. X# else
  2779. X#  define WEXITSTATUS(status) status.w_T.w_Retcode
  2780. X# endif
  2781. X#endif
  2782. X
  2783. X#if defined(sgi) 
  2784. X/* on IRIX, regardless of the stream head's read mode (RNORM/RMSGN/RMSGD)
  2785. X * TIOCPKT mode causes data loss if our buffer is too small (IOSIZE)
  2786. X * to hold the whole packet at first read().
  2787. X * (Marc Boucher)
  2788. X */
  2789. X# undef TIOCPKT
  2790. X#endif
  2791. X
  2792. X#if !defined(VDISABLE)
  2793. X# ifdef _POSIX_VDISABLE
  2794. X#  define VDISABLE _POSIX_VDISABLE
  2795. X# else
  2796. X#  define VDISABLE 0377
  2797. X# endif /* _POSIX_VDISABLE */
  2798. X#endif /* !VDISABLE */
  2799. X
  2800. X#if !defined(FNDELAY) && defined(O_NDELAY)
  2801. X# define FNDELAY O_NDELAY
  2802. X#endif
  2803. X
  2804. X/*typedef long off_t; */    /* Someone might need this */
  2805. X
  2806. X
  2807. X/* 
  2808. X * 4 <= IOSIZE <=1000
  2809. X * you may try to vary this value. Use low values if your (VMS) system
  2810. X * tends to choke when pasting. Use high values if you want to test
  2811. X * how many characters your pty's can buffer.
  2812. X */
  2813. X#define IOSIZE        4096
  2814. X
  2815. X/* used in screen.c and attacher.c */
  2816. X#if !defined(NSIG)    /* kbeal needs these w/o SYSV */
  2817. X# define NSIG 32
  2818. X#endif /* !NSIG */
  2819. X
  2820. END_OF_FILE
  2821. if test 7722 -ne `wc -c <'os.h'`; then
  2822.     echo shar: \"'os.h'\" unpacked with wrong size!
  2823. fi
  2824. # end of 'os.h'
  2825. fi
  2826. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  2827.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  2828. else
  2829. echo shar: Extracting \"'patchlevel.h'\" \(7442 characters\)
  2830. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  2831. X/* Copyright (c) 1993
  2832. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  2833. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  2834. X * Copyright (c) 1987 Oliver Laumann
  2835. X *
  2836. X * This program is free software; you can redistribute it and/or modify
  2837. X * it under the terms of the GNU General Public License as published by
  2838. X * the Free Software Foundation; either version 2, or (at your option)
  2839. X * any later version.
  2840. X *
  2841. X * This program is distributed in the hope that it will be useful,
  2842. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2843. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2844. X * GNU General Public License for more details.
  2845. X *
  2846. X * You should have received a copy of the GNU General Public License
  2847. X * along with this program (see the file COPYING); if not, write to the
  2848. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2849. X *
  2850. X ****************************************************************
  2851. X * $Id: patchlevel.h,v 1.4 1993/07/21 15:43:16 mlschroe Exp $ FAU
  2852. X */
  2853. X
  2854. X/****************************************************************
  2855. X *
  2856. X * patchlevel.h: Our life story.
  2857. X *
  2858. X * 08.07.91 -- 3.00.01 -wipe and a 'setenv TERM dumb' bugfix.
  2859. X * 17.07.91 -- 3.00.02 another patchlevel by Wayne Davison
  2860. X * 31.07.91 -- 3.00.03 E0, S0, C0 for flexible semi-graphics, nonblocking 
  2861. X *                     window title input and 'C-a :' command input.
  2862. X * 10.08.91 -- 3.00.04 scrollback, markkeys and some bugfixes.
  2863. X * 13.08.91 -- 3.00.05 mark routine improved, ansi prototypes added.
  2864. X * 20.08.91 -- 3.00.06 screen -h, faster GotoPos in overlay, termcap %.
  2865. X *                     instead of %c
  2866. X * 28.08.91 -- 3.00.07 environment variable support. security. terminfo.
  2867. X *                     pyramid and ultrix support.
  2868. X * 07.09.91 -- 3.00.99 secopen(), MIPS support, SVR4 support.
  2869. X * 09.09.91 -- 3.01.00 backspace bug fixed.
  2870. X * 03.10.91 -- 3.01.01 ansi.c: null-ptr fixed, CLS now saves to scrollback.
  2871. X *                     Using setresuid on hpux. Memory leak fixed.
  2872. X *               Better GotoPos(). Support for IC. Another resize bug.
  2873. X *                     Detach() w/o fore crashed. -T and -A(dapt) option.
  2874. X *                     GNU copyleft.
  2875. X * 19.12.91 -- 3.01.02 flow now really automatic (autoflow killed).
  2876. X *               7 bit restriction removed from WriteString().
  2877. X * 09.01.92 -- 3.01.03 flow reattach bug fixed. VDISCARD bug fixed.
  2878. X * 13.01.92 -- 3.01.04 new flow concept: ^Af toggles now three states
  2879. X * 21.01.92 -- 3.01.05 '^A:screen 11' bug fixed. aflag in DoScreen().
  2880. X *                     Some code cleanup. attach_tty and display_tty[]
  2881. X *                     added.
  2882. X * 26.01.92 -- 3.01.06 apollo support, "hardcopy_append on", "bufferfile", 
  2883. X *                     SECURITY PROBLEM cleared..
  2884. X * 28.01.92 -- 3.01.07 screen after su allowed. Pid became part of 
  2885. X *                     SockName. sysvish 14 character restriction considered.
  2886. X * 31.01.92 -- 3.02.00 Ultrix port, Irix 3.3 SGI port, shadow pw support,
  2887. X *                     data loss on stdin overflow fixed. "refresh off".
  2888. X * 12.02.92 -- 3.02.02 stripdev() moved, -S introduced, bufferfile improved,
  2889. X *                     ShellProg coredump cleared. SVR4 bugfixes.
  2890. X *                     I/O code speedup added.
  2891. X * 24.04.92 -- 3.02.03 perfectly stackable overlays. One scrollback per window,
  2892. X *                     not per display.
  2893. X * 05.05.92 -- 3.02.04 very nasty initialisation bug fixed.
  2894. X * 09.05.92 -- 3.02.05 parsing for $:cl: termcap strings and \012 octal notation
  2895. X *                     in screenrc file. More structuring. Detached startup
  2896. X *                     with 'screen -d -m -S...' bugfixed.    
  2897. X * 11.05.92 -- 3.02.06 setreuid() bugs cleared, C-a : setenv added.
  2898. X *               "xn" capability in TERMCAP needed since "am" is there.
  2899. X * 25.06.92 -- 3.02.07 The multi display test version. Have merci.
  2900. X * 15.07.92 -- 3.02.08 :B8: supports automatic charset switching for 8-bit
  2901. X * 26.09.92 -- 3.02.09 Ported to linux. Ignoring bad files in $SCREENDIR
  2902. X * 22.10.92 -- 3.02.10 screen.c/ansi.c splitted in several pieces.
  2903. X *               Better ISearch. Cleanup of loadav.c
  2904. X * 29.10.92 -- 3.02.11 Key mechanism rewritten. New command names.
  2905. X *               New iscreenrc syntax. 
  2906. X * 02.11.92 -- 3.02.12 'bind g copy_reg' and 'bind x ins_reg' as suggested by
  2907. X *               stillson@tsfsrv.mitre.org (Ken Stillson).
  2908. X * 03.11.92 -- 3.02.13 Ported to SunOs 4.1.2. Gulp. Some NULL ptrs fixed and
  2909. X *               misc. braindamage fixed.
  2910. X * 03.11.92 -- 3.02.14 Argument number checking, AKA fixed.
  2911. X * 05.11.92 -- 3.02.15 Memory leaks in Detach() and KillWindow() fixed.
  2912. X *                     Lockprg powerdetaches on SIGHUP.
  2913. X * 12.11.92 -- 3.02.16 Introduced two new termcaps: "CS" and "CE".
  2914. X *               (Switch cursorkeys in application mode)
  2915. X *               Tim's async output patch.
  2916. X *               Fixed an ugly bug in WriteString().
  2917. X *               New command: 'process'
  2918. X * 16.11.92 -- 3.02.17 Nuking unsent tty output is now optional, (toxic 
  2919. X *               ESC radiation). 
  2920. X * 30.11.92 -- 3.02.18 Lots of multi display bugs fixed. New layer
  2921. X *               function 'Restore'. MULTIUSER code cleanup.
  2922. X *               Rudimental acls added for multiuser.
  2923. X *                     No more error output, when output gives write errors.
  2924. X * 02.12.92 -- 3.02.19 BROKEN_PIPE and SOCK_NOT_IN_FS defines added for 
  2925. X *                     braindead systems. Bug in recover socket code fixed.
  2926. X *                     Can create windows again from shell.
  2927. X * 22.12.92 -- 3.02.20 Made a superb configure script. STY and break fixed.
  2928. X * 01.02.93 -- 3.02.21 Coredump bug fixed: 8-bit output in background windows.
  2929. X *                     Console grabbing somewhat more useable.
  2930. X * 23.02.93 -- 3.02.22 Added ^:exec command, but not tested at all.
  2931. X * 23.02.93 -- 3.02.23 Added 'hardcopydir' and 'logdir' commands.
  2932. X * 11.03.93 -- 3.02.24 Prefixed display and window structure elements.
  2933. X *                     Screen now handles autowrapped lines correctly
  2934. X *                     in the redisplay and mark function.
  2935. X * 19.03.93 -- 3.03.00 Patched for BSD386. pseudos work.
  2936. X * 31.03.93 -- 3.03.01 Don't allocate so much empty attr and font lines.
  2937. X * 04.04.93 -- 3.03.02 fixed :exec !..| less and :|less, patched BELL_DONE & 
  2938. X *                     ^B/^F. Fixed auto_nuke attribute resetting. Better linux 
  2939. X *                     configure. ^AW shows '&' when window has other attacher.
  2940. X *                     MAXWIN > 10 patch. KEEP_UNDEF in config.h.in, shellaka 
  2941. X *                     bug fixed. dec alpha port. Solaris port. 
  2942. X * 02.05.93 -- 3.03.03 Configure tweaked for sgi. Update environment with 
  2943. X *                     setenv command. Silence on|off, silencewait <sec>, 
  2944. X *                     defautonuke commands added. Manual page updated.
  2945. X * 13.05.93 -- 3.03.04 exit in newsyntax script, finished _CX_UX port.
  2946. X *                     Texinfo page added by Jason Merrill. Much longish debug 
  2947. X *                     output removed. Select window by title (or number).
  2948. X * 16.06.93 -- 3.04.00 Replaced ^A- by ^A^H to be complementary to ^A SPACE.
  2949. X *                     Moved into CVS. Yacc.
  2950. X * 28.06.93 -- 3.04.01 Fixed selecting windows with numeric title. Silence 
  2951. X *                     now works without nethackoption set.
  2952. X * 01.07.93 -- 3.04.02 Implementing real acls.
  2953. X * 22.07.93 -- 3.05.00 Fixed SVR4, some multiuser bugs, -- DISTRIBUTED
  2954. X */
  2955. X
  2956. X#define ORIGIN "FAU"
  2957. X#define REV 3
  2958. X#define VERS 5
  2959. X#define PATCHLEVEL 0
  2960. X#define DATE "22-Jul-93"
  2961. X#define STATE "" 
  2962. END_OF_FILE
  2963. if test 7442 -ne `wc -c <'patchlevel.h'`; then
  2964.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  2965. fi
  2966. # end of 'patchlevel.h'
  2967. fi
  2968. if test -f 'resize.c' -a "${1}" != "-c" ; then 
  2969.   echo shar: Will not clobber existing file \"'resize.c'\"
  2970. else
  2971. echo shar: Extracting \"'resize.c'\" \(13707 characters\)
  2972. sed "s/^X//" >'resize.c' <<'END_OF_FILE'
  2973. X/* Copyright (c) 1993
  2974. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  2975. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  2976. X * Copyright (c) 1987 Oliver Laumann
  2977. X *
  2978. X * This program is free software; you can redistribute it and/or modify
  2979. X * it under the terms of the GNU General Public License as published by
  2980. X * the Free Software Foundation; either version 2, or (at your option)
  2981. X * any later version.
  2982. X *
  2983. X * This program is distributed in the hope that it will be useful,
  2984. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2985. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  2986. X * GNU General Public License for more details.
  2987. X *
  2988. X * You should have received a copy of the GNU General Public License
  2989. X * along with this program (see the file COPYING); if not, write to the
  2990. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2991. X *
  2992. X ****************************************************************
  2993. X */
  2994. X
  2995. X#include "rcs.h"
  2996. XRCS_ID("$Id: resize.c,v 1.2 1993/06/23 22:49:14 mlschroe Exp $ FAU")
  2997. X
  2998. X#include <stdio.h>
  2999. X#include <sys/types.h>
  3000. X#include <signal.h>
  3001. X#ifndef sun
  3002. X#include <sys/ioctl.h>
  3003. X#endif
  3004. X
  3005. X#ifdef ISC
  3006. X# include <sys/tty.h>
  3007. X# include <sys/sioctl.h>
  3008. X# include <sys/pty.h>
  3009. X#endif
  3010. X
  3011. X#include "config.h"
  3012. X#include "screen.h"
  3013. X#include "extern.h"
  3014. X
  3015. Xstatic void CheckMaxSize __P((int));
  3016. Xstatic int ResizeScreenArray __P((struct win *, char ***, int, int, int));
  3017. Xstatic void FreeArray __P((char ***, int));
  3018. X#ifdef COPY_PASTE
  3019. Xstatic int ResizeHistArray __P((struct win *, char ***, int, int, int));
  3020. Xstatic void FreeScrollback __P((struct win *));
  3021. X#endif
  3022. X
  3023. Xextern int maxwidth;
  3024. Xextern struct display *display, *displays;
  3025. Xextern char *blank, *null, *OldImage, *OldAttr;
  3026. Xextern char *OldFont;
  3027. Xextern struct win *windows;
  3028. Xextern int Z0width, Z1width;
  3029. X
  3030. X#ifdef NETHACK
  3031. Xextern int nethackflag;
  3032. X#endif
  3033. X
  3034. X#if defined(TIOCGWINSZ) || defined(TIOCSWINSZ)
  3035. X  struct winsize glwz;
  3036. X#endif
  3037. X
  3038. X/*
  3039. X * ChangeFlag:   0: try to modify no window
  3040. X *               1: modify fore (and try to modify no d_other) + redisplay
  3041. X *               2: modify all windows
  3042. X *
  3043. X * Note: Activate() is only called if change_flag == 1
  3044. X *       i.e. on a WINCH event
  3045. X */
  3046. X
  3047. Xvoid
  3048. XCheckScreenSize(change_flag)
  3049. Xint change_flag;
  3050. X{
  3051. X  int wi, he;
  3052. X  struct win *p;
  3053. X  struct layer *oldlay;
  3054. X
  3055. X  if (display == 0)
  3056. X    {
  3057. X      debug("CheckScreenSize: No display -> no check.\n");
  3058. X      return;
  3059. X    }
  3060. X  oldlay = d_lay;
  3061. X#ifdef TIOCGWINSZ
  3062. X  if (ioctl(d_userfd, TIOCGWINSZ, &glwz) != 0)
  3063. X    {
  3064. X      debug2("CheckScreenSize: ioctl(%d, TIOCGWINSZ) errno %d\n", d_userfd, errno);
  3065. X      wi = CO;
  3066. X      he = LI;
  3067. X    }
  3068. X  else
  3069. X    {
  3070. X      wi = glwz.ws_col;
  3071. X      he = glwz.ws_row;
  3072. X      if (wi == 0)
  3073. X        wi = CO;
  3074. X      if (he == 0)
  3075. X        he = LI;
  3076. X    }
  3077. X#else
  3078. X  wi = CO;
  3079. X  he = LI;
  3080. X#endif
  3081. X  
  3082. X  debug2("CheckScreenSize: screen is (%d,%d)\n", wi, he);
  3083. X
  3084. X  if (change_flag == 2)
  3085. X    {
  3086. X      debug("Trying to adapt all windows (-A)\n");
  3087. X      for (p = windows; p; p = p->w_next)
  3088. X    if (p->w_display == 0 || p->w_display == display)
  3089. X          ChangeWindowSize(p, wi, he);
  3090. X    }
  3091. X  if (d_width == wi && d_height == he)
  3092. X    {
  3093. X      debug("CheckScreenSize: No change -> return.\n");
  3094. X      return;
  3095. X    }
  3096. X  ChangeScreenSize(wi, he, change_flag);
  3097. X  if (change_flag == 1)
  3098. X    Activate(d_fore ? d_fore->w_norefresh : 0);
  3099. X  if (d_lay != oldlay)
  3100. X    {
  3101. X#ifdef NETHACK
  3102. X      if (nethackflag)
  3103. X    Msg(0, "KAABLAMM!!!  You triggered a land mine!");
  3104. X      else
  3105. X#endif
  3106. X      Msg(0, "Aborted because of window size change.");
  3107. X    }
  3108. X}
  3109. X
  3110. Xvoid
  3111. XChangeScreenSize(wi, he, change_fore)
  3112. Xint wi, he;
  3113. Xint change_fore;
  3114. X{
  3115. X  struct win *p;
  3116. X  int wwi;
  3117. X
  3118. X  if (d_width == wi && d_height == he)
  3119. X    {
  3120. X      debug("ChangeScreenSize: no change\n");
  3121. X      return;
  3122. X    }
  3123. X  debug2("ChangeScreenSize from (%d,%d) ", d_width, d_height);
  3124. X  debug3("to (%d,%d) (change_fore: %d)\n",wi, he, change_fore);
  3125. X  d_width = wi;
  3126. X  d_height = he;
  3127. X
  3128. X  CheckMaxSize(wi);
  3129. X  if (CWS)
  3130. X    {
  3131. X      d_defwidth = CO;
  3132. X      d_defheight = LI;
  3133. X    }
  3134. X  else
  3135. X    {
  3136. X      if (CZ0 && (wi == Z0width || wi == Z1width) &&
  3137. X          (CO == Z0width || CO == Z1width))
  3138. X        d_defwidth = CO;
  3139. X      else
  3140. X        d_defwidth = wi;
  3141. X      d_defheight = he;
  3142. X    }
  3143. X  debug2("Default size: (%d,%d)\n", d_defwidth, d_defheight);
  3144. X  if (change_fore)
  3145. X    DoResize(wi, he);
  3146. X  if (CWS == NULL && displays->_d_next == 0)
  3147. X    {
  3148. X      /* adapt all windows  -  to be removed ? */
  3149. X      for (p = windows; p; p = p->w_next)
  3150. X        {
  3151. X          debug1("Trying to change window %d.\n", p->w_number);
  3152. X          wwi = wi;
  3153. X          if (CZ0 && (wi == Z0width || wi == Z1width))
  3154. X        {
  3155. X          if (p->w_width > (Z0width + Z1width) / 2)
  3156. X        wwi = Z0width;
  3157. X          else
  3158. X        wwi = Z1width;
  3159. X        }
  3160. X          ChangeWindowSize(p, wwi, he);
  3161. X        }
  3162. X    }
  3163. X}
  3164. X
  3165. Xvoid
  3166. XDoResize(wi, he)
  3167. Xint wi, he;
  3168. X{
  3169. X  struct layer *oldlay;
  3170. X  int q = 0;
  3171. X
  3172. X  for(;;)
  3173. X    {
  3174. X      oldlay = d_lay;
  3175. X      for (; d_lay; d_lay = d_lay->l_next)
  3176. X    {
  3177. X      d_layfn = d_lay->l_layfn;
  3178. X      if ((q = Resize(wi, he)))
  3179. X        break;
  3180. X    }
  3181. X      d_lay = oldlay;
  3182. X      d_layfn = d_lay->l_layfn;
  3183. X      if (q == 0)
  3184. X    break;
  3185. X      ExitOverlayPage();
  3186. X    }
  3187. X}
  3188. X
  3189. X#ifdef COPY_PASTE
  3190. X
  3191. Xint
  3192. XChangeScrollback(p, histheight, histwidth)
  3193. Xstruct win *p;
  3194. Xint histheight, histwidth;
  3195. X{
  3196. X  if (histheight > MAXHISTHEIGHT)
  3197. X    histheight = MAXHISTHEIGHT;
  3198. X  debug2("ChangeScrollback(..., %d, %d)\n", histheight, histwidth);
  3199. X  debug2("  was %d, %d\n", p->w_histheight, p->w_width);
  3200. X
  3201. X  if (histheight == 0)
  3202. X    {
  3203. X      FreeScrollback(p);
  3204. X      return 0;
  3205. X    }
  3206. X
  3207. X  if (ResizeHistArray(p, &p->w_ihist, histwidth, histheight, 1)
  3208. X      || ResizeHistArray(p, &p->w_ahist, histwidth, histheight, 0)
  3209. X      || ResizeHistArray(p, &p->w_fhist, histwidth, histheight, 0))
  3210. X    {
  3211. X      debug("   failed, removing all histbuf\n");
  3212. X      FreeScrollback(p);
  3213. X      Msg(0, strnomem);
  3214. X      return -1;
  3215. X    }
  3216. X  if (p->w_histheight != histheight)
  3217. X    p->w_histidx = 0;
  3218. X  p->w_histheight = histheight;
  3219. X
  3220. X  return 0;
  3221. X}
  3222. X
  3223. Xstatic void
  3224. XFreeScrollback(p)
  3225. Xstruct win *p;
  3226. X{
  3227. X  FreeArray(&p->w_ihist, p->w_histheight);
  3228. X  FreeArray(&p->w_ahist, p->w_histheight);
  3229. X  FreeArray(&p->w_fhist, p->w_histheight);
  3230. X  p->w_histheight = 0;
  3231. X}
  3232. X
  3233. Xstatic int
  3234. XResizeHistArray(p, arr, wi, hi, fillblank)
  3235. Xstruct win *p;
  3236. Xchar ***arr;
  3237. Xint wi, hi, fillblank;
  3238. X{
  3239. X  char **narr, **np, **onp, **onpe;
  3240. X  int t, x, first;
  3241. X
  3242. X  if (p->w_width == wi && p->w_histheight == hi)
  3243. X    return(0);
  3244. X  if (p->w_histheight != hi)
  3245. X    {
  3246. X      if ((narr = (char **)calloc(sizeof(char *), hi)) == NULL)
  3247. X    {
  3248. X      FreeArray(arr, p->w_histheight);
  3249. X      return(-1);
  3250. X    }
  3251. X      np = narr;
  3252. X      onp = (*arr) + p->w_histidx;
  3253. X      onpe = (*arr) + p->w_histheight;
  3254. X      first = p->w_histheight - hi;
  3255. X      if (first < 0)
  3256. X     np -= first;
  3257. X      for(t = 0; t < p->w_histheight; t++)
  3258. X    {
  3259. X      ASSERT(*onp);
  3260. X          if (t - first >= 0 && t - first < hi)
  3261. X        *np++ = *onp;
  3262. X      else if (*onp != null)
  3263. X        free(*onp);
  3264. X      if (++onp == onpe)
  3265. X        onp = *arr;
  3266. X    }
  3267. X      if (*arr)
  3268. X    free(*arr);
  3269. X    }
  3270. X  else
  3271. X    narr = *arr;
  3272. X  for (t=0, np=narr; t < hi; t++, np++)
  3273. X    {
  3274. X      if ((!fillblank && *np == 0) || *np == null)
  3275. X    {
  3276. X      *np = null;
  3277. X      continue;
  3278. X    }
  3279. X      x = p->w_width;
  3280. X      if (*np == 0)
  3281. X    {
  3282. X      *np = (char *)malloc(wi + 1);
  3283. X          x = 0;
  3284. X    }
  3285. X      else if (p->w_width != wi)
  3286. X    {
  3287. X      *np = (char *)xrealloc(*np, wi + 1);
  3288. X    }
  3289. X      if (*np == 0)
  3290. X    {
  3291. X      FreeArray(&narr, hi);
  3292. X      return -1;
  3293. X    }
  3294. X      if (x > wi)
  3295. X    x = wi;
  3296. X      if (fillblank)
  3297. X    bclear(*np + x, wi + 1 - x);
  3298. X      else
  3299. X    bzero(*np + x, wi + 1 - x);
  3300. X    }
  3301. X  *arr = narr;
  3302. X  return 0;
  3303. X}
  3304. X#endif /* COPY_PASTE */
  3305. X      
  3306. X
  3307. Xstatic int
  3308. XResizeScreenArray(p, arr, wi, hi, fillblank)
  3309. Xstruct win *p;
  3310. Xchar ***arr;
  3311. Xint wi, hi, fillblank;
  3312. X{
  3313. X  int minr;
  3314. X  char **cp;
  3315. X
  3316. X  if (p->w_width == wi && p->w_height == hi)
  3317. X    return(0);
  3318. X
  3319. X  if (hi > p->w_height)
  3320. X    minr = p->w_height;
  3321. X  else
  3322. X    minr = hi;
  3323. X
  3324. X  if (p->w_height > hi)
  3325. X    {
  3326. X      for (cp = *arr; cp < *arr + (p->w_height - hi); cp++)
  3327. X        if (*cp != null)
  3328. X      free(*cp);
  3329. X      bcopy((char *)(*arr + (p->w_height - hi)), (char *)(*arr),
  3330. X        hi * sizeof(char *));
  3331. X    }
  3332. X  if (*arr && p->w_width != wi)
  3333. X    for (cp = *arr; cp < *arr + minr; cp++)
  3334. X      {
  3335. X    int x = p->w_width;
  3336. X
  3337. X    if (*cp == null)
  3338. X      continue;
  3339. X    if ((*cp = (char *)xrealloc(*cp, (unsigned) wi + 1)) == 0)
  3340. X      {
  3341. X        FreeArray(arr, p->w_height);
  3342. X        return(-1);
  3343. X      }
  3344. X    if (x > wi)
  3345. X      x = wi;
  3346. X    if (fillblank)
  3347. X      bclear(*cp + x, wi + 1 - x);
  3348. X    else
  3349. X      bzero(*cp + x, wi + 1 - x);
  3350. X      }
  3351. X  if (*arr)
  3352. X    *arr = (char **) xrealloc((char *) *arr, (unsigned) hi * sizeof(char *));
  3353. X  else
  3354. X    *arr = (char **) malloc((unsigned) hi * sizeof(char *));
  3355. X  if (*arr == NULL)
  3356. X    return -1;
  3357. X  for (cp = *arr + p->w_height; cp < *arr + hi; cp++)
  3358. X    {
  3359. X      if (!fillblank)
  3360. X    {
  3361. X      *cp = null;
  3362. X      continue;
  3363. X    }
  3364. X      if ((*cp = malloc((unsigned) wi + 1)) == 0)
  3365. X    {
  3366. X      while (--cp >= *arr)
  3367. X        free(*cp);
  3368. X      free(*arr);
  3369. X      *arr = NULL;
  3370. X          return -1;
  3371. X    }
  3372. X      bclear(*cp, wi + 1);
  3373. X    }
  3374. X  return 0;
  3375. X}
  3376. X
  3377. Xstatic void
  3378. XFreeArray(arr, hi)
  3379. Xchar ***arr;
  3380. Xint hi;
  3381. X{
  3382. X  register char **p;
  3383. X  register int t;
  3384. X
  3385. X  if (*arr == 0)
  3386. X    return;
  3387. X  for (t = hi, p = *arr; t--; p++)
  3388. X    if (*p && *p != null)
  3389. X      free(*p);
  3390. X  free(*arr);
  3391. X  *arr = 0;
  3392. X}
  3393. X
  3394. X
  3395. Xstatic void
  3396. XCheckMaxSize(wi)
  3397. Xint wi;
  3398. X{
  3399. X  char *oldnull = null;
  3400. X  struct win *p;
  3401. X  int i;
  3402. X
  3403. X  wi = ((wi + 1) + 255) & ~255;
  3404. X  if (wi <= maxwidth)
  3405. X    return;
  3406. X  maxwidth = wi;
  3407. X  debug1("New maxwidth: %d\n", maxwidth);
  3408. X  if (blank == 0)
  3409. X    blank = malloc((unsigned) maxwidth);
  3410. X  else
  3411. X    blank = xrealloc(blank, (unsigned) maxwidth);
  3412. X  if (null == 0)
  3413. X    null = malloc((unsigned) maxwidth);
  3414. X  else
  3415. X    null = xrealloc(null, (unsigned) maxwidth);
  3416. X  if (OldImage == 0)
  3417. X    OldImage = malloc((unsigned) maxwidth);
  3418. X  else
  3419. X    OldImage = xrealloc(OldImage, (unsigned) maxwidth);
  3420. X  if (OldAttr == 0)
  3421. X    OldAttr = malloc((unsigned) maxwidth);
  3422. X  else
  3423. X    OldAttr = xrealloc(OldAttr, (unsigned) maxwidth);
  3424. X  if (OldFont == 0)
  3425. X    OldFont = malloc((unsigned) maxwidth);
  3426. X  else
  3427. X    OldFont = xrealloc(OldFont, (unsigned) maxwidth);
  3428. X  if (!(blank && null && OldImage && OldAttr && OldFont))
  3429. X    {
  3430. X      Panic(0, "Out of memory -> Game over!!");
  3431. X      /*NOTREACHED*/
  3432. X    }
  3433. X  MakeBlankLine(blank, maxwidth);
  3434. X  bzero(null, maxwidth);
  3435. X
  3436. X  /* We have to run through all windows to substitute
  3437. X   * the null references.
  3438. X   */
  3439. X  for (p = windows; p; p = p->w_next)
  3440. X    {
  3441. X      for (i = 0; i < p->w_height; i++)
  3442. X    {
  3443. X      if (p->w_attr[i] == oldnull)
  3444. X        p->w_attr[i] = null;
  3445. X      if (p->w_font[i] == oldnull)
  3446. X        p->w_font[i] = null;
  3447. X    }
  3448. X#ifdef COPY_PASTE
  3449. X      for (i = 0; i < p->w_histheight; i++)
  3450. X    {
  3451. X      if (p->w_ahist[i] == oldnull)
  3452. X        p->w_ahist[i] = null;
  3453. X      if (p->w_fhist[i] == oldnull)
  3454. X        p->w_fhist[i] = null;
  3455. X    }
  3456. X#endif
  3457. X    }
  3458. X}
  3459. X
  3460. X
  3461. Xint
  3462. XChangeWindowSize(p, wi, he)
  3463. Xstruct win *p;
  3464. Xint wi, he;
  3465. X{
  3466. X  int t, scr;
  3467. X  
  3468. X  CheckMaxSize(wi);
  3469. X  
  3470. X  if (wi == p->w_width && he == p->w_height)
  3471. X    {
  3472. X      debug("ChangeWindowSize: No change.\n");
  3473. X      return 0;
  3474. X    }
  3475. X
  3476. X  debug2("ChangeWindowSize from (%d,%d) to ", p->w_width, p->w_height);
  3477. X  debug2("(%d,%d)\n", wi, he);
  3478. X  if (p->w_lay != &p->w_winlay)
  3479. X    {
  3480. X      debug("ChangeWindowSize: No resize because of overlay.\n");
  3481. X      return -1;
  3482. X    }
  3483. X  if (wi == 0 && he == 0)
  3484. X    {
  3485. X      FreeArray(&p->w_image, p->w_height);
  3486. X      FreeArray(&p->w_attr, p->w_height);
  3487. X      FreeArray(&p->w_font, p->w_height);
  3488. X      if (p->w_tabs)
  3489. X    free(p->w_tabs);
  3490. X      p->w_tabs = NULL;
  3491. X      p->w_width = 0;
  3492. X      p->w_height = 0;
  3493. X#ifdef COPY_PASTE
  3494. X      FreeScrollback(p);
  3495. X#endif
  3496. X      return 0;
  3497. X    }
  3498. X
  3499. X  /* when window gets smaller, scr is the no. of lines we scroll up */
  3500. X  scr = p->w_height - he;
  3501. X  if (scr < 0)
  3502. X    scr = 0;
  3503. X#ifdef COPY_PASTE
  3504. X  for (t = 0; t < scr; t++)
  3505. X    AddLineToHist(p, p->w_image+t, p->w_attr+t, p->w_font+t); 
  3506. X#endif
  3507. X  if (ResizeScreenArray(p, &p->w_image, wi, he, 1)
  3508. X      || ResizeScreenArray(p, &p->w_attr, wi, he, 0)
  3509. X      || ResizeScreenArray(p, &p->w_font, wi, he, 0))
  3510. X    {
  3511. Xnomem:      KillWindow(p);
  3512. X      Msg(0, "Out of memory -> Window destroyed !!");
  3513. X      return -1;
  3514. X    }
  3515. X  /* this won't change the d_height of the scrollback history buffer, but
  3516. X   * it will check the d_width of the lines.
  3517. X   */
  3518. X#ifdef COPY_PASTE
  3519. X  ChangeScrollback(p, p->w_histheight, wi);
  3520. X#endif
  3521. X
  3522. X  if (p->w_tabs == 0)
  3523. X    {
  3524. X      /* tabs get d_width+1 because 0 <= x <= wi */
  3525. X      if ((p->w_tabs = malloc((unsigned) wi + 1)) == 0)
  3526. X        goto nomem;
  3527. X      t = 8;
  3528. X    }
  3529. X  else
  3530. X    {
  3531. X      if ((p->w_tabs = xrealloc(p->w_tabs, (unsigned) wi + 1)) == 0)
  3532. X        goto nomem;
  3533. X      t = p->w_width;
  3534. X    }
  3535. X  for (t = (t + 7) & 8; t < wi; t += 8)
  3536. X    p->w_tabs[t] = 1; 
  3537. X  p->w_height = he;
  3538. X  p->w_width = wi;
  3539. X  if (p->w_x >= wi)
  3540. X    p->w_x = wi - 1;
  3541. X  if ((p->w_y -= scr) < 0)
  3542. X    p->w_y = 0;
  3543. X  if (p->w_Saved_x >= wi)
  3544. X    p->w_Saved_x = wi - 1;
  3545. X  if ((p->w_Saved_y -= scr) < 0)
  3546. X    p->w_Saved_y = 0;
  3547. X  if (p->w_autoaka > 0) 
  3548. X    if ((p->w_autoaka -= scr) < 1)
  3549. X      p->w_autoaka = 1;
  3550. X  p->w_top = 0;
  3551. X  p->w_bot = he - 1;
  3552. X#ifdef TIOCSWINSZ
  3553. X  if (p->w_ptyfd && p->w_pid)
  3554. X    {
  3555. X      glwz.ws_col = wi;
  3556. X      glwz.ws_row = he;
  3557. X      debug("Setting pty winsize.\n");
  3558. X      if (ioctl(p->w_ptyfd, TIOCSWINSZ, &glwz))
  3559. X    debug2("SetPtySize: errno %d (fd:%d)\n", errno, p->w_ptyfd);
  3560. X# if defined(STUPIDTIOCSWINSZ) && defined(SIGWINCH)
  3561. X#  ifdef POSIX
  3562. X      pgrp = tcgetpgrp(p->w_ptyfd);
  3563. X#  else /* POSIX */
  3564. X      if (ioctl(p->w_ptyfd, TIOCGPGRP, &pgrp))
  3565. X    pgrp = 0;
  3566. X#  endif /* POSIX */
  3567. X      if (pgrp)
  3568. X    {
  3569. X      debug1("Sending SIGWINCH to pgrp %d.\n", pgrp);
  3570. X      if (killpg(pgrp, SIGWINCH))
  3571. X        debug1("killpg: errno %d\n", errno);
  3572. X    }
  3573. X      else
  3574. X    debug1("Could not get pgrp: errno %d\n", errno);
  3575. X# endif /* STUPIDTIOCSWINSZ */
  3576. X    }
  3577. X#endif /* TIOCSWINSZ */
  3578. X  return 0;
  3579. X}
  3580. X
  3581. X
  3582. Xchar *
  3583. Xxrealloc(mem, len)
  3584. Xchar *mem;
  3585. Xint len;
  3586. X{
  3587. X  register char *nmem;
  3588. X
  3589. X  if ((nmem = realloc(mem, len)))
  3590. X    return(nmem);
  3591. X  free(mem);
  3592. X  return((char *)0);
  3593. X}
  3594. END_OF_FILE
  3595. if test 13707 -ne `wc -c <'resize.c'`; then
  3596.     echo shar: \"'resize.c'\" unpacked with wrong size!
  3597. fi
  3598. # end of 'resize.c'
  3599. fi
  3600. if test -f 'search.c' -a "${1}" != "-c" ; then 
  3601.   echo shar: Will not clobber existing file \"'search.c'\"
  3602. else
  3603. echo shar: Extracting \"'search.c'\" \(7998 characters\)
  3604. sed "s/^X//" >'search.c' <<'END_OF_FILE'
  3605. X/* Copyright (c) 1993
  3606. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  3607. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  3608. X * Copyright (c) 1987 Oliver Laumann
  3609. X *
  3610. X * This program is free software; you can redistribute it and/or modify
  3611. X * it under the terms of the GNU General Public License as published by
  3612. X * the Free Software Foundation; either version 2, or (at your option)
  3613. X * any later version.
  3614. X *
  3615. X * This program is distributed in the hope that it will be useful,
  3616. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3617. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3618. X * GNU General Public License for more details.
  3619. X *
  3620. X * You should have received a copy of the GNU General Public License
  3621. X * along with this program (see the file COPYING); if not, write to the
  3622. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  3623. X *
  3624. X ****************************************************************
  3625. X */
  3626. X
  3627. X#include "rcs.h"
  3628. XRCS_ID("$Id: search.c,v 1.1.1.1 1993/06/16 23:51:17 jnweiger Exp $ FAU")
  3629. X
  3630. X#include <sys/types.h>
  3631. X
  3632. X#include "config.h"
  3633. X#include "screen.h"
  3634. X#include "mark.h"
  3635. X#include "extern.h"
  3636. X
  3637. X#ifdef COPY_PASTE
  3638. X
  3639. Xextern struct win *fore;
  3640. Xextern struct display *display;
  3641. X
  3642. X/********************************************************************
  3643. X *  VI style Search
  3644. X */
  3645. X
  3646. Xstatic int  matchword __P((char *, int, int, int));
  3647. Xstatic void searchend __P((char *, int));
  3648. Xstatic void backsearchend __P((char *, int));
  3649. X
  3650. Xvoid
  3651. XSearch(dir)
  3652. Xint dir;
  3653. X{
  3654. X  struct markdata *markdata;
  3655. X  if (dir == 0)
  3656. X    {
  3657. X      markdata = (struct markdata *)d_lay->l_data;
  3658. X      if (markdata->isdir > 0)
  3659. X    searchend(0, 0);
  3660. X      else if (markdata->isdir < 0)
  3661. X    backsearchend(0, 0);
  3662. X      else
  3663. X    Msg(0, "No previous pattern");
  3664. X    }
  3665. X  else
  3666. X    Input((dir > 0 ? "/" : "?"), sizeof(markdata->isstr)-1, (dir > 0 ? searchend : backsearchend), INP_COOKED);
  3667. X}
  3668. X
  3669. Xstatic void
  3670. Xsearchend(buf, len)
  3671. Xchar *buf;
  3672. Xint len;
  3673. X{
  3674. X  int x = 0, sx, ex, y;
  3675. X  struct markdata *markdata;
  3676. X
  3677. X  markdata = (struct markdata *)d_lay->l_data;
  3678. X  markdata->isdir = 1;
  3679. X  if (len)
  3680. X    strcpy(markdata->isstr, buf);
  3681. X  sx = markdata->cx + 1;
  3682. X  ex = d_width - 1;
  3683. X  for (y = markdata->cy; y < fore->w_histheight + d_height; y++, sx = 0)
  3684. X    {
  3685. X      if ((x = matchword(markdata->isstr, y, sx, ex)) >= 0)
  3686. X        break;
  3687. X    }
  3688. X  if (y >= fore->w_histheight + d_height)
  3689. X    {
  3690. X      GotoPos(markdata->cx, W2D(markdata->cy));
  3691. X      Msg(0, "Pattern not found");
  3692. X    }
  3693. X  else
  3694. X    revto(x, y);
  3695. X}
  3696. X
  3697. Xstatic void
  3698. Xbacksearchend(buf, len)
  3699. Xchar *buf;
  3700. Xint len;
  3701. X{
  3702. X  int sx, ex, x = -1, y;
  3703. X  struct markdata *markdata;
  3704. X
  3705. X  markdata = (struct markdata *)d_lay->l_data;
  3706. X  markdata->isdir = -1;
  3707. X  if (len)
  3708. X    strcpy(markdata->isstr, buf);
  3709. X  ex = markdata->cx - 1;
  3710. X  for (y = markdata->cy; y >= 0; y--, ex = d_width - 1)
  3711. X    {
  3712. X      sx = 0;
  3713. X      while ((sx = matchword(markdata->isstr, y, sx, ex)) >= 0)
  3714. X    x = sx++;
  3715. X      if (x >= 0)
  3716. X    break;
  3717. X    }
  3718. X  if (y < 0)
  3719. X    {
  3720. X      GotoPos(markdata->cx, W2D(markdata->cy));
  3721. X      Msg(0, "Pattern not found");
  3722. X    }
  3723. X  else
  3724. X    revto(x, y);
  3725. X}
  3726. X
  3727. Xstatic int
  3728. Xmatchword(pattern, y, sx, ex)
  3729. Xchar *pattern;
  3730. Xint y, sx, ex;
  3731. X{
  3732. X  char *ip, *ipe, *cp, *pp;
  3733. X
  3734. X  ip = iWIN(y) + sx;
  3735. X  ipe = iWIN(y) + d_width;
  3736. X  for (;sx <= ex; sx++)
  3737. X    {
  3738. X      cp = ip++;
  3739. X      pp = pattern;
  3740. X      while (*cp++ == *pp++)
  3741. X    if (*pp == 0)
  3742. X      return sx;
  3743. X    else if (cp == ipe)
  3744. X      break;
  3745. X    }
  3746. X  return -1;
  3747. X}
  3748. X
  3749. X
  3750. X/********************************************************************
  3751. X *  Emacs style ISearch
  3752. X */
  3753. X
  3754. Xstatic char *isprompts[] = {
  3755. X  "I-search backward: ", "failing I-search backward: ",
  3756. X  "I-search: ", "failing I-search: "
  3757. X};
  3758. X
  3759. X
  3760. Xstatic int  is_redo __P((struct markdata *));
  3761. Xstatic void is_process __P((char *, int));
  3762. Xstatic int  is_bm __P((char *, int, int, int, int));
  3763. X
  3764. X
  3765. Xstatic int
  3766. Xis_bm(str, l, p, end, dir)
  3767. Xchar *str;
  3768. Xint l, p, end, dir;
  3769. X{
  3770. X  int tab[256];
  3771. X  int i, q;
  3772. X  char *s, c;
  3773. X  int w = d_width;
  3774. X
  3775. X  debug2("is_bm: searching for %s len %d\n", str, l);
  3776. X  debug3("start at %d end %d dir %d\n", p, end, dir);
  3777. X  if (p < 0 || p + l > end)
  3778. X    return -1;
  3779. X  if (l == 0)
  3780. X    return p;
  3781. X  if (dir < 0)
  3782. X    str += l - 1;
  3783. X  for (i = 0; i < 256; i++)
  3784. X    tab[i] = l * dir;
  3785. X  for (i = 0; i < l - 1; i++, str += dir)
  3786. X    tab[(int)(unsigned char) *str] = (l - 1 - i) * dir;
  3787. X  if (dir > 0)
  3788. X    p += l - 1;
  3789. X  debug1("first char to match: %c\n", *str);
  3790. X  while (p >= 0 && p < end)
  3791. X    {
  3792. X      q = p;
  3793. X      s = str;
  3794. X      for (i = 0;;)
  3795. X    {
  3796. X          c = iWIN(q / w)[q % w];
  3797. X      if (i == 0)
  3798. X            p += tab[(int)(unsigned char) c];
  3799. X      if (c != *s)
  3800. X        break;
  3801. X      q -= dir;
  3802. X      s -= dir;
  3803. X      if (++i == l)
  3804. X        return q + (dir > 0 ? 1 : -l);
  3805. X    }
  3806. X    }
  3807. X  return -1;
  3808. X}
  3809. X
  3810. X
  3811. X/*ARGSUSED*/
  3812. Xstatic void
  3813. Xis_process(p, n)
  3814. Xchar *p;
  3815. Xint n;
  3816. X{
  3817. X  int pos, x, y, dir;
  3818. X  struct markdata *markdata;
  3819. X
  3820. X  if (n == 0)
  3821. X    return;
  3822. X  markdata = (struct markdata *)d_lay->l_next->l_data;
  3823. X  ASSERT(p);
  3824. X
  3825. X  pos = markdata->cx + markdata->cy * d_width;
  3826. X  GotoPos(markdata->cx, W2D(markdata->cy));
  3827. X
  3828. X  switch (*p)
  3829. X    {
  3830. X    case '\007':    /* CTRL-G */
  3831. X      pos = markdata->isstartpos;
  3832. X      /*FALLTHROUGH*/
  3833. X    case '\033':    /* ESC */
  3834. X      *p = 0;
  3835. X      break;
  3836. X    case '\013':    /* CTRL-K */
  3837. X    case '\027':    /* CTRL-W */
  3838. X      markdata->isistrl = 1;
  3839. X      /*FALLTHROUGH*/
  3840. X    case '\b':
  3841. X    case '\177':
  3842. X      if (markdata->isistrl == 0)
  3843. X    return;
  3844. X      markdata->isistrl--;
  3845. X      pos = is_redo(markdata);
  3846. X      *p = '\b';
  3847. X      break;
  3848. X    case '\023':    /* CTRL-S */
  3849. X    case '\022':     /* CTRL-R */
  3850. X      if (markdata->isistrl >= sizeof(markdata->isistr))
  3851. X    return;
  3852. X      dir = (*p == '\023') ? 1 : -1;
  3853. X      pos += dir;
  3854. X      if (markdata->isdir == dir && markdata->isistrl == 0)
  3855. X    {
  3856. X      strcpy(markdata->isistr, markdata->isstr);
  3857. X      markdata->isistrl = markdata->isstrl = strlen(markdata->isstr);
  3858. X      break;
  3859. X    }
  3860. X      markdata->isdir = dir;
  3861. X      markdata->isistr[markdata->isistrl++] = *p;
  3862. X      break;
  3863. X    default:
  3864. X      if (*p < ' ' || markdata->isistrl >= sizeof(markdata->isistr)
  3865. X      || markdata->isstrl >= sizeof(markdata->isstr) - 1)
  3866. X    return;
  3867. X      markdata->isstr[markdata->isstrl++] = *p;
  3868. X      markdata->isistr[markdata->isistrl++] = *p;
  3869. X      markdata->isstr[markdata->isstrl] = 0;
  3870. X      debug2("New char: %c - left %d\n", *p, sizeof(markdata->isistr) - markdata->isistrl);
  3871. X    }
  3872. X  if (*p && *p != '\b')
  3873. X    pos = is_bm(markdata->isstr, markdata->isstrl, pos, d_width * (fore->w_histheight + d_height), markdata->isdir);
  3874. X  if (pos >= 0)
  3875. X    {
  3876. X      x = pos % d_width;
  3877. X      y = pos / d_width;
  3878. X      LAY_CALL_UP
  3879. X    (
  3880. X          RefreshLine(STATLINE, 0, d_width - 1, 0);
  3881. X          revto(x, y);
  3882. X          if (W2D(markdata->cy) == STATLINE)
  3883. X        {
  3884. X          revto_line(markdata->cx, markdata->cy, STATLINE > 0 ? STATLINE - 1 : 1);
  3885. X        }
  3886. X        );
  3887. X    }
  3888. X  if (*p)
  3889. X    inp_setprompt(isprompts[markdata->isdir + (pos < 0) + 1], markdata->isstrl ? markdata->isstr : "");
  3890. X  GotoPos(markdata->cx, W2D(markdata->cy));
  3891. X}
  3892. X
  3893. Xstatic int
  3894. Xis_redo(markdata)
  3895. Xstruct markdata *markdata;
  3896. X{
  3897. X  int i, pos, dir;
  3898. X  char c;
  3899. X
  3900. X  pos = markdata->isstartpos;
  3901. X  dir = markdata->isstartdir;
  3902. X  markdata->isstrl = 0;
  3903. X  for (i = 0; i < markdata->isistrl; i++)
  3904. X    {
  3905. X      c = markdata->isistr[i];
  3906. X      if (c == '\022')
  3907. X    pos += (dir = -1);
  3908. X      else if (c == '\023')
  3909. X    pos += (dir = 1);
  3910. X      else
  3911. X    markdata->isstr[markdata->isstrl++] = c;
  3912. X      if (pos >= 0)
  3913. X        pos = is_bm(markdata->isstr, markdata->isstrl, pos, d_width * (fore->w_histheight + d_height), dir);
  3914. X    }
  3915. X  markdata->isstr[markdata->isstrl] = 0;
  3916. X  markdata->isdir = dir;
  3917. X  return pos;
  3918. X}
  3919. X
  3920. Xvoid
  3921. XISearch(dir)
  3922. Xint dir;
  3923. X{
  3924. X  struct markdata *markdata;
  3925. X  markdata = (struct markdata *)d_lay->l_data;
  3926. X  markdata->isdir = markdata->isstartdir = dir;
  3927. X  markdata->isstartpos = markdata->cx + markdata->cy * d_width;
  3928. X  markdata->isistrl = markdata->isstrl = 0;
  3929. X  if (W2D(markdata->cy) == STATLINE)
  3930. X    {
  3931. X      revto_line(markdata->cx, markdata->cy, STATLINE > 0 ? STATLINE - 1 : 1);
  3932. X    }
  3933. X  Input(isprompts[dir + 1], sizeof(markdata->isstr) - 1, is_process, INP_RAW);
  3934. X  GotoPos(markdata->cx, W2D(markdata->cy));
  3935. X}
  3936. X
  3937. X#endif /* COPY_PASTE */
  3938. END_OF_FILE
  3939. if test 7998 -ne `wc -c <'search.c'`; then
  3940.     echo shar: \"'search.c'\" unpacked with wrong size!
  3941. fi
  3942. # end of 'search.c'
  3943. fi
  3944. echo shar: End of archive 2 \(of 10\).
  3945. cp /dev/null ark2isdone
  3946. MISSING=""
  3947. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  3948.     if test ! -f ark${I}isdone ; then
  3949.     MISSING="${MISSING} ${I}"
  3950.     fi
  3951. done
  3952. if test "${MISSING}" = "" ; then
  3953.     echo You have unpacked all 10 archives.
  3954.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  3955. else
  3956.     echo You still need to unpack the following archives:
  3957.     echo "        " ${MISSING}
  3958. fi
  3959. ##  End of shell archive.
  3960. exit 0
  3961.