home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume28 / screen32 / part05 < prev    next >
Encoding:
Text File  |  1992-02-08  |  55.0 KB  |  1,867 lines

  1. Newsgroups: comp.sources.misc
  2. From: jnweiger@immd4.informatik.uni-erlangen.de (Juergen Weigert)
  3. Subject:  v28i022:  screen-3.2 - multiple windows on an ASCII terminal, v3.2, Part05/11
  4. Message-ID: <1992Feb9.223612.6657@sparky.imd.sterling.com>
  5. X-Md4-Signature: f0ec29b1efacd75871fe316395f2c9fb
  6. Date: Sun, 9 Feb 1992 22:36:12 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jnweiger@immd4.informatik.uni-erlangen.de (Juergen Weigert)
  10. Posting-number: Volume 28, Issue 22
  11. Archive-name: screen-3.2/part05
  12. Environment: UNIX
  13.  
  14. #!/bin/sh
  15. # do not concatenate these parts, unpack them in order with /bin/sh
  16. # file screen3.2/screen.1 continued
  17. #
  18. if test ! -r _shar_seq_.tmp; then
  19.     echo 'Please unpack part 1 first!'
  20.     exit 1
  21. fi
  22. (read Scheck
  23.  if test "$Scheck" != 5; then
  24.     echo Please unpack part "$Scheck" next!
  25.     exit 1
  26.  else
  27.     exit 0
  28.  fi
  29. ) < _shar_seq_.tmp || exit 1
  30. if test ! -f _shar_wnt_.tmp; then
  31.     echo 'x - still skipping screen3.2/screen.1'
  32. else
  33. echo 'x - continuing file screen3.2/screen.1'
  34. sed 's/^X//' << 'SHAR_EOF' >> 'screen3.2/screen.1' &&
  35. options, just as if
  36. .B \-R
  37. were not specified.
  38. .TP 5
  39. .B \-s
  40. sets the default shell to the program specified, instead of the value
  41. in the environment variable $SHELL (or \*Q/bin/sh\*U if not defined).
  42. This can also be defined through the \*Qshell\*U .screenrc command.
  43. .SH CUSTOMIZATION
  44. The \*Qsocket directory\*U defaults either to $HOME/.screen or preferably
  45. to /local/screens. If
  46. .I screen
  47. is installed setuid-root, then the administrator
  48. should compile screen with an adequate (not NFS mounted) SOCKDIR. If
  49. .I screen
  50. is not running setuid-root, the user can specify any mode 777 directory
  51. in the environment variable $SCREENDIR.
  52. .PP
  53. When
  54. .I screen
  55. is invoked, it executes initialization commands from the files
  56. \*Q/local/etc/screenrc\*U and
  57. \*Q.screenrc\*U in the user's home directory. These are the \*Qprogrammer's
  58. defaults\*U that can be overridden in the following ways: For the 
  59. global screenrc file 
  60. .I screen
  61. searches for the environment variable $SYSSCREENRC. The user specific
  62. screenrc file is searchend in $ISCREENRC, then $SCREENRC, then $HOME/.iscreenrc
  63. and finally defaults to $HOME/.screenrc. The command line option \fB-c\fP takes
  64. precedence over the user specific screenrc file.
  65. Commands in these files are used to set options, bind functions to
  66. keys, and to automatically establish one or more extra windows at the
  67. beginning of your
  68. .I screen
  69. session.
  70. Commands are listed one per line, with empty lines being ignored.
  71. A command's arguments are separated by tabs or spaces, and may be
  72. surrounded by single or double quotes.
  73. A `#' turns the rest of the line into a comment, except in quotes.
  74. Unintelligible lines are warned about and ignored.
  75. Commands may contain references to environment variables. The 
  76. syntax is the shell-like "$VAR " or "${VAR}". Note that this causes 
  77. incompatibilities with previous 
  78. .I screen
  79. versions, as now the '$'-sign has to be protected with '\' if no
  80. variable substitution shall be performed.
  81. .PP
  82. Customization can also be done 'on-line'. To enter the command mode type
  83. `C-a :'. Setting flags (like scrollback, login, etc.) on-line may not have
  84. the desired effect, as e.\|g. the command "C-a : login on" will affect
  85. only the settings for the creation of new windows (just like within .screenrc).
  86. If you intend to change flags
  87. of the current window, then prepend the command with the keyword "set". E.\|g.
  88. "C-a : set login on" will log this window in.
  89. .PP
  90. The following initialization commands are available:
  91. .PP
  92. .ne 3
  93. .B "activity \fImessage\fP"
  94. .sp
  95. When any activity occurs in a background window that is being monitored,
  96. .I screen
  97. displays a notification in the message line.
  98. The notification message can be re-defined by means of the \*Qactivity\*U
  99. command.
  100. Each occurrence of `%' in \fImessage\fP is replaced by
  101. the number of the window in which activity has occurred,
  102. and each occurrence of `~' is replaced by the definition for bell
  103. in your termcap (usually an audible bell).
  104. The default message is
  105. .sp
  106. X    'Activity in window %'
  107. .sp
  108. Note that monitoring is off for all windows by default, but can be altered
  109. by use of the \*Qmonitor\*U command (C-a M).
  110. .PP
  111. .ne 3
  112. .B "autodetach on\fP|\fBoff"
  113. .sp
  114. Sets whether 
  115. .I screen
  116. will automatically detach upon hangup, which
  117. saves all your running programs until they are resumed with a
  118. .B "screen -r"
  119. command.
  120. When turned off, a hangup signal will terminate 
  121. .I screen
  122. and all the processes it contains. Autodetach is on by default.
  123. .PP
  124. .ne 3
  125. .B "bell \fImessage\fP"
  126. .sp
  127. When a bell character is sent to a background window,
  128. .I screen
  129. displays a notification in the message line.
  130. The notification message can be re-defined by means of the \*Qbell\*U
  131. command.
  132. Each occurrence of `%' in \fImessage\fP is replaced by
  133. the number of the window to which a bell has been sent,
  134. and each occurrence of `~' is replaced by the definition for bell
  135. in your termcap (usually an audible bell).
  136. The default message is
  137. .sp
  138. X    'Bell in window %'
  139. .sp
  140. An empty message can be supplied to the \*Qbell\*U command to suppress
  141. output of a message line (bell "").
  142. .PP
  143. .ne 3
  144. .B "bind \fP\fIkey\fP [\fIfunction\fP [\fIargs\fP]]"
  145. .sp
  146. Bind a function to a key.
  147. By default, each function provided by
  148. .I screen
  149. is bound to one or more keys as indicated by the above table, e.\|g. the
  150. function to create a new window is bound to \*QC-c\*U and \*Qc\*U.
  151. The \*Qbind\*U command can be used to redefine the key bindings and to
  152. define new bindings.
  153. The \fIkey\fP argument is either a single character, a two-character sequence
  154. of the form \*Q^x\*U (meaning \*QC-x\*U), a backslash followed by an octal
  155. number (specifying the ASCII code of the character), or a backslash followed
  156. by a second character, such as \*Q\e^\*U or \*Q\e\e\*U.
  157. The argument can also be quoted, if you like.
  158. If no further argument is given, any previously established binding
  159. for this key is removed.
  160. The \fIfunction\fP argument can be one of the following keywords:
  161. .PP
  162. .nf
  163. X    select0    Switch to window #0
  164. X    \0\0...
  165. X    select9    Switch to window #9
  166. X    aka    Change the current window's a.\|k.\|a.
  167. X    clear    Clear the screen
  168. X    colon    Enter one \*Q.screenrc\*U command on-the-fly.
  169. X    copy    Select a piece of text.
  170. X    detach    Detach \fIscreen\fP
  171. X    flow    Toggle the current window's flow-control setting
  172. X    hardcopy    Make hardcopy of current window
  173. X    history    Use cut&paste to fetch a recently displayed line.
  174. X    help    Display a list of the key bindings in effect
  175. X    info    Display the current window's status information
  176. X    kill    Kill the current window
  177. X    lastmsg    Redisplay the last message line
  178. X    lock    Run a screenlock program. 
  179. X    log    Begin/end logging of the current window's output
  180. X    login    Toggle the window's \*Qlogin\*U setting (/etc/utmp entry)
  181. X    monitor    Toggle activity monitoring of the current window
  182. X    next    Switch to the next window
  183. X    other    Switch to the window displayed previously
  184. X    paste    Paste in a selected piece of text.
  185. X    pow_detach    Detach \fIscreen\fP and logout.
  186. X    prev    Switch to the previous window
  187. X    quit    Kill all windows and terminate
  188. X    readbuffer    Take text from the exchange file.
  189. X    redisplay    Redisplay current window
  190. X    reset    Reset the window to its \*Qpower-on\*U settings
  191. X    screen    Create a new window with the specified command
  192. X    shell    Create a new window with a shell
  193. X    suspend    Suspend \fIscreen\fP
  194. X    termcap    Write screen's termcap entry to $HOME/.screencap
  195. X    vbell    Toggle the window's \*Qvbell\*U setting.
  196. X      version    Display the version numbers and date last modified
  197. X    width    Toggle the terminal width between 80 and 132 columns
  198. X    windows    Display a list of all windows
  199. X    wrap    Toggle the current window's line-wrap setting
  200. X    writebuffer    Store the selected text in the exchange file.
  201. X    xoff    Send a control-s to the current program
  202. X    xon    Send a control-q to the current program
  203. .fi
  204. .PP
  205. Some examples:
  206. .PP
  207. .nf
  208. X    bind ' ' windows
  209. X    bind ^f screen telnet foobar
  210. X    bind \e033 screen -ln -t root -h 1000 9 su
  211. .fi
  212. .PP
  213. would bind the space key to the function that displays a list
  214. of windows (so that the function usually invoked by \*QC-a C-w\*U
  215. would also be available as \*QC-a space\*U),
  216. bind \*QC-f\*U to the function \*Qcreate a window with a TELNET
  217. connection to foobar\*U, and bind \*Qescape\*U to the function
  218. that creates an non-login window with a.\|k.\|a. \*Qroot\*U in slot #9, with
  219. a super-user shell and a scrollbackbuffer of 1000 lines.
  220. .PP
  221. .ne 3
  222. .B "bufferfile \fIexchange-file\fP"
  223. .sp
  224. Change the filename used for reading and writing with the copybuffer.
  225. The default is \*Q/tmp/screen-exchange\*U. The following example
  226. will paste the system's password file into the screen window:
  227. .PP
  228. .nf
  229. X    C-a : bufferfile /etc/passwd
  230. X    C-a < C-a ]
  231. .fi
  232. .PP
  233. .ne 3
  234. .B "chdir \fP[\fIdirectory\fP]"
  235. .sp
  236. Change the \fIcurrent directory\fP of
  237. .I screen
  238. to the specified directory or, if called without an argument,
  239. to your home directory (the value of the environment variable $HOME).
  240. All windows that are created by means of the \*Qscreen\*U command
  241. from within \*Q.screenrc\*U or by means of \*QC-a : screen ...\*U
  242. or \*QC-a c\*U use this as their default directory.
  243. Without a chdir command, this would be the directory from which
  244. .I screen
  245. was invoked.
  246. Hardcopy and log files are always written to the \fIwindow's\fP default
  247. directory, \fInot\fP the current directory of the process running in the
  248. window.
  249. You can use this command multiple times in your .screenrc to start various
  250. windows in different default directories, but the last chdir value will
  251. affect all the windows you create interactively.
  252. .PP
  253. .ne 3
  254. .B "crlf on\fP|\fBoff"
  255. .sp
  256. This affects the copying of text regions with the `C-a [' command. If it is set
  257. to `on', lines will be separated by the two character sequence `CR' - `LF'. 
  258. Otherwise only `LF' is used.
  259. .PP
  260. .ne 3
  261. .B "echo \fP[\fB-n\fP]\fB \fImessage\fP"
  262. .sp
  263. The echo command may be used to annoy 
  264. .I screen
  265. users with a 'message of the
  266. day'. Typically installed in a global /usr/local/etc/screenrc. See also
  267. \*Qsleep\*U.
  268. Echo is also useful for online checking of environment variables.
  269. .PP
  270. .ne 3
  271. .B "escape \fIxy\fP"
  272. .sp
  273. Set the command character to \fIx\fP and the character generating a literal
  274. command character to \fIy\fP (just like in the \-e option).
  275. Each argument is either a single character, a two-character sequence
  276. of the form \*Q^x\*U (meaning \*QC-x\*U), a backslash followed by an octal
  277. number (specifying the ASCII code of the character), or a backslash followed
  278. by a second character, such as \*Q\e^\*U or \*Q\e\e\*U.
  279. The default is \*Q^Aa\*U, but \*Q``\*U is recommended by one of the authors.
  280. .PP
  281. .ne 3
  282. .B "flow on\fP|\fBoff\fP|\fBauto \fP[\fBinterrupt\fP]\fB"
  283. .sp
  284. Sets the default flow-control mode for new windows.
  285. Specifying \*Qflow auto interrupt\*U is the same as the command-line options
  286. .B \-fa
  287. and
  288. .BR \-i . 
  289. See the discussion on FLOW-CONTROL later on in this document for full details
  290. and note, that this is subject to change in future releases.
  291. .PP
  292. .ne 3
  293. .B "hardcopy_append on\fP|\fBoff"
  294. .sp
  295. If set to "on", 
  296. .I screen
  297. will append to the "hardcopy.n" files created by the command \*QC-a h\*U, 
  298. otherwise these files are overwritten each time.
  299. .PP
  300. .ne 3
  301. .B "hardstatus on\fP|\fBoff"
  302. .sp
  303. Toggles the use of the terminals hardware status line. If "on", 
  304. .I screen
  305. will use this facility to display one line messages. Otherwise these messages
  306. are overlayed in reverse video mode at the display line. Note that the 
  307. hardstatus feature should only be used, if the termcap/terminfo capabilities
  308. "hs", "ts", "fs" and "ds" are set properly.
  309. .PP
  310. .ne 3
  311. .B "login on\fP|\fBoff"
  312. .sp
  313. Sets the login flag which determines if new windows should have /etc/utmp
  314. entries added for them.
  315. The login state is also changeable on-the-fly by using the bindable version
  316. of the \*Qlogin\*U command (C-a L) of by means of "C-a : set login on|off".
  317. The default should be \*Qon\*U for a 
  318. .I screen
  319. that runs under suid-root.
  320. .PP
  321. .ne 3
  322. .B "markkeys \fIstring\fP"
  323. .sp
  324. This is a method of changing the keymap used for copy/history mode.
  325. The string is made up of \fIoldchar\fP=\fInewchar\fP pairs which are
  326. separated by `:'. Example: The string \*QB=^B:F=^F\*U will change the 
  327. keys `C-b' and `C-f' from their (original emacs-style bindings) to the vi style
  328. binding (scroll up/down full page), which is the default meaning of `B' and
  329. `F'.
  330. .PP
  331. .ne 3
  332. .B "mode \fImode\fP"
  333. .sp
  334. The mode of each newly allocated pseudo-tty is set to \fImode\fP.
  335. \fIMode\fP is an octal number.
  336. When no \*Qmode\*U command is given, mode 0622 is used.
  337. .PP
  338. .ne 3
  339. .B "nethack on\fP|\fBoff"
  340. .sp
  341. Changes the kind of error messages used by
  342. .IR screen .
  343. When you are familiar with the game \*Qnethack\*U, you may enjoy the
  344. nethack-style messages which will often blur the facts a little, but are
  345. much funnier to read. Anyway, standard messages often tend to be unclear as
  346. well.
  347. .br
  348. This option is only 
  349. available, if screen was compiled with the NETHACK flag defined. The
  350. default setting is then determined by the presence of the environment 
  351. variable $NETHACKOPTIONS.
  352. .PP
  353. .ne 3
  354. .B "msgminwait \fIsec\fP"
  355. .sp
  356. Defines the time 
  357. .I screen 
  358. delays all activity after a message was dispayled. The default is 1 second.
  359. .PP
  360. .ne 3
  361. .B "msgwait \fIsec\fP"
  362. .sp
  363. Defines the time a message is displayed, if 
  364. .I screen
  365. is not disturbed by other activity. The default is 5 seconds.
  366. .PP
  367. .ne 3
  368. .B "password \fP[\fIcrypted_pw\fP]"
  369. .sp
  370. Present a crypted password in your \*Q.screenrc\*U file and screen will ask
  371. for it, whenever a detached session is tried to be resumed. This is useful,
  372. if you have privileged programs running under
  373. .I screen
  374. and you want to protect your session from reattach attempts by users that 
  375. managed to have your uid. (I.e. any superuser.)
  376. .PP
  377. .ne 3
  378. .B "pow_detach_msg \fImessage\fP"
  379. .sp
  380. The \fImessage\fP specified here is output whenever a `Power detach' was
  381. performed. It may be used as a replacement for a logout message or to reset 
  382. baud rate, etc.
  383. .PP
  384. .ne 3
  385. .B "screen \fP[\fI-opts\fP] [\fIn\fP] [\fIcmd\fP [\fIargs\fP]]"
  386. .sp
  387. Establish a new window.
  388. The flow-control options (\fB\-f\fP, \fB\-fn\fP and \fB\-fa\fP),
  389. title (a.\|k.\|a.) option (\fB\-t\fP), login options (\fB-l\fP and \fB-ln\fP)
  390. , terminal type option (\fB-T <term>\fP) and scrollback option (\fB-h\fP <num>)
  391. may be specified for each command.
  392. If an optional number \fIn\fP in the range 0..9 is given, the window
  393. number \fIn\fP is assigned to the newly created window (or, if this
  394. number is already in-use, the next available number).
  395. If a command is specified after \*Qscreen\*U, this command (with the given
  396. arguments) is started in the window; otherwise, a shell is created.
  397. Thus, if your \*Q.screenrc\*U contains the lines
  398. .sp
  399. .nf
  400. X    # example for .screenrc:
  401. X    screen 1
  402. X    screen -fn -t foobar 2 telnet foobar
  403. .fi
  404. .sp
  405. .I screen
  406. creates a shell window (in window #1), a window with a TELNET connection
  407. to the machine foobar (with no flow-control using the a.\|k.\|a. \*Qfoobar\*U
  408. in window #2), and finally, a second shell window
  409. (the default window) which gets a window number of zero.
  410. When the initialization is completed,
  411. .I screen
  412. switches to the last window specified in your .screenrc file or, if none, it
  413. opens a default window #0 that would be displayed in this
  414. case.
  415. .PP
  416. .ne 3
  417. .B "scrollback \fP\fInum\fP"
  418. .sp
  419. Set the size of the scrollback buffer for new windows to \fInum\fP lines.
  420. The default scrollback is 50 lines.
  421. Use "C-a : set scrollback \fInum\fP" to change the scrollback size of the
  422. current window and use "C-a i" to view the current setting. 
  423. .PP
  424. .ne 3
  425. .B "redraw on\fP|\fBoff"
  426. .sp
  427. Define whether the display should be refreshed (as done with "C-a l") after
  428. switching to the current window. As usual when the "set" keyword is given,
  429. this command only affects the current window. But unlike other commands,
  430. "redraw off" (without "set") affects all windows, the window specific settings
  431. come into effect again when "redraw on" (without "set") is entered.
  432. .PP
  433. .ne 3
  434. .B "shell \fIcommand\fP"
  435. .sp
  436. Set the command to be used to create a new shell.
  437. This overrides the value of the environment variable $SHELL, or \*Q/bin/sh\*U
  438. if undefined.
  439. This is useful if you'd like to run a tty-enhancer which is expecting to
  440. execute the program specified in $SHELL.
  441. .PP
  442. .ne 3
  443. .B "shellaka \fIa.\|k.\|a.\fP"
  444. .sp
  445. Set the a.\|k.\|a. for all shells created during startup or by
  446. the C-A C-c command.
  447. For details about what a.\|k.\|a.\|'s are, see the discussion
  448. entitled ALSO KNOWN AS.
  449. .PP
  450. .ne
  451. .B "sleep \fP\fInum\fP"
  452. This command will pause the execution of a .screenrc file for \fInum\fP seconds.
  453. It may be used to give users a chance to read the messages output by \*Qecho\*U.
  454. .PP
  455. .ne 3
  456. .B "slowpaste \fIusec\fP"
  457. .sp
  458. Define the speed text is inserted by the paste ("C-a ]") command. For each
  459. 80 characters (IOSIZE) pasted 
  460. .I screen
  461. will make a pause of \fIusec\fP milliseconds to allow the application the
  462. processing of input. Use that, if you have to fear that your underlying system
  463. chokes on large pastes.
  464. .PP
  465. .ne 3
  466. .B "term \fIterm\fP"
  467. .sp
  468. In each window's environment
  469. .I screen
  470. opens, it sets the $TERM variable to \*Qscreen\*U by default. 
  471. But when no description for \*Qscreen\*U is installed in the local termcap
  472. or terminfo data base, you can pretend that the terminal emulator is - say -
  473. \*Qvt100\*U. This won't do much harm, as 
  474. .I screen
  475. is VT100/ANSI compatible.
  476. The use of the \*Qterm\*U command is discouraged for non-default purpose.
  477. That is, one may want to specify special $TERM settings (e.g. vt100) for the
  478. next \*Qscreen rlogin othermachine\*U command. Use the command \*Qscreen -T vt100
  479. rlogin othermachine\*U rather than setting (\*Qterm vt100\*U) and resetting
  480. (\*Qterm screen\*U) the default before and after the \*Qscreen\*U command.
  481. .PP
  482. .ne 3
  483. .B "termcap \fIterm\fP \fIterminal-tweaks\fP \fP[\fIwindow-tweaks\fP]"
  484. .br
  485. .B "terminfo \fIterm\fP \fIterminal-tweaks\fP \fP[\fIwindow-tweaks\fP]"
  486. .sp
  487. Use this command to modify your terminal's termcap entry without going through
  488. all the hassles involved in creating a custom termcap entry.
  489. Plus, you can optionally customize the termcap generated for the windows.
  490. If your system works with terminfo-database rather than with
  491. termcap
  492. .I screen
  493. will understand the `terminfo' command which has the same effects as
  494. the `termcap' command. Thus users can write one .screenrc file that handles
  495. both cases, although terminfo syntax is slightly different
  496. from termcap syntax.
  497. .PP
  498. The first argument specifies which terminal(s) should be affected by this
  499. definition.
  500. You can specify multiple terminal names by separating them with `|'s.
  501. Use `*' to match all terminals and `vt*' to match all terminals that begin
  502. with \*Qvt\*U.
  503. .PP
  504. Each \fItweak\fP argument contains one or more termcap defines (separated
  505. by `:'s) to be inserted at the start of the appropriate termcap entry,
  506. enhancing it or overriding existing values.
  507. The first tweak modifies your terminal's termcap, and contains definitions
  508. that your terminal uses to perform certain functions.
  509. Specify a null string to leave this unchanged (e.\|g. '').
  510. The second (optional) tweak modifies all the window termcaps, and should
  511. contain definitions that screen understands (see the \*QVIRTUAL TERMINAL\*U
  512. section).
  513. .PP
  514. Some examples:
  515. .IP
  516. termcap xterm*  LP:hs@
  517. .PP
  518. Informs
  519. .I screen
  520. that all terminals that begin with `xterm' have firm auto-margins that
  521. allow the last position on the screen to be updated (LP), but they don't
  522. really have a status line (no 'hs' -- append `@' to turn entries off).
  523. Note that we assume `LP' for all terminal names that start with \*Qvt\*U,
  524. but only if you don't specify a termcap command for that terminal.
  525. .sp
  526. .nf
  527. X    termcap vt*  LP
  528. X    termcap vt102|vt220  Z0=\eE[?3h:Z1=\eE[?3l
  529. .fi
  530. .sp
  531. Specifies the firm-margined `LP' capability for all terminals that begin with
  532. `vt', and the second line will also add the escape-sequences to switch
  533. into (Z0) and back out of (Z1) 132-character-per-line mode if this is
  534. a vt102 or vt220.
  535. (You must specify Z0 and Z1 in your termcap to use the width-changing
  536. commands.)
  537. .IP
  538. termcap vt100  ""  l0=PF1:l1=PF2:l2=PF3:l3=PF4
  539. .PP
  540. This leaves your vt100 termcap alone and adds the function key labels to
  541. each window's termcap entry.
  542. .IP
  543. termcap h19|z19  am@:im=\eE@:ei=\eEO  dc=\eE[P
  544. .PP
  545. Takes a h19 or z19 termcap and turns off auto-margins (am@) and enables the
  546. insert mode (im) and end-insert (ei) capabilities (the `@' in the `im'
  547. string is after the `=', so it is part of the string).
  548. Having the `im' and `ei' definitions put into your terminal's termcap will
  549. cause screen to automatically advertise the character-insert capability in
  550. each window's termcap.
  551. Each window will also get the delete-character capability (dc) added to its
  552. termcap, which screen will translate into a line-update for the terminal
  553. (we're pretending it doesn't support character deletion).
  554. .PP
  555. If you would like to fully specify each window's termcap entry, you should
  556. instead set the $SCREENCAP variable prior to running
  557. .IR screen .
  558. See the discussion on the \*QVIRTUAL TERMINAL\*U in this manual, and the termcap(5)
  559. man page for more information on termcap definitions.
  560. .PP
  561. .ne 3
  562. .B "vbell on\fP|\fBoff"
  563. .sp
  564. Sets the visual bell setting for new windows. If your terminal does not support
  565. a visual bell a message is printed to the status line. The default 
  566. message is \*QWuff, Wuff!!\*U.
  567. .PP
  568. .ne 3
  569. .B "vbell_msg \fImessage\fP"
  570. .sp
  571. Sets the visual bell message. \fImessage\fP is printed to the status line if
  572. the window receives a bell character (^G) and vbell is set to \*Qon\*U.
  573. .PP
  574. .ne 3
  575. .B "vbellwait \fIsec\fP"
  576. .sp
  577. Define a delay in seconds after each display of 
  578. .I screen 's
  579. visual bell message. The default is 0 seconds.
  580. .PP
  581. .ne 3
  582. .B "wrap on\fP|\fBoff"
  583. .sp
  584. Sets the line-wrap setting for new windows.
  585. When line-wrap is on, the second consecutive printable character output at
  586. the last column of a line will wrap to the start of the following line.
  587. As an added feature, backspace (^H) will also wrap through the left margin
  588. to the previous line.
  589. Line-wrap is on by default and can be toggled with the \*Qwrap\*U
  590. command (\*QC-a r\*U) or by means of "C-a : set wrap on|off".
  591. .SH "THE MESSAGE LINE"
  592. .I Screen
  593. displays informational messages and other diagnostics in a \fImessage line\fP
  594. at the bottom of the screen.
  595. If your terminal has a status line defined in its termcap, screen will use
  596. this for displaying its messages, otherwise the last line of the screen will
  597. be temporarily overwritten and output will be momentarily interrupted.
  598. The message line is automatically removed after a few seconds delay, but it
  599. can also be removed early (on terminals without a status line) by beginning
  600. to type.
  601. .PP
  602. The message line facility can be used by an application running in
  603. the current window by means of the ANSI \fIPrivacy message\fP
  604. control sequence.
  605. For instance, from within the shell, try something like:
  606. .IP
  607. echo '<esc>^Hello world<esc>\e\e'
  608. .PP
  609. where '<esc>' is an \fIescape\fP, '^' is a literal up-arrow,
  610. and '\e\e' turns into a single backslash.
  611. .SH "FLOW-CONTROL"
  612. Each window has a flow-control setting that determines how screen deals with
  613. the XON and XOFF characters (and perhaps the interrupt character).
  614. When flow-control is turned off, screen ignores the XON and XOFF characters,
  615. which allows the user to send them to the current program by simply typing
  616. them (useful for the \fIemacs\fP editor, for instance).
  617. The trade-off is that it will take longer for output from a \*Qnormal\*U
  618. program to pause in response to an XOFF.
  619. With flow-control turned on, XON and XOFF characters are used to immediately
  620. pause the output of the current window.
  621. You can still send these characters to the current program, but you must use
  622. the appropriate two-character screen commands (typically \*QC-a q\*U (xon)
  623. and \*QC-a s\*U (xoff)).
  624. The xon/xoff commands are also useful for typing C-s and C-q past a terminal
  625. that intercepts these characters.
  626. .PP
  627. Each window has an initial flow-control value set with either the
  628. .B \-f
  629. option or the \*Qflow\*U .screenrc command. Per default the windows
  630. are set to automatic flow-switching.
  631. It can then be toggled between the three states 'fixed on', 'fixed off' and
  632. 'automatic' interactively with the \*Qflow\*U command bound to "C-a f".
  633. .PP
  634. The automatic flow-switching mode deals with
  635. flow control using the TIOCPKT mode (like \*Qrlogin\*U does). If
  636. the tty driver does not support TIOCPKT, screen tries to find out
  637. the right mode based on the current setting of the application
  638. keypad -- when it is enabled, flow-control is turned off and visa versa.
  639. Of course, you can still manipulate flow-control manually when needed.
  640. .PP
  641. If you're running with flow-control enabled and find that pressing the
  642. interrupt key (usually C-c) does not interrupt the display until another
  643. 6-8 lines have scrolled by, try running screen with the \*Qinterrupt\*U
  644. option (add the \*Qinterrupt\*U flag to the \*Qflow\*U command in
  645. your .screenrc, or use the
  646. .B \-i
  647. command-line option).
  648. This causes the output that
  649. .I screen
  650. has accumulated from the interrupted program to be flushed.
  651. One disadvantage is that the virtual terminal's memory contains the
  652. non-flushed version of the output, which in rare cases can cause
  653. minor inaccuracies in the output.
  654. For example, if you switch screens and return, or update the screen
  655. with \*QC-a l\*U you would see the version of the output you would
  656. have gotten without \*Qinterrupt\*U being on.
  657. Also, you might need to turn off flow-control (or use auto-flow mode to turn
  658. it off automatically) when running a program that expects you to type the
  659. interrupt character as input, as it is possible to interrupt
  660. the output of the virtual terminal to your physical terminal when flow-control
  661. is enabled.
  662. If this happens, a simple refresh of the screen with \*QC-a l\*U will
  663. restore it.
  664. Give each mode a try, and use whichever mode you find more comfortable.
  665. .SH "ALSO KNOWN AS (A.\|K.\|A.\|s)"
  666. You can customize each window's name in the window display (viewed with the
  667. \*Qwindows\*U command (C-a w)) by setting it with one of
  668. the a.\|k.\|a. commands.
  669. Normally the name displayed is the actual command name of the program
  670. created in the window.
  671. However, it is sometimes useful to distinguish various programs of the same
  672. name or to change the name on-the-fly to reflect the current state of
  673. the window.
  674. .PP
  675. The default name for all shell windows can be set with the \*Qshellaka\*U
  676. command in the .screenrc file, while all other windows are created with
  677. a \*Qscreen\*U command and thus can have their name set with the
  678. .B \-t
  679. option.
  680. Interactively, there is the AKA-string escape-sequence
  681. (<esc>k\fIname\fP<esc>\e) and the \*Qaka\*U command (C-a A).
  682. The former can be output from an application to control the window's name
  683. under software control, and the latter will prompt for a name when typed.
  684. You can also bind pre-defined names to keys with the \*Qaka\*U command
  685. to set things quickly without prompting.
  686. .PP
  687. Finally,
  688. .I screen
  689. has a shell-specific heuristic that is enabled by setting the window's name
  690. to \*Q\fIsearch|name\fP\*U and arranging to have a null aka escape-sequence
  691. output as a part of your prompt.
  692. The \fIsearch\fP portion specifies an end-of-prompt search string, while
  693. the \fIname\fP portion specifies the default shell name for the window.
  694. If the \fIname\fP ends in a `:'
  695. .I screen
  696. will add what it believes to be the current command running in the window
  697. to the end of the window's shell name (e.\|g. \*Q\fIname:cmd\fP\*U).
  698. Otherwise the current command name supersedes the shell name while it is
  699. running.
  700. .PP
  701. Here's how it works:  you must modify your shell prompt to output a null
  702. aka escape-sequence (<esc>k<esc>\e) as a part of your prompt.
  703. The last part of your prompt must be the same as the string you specified
  704. for the \fIsearch\fP portion of the a.\|k.\|a.
  705. Once this is set up,
  706. .I screen
  707. will use the aka escape-sequence to clear the previous command name and
  708. get ready for the next command.
  709. Then, when a newline is received from the shell, a search is made for the
  710. end of the prompt.
  711. If found, it will grab the first word after the matched string and use it
  712. as the command name.
  713. If the command name begins with either '!', '%', or '^'
  714. .I screen
  715. will use the first word on the following line (if found) in preference to
  716. the just-found name.
  717. This helps csh users get better command names when using job control or
  718. history recall commands.
  719. .PP
  720. Here's some .screenrc examples:
  721. .IP
  722. screen -t top 2 nice top
  723. .PP
  724. Adding this line to your .screenrc would start a niced version of the
  725. \*Qtop\*U command in window 2 name \*Qtop\*U rather than \*Qnice\*U.
  726. .sp
  727. .nf
  728. X    shellaka '> |csh'
  729. X    screen 1
  730. .fi
  731. .sp
  732. This file would start two shells (one specified, one default) using
  733. the given shellaka.
  734. The a.\|k.\|a. specified is an auto-aka that would expect the prompt and
  735. the typed command to look something like the following:
  736. .IP
  737. /usr/joe/src/dir> trn
  738. .PP
  739. (it looks after the '> ' for the command name).
  740. The window status would show the name \*Qtrn\*U while the command was
  741. running, and revert to \*Qcsh\*U upon completion.
  742. .IP
  743. bind R screen -t '% |root:' su
  744. .PP
  745. Having this command in your .screenrc would bind the key
  746. sequence \*QC-a R\*U to the \*Qsu\*U command and give it an
  747. auto-aka name of \*Qroot:\*U.
  748. For this auto-aka to work, the screen could look something
  749. like this:
  750. .sp
  751. .nf
  752. X    % !em
  753. X    emacs file.c
  754. .fi
  755. .sp
  756. Here the user typed the csh history command \*Q!em\*U which ran the
  757. previously entered \*Qemacs\*U command.
  758. The window status would show \*Qroot:emacs\*U during the execution
  759. of the command, and revert to simply \*Qroot:\*U at its completion.
  760. .PP
  761. .nf
  762. X    bind o aka
  763. X    bind E aka ""
  764. X    bind u aka (unknown)
  765. .fi
  766. .sp
  767. The first binding doesn't have any arguments, so it would prompt you
  768. for an a.\|k.\|a. when you type \*QC-a o\*U.
  769. The second binding would clear an auto-aka's current setting (C-a E).
  770. The third binding would set the current window's a.\|k.\|a. to \*Q(unknown)\*U
  771. (C-a u).
  772. .PP
  773. One thing to keep in mind when adding a null aka escape-sequence to
  774. your prompt is that some shells (like the csh) count all the non-control
  775. characters as part of the prompt's length.
  776. If these invisible characters aren't a multiple of 8 then backspacing over
  777. a tab will result in an incorrect display.
  778. One way to get around this is to use a prompt like this:
  779. .IP
  780. set prompt='^[[0000m^[k^[\e% '
  781. .PP
  782. The escape-sequence \*Q<esc>[0000m\*U not only normalizes the character
  783. attributes, but all the zeros round the length of the invisible characters
  784. up to 8.
  785. Bash users will probably want to echo the escape sequence in the
  786. PROMPT_COMMAND:
  787. .IP
  788. PROMPT_COMMAND='echo -n -e "\e033k\e033\e134"'
  789. .PP
  790. (I used \*Q\134\*U to output a `\e' because of a bug in v1.04).
  791. .SH "THE VIRTUAL TERMINAL"
  792. Usually
  793. .I screen
  794. tries to emulate as much of the VT100/ANSI standard
  795. as possible. But if your terminal lacks certain capabilities
  796. the emulation may not be complete. In these cases
  797. .I screen
  798. has to tell the applications that some of the features
  799. are missing. This is no problem on machines using termcap,
  800. because
  801. .I screen
  802. can use the $TERMCAP variable to
  803. customize the standard screen termcap.
  804. .br
  805. But if you do a
  806. rlogin on another machine or your machine supports only
  807. terminfo this method fails. Because of this
  808. .I screen
  809. offers a way to deal with these cases. Here is how it works:
  810. .br
  811. When 
  812. .I screen
  813. tries to figure out a terminal name for itself,
  814. it first looks
  815. for an entry named \*Qscreen.<term>\*U, where <term> is
  816. the contents of your $TERM variable.
  817. If no such entry exists,
  818. .I screen
  819. tries \*Qscreen\*U (or \*Qscreen-w\*U, if the terminal is wide
  820. (132 cols or more)).
  821. If even this entry cannot be found, \*Qvt100\*U is used as a
  822. substitute.
  823. .br
  824. The idea is that if you have a terminal which doesn't
  825. support an important feature (e.g. delete char or clear to EOS)
  826. you can build a new termcap/terminfo entry for
  827. .I screen
  828. (named \*Qscreen.<dumbterm>\*U) in which this capability
  829. has been disabled.  If this entry is installed on your
  830. machines you are able to do
  831. a rlogin and still keep the correct termcap/terminfo entry.
  832. The terminal name is put in the $TERM variable
  833. of all new windows.
  834. .I Screen
  835. also sets the $TERMCAP variable reflecting the capabilities
  836. of the virtual terminal emulated. Notice that, however, on machines
  837. using the terminfo database this variable has no effect.
  838. Furthermore, the variable $WINDOW is set to the window number
  839. of each window.
  840. .br
  841. The actual set of capabilities supported by the virtual terminal
  842. depends on the capabilities supported by the physical terminal.
  843. If, for instance, the physical terminal does not support underscore mode,
  844. .I screen
  845. does not put the `us' and `ue' capabilities into the window's $TERMCAP
  846. variable, accordingly.
  847. However, a minimum number of capabilities must be supported by a
  848. terminal in order to run
  849. .IR screen ;
  850. namely scrolling, clear screen, and direct cursor addressing
  851. (in addition,
  852. .I screen
  853. does not run on hardcopy terminals or on terminals that over-strike).
  854. .PP
  855. Also, you can customize the $TERMCAP value used by
  856. .I screen
  857. by using the \*Qtermcap\*U .screenrc command, or
  858. by defining the variable $SCREENCAP prior to startup.
  859. When the latter defined, its value will be copied verbatim into each
  860. window's $TERMCAP variable.
  861. This can either be the full terminal definition, or a filename where the
  862. terminal \*Qscreen\*U (and/or \*Qscreen-w\*U) is defined.
  863. .PP
  864. Note that 
  865. .I screen
  866. honors the \*Qterminfo\*U .screenrc command if the system uses the
  867. terminfo database rather than termcap.
  868. .PP
  869. When the boolean `G0' capability is present in the termcap entry
  870. for the terminal on which
  871. .I screen
  872. has been called, the terminal emulation of
  873. .I screen
  874. supports multiple character sets.
  875. This allows an application to make use of, for instance,
  876. the VT100 graphics character set or national character sets.
  877. The following control functions from ISO 2022 are supported:
  878. \fIlock shift G0\fP (\fISI\fP), \fIlock shift G1\fP (\fISO\fP),
  879. \fIlock shift G2\fP, \fIlock shift G3\fP, \fIsingle shift G2\fP,
  880. and \fIsingle shift G3\fP.
  881. When a virtual terminal is created or reset, the ASCII character
  882. set is designated as \fIG0\fP through \fIG3\fP.
  883. When the `G0' capability is present, screen evaluates the capabilities
  884. `S0', `E0', and `C0' if present. `S0' is the sequence the terminal uses
  885. to enable and start the graphics character set rather than \fISI\fP. 
  886. `E0' is the corresponding replacement for \fISO\fP. `C0' gives a character
  887. by character translation string that is used during semi-graphics mode. This 
  888. string is built like the `acsc' terminfo capability.
  889. .PP
  890. When the `po' and `pf' capabilities are present in the terminal's
  891. termcap entry, applications running in a
  892. .I screen
  893. window can send output to the printer port of the terminal.
  894. This allows a user to have an application in one window
  895. sending output to a printer connected to the terminal, while all
  896. other windows are still active (the printer port is enabled
  897. and disabled again for each chunk of output).
  898. As a side-effect, programs running in different windows can
  899. send output to the printer simultaneously.
  900. Data sent to the printer is not displayed in the window.
  901. .PP
  902. Some capabilities are only put into the $TERMCAP
  903. variable of the virtual terminal if they can be efficiently
  904. implemented by the physical terminal.
  905. For instance, `dl' (delete line) is only put into the $TERMCAP
  906. variable if the terminal supports either delete line itself or
  907. scrolling regions. Note that this may provoke confusion, when 
  908. the session is reattached on a different terminal, as the value
  909. of $TERMCAP cannot be modified by parent processes.
  910. .PP
  911. The following is a list of control sequences recognized by
  912. .IR screen .
  913. \*Q(V)\*U and \*Q(A)\*U indicate VT100-specific and ANSI- or
  914. ISO-specific functions, respectively.
  915. .PP
  916. .nf
  917. .TP 20
  918. .B "ESC E"
  919. X    Next Line
  920. .TP 20
  921. .B "ESC D"
  922. X    Index
  923. .TP 20
  924. .B "ESC M"
  925. X    Reverse Index
  926. .TP 20
  927. .B "ESC H"
  928. X    Horizontal Tab Set
  929. .TP 20
  930. .B "ESC 7"
  931. (V)    Save Cursor and Attributes
  932. .TP 20
  933. .B "ESC 8"
  934. (V)    Restore Cursor and Attributes
  935. .TP 20
  936. .B "ESC [s"
  937. (A)    Save Cursor and Attributes
  938. .TP 20
  939. .B "ESC [u"
  940. (A)    Restore Cursor and Attributes
  941. .TP 20
  942. .B "ESC c"
  943. X    Reset to Initial State
  944. .TP 20
  945. .B "ESC ="
  946. (V)    Application Keypad Mode
  947. .TP 20
  948. .B "ESC >"
  949. (V)    Numeric Keypad Mode
  950. .TP 20
  951. .B "ESC # 8"
  952. (V)    Fill Screen with E's
  953. .TP 20
  954. .B "ESC \e"
  955. (A)    String Terminator
  956. .TP 20
  957. .B "ESC ^"
  958. (A)    Privacy Message String (Message Line)
  959. .TP 20
  960. .B "ESC k"
  961. X    A.\|k.\|a. Definition String
  962. .TP 20
  963. .B "ESC P"
  964. (A)    Device Control String
  965. X    Outputs a string directly to the host
  966. X    terminal without interpretation.
  967. .TP 20
  968. .B "ESC _"
  969. (A)    Application Program Command (not used)
  970. .TP 20
  971. .B "ESC ]"
  972. (A)    Operating System Command (not used)
  973. .TP 20
  974. .B "Control-N"
  975. (A)    Lock Shift G1 (SO)
  976. .TP 20
  977. .B "Control-O"
  978. (A)    Lock Shift G0 (SI)
  979. .TP 20
  980. .B "ESC n"
  981. (A)    Lock Shift G2
  982. .TP 20
  983. .B "ESC o"
  984. (A)    Lock Shift G3
  985. .TP 20
  986. .B "ESC N"
  987. (A)    Single Shift G2
  988. .TP 20
  989. .B "ESC O"
  990. (A)    Single Shift G3
  991. .TP 20
  992. .B "ESC ( \fPPcs"
  993. (A)    Designate character set as G0
  994. .TP 20
  995. .B "ESC ) \fPPcs"
  996. (A)    Designate character set as G1
  997. .TP 20
  998. .B "ESC * \fPPcs"
  999. (A)    Designate character set as G2
  1000. .TP 20
  1001. .B "ESC + \fPPcs"
  1002. (A)    Designate character set as G3
  1003. .TP 20
  1004. .B "ESC [ \fPPn\fB ; \fPPn\fB H"
  1005. X    Direct Cursor Addressing
  1006. .TP 20
  1007. .B "ESC [ \fPPn\fB ; \fPPn\fB f"
  1008. X    Direct Cursor Addressing
  1009. .TP 20
  1010. .B "ESC [ \fPPn\fB J"
  1011. X    Erase in Display
  1012. .TP 20
  1013. \h'\w'ESC 'u'Pn = None or \fB0\fP
  1014. X    From Cursor to End of Screen
  1015. .TP 20
  1016. \h'\w'ESC Pn = 'u'\fB1\fP
  1017. X    From Beginning of Screen to Cursor
  1018. .TP 20
  1019. \h'\w'ESC Pn = 'u'\fB2\fP
  1020. X    Entire Screen
  1021. .TP 20
  1022. .B "ESC [ \fPPn\fB K"
  1023. X    Erase in Line
  1024. .TP 20
  1025. \h'\w'ESC 'u'Pn = None or \fB0\fP
  1026. X    From Cursor to End of Line
  1027. .TP 20
  1028. \h'\w'ESC Pn = 'u'\fB1\fP
  1029. X    From Beginning of Line to Cursor
  1030. .TP 20
  1031. \h'\w'ESC Pn = 'u'\fB2\fP
  1032. X    Entire Line
  1033. .TP 20
  1034. .B "ESC [ \fPPn\fB A"
  1035. X    Cursor Up
  1036. .TP 20
  1037. .B "ESC [ \fPPn\fB B"
  1038. X    Cursor Down
  1039. .TP 20
  1040. .B "ESC [ \fPPn\fB C"
  1041. X    Cursor Right
  1042. .TP 20
  1043. .B "ESC [ \fPPn\fB D"
  1044. X    Cursor Left
  1045. .TP 20
  1046. .B "ESC [ \fPPs\fB ;\fP...\fB; \fPPs\fB m"
  1047. X    Select Graphic Rendition
  1048. .TP 20
  1049. \h'\w'ESC 'u'Ps = None or \fB0\fP
  1050. X    Default Rendition
  1051. .TP 20
  1052. \h'\w'ESC Ps = 'u'\fB1\fP
  1053. X    Bold
  1054. .TP 20
  1055. \h'\w'ESC Ps = 'u'\fB2\fP
  1056. (A)    Faint
  1057. .TP 20
  1058. \h'\w'ESC Ps = 'u'\fB3\fP
  1059. (A)    \fIStandout\fP Mode (ANSI: Italicized)
  1060. .TP 20
  1061. \h'\w'ESC Ps = 'u'\fB4\fP
  1062. X    Underlined
  1063. .TP 20
  1064. \h'\w'ESC Ps = 'u'\fB5\fP
  1065. X    Blinking
  1066. .TP 20
  1067. \h'\w'ESC Ps = 'u'\fB7\fP
  1068. X    Negative Image
  1069. .TP 20
  1070. \h'\w'ESC Ps = 'u'\fB22\fP
  1071. (A)    Normal Intensity
  1072. .TP 20
  1073. \h'\w'ESC Ps = 'u'\fB23\fP
  1074. (A)    \fIStandout\fP Mode off (ANSI: Italicized off)
  1075. .TP 20
  1076. \h'\w'ESC Ps = 'u'\fB24\fP
  1077. (A)    Not Underlined
  1078. .TP 20
  1079. \h'\w'ESC Ps = 'u'\fB25\fP
  1080. (A)    Not Blinking
  1081. .TP 20
  1082. \h'\w'ESC Ps = 'u'\fB27\fP
  1083. (A)    Positive Image
  1084. .TP 20
  1085. .B "ESC [ \fPPn\fB g"
  1086. X    Tab Clear
  1087. .TP 20
  1088. \h'\w'ESC 'u'Pn = None or \fB0\fP
  1089. X    Clear Tab at Current Position
  1090. .TP 20
  1091. \h'\w'ESC Ps = 'u'\fB3\fP
  1092. X    Clear All Tabs
  1093. .TP 20
  1094. .B "ESC [ \fPPn\fB ; \fPPn\fB r"
  1095. (V)    Set Scrolling Region
  1096. .TP 20
  1097. .B "ESC [ \fPPn\fB I"
  1098. (A)    Horizontal Tab
  1099. .TP 20
  1100. .B "ESC [ \fPPn\fB Z"
  1101. (A)    Backward Tab
  1102. .TP 20
  1103. .B "ESC [ \fPPn\fB L"
  1104. (A)    Insert Line
  1105. .TP 20
  1106. .B "ESC [ \fPPn\fB M"
  1107. (A)    Delete Line
  1108. .TP 20
  1109. .B "ESC [ \fPPn\fB @"
  1110. (A)    Insert Character
  1111. .TP 20
  1112. .B "ESC [ \fPPn\fB P"
  1113. (A)    Delete Character
  1114. .TP 20
  1115. .B "ESC [ \fPPs\fB ;\fP...\fB; \fPPs\fB h"
  1116. X    Set Mode
  1117. .TP 20
  1118. .B "ESC [ \fPPs\fB ;\fP...\fB; \fPPs\fB l"
  1119. X    Reset Mode
  1120. .TP 20
  1121. \h'\w'ESC 'u'Ps = \fB4\fP
  1122. (A)    Insert Mode
  1123. .TP 20
  1124. \h'\w'ESC Ps = 'u'\fB?3\fP
  1125. (V)    Change Terminal Width
  1126. .TP 20
  1127. \h'\w'ESC Ps = 'u'\fB?5\fP
  1128. (V)    Visible Bell (\fIOn\fP followed by \fIOff\fP)
  1129. .TP 20
  1130. \h'\w'ESC Ps = 'u'\fB?6\fP
  1131. (V)    \fIOrigin\fP Mode
  1132. .TP 20
  1133. \h'\w'ESC Ps = 'u'\fB?7\fP
  1134. (V)    \fIWrap\fP Mode
  1135. .TP 20
  1136. .B "ESC [ 5 i"
  1137. (A)    Start relay to printer (ANSI Media Copy)
  1138. .TP 20
  1139. .B "ESC [ 4 i"
  1140. (A)    Stop relay to printer (ANSI Media Copy)
  1141. .fi
  1142. .SH FILES
  1143. .nf
  1144. .ta 2i
  1145. $SYSSCREENRC
  1146. .br
  1147. /local/etc/screenrc          \fIscreen\fP initialization commands
  1148. .br
  1149. $ISCREENRC
  1150. .br
  1151. $SCREENRC
  1152. .br
  1153. $HOME/.iscreenrc
  1154. .br
  1155. $HOME/.screenrc      Read in after /usr/local/etc/screenrc
  1156. .br
  1157. $ISCREENDIR/S-<login>
  1158. .br
  1159. $SCREENDIR/S-<login>
  1160. .br
  1161. /local/screens/S-<login>          Socket directories (default)
  1162. .br
  1163. /usr/tmp/screens/S-<login>          Alternate socket directories.
  1164. .br
  1165. <socket directory>/.termcap          Written by the "termcap" output function
  1166. .br
  1167. /usr/tmp/screens/screen-exchange          or
  1168. .br
  1169. /tmp/screen-exchange          \fIscreen\fP `interprocess communication buffer'
  1170. .br
  1171. hardcopy.[0-9]      Screen images created by the hardcopy function
  1172. .br
  1173. screenlog.[0-9]      Output log files created by the log function
  1174. .br
  1175. /usr/lib/terminfo/?/*           or
  1176. .br
  1177. /etc/termcap      Terminal capability databases
  1178. .br
  1179. /etc/utmp      Login records
  1180. .br
  1181. $LOCKPRG      Program that locks a terminal.
  1182. .fi
  1183. .SH "SEE ALSO"
  1184. termcap(5), utmp(5), vi(1), captoinfo(1), tic(1)
  1185. .SH AUTHORS
  1186. Originally created by Oliver Laumann, this latest version was
  1187. produced by Wayne Davison, Juergen Weigert and Michael Schroeder.
  1188. .SH CONTRIBUTORS
  1189. Allan Ball,
  1190. Bart Schaefer,
  1191. Doug Siebert,
  1192. Howard Chu,
  1193. Jay Vassos-Libove,  
  1194. John Kraft,
  1195. Larry Virden,
  1196. Marc Boucher,
  1197. Nathan Glasser,
  1198. Patrick Wolfe,
  1199. Rudolf Koenig.
  1200. Toerless Eckert, 
  1201. .SH VERSION
  1202. This is version 3.2. It's roots are a merge of a custom version
  1203. 2.3PR7 by Wayne Davison
  1204. and several enhancements to Oliver Laumann's version 2.0. Note that all versions
  1205. numbered 2.x are copyright by Oliver Laumann. 
  1206. X
  1207. .SH BUGS
  1208. `dm' (delete mode), `xn', and `xs' are not handled
  1209. correctly (they are ignored).
  1210. .PP
  1211. The \fIGR\fP set of ISO 2022 is not supported.
  1212. .PP
  1213. There is no keyboard input translation to VT100 sequences.
  1214. .PP
  1215. It is not possible to change the environment variable $TERMCAP when 
  1216. reattaching under a different terminal type.
  1217. .PP
  1218. The support of terminfo based systems is very limited. Adding extra
  1219. capabilities to $TERMCAP may not have any effects.
  1220. .PP
  1221. .I Screen
  1222. does not make use of hardware tabs.
  1223. .PP
  1224. .I Screen
  1225. must be installed as set-uid with owner root in order to be able
  1226. to correctly change the owner of the tty device file for each
  1227. window.
  1228. Special permission may also be required to write the file \*Q/etc/utmp\*U.
  1229. .PP
  1230. Entries in \*Q/etc/utmp\*U are not removed when
  1231. .I screen
  1232. is killed with SIGKILL.
  1233. This will cause some programs (like "w" or "rwho")
  1234. to advertise that a user is logged on who really isn't.
  1235. SHAR_EOF
  1236. echo 'File screen3.2/screen.1 is complete' &&
  1237. chmod 0444 screen3.2/screen.1 ||
  1238. echo 'restore of screen3.2/screen.1 failed'
  1239. Wc_c="`wc -c < 'screen3.2/screen.1'`"
  1240. test 63790 -eq "$Wc_c" ||
  1241.     echo 'screen3.2/screen.1: original size 63790, current size' "$Wc_c"
  1242. rm -f _shar_wnt_.tmp
  1243. fi
  1244. # ============= screen3.2/screen.c ==============
  1245. if test -f 'screen3.2/screen.c' -a X"$1" != X"-c"; then
  1246.     echo 'x - skipping screen3.2/screen.c (File already exists)'
  1247.     rm -f _shar_wnt_.tmp
  1248. else
  1249. > _shar_wnt_.tmp
  1250. echo 'x - extracting screen3.2/screen.c (Text)'
  1251. sed 's/^X//' << 'SHAR_EOF' > 'screen3.2/screen.c' &&
  1252. /* Copyright (c) 1991
  1253. X *      Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
  1254. X *      Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
  1255. X * Copyright (c) 1987 Oliver Laumann
  1256. X *
  1257. X * This program is free software; you can redistribute it and/or modify
  1258. X * it under the terms of the GNU General Public License as published by
  1259. X * the Free Software Foundation; either version 1, or (at your option)
  1260. X * any later version.
  1261. X *
  1262. X * This program is distributed in the hope that it will be useful,
  1263. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1264. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1265. X * GNU General Public License for more details.
  1266. X *
  1267. X * You should have received a copy of the GNU General Public License
  1268. X * along with this program (see the file COPYING); if not, write to the
  1269. X * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1270. X *
  1271. X * Noteworthy contributors to screen's design and implementation:
  1272. X *    Wayne Davison (davison@borland.com)
  1273. X *    Patrick Wolfe (pat@kai.com, kailand!pat)
  1274. X *    Bart Schaefer (schaefer@cse.ogi.edu)
  1275. X *    Nathan Glasser (nathan@brokaw.lcs.mit.edu)
  1276. X *    Larry W. Virden (lwv27%cas.BITNET@CUNYVM.CUNY.Edu)
  1277. X *    Howard Chu (hyc@hanauma.jpl.nasa.gov)
  1278. X *    Tim MacKenzie (tym@dibbler.cs.monash.edu.au)
  1279. X *    Markku Jarvinen (mta@{cc,cs,ee}.tut.fi)
  1280. X *    Marc Boucher (marc@CAM.ORG)
  1281. X *
  1282. X ****************************************************************
  1283. X */
  1284. X
  1285. #ifndef lint
  1286. X  static char rcs_id[] = "$Id: screen.c,v 1.2 92/02/03 02:28:05 jnweiger Exp $ FAU";
  1287. #endif
  1288. X
  1289. X
  1290. #include <sys/param.h>
  1291. /* #include <signal.h> */
  1292. #include <ctype.h>
  1293. #include <pwd.h>
  1294. #include <fcntl.h>
  1295. #ifdef sgi
  1296. # include <sys/sysmacros.h>
  1297. #endif /* sgi */
  1298. #if !defined(sun) && !defined(B43) && !defined(ISC)
  1299. # include <time.h>
  1300. #endif
  1301. /*
  1302. X * Gee!! We should reverse that #if! 
  1303. X */
  1304. #if defined(sun) || defined(_AIX) || defined(sysV68) || defined(MIPS) || defined(GOULD_NP1) || defined(B43) || defined(ISC) || defined(apollo) || defined(BSDI) || defined(sgi)
  1305. # include <sys/time.h>
  1306. #endif
  1307. #if defined(M_XENIX) || defined(M_UNIX)
  1308. #include <sys/select.h> /* for timeval */
  1309. #endif
  1310. #include <sys/types.h>
  1311. #ifdef ISC
  1312. # include <sys/bsdtypes.h>
  1313. #endif
  1314. #if !defined(sysV68) && !defined(M_XENIX)
  1315. # include <sys/wait.h>
  1316. #endif
  1317. #include <sys/stat.h>
  1318. #ifndef sgi
  1319. # include <sys/file.h>
  1320. #endif /* sgi */
  1321. #ifndef sun
  1322. # include <sys/ioctl.h>
  1323. #endif /* sun */
  1324. X
  1325. #include <signal.h>
  1326. X
  1327. #include "config.h"
  1328. X
  1329. #ifdef SHADOWPW
  1330. # include <shadow.h>
  1331. #endif /* SHADOWPW */
  1332. X
  1333. #ifdef SVR4
  1334. # include <sys/stropts.h>
  1335. #endif
  1336. X
  1337. #ifdef SYSV
  1338. # include <sys/utsname.h>
  1339. #endif
  1340. X
  1341. #if defined(_SEQUENT_) 
  1342. /* for the FD.. stuff */
  1343. # include <sys/select.h>
  1344. #endif 
  1345. X
  1346. #if defined(sequent) || defined(SVR4)
  1347. # include <sys/resource.h>
  1348. #endif /* sequent || SVR4 */
  1349. X
  1350. #ifdef ISC
  1351. # include <sys/tty.h>
  1352. # include <sys/sioctl.h>
  1353. # include <sys/pty.h>
  1354. #endif
  1355. X
  1356. #include "screen.h"
  1357. X
  1358. #include "patchlevel.h"
  1359. X
  1360. #if defined(xelos) || defined(sysV68) || defined(M_XENIX)
  1361. X struct passwd *getpwuid __P((uid_t));
  1362. X struct passwd *getpwnam __P((char *));
  1363. #endif
  1364. X
  1365. #ifdef USEVARARGS
  1366. # if defined(__STDC__)
  1367. #  include <stdarg.h>
  1368. # else
  1369. #  include <varargs.h>
  1370. # endif
  1371. #endif
  1372. X
  1373. #ifdef DEBUG
  1374. FILE *dfp;
  1375. #endif
  1376. X
  1377. X
  1378. #ifdef COPY_PASTE
  1379. extern char *copybuffer;    /* def in mark.c jw. */
  1380. extern copylen;
  1381. #endif /* COPY_PASTE */
  1382. X
  1383. extern char *blank, *null, Term[], screenterm[], **environ, *Termcap;
  1384. int force_vt = 1, assume_LP = 0;
  1385. extern int in_ovl;
  1386. extern int ovl_blockfore;
  1387. extern void (*ovl_process)();
  1388. extern int help_page;
  1389. extern int screenwidth, screenheight;
  1390. extern char display_tty[];
  1391. extern int default_width, default_height;
  1392. extern int Z0width, Z1width;
  1393. extern int ISO2022;
  1394. extern int status, HS;
  1395. extern char *Z0, *WS, *LastMsg;
  1396. extern time_t TimeDisplayed;
  1397. int BellDisplayed;
  1398. int VBellWait, MsgWait, MsgMinWait;
  1399. X
  1400. /* tputs uses that: jw */
  1401. extern short ospeed;
  1402. X
  1403. extern int flow, default_flow, wrap, visual_bell, default_monitor;
  1404. extern int errno;
  1405. extern sys_nerr;
  1406. extern char *sys_errlist[];
  1407. extern char mark_key_tab[];
  1408. X
  1409. #if defined(TIOCSWINSZ) || defined(TIOCGWINSZ)
  1410. extern struct winsize glwz;
  1411. #endif
  1412. X
  1413. static char *MakeWinMsg __P((char *, int));
  1414. static void MakeNewEnv __P((void));
  1415. static int Attach __P((int));
  1416. static void Attacher __P((void));
  1417. static void SigHandler __P((void));
  1418. static sig_t AttacherSigInt __P(SIGPROTOARG);
  1419. static sig_t SigChld __P(SIGPROTOARG);
  1420. static sig_t SigInt __P(SIGPROTOARG);
  1421. static sig_t CoreDump __P((int));
  1422. static void DoWait __P((void));
  1423. static sig_t Finit __P((int));
  1424. static void InitKeytab __P((void));
  1425. static void SetForeWindow __P((int));
  1426. static int NextWindow __P((void));
  1427. static int PreviousWindow __P((void));
  1428. static int MoreWindows __P((void));
  1429. static void FreeWindow __P((struct win *));
  1430. static void execvpe __P((char *, char **, char **));
  1431. static void LogToggle __P((void));
  1432. static void ShowWindows __P((void));
  1433. static void ShowTime __P((void));
  1434. static void ShowInfo __P((void));
  1435. static int OpenPTY __P((void));
  1436. #ifdef PASSWORD
  1437. static void trysend __P((int, struct msg *, char *));
  1438. #endif
  1439. #if defined(SIGWINCH) && defined(TIOCGWINSZ)
  1440. static sig_t SigAttWinch __P(SIGPROTOARG);
  1441. #endif
  1442. static void fgtty __P((void));
  1443. static void freetty __P((void));
  1444. static void brktty __P((void));
  1445. X
  1446. #if defined(LOCK)
  1447. static sig_t DoLock __P(SIGPROTOARG);
  1448. static void LockTerminal __P((void));
  1449. #endif
  1450. X
  1451. #ifdef COPY_PASTE
  1452. static pastelen;
  1453. static char *pastebuffer;
  1454. #endif
  1455. #ifdef PASSWORD
  1456. extern char Password[];
  1457. #endif
  1458. X
  1459. static struct passwd *ppp;
  1460. X
  1461. /* used for opening a new pty-pair: */
  1462. static char PtyName[32], TtyName[32];
  1463. X
  1464. /* used for the attacher's tty: */
  1465. static char *attach_tty;
  1466. X
  1467. char *ShellProg;
  1468. char *ShellArgs[2];
  1469. static char inbuf[MAXWIN][IOSIZE];
  1470. static inlen[MAXWIN];
  1471. static inbuf_ct;
  1472. static ESCseen;
  1473. static GotSignal;
  1474. X
  1475. static char DefaultShell[] = "/bin/sh";
  1476. static char DefaultPath[] = ":/usr/ucb:/bin:/usr/bin";
  1477. X
  1478. #ifdef hpux
  1479. char PtyProto[] = "/dev/ptym/ptyXY";
  1480. char TtyProto[] = "/dev/pty/ttyXY";
  1481. #else
  1482. # if !(defined(sequent) || defined(_SEQUENT_) || defined(SVR4))
  1483. static char PtyProto[] = "/dev/ptyXY";
  1484. static char TtyProto[] = "/dev/ttyXY";
  1485. # endif
  1486. #endif /* hpux */
  1487. int TtyMode = 0622;
  1488. #ifdef SOCKDIR
  1489. char *SockDir = SOCKDIR;
  1490. #else
  1491. char *SockDir = ".iscreen";
  1492. #endif
  1493. extern char SockPath[], *SockNamePtr, *SockName;
  1494. int ServerSocket = -1;
  1495. static char **NewEnv;
  1496. X
  1497. char *RcFileName = NULL;
  1498. char Esc = Ctrl('a');
  1499. char MetaEsc = 'a';
  1500. char *home;
  1501. X
  1502. int HasWindow;
  1503. char *LoginName;
  1504. char *BellString;
  1505. char *VisualBellString;
  1506. char *ActivityString;
  1507. char *BufferFile;
  1508. char *PowDetachString;
  1509. int auto_detach = 1;
  1510. int iflag, rflag, dflag, lsflag, quietflag, wipeflag;
  1511. int adaptflag, loginflag = -1, allflag;
  1512. static intrc, startc, stopc;
  1513. char HostName[MAXSTR];
  1514. int Detached, Suspended;
  1515. int DeadlyMsg = 1;
  1516. int AttacherPid;    /* Non-Zero in child if we have an attacher */
  1517. int MasterPid;
  1518. int real_uid, real_gid, eff_uid, eff_gid;
  1519. int default_histheight;
  1520. int default_startup;
  1521. int slowpaste;
  1522. X
  1523. #if defined(BSDJOBS) && !(defined(POSIX) || defined(SYSV))
  1524. int DevTty = -1;
  1525. #endif
  1526. X
  1527. #ifdef NETHACK
  1528. int nethackflag = 0;
  1529. #endif
  1530. X
  1531. struct mode OldMode, NewMode;
  1532. X
  1533. struct win *fore = NULL;
  1534. int WinList = -1;
  1535. int ForeNum;
  1536. struct win *wtab[MAXWIN];
  1537. X
  1538. struct key ktab[256];
  1539. X
  1540. #ifndef FD_SET
  1541. typedef struct fd_set
  1542. {
  1543. X  int fd_bits[1];
  1544. }      fd_set;
  1545. # define FD_ZERO(fd) ((fd)->fd_bits[0] = 0)
  1546. # define FD_SET(b, fd) ((fd)->fd_bits[0] |= 1 << (b))
  1547. # define FD_ISSET(b, fd) ((fd)->fd_bits[0] & 1 << (b))
  1548. # define FD_SETSIZE 32
  1549. #endif
  1550. X
  1551. X
  1552. #ifndef WTERMSIG
  1553. # ifndef BSDWAIT /* if wait is NOT a union: */
  1554. #  define WTERMSIG(status) (status & 0177)
  1555. # else
  1556. #  define WTERMSIG(status) status.w_T.w_Termsig 
  1557. # endif
  1558. #endif
  1559. X
  1560. #ifndef WIFCORESIG
  1561. # ifndef BSDWAIT /* if wait is NOT a union: */
  1562. #  define WIFCORESIG(status) (status & 0200)
  1563. # else
  1564. #  define WIFCORESIG(status) status.w_T.w_Coredump
  1565. # endif
  1566. #endif
  1567. X
  1568. #ifndef WEXITSTATUS
  1569. # ifndef BSDWAIT /* if wait is NOT a union: */
  1570. #  define WEXITSTATUS(status) ((status >> 8) & 0377)
  1571. # else
  1572. #  define WEXITSTATUS(status) status.w_T.w_Retcode
  1573. # endif
  1574. #endif
  1575. X
  1576. char *shellaka = NULL;
  1577. X
  1578. /*
  1579. X * Do this last
  1580. X */
  1581. #include "extern.h"
  1582. X
  1583. /*
  1584. X * XXX: Missing system header files.
  1585. X */
  1586. #ifdef USEVARARGS
  1587. # ifndef VPRNT_DECLARED
  1588. int vsprintf __P((char *, char *, va_list));
  1589. # endif /* VPRNT_DECLARED */
  1590. #endif
  1591. int select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *));
  1592. X
  1593. static void
  1594. brktty()
  1595. {
  1596. #ifdef POSIX
  1597. X  setsid();        /* will break terminal affiliation */
  1598. # ifdef BSD
  1599. X  ioctl(0, TIOCSCTTY, 0);
  1600. # endif /* BSD */
  1601. #else
  1602. # ifdef SYSV
  1603. X  setpgrp();        /* will break terminal affiliation */
  1604. # else
  1605. #  ifdef BSDJOBS
  1606. X  if (DevTty)
  1607. X    if (ioctl(DevTty, TIOCNOTTY, (char *) 0) != 0)
  1608. X      debug2("brktty: ioctl(DevTty=%d, TIOCNOTTY, 0) = %d\n", DevTty, errno);
  1609. #  endif
  1610. # endif
  1611. #endif
  1612. }
  1613. X
  1614. static void
  1615. freetty()
  1616. {
  1617. X  brktty();
  1618. #if defined(BSDJOBS) && !(defined(POSIX) || defined(SYSV))
  1619. X  if (DevTty >= 0)
  1620. X    {
  1621. X      close(DevTty);
  1622. X      DevTty = -1;
  1623. X    }
  1624. #endif
  1625. X  close(0);
  1626. X  close(1);
  1627. X  close(2);
  1628. X  debug("did freetty\n");
  1629. }
  1630. X
  1631. static void
  1632. fgtty()
  1633. {
  1634. #ifdef BSDJOBS
  1635. X  int mypid;
  1636. X
  1637. X  mypid = getpid();
  1638. X
  1639. # ifdef BSDI
  1640. X  setsid();
  1641. X  ioctl(0, TIOCSCTTY, 0);
  1642. # endif /* BSDI */
  1643. X
  1644. # ifdef POSIX
  1645. X  if (tcsetpgrp(0, mypid))
  1646. X    {
  1647. X      debug1("fgtty: tcsetpgrp: %d\n", errno);
  1648. X      /* error is likely to have side-effects -- better to warn our user */
  1649. X      SendErrorMsg("fgtty: Could not set process group id in tty");
  1650. X    }
  1651. # else
  1652. X  if (ioctl(0, TIOCSPGRP, &mypid) != 0)
  1653. X    debug1("fgtty: TIOSETPGRP: %d\n", errno);
  1654. X  /* posix setsid() in brktty() from freetty() already made us leader */
  1655. X  if (setpgrp(0, mypid))
  1656. X    debug1("fgtty: setpgrp: %d\n", errno);
  1657. # endif /* POSIX */
  1658. #endif /* BSDJOBS */
  1659. }
  1660. X
  1661. #ifdef hpux
  1662. /*
  1663. X * hpux has berkeley signal semantics if we use sigvector,
  1664. X * but not, if we use signal, so we define our own signal() routine.
  1665. X * (jw)
  1666. X */
  1667. void (*signal(sig, func)) ()
  1668. int sig;
  1669. void (*func) ();
  1670. {
  1671. X  struct sigvec osv, sv;
  1672. X
  1673. X  sv.sv_handler = func;
  1674. X  sv.sv_mask = sigmask(sig);
  1675. X  sv.sv_flags = SV_BSDSIG;
  1676. X  if (sigvector(sig, &sv, &osv) < 0)
  1677. X    return (BADSIG);
  1678. X  return (osv.sv_handler);
  1679. }
  1680. #endif    /* hpux */
  1681. X
  1682. #ifndef USEBCOPY
  1683. void bcopy(s1, s2, len)
  1684. register char *s1, *s2;
  1685. register int len;
  1686. {
  1687. X  if (s1 < s2 && s2 < s1 + len)
  1688. X    {
  1689. X      s1 += len;
  1690. X      s2 += len;
  1691. X      while (len-- > 0)
  1692. X    *--s2 = *--s1;
  1693. X    }
  1694. X  else
  1695. X    while (len-- > 0)
  1696. X      *s2++ = *s1++;
  1697. }
  1698. #endif    /* USEBCOPY */
  1699. X
  1700. void bclear(p, n)
  1701. int n;
  1702. char *p;
  1703. {
  1704. X  bcopy(blank, p, n);
  1705. }
  1706. X
  1707. static void
  1708. closeallfiles()
  1709. {
  1710. X  int f;
  1711. #ifdef SVR4
  1712. X  struct rlimit rl;
  1713. X  
  1714. X  if ((getrlimit(RLIMIT_NOFILE, &rl) == 0) && rl.rlim_max != RLIM_INFINITY)
  1715. X    f = rl.rlim_max;
  1716. X  else
  1717. #endif /* SVR4 */
  1718. #if defined(SYSV) && !defined(ISC)
  1719. X  f = NOFILE;
  1720. #else /* SYSV && !ISC */
  1721. X  f = getdtablesize();
  1722. #endif /* SYSV && !ISC */
  1723. X  while (--f > 2)
  1724. X    close(f);
  1725. }
  1726. X  
  1727. static int InterruptPlease = 0;
  1728. X
  1729. void main(ac, av)
  1730. int ac;
  1731. char **av;
  1732. {
  1733. X  register int n, len;
  1734. X  register struct win *p;
  1735. X  char *ap, *aka = NULL;
  1736. X  char *av0;
  1737. X  char socknamebuf[2 * MAXSTR];
  1738. X  int s = 0;
  1739. X  fd_set r, w, e;
  1740. X  int mflag = 0;
  1741. X  struct timeval tv;
  1742. X  int nsel;
  1743. X  char buf[IOSIZE], *bufp, *myname = (ac == 0) ? "screen" : av[0];
  1744. X  struct stat st;
  1745. X  int buflen, tmp;
  1746. #ifdef _MODE_T            /* (jw) */
  1747. X  mode_t oumask;
  1748. #else
  1749. X  int oumask;
  1750. #endif
  1751. #ifdef SYSV
  1752. X  struct utsname utsnam;
  1753. #endif
  1754. X
  1755. X  /*
  1756. X   *  First, close all unused descriptors
  1757. X   *  (otherwise, we might have problems with the select() call)
  1758. X   */
  1759. X  closeallfiles();
  1760. #ifdef DEBUG
  1761. X  (void) mkdir("/tmp/debug", 0777);
  1762. X  if ((dfp = fopen("/tmp/debug/screen.front", "w")) == NULL)
  1763. X    dfp = stderr;
  1764. X  else
  1765. X    (void) chmod("/tmp/debug/screen.front", 0666);
  1766. #endif
  1767. X  debug1("-- screen debug started %s\n", *av);
  1768. #ifdef POSIX
  1769. X  debug("POSIX\n");
  1770. #endif
  1771. #ifdef TERMIO
  1772. X  debug("TERMIO\n");
  1773. #endif
  1774. #ifdef SYSV
  1775. X  debug("SYSV\n");
  1776. #endif
  1777. #ifdef NAMEDPIPE
  1778. X  debug("NAMEDPIPE\n");
  1779. #endif
  1780. #if defined(SIGWINCH) && defined(TIOCGWINSZ)
  1781. X  debug("Window changing enabled\n");
  1782. #endif
  1783. #ifdef NOREUID
  1784. X  debug("NOREUID\n");
  1785. #endif
  1786. #ifdef hpux
  1787. X  debug("hpux\n");
  1788. #endif
  1789. #ifdef USEBCOPY
  1790. X  debug("USEBCOPY\n");
  1791. #endif
  1792. #ifdef UTMPOK
  1793. X  debug("UTMPOK\n");
  1794. #endif
  1795. #ifdef LOADAV
  1796. X  debug("LOADAV\n");
  1797. #endif
  1798. #ifdef NETHACK
  1799. X  debug("NETHACK\n");
  1800. #endif
  1801. #ifdef TERMINFO
  1802. X  debug("TERMINFO\n");
  1803. #endif
  1804. #ifdef NAME_MAX
  1805. X  debug1("NAME_MAX = %d\n", NAME_MAX);
  1806. #endif
  1807. X
  1808. X  BellString = SaveStr("Bell in window %");
  1809. X  VisualBellString = SaveStr("   Wuff,  Wuff!!  ");
  1810. X  ActivityString = SaveStr("Activity in window %");
  1811. X  BufferFile = SaveStr("/tmp/screen-exchange");
  1812. X  PowDetachString = 0;
  1813. X  default_histheight = DEFAULTHISTHEIGHT;
  1814. X  default_startup = (ac > 1) ? 0 : 1;
  1815. X  adaptflag = 0;
  1816. X  slowpaste = 0;
  1817. X  VBellWait = VBELLWAIT;
  1818. X  MsgWait = MSGWAIT;
  1819. X  MsgMinWait = MSGMINWAIT;
  1820. X  CompileKeys((char *)NULL, mark_key_tab);
  1821. X
  1822. X  av0 = *av;
  1823. X  while (ac > 0)
  1824. X    {
  1825. X      ap = *++av;
  1826. X      if (--ac > 0 && *ap == '-')
  1827. X    {
  1828. X      switch (ap[1])
  1829. X        {
  1830. X        case 'a':
  1831. X          allflag = 1;
  1832. X          break;
  1833. X        case 'A':
  1834. X          adaptflag = 1;
  1835. X          break;
  1836. X        case 'c':
  1837. X          if (ap[2])
  1838. X        RcFileName = ap + 2;
  1839. X          else
  1840. X        {
  1841. X          if (--ac == 0)
  1842. X            exit_with_usage(myname);
  1843. X          RcFileName = *++av;
  1844. X        }
  1845. X          break;
  1846. X        case 'e':
  1847. X          if (ap[2])
  1848. X        ap += 2;
  1849. X          else
  1850. X        {
  1851. X          if (--ac == 0)
  1852. X            exit_with_usage(myname);
  1853. X          ap = *++av;
  1854. X        }
  1855. X          if (!ParseEscape(ap))
  1856. X        Msg(0, "Two characters are required with -e option.");
  1857. X          break;
  1858. X        case 'f':
  1859. SHAR_EOF
  1860. true || echo 'restore of screen3.2/screen.c failed'
  1861. fi
  1862. echo 'End of  part 5'
  1863. echo 'File screen3.2/screen.c is continued in part 6'
  1864. echo 6 > _shar_seq_.tmp
  1865. exit 0
  1866. exit 0 # Just in case...
  1867.