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