previous next top contents index framed top this page unframed
The MODULE TVIEW displays the contents of a text file. TVIEW prompts for the name of the file to be examined. Once the input file is successfully opened, the contents of position 0 are automatically displayed and you are prompted for a command. TVIEW displays the current position in the file followed by / followed by 16 characters beginning at the current position. Printing characters are displayed exactly as they appear in the file; character codes delimited by angle brackets are displayed for non-printing characters. For example, a horizontal tab character is displayed as <9> (assuming an ASCII character set). Available commands are displayed when ? is typed in response to the TVIEW command prompt, and are listed in Table 34–1.
| n | Examine position n |
| <eol> | Step forward through file |
| ^ | Step backward through file |
| +n | Position forward n INTEGERs |
| -n | Position backward n INTEGERs |
| C | Show value of charsToExamine |
| C n | Set charsToExamine = n |
| F xxx | Examine file xxx |
| P | Toggle prompt |
| Q | Quit TVIEW |
| S xxx | Search for value xxx |
| W xxx | Write value xxx |
The file being examined is initially opened for input only.
When the
W command is issued,
the file is closed and reopened for input and
output access.
After the value has been written, the file is again
closed and then reopened for input only.
Since TVIEW opens the file for
random access, the file format must be such that random access is
allowed, or the command will fail.
34.1. n, <eol>, ^, +n, and -n
These commands tell TVIEW
what position in the input file to display.
If n is typed,
16 characters beginning at position n are displayed.
Typing <eol> causes TVIEW
to display the contents of the next 16
positions in the file.
For example, if the contents of position 0
have just been displayed and the <eol>
command is issued, TVIEW
displays 16 characters
beginning with position 16. ^ displays the
previous 16 characters, +n
displays the 16 characters beginning with
the nth next position,
and -n displays the 16 characters beginning
with the nth previous position in the file.
34.2. C and C n
If given an integer argument,
the C command displays that many characters at a time;
the default is 16.
With no argument,
C tells how many characters it displays at a time.
34.3. F xxx
The F command changes the input file to xxx.
The new input file
is opened and the first 16 characters of the file are automatically
displayed.
34.4. P
TVIEW's P command toggles prompt mode.
When prompt mode is on, TVIEW prompts with TVIEW>;
when off, it leaves the cursor at the end of the previously displayed
set of characters to save space.
34.5. Q
The Q command exits TVIEW.
34.6. S xxx
The S command searches
forward for the STRING xxx.
The search is case-insensitive.
If the STRING is found, 16
characters are displayed beginning with the beginning of the
search STRING. If the
STRING is not found in the file,
a message is printed and 16 characters
beginning with the current position are redisplayed.
34.7. W xxx
The W command writes the STRING xxx
to the current position of the
input file.
The message Wrote xxx at n
is displayed and the new text
beginning with the current position is redisplayed.
34.8. TVIEW Example
Example 34–2 shows how to use TVIEW to examine a text
file. The file text is opened and the first 16 characters are
automatically displayed. The 16th character is a carriage
return, indicated by <13>.
<eol> displays the next 16 characters
beginning with position 16,
and 100<eol> displays 16 characters
beginning with location 100.
The search command searches forward from
the current position (100) for the
STRING proc and finds it at position 138.
| MAINSAIL (R) Version 16.20.<release> (? for help) Revision: <date> Copyright (c) 1984-1998 by XIDAK, Inc., Point Arena, California, USA. *tview<eol> Text file viewer (? for help) <xxx> represents non-graphic decimal character code xxx File to view: filcch 0/ BEGIN "$filCch"<13> TVIEW><eol> 16/ <10><13><10>MODULE $filCc TVIEW>100<eol> 100/ <9> <9> LONG I TVIEW>s proc<eol> 138/ PROCEDURE $clear TVIEW>q<eol> * |
MAINSAIL Utilities User's Guide, Chapter 34