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