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