[BACK]Return to window.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / window

Annotation of src/usr.bin/window/window.1, Revision 1.1

1.1     ! deraadt     1: .\"    $NetBSD: window.1,v 1.3 1995/09/28 10:35:05 tls Exp $
        !             2: .\"
        !             3: .\" Copyright (c) 1985, 1990, 1993
        !             4: .\"    The Regents of the University of California.  All rights reserved.
        !             5: .\"
        !             6: .\" This code is derived from software contributed to Berkeley by
        !             7: .\" Edward Wang at The University of California, Berkeley.
        !             8: .\"
        !             9: .\" Redistribution and use in source and binary forms, with or without
        !            10: .\" modification, are permitted provided that the following conditions
        !            11: .\" are met:
        !            12: .\" 1. Redistributions of source code must retain the above copyright
        !            13: .\"    notice, this list of conditions and the following disclaimer.
        !            14: .\" 2. Redistributions in binary form must reproduce the above copyright
        !            15: .\"    notice, this list of conditions and the following disclaimer in the
        !            16: .\"    documentation and/or other materials provided with the distribution.
        !            17: .\" 3. All advertising materials mentioning features or use of this software
        !            18: .\"    must display the following acknowledgement:
        !            19: .\"    This product includes software developed by the University of
        !            20: .\"    California, Berkeley and its contributors.
        !            21: .\" 4. Neither the name of the University nor the names of its contributors
        !            22: .\"    may be used to endorse or promote products derived from this software
        !            23: .\"    without specific prior written permission.
        !            24: .\"
        !            25: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
        !            26: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            27: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            28: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            29: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            30: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            31: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            32: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            33: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            34: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            35: .\" SUCH DAMAGE.
        !            36: .\"
        !            37: .\"    @(#)window.1    8.2 (Berkeley) 12/30/93
        !            38: .\"
        !            39: .Dd December 30, 1993
        !            40: .Dt WINDOW 1
        !            41: .Os BSD 4.3
        !            42: .Sh NAME
        !            43: .Nm window
        !            44: .Nd window environment
        !            45: .Sh SYNOPSIS
        !            46: .Nm window
        !            47: .Op Fl t
        !            48: .Op Fl f
        !            49: .Op Fl d
        !            50: .Op Fl e Ar escape-char
        !            51: .Op Fl c Ar command
        !            52: .Sh DESCRIPTION
        !            53: .Nm Window
        !            54: implements a window environment on
        !            55: .Tn ASCII
        !            56: terminals.
        !            57: .Pp
        !            58: A window is a rectangular portion of the physical terminal
        !            59: screen associated with a set of processes.  Its size and
        !            60: position can be changed by the user at any time.  Processes
        !            61: communicate with their window in the same way they normally
        !            62: interact with a terminal\-through their standard input, output,
        !            63: and diagnostic file descriptors.  The window program handles the
        !            64: details of redirecting input and output to and from the
        !            65: windows.  At any one time, only one window can receive
        !            66: input from the keyboard, but all windows can simultaneously send output
        !            67: to the display.
        !            68: .Pp
        !            69: When
        !            70: .Nm window
        !            71: starts up, the commands (see long commands below)
        !            72: contained in the file
        !            73: .Pa .windowrc
        !            74: in the user's home directory are
        !            75: executed.  If it does not exist, two equal sized windows spanning
        !            76: the terminal screen are created by default.
        !            77: .Pp
        !            78: The command line options are
        !            79: .Bl -tag -width Fl
        !            80: .It Fl t
        !            81: Turn on terse mode (see
        !            82: .Ic terse
        !            83: command below).
        !            84: .It Fl f
        !            85: Fast.  Don't perform any startup action.
        !            86: .It Fl d
        !            87: Ignore
        !            88: .Pa .windowrc
        !            89: and create the two default
        !            90: windows instead.
        !            91: .It Fl e Ar escape-char
        !            92: Set the escape character to
        !            93: .Ar escape-char  .
        !            94: .Ar Escape-char
        !            95: can be a single character, or in the form
        !            96: .Ic ^X
        !            97: where
        !            98: .Ar X
        !            99: is any character, meaning
        !           100: .No control\- Ns Ar X  .
        !           101: .It Fl c Ar command
        !           102: Execute the string
        !           103: .Ar command
        !           104: as a long command (see below)
        !           105: before doing anything else.
        !           106: .El
        !           107: .Pp
        !           108: Windows can overlap and are framed as necessary.  Each window
        !           109: is named by one of the digits ``1'' to ``9''.  This one-character
        !           110: identifier, as well as a user definable label string, are displayed
        !           111: with the window on the top edge of its frame.  A window can be
        !           112: designated to be in the
        !           113: .Ar foreground  ,
        !           114: in which case it will always be
        !           115: on top of all normal, non-foreground windows, and can be covered
        !           116: only by other foreground windows.  A window need not be completely
        !           117: within the edges of the terminal screen.  Thus a large window
        !           118: (possibly larger than the screen) may be positioned to show only
        !           119: a portion of its full size.
        !           120: .Pp
        !           121: Each window has a cursor and a set of control functions.  Most intelligent
        !           122: terminal operations such as line and
        !           123: character deletion and insertion are supported.  Display modes
        !           124: such as underlining and reverse video are available if they are
        !           125: supported by the terminal.  In addition,
        !           126: similar to terminals with multiple pages of memory,
        !           127: each window has a text buffer which can have more lines than the window
        !           128: itself.
        !           129: .Ss Process Environment
        !           130: With each newly created window, a shell program is spawned with its
        !           131: process environment tailored to that window.  Its standard input,
        !           132: output, and diagnostic file descriptors are bound to one end of either
        !           133: a pseudo-terminal
        !           134: .Xr (pty 4 )
        !           135: or a
        !           136: .Ux
        !           137: domain socket
        !           138: .Xr (socketpair 4 ) .
        !           139: If a pseudo-terminal is used, then its special
        !           140: characters and modes (see
        !           141: .Xr stty 1 )
        !           142: are copied from the physical
        !           143: terminal.  A
        !           144: .Xr termcap 5
        !           145: entry tailored to this window is created
        !           146: and passed as environment
        !           147: .Xr (environ 5 )
        !           148: variable
        !           149: .Ev TERMCAP  .
        !           150: The termcap entry contains the window's size and
        !           151: characteristics as well as information from the physical terminal,
        !           152: such as the existence of underline, reverse video, and other display
        !           153: modes, and the codes produced by the terminal's function keys,
        !           154: if any.  In addition, the window size attributes of the pseudo-terminal
        !           155: are set to reflect the size of this window, and updated whenever
        !           156: it is changed by the user.  In particular, the editor
        !           157: .Xr vi 1
        !           158: uses
        !           159: this information to redraw its display.
        !           160: .Ss Operation
        !           161: During normal execution,
        !           162: .Nm window
        !           163: can be in one of two states:
        !           164: conversation mode and command mode.  In conversation mode, the
        !           165: terminal's real cursor is placed at the cursor position of a particular
        !           166: window--called the current window--and input from the keyboard is sent
        !           167: to the process in that window.  The current window is always
        !           168: on top of all other windows, except those in foreground.  In addition,
        !           169: it is set apart by highlighting its identifier and label in reverse video.
        !           170: .Pp
        !           171: Typing
        !           172: .Nm window Ns 's
        !           173: escape character (normally
        !           174: .Ic ^P )
        !           175: in conversation
        !           176: mode switches it into command mode.  In command mode, the top line of
        !           177: the terminal screen becomes the command prompt window, and
        !           178: .Nm window
        !           179: interprets input from the keyboard as commands to manipulate windows.
        !           180: .Pp
        !           181: There are two types of commands: short commands are usually one or two
        !           182: key strokes; long commands are strings either typed by the user in the
        !           183: command window (see the
        !           184: .Dq Ic \&:
        !           185: command below), or read from a file (see
        !           186: .Ic source
        !           187: below).
        !           188: .Ss Short Commands
        !           189: Below,
        !           190: .Ar \&#
        !           191: represents one of the digits ``1'' to ``9''
        !           192: corresponding to the windows 1 to 9.
        !           193: .Ic ^X
        !           194: means
        !           195: .No control\- Ns Ar X  ,
        !           196: where
        !           197: .Ar X
        !           198: is any character.  In particular,
        !           199: .Ic ^^
        !           200: is
        !           201: .Li control\-^.
        !           202: .Ar Escape
        !           203: is the escape key, or
        !           204: .Ic ^\&[ .
        !           205: .Bl -tag -width Ds
        !           206: .It Ar #
        !           207: Select window
        !           208: .Ar #
        !           209: as the current window
        !           210: and return to conversation mode.
        !           211: .It Ic \&% Ns Ar #
        !           212: Select window
        !           213: .Ar #
        !           214: but stay in command mode.
        !           215: .It Ic ^^
        !           216: Select the previous window and return to conversation
        !           217: mode.  This is useful for toggling between two windows.
        !           218: .It Ic escape
        !           219: Return to conversation mode.
        !           220: .It Ic ^P
        !           221: Return to conversation mode and write
        !           222: .Ic ^P
        !           223: to the
        !           224: current window.  Thus, typing two
        !           225: .Ic ^P Ns 's
        !           226: in conversation
        !           227: mode sends one to the current window.  If the
        !           228: .Nm window
        !           229: escape is changed to some other character, that
        !           230: character takes the place of
        !           231: .Ic ^P
        !           232: here.
        !           233: .It Ic ?
        !           234: List a short summary of commands.
        !           235: .It Ic ^L
        !           236: Refresh the screen.
        !           237: .It Ic q
        !           238: Exit
        !           239: .Nm window  .
        !           240: Confirmation is requested.
        !           241: .It Ic ^Z
        !           242: Suspend
        !           243: .Nm window  .
        !           244: .It Ic w
        !           245: Create a new window.  The user is prompted for the positions
        !           246: of the upper left and lower right corners of the window.
        !           247: The cursor is placed on the screen and the keys ``h'', ``j'',
        !           248: ``k'', and ``l''
        !           249: move the cursor left, down, up, and right, respectively.
        !           250: The keys ``H'', ``J'', ``K'', and ``L'' move the cursor to the respective
        !           251: limits of the screen.  Typing a number before the movement keys
        !           252: repeats the movement that number of times.  Return enters the cursor position
        !           253: as the upper left corner of the window.  The lower right corner
        !           254: is entered in the same manner.  During this process,
        !           255: the placement of the new window is indicated by a rectangular
        !           256: box drawn on the screen, corresponding to where the new window
        !           257: will be framed.  Typing escape at any point
        !           258: cancels this command.
        !           259: .Pp
        !           260: This window becomes the current window,
        !           261: and is given the first available ID.  The default buffer size
        !           262: is used (see
        !           263: .Ar default_nline
        !           264: command below).
        !           265: .Pp
        !           266: Only fully visible windows can be created this way.
        !           267: .It Ic c Ns Ar #
        !           268: Close window
        !           269: .Ar # .
        !           270: The process in the window is sent
        !           271: the hangup signal (see
        !           272: .Xr kill 1 ) .
        !           273: .Xr Csh 1
        !           274: should
        !           275: handle this signal correctly and cause no problems.
        !           276: .It Ic m Ns Ar #
        !           277: Move window
        !           278: .Ar #
        !           279: to another location.  A box in the shape
        !           280: of the window is drawn on
        !           281: the screen to indicate the new position of the window, and the same keys as
        !           282: those for the
        !           283: .Ic w
        !           284: command are used to position the box.  The
        !           285: window can be moved partially off-screen.
        !           286: .It Ic M Ns Ar #
        !           287: Move window
        !           288: .Ar #
        !           289: to its previous position.
        !           290: .It Ic s Ns Ar #
        !           291: Change the size of window
        !           292: .Ar # .
        !           293: The user is prompted
        !           294: to enter the new lower right corner of the window.  A box
        !           295: is drawn to indicate the new window size.  The same
        !           296: keys used in
        !           297: .Ic w
        !           298: and
        !           299: .Ic m
        !           300: are used to enter the position.
        !           301: .It Ic S Ns Ar #
        !           302: Change window
        !           303: .Ar #
        !           304: to its previous size.
        !           305: .It Ic ^Y
        !           306: Scroll the current window up by one line.
        !           307: .It Ic ^E
        !           308: Scroll the current window down by one line.
        !           309: .It Ic ^U
        !           310: Scroll the current window up by half the window size.
        !           311: .It Ic ^D
        !           312: Scroll the current window down by half the window size.
        !           313: .It Ic ^B
        !           314: Scroll the current window up by the full window size.
        !           315: .It Ic ^F
        !           316: Scroll the current window down by the full window size.
        !           317: .It Ic h
        !           318: Move the cursor of the current window left by one column.
        !           319: .It Ic j
        !           320: Move the cursor of the current window down by one line.
        !           321: .It Ic k
        !           322: Move the cursor of the current window up by one line.
        !           323: .It Ic l
        !           324: Move the cursor of the current window right by one column.
        !           325: .It Ic y
        !           326: Yank.  The user is prompted to enter two points within the current
        !           327: window.  Then the content of the current window between those two points
        !           328: is saved in the yank buffer.
        !           329: .It Ic p
        !           330: Put.  The content of the yank buffer is written to the current
        !           331: window as input.
        !           332: .It Ic ^S
        !           333: Stop output in the current window.
        !           334: .It Ic ^Q
        !           335: Start output in the current window.
        !           336: .It Ic :
        !           337: Enter a line to be executed as long commands.
        !           338: Normal line
        !           339: editing characters (erase character, erase word, erase line)
        !           340: are supported.
        !           341: .El
        !           342: .Ss Long Commands
        !           343: Long commands are a sequence of statements
        !           344: parsed much like a programming language, with a syntax
        !           345: similar to that of C.  Numeric and string expressions and variables
        !           346: are supported, as well as conditional statements.
        !           347: .Pp
        !           348: There are two data types: string and number.  A string is a sequence
        !           349: of letters or digits beginning with a letter.  ``_'' and ``.'' are
        !           350: considered letters.  Alternately, non-alphanumeric characters can
        !           351: be included in strings by quoting them in ``"'' or escaping them
        !           352: with ``\\''.  In addition, the ``\\'' sequences of C are supported,
        !           353: both inside and outside quotes (e.g., ``\\n'' is a new line,
        !           354: ``\\r'' a carriage return).  For example, these are legal strings:
        !           355: abcde01234, "&#$^*&#", ab"$#"cd, ab\\$\\#cd, "/usr/ucb/window".
        !           356: .Pp
        !           357: A number is an integer value in one of three forms:
        !           358: a decimal number, an octal number preceded by ``0'',
        !           359: or a hexadecimal number preceded by ``0x'' or ``0X''.  The natural
        !           360: machine integer size is used (i.e., the signed integer type
        !           361: of the C compiler).  As in C, a non-zero number represents
        !           362: a boolean true.
        !           363: .Pp
        !           364: The character ``#'' begins a comment which terminates at the
        !           365: end of the line.
        !           366: .Pp
        !           367: A statement is either a conditional or an expression.  Expression
        !           368: statements are terminated with a new line or ``;''.  To continue
        !           369: an expression on the next line, terminate the first line with ``\\''.
        !           370: .Ss Conditional Statement
        !           371: .Nm Window
        !           372: has a single control structure:
        !           373: the fully bracketed if statement in the form
        !           374: .Pp
        !           375: .Bd -literal -offset indent -compact
        !           376: if <expr> then
        !           377: \t<statement>
        !           378: \t...
        !           379: elsif <expr> then
        !           380: \t<statement>
        !           381: \t...
        !           382: else
        !           383: \t<statement>
        !           384: \t...
        !           385: endif
        !           386: .Ed
        !           387: .Pp
        !           388: The
        !           389: .Ic else
        !           390: and
        !           391: .Ic elsif
        !           392: parts are optional, and the latter can
        !           393: be repeated any number of times.
        !           394: <Expr>
        !           395: must be numeric.
        !           396: .Ss Expressions
        !           397: Expressions in
        !           398: .Nm window
        !           399: are similar to those in the
        !           400: C language, with most C operators supported on numeric
        !           401: operands.  In addition, some are overloaded to operate on strings.
        !           402: .Pp
        !           403: When an expression is used as a statement, its value is discarded
        !           404: after evaluation.  Therefore, only expressions with side
        !           405: effects (assignments and function calls) are useful as statements.
        !           406: .Pp
        !           407: Single valued (no arrays) variables are supported, of both
        !           408: numeric and string values.  Some variables are predefined.  They
        !           409: are listed below.
        !           410: .Pp
        !           411: The operators in order of increasing precedence:
        !           412: .Bl -tag -width Fl
        !           413: .It Xo
        !           414: .Aq Va expr1
        !           415: .Ic =
        !           416: .Aq Va expr2
        !           417: .Xc
        !           418: Assignment.  The variable of name
        !           419: .Aq Va expr1 ,
        !           420: which must be string valued,
        !           421: is assigned the result of
        !           422: .Aq Va expr2 .
        !           423: Returns the value of
        !           424: .Aq Va expr2 .
        !           425: .It Xo
        !           426: .Aq Va expr1
        !           427: .Ic ?
        !           428: .Aq Va expr2
        !           429: .Ic :
        !           430: .Aq Va expr3
        !           431: .Xc
        !           432: Returns the value of
        !           433: .Aq Va expr2
        !           434: if
        !           435: .Aq Va expr1
        !           436: evaluates true
        !           437: (non-zero numeric value); returns the value of
        !           438: .Aq Va expr3
        !           439: otherwise.  Only
        !           440: one of
        !           441: .Aq Va expr2
        !           442: and
        !           443: .Aq Va expr3
        !           444: is evaluated.
        !           445: .Aq Va Expr1
        !           446: must
        !           447: be numeric.
        !           448: .It Xo
        !           449: .Aq Va expr1
        !           450: .Ic \&|\&|
        !           451: .Aq Va expr2
        !           452: .Xc
        !           453: Logical or.  Numeric values only.  Short circuit evaluation is supported
        !           454: (i.e., if
        !           455: .Aq Va expr1
        !           456: evaluates true, then
        !           457: .Aq Va expr2
        !           458: is not evaluated).
        !           459: .It Xo
        !           460: .Aq Va expr1
        !           461: .Ic \&&\&&
        !           462: .Aq Va expr2
        !           463: .Xc
        !           464: Logical and with short circuit evaluation.  Numeric values only.
        !           465: .It Xo
        !           466: .Aq Va expr1
        !           467: .Ic \&|
        !           468: .Aq Va expr2
        !           469: .Xc
        !           470: Bitwise or.  Numeric values only.
        !           471: .It Xo
        !           472: .Aq Va expr1
        !           473: .Ic ^
        !           474: .Aq Va expr2
        !           475: .Xc
        !           476: Bitwise exclusive or.  Numeric values only.
        !           477: .It Xo
        !           478: .Aq Va expr1
        !           479: .Ic \&&
        !           480: .Aq Va expr2
        !           481: .Xc
        !           482: Bitwise and.  Numeric values only.
        !           483: .It Xo
        !           484: .Aq Va expr1
        !           485: .Ic ==
        !           486: .Aq Va expr2 ,
        !           487: .Aq Va expr1
        !           488: .Ic !=
        !           489: .Aq expr2
        !           490: .Xc
        !           491: Comparison (equal and not equal, respectively).  The boolean
        !           492: result (either 1 or 0) of the comparison is returned.  The
        !           493: operands can be numeric or string valued.  One string operand
        !           494: forces the other to be converted to a string in necessary.
        !           495: .It Xo
        !           496: .Aq Va expr1
        !           497: .Ic <
        !           498: .Aq Va expr2 ,
        !           499: .Aq Va expr1
        !           500: .Ic >
        !           501: .Aq Va expr2 ,
        !           502: .Aq Va expr1
        !           503: .Ic <=
        !           504: .Aq Va expr2 ,
        !           505: .Xc
        !           506: Less than, greater than, less than or equal to,
        !           507: greater than or equal to.  Both numeric and string values, with
        !           508: automatic conversion as above.
        !           509: .It Xo
        !           510: .Aq Va expr1
        !           511: .Ic <<
        !           512: .Aq Va expr2 ,
        !           513: .Aq Va expr1
        !           514: .Ic >>
        !           515: .Aq Va expr2
        !           516: .Xc
        !           517: If both operands are numbers,
        !           518: .Aq Va expr1
        !           519: is bit
        !           520: shifted left (or right) by
        !           521: .Aq Va expr2
        !           522: bits.  If
        !           523: .Aq Va expr1
        !           524: is
        !           525: a string, then its first (or last)
        !           526: .Aq Va expr2
        !           527: characters are
        !           528: returns (if
        !           529: .Aq Va expr2
        !           530: is also a string, then its length is used
        !           531: in place of its value).
        !           532: .It Xo
        !           533: .Aq Va expr1
        !           534: .Ic +
        !           535: .Aq Va expr2 ,
        !           536: .Aq Va expr1
        !           537: .Ic -
        !           538: .Aq Va expr2
        !           539: .Xc
        !           540: Addition and subtraction on numbers.  For ``+'', if one
        !           541: argument is a string, then the other is converted to a string,
        !           542: and the result is the concatenation of the two strings.
        !           543: .It Xo
        !           544: .Aq Va expr1
        !           545: .Ic \&*
        !           546: .Aq Va expr2 ,
        !           547: .Aq Va expr1
        !           548: .Ic \&/
        !           549: .Aq Va expr2 ,
        !           550: .Aq Va expr1
        !           551: .Ic \&%
        !           552: .Aq Va expr2
        !           553: .Xc
        !           554: Multiplication, division, modulo.  Numbers only.
        !           555: .It Xo
        !           556: .Ic \- Ns Aq Va expr ,
        !           557: .Ic ~ Ns Aq Va expr ,
        !           558: .Ic \&! Ns Aq Va expr ,
        !           559: .Ic \&$ Ns Aq Va expr ,
        !           560: .Ic \&$? Ns Aq Va expr
        !           561: .Xc
        !           562: The first three are unary minus, bitwise complement and logical complement
        !           563: on numbers only.  The operator, ``$'', takes
        !           564: .Aq Va expr
        !           565: and returns
        !           566: the value of the variable of that name.  If
        !           567: .Aq Va expr
        !           568: is numeric
        !           569: with value
        !           570: .Ar n
        !           571: and it appears within an alias macro (see below),
        !           572: then it refers to the nth argument of the alias invocation.  ``$?''
        !           573: tests for the existence of the variable
        !           574: .Aq Va expr ,
        !           575: and returns 1
        !           576: if it exists or 0 otherwise.
        !           577: .It Xo
        !           578: .Ao Va expr Ac Ns Pq Aq Ar arglist
        !           579: .Xc
        !           580: Function call.
        !           581: .Aq Va Expr
        !           582: must be a string that is the unique
        !           583: prefix of the name of a builtin
        !           584: .Nm window
        !           585: function
        !           586: or the full name of a user defined alias macro.  In the case of a builtin
        !           587: function,
        !           588: .Aq Ar arglist
        !           589: can be in one of two forms:
        !           590: .Bd -literal -offset indent
        !           591: <expr1>, <expr2>, ...
        !           592: argname1 = <expr1>, argname2 = <expr2>, ...
        !           593: .Ed
        !           594: .Pp
        !           595: The two forms can in fact be intermixed, but the result is
        !           596: unpredictable.  Most arguments can be omitted; default values will
        !           597: be supplied for them.  The
        !           598: .Ar argnames
        !           599: can be unique prefixes
        !           600: of the argument names.  The commas separating
        !           601: arguments are used only to disambiguate, and can usually be omitted.
        !           602: .Pp
        !           603: Only the first argument form is valid for user defined aliases.  Aliases
        !           604: are defined using the
        !           605: .Ic alias
        !           606: builtin function (see below).  Arguments
        !           607: are accessed via a variant of the variable mechanism (see ``$'' operator
        !           608: above).
        !           609: .Pp
        !           610: Most functions return value, but some are used for side effect
        !           611: only and so must be used as statements.  When a function or an alias is used
        !           612: as a statement, the parentheses surrounding
        !           613: the argument list may be omitted.  Aliases return no value.
        !           614: .El
        !           615: .Ss  Builtin Functions
        !           616: The arguments are listed by name in their natural
        !           617: order.  Optional arguments are in square brackets
        !           618: .Sq Op .
        !           619: Arguments
        !           620: that have no names are in angle brackets
        !           621: .Sq <> .
        !           622: An argument meant to be a boolean flag (often named
        !           623: .Ar flag )
        !           624: can be one of
        !           625: .Ar on ,
        !           626: .Ar off ,
        !           627: .Ar yes ,
        !           628: .Ar no ,
        !           629: .Ar true ,
        !           630: or
        !           631: .Ar false ,
        !           632: with
        !           633: obvious meanings, or it can be a numeric expression,
        !           634: in which case a non-zero value is true.
        !           635: .Bl -tag -width Fl
        !           636: .It Xo
        !           637: .Ic alias Ns Po Bq Aq Ar string ,
        !           638: .Bq Aq Ar string\-list Pc
        !           639: .Xc
        !           640: If no argument is given, all currently defined alias macros are
        !           641: listed.  Otherwise,
        !           642: .Aq Ar string
        !           643: is defined as an alias,
        !           644: with expansion
        !           645: .Aq Ar string\-list > .
        !           646: The previous definition of
        !           647: .Aq Ar string ,
        !           648: if any, is returned.  Default for
        !           649: .Aq Ar string\-list
        !           650: is no change.
        !           651: .It Ic close Ns Pq Aq Ar window\-list
        !           652: Close the windows specified in
        !           653: .Aq Ar window\-list .
        !           654: If
        !           655: .Aq Ar window\-list
        !           656: is the word
        !           657: .Ar all  ,
        !           658: than all windows are closed.  No value is returned.
        !           659: .It Ic cursormodes Ns Pq Bq Ar modes
        !           660: Set the window cursor to
        !           661: .Ar modes  .
        !           662: .Ar Modes
        !           663: is the bitwise
        !           664: or of the mode bits defined as the variables
        !           665: .Ar m_ul
        !           666: (underline),
        !           667: .Ar m_rev
        !           668: (reverse video),
        !           669: .Ar m_blk
        !           670: (blinking),
        !           671: and
        !           672: .Ar m_grp
        !           673: (graphics, terminal dependent).  Return
        !           674: value is the previous modes.  Default is no change.
        !           675: For example,
        !           676: .Li cursor($m_rev$m_blk)
        !           677: sets the window cursors to blinking
        !           678: reverse video.
        !           679: .It Ic default_nline Ns Pq Bq Ar nline
        !           680: Set the default buffer size to
        !           681: .Ar nline  .
        !           682: Initially, it is
        !           683: 48 lines.  Returns the old default buffer size.  Default is
        !           684: no change.  Using a very large buffer can slow the program down
        !           685: considerably.
        !           686: .It Ic default_shell Ns Pq Bq Aq Ar string\-list
        !           687: Set the default window shell program to
        !           688: .Aq Ar string\-list .
        !           689: Returns
        !           690: the first string in the old shell setting.  Default is no change.  Initially,
        !           691: the default shell is taken from the environment variable
        !           692: .Ev SHELL  .
        !           693: .It Ic default_smooth Ns Pq Bq Ar flag
        !           694: Set the default value of the
        !           695: .Ar smooth
        !           696: argument
        !           697: to the command
        !           698: .Nm window
        !           699: (see below).  The argument
        !           700: is a boolean flag (one of
        !           701: .Ar on  ,
        !           702: .Ar off  ,
        !           703: .Ar yes  ,
        !           704: .Ar no  ,
        !           705: .Ar true  ,
        !           706: .Ar false  ,
        !           707: or a number,
        !           708: as described above).  Default is no change.
        !           709: The old value (as a number) is returned.
        !           710: The initial value is 1 (true).
        !           711: .It Xo
        !           712: .Ic echo Ns ( Op Ar window ,
        !           713: .Bq Aq Ar string\-list )
        !           714: .Xc
        !           715: Write the list of strings,
        !           716: .Aq Ar string-list ,
        !           717: to
        !           718: .Nm window  ,
        !           719: separated
        !           720: by spaces and terminated with a new line.  The strings are only
        !           721: displayed in the window, the processes in the window are not
        !           722: involved (see
        !           723: .Ic write
        !           724: below).  No value is returned.  Default
        !           725: is the current window.
        !           726: .It Ic escape Ns Pq Bq Ar escapec
        !           727: Set the escape character to
        !           728: .Ar escape-char  .
        !           729: Returns the old
        !           730: escape character as a one-character string.  Default is no
        !           731: change.
        !           732: .Ar Escapec
        !           733: can be a string of a single character, or
        !           734: in the form
        !           735: .Fl ^X ,
        !           736: meaning
        !           737: .No control\- Ns Ar X .
        !           738: .It Xo
        !           739: .Ic foreground Ns ( Bq Ar window ,
        !           740: .Bq Ar flag )
        !           741: .Xc
        !           742: Move
        !           743: .Nm window
        !           744: in or out of foreground.
        !           745: .Ar Flag
        !           746: is a boolean value.  The old foreground flag
        !           747: is returned.  Default for
        !           748: .Nm window
        !           749: is the current window,
        !           750: default for
        !           751: .Ar flag
        !           752: is no change.
        !           753: .It Xo
        !           754: .Ic label Ns ( Bq Ar window ,
        !           755: .Bq Ar label )
        !           756: .Xc
        !           757: Set the label of
        !           758: .Nm window
        !           759: to
        !           760: .Ar label  .
        !           761: Returns the old
        !           762: label as a string.  Default for
        !           763: .Nm window
        !           764: is the current
        !           765: window, default for
        !           766: .Ar label
        !           767: is no change.  To turn
        !           768: off a label, set it to an empty string ("").
        !           769: .It Ic list Ns Pq
        !           770: No arguments.  List the identifiers and labels of all windows.  No
        !           771: value is returned.
        !           772: .It Ic select Ns Pq Bq Ar window
        !           773: Make
        !           774: .Nm window
        !           775: the current window.  The previous current window
        !           776: is returned.  Default is no change.
        !           777: .It Ic source Ns Pq Ar filename
        !           778: Read and execute the long commands in
        !           779: .Ar filename  .
        !           780: Returns \-1 if the file cannot be read, 0 otherwise.
        !           781: .It Ic terse Ns Pq Bq flag
        !           782: Set terse mode to
        !           783: .Ar flag  .
        !           784: In terse mode, the command window
        !           785: stays hidden even in command mode, and errors are reported by
        !           786: sounding the terminal's bell.
        !           787: .Ar Flag
        !           788: can take on the same
        !           789: values as in
        !           790: .Ar foreground
        !           791: above.  Returns the old terse flag.
        !           792: Default is no change.
        !           793: .It Ic unalias Ns Pq Ar alias
        !           794: Undefine
        !           795: .Ar alias  .
        !           796: Returns -1 if
        !           797: .Ar alias
        !           798: does not exist,
        !           799: 0 otherwise.
        !           800: .It Ic unset Ns Pq Ar variable
        !           801: Undefine
        !           802: .Ar variable  .
        !           803: Returns -1 if
        !           804: .Ar variable
        !           805: does not exist,
        !           806: 0 otherwise.
        !           807: .It Ic variables Ns Pq
        !           808: No arguments.  List all variables.  No value is returned.
        !           809: .It Xo
        !           810: .Ic window Ns ( Bq Ar row ,
        !           811: .Bq Ar column ,
        !           812: .Bq Ar nrow ,
        !           813: .Bq Ar ncol ,
        !           814: .Bq Ar nline ,
        !           815: .Bq Ar label ,
        !           816: .Bq Ar pty ,
        !           817: .Bq Ar frame ,
        !           818: .Bq Ar mapnl ,
        !           819: .Bq Ar keepopen ,
        !           820: .Bq Ar smooth ,
        !           821: .Bq Ar shell ) .
        !           822: .Xc
        !           823: Open a window with upper left corner at
        !           824: .Ar row  ,
        !           825: .Ar column
        !           826: and size
        !           827: .Ar nrow  ,
        !           828: .Ar ncol  .
        !           829: If
        !           830: .Ar nline
        !           831: is specified,
        !           832: then that many lines are allocated for the text buffer.  Otherwise,
        !           833: the default buffer size is used.  Default values for
        !           834: .Ar row  ,
        !           835: .Ar column  ,
        !           836: .Ar nrow  ,
        !           837: and
        !           838: .Ar ncol
        !           839: are, respectively,
        !           840: the upper, left-most, lower, or right-most extremes of the
        !           841: screen.
        !           842: .Ar Label
        !           843: is the label string.
        !           844: .Ar Frame  ,
        !           845: .Ar pty  ,
        !           846: and
        !           847: .Ar mapnl
        !           848: are flag values
        !           849: interpreted in the same way as the argument to
        !           850: .Ar foreground
        !           851: (see above);
        !           852: they mean, respectively, put a frame around this window (default true),
        !           853: allocate pseudo-terminal for this window rather than socketpair (default
        !           854: true), and map new line characters in this window to carriage return
        !           855: and line feed (default true if socketpair is used, false otherwise).
        !           856: Normally, a window is automatically closed when its process
        !           857: exits.  Setting
        !           858: .Ar keepopen
        !           859: to true (default false) prevents this
        !           860: action.  When
        !           861: .Ar smooth
        !           862: is true, the screen is updated more frequently
        !           863: (for this window) to produce a more terminal-like behavior.
        !           864: The default value of
        !           865: .Ar smooth
        !           866: is set by the
        !           867: .Ar default_smooth
        !           868: command (see above).
        !           869: .Ar Shell
        !           870: is a list of strings that will be used as the shell
        !           871: program to place in the window (default is the program specified
        !           872: by
        !           873: .Ar default_shell  ,
        !           874: see above).  The created window's identifier
        !           875: is returned as a number.
        !           876: .It Xo
        !           877: .Ic write Ns ( Bq Ar window ,
        !           878: .Bq Aq Ar string\-list )
        !           879: .Xc
        !           880: Send the list of strings,
        !           881: .Aq Ar string-list ,
        !           882: to
        !           883: .Nm window  ,
        !           884: separated
        !           885: by spaces but not terminated with a new line.  The strings are actually
        !           886: given to the window as input.  No value is returned.  Default
        !           887: is the current window.
        !           888: .El
        !           889: .Ss Predefined Variables
        !           890: These variables are for information only.  Redefining them does
        !           891: not affect the internal operation of
        !           892: .Nm window  .
        !           893: .Bl -tag -width modes
        !           894: .It Ar baud
        !           895: The baud rate as a number between 50 and 38400.
        !           896: .It Ar modes
        !           897: The display modes (reverse video, underline, blinking, graphics)
        !           898: supported by the physical terminal.  The value of
        !           899: .Ar modes
        !           900: is the bitwise or of some of the one bit values,
        !           901: .Ar m_blk ,
        !           902: .Ar m_grp ,
        !           903: .Ar m_rev ,
        !           904: and
        !           905: .Ar m_ul
        !           906: (see below).
        !           907: These values are useful
        !           908: in setting the window cursors' modes (see
        !           909: .Ar cursormodes
        !           910: above).
        !           911: .It Ar m_blk
        !           912: The blinking mode bit.
        !           913: .It Ar m_grp
        !           914: The graphics mode bit (not very useful).
        !           915: .It Ar m_rev
        !           916: The reverse video mode bit.
        !           917: .It Ar m_ul
        !           918: The underline mode bit.
        !           919: .It Ar ncol
        !           920: The number of columns on the physical screen.
        !           921: .It Ar nrow
        !           922: The number of rows on the physical screen.
        !           923: .It Ar term
        !           924: The terminal type.  The standard name, found in the second name
        !           925: field of the terminal's
        !           926: .Ev TERMCAP
        !           927: entry, is used.
        !           928: .Sh ENVIRONMENT
        !           929: .Nm Window
        !           930: utilizes these environment variables:
        !           931: .Ev HOME ,
        !           932: .Ev SHELL ,
        !           933: .Ev TERM ,
        !           934: .Ev TERMCAP ,
        !           935: .Ev WINDOW_ID .
        !           936: .Sh FILES
        !           937: .Bl -tag -width /dev/[pt]ty[pq]? -compact
        !           938: .It Pa ~/.windowrc
        !           939: startup command file.
        !           940: .It Pa /dev/[pt]ty[pq]?
        !           941: pseudo-terminal devices.
        !           942: .El
        !           943: .Sh HISTORY
        !           944: The
        !           945: .Nm window
        !           946: command appeared in
        !           947: .Bx 4.3 .
        !           948: .Sh DIAGNOSTICS
        !           949: Should be self explanatory.