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