Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pg(1) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

crypt(1)

ed(1)

grep(1)

more(1)

terminfo(4)




pg(1) pg(1)
NAME pg - shows the contents of a file in display-size chunks SYNOPSIS pg [-number] [+linenumber] [+/pattern] [-c] [-e] [-f] [-n] [-p string] [-s] [file]... ARGUMENTS -number Specifies an integer the size (in lines) of the window that pg is to use instead of the default. On a terminal containing 24 lines, the default window size is 23. +linenumber Starts examining the file at linenumber. +/pattern Starts examining the file at the first line containing the regular expression pattern. The terminal / may be omitted from this command. -c Homes the cursor and clears the screen before displaying each page. This option is ignored if clear_screen is not defined for this terminal type in the terminfo data base. -e Causes pg not to pause at the end of each file. -f Inhibits pg from splitting lines. Normally, pg splits lines longer than the screen width, but some sequences of characters in the text being displayed (e.g., escape sequences for underlining) generate undesirable results. file The filename - or null arguments indicate that pg should read from the standard input. -n Causes an automatic end of command as soon as a command letter is entered. Normally, commands must be terminated by a newline. -p string Causes pg to use string as the prompt. If the prompt string contains a %d, the first occurrence of %d in the prompt will be replaced by the current page number when the prompt is issued. The default prompt string is :. -s Causes pg to print all messages and prompts in standout mode (usually inverse video). January 1992 1



pg(1) pg(1)
DESCRIPTION pg is a filter that examines files, one screenful at a time, on a soft-copy terminal. Each screenful is followed by a prompt. If the user types a carriage return, another page is displayed; other possibilities are enumerated later in this manual page. This command is different from previous paginators in that it allows you to back up and review something that has already passed. The method for doing this is explained later in this manual page. In order to determine terminal attributes, pg scans the terminfo database for the terminal type specified by the environment variable TERM. If TERM is not defined, the terminal type dumb is assumed. The responses that may be typed when pg pauses can be divided into three categories: those causing further perusal, those that search, and those that modify the perusal environment. Commands which cause further perusal normally take a preceding address, an optionally signed number indicating the point from which further text should be displayed. This address is interpreted in either pages or lines depending on the command. A signed address specifies a point relative to the current page or line, and an unsigned address specifies an address relative to the beginning of the file. Each command has a default address that is used if none is provided. The perusal commands and their defaults are as follows: +1 newline (or blank) Causes one page to be displayed. The address is specified in pages. +1 l Causes pg to simulate scrolling the screen forward or backward, the number of lines specified, with a relative address. With an absolute address this command prints a screenful beginning at the specified line. +1 d or CONTROL-d Simulates scrolling half a screen forward or backward. The following perusal commands take no address: . or CONTROL-l Causes the current page of text to be redisplayed by typing a single period or CONTROL-l. 2 January 1992



pg(1) pg(1)
$ Displays the last windowful in the file. Use with caution when the input is a pipe. The following commands are available for searching for text patterns in the text. The regular expressions described in ed(1) are available. They must always be terminated by a newline, even if the -n option is specified: i/pattern/ Searches forward for the ith (default i=1) occurrence of pattern. Searching begins immediately after the current page and continues to the end of the current file, without wrap-around. The final / may be omitted unless m, b, or t modifiers are appended. i^pattern^ i?pattern? Searches backward for the ith (default i=1) occurrence of pattern. Begins searching immediately before the current page and continues to the beginning of the current file, without wrap-around. The final ^ and ? may be omitted from these commands unless the m, b, or t modifiers are appended. The ^ notation is useful for Adds 100 terminals that will not properly handle the ?. After searching, pg will normally display the line found at the top of the screen. This can be modified by appending m or b to the search command to leave the line found in the middle or at the bottom of the window from now on. The suffix t can be used to restore the original situation. The user of pg can modify the environment of perusal with the following commands: if Skips i screenfuls and prints a screenful of lines in. Begins perusing the ith next file in the command line. The i is an unsigned number, default value is 1. ip Begins perusing the ith previous file in the command line. i is an unsigned number, default is 1. iw Displays another window of text. If i is present, set the window size to i. iz Specifies i as the new window size, if present. Otherwise, this option has the same effect as typing a space. s filename Saves the input in the named file. Only the current file being perused is saved. The white space between January 1992 3



pg(1) pg(1)
the s and filename is optional. This command must always be terminated by a newline, even if the -n option is specified. h Helps by displaying an abbreviated summary of available commands. q Q Quits the pg program. !command Passes command to the shell, whose name is taken from the SHELL environment variable. If this is not available, the default shell is used. This command must always be terminated by a newline, even if the -n option is specified. At any time when output is being sent to the terminal, the user can press the quit key (normally CONTROL-\) or the interrupt key. This causes pg to stop sending output, and display the prompt. The user may then enter one of the above commands in the normal manner. Unfortunately, some output is lost when this is done, due to the fact that any characters waiting in the terminal's output queue are flushed when the quit signal occurs. If the standard output is not a terminal, then pg acts just like cat(1), except that a header is printed before each file (if there is more than one). EXAMPLES A sample usage of pg in reading system news is: news | pg -p "(Page %d):" LIMITATIONS If terminal tabs are not set every eight positions, undesirable results may occur. When using pg as a filter with another command that changes the terminal I/O options (e.g., crypt(1)), terminal settings may not be restored correctly. NOTES While waiting for terminal input, pg responds to the interrupt character (CONTROL-C by default) by terminating execution. Between prompts, however, the interrupt signal interrupts pg's current task and place the user in prompt mode. These should be used with caution when input is being read from a pipe, since an interrupt is likely to terminate the other commands in the pipeline. 4 January 1992



pg(1) pg(1)
FILES /usr/bin/pg Executable file /usr/lib/terminfo/* Terminal information files /tmp/pg* Temporary file SEE ALSO crypt(1), ed(1), grep(1), more(1) terminfo(4) in A/UX Programmer's Reference January 1992 5

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026