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