1WINDOW(1)                   General Commands Manual                  WINDOW(1)
2
3
4

NAME

6       window - window environment
7

SYNOPSIS

9       window [ -t ] [ -f ] [ -d ] [ -e escape-char ] [ -c command ]
10

DESCRIPTION

12       Window implements a window environment on ASCII terminals.
13
14       A window is a rectangular portion of the physical terminal screen asso‐
15       ciated with a set of processes.  Its size and position can  be  changed
16       by  the  user  at any time.  Processes communicate with their window in
17       the same way they normally  interact  with  a  terminal--through  their
18       standard  input,  output,  and diagnostic file descriptors.  The window
19       program handles the details of redirecting input an output to and  from
20       the  windows.   At any one time, only one window can receive input from
21       the keyboard, but all windows can simultaneously  send  output  to  the
22       display.
23
24       Windows  can overlap and are framed as necessary.  Each window is named
25       by one of the digits ``1'' to ``9''.  This one character identifier, as
26       well as a user definable label string, are displayed with the window on
27       the top edge of its frame.  A window can be designated  to  be  in  the
28       foreground,  in which case it will always be on top of all normal, non-
29       foreground windows, and can be covered only by  other  foreground  win‐
30       dows.  A window need not be completely within the edges of the terminal
31       screen.  Thus a large window (possibly larger than the screen)  may  be
32       positioned to show only a portion of its full size.
33
34       Each window has a cursor and a set of control functions.  Most intelli‐
35       gent terminal operations such as line and character deletion and inser‐
36       tion  are  supported.   Display  modes  such as underlining and reverse
37       video are available if they are supported by the  terminal.   In  addi‐
38       tion,  similar  to terminals with multiple pages of memory, each window
39       has a text buffer which can have more lines than the window itself.
40

OPTIONS

42       When window starts up, the commands (see long commands below) contained
43       in the file .windowrc in the user's home directory are executed.  If it
44       does not exist, two equal sized windows spanning  the  terminal  screen
45       are created by default.
46
47       The command line options are
48
49       -t     Turn on terse mode (see terse command below).
50
51       -f     Fast.  Don't perform any startup action.
52
53       -d     Ignore .windowrc and create the two default windows instead.
54
55       -e escape-char
56              Set  the  escape character to escape-char.  Escape-char can be a
57              single character, or in the form ^X where X  is  any  character,
58              meaning control-X.
59
60       -c command
61              Execute  the string command as a long command (see below) before
62              doing anything else.
63

PROCESS ENVIRONMENT

65       With each newly created window, a shell program  is  spawned  with  its
66       process  environment tailored to that window.  Its standard input, out‐
67       put, and diagnostic file descriptors are bound to one end of  either  a
68       pseudo-terminal (pty (4)) or a UNIX domain socket (socketpair (4)).  If
69       a pseudo-terminal is used, then its special characters and  modes  (see
70       stty  (1))  are copied from the physical terminal.  A termcap (5) entry
71       tailored to this window is created and passed as  environment  (environ
72       (5))  variable  TERMCAP.   The termcap entry contains the window's size
73       and characteristics as well as information from the physical  terminal,
74       such  as  the  existence of underline, reverse video, and other display
75       modes, and the codes produced by the terminal's function keys, if  any.
76       In  addition, the window size attributes of the pseudo-terminal are set
77       to reflect the size of this window, and updated whenever it is  changed
78       by the user.  In particular, the editor vi (1) uses this information to
79       redraw its display.
80

OPERATION

82       During normal execution, window can be in one of two states:  conversa‐
83       tion  mode and command mode.  In conversation mode, the terminal's real
84       cursor is placed at the cursor position of a particular  window--called
85       the  current window--and input from the keyboard is sent to the process
86       in that window.  The current window is always on top of all other  win‐
87       dows,  except  those  in  foreground.   In addition, it is set apart by
88       highlighting its identifier and label in reverse video.
89
90       Typing window's escape character (normally  ^P)  in  conversation  mode
91       switches  it  into  command mode.  In command mode, the top line of the
92       terminal screen becomes the command prompt window,  and  window  inter‐
93       prets input from the keyboard as commands to manipulate windows.
94
95       There  are two types of commands: short commands are usually one or two
96       key strokes; long commands are strings either typed by the user in  the
97       command  window (see the ``:'' command below), or read from a file (see
98       source below).
99

SHORT COMMANDS

101       Below, # represents one of the digits ``1'' to ``9''  corresponding  to
102       the  windows 1 to 9.  ^X means control-X, where X is any character.  In
103       particular, ^^ is control-^.  Escape is the escape key, or ^[.
104
105       #      Select window # as the current window and return to conversation
106              mode.
107
108       %#     Select window # but stay in command mode.
109
110       ^^     Select  the  previous  window  and  return to conversation mode.
111              This is useful for toggling between two windows.
112
113       escape Return to conversation mode.
114
115       ^P     Return to conversation mode and write ^P to the current  window.
116              Thus, typing two ^P's in conversation mode sends one to the cur‐
117              rent window.  If the window escape  is  changed  to  some  other
118              character, that character takes the place of ^P here.
119
120       ?      List a short summary of commands.
121
122       ^L     Redraw the screen.
123
124       q      Exit window.  Confirmation is requested.
125
126       ^Z     Suspend window.
127
128       w      Create  a new window.  The user is prompted for the positions of
129              the upper left and lower right corners of the window.  The  cur‐
130              sor  is  placed  on the screen and the keys ``h'', ``j'', ``k'',
131              and ``l'' move the cursor left, down,  up,  and  right,  respec‐
132              tively.  The keys ``H'', ``J'', ``K'', and ``L'' move the cursor
133              to the respective limits of the screen.  Typing a number  before
134              the  movement  keys  repeats  the movement that number of times.
135              Return enters the cursor position as the upper  left  corner  of
136              the  window.  The lower right corner is entered in the same man‐
137              ner.  During this process, the placement of the  new  window  is
138              indicated  by a rectangular box drawn on the screen, correspond‐
139              ing to where the new window will be framed.   Typing  escape  at
140              any point cancels this command.
141
142              This  window  becomes the current window, and is given the first
143              available ID.  The default buffer size is used (see  nline  com‐
144              mand below).
145
146              Only fully visible windows can be created this way.
147
148       c#     Close  window  #.   The process in the window is sent the hangup
149              signal (see kill (1)).  Csh (1) should handle this  signal  cor‐
150              rectly and cause no problems.
151
152       m#     Move  window  #  to another location.  A box in the shape of the
153              window is drawn on the screen to indicate the  new  position  of
154              the  window,  and  the  same keys as those for the w command are
155              used to position the box.  The window  can  be  moved  partially
156              off-screen.
157
158       M#     Move window # to its previous position.
159
160       s#     Change  the size of window #.  The user is prompted to enter the
161              new lower right corner of the window.  A box is drawn  to  indi‐
162              cate  the  new  window  size.  The same keys used in w and m are
163              used to enter the position.
164
165       S#     Change window # to its previous size.
166
167       ^Y     Scroll the current window up by one line.
168
169       ^E     Scroll the current window down by one line.
170
171       ^U     Scroll the current window up by half the window size.
172
173       ^D     Scroll the current window down by half the window size.
174
175       ^B     Scroll the current window up by the full window size.
176
177       ^F     Scroll the current window down by the full window size.
178
179       h      Move the cursor of the current window left by one column.
180
181       j      Move the cursor of the current window down by one line.
182
183       k      Move the cursor of the current window up by one line.
184
185       l      Move the cursor of the current window right by one column.
186
187       ^S     Stop output in the current window.
188
189       ^Q     Start output in the current window.
190
191       :      Enter a line to be executed as long commands.  Normal line edit‐
192              ing  characters  (erase  character,  erase word, erase line) are
193              supported.
194

LONG COMMANDS

196       Long commands are a sequence of statements parsed much like a  program‐
197       ming  language, with a syntax similar to that of C.  Numeric and string
198       expressions and variables are supported, as well as conditional  state‐
199       ments.
200
201       There are two data types: string and number.  A string is a sequence of
202       letters or digits beginning with a letter.  ``_'' and ``.'' are consid‐
203       ered letters.  Alternately, non-alphanumeric characters can be included
204       in strings by quoting them in ``"'' or escaping them  with  ``\''.   In
205       addition,  the ``\'' sequences of C are supported, both inside and out‐
206       side quotes (e.g., ``\n'' is a new line,  ``\r''  a  carriage  return).
207       For  example, these are legal strings: abcde01234, "&#$^*&#", ab"$#"cd,
208       ab\$\#cd, "/usr/ucb/window".
209
210       A number is an integer value in one of three forms: a  decimal  number,
211       an  octal number preceded by ``0'', or a hexadecimal number preceded by
212       ``0x'' or ``0X''.  The natural machine integer size is used (i.e.,  the
213       signed  integer  type  of  the C compiler).  As in C, a non-zero number
214       represents a boolean true.
215
216       The character ``#'' begins a comment which terminates at the end of the
217       line.
218
219       A  statement  is  either  a  conditional  or an expression.  Expression
220       statements are terminated with a new line or  ``;''.   To  continue  an
221       expression on the next line, terminate the first line with ``\''.
222

CONDITIONAL STATEMENT

224       Window has a single control structure: the fully bracketed if statement
225       in the form
226            if <expr> then
227                 <statement>
228                 . . .
229            elsif <expr> then
230                 <statement>
231                 . . .
232            else
233                 <statement>
234                 . . .
235            endif
236       The else and elsif parts are optional, and the latter can  be  repeated
237       any number of times.  <Expr> must be numeric.
238

EXPRESSIONS

240       Expressions in window are similar to those in the C language, with most
241       C operators supported on numeric operands.  In addition, some are over‐
242       loaded to operate on strings.
243
244       When an expression is used as a statement, its value is discarded after
245       evaluation.  Therefore, only expressions with side effects (assignments
246       and function calls) are useful as statements.
247
248       Single  valued (no arrays) variables are supported, of both numeric and
249       string values.  Some variables are predefined.  They are listed below.
250
251       The operators in order of increasing precedence:
252
253       <expr1> = <expr2>
254              Assignment.  The variable of name <expr1>, which must be  string
255              valued, is assigned the result of <expr2>.  Returns the value of
256              <expr2>.
257
258       <expr1> ? <expr2> : <expr3>
259              Returns the value of <expr2> if <expr1> evaluates true (non-zero
260              numeric  value);  returns  the value of <expr3> otherwise.  Only
261              one of <expr2>  and  <expr3>  is  evaluated.   <Expr1>  must  be
262              numeric.
263
264       <expr1> || <expr2>
265              Logical  or.   Numeric values only.  Short circuit evaluation is
266              supported (i.e., if <expr1> evaluates true, then <expr2> is  not
267              evaluated).
268
269       <expr1> && <expr2>
270              Logical and with short circuit evaluation.  Numeric values only.
271
272       <expr1> | <expr2>
273              Bitwise or.  Numeric values only.
274
275       <expr1> ^ <expr2>
276              Bitwise exclusive or.  Numeric values only.
277
278       <expr1> & <expr2>
279              Bitwise and.  Numeric values only.
280
281       <expr1> == <expr2>, <expr1> != <expr2>
282              Comparison  (equal  and  not  equal, respectively).  The boolean
283              result (either 1 or 0) of the comparison is returned.  The oper‐
284              ands can be numeric or string valued.  One string operand forces
285              the other to be converted to a string in necessary.
286
287       <expr1> < <expr2>, <expr1> > <expr2>, <expr1> <=  <expr2>,  <expr1>  >=
288       <expr2>
289              Less  than, greater than, less than or equal to, greater than or
290              equal to.  Both numeric and string values, with  automatic  con‐
291              version as above.
292
293       <expr1> << <expr2>, <expr1> >> <expr2>
294              If  both  operands  are numbers, <expr1> is bit shifted left (or
295              right) by <expr2> bits.  If <expr1> is a string, then its  first
296              (or  last)  <expr2> characters are returns (if <expr2> is also a
297              string, then its length is used in place of its value).
298
299       <expr1> + <expr2>, <expr1> - <expr2>
300              Addition and subtraction on numbers.  For ``+'', if one argument
301              is  a  string,  then the other is converted to a string, and the
302              result is the concatenation of the two strings.
303
304       <expr1> * <expr2>, <expr1> / <expr2>, <expr1> % <expr2>
305              Multiplication, division, modulo.  Numbers only.
306
307       -<expr>, ~<expr>, !<expr>, $<expr>, $?<expr>
308              The first three are unary minus, bitwise complement and  logical
309              complement  on  numbers only.  The operator, ``$'', takes <expr>
310              and returns the value of the variable of that name.   If  <expr>
311              is  numeric  with  value  n and it appears within an alias macro
312              (see below), then it refers to the nth  argument  of  the  alias
313              invocation.   ``$?''   tests  for  the existence of the variable
314              <expr>, and returns 1 if it exists or 0 otherwise.
315
316       <expr>(<arglist>)
317              Function call.  <Expr> must be a string that is the unique  pre‐
318              fix of the name of a builtin window function or the full name of
319              a user defined alias macro.  In the case of a builtin  function,
320              <arglist> can be in one of two forms:
321                   <expr1>, <expr2>, . . .
322                   argname1 = <expr1>, argname2 = <expr2>, . . .
323              The  two  forms  can  in  fact  be intermixed, but the result is
324              unpredictable.  Most arguments can be  omitted;  default  values
325              will  be supplied for them.  The argnames can be unique prefixes
326              of the the argument names.  The commas separating arguments  are
327              used only to disambiguate, and can usually be omitted.
328
329              Only  the first argument form is valid for user defined aliases.
330              Aliases are  defined  using  the  alias  builtin  function  (see
331              below).   Arguments  are  accessed via a variant of the variable
332              mechanism (see ``$'' operator above).
333
334              Most functions return value, but some are used for  side  effect
335              only  and  so must be used as statements.  When a function or an
336              alias is used as a statement, the  parenthesis  surrounding  the
337              argument list may be omitted.  Aliases return no value.
338

BUILTIN FUNCTIONS

340       The  arguments  are  listed  by  name in their natural order.  Optional
341       arguments are in square brackets (``[ ]'').   Arguments  that  have  no
342       names are in angle brackets (``<>'').
343
344       alias([<string>], [<string-list>])
345              If  no argument is given, all currently defined alias macros are
346              listed.  Otherwise, <string> is defined as an alias, with expan‐
347              sion  <string-list>.   The  previous  definition of <string>, if
348              any, is returned.  Default for <string-list> is no change.
349
350       close(<window-list>)
351              Close the windows specified in <window-list>.  If  <window-list>
352              is  the  word  all,  than  all  windows are closed.  No value is
353              returned.
354
355       cursormodes([modes])
356              Set the window cursor to modes.  Modes is the bitwise or of  the
357              mode  bits  defined  as  the  variables  m_ul (underline), m_rev
358              (reverse video), m_blk (blinking), and m_grp (graphics, terminal
359              dependent).   Return value is the previous modes.  Default is no
360              change.  For example, cursor($m_rev|$m_blk) sets the window cur‐
361              sors to blinking reverse video.
362
363       echo([window], [<string-list>])
364              Write  the  list of strings, <string-list>, to window, separated
365              by spaces and terminated with a new line.  The strings are  only
366              displayed  in  the  window,  the processes in the window are not
367              involved (see write below).  No value is returned.   Default  is
368              the current window.
369
370       escape([escapec])
371              Set the escape character to escape-char.  Returns the old escape
372              character as a one character  string.   Default  is  no  change.
373              Escapec  can  be  a string of a single character, or in the form
374              ^X, meaning control-X.
375
376       foreground([window], [flag])
377              Move window in or out of foreground.  Flag can  be  one  of  on,
378              off,  yes,  no, true, or false, with obvious meanings, or it can
379              be a numeric expression, in which case a non-zero value is true.
380              Returns the old foreground flag as a number.  Default for window
381              is the current window, default for flag is no change.
382
383       label([window], [label])
384              Set the label of window to label.  Returns the old  label  as  a
385              string.   Default  for window is the current window, default for
386              label is no change.  To turn off a label, set  it  to  an  empty
387              string ("").
388
389       list() No  arguments.   List the identifiers and labels of all windows.
390              No value is returned.
391
392       nline([nline])
393              Set the default buffer size  to  nline.   Initially,  it  is  48
394              lines.   Returns  the  old  default  buffer size.  Default is no
395              change.  Using a very large buffer can  slow  the  program  down
396              considerably.
397
398       select([window])
399              Make  window the current window.  The previous current window is
400              returned.  Default is no change.
401
402       shell([<string-list>])
403              Set the default window shell program to <string-list>.   Returns
404              the  first  string  in  the  old  shell  setting.  Default is no
405              change.  Initially, the default shell is taken from the environ‐
406              ment variable SHELL.
407
408       source(filename)
409              Read  and  execute the long commands in filename.  Returns -1 if
410              the file cannot be read, 0 otherwise.
411
412       terse([flag])
413              Set terse mode to flag.  In terse mode, the command window stays
414              hidden even in command mode, and errors are reported by sounding
415              the terminal's bell.  Flag can take on the  same  values  as  in
416              foreground  above.   Returns  the old terse flag.  Default is no
417              change.
418
419       unalias(alias)
420              Undefine alias.  Returns -1 if alias does not  exist,  0  other‐
421              wise.
422
423       unset(variable)
424              Undefine  variable.   Returns  -1  if variable does not exist, 0
425              otherwise.
426
427       variables()
428              No arguments.  List all variables.  No value is returned.
429
430       window([row], [column], [nrow], [ncol], [nline], [frame],
431              [pty], [mapnl], [shell])
432              Open a window with upper left corner at  row,  column  and  size
433              nrow,  ncol.   If  nline  is specified, then that many lines are
434              allocated for the text buffer.  Otherwise,  the  default  buffer
435              size  is  used.   Default values for row, column, nrow, and ncol
436              are, respectively, the upper, left-most,  lower,  or  right-most
437              extremes  of  the screen.  Frame, pty, and mapnl are flag values
438              interpreted in the same way as the argument to  foreground  (see
439              above);  they mean, respectively, put a frame around this window
440              (default true), allocate pseudo-terminal for this window  rather
441              than  socketpair  (default true), and map new line characters in
442              this window to carriage return and line feed  (default  true  if
443              socketpair  is  used,  false  otherwise).   Shell  is  a list of
444              strings that will be used as the shell program to place  in  the
445              window  (default  is the program specified by shell, see below).
446              The created window's identifier is returned as a number.
447
448       write([window], [<string-list>])
449              Send the list of strings, <string-list>, to window, separated by
450              spaces  but  not  terminated  with  a new line.  The strings are
451              actually given to the window as input.  No  value  is  returned.
452              Default is the current window.
453

PREDEFINED VARIABLES

455       These  variables  are  for  information only.  Redefining them does not
456       affect the internal operation of window.
457
458       baud   The baud rate as a number between 50 and 38400.
459
460       modes  The display modes (reverse video, underline, blinking, graphics)
461              supported  by  the physical terminal.  The value of modes is the
462              bitwise or of some of the one bit values, m_blk,  m_grp,  m_rev,
463              and  m_ul  (see  below).  These values are useful in setting the
464              window cursors' modes (see cursormodes above).
465
466       m_blk  The blinking mode bit.
467
468       m_grp  The graphics mode bit (not very useful).
469
470       m_rev  The reverse video mode bit.
471
472       m_ul   The underline mode bit.
473
474       ncol   The number of columns on the physical screen.
475
476       nrow   The number of rows on the physical screen.
477
478       term   The terminal type.  The standard name, found in the second  name
479              field of the terminal's TERMCAP entry, is used.
480

FILES

482       ~/.windowrc    startup command file.
483       /dev/[pt]ty[pq]?pseudo-terminal devices.
484

DIAGNOSTICS

486       Should be self explanatory.
487

BUGS

4894.3 Berkeley Distribution        May 12, 1986                        WINDOW(1)
Impressum