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