4.4BSD/usr/share/man/cat1/window.0

Compare this file to the similar file:
Show the results in this format:

WINDOW(1)                    BSD Reference Manual                    WINDOW(1)

NNAAMMEE
     wwiinnddooww - window environment

SSYYNNOOPPSSIISS
     wwiinnddooww [--tt] [--ff] [--dd] [--ee _e_s_c_a_p_e_-_c_h_a_r] [--cc _c_o_m_m_a_n_d]

DDEESSCCRRIIPPTTIIOONN
     WWiinnddooww implements a window environment on ASCII terminals.

     A window is a rectangular portion of the physical terminal screen associ-
     ated with a set of processes.  Its size and position can be changed by
     the user at any time.  Processes communicate with their window in the
     same way they normally interact with a terminal-through their standard
     input, output, and diagnostic file descriptors.  The window program han-
     dles the details of redirecting input an output to and from the windows.
     At any one time, only one window can receive input from the keyboard, but
     all windows can simultaneously send output to the display.

     When wwiinnddooww starts up, the commands (see long commands below) contained
     in the file _._w_i_n_d_o_w_r_c in the user's home directory are executed.  If it
     does not exist, two equal sized windows spanning the terminal screen are
     created by default.

     The command line options are

     --tt          Turn on terse mode (see tteerrssee command below).

     --ff          Fast.  Don't perform any startup action.

     --dd          Ignore _._w_i_n_d_o_w_r_c and create the two default windows instead.

     --ee _e_s_c_a_p_e_-_c_h_a_r
                 Set the escape character to _e_s_c_a_p_e_-_c_h_a_r. _E_s_c_a_p_e_-_c_h_a_r can be a
                 single character, or in the form ^^XX where _X is any character,
                 meaning control-_X.

     --cc _c_o_m_m_a_n_d  Execute the string _c_o_m_m_a_n_d as a long command (see below) be-
                 fore doing anything else.

     Windows can overlap and are framed as necessary.  Each window is named by
     one of the digits ``1'' to ``9''.  This one-character identifier, as well
     as a user definable label string, are displayed with the window on the
     top edge of its frame.  A window can be designated to be in the
     _f_o_r_e_g_r_o_u_n_d, in which case it will always be on top of all normal, non-
     foreground windows, and can be covered only by other foreground windows.
     A window need not be completely within the edges of the terminal screen.
     Thus a large window (possibly larger than the screen) may be positioned
     to show only a portion of its full size.

     Each window has a cursor and a set of control functions.  Most intelli-
     gent terminal operations such as line and character deletion and inser-
     tion are supported.  Display modes such as underlining and reverse video
     are available if they are supported by the terminal.  In addition, simi-
     lar to terminals with multiple pages of memory, each window has a text
     buffer which can have more lines than the window itself.

   PPrroocceessss EEnnvviirroonnmmeenntt
     With each newly created window, a shell program is spawned with its pro-
     cess environment tailored to that window.  Its standard input, output,
     and diagnostic file descriptors are bound to one end of either a pseudo-
     terminal (pty(4))  or a UNIX domain socket (socketpair(4)).  If a pseudo-
     terminal is used, then its special characters and modes (see stty(1))
     are copied from the physical terminal.  A termcap(5) entry tailored to
     this window is created and passed as environment (environ(5))  variable
     TERMCAP. The termcap entry contains the window's size and characteristics
     as well as information from the physical terminal, such as the existence
     of underline, reverse video, and other display modes, and the codes pro-
     duced by the terminal's function keys, if any.  In addition, the window
     size attributes of the pseudo-terminal are set to reflect the size of
     this window, and updated whenever it is changed by the user.  In particu-
     lar, the editor vi(1) uses this information to redraw its display.

   OOppeerraattiioonn
     During normal execution, wwiinnddooww can be in one of two states: conversation
     mode and command mode.  In conversation mode, the terminal's real cursor
     is placed at the cursor position of a particular window--called the cur-
     rent window--and input from the keyboard is sent to the process in that
     window.  The current window is always on top of all other windows, except
     those in foreground.  In addition, it is set apart by highlighting its
     identifier and label in reverse video.

     Typing wwiinnddooww's escape character (normally ^^PP) in conversation mode
     switches it into command mode.  In command mode, the top line of the ter-
     minal screen becomes the command prompt window, and wwiinnddooww interprets in-
     put from the keyboard as commands to manipulate windows.

     There are two types of commands: short commands are usually one or two
     key strokes; long commands are strings either typed by the user in the
     command window (see the ``::'' command below), or read from a file (see
     ssoouurrccee below).

   SShhoorrtt CCoommmmaannddss
     Below, _# represents one of the digits ``1'' to ``9'' corresponding to the
     windows 1 to 9.  ^^XX means control-_X, where _X is any character.  In par-
     ticular, ^^^^ is control-^. _E_s_c_a_p_e is the escape key, or ^^[[.

     _#       Select window _# as the current window and return to conversation
             mode.

     %%_#      Select window _# but stay in command mode.

     ^^^^      Select the previous window and return to conversation mode.  This
             is useful for toggling between two windows.

     eessccaappee  Return to conversation mode.

     ^^PP      Return to conversation mode and write ^^PP to the current window.
             Thus, typing two ^^PP's in conversation mode sends one to the cur-
             rent window.  If the wwiinnddooww escape is changed to some other char-
             acter, that character takes the place of ^^PP here.

     ??       List a short summary of commands.

     ^^LL      Refresh the screen.

     qq       Exit wwiinnddooww. Confirmation is requested.

     ^^ZZ      Suspend wwiinnddooww.

     ww       Create a new window.  The user is prompted for the positions of
             the upper left and lower right corners of the window.  The cursor
             is placed on the screen and the keys ``h'', ``j'', ``k'', and
             ``l'' move the cursor left, down, up, and right, respectively.
             The keys ``H'', ``J'', ``K'', and ``L'' move the cursor to the
             respective limits of the screen.  Typing a number before the
             movement keys repeats the movement that number of times.  Return
             enters the cursor position as the upper left corner of the win-
             dow.  The lower right corner is entered in the same manner.  Dur-
             ing this process, the placement of the new window is indicated by
             a rectangular box drawn on the screen, corresponding to where the
             new window will be framed.  Typing escape at any point cancels
             this command.

             This window becomes the current window, and is given the first
             available ID.  The default buffer size is used (see _d_e_f_a_u_l_t___n_l_i_n_e
             command below).

             Only fully visible windows can be created this way.

     cc_#      Close window _#. The process in the window is sent the hangup sig-
             nal (see kill(1)).  Csh(1) should handle this signal correctly
             and cause no problems.

     mm_#      Move window _# to another location.  A box in the shape of the
             window is drawn on the screen to indicate the new position of the
             window, and the same keys as those for the ww command are used to
             position the box.  The window can be moved partially off-screen.

     MM_#      Move window _# to its previous position.

     ss_#      Change the size of window _#. The user is prompted to enter the
             new lower right corner of the window.  A box is drawn to indicate
             the new window size.  The same keys used in ww and mm are used to
             enter the position.

     SS_#      Change window _# to its previous size.

     ^^YY      Scroll the current window up by one line.

     ^^EE      Scroll the current window down by one line.

     ^^UU      Scroll the current window up by half the window size.

     ^^DD      Scroll the current window down by half the window size.

     ^^BB      Scroll the current window up by the full window size.

     ^^FF      Scroll the current window down by the full window size.

     hh       Move the cursor of the current window left by one column.

     jj       Move the cursor of the current window down by one line.

     kk       Move the cursor of the current window up by one line.

     ll       Move the cursor of the current window right by one column.

     yy       Yank.  The user is prompted to enter two points within the cur-
             rent window.  Then the content of the current window between
             those two points is saved in the yank buffer.

     pp       Put.  The content of the yank buffer is written to the current
             window as input.

     ^^SS      Stop output in the current window.

     ^^QQ      Start output in the current window.

     :       Enter a line to be executed as long commands.  Normal line edit-
             ing characters (erase character, erase word, erase line) are sup-
             ported.

   LLoonngg CCoommmmaannddss
     Long commands are a sequence of statements parsed much like a programming
     language, with a syntax similar to that of C.  Numeric and string expres-
     sions and variables are supported, as well as conditional statements.

     There are two data types: string and number.  A string is a sequence of
     letters or digits beginning with a letter.  ``_'' and ``.'' are consid-
     ered letters.  Alternately, non-alphanumeric characters can be included
     in strings by quoting them in ``"'' or escaping them with ``\''.  In ad-
     dition, the ``\'' sequences of C are supported, both inside and outside
     quotes (e.g., ``\n'' is a new line, ``\r'' a carriage return).  For exam-
     ple, these are legal strings: abcde01234, "&#$^*&#", ab"$#"cd, ab\$\#cd,
     "/usr/ucb/window".

     A number is an integer value in one of three forms: a decimal number, an
     octal number preceded by ``0'', or a hexadecimal number preceded by
     ``0x'' or ``0X''.  The natural machine integer size is used (i.e., the
     signed integer type of the C compiler).  As in C, a non-zero number rep-
     resents a boolean true.

     The character ``#'' begins a comment which terminates at the end of the
     line.

     A statement is either a conditional or an expression.  Expression state-
     ments are terminated with a new line or ``;''.  To continue an expression
     on the next line, terminate the first line with ``\''.

   CCoonnddiittiioonnaall SSttaatteemmeenntt
     WWiinnddooww has a single control structure: the fully bracketed if statement
     in the form

           if <expr> then
           <statement>
           ...
           elsif <expr> then
           <statement>
           ...
           else
           <statement>
           ...
           endif

     The eellssee and eellssiiff parts are optional, and the latter can be repeated any
     number of times.  <Expr> must be numeric.

   EExxpprreessssiioonnss
     Expressions in wwiinnddooww are similar to those in the C language, with most C
     operators supported on numeric operands.  In addition, some are overload-
     ed to operate on strings.

     When an expression is used as a statement, its value is discarded after
     evaluation.  Therefore, only expressions with side effects (assignments
     and function calls) are useful as statements.

     Single valued (no arrays) variables are supported, of both numeric and
     string values.  Some variables are predefined.  They are listed below.

     The operators in order of increasing precedence:

     <_e_x_p_r_1> == <_e_x_p_r_2>
                 Assignment.  The variable of name <_e_x_p_r_1>, which must be
                 string valued, is assigned the result of <_e_x_p_r_2>. Returns the
                 value of <_e_x_p_r_2>.

     <_e_x_p_r_1> ?? <_e_x_p_r_2> : <_e_x_p_r_3>
                 Returns the value of <_e_x_p_r_2> if <_e_x_p_r_1> evaluates true (non-
                 zero numeric value); returns the value of <_e_x_p_r_3> otherwise.
                 Only one of <_e_x_p_r_2> and <_e_x_p_r_3> is evaluated.  <_E_x_p_r_1> must

                 be numeric.

     <_e_x_p_r_1> |||| <_e_x_p_r_2>
                 Logical or.  Numeric values only.  Short circuit evaluation
                 is supported (i.e., if <_e_x_p_r_1> evaluates true, then <_e_x_p_r_2>
                 is not evaluated).

     <_e_x_p_r_1> &&&& <_e_x_p_r_2>
                 Logical and with short circuit evaluation.  Numeric values
                 only.

     <_e_x_p_r_1> || <_e_x_p_r_2>
                 Bitwise or.  Numeric values only.

     <_e_x_p_r_1> ^^ <_e_x_p_r_2>
                 Bitwise exclusive or.  Numeric values only.

     <_e_x_p_r_1> && <_e_x_p_r_2>
                 Bitwise and.  Numeric values only.

     <_e_x_p_r_1> ==== <_e_x_p_r_2>, <_e_x_p_r_1> !!== <expr2>
                 Comparison (equal and not equal, respectively).  The boolean
                 result (either 1 or 0) of the comparison is returned.  The
                 operands can be numeric or string valued.  One string operand
                 forces the other to be converted to a string in necessary.

     <_e_x_p_r_1> << <_e_x_p_r_2>, <_e_x_p_r_1> >> <_e_x_p_r_2>, <_e_x_p_r_1> <<== <_e_x_p_r_2>,
                 Less than, greater than, less than or equal to, greater than
                 or equal to.  Both numeric and string values, with automatic
                 conversion as above.

     <_e_x_p_r_1> <<<< <_e_x_p_r_2>, <_e_x_p_r_1> >>>> <_e_x_p_r_2>
                 If both operands are numbers, <_e_x_p_r_1> is bit shifted left (or
                 right) by <_e_x_p_r_2> bits.  If <_e_x_p_r_1> is a string, then its
                 first (or last) <_e_x_p_r_2> characters are returns (if <_e_x_p_r_2> is
                 also a string, then its length is used in place of its val-
                 ue).

     <_e_x_p_r_1> ++ <_e_x_p_r_2>, <_e_x_p_r_1> -- <_e_x_p_r_2>
                 Addition and subtraction on numbers.  For ``+'', if one argu-
                 ment is a string, then the other is converted to a string,
                 and the result is the concatenation of the two strings.

     <_e_x_p_r_1> ** <_e_x_p_r_2>, <_e_x_p_r_1> // <_e_x_p_r_2>, <_e_x_p_r_1> %% <_e_x_p_r_2>
                 Multiplication, division, modulo.  Numbers only.

     --<_e_x_p_r>, ~~<_e_x_p_r>, !!<_e_x_p_r>, $$<_e_x_p_r>, $$??<_e_x_p_r>
                 The first three are unary minus, bitwise complement and logi-
                 cal complement on numbers only.  The operator, ``$'', takes
                 <_e_x_p_r> and returns the value of the variable of that name.
                 If <_e_x_p_r> is numeric with value _n and it appears within an
                 alias macro (see below), then it refers to the nth argument
                 of the alias invocation.  ``$?''  tests for the existence of
                 the variable <_e_x_p_r>, and returns 1 if it exists or 0 other-
                 wise.

     <_e_x_p_r>(<_a_r_g_l_i_s_t>)
                 Function call.  <_E_x_p_r> must be a string that is the unique
                 prefix of the name of a builtin wwiinnddooww function or the full
                 name of a user defined alias macro.  In the case of a builtin
                 function, <_a_r_g_l_i_s_t> can be in one of two forms:

                       <expr1>, <expr2>, ...
                       argname1 = <expr1>, argname2 = <expr2>, ...


                 The two forms can in fact be intermixed, but the result is
                 unpredictable.  Most arguments can be omitted; default values
                 will be supplied for them.  The _a_r_g_n_a_m_e_s can be unique pre-
                 fixes of the the argument names.  The commas separating argu-
                 ments are used only to disambiguate, and can usually be omit-
                 ted.

                 Only the first argument form is valid for user defined alias-
                 es.  Aliases are defined using the aalliiaass builtin function
                 (see below).  Arguments are accessed via a variant of the
                 variable mechanism (see ``$'' operator above).

                 Most functions return value, but some are used for side ef-
                 fect only and so must be used as statements.  When a function
                 or an alias is used as a statement, the parenthesis surround-
                 ing the argument list may be omitted.  Aliases return no val-
                 ue.

   BBuuiillttiinn FFuunnccttiioonnss
     The arguments are listed by name in their natural order.  Optional argu-
     ments are in square brackets `[]'. Arguments that have no names are in
     angle brackets `<>'. An argument meant to be a boolean flag (often named
     _f_l_a_g) can be one of _o_n, _o_f_f, _y_e_s, _n_o, _t_r_u_e, or _f_a_l_s_e, with obvious mean-
     ings, or it can be a numeric expression, in which case a non-zero value
     is true.

     aalliiaass([<_s_t_r_i_n_g>], [<_s_t_r_i_n_g_-_l_i_s_t)>]
                 If no argument is given, all currently defined alias macros
                 are listed.  Otherwise, <_s_t_r_i_n_g> is defined as an alias, with
                 expansion <_s_t_r_i_n_g_-_l_i_s_t _>>. The previous definition of
                 <_s_t_r_i_n_g>, if any, is returned.  Default for <_s_t_r_i_n_g_-_l_i_s_t> is
                 no change.

     cclloossee(<_w_i_n_d_o_w_-_l_i_s_t>)
                 Close the windows specified in <_w_i_n_d_o_w_-_l_i_s_t>. If
                 <_w_i_n_d_o_w_-_l_i_s_t> is the word _a_l_l, than all windows are closed.
                 No value is returned.

     ccuurrssoorrmmooddeess([_m_o_d_e_s])
                 Set the window cursor to _m_o_d_e_s. _M_o_d_e_s is the bitwise or of
                 the mode bits defined as the variables _m___u_l (underline),
                 _m___r_e_v (reverse video), _m___b_l_k (blinking), and _m___g_r_p (graphics,
                 terminal dependent).  Return value is the previous modes.
                 Default is no change.  For example, cursor($m_rev$m_blk) sets
                 the window cursors to blinking reverse video.

     ddeeffaauulltt__nnlliinnee([_n_l_i_n_e])
                 Set the default buffer size to _n_l_i_n_e. Initially, it is 48
                 lines.  Returns the old default buffer size.  Default is no
                 change.  Using a very large buffer can slow the program down
                 considerably.

     ddeeffaauulltt__sshheellll([<_s_t_r_i_n_g_-_l_i_s_t>])
                 Set the default window shell program to <_s_t_r_i_n_g_-_l_i_s_t>. Re-
                 turns the first string in the old shell setting.  Default is
                 no change.  Initially, the default shell is taken from the
                 environment variable SHELL.

     ddeeffaauulltt__ssmmooootthh([_f_l_a_g])
                 Set the default value of the _s_m_o_o_t_h argument to the command
                 wwiinnddooww (see below).  The argument is a boolean flag (one of
                 _o_n, _o_f_f, _y_e_s, _n_o, _t_r_u_e, _f_a_l_s_e, or a number, as described
                 above).  Default is no change.  The old value (as a number)
                 is returned.  The initial value is 1 (true).

     eecchhoo([_w_i_n_d_o_w], [<_s_t_r_i_n_g_-_l_i_s_t>])
                 Write the list of strings, <_s_t_r_i_n_g_-_l_i_s_t>, to wwiinnddooww, separat-
                 ed by spaces and terminated with a new line.  The strings are
                 only displayed in the window, the processes in the window are
                 not involved (see wwrriittee below).  No value is returned.  De-
                 fault is the current window.

     eessccaappee([_e_s_c_a_p_e_c])
                 Set the escape character to _e_s_c_a_p_e_-_c_h_a_r. Returns the old es-
                 cape character as a one-character string.  Default is no
                 change.  _E_s_c_a_p_e_c can be a string of a single character, or in
                 the form --^^XX, meaning control-_X.

     ffoorreeggrroouunndd([_w_i_n_d_o_w], [_f_l_a_g])
                 Move wwiinnddooww in or out of foreground.  _F_l_a_g is a boolean val-
                 ue.  The old foreground flag is returned.  Default for wwiinnddooww
                 is the current window, default for _f_l_a_g is no change.

     llaabbeell([_w_i_n_d_o_w], [_l_a_b_e_l])
                 Set the label of wwiinnddooww to _l_a_b_e_l. Returns the old label as a
                 string.  Default for wwiinnddooww is the current window, default
                 for _l_a_b_e_l is no change.  To turn off a label, set it to an
                 empty string ("").

     lliisstt()      No arguments.  List the identifiers and labels of all win-
                 dows.  No value is returned.

     sseelleecctt([_w_i_n_d_o_w])
                 Make wwiinnddooww the current window.  The previous current window
                 is returned.  Default is no change.

     ssoouurrccee(_f_i_l_e_n_a_m_e)
                 Read and execute the long commands in _f_i_l_e_n_a_m_e. Returns -1 if
                 the file cannot be read, 0 otherwise.

     tteerrssee([flag])
                 Set terse mode to _f_l_a_g. In terse mode, the command window
                 stays hidden even in command mode, and errors are reported by
                 sounding the terminal's bell.  _F_l_a_g can take on the same val-
                 ues as in _f_o_r_e_g_r_o_u_n_d above.  Returns the old terse flag.  De-
                 fault is no change.

     uunnaalliiaass(_a_l_i_a_s)
                 Undefine _a_l_i_a_s. Returns -1 if _a_l_i_a_s does not exist, 0 other-
                 wise.

     uunnsseett(_v_a_r_i_a_b_l_e)
                 Undefine _v_a_r_i_a_b_l_e. Returns -1 if _v_a_r_i_a_b_l_e does not exist, 0
                 otherwise.

     vvaarriiaabblleess()
                 No arguments.  List all variables.  No value is returned.

     wwiinnddooww([_r_o_w], [_c_o_l_u_m_n], [_n_r_o_w], [_n_c_o_l], [_n_l_i_n_e], [_l_a_b_e_l], [_p_t_y], [_f_r_a_m_e],
                 [_m_a_p_n_l], [_k_e_e_p_o_p_e_n], [_s_m_o_o_t_h], [_s_h_e_l_l]).
                 Open a window with upper left corner at _r_o_w, _c_o_l_u_m_n and size
                 _n_r_o_w, _n_c_o_l. If _n_l_i_n_e is specified, then that many lines are
                 allocated for the text buffer.  Otherwise, the default buffer
                 size is used.  Default values for _r_o_w, _c_o_l_u_m_n, _n_r_o_w, and _n_c_o_l
                 are, respectively, the upper, left-most, lower, or right-most
                 extremes of the screen.  _L_a_b_e_l is the label string.  _F_r_a_m_e,
                 _p_t_y, and _m_a_p_n_l are flag values interpreted in the same way as
                 the argument to _f_o_r_e_g_r_o_u_n_d (see above); they mean, respec-
                 tively, put a frame around this window (default true), allo-
                 cate pseudo-terminal for this window rather than socketpair
                 (default true), and map new line characters in this window to
                 carriage return and line feed (default true if socketpair is
                 used, false otherwise).  Normally, a window is automatically
                 closed when its process exits.  Setting _k_e_e_p_o_p_e_n to true (de-
                 fault false) prevents this action.  When _s_m_o_o_t_h is true, the
                 screen is updated more frequently (for this window) to pro-
                 duce a more terminal-like behavior.  The default value of
                 _s_m_o_o_t_h is set by the _d_e_f_a_u_l_t___s_m_o_o_t_h command (see above).
                 _S_h_e_l_l is a list of strings that will be used as the shell
                 program to place in the window (default is the program speci-
                 fied by _d_e_f_a_u_l_t___s_h_e_l_l, see above).  The created window's
                 identifier is returned as a number.

     wwrriittee([_w_i_n_d_o_w], [<_s_t_r_i_n_g_-_l_i_s_t>])
                 Send the list of strings, <_s_t_r_i_n_g_-_l_i_s_t>, to wwiinnddooww, separated
                 by spaces but not terminated with a new line.  The strings
                 are actually given to the window as input.  No value is re-
                 turned.  Default is the current window.

   PPrreeddeeffiinneedd VVaarriiaabblleess
     These variables are for information only.  Redefining them does not af-
     fect the internal operation of wwiinnddooww.

     _b_a_u_d   The baud rate as a number between 50 and 38400.

     _m_o_d_e_s  The display modes (reverse video, underline, blinking, graphics)
            supported by the physical terminal.  The value of _m_o_d_e_s is the
            bitwise or of some of the one bit values, _m___b_l_k, _m___g_r_p, _m___r_e_v, and
            _m___u_l (see below).  These values are useful in setting the window
            cursors' modes (see _c_u_r_s_o_r_m_o_d_e_s above).

     _m___b_l_k  The blinking mode bit.

     _m___g_r_p  The graphics mode bit (not very useful).

     _m___r_e_v  The reverse video mode bit.

     _m___u_l   The underline mode bit.

     _n_c_o_l   The number of columns on the physical screen.

     _n_r_o_w   The number of rows on the physical screen.

     _t_e_r_m   The terminal type.  The standard name, found in the second name
            field of the terminal's TERMCAP entry, is used.

EENNVVIIRROONNMMEENNTT
     WWiinnddooww utilizes these environment variables: HOME, SHELL, TERM, TERMCAP,
     WINDOW_ID.

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

HHIISSTTOORRYY
     The wwiinnddooww command appeared in 4.3BSD.

DDIIAAGGNNOOSSTTIICCSS
     Should be self explanatory.

4.3 Berkeley Distribution        June 6, 1993                                8