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