home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
msdos
/
sysutl
/
history.arc
/
HISTORY.DOC
< prev
next >
Wrap
Text File
|
1988-03-20
|
10KB
|
231 lines
HISTORY.DOC Version 1.3 30 April 87 Page 1
Copyright 1985-7 Michael M Rubenstein
Portions Copyright 1988, Russell Nelson
This software and the accompanying documentation may be
distributed freely for noncommercial use.
Changes in Version 1.4R
- Cleaned up memory usage. Went from 27K to 7.7K.
Changes in Version 1.3R
- Ported to Turbo C.
- Added filename completion. See the LF command below.
- Split into two files, one for editing and one for
history, to hide the history data structure.
- Fixed some hokiness regarding the second history buffer.
Changes in Version 1.3
- Added second history buffer for use of programs
other than COMMAND.COM.
Changes in Version 1.2
- Corrected handling of long lines when screen
scrolls.
Changes in Version 1.1.
- Function keys 1-5 have been implemented in a
manner much more consistent with the standard
MSDOS function keys.
- If supplied by the calling program, the buffer
line may be used. This allows use of the function
keys in the few programs (such as EDLIN) which are
designed for use of the keys.
Description.
HISTORY is a history processing terminate and stay resident
program. It provides the ability to recall and edit previous
commands and allows much more sophisticated editing than is found
in the normal MSDOS system.
HISTORY includes a search mechanism to handle relatively large
histories.
Requirements.
HISTORY requires about 5500 bytes of memory plus whatever is
required for the history storage.
Running HISTORY.
HISTORY takes two optional argument son the command line -- the
number of bytes (256 - 32767) to use for history storage for
COMMAND.COM and the number of bytes (256 - 32767) to use for
other programs. If only one argument is given, it is taken as
HISTORY.DOC Version 1.3 30 April 87 Page 2
the number of bytes for COMMAND.COM. If an argument is missing,
the minimum, 256, is used. If a number less than 256 is given,
it is silently treated as 256. If a number larger than 32767 is
given, it is silently treated as 32767. The history buffer is
circular; i.e, when space is exhausted the oldest commands are
deleted. The sum of the two arguments should not be greater than
about 55,000 (usually a much smaller sum is appropriate).
A value of 1000-2000 is generally appropriate for the first
argument. A much smaller value is usually adequate for the
second argument; the default of 256 bytes is generally adequate.
Entering commands with HISTORY is similar to doing so in the standard
command processor, but there are numerous additional editing
options.
Left arrow - Back one character.
Right arrow - Forward one character.
Ctrl left arrow - Back one word.
Ctrl right arrow - Forward one word.
Home - Go to start of line.
End - Go to end of line.
Del - Delete current character.
Backspace - Delete previous character.
Line Feed - Complete the filename to the left of the
cursor. If the filename contains wildcards,
copy all the matching filenames in.
Ctrl Q - Remove any special meaning from the
next character. For example, Ctrl Q
Ctrl H inserts a Ctrl H (backspace)
into the line.
Ctrl T - Delete to beginning of next word.
F10
Ctrl W
F9 - Delete back to beginning of word.
Ctrl U - Delete entire line.
Ctrl X
Esc
Ctrl Y - Delete to end of line
F8
Ins - Toggle insert mode.
F1 - If the current line is empty, copy the
template from the buffer. Otherwise
advance one character.
HISTORY.DOC Version 1.3 30 April 87 Page 3
F2 - If the current line is empty, copy the
template from the buffer. In any case,
waits for another character and
advances to the next occurrence of that
character.
F3 - If the current line is empty, copy the
template from the buffer. In any case,
advance to the end of the line.
F4 - If the current line is empty, copy the
template from the buffer. In any case,
waits for another character and deletes
to the next occurrence of that
character.
F5 - Make the current line the template.
The command will be processed when RETURN or ENTER is pressed.
The cursor need not be at the end of the line.
The real power of HISTORY, however, is in the ability to recall
and edit previous command lines. This is controlled by several
additional command keys:
Up arrow - Recall previous command line. Repeated
application gets successively earlier
command lines. If there is no previous
command line (or it has not been kept
in the history), the bell will sound.
The Ctrl U, Ctrl X, and ESC editing
commands reset the internal pointer to
the end so the next up arrow gets the last
command line executed again.
Ctrl L - Searches for a previous command line
F7 which matches the current line to the
left of the cursor. Case is
immaterial. If none is found, the bell
will sound. For example, if the
previous command lines were
dir
ws test.doc
type whatever.c
whatever
ws what.out
dir
then typing
w Ctrl L
would recall the command "ws what.out".
The cursor is left after the "w", so
HISTORY.DOC Version 1.3 30 April 87 Page 4
typing Ctrl L again would recall
"whatever". If ws Ctrl L were typed
initially, the "whatever" command would
be skipped and the two "ws" commands
would be recalled.
Down arrow - Recalls the next command (assuming a
previous command has been recalled with
up arrow and is being edited). If
there is no next command, the bell
sounds.
While the editing commands may seem a bit complex at first, a
little playing at the terminal will make them very natural and
easy to use. The Ctrl L command, in particular, is quite
different from the commands found in most editors. With a very
little practice, command line editing with HISTORY becomes almost
automatic and one soon wonders how one lived without it.
The history commands are available in any program (e.g., DEBUG)
which uses BDOS function 10 for input. Two history buffers are
used -- one for COMMAND.COM and one for all other programs.
For the Hacker.
HISTORY was written in C and compiled with the Aztec C. Source
code is included. A small assembly language interface is used to
make the program memory resident and communicate with the get
console buffer interrupt.
The C code is fairly standard and should be reasonably easy to
convert to other versions. The assembly language interface will
require more work if another C compiler is used.
<End of Document>