|
|
1.1 root 1: .\" Copyright (c) 1985 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)window.1 6.5 (Berkeley) 5/12/86
6: .\"
7: .TH WINDOW 1 "May 12, 1986"
8: .UC 6
9: .SH NAME
10: window \- window environment
11: .SH SYNOPSIS
12: .B window
13: [
14: .B \-t
15: ] [
16: .B \-f
17: ] [
18: .B \-d
19: ] [
20: .B \-e escape-char
21: ] [
22: .B \-c command
23: ]
24: .SH DESCRIPTION
25: \fIWindow\fP implements a window environment on
26: ASCII terminals.
27: .PP
28: A window is a rectangular portion of the physical terminal
29: screen associated with a set of processes. Its size and
30: position can be changed by the user at any time. Processes
31: communicate with their window in the same way they normally
32: interact with a terminal--through their standard input, output,
33: and diagnostic file descriptors. The window program handles the
34: details of redirecting input an output to and from the
35: windows. At any one time, only one window can receive
36: input from the keyboard, but all windows can simultaneously send output
37: to the display.
38: .PP
39: Windows can overlap and are framed as necessary. Each window
40: is named by one of the digits ``1'' to ``9''. This one character
41: identifier, as well as a user definable label string, are displayed
42: with the window on the top edge of its frame. A window can be
43: designated to be in the \fIforeground\fP, in which case it will always be
44: on top of all normal, non-foreground windows, and can be covered
45: only by other foreground windows. A window need not be completely
46: within the edges of the terminal screen. Thus a large window
47: (possibly larger than the screen) may be positioned to show only
48: a portion of its full size.
49: .PP
50: Each window has a cursor and a set of control functions. Most intelligent
51: terminal operations such as line and
52: character deletion and insertion are supported. Display modes
53: such as underlining and reverse video are available if they are
54: supported by the terminal. In addition,
55: similar to terminals with multiple pages of memory,
56: each window has a text buffer which can have more lines than the window
57: itself.
58: .SH OPTIONS
59: When \fIwindow\fP starts up, the commands (see long commands below)
60: contained in the file \fI.windowrc\fP in the user's home directory are
61: executed. If it does not exist, two equal sized windows spanning
62: the terminal screen are created by default.
63: .PP
64: The command line options are
65: .TP
66: .B \-t
67: Turn on terse mode (see \fIterse\fP command below).
68: .TP
69: .B \-f
70: Fast. Don't perform any startup action.
71: .TP
72: .B \-d
73: Ignore \fI.windowrc\fP and create the two default
74: windows instead.
75: .TP
76: .B \-e escape-char
77: Set the escape character to \fIescape-char\fP. \fIEscape-char\fP
78: can be a single character, or in the form \fI^X\fP where \fIX\fP
79: is any character, meaning control-\fIX\fP.
80: .TP
81: .B \-c command
82: Execute the string \fIcommand\fP as a long command (see below)
83: before doing anything else.
84: .SH "PROCESS ENVIRONMENT"
85: With each newly created window, a shell program is spawned with its
86: process environment tailored to that window. Its standard input,
87: output, and diagnostic file descriptors are bound to one end of either
88: a pseudo-terminal (\fIpty\fP (4)) or a UNIX domain socket
89: (\fIsocketpair\fP (4)). If a pseudo-terminal is used, then its special
90: characters and modes (see \fIstty\fP (1)) are copied from the physical
91: terminal. A \fItermcap\fP (5) entry tailored to this window is created
92: and passed as environment (\fIenviron\fP (5)) variable
93: \fITERMCAP\fP. The termcap entry contains the window's size and
94: characteristics as well as information from the physical terminal,
95: such as the existence of underline, reverse video, and other display
96: modes, and the codes produced by the terminal's function keys,
97: if any. In addition, the window size attributes of the pseudo-terminal
98: are set to reflect the size of this window, and updated whenever
99: it is changed by the user. In particular, the editor \fIvi\fP (1) uses
100: this information to redraw its display.
101: .SH OPERATION
102: .PP
103: During normal execution, \fIwindow\fP can be in one of two states:
104: conversation mode and command mode. In conversation mode, the
105: terminal's real cursor is placed at the cursor position of a particular
106: window--called the current window--and input from the keyboard is sent
107: to the process in that window. The current window is always
108: on top of all other windows, except those in foreground. In addition,
109: it is set apart by highlighting its identifier and label in reverse video.
110: .PP
111: Typing \fIwindow\fP's escape character (normally ^P) in conversation
112: mode switches it into command mode. In command mode, the top line of
113: the terminal screen becomes the command prompt window, and \fIwindow\fP
114: interprets input from the keyboard as commands to manipulate windows.
115: .PP
116: There are two types of commands: short commands are usually one or two
117: key strokes; long commands are strings either typed by the user in the
118: command window (see the ``:'' command below), or read from a file (see
119: \fIsource\fP below).
120: .SH "SHORT COMMANDS"
121: Below, \fI#\fP represents one of the digits ``1'' to ``9''
122: corresponding to the windows 1 to 9. \fI^X\fP means control-\fIX\fP,
123: where \fPX\fP is any character. In particular, \fI^^\fP is
124: control-^. \fIEscape\fP is the escape key, or \fI^[\fP.
125: .TP
126: .B #
127: Select window \fI#\fP as the current window
128: and return to conversation mode.
129: .TP
130: .B %#
131: Select window \fI#\fP but stay in command mode.
132: .TP
133: .B ^^
134: Select the previous window and return to conversation
135: mode. This is useful for toggling between two windows.
136: .TP
137: .B escape
138: Return to conversation mode.
139: .TP
140: .B ^P
141: Return to conversation mode and write ^P to the
142: current window. Thus, typing two ^P's in conversation
143: mode sends one to the current window. If the \fIwindow\fP
144: escape is changed to some other character, that
145: character takes the place of ^P here.
146: .TP
147: .B ?
148: List a short summary of commands.
149: .TP
150: .B ^L
151: Redraw the screen.
152: .TP
153: .B q
154: Exit \fIwindow\fP. Confirmation is requested.
155: .TP
156: .B ^Z
157: Suspend \fIwindow\fP.
158: .TP
159: .B w
160: Create a new window. The user is prompted for the positions
161: of the upper left and lower right corners of the window.
162: The cursor is placed on the screen and the keys ``h'', ``j'',
163: ``k'', and ``l''
164: move the cursor left, down, up, and right, respectively.
165: The keys ``H'', ``J'', ``K'', and ``L'' move the cursor to the respective
166: limits of the screen. Typing a number before the movement keys
167: repeats the movement that number of times. Return enters the cursor position
168: as the upper left corner of the window. The lower right corner
169: is entered in the same manner. During this process,
170: the placement of the new window is indicated by a rectangular
171: box drawn on the screen, corresponding to where the new window
172: will be framed. Typing escape at any point
173: cancels this command.
174: .IP
175: This window becomes the current window,
176: and is given the first available ID. The default buffer size
177: is used (see \fInline\fP command below).
178: .IP
179: Only fully visible windows can be created this way.
180: .TP
181: .B c#
182: Close window \fI#\fP. The process in the window is sent
183: the hangup signal (see \fIkill\fP (1)). \fICsh\fP (1) should
184: handle this signal correctly and cause no problems.
185: .TP
186: .B m#
187: Move window \fI#\fP to another location. A box in the shape
188: of the window is drawn on
189: the screen to indicate the new position of the window, and the same keys as
190: those for the \fIw\fP command are used to position the box. The
191: window can be moved partially off-screen.
192: .TP
193: .B M#
194: Move window \fI#\fP to its previous position.
195: .TP
196: .B s#
197: Change the size of window \fI#\fP. The user is prompted
198: to enter the new lower right corner of the window. A box
199: is drawn to indicate the new window size. The same
200: keys used in \fIw\fP and \fIm\fP are used to enter the position.
201: .TP
202: .B S#
203: Change window \fI#\fP to its previous size.
204: .TP
205: .B ^Y
206: Scroll the current window up by one line.
207: .TP
208: .B ^E
209: Scroll the current window down by one line.
210: .TP
211: .B ^U
212: Scroll the current window up by half the window size.
213: .TP
214: .B ^D
215: Scroll the current window down by half the window size.
216: .TP
217: .B ^B
218: Scroll the current window up by the full window size.
219: .TP
220: .B ^F
221: Scroll the current window down by the full window size.
222: .TP
223: .B h
224: Move the cursor of the current window left by one column.
225: .TP
226: .B j
227: Move the cursor of the current window down by one line.
228: .TP
229: .B k
230: Move the cursor of the current window up by one line.
231: .TP
232: .B l
233: Move the cursor of the current window right by one column.
234: .TP
235: .B ^S
236: Stop output in the current window.
237: .TP
238: .B ^Q
239: Start output in the current window.
240: .TP
241: .B :
242: Enter a line to be executed as long commands. Normal line
243: editing characters (erase character, erase word, erase line) are
244: supported.
245: .SH "LONG COMMANDS"
246: Long commands are a sequence of statements
247: parsed much like a programming language, with a syntax
248: similar to that of C. Numeric and string expressions and variables
249: are supported, as well as conditional statements.
250: .PP
251: There are two data types: string and number. A string is a sequence
252: of letters or digits beginning with a letter. ``_'' and ``.'' are
253: considered letters. Alternately, non-alphanumeric characters can
254: be included in strings by quoting them in ``"'' or escaping them
255: with ``\\''. In addition, the ``\\'' sequences of C are supported,
256: both inside and outside quotes (e.g., ``\\n'' is a new line,
257: ``\\r'' a carriage return). For example, these are legal strings:
258: abcde01234, "&#$^*&#", ab"$#"cd, ab\\$\\#cd, "/usr/ucb/window".
259: .PP
260: A number is an integer value in one of three forms:
261: a decimal number, an octal number preceded by ``0'',
262: or a hexadecimal number preceded by ``0x'' or ``0X''. The natural
263: machine integer size is used (i.e., the signed integer type
264: of the C compiler). As in C, a non-zero number represents
265: a boolean true.
266: .PP
267: The character ``#'' begins a comment which terminates at the
268: end of the line.
269: .PP
270: A statement is either a conditional or an expression. Expression
271: statements are terminated with a new line or ``;''. To continue
272: an expression on the next line, terminate the first line with ``\\''.
273: .SH "CONDITIONAL STATEMENT"
274: \fIWindow\fP has a single control structure:
275: the fully bracketed if statement in the form
276: .nf
277: if <expr> then
278: <statement>
279: . . .
280: elsif <expr> then
281: <statement>
282: . . .
283: else
284: <statement>
285: . . .
286: endif
287: .fi
288: The \fIelse\fP and \fIelsif\fP parts are optional, and the latter can
289: be repeated any number of times. \fI<Expr>\fP must be numeric.
290: .SH EXPRESSIONS
291: Expressions in \fIwindow\fP are similar to those in the
292: C language, with most C operators supported on numeric
293: operands. In addition, some are overloaded to operate on strings.
294: .PP
295: When an expression is used as a statement, its value is discarded
296: after evaluation. Therefore, only expressions with side
297: effects (assignments and function calls) are useful as statements.
298: .PP
299: Single valued (no arrays) variables are supported, of both
300: numeric and string values. Some variables are predefined. They
301: are listed below.
302: .PP
303: The operators in order of increasing precedence:
304: .TP
305: .B <expr1> = <expr2>
306: Assignment. The variable of name \fI<expr1>\fP, which must be string valued,
307: is assigned the result of \fI<expr2>\fP. Returns the value of \fI<expr2>\fP.
308: .TP
309: .B <expr1> ? <expr2> : <expr3>
310: Returns the value of \fI<expr2>\fP if \fI<expr1>\fP evaluates true
311: (non-zero numeric value); returns the value of \fI<expr3>\fP otherwise. Only
312: one of \fI<expr2>\fP and \fI<expr3>\fP is evaluated. \fI<Expr1>\fP must
313: be numeric.
314: .TP
315: .B <expr1> || <expr2>
316: Logical or. Numeric values only. Short circuit evaluation is supported
317: (i.e., if \fI<expr1>\fP evaluates true, then \fI<expr2>\fP is not evaluated).
318: .TP
319: .B <expr1> && <expr2>
320: Logical and with short circuit evaluation. Numeric values only.
321: .TP
322: .B <expr1> | <expr2>
323: Bitwise or. Numeric values only.
324: .TP
325: .B <expr1> ^ <expr2>
326: Bitwise exclusive or. Numeric values only.
327: .TP
328: .B <expr1> & <expr2>
329: Bitwise and. Numeric values only.
330: .TP
331: .B <expr1> == <expr2>, <expr1> != <expr2>
332: Comparison (equal and not equal, respectively). The boolean
333: result (either 1 or 0) of the comparison is returned. The
334: operands can be numeric or string valued. One string operand
335: forces the other to be converted to a string in necessary.
336: .TP
337: .B <expr1> < <expr2>, <expr1> > <expr2>, <expr1> <= <expr2>, <expr1> >= <expr2>
338: Less than, greater than, less than or equal to,
339: greater than or equal to. Both numeric and string values, with
340: automatic conversion as above.
341: .TP
342: .B <expr1> << <expr2>, <expr1> >> <expr2>
343: If both operands are numbers, \fI<expr1>\fP is bit
344: shifted left (or right) by \fI<expr2>\fP bits. If \fI<expr1>\fP is
345: a string, then its first (or last) \fI<expr2>\fP characters are
346: returns (if \fI<expr2>\fP is also a string, then its length is used
347: in place of its value).
348: .TP
349: .B <expr1> + <expr2>, <expr1> - <expr2>
350: Addition and subtraction on numbers. For ``+'', if one
351: argument is a string, then the other is converted to a string,
352: and the result is the concatenation of the two strings.
353: .TP
354: .B <expr1> * <expr2>, <expr1> / <expr2>, <expr1> % <expr2>
355: Multiplication, division, modulo. Numbers only.
356: .TP
357: .B -<expr>, ~<expr>, !<expr>, $<expr>, $?<expr>
358: The first three are unary minus, bitwise complement and logical complement
359: on numbers only. The operator, ``$'', takes \fI<expr>\fP and returns
360: the value of the variable of that name. If \fI<expr>\fP is numeric
361: with value \fIn\fP and it appears within an alias macro (see below),
362: then it refers to the nth argument of the alias invocation. ``$?''
363: tests for the existence of the variable \fI<expr>\fP, and returns 1
364: if it exists or 0 otherwise.
365: .TP
366: .B <expr>(<arglist>)
367: Function call. \fI<Expr>\fP must be a string that is the unique
368: prefix of the name of a builtin \fIwindow\fP function
369: or the full name of a user defined alias macro. In the case of a builtin
370: function, \fI<arglist>\fP can be in one of two forms:
371: .br
372: <expr1>, <expr2>, . . .
373: .br
374: argname1 = <expr1>, argname2 = <expr2>, . . .
375: .br
376: The two forms can in fact be intermixed, but the result is
377: unpredictable. Most arguments can be omitted; default values will
378: be supplied for them. The \fIargnames\fP can be unique prefixes
379: of the the argument names. The commas separating
380: arguments are used only to disambiguate, and can usually be omitted.
381: .IP
382: Only the first argument form is valid for user defined aliases. Aliases
383: are defined using the \fIalias\fP builtin function (see below). Arguments
384: are accessed via a variant of the variable mechanism (see ``$'' operator
385: above).
386: .IP
387: Most functions return value, but some are used for side effect
388: only and so must be used as statements. When a function or an alias is used
389: as a statement, the parenthesis surrounding
390: the argument list may be omitted. Aliases return no value.
391: .SH "BUILTIN FUNCTIONS"
392: The arguments are listed by name in their natural
393: order. Optional arguments are in square brackets (``[ ]''). Arguments
394: that have no names are in angle brackets (``<>'').
395: .TP
396: .B alias([<string>], [<string-list>])
397: If no argument is given, all currently defined alias macros are
398: listed. Otherwise, \fI<string>\fP is defined as an alias,
399: with expansion \fI<string-list>\fP. The previous definition of
400: \fI<string>\fP, if any, is returned. Default for \fI<string-list>\fP
401: is no change.
402: .TP
403: .B close(<window-list>)
404: Close the windows specified in \fI<window-list>\fP. If \fI<window-list>\fP
405: is the word \fIall\fP, than all windows are closed. No value is returned.
406: .TP
407: .B cursormodes([modes])
408: Set the window cursor to \fImodes\fP. \fIModes\fP is the bitwise
409: or of the mode bits defined as the variables \fIm_ul\fP (underline),
410: \fIm_rev\fP (reverse video), \fIm_blk\fP (blinking),
411: and \fIm_grp\fP (graphics, terminal dependent). Return
412: value is the previous modes. Default is no change.
413: For example, cursor($m_rev|$m_blk) sets the window cursors to blinking
414: reverse video.
415: .TP
416: .B echo([window], [<string-list>])
417: Write the list of strings, \fI<string-list>\fP, to \fIwindow\fP, separated
418: by spaces and terminated with a new line. The strings are only
419: displayed in the window, the processes in the window are not
420: involved (see \fIwrite\fP below). No value is returned. Default
421: is the current window.
422: .TP
423: .B escape([escapec])
424: Set the escape character to \fIescape-char\fP. Returns the old
425: escape character as a one character string. Default is no
426: change. \fPEscapec\fP can be a string of a single character, or
427: in the form \fI^X\fP, meaning control-\fIX\fP.
428: .TP
429: .B foreground([window], [flag])
430: Move \fIwindow\fP in or out of foreground. \fIFlag\fP
431: can be one of \fIon\fP, \fIoff\fP,
432: \fIyes\fP, \fIno\fP, \fItrue\fP, or \fIfalse\fP, with obvious
433: meanings, or it can be a numeric expression, in which case
434: a non-zero value is true. Returns the old foreground flag
435: as a number. Default for \fIwindow\fP is the current window,
436: default for \fIflag\fP is no change.
437: .TP
438: .B label([window], [label])
439: Set the label of \fIwindow\fP to \fIlabel\fP. Returns the old
440: label as a string. Default for \fIwindow\fP is the current
441: window, default for \fIlabel\fP is no change. To turn
442: off a label, set it to an empty string ("").
443: .TP
444: .B list()
445: No arguments. List the identifiers and labels of all windows. No
446: value is returned.
447: .TP
448: .B nline([nline])
449: Set the default buffer size to \fInline\fP. Initially, it is
450: 48 lines. Returns the old default buffer size. Default is
451: no change. Using a very large buffer can slow the program down
452: considerably.
453: .TP
454: .B select([window])
455: Make \fIwindow\fP the current window. The previous current window
456: is returned. Default is no change.
457: .TP
458: .B shell([<string-list>])
459: Set the default window shell program to \fI<string-list>\fP. Returns
460: the first string in the old shell setting. Default is no change. Initially,
461: the default shell is taken from the environment variable \fISHELL\fP.
462: .TP
463: .B source(filename)
464: Read and execute the long commands in \fIfilename\fP. Returns
465: -1 if the file cannot be read, 0 otherwise.
466: .TP
467: .B terse([flag])
468: Set terse mode to \fIflag\fP. In terse mode, the command window
469: stays hidden even in command mode, and errors are reported by
470: sounding the terminal's bell. \fIFlag\fP can take on the same
471: values as in \fIforeground\fP above. Returns the old terse flag.
472: Default is no change.
473: .TP
474: .B unalias(alias)
475: Undefine \fIalias\fP. Returns -1 if \fIalias\fP does not exist,
476: 0 otherwise.
477: .TP
478: .B unset(variable)
479: Undefine \fIvariable\fP. Returns -1 if \fIvariable\fP does not exist,
480: 0 otherwise.
481: .TP
482: .B variables()
483: No arguments. List all variables. No value is returned.
484: .TP
485: .B window([row], [column], [nrow], [ncol], [nline], [frame],
486: .B [pty], [mapnl], [shell])
487: .br
488: Open a window with upper left corner at \fIrow\fP, \fIcolumn\fP
489: and size \fInrow\fP, \fIncol\fP. If \fInline\fP is specified,
490: then that many lines are allocated for the text buffer. Otherwise,
491: the default buffer size is used. Default values for
492: \fIrow\fP, \fIcolumn\fP, \fInrow\fP, and \fIncol\fP are, respectively,
493: the upper, left-most, lower, or right-most extremes of the
494: screen. \fIFrame\fP, \fIpty\fP, and \fImapnl\fP are flag values
495: interpreted in the same way as the argument to \fIforeground\fP (see above);
496: they mean, respectively, put a frame around this window (default true),
497: allocate pseudo-terminal for this window rather than socketpair (default
498: true), and map new line characters in this window to carriage return
499: and line feed (default true if socketpair is used, false otherwise).
500: \fIShell\fP is a list of strings that will be used as the shell
501: program to place in the window (default is the program specified
502: by \fIshell\fP, see below). The created window's identifier
503: is returned as a number.
504: .TP
505: .B write([window], [<string-list>])
506: Send the list of strings, \fI<string-list>\fP, to \fIwindow\fP, separated
507: by spaces but not terminated with a new line. The strings are actually
508: given to the window as input. No value is returned. Default
509: is the current window.
510: .SH "PREDEFINED VARIABLES"
511: These variables are for information only. Redefining them does
512: not affect the internal operation of \fIwindow\fP.
513: .TP
514: .B baud
515: The baud rate as a number between 50 and 38400.
516: .TP
517: .B modes
518: The display modes (reverse video, underline, blinking, graphics)
519: supported by the physical terminal. The value of \fImodes\fP is
520: the bitwise or of some of the one bit values, \fIm_blk\fP, \fIm_grp\fP,
521: \fIm_rev\fP, and \fIm_ul\fP (see below). These values are useful
522: in setting the window cursors' modes (see \fIcursormodes\fP above).
523: .TP
524: .B m_blk
525: The blinking mode bit.
526: .TP
527: .B m_grp
528: The graphics mode bit (not very useful).
529: .TP
530: .B m_rev
531: The reverse video mode bit.
532: .TP
533: .B m_ul
534: The underline mode bit.
535: .TP
536: .B ncol
537: The number of columns on the physical screen.
538: .TP
539: .B nrow
540: The number of rows on the physical screen.
541: .TP
542: .B term
543: The terminal type. The standard name, found in the second name
544: field of the terminal's \fITERMCAP\fP entry, is used.
545: .SH FILES
546: .ta 15
547: ~/.windowrc startup command file.
548: .br
549: /dev/[pt]ty[pq]? pseudo-terminal devices.
550: .SH DIAGNOSTICS
551: Should be self explanatory.
552: .SH BUGS
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.