162471Sbostic.\" Copyright (c) 1985, 1990, 1993 262471Sbostic.\" The Regents of the University of California. All rights reserved. 319781Smckusick.\" 443755Scael.\" This code is derived from software contributed to Berkeley by 543755Scael.\" Edward Wang at The University of California, Berkeley. 643755Scael.\" 750586Scael.\" %sccs.include.redist.roff% 842954Sbostic.\" 9*65227Smckusick.\" @(#)window.1 8.2 (Berkeley) 12/30/93 1019781Smckusick.\" 1143085Scael.Dd 1243085Scael.Dt WINDOW 1 1343085Scael.Os BSD 4.3 1443085Scael.Sh NAME 1543085Scael.Nm window 1643085Scael.Nd window environment 1743085Scael.Sh SYNOPSIS 1843085Scael.Nm window 1943085Scael.Op Fl t 2043085Scael.Op Fl f 2143085Scael.Op Fl d 2243085Scael.Op Fl e Ar escape-char 2343085Scael.Op Fl c Ar command 2443085Scael.Sh DESCRIPTION 2543085Scael.Nm Window 2643085Scaelimplements a window environment on 2750586Scael.Tn ASCII 2850586Scaelterminals. 2943085Scael.Pp 3018595SedwardA window is a rectangular portion of the physical terminal 3122693Sedwardscreen associated with a set of processes. Its size and 3222693Sedwardposition can be changed by the user at any time. Processes 3322693Sedwardcommunicate with their window in the same way they normally 3443085Scaelinteract with a terminal\-through their standard input, output, 3522693Sedwardand diagnostic file descriptors. The window program handles the 36*65227Smckusickdetails of redirecting input and output to and from the 3718595Sedwardwindows. At any one time, only one window can receive 3818595Sedwardinput from the keyboard, but all windows can simultaneously send output 3918595Sedwardto the display. 4043085Scael.Pp 4143085ScaelWhen 4243085Scael.Nm window 4343085Scaelstarts up, the commands (see long commands below) 4443085Scaelcontained in the file 4543085Scael.Pa .windowrc 4643085Scaelin the user's home directory are 4743085Scaelexecuted. If it does not exist, two equal sized windows spanning 4843085Scaelthe terminal screen are created by default. 4943085Scael.Pp 5043085ScaelThe command line options are 5150586Scael.Bl -tag -width Fl 5250586Scael.It Fl t 5343085ScaelTurn on terse mode (see 5443085Scael.Ic terse 5543085Scaelcommand below). 5650586Scael.It Fl f 5743085ScaelFast. Don't perform any startup action. 5850586Scael.It Fl d 5943085ScaelIgnore 6043085Scael.Pa .windowrc 6143085Scaeland create the two default 6243085Scaelwindows instead. 6350586Scael.It Fl e Ar escape-char 6443085ScaelSet the escape character to 6543085Scael.Ar escape-char . 6643085Scael.Ar Escape-char 6743085Scaelcan be a single character, or in the form 6843085Scael.Ic ^X 6943085Scaelwhere 7043085Scael.Ar X 7143085Scaelis any character, meaning 7250586Scael.No control\- Ns Ar X . 7350586Scael.It Fl c Ar command 7443085ScaelExecute the string 7543085Scael.Ar command 7643085Scaelas a long command (see below) 7743085Scaelbefore doing anything else. 7850586Scael.El 7943085Scael.Pp 8018595SedwardWindows can overlap and are framed as necessary. Each window 8136088Sedwardis named by one of the digits ``1'' to ``9''. This one-character 8218595Sedwardidentifier, as well as a user definable label string, are displayed 8318595Sedwardwith the window on the top edge of its frame. A window can be 8443085Scaeldesignated to be in the 8543085Scael.Ar foreground , 8643085Scaelin which case it will always be 8718595Sedwardon top of all normal, non-foreground windows, and can be covered 8822693Sedwardonly by other foreground windows. A window need not be completely 8922693Sedwardwithin the edges of the terminal screen. Thus a large window 9022693Sedward(possibly larger than the screen) may be positioned to show only 9122693Sedwarda portion of its full size. 9243085Scael.Pp 9322693SedwardEach window has a cursor and a set of control functions. Most intelligent 9422693Sedwardterminal operations such as line and 9518595Sedwardcharacter deletion and insertion are supported. Display modes 9622693Sedwardsuch as underlining and reverse video are available if they are 9722693Sedwardsupported by the terminal. In addition, 9822693Sedwardsimilar to terminals with multiple pages of memory, 9927209Slepreaueach window has a text buffer which can have more lines than the window 10022693Sedwarditself. 10143085Scael.Ss Process Environment 10218595SedwardWith each newly created window, a shell program is spawned with its 10318595Sedwardprocess environment tailored to that window. Its standard input, 10418595Sedwardoutput, and diagnostic file descriptors are bound to one end of either 10543085Scaela pseudo-terminal 10643085Scael.Xr (pty 4 ) 10750586Scaelor a 10850586Scael.Ux 10950586Scaeldomain socket 11043085Scael.Xr (socketpair 4 ) . 11143085ScaelIf a pseudo-terminal is used, then its special 11243085Scaelcharacters and modes (see 11343085Scael.Xr stty 1 ) 11443085Scaelare copied from the physical 11543085Scaelterminal. A 11643085Scael.Xr termcap 5 11743085Scaelentry tailored to this window is created 11843085Scaeland passed as environment 11943085Scael.Xr (environ 5 ) 12043085Scaelvariable 12143085Scael.Ev TERMCAP . 12243085ScaelThe termcap entry contains the window's size and 12318595Sedwardcharacteristics as well as information from the physical terminal, 12418595Sedwardsuch as the existence of underline, reverse video, and other display 12518595Sedwardmodes, and the codes produced by the terminal's function keys, 12622693Sedwardif any. In addition, the window size attributes of the pseudo-terminal 12722693Sedwardare set to reflect the size of this window, and updated whenever 12843085Scaelit is changed by the user. In particular, the editor 12943085Scael.Xr vi 1 13043085Scaeluses 13118595Sedwardthis information to redraw its display. 13243085Scael.Ss Operation 13343085ScaelDuring normal execution, 13443085Scael.Nm window 13543085Scaelcan be in one of two states: 13618595Sedwardconversation mode and command mode. In conversation mode, the 13718595Sedwardterminal's real cursor is placed at the cursor position of a particular 13818595Sedwardwindow--called the current window--and input from the keyboard is sent 13918595Sedwardto the process in that window. The current window is always 14018595Sedwardon top of all other windows, except those in foreground. In addition, 14118595Sedwardit is set apart by highlighting its identifier and label in reverse video. 14243085Scael.Pp 14343085ScaelTyping 14450586Scael.Nm window Ns 's 14543085Scaelescape character (normally 14643085Scael.Ic ^P ) 14743085Scaelin conversation 14818595Sedwardmode switches it into command mode. In command mode, the top line of 14943085Scaelthe terminal screen becomes the command prompt window, and 15043085Scael.Nm window 15118595Sedwardinterprets input from the keyboard as commands to manipulate windows. 15243085Scael.Pp 15318595SedwardThere are two types of commands: short commands are usually one or two 15418595Sedwardkey strokes; long commands are strings either typed by the user in the 15543085Scaelcommand window (see the 15643085Scael.Dq Ic \&: 15743085Scaelcommand below), or read from a file (see 15843085Scael.Ic source 15943085Scaelbelow). 16043085Scael.Ss Short Commands 16143085ScaelBelow, 16250586Scael.Ar \&# 16343085Scaelrepresents one of the digits ``1'' to ``9'' 16443085Scaelcorresponding to the windows 1 to 9. 16543085Scael.Ic ^X 16643085Scaelmeans 16750586Scael.No control\- Ns Ar X , 16843085Scaelwhere 16943085Scael.Ar X 17043085Scaelis any character. In particular, 17143085Scael.Ic ^^ 17243085Scaelis 17343085Scael.Li control\-^. 17443085Scael.Ar Escape 17543085Scaelis the escape key, or 17650586Scael.Ic ^\&[ . 17750586Scael.Bl -tag -width Ds 17850586Scael.It Ar # 17943085ScaelSelect window 18043085Scael.Ar # 18143085Scaelas the current window 18214296Sedwardand return to conversation mode. 18350586Scael.It Ic \&% Ns Ar # 18443085ScaelSelect window 18543085Scael.Ar # 18643085Scaelbut stay in command mode. 18750586Scael.It Ic ^^ 18818595SedwardSelect the previous window and return to conversation 18918595Sedwardmode. This is useful for toggling between two windows. 19050586Scael.It Ic escape 19114187SedwardReturn to conversation mode. 19250586Scael.It Ic ^P 19343085ScaelReturn to conversation mode and write 19443085Scael.Ic ^P 19543085Scaelto the 19643085Scaelcurrent window. Thus, typing two 19750586Scael.Ic ^P Ns 's 19843085Scaelin conversation 19943085Scaelmode sends one to the current window. If the 20043085Scael.Nm window 20114187Sedwardescape is changed to some other character, that 20243085Scaelcharacter takes the place of 20343085Scael.Ic ^P 20443085Scaelhere. 20550586Scael.It Ic ? 20618595SedwardList a short summary of commands. 20750586Scael.It Ic ^L 20843085ScaelRefresh the screen. 20950586Scael.It Ic q 21043085ScaelExit 21143085Scael.Nm window . 21243085ScaelConfirmation is requested. 21350586Scael.It Ic ^Z 21443085ScaelSuspend 21543085Scael.Nm window . 21650586Scael.It Ic w 21718595SedwardCreate a new window. The user is prompted for the positions 21814296Sedwardof the upper left and lower right corners of the window. 21914326SedwardThe cursor is placed on the screen and the keys ``h'', ``j'', 22014326Sedward``k'', and ``l'' 22114326Sedwardmove the cursor left, down, up, and right, respectively. 22214326SedwardThe keys ``H'', ``J'', ``K'', and ``L'' move the cursor to the respective 22314802Sedwardlimits of the screen. Typing a number before the movement keys 22418595Sedwardrepeats the movement that number of times. Return enters the cursor position 22514187Sedwardas the upper left corner of the window. The lower right corner 22616285Sedwardis entered in the same manner. During this process, 22718595Sedwardthe placement of the new window is indicated by a rectangular 22818595Sedwardbox drawn on the screen, corresponding to where the new window 22918595Sedwardwill be framed. Typing escape at any point 23016285Sedwardcancels this command. 23143085Scael.Pp 23214802SedwardThis window becomes the current window, 23318595Sedwardand is given the first available ID. The default buffer size 23443085Scaelis used (see 23543085Scael.Ar default_nline 23643085Scaelcommand below). 23743085Scael.Pp 23816285SedwardOnly fully visible windows can be created this way. 23950586Scael.It Ic c Ns Ar # 24043085ScaelClose window 24143085Scael.Ar # . 24243085ScaelThe process in the window is sent 24343085Scaelthe hangup signal (see 24443085Scael.Xr kill 1 ) . 24543085Scael.Xr Csh 1 24643085Scaelshould 24714187Sedwardhandle this signal correctly and cause no problems. 24850586Scael.It Ic m Ns Ar # 24943085ScaelMove window 25043085Scael.Ar # 25143085Scaelto another location. A box in the shape 25216285Sedwardof the window is drawn on 25316285Sedwardthe screen to indicate the new position of the window, and the same keys as 25443085Scaelthose for the 25543085Scael.Ic w 25643085Scaelcommand are used to position the box. The 25716107Sedwardwindow can be moved partially off-screen. 25850586Scael.It Ic M Ns Ar # 25943085ScaelMove window 26043085Scael.Ar # 26143085Scaelto its previous position. 26250586Scael.It Ic s Ns Ar # 26343085ScaelChange the size of window 26443085Scael.Ar # . 26543085ScaelThe user is prompted 26618595Sedwardto enter the new lower right corner of the window. A box 26718595Sedwardis drawn to indicate the new window size. The same 26843085Scaelkeys used in 26943085Scael.Ic w 27043085Scaeland 27143085Scael.Ic m 27243085Scaelare used to enter the position. 27350586Scael.It Ic S Ns Ar # 27443085ScaelChange window 27543085Scael.Ar # 27643085Scaelto its previous size. 27750586Scael.It Ic ^Y 27814802SedwardScroll the current window up by one line. 27950586Scael.It Ic ^E 28014802SedwardScroll the current window down by one line. 28150586Scael.It Ic ^U 28214187SedwardScroll the current window up by half the window size. 28350586Scael.It Ic ^D 28414187SedwardScroll the current window down by half the window size. 28550586Scael.It Ic ^B 28614187SedwardScroll the current window up by the full window size. 28750586Scael.It Ic ^F 28814187SedwardScroll the current window down by the full window size. 28950586Scael.It Ic h 29014187SedwardMove the cursor of the current window left by one column. 29150586Scael.It Ic j 29214187SedwardMove the cursor of the current window down by one line. 29350586Scael.It Ic k 29414187SedwardMove the cursor of the current window up by one line. 29550586Scael.It Ic l 29614187SedwardMove the cursor of the current window right by one column. 29757758Sedward.It Ic y 29857758SedwardYank. The user is prompted to enter two points within the current 29957758Sedwardwindow. Then the content of the current window between those two points 30057758Sedwardis saved in the yank buffer. 30157758Sedward.It Ic p 30257758SedwardPut. The content of the yank buffer is written to the current 30357758Sedwardwindow as input. 30450586Scael.It Ic ^S 30518595SedwardStop output in the current window. 30650586Scael.It Ic ^Q 30718595SedwardStart output in the current window. 30850586Scael.It Ic : 30943085ScaelEnter a line to be executed as long commands. 31043085ScaelNormal line 31143085Scaelediting characters (erase character, erase word, erase line) 31243085Scaelare supported. 31350586Scael.El 31443085Scael.Ss Long Commands 31518595SedwardLong commands are a sequence of statements 31618595Sedwardparsed much like a programming language, with a syntax 31718595Sedwardsimilar to that of C. Numeric and string expressions and variables 31818595Sedwardare supported, as well as conditional statements. 31943085Scael.Pp 32018595SedwardThere are two data types: string and number. A string is a sequence 32118595Sedwardof letters or digits beginning with a letter. ``_'' and ``.'' are 32218595Sedwardconsidered letters. Alternately, non-alphanumeric characters can 32318595Sedwardbe included in strings by quoting them in ``"'' or escaping them 32418595Sedwardwith ``\\''. In addition, the ``\\'' sequences of C are supported, 32518595Sedwardboth inside and outside quotes (e.g., ``\\n'' is a new line, 32618595Sedward``\\r'' a carriage return). For example, these are legal strings: 32718595Sedwardabcde01234, "&#$^*&#", ab"$#"cd, ab\\$\\#cd, "/usr/ucb/window". 32843085Scael.Pp 32918595SedwardA number is an integer value in one of three forms: 33018595Sedwarda decimal number, an octal number preceded by ``0'', 33118595Sedwardor a hexadecimal number preceded by ``0x'' or ``0X''. The natural 33218595Sedwardmachine integer size is used (i.e., the signed integer type 33318595Sedwardof the C compiler). As in C, a non-zero number represents 33418595Sedwarda boolean true. 33543085Scael.Pp 33618595SedwardThe character ``#'' begins a comment which terminates at the 33718595Sedwardend of the line. 33843085Scael.Pp 33918595SedwardA statement is either a conditional or an expression. Expression 34018595Sedwardstatements are terminated with a new line or ``;''. To continue 34118595Sedwardan expression on the next line, terminate the first line with ``\\''. 34243085Scael.Ss Conditional Statement 34343085Scael.Nm Window 34443085Scaelhas a single control structure: 34518595Sedwardthe fully bracketed if statement in the form 34643085Scael.Pp 34750586Scael.Bd -literal -offset indent -compact 34843085Scaelif <expr> then 34943085Scael\t<statement> 35043085Scael\t... 35143085Scaelelsif <expr> then 35243085Scael\t<statement> 35343085Scael\t... 35443085Scaelelse 35543085Scael\t<statement> 35643085Scael\t... 35743085Scaelendif 35850586Scael.Ed 35943085Scael.Pp 36043085ScaelThe 36143085Scael.Ic else 36243085Scaeland 36343085Scael.Ic elsif 36443085Scaelparts are optional, and the latter can 36543085Scaelbe repeated any number of times. 36643085Scael<Expr> 36743085Scaelmust be numeric. 36843085Scael.Ss Expressions 36943085ScaelExpressions in 37043085Scael.Nm window 37143085Scaelare similar to those in the 37218595SedwardC language, with most C operators supported on numeric 37318595Sedwardoperands. In addition, some are overloaded to operate on strings. 37443085Scael.Pp 37518595SedwardWhen an expression is used as a statement, its value is discarded 37618595Sedwardafter evaluation. Therefore, only expressions with side 37718595Sedwardeffects (assignments and function calls) are useful as statements. 37843085Scael.Pp 37918595SedwardSingle valued (no arrays) variables are supported, of both 38018595Sedwardnumeric and string values. Some variables are predefined. They 38118595Sedwardare listed below. 38243085Scael.Pp 38318595SedwardThe operators in order of increasing precedence: 38450586Scael.Bl -tag -width Fl 38550586Scael.It Xo 38650586Scael.Aq Va expr1 38743085Scael.Ic = 38850586Scael.Aq Va expr2 38950586Scael.Xc 39043085ScaelAssignment. The variable of name 39150586Scael.Aq Va expr1 , 39243085Scaelwhich must be string valued, 39343085Scaelis assigned the result of 39450586Scael.Aq Va expr2 . 39543085ScaelReturns the value of 39650586Scael.Aq Va expr2 . 39750586Scael.It Xo 39850586Scael.Aq Va expr1 39943085Scael.Ic ? 40050586Scael.Aq Va expr2 40143085Scael.Ic : 40250586Scael.Aq Va expr3 40350586Scael.Xc 40443085ScaelReturns the value of 40550586Scael.Aq Va expr2 40643085Scaelif 40750586Scael.Aq Va expr1 40843085Scaelevaluates true 40943085Scael(non-zero numeric value); returns the value of 41050586Scael.Aq Va expr3 41143085Scaelotherwise. Only 41243085Scaelone of 41350586Scael.Aq Va expr2 41443085Scaeland 41550586Scael.Aq Va expr3 41643085Scaelis evaluated. 41750586Scael.Aq Va Expr1 41843085Scaelmust 41918595Sedwardbe numeric. 42050586Scael.It Xo 42150586Scael.Aq Va expr1 42243085Scael.Ic \&|\&| 42350586Scael.Aq Va expr2 42450586Scael.Xc 42518595SedwardLogical or. Numeric values only. Short circuit evaluation is supported 42643085Scael(i.e., if 42750586Scael.Aq Va expr1 42843085Scaelevaluates true, then 42950586Scael.Aq Va expr2 43043085Scaelis not evaluated). 43150586Scael.It Xo 43250586Scael.Aq Va expr1 43343085Scael.Ic \&&\&& 43450586Scael.Aq Va expr2 43550586Scael.Xc 43618595SedwardLogical and with short circuit evaluation. Numeric values only. 43750586Scael.It Xo 43850586Scael.Aq Va expr1 43943085Scael.Ic \&| 44050586Scael.Aq Va expr2 44150586Scael.Xc 44218595SedwardBitwise or. Numeric values only. 44350586Scael.It Xo 44450586Scael.Aq Va expr1 44543085Scael.Ic ^ 44650586Scael.Aq Va expr2 44750586Scael.Xc 44818595SedwardBitwise exclusive or. Numeric values only. 44950586Scael.It Xo 45050586Scael.Aq Va expr1 45143085Scael.Ic \&& 45250586Scael.Aq Va expr2 45350586Scael.Xc 45418595SedwardBitwise and. Numeric values only. 45550586Scael.It Xo 45650586Scael.Aq Va expr1 45750586Scael.Ic == 45850586Scael.Aq Va expr2 , 45950586Scael.Aq Va expr1 46043085Scael.Ic != 46150586Scael.Aq expr2 46250586Scael.Xc 46318595SedwardComparison (equal and not equal, respectively). The boolean 46418595Sedwardresult (either 1 or 0) of the comparison is returned. The 46518595Sedwardoperands can be numeric or string valued. One string operand 46618595Sedwardforces the other to be converted to a string in necessary. 46750586Scael.It Xo 46850586Scael.Aq Va expr1 46943085Scael.Ic < 47050586Scael.Aq Va expr2 , 47150586Scael.Aq Va expr1 47243085Scael.Ic > 47350586Scael.Aq Va expr2 , 47450586Scael.Aq Va expr1 47543085Scael.Ic <= 47650586Scael.Aq Va expr2 , 47750586Scael.Xc 47818595SedwardLess than, greater than, less than or equal to, 47918595Sedwardgreater than or equal to. Both numeric and string values, with 48018595Sedwardautomatic conversion as above. 48150586Scael.It Xo 48250586Scael.Aq Va expr1 48343085Scael.Ic << 48450586Scael.Aq Va expr2 , 48550586Scael.Aq Va expr1 48643085Scael.Ic >> 48750586Scael.Aq Va expr2 48850586Scael.Xc 48943085ScaelIf both operands are numbers, 49050586Scael.Aq Va expr1 49143085Scaelis bit 49243085Scaelshifted left (or right) by 49350586Scael.Aq Va expr2 49443085Scaelbits. If 49550586Scael.Aq Va expr1 49643085Scaelis 49743085Scaela string, then its first (or last) 49850586Scael.Aq Va expr2 49943085Scaelcharacters are 50043085Scaelreturns (if 50150586Scael.Aq Va expr2 50243085Scaelis also a string, then its length is used 50318595Sedwardin place of its value). 50450586Scael.It Xo 50550586Scael.Aq Va expr1 50643085Scael.Ic + 50750586Scael.Aq Va expr2 , 50850586Scael.Aq Va expr1 50943085Scael.Ic - 51050586Scael.Aq Va expr2 51150586Scael.Xc 51218595SedwardAddition and subtraction on numbers. For ``+'', if one 51318595Sedwardargument is a string, then the other is converted to a string, 51418595Sedwardand the result is the concatenation of the two strings. 51550586Scael.It Xo 51650586Scael.Aq Va expr1 51743085Scael.Ic \&* 51850586Scael.Aq Va expr2 , 51950586Scael.Aq Va expr1 52043085Scael.Ic \&/ 52150586Scael.Aq Va expr2 , 52250586Scael.Aq Va expr1 52343085Scael.Ic \&% 52450586Scael.Aq Va expr2 52550586Scael.Xc 52618595SedwardMultiplication, division, modulo. Numbers only. 52750586Scael.It Xo 52850586Scael.Ic \- Ns Aq Va expr , 52950586Scael.Ic ~ Ns Aq Va expr , 53050586Scael.Ic \&! Ns Aq Va expr , 53150586Scael.Ic \&$ Ns Aq Va expr , 53250586Scael.Ic \&$? Ns Aq Va expr 53350586Scael.Xc 53418595SedwardThe first three are unary minus, bitwise complement and logical complement 53543085Scaelon numbers only. The operator, ``$'', takes 53650586Scael.Aq Va expr 53743085Scaeland returns 53843085Scaelthe value of the variable of that name. If 53950586Scael.Aq Va expr 54043085Scaelis numeric 54143085Scaelwith value 54243085Scael.Ar n 54343085Scaeland it appears within an alias macro (see below), 54418595Sedwardthen it refers to the nth argument of the alias invocation. ``$?'' 54543085Scaeltests for the existence of the variable 54650586Scael.Aq Va expr , 54743085Scaeland returns 1 54818595Sedwardif it exists or 0 otherwise. 54950586Scael.It Xo 55050586Scael.Ao Va expr Ac Ns Pq Aq Ar arglist 55150586Scael.Xc 55243085ScaelFunction call. 55350586Scael.Aq Va Expr 55443085Scaelmust be a string that is the unique 55543085Scaelprefix of the name of a builtin 55643085Scael.Nm window 55743085Scaelfunction 55818595Sedwardor the full name of a user defined alias macro. In the case of a builtin 55943085Scaelfunction, 56050586Scael.Aq Ar arglist 56143085Scaelcan be in one of two forms: 56250586Scael.Bd -literal -offset indent 56350586Scael<expr1>, <expr2>, ... 56450586Scaelargname1 = <expr1>, argname2 = <expr2>, ... 56550586Scael.Ed 56650586Scael.Pp 56718595SedwardThe two forms can in fact be intermixed, but the result is 56818595Sedwardunpredictable. Most arguments can be omitted; default values will 56943085Scaelbe supplied for them. The 57043085Scael.Ar argnames 57143085Scaelcan be unique prefixes 572*65227Smckusickof the argument names. The commas separating 57318595Sedwardarguments are used only to disambiguate, and can usually be omitted. 57443085Scael.Pp 57518595SedwardOnly the first argument form is valid for user defined aliases. Aliases 57643085Scaelare defined using the 57743085Scael.Ic alias 57843085Scaelbuiltin function (see below). Arguments 57918595Sedwardare accessed via a variant of the variable mechanism (see ``$'' operator 58018595Sedwardabove). 58143085Scael.Pp 58218595SedwardMost functions return value, but some are used for side effect 58318595Sedwardonly and so must be used as statements. When a function or an alias is used 584*65227Smckusickas a statement, the parentheses surrounding 58518595Sedwardthe argument list may be omitted. Aliases return no value. 58650586Scael.El 58743085Scael.Ss Builtin Functions 58818595SedwardThe arguments are listed by name in their natural 58943085Scaelorder. Optional arguments are in square brackets 59043085Scael.Sq Op . 59143085ScaelArguments 59243085Scaelthat have no names are in angle brackets 59343085Scael.Sq <> . 59443085ScaelAn argument meant to be a boolean flag (often named 59543085Scael.Ar flag ) 59643085Scaelcan be one of 59743085Scael.Ar on , 59843085Scael.Ar off , 59943085Scael.Ar yes , 60043085Scael.Ar no , 60143085Scael.Ar true , 60243085Scaelor 60343085Scael.Ar false , 60443085Scaelwith 60543085Scaelobvious meanings, or it can be a numeric expression, 60639861Sedwardin which case a non-zero value is true. 60750586Scael.Bl -tag -width Fl 60850586Scael.It Xo 60950586Scael.Ic alias Ns Po Bq Aq Ar string , 61050586Scael.Bq Aq Ar string\-list Pc 61150586Scael.Xc 61218595SedwardIf no argument is given, all currently defined alias macros are 61343085Scaellisted. Otherwise, 61450586Scael.Aq Ar string 61543085Scaelis defined as an alias, 61643085Scaelwith expansion 61750586Scael.Aq Ar string\-list > . 61843085ScaelThe previous definition of 61950586Scael.Aq Ar string , 62043085Scaelif any, is returned. Default for 62150586Scael.Aq Ar string\-list 62218595Sedwardis no change. 62350586Scael.It Ic close Ns Pq Aq Ar window\-list 62443085ScaelClose the windows specified in 62550586Scael.Aq Ar window\-list . 62643085ScaelIf 62750586Scael.Aq Ar window\-list 62843085Scaelis the word 62943085Scael.Ar all , 63043085Scaelthan all windows are closed. No value is returned. 63150586Scael.It Ic cursormodes Ns Pq Bq Ar modes 63243085ScaelSet the window cursor to 63343085Scael.Ar modes . 63443085Scael.Ar Modes 63543085Scaelis the bitwise 63643085Scaelor of the mode bits defined as the variables 63743085Scael.Ar m_ul 63843085Scael(underline), 63943085Scael.Ar m_rev 64043085Scael(reverse video), 64143085Scael.Ar m_blk 64243085Scael(blinking), 64343085Scaeland 64443085Scael.Ar m_grp 64543085Scael(graphics, terminal dependent). Return 64618595Sedwardvalue is the previous modes. Default is no change. 64743085ScaelFor example, 64843085Scael.Li cursor($m_rev$m_blk) 64943085Scaelsets the window cursors to blinking 65018595Sedwardreverse video. 65150586Scael.It Ic default_nline Ns Pq Bq Ar nline 65243085ScaelSet the default buffer size to 65343085Scael.Ar nline . 65443085ScaelInitially, it is 65539861Sedward48 lines. Returns the old default buffer size. Default is 65639861Sedwardno change. Using a very large buffer can slow the program down 65739861Sedwardconsiderably. 65850586Scael.It Ic default_shell Ns Pq Bq Aq Ar string\-list 65943085ScaelSet the default window shell program to 66050586Scael.Aq Ar string\-list . 66143085ScaelReturns 66239861Sedwardthe first string in the old shell setting. Default is no change. Initially, 66343085Scaelthe default shell is taken from the environment variable 66443085Scael.Ev SHELL . 66550586Scael.It Ic default_smooth Ns Pq Bq Ar flag 66643085ScaelSet the default value of the 66743085Scael.Ar smooth 66843085Scaelargument 66943085Scaelto the command 67043085Scael.Nm window 67143085Scael(see below). The argument 67243085Scaelis a boolean flag (one of 67343085Scael.Ar on , 67443085Scael.Ar off , 67543085Scael.Ar yes , 67643085Scael.Ar no , 67743085Scael.Ar true , 67843085Scael.Ar false , 67943085Scaelor a number, 68039861Sedwardas described above). Default is no change. 68139861SedwardThe old value (as a number) is returned. 68239861SedwardThe initial value is 1 (true). 68350586Scael.It Xo 68450586Scael.Ic echo Ns ( Op Ar window , 68550586Scael.Bq Aq Ar string\-list ) 68650586Scael.Xc 68743085ScaelWrite the list of strings, 68850586Scael.Aq Ar string-list , 68943085Scaelto 69043085Scael.Nm window , 69143085Scaelseparated 69218595Sedwardby spaces and terminated with a new line. The strings are only 69327996Sannedisplayed in the window, the processes in the window are not 69443085Scaelinvolved (see 69543085Scael.Ic write 69643085Scaelbelow). No value is returned. Default 69718595Sedwardis the current window. 69850586Scael.It Ic escape Ns Pq Bq Ar escapec 69943085ScaelSet the escape character to 70043085Scael.Ar escape-char . 70143085ScaelReturns the old 70236088Sedwardescape character as a one-character string. Default is no 70343085Scaelchange. 70443085Scael.Ar Escapec 70543085Scaelcan be a string of a single character, or 70643085Scaelin the form 70743085Scael.Fl ^X , 70843085Scaelmeaning 70950586Scael.No control\- Ns Ar X . 71050586Scael.It Xo 71150586Scael.Ic foreground Ns ( Bq Ar window , 71250586Scael.Bq Ar flag ) 71350586Scael.Xc 71443085ScaelMove 71543085Scael.Nm window 71643085Scaelin or out of foreground. 71743085Scael.Ar Flag 71839861Sedwardis a boolean value. The old foreground flag 71943085Scaelis returned. Default for 72043085Scael.Nm window 72143085Scaelis the current window, 72243085Scaeldefault for 72343085Scael.Ar flag 72443085Scaelis no change. 72550586Scael.It Xo 72650586Scael.Ic label Ns ( Bq Ar window , 72750586Scael.Bq Ar label ) 72850586Scael.Xc 72943085ScaelSet the label of 73043085Scael.Nm window 73143085Scaelto 73243085Scael.Ar label . 73343085ScaelReturns the old 73443085Scaellabel as a string. Default for 73543085Scael.Nm window 73643085Scaelis the current 73743085Scaelwindow, default for 73843085Scael.Ar label 73943085Scaelis no change. To turn 74018595Sedwardoff a label, set it to an empty string (""). 74150586Scael.It Ic list Ns Pq 74218595SedwardNo arguments. List the identifiers and labels of all windows. No 74318595Sedwardvalue is returned. 74450586Scael.It Ic select Ns Pq Bq Ar window 74543085ScaelMake 74643085Scael.Nm window 74743085Scaelthe current window. The previous current window 74818595Sedwardis returned. Default is no change. 74950586Scael.It Ic source Ns Pq Ar filename 75043085ScaelRead and execute the long commands in 75143085Scael.Ar filename . 75250586ScaelReturns \-1 if the file cannot be read, 0 otherwise. 75350586Scael.It Ic terse Ns Pq Bq flag 75443085ScaelSet terse mode to 75543085Scael.Ar flag . 75643085ScaelIn terse mode, the command window 75718595Sedwardstays hidden even in command mode, and errors are reported by 75843085Scaelsounding the terminal's bell. 75943085Scael.Ar Flag 76043085Scaelcan take on the same 76143085Scaelvalues as in 76243085Scael.Ar foreground 76343085Scaelabove. Returns the old terse flag. 76418595SedwardDefault is no change. 76550586Scael.It Ic unalias Ns Pq Ar alias 76643085ScaelUndefine 76743085Scael.Ar alias . 76843085ScaelReturns -1 if 76943085Scael.Ar alias 77043085Scaeldoes not exist, 77118595Sedward0 otherwise. 77250586Scael.It Ic unset Ns Pq Ar variable 77343085ScaelUndefine 77443085Scael.Ar variable . 77543085ScaelReturns -1 if 77643085Scael.Ar variable 77743085Scaeldoes not exist, 77818595Sedward0 otherwise. 77950586Scael.It Ic variables Ns Pq 78018595SedwardNo arguments. List all variables. No value is returned. 78150586Scael.It Xo 78250586Scael.Ic window Ns ( Bq Ar row , 78350586Scael.Bq Ar column , 78450586Scael.Bq Ar nrow , 78550586Scael.Bq Ar ncol , 78650586Scael.Bq Ar nline , 78750586Scael.Bq Ar label , 78850586Scael.Bq Ar pty , 78950586Scael.Bq Ar frame , 79050586Scael.Bq Ar mapnl , 79150586Scael.Bq Ar keepopen , 79250586Scael.Bq Ar smooth , 79350586Scael.Bq Ar shell ) . 79450586Scael.Xc 79543085ScaelOpen a window with upper left corner at 79643085Scael.Ar row , 79743085Scael.Ar column 79843085Scaeland size 79943085Scael.Ar nrow , 80043085Scael.Ar ncol . 80143085ScaelIf 80243085Scael.Ar nline 80343085Scaelis specified, 80418595Sedwardthen that many lines are allocated for the text buffer. Otherwise, 80518595Sedwardthe default buffer size is used. Default values for 80643085Scael.Ar row , 80743085Scael.Ar column , 80843085Scael.Ar nrow , 80943085Scaeland 81043085Scael.Ar ncol 81143085Scaelare, respectively, 81218595Sedwardthe upper, left-most, lower, or right-most extremes of the 81343085Scaelscreen. 81443085Scael.Ar Label 81543085Scaelis the label string. 81643085Scael.Ar Frame , 81743085Scael.Ar pty , 81843085Scaeland 81943085Scael.Ar mapnl 82043085Scaelare flag values 82143085Scaelinterpreted in the same way as the argument to 82243085Scael.Ar foreground 82343085Scael(see above); 82418595Sedwardthey mean, respectively, put a frame around this window (default true), 82518595Sedwardallocate pseudo-terminal for this window rather than socketpair (default 82618595Sedwardtrue), and map new line characters in this window to carriage return 82718595Sedwardand line feed (default true if socketpair is used, false otherwise). 82839861SedwardNormally, a window is automatically closed when its process 82943085Scaelexits. Setting 83043085Scael.Ar keepopen 83143085Scaelto true (default false) prevents this 83243085Scaelaction. When 83343085Scael.Ar smooth 83443085Scaelis true, the screen is updated more frequently 83539861Sedward(for this window) to produce a more terminal-like behavior. 83643085ScaelThe default value of 83743085Scael.Ar smooth 83843085Scaelis set by the 83943085Scael.Ar default_smooth 84039861Sedwardcommand (see above). 84143085Scael.Ar Shell 84243085Scaelis a list of strings that will be used as the shell 84318595Sedwardprogram to place in the window (default is the program specified 84443085Scaelby 84543085Scael.Ar default_shell , 84643085Scaelsee above). The created window's identifier 84718595Sedwardis returned as a number. 84850586Scael.It Xo 84950586Scael.Ic write Ns ( Bq Ar window , 85050586Scael.Bq Aq Ar string\-list ) 85150586Scael.Xc 85243085ScaelSend the list of strings, 85350586Scael.Aq Ar string-list , 85443085Scaelto 85543085Scael.Nm window , 85643085Scaelseparated 85718595Sedwardby spaces but not terminated with a new line. The strings are actually 85818595Sedwardgiven to the window as input. No value is returned. Default 85918595Sedwardis the current window. 86050586Scael.El 86143085Scael.Ss Predefined Variables 86218595SedwardThese variables are for information only. Redefining them does 86343085Scaelnot affect the internal operation of 86443085Scael.Nm window . 86550586Scael.Bl -tag -width modes 86650586Scael.It Ar baud 86718595SedwardThe baud rate as a number between 50 and 38400. 86850586Scael.It Ar modes 86918595SedwardThe display modes (reverse video, underline, blinking, graphics) 87043085Scaelsupported by the physical terminal. The value of 87143085Scael.Ar modes 87243085Scaelis the bitwise or of some of the one bit values, 87343085Scael.Ar m_blk , 87443085Scael.Ar m_grp , 87543085Scael.Ar m_rev , 87643085Scaeland 87743085Scael.Ar m_ul 87843085Scael(see below). 87943085ScaelThese values are useful 88043085Scaelin setting the window cursors' modes (see 88143085Scael.Ar cursormodes 88243085Scaelabove). 88350586Scael.It Ar m_blk 88418595SedwardThe blinking mode bit. 88550586Scael.It Ar m_grp 88618595SedwardThe graphics mode bit (not very useful). 88750586Scael.It Ar m_rev 88818595SedwardThe reverse video mode bit. 88950586Scael.It Ar m_ul 89018595SedwardThe underline mode bit. 89150586Scael.It Ar ncol 89218595SedwardThe number of columns on the physical screen. 89350586Scael.It Ar nrow 89418595SedwardThe number of rows on the physical screen. 89550586Scael.It Ar term 89618595SedwardThe terminal type. The standard name, found in the second name 89743085Scaelfield of the terminal's 89843085Scael.Ev TERMCAP 89943085Scaelentry, is used. 90043085Scael.Sh ENVIRONMENT 90143085Scael.Nm Window 90243085Scaelutilizes these environment variables: 90343085Scael.Ev HOME , 90443085Scael.Ev SHELL , 90543085Scael.Ev TERM , 90643085Scael.Ev TERMCAP , 90743085Scael.Ev WINDOW_ID . 90843085Scael.Sh FILES 90950586Scael.Bl -tag -width /dev/[pt]ty[pq]? -compact 91050586Scael.It Pa ~/.windowrc 91143085Scaelstartup command file. 91250586Scael.It Pa /dev/[pt]ty[pq]? 91343085Scaelpseudo-terminal devices. 91450586Scael.El 91543085Scael.Sh HISTORY 91650586ScaelThe 91743085Scael.Nm window 91850586Scaelcommand appeared in 91950586Scael.Bx 4.3 . 92043085Scael.Sh DIAGNOSTICS 92114187SedwardShould be self explanatory. 922