]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - usr.bin/window/window.1
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / usr.bin / window / window.1
1 .\" Copyright (c) 1985, 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Edward Wang at The University of California, Berkeley.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)window.1    8.2 (Berkeley) 12/30/93
36 .\" $FreeBSD$
37 .\"
38 .Dd December 30, 1993
39 .Dt WINDOW 1
40 .Os
41 .Sh NAME
42 .Nm window
43 .Nd window environment
44 .Sh SYNOPSIS
45 .Nm
46 .Op Fl t
47 .Op Fl f
48 .Op Fl d
49 .Op Fl e Ar escape-char
50 .Op Fl c Ar command
51 .Sh DESCRIPTION
52 The
53 .Nm
54 utility implements a window environment on
55 .Tn ASCII
56 terminals.
57 .Pp
58 A window is a rectangular portion of the physical terminal
59 screen associated with a set of processes.
60 Its size and
61 position can be changed by the user at any time.
62 Processes
63 communicate with their window in the same way they normally
64 interact with a terminal\-through their standard input, output,
65 and diagnostic file descriptors.
66 The window program handles the
67 details of redirecting input and output to and from the
68 windows.
69 At any one time, only one window can receive
70 input from the keyboard, but all windows can simultaneously send output
71 to the display.
72 .Pp
73 When
74 .Nm
75 starts up, the commands (see long commands below)
76 contained in the file
77 .Pa .windowrc
78 in the user's home directory are
79 executed.
80 If it does not exist, two equal sized windows spanning
81 the terminal screen are created by default.
82 .Pp
83 The command line options are
84 .Bl -tag -width Fl
85 .It Fl t
86 Turn on terse mode (see
87 .Ic terse
88 command below).
89 .It Fl f
90 Fast.
91 Do not perform any startup action.
92 .It Fl d
93 Ignore
94 .Pa .windowrc
95 and create the two default
96 windows instead.
97 .It Fl e Ar escape-char
98 Set the escape character to
99 .Ar escape-char .
100 .Ar Escape-char
101 can be a single character, or in the form
102 .Ic ^X
103 where
104 .Ar X
105 is any character, meaning
106 .No control\- Ns Ar X .
107 .It Fl c Ar command
108 Execute the string
109 .Ar command
110 as a long command (see below)
111 before doing anything else.
112 .El
113 .Pp
114 Windows can overlap and are framed as necessary.
115 Each window
116 is named by one of the digits ``1'' to ``9''.
117 This one-character
118 identifier, as well as a user definable label string, are displayed
119 with the window on the top edge of its frame.
120 A window can be
121 designated to be in the
122 .Ar foreground ,
123 in which case it will always be
124 on top of all normal, non-foreground windows, and can be covered
125 only by other foreground windows.
126 A window need not be completely
127 within the edges of the terminal screen.
128 Thus a large window
129 (possibly larger than the screen) may be positioned to show only
130 a portion of its full size.
131 .Pp
132 Each window has a cursor and a set of control functions.
133 Most intelligent
134 terminal operations such as line and
135 character deletion and insertion are supported.
136 Display modes
137 such as underlining and reverse video are available if they are
138 supported by the terminal.
139 In addition,
140 similar to terminals with multiple pages of memory,
141 each window has a text buffer which can have more lines than the window
142 itself.
143 .Ss Process Environment
144 With each newly created window, a shell program is spawned with its
145 process environment tailored to that window.
146 Its standard input,
147 output, and diagnostic file descriptors are bound to one end of either
148 a pseudo-terminal (see
149 .Xr pty 4 )
150 or a
151 .Ux
152 domain socket (see
153 .Xr socketpair 2 ) .
154 If a pseudo-terminal is used, then its special
155 characters and modes (see
156 .Xr stty 1 )
157 are copied from the physical
158 terminal.
159 A
160 .Xr termcap 5
161 entry tailored to this window is created
162 and passed as environment (see
163 .Xr environ 7 )
164 variable
165 .Ev TERMCAP .
166 The termcap entry contains the window's size and
167 characteristics as well as information from the physical terminal,
168 such as the existence of underline, reverse video, and other display
169 modes, and the codes produced by the terminal's function keys,
170 if any.
171 In addition, the window size attributes of the pseudo-terminal
172 are set to reflect the size of this window, and updated whenever
173 it is changed by the user.
174 In particular, the editor
175 .Xr vi 1
176 uses
177 this information to redraw its display.
178 .Ss Operation
179 During normal execution,
180 .Nm
181 can be in one of two states:
182 conversation mode and command mode.
183 In conversation mode, the
184 terminal's real cursor is placed at the cursor position of a particular
185 window--called the current window--and input from the keyboard is sent
186 to the process in that window.
187 The current window is always
188 on top of all other windows, except those in foreground.
189 In addition,
190 it is set apart by highlighting its identifier and label in reverse video.
191 .Pp
192 Typing
193 .Nm Ns 's
194 escape character (normally
195 .Ic ^P )
196 in conversation
197 mode switches it into command mode.
198 In command mode, the top line of
199 the terminal screen becomes the command prompt window, and
200 .Nm
201 interprets input from the keyboard as commands to manipulate windows.
202 .Pp
203 There are two types of commands: short commands are usually one or two
204 key strokes; long commands are strings either typed by the user in the
205 command window (see the
206 .Dq Ic \&:
207 command below), or read from a file (see
208 .Ic source
209 below).
210 .Ss Short Commands
211 Below,
212 .Ar \&#
213 represents one of the digits ``1'' to ``9''
214 corresponding to the windows 1 to 9.
215 .Ic ^X
216 means
217 .No control\- Ns Ar X ,
218 where
219 .Ar X
220 is any character.
221 In particular,
222 .Ic ^^
223 is
224 .Li control\-^ .
225 .Ar Escape
226 is the escape key, or
227 .Ic ^\&[ .
228 .Bl -tag -width Ds
229 .It Ar #
230 Select window
231 .Ar #
232 as the current window
233 and return to conversation mode.
234 .It Ic \&% Ns Ar #
235 Select window
236 .Ar #
237 but stay in command mode.
238 .It Ic ^^
239 Select the previous window and return to conversation
240 mode.
241 This is useful for toggling between two windows.
242 .It Ic escape
243 Return to conversation mode.
244 .It Ic ^P
245 Return to conversation mode and write
246 .Ic ^P
247 to the
248 current window.
249 Thus, typing two
250 .Ic ^P Ns 's
251 in conversation
252 mode sends one to the current window.
253 If the
254 .Nm
255 escape is changed to some other character, that
256 character takes the place of
257 .Ic ^P
258 here.
259 .It Ic \&?
260 List a short summary of commands.
261 .It Ic ^L
262 Refresh the screen.
263 .It Ic q
264 Exit
265 .Nm .
266 Confirmation is requested.
267 .It Ic ^Z
268 Suspend
269 .Nm .
270 .It Ic w
271 Create a new window.
272 The user is prompted for the positions
273 of the upper left and lower right corners of the window.
274 The cursor is placed on the screen and the keys ``h'', ``j'',
275 ``k'', and ``l''
276 move the cursor left, down, up, and right, respectively.
277 The keys ``H'', ``J'', ``K'', and ``L'' move the cursor to the respective
278 limits of the screen.
279 Typing a number before the movement keys
280 repeats the movement that number of times.
281 Return enters the cursor position
282 as the upper left corner of the window.
283 The lower right corner
284 is entered in the same manner.
285 During this process,
286 the placement of the new window is indicated by a rectangular
287 box drawn on the screen, corresponding to where the new window
288 will be framed.
289 Typing escape at any point
290 cancels this command.
291 .Pp
292 This window becomes the current window,
293 and is given the first available ID.
294 The default buffer size
295 is used (see
296 .Ar default_nline
297 command below).
298 .Pp
299 Only fully visible windows can be created this way.
300 .It Ic c Ns Ar #
301 Close window
302 .Ar # .
303 The process in the window is sent
304 the hangup signal (see
305 .Xr kill 1 ) .
306 The
307 .Xr csh 1
308 utility should
309 handle this signal correctly and cause no problems.
310 .It Ic m Ns Ar #
311 Move window
312 .Ar #
313 to another location.
314 A box in the shape
315 of the window is drawn on
316 the screen to indicate the new position of the window, and the same keys as
317 those for the
318 .Ic w
319 command are used to position the box.
320 The
321 window can be moved partially off-screen.
322 .It Ic M Ns Ar #
323 Move window
324 .Ar #
325 to its previous position.
326 .It Ic s Ns Ar #
327 Change the size of window
328 .Ar # .
329 The user is prompted
330 to enter the new lower right corner of the window.
331 A box
332 is drawn to indicate the new window size.
333 The same
334 keys used in
335 .Ic w
336 and
337 .Ic m
338 are used to enter the position.
339 .It Ic S Ns Ar #
340 Change window
341 .Ar #
342 to its previous size.
343 .It Ic ^Y
344 Scroll the current window up by one line.
345 .It Ic ^E
346 Scroll the current window down by one line.
347 .It Ic ^U
348 Scroll the current window up by half the window size.
349 .It Ic ^D
350 Scroll the current window down by half the window size.
351 .It Ic ^B
352 Scroll the current window up by the full window size.
353 .It Ic ^F
354 Scroll the current window down by the full window size.
355 .It Ic h
356 Move the cursor of the current window left by one column.
357 .It Ic j
358 Move the cursor of the current window down by one line.
359 .It Ic k
360 Move the cursor of the current window up by one line.
361 .It Ic l
362 Move the cursor of the current window right by one column.
363 .It Ic y
364 Yank.
365 The user is prompted to enter two points within the current
366 window.
367 Then the content of the current window between those two points
368 is saved in the yank buffer.
369 .It Ic p
370 Put.
371 The content of the yank buffer is written to the current
372 window as input.
373 .It Ic ^S
374 Stop output in the current window.
375 .It Ic ^Q
376 Start output in the current window.
377 .It Ic :
378 Enter a line to be executed as long commands.
379 Normal line
380 editing characters (erase character, erase word, erase line)
381 are supported.
382 .El
383 .Ss Long Commands
384 Long commands are a sequence of statements
385 parsed much like a programming language, with a syntax
386 similar to that of C.
387 Numeric and string expressions and variables
388 are supported, as well as conditional statements.
389 .Pp
390 There are two data types: string and number.
391 A string is a sequence
392 of letters or digits beginning with a letter.
393 ``_'' and ``.'' are
394 considered letters.
395 Alternately, non-alphanumeric characters can
396 be included in strings by quoting them in ``"'' or escaping them
397 with ``\\''.
398 In addition, the ``\\'' sequences of C are supported,
399 both inside and outside quotes (e.g., ``\\n'' is a new line,
400 ``\\r'' a carriage return).
401 For example, these are legal strings:
402 abcde01234, "&#$^*&#", ab"$#"cd, ab\\$\\#cd, "/usr/ucb/window".
403 .Pp
404 A number is an integer value in one of three forms:
405 a decimal number, an octal number preceded by ``0'',
406 or a hexadecimal number preceded by ``0x'' or ``0X''.
407 The natural
408 machine integer size is used (i.e., the signed integer type
409 of the C compiler).
410 As in C, a non-zero number represents
411 a boolean true.
412 .Pp
413 The character ``#'' begins a comment which terminates at the
414 end of the line.
415 .Pp
416 A statement is either a conditional or an expression.
417 Expression
418 statements are terminated with a new line or ``;''.
419 To continue
420 an expression on the next line, terminate the first line with ``\\''.
421 .Ss Conditional Statement
422 The
423 .Nm
424 utility has a single control structure:
425 the fully bracketed if statement in the form
426 .Pp
427 .Bd -literal -offset indent -compact
428 if <expr> then
429 \t<statement>
430 \t...
431 elsif <expr> then
432 \t<statement>
433 \t...
434 else
435 \t<statement>
436 \t...
437 endif
438 .Ed
439 .Pp
440 The
441 .Ic else
442 and
443 .Ic elsif
444 parts are optional, and the latter can
445 be repeated any number of times.
446 <Expr>
447 must be numeric.
448 .Ss Expressions
449 Expressions in
450 .Nm
451 are similar to those in the
452 C language, with most C operators supported on numeric
453 operands.
454 In addition, some are overloaded to operate on strings.
455 .Pp
456 When an expression is used as a statement, its value is discarded
457 after evaluation.
458 Therefore, only expressions with side
459 effects (assignments and function calls) are useful as statements.
460 .Pp
461 Single valued (no arrays) variables are supported, of both
462 numeric and string values.
463 Some variables are predefined.
464 They
465 are listed below.
466 .Pp
467 The operators in order of increasing precedence:
468 .Bl -tag -width Fl
469 .It Xo
470 .Aq Va expr1
471 .Ic =
472 .Aq Va expr2
473 .Xc
474 Assignment.
475 The variable of name
476 .Aq Va expr1 ,
477 which must be string valued,
478 is assigned the result of
479 .Aq Va expr2 .
480 Returns the value of
481 .Aq Va expr2 .
482 .It Xo
483 .Aq Va expr1
484 .Ic \&?
485 .Aq Va expr2
486 .Ic :
487 .Aq Va expr3
488 .Xc
489 Returns the value of
490 .Aq Va expr2
491 if
492 .Aq Va expr1
493 evaluates true
494 (non-zero numeric value); returns the value of
495 .Aq Va expr3
496 otherwise.
497 Only
498 one of
499 .Aq Va expr2
500 and
501 .Aq Va expr3
502 is evaluated.
503 .Aq Va Expr1
504 must
505 be numeric.
506 .It Xo
507 .Aq Va expr1
508 .Ic \&|\&|
509 .Aq Va expr2
510 .Xc
511 Logical or.
512 Numeric values only.
513 Short circuit evaluation is supported
514 (i.e., if
515 .Aq Va expr1
516 evaluates true, then
517 .Aq Va expr2
518 is not evaluated).
519 .It Xo
520 .Aq Va expr1
521 .Ic \&&\&&
522 .Aq Va expr2
523 .Xc
524 Logical and with short circuit evaluation.
525 Numeric values only.
526 .It Xo
527 .Aq Va expr1
528 .Ic \&|
529 .Aq Va expr2
530 .Xc
531 Bitwise or.
532 Numeric values only.
533 .It Xo
534 .Aq Va expr1
535 .Ic ^
536 .Aq Va expr2
537 .Xc
538 Bitwise exclusive or.
539 Numeric values only.
540 .It Xo
541 .Aq Va expr1
542 .Ic \&&
543 .Aq Va expr2
544 .Xc
545 Bitwise and.
546 Numeric values only.
547 .It Xo
548 .Aq Va expr1
549 .Ic ==
550 .Aq Va expr2 ,
551 .Aq Va expr1
552 .Ic !=
553 .Aq expr2
554 .Xc
555 Comparison (equal and not equal, respectively).
556 The boolean
557 result (either 1 or 0) of the comparison is returned.
558 The
559 operands can be numeric or string valued.
560 One string operand
561 forces the other to be converted to a string in necessary.
562 .It Xo
563 .Aq Va expr1
564 .Ic <
565 .Aq Va expr2 ,
566 .Aq Va expr1
567 .Ic >
568 .Aq Va expr2 ,
569 .Aq Va expr1
570 .Ic <=
571 .Aq Va expr2 ,
572 .Xc
573 Less than, greater than, less than or equal to,
574 greater than or equal to.
575 Both numeric and string values, with
576 automatic conversion as above.
577 .It Xo
578 .Aq Va expr1
579 .Ic <<
580 .Aq Va expr2 ,
581 .Aq Va expr1
582 .Ic >>
583 .Aq Va expr2
584 .Xc
585 If both operands are numbers,
586 .Aq Va expr1
587 is bit
588 shifted left (or right) by
589 .Aq Va expr2
590 bits.
591 If
592 .Aq Va expr1
593 is
594 a string, then its first (or last)
595 .Aq Va expr2
596 characters are
597 returns (if
598 .Aq Va expr2
599 is also a string, then its length is used
600 in place of its value).
601 .It Xo
602 .Aq Va expr1
603 .Ic +
604 .Aq Va expr2 ,
605 .Aq Va expr1
606 .Ic -
607 .Aq Va expr2
608 .Xc
609 Addition and subtraction on numbers.
610 For ``+'', if one
611 argument is a string, then the other is converted to a string,
612 and the result is the concatenation of the two strings.
613 .It Xo
614 .Aq Va expr1
615 .Ic \&*
616 .Aq Va expr2 ,
617 .Aq Va expr1
618 .Ic \&/
619 .Aq Va expr2 ,
620 .Aq Va expr1
621 .Ic \&%
622 .Aq Va expr2
623 .Xc
624 Multiplication, division, modulo.
625 Numbers only.
626 .It Xo
627 .Ic \- Ns Aq Va expr ,
628 .Ic ~ Ns Aq Va expr ,
629 .Ic \&! Ns Aq Va expr ,
630 .Ic \&$ Ns Aq Va expr ,
631 .Ic \&$? Ns Aq Va expr
632 .Xc
633 The first three are unary minus, bitwise complement and logical complement
634 on numbers only.
635 The operator, ``$'', takes
636 .Aq Va expr
637 and returns
638 the value of the variable of that name.
639 If
640 .Aq Va expr
641 is numeric
642 with value
643 .Ar n
644 and it appears within an alias macro (see below),
645 then it refers to the nth argument of the alias invocation.
646 ``$?''
647 tests for the existence of the variable
648 .Aq Va expr ,
649 and returns 1
650 if it exists or 0 otherwise.
651 .It Xo
652 .Ao Va expr Ac Ns Pq Aq Ar arglist
653 .Xc
654 Function call.
655 .Aq Va Expr
656 must be a string that is the unique
657 prefix of the name of a builtin
658 .Nm
659 function
660 or the full name of a user defined alias macro.
661 In the case of a builtin
662 function,
663 .Aq Ar arglist
664 can be in one of two forms:
665 .Bd -literal -offset indent
666 <expr1>, <expr2>, ...
667 argname1 = <expr1>, argname2 = <expr2>, ...
668 .Ed
669 .Pp
670 The two forms can in fact be intermixed, but the result is
671 unpredictable.
672 Most arguments can be omitted; default values will
673 be supplied for them.
674 The
675 .Ar argnames
676 can be unique prefixes
677 of the argument names.
678 The commas separating
679 arguments are used only to disambiguate, and can usually be omitted.
680 .Pp
681 Only the first argument form is valid for user defined aliases.
682 Aliases
683 are defined using the
684 .Ic alias
685 builtin function (see below).
686 Arguments
687 are accessed via a variant of the variable mechanism (see ``$'' operator
688 above).
689 .Pp
690 Most functions return value, but some are used for side effect
691 only and so must be used as statements.
692 When a function or an alias is used
693 as a statement, the parentheses surrounding
694 the argument list may be omitted.
695 Aliases return no value.
696 .El
697 .Ss Builtin Functions
698 The arguments are listed by name in their natural
699 order.
700 Optional arguments are in square brackets
701 .Sq Op .
702 Arguments
703 that have no names are in angle brackets
704 .Sq <> .
705 An argument meant to be a boolean flag (often named
706 .Ar flag )
707 can be one of
708 .Ar on ,
709 .Ar off ,
710 .Ar yes ,
711 .Ar no ,
712 .Ar true ,
713 or
714 .Ar false ,
715 with
716 obvious meanings, or it can be a numeric expression,
717 in which case a non-zero value is true.
718 .Bl -tag -width Fl
719 .It Ic alias Ns Po
720 .Bq Aq Ar string ,
721 .Bq Aq Ar string\-list
722 .Pc
723 If no argument is given, all currently defined alias macros are
724 listed.
725 Otherwise,
726 .Aq Ar string
727 is defined as an alias,
728 with expansion
729 .Aq Ar string\-list > .
730 The previous definition of
731 .Aq Ar string ,
732 if any, is returned.
733 Default for
734 .Aq Ar string\-list
735 is no change.
736 .It Ic close Ns Pq Aq Ar window\-list
737 Close the windows specified in
738 .Aq Ar window\-list .
739 If
740 .Aq Ar window\-list
741 is the word
742 .Ar all ,
743 than all windows are closed.
744 No value is returned.
745 .It Ic cursormodes Ns Pq Bq Ar modes
746 Set the window cursor to
747 .Ar modes .
748 .Ar Modes
749 is the bitwise
750 or of the mode bits defined as the variables
751 .Ar m_ul
752 (underline),
753 .Ar m_rev
754 (reverse video),
755 .Ar m_blk
756 (blinking),
757 and
758 .Ar m_grp
759 (graphics, terminal dependent).
760 Return
761 value is the previous modes.
762 Default is no change.
763 For example,
764 .Li cursor($m_rev$m_blk)
765 sets the window cursors to blinking
766 reverse video.
767 .It Ic default_nline Ns Pq Bq Ar nline
768 Set the default buffer size to
769 .Ar nline .
770 Initially, it is
771 48 lines.
772 Returns the old default buffer size.
773 Default is
774 no change.
775 Using a very large buffer can slow the program down
776 considerably.
777 .It Ic default_shell Ns Pq Bq Aq Ar string\-list
778 Set the default window shell program to
779 .Aq Ar string\-list .
780 Returns
781 the first string in the old shell setting.
782 Default is no change.
783 Initially,
784 the default shell is taken from the environment variable
785 .Ev SHELL .
786 .It Ic default_smooth Ns Pq Bq Ar flag
787 Set the default value of the
788 .Ar smooth
789 argument
790 to the command
791 .Nm
792 (see below).
793 The argument
794 is a boolean flag (one of
795 .Ar on ,
796 .Ar off ,
797 .Ar yes ,
798 .Ar no ,
799 .Ar true ,
800 .Ar false ,
801 or a number,
802 as described above).
803 Default is no change.
804 The old value (as a number) is returned.
805 The initial value is 1 (true).
806 .It Xo
807 .Ic echo Ns ( Op Ar window ,
808 .Bq Aq Ar string\-list )
809 .Xc
810 Write the list of strings,
811 .Aq Ar string-list ,
812 to
813 .Nm ,
814 separated
815 by spaces and terminated with a new line.
816 The strings are only
817 displayed in the window, the processes in the window are not
818 involved (see
819 .Ic write
820 below).
821 No value is returned.
822 Default
823 is the current window.
824 .It Ic escape Ns Pq Bq Ar escapec
825 Set the escape character to
826 .Ar escape-char .
827 Returns the old
828 escape character as a one-character string.
829 Default is no
830 change.
831 .Ar Escapec
832 can be a string of a single character, or
833 in the form
834 .Fl ^X ,
835 meaning
836 .No control\- Ns Ar X .
837 .It Xo
838 .Ic foreground Ns ( Bq Ar window ,
839 .Bq Ar flag )
840 .Xc
841 Move
842 .Nm
843 in or out of foreground.
844 .Ar Flag
845 is a boolean value.
846 The old foreground flag
847 is returned.
848 Default for
849 .Nm
850 is the current window,
851 default for
852 .Ar flag
853 is no change.
854 .It Xo
855 .Ic label Ns ( Bq Ar window ,
856 .Bq Ar label )
857 .Xc
858 Set the label of
859 .Nm
860 to
861 .Ar label .
862 Returns the old
863 label as a string.
864 Default for
865 .Nm
866 is the current
867 window, default for
868 .Ar label
869 is no change.
870 To turn
871 off a label, set it to an empty string ("").
872 .It Ic list Ns Pq
873 No arguments.
874 List the identifiers and labels of all windows.
875 No
876 value is returned.
877 .It Ic select Ns Pq Bq Ar window
878 Make
879 .Nm
880 the current window.
881 The previous current window
882 is returned.
883 Default is no change.
884 .It Ic source Ns Pq Ar filename
885 Read and execute the long commands in
886 .Ar filename .
887 Returns \-1 if the file cannot be read, 0 otherwise.
888 .It Ic terse Ns Pq Bq flag
889 Set terse mode to
890 .Ar flag .
891 In terse mode, the command window
892 stays hidden even in command mode, and errors are reported by
893 sounding the terminal's bell.
894 .Ar Flag
895 can take on the same
896 values as in
897 .Ar foreground
898 above.
899 Returns the old terse flag.
900 Default is no change.
901 .It Ic unalias Ns Pq Ar alias
902 Undefine
903 .Ar alias .
904 Returns -1 if
905 .Ar alias
906 does not exist,
907 0 otherwise.
908 .It Ic unset Ns Pq Ar variable
909 Undefine
910 .Ar variable .
911 Returns -1 if
912 .Ar variable
913 does not exist,
914 0 otherwise.
915 .It Ic variables Ns Pq
916 No arguments.
917 List all variables.
918 No value is returned.
919 .It Xo
920 .Ic window Ns ( Bq Ar row ,
921 .Bq Ar column ,
922 .Bq Ar nrow ,
923 .Bq Ar ncol ,
924 .Bq Ar nline ,
925 .Bq Ar label ,
926 .Bq Ar pty ,
927 .Bq Ar frame ,
928 .Bq Ar mapnl ,
929 .Bq Ar keepopen ,
930 .Bq Ar smooth ,
931 .Bq Ar shell ) .
932 .Xc
933 Open a window with upper left corner at
934 .Ar row ,
935 .Ar column
936 and size
937 .Ar nrow ,
938 .Ar ncol .
939 If
940 .Ar nline
941 is specified,
942 then that many lines are allocated for the text buffer.
943 Otherwise,
944 the default buffer size is used.
945 Default values for
946 .Ar row ,
947 .Ar column ,
948 .Ar nrow ,
949 and
950 .Ar ncol
951 are, respectively,
952 the upper, left-most, lower, or right-most extremes of the
953 screen.
954 .Ar Label
955 is the label string.
956 .Ar Frame ,
957 .Ar pty ,
958 and
959 .Ar mapnl
960 are flag values
961 interpreted in the same way as the argument to
962 .Ar foreground
963 (see above);
964 they mean, respectively, put a frame around this window (default true),
965 allocate pseudo-terminal for this window rather than socketpair (default
966 true), and map new line characters in this window to carriage return
967 and line feed (default true if socketpair is used, false otherwise).
968 Normally, a window is automatically closed when its process
969 exits.
970 Setting
971 .Ar keepopen
972 to true (default false) prevents this
973 action.
974 When
975 .Ar smooth
976 is true, the screen is updated more frequently
977 (for this window) to produce a more terminal-like behavior.
978 The default value of
979 .Ar smooth
980 is set by the
981 .Ar default_smooth
982 command (see above).
983 .Ar Shell
984 is a list of strings that will be used as the shell
985 program to place in the window (default is the program specified
986 by
987 .Ar default_shell ,
988 see above).
989 The created window's identifier
990 is returned as a number.
991 .It Xo
992 .Ic write Ns ( Bq Ar window ,
993 .Bq Aq Ar string\-list )
994 .Xc
995 Send the list of strings,
996 .Aq Ar string-list ,
997 to
998 .Nm ,
999 separated
1000 by spaces but not terminated with a new line.
1001 The strings are actually
1002 given to the window as input.
1003 No value is returned.
1004 Default
1005 is the current window.
1006 .El
1007 .Ss Predefined Variables
1008 These variables are for information only.
1009 Redefining them does
1010 not affect the internal operation of
1011 .Nm .
1012 .Bl -tag -width modes
1013 .It Ar baud
1014 The baud rate as a number between 50 and 38400.
1015 .It Ar modes
1016 The display modes (reverse video, underline, blinking, graphics)
1017 supported by the physical terminal.
1018 The value of
1019 .Ar modes
1020 is the bitwise or of some of the one bit values,
1021 .Ar m_blk ,
1022 .Ar m_grp ,
1023 .Ar m_rev ,
1024 and
1025 .Ar m_ul
1026 (see below).
1027 These values are useful
1028 in setting the window cursors' modes (see
1029 .Ar cursormodes
1030 above).
1031 .It Ar m_blk
1032 The blinking mode bit.
1033 .It Ar m_grp
1034 The graphics mode bit (not very useful).
1035 .It Ar m_rev
1036 The reverse video mode bit.
1037 .It Ar m_ul
1038 The underline mode bit.
1039 .It Ar ncol
1040 The number of columns on the physical screen.
1041 .It Ar nrow
1042 The number of rows on the physical screen.
1043 .It Ar term
1044 The terminal type.
1045 The standard name, found in the second name
1046 field of the terminal's
1047 .Ev TERMCAP
1048 entry, is used.
1049 .El
1050 .Sh ENVIRONMENT
1051 The
1052 .Nm
1053 utility utilizes these environment variables:
1054 .Ev HOME ,
1055 .Ev SHELL ,
1056 .Ev TERM ,
1057 .Ev TERMCAP ,
1058 .Ev WINDOW_ID .
1059 .Sh FILES
1060 .Bl -tag -width /dev/[pt]ty[pq]? -compact
1061 .It Pa ~/.windowrc
1062 startup command file.
1063 .It Pa /dev/[pt]ty[pq]?
1064 pseudo-terminal devices.
1065 .El
1066 .Sh DIAGNOSTICS
1067 Should be self explanatory.
1068 .Sh HISTORY
1069 The
1070 .Nm
1071 command appeared in
1072 .Bx 4.3 .