CMDTOOL(1) — USER COMMANDS
NAME
cmdtool − Run a shell (or other program) from the SunView text facility
SYNOPSIS
cmdtool [ −C ] [ −P n ] [ program [ args ] ]
DESCRIPTION
cmdtool is a standard tool provided with the SunView environment.
When invoked, cmdtool runs a program (usually a shell) in a text-based command subwindow. Typed characters are inserted at the caret. If this program is a shell, it accepts commands and runs programs in the usual way. (See BUGS below).
Text can be edited anywhere on the command line the same way as in any other text subwindow. Commands and their output are kept in a log which can be scrolled using the scrollbar. The log file can also be edited, or even saved using the Save command in the text facility’s pop-up menu. The Split command, also in the pop-up menu, can be used to create two or more independently scrolling views of the log.
DEFAULTS OPTIONS
/Tty/Append_only_log
TRUE is the standard default; it means that only the command line may be editted. FALSE permits editting of the entire log. See the descripton of Enable Edit below.
/Tty/Insert_makes_caret_visible
This entry describes how hard the command subwindow should try to keep the caret visible.
Same_as_for_textIs the standard default; it means that the setting for Insert_makes_caret_visible will be taken from the Text category instead of Tty when a command subwindow is created.
If_auto_scrollIf the caret is showing, and an inserted newline would position it below the bottom of the screen as determined by /Text/Lower_context, the text is scrolled to keep it showing. The amount scrolled is controlled by /Text/Auto_scroll_by. See textedit (1) for more information.
AlwaysUpon any input action, if the caret is positioned off the screen, it is scrolled back into view.
/Tty/Checkpoint_frequency
0 is the standard default; it means that no checkpointing will take place. For a value n greater than zero, checkpointing will take place after every nth edit. Each character typed, each Get, and each Delete counts as an edit. If the transcript file is named /tmp/tty.txt.000xxx, at each checkpoint, an updated copy of the transcript will be saved in /tmp/tty.txt.000xxx%%.
/Text/Edit_back_char
Set the character for deleting the character preceding the caret. Note: Stty erase has no effect; text based tools only refer to the defaults database. The standard default is the DEL key.
/Text/Edit_back_word
Set the character for deleting the word preceding the caret. Note: Stty werase has no effect; text based tools only refer to the defaults database. The standard default is CTRL-W.
/Text/Edit_back_line
Set the character for deleting from the newline preceding the caret to the caret. Note: Stty kill has no effect; text based tools only refer to the defaults database. The standard default is CTRL-U.
COMMANDLINE OPTIONS
−C Redirect system console output to this instance of the cmdtool. This will prevent system error messages from being printed in unexpected places on the screen. Moreover, since a cmdtool window is scrollable, messages that go off the top of the window can be scrolled back for re-examination.
−P nSet the checkPoint frequency to n.
cmdtool also takes generic tool arguments; see suntools (1) for a list of these arguments.
program [ args ]
If a program argument is present, cmdtool executes it. Subsequent arguments will be assumed to be arguments of the program argument, and will be passed to it for execution. If there are no arguments, cmdtool runs the program corresponding to the SHELL environment variable. If this environment variable is not available, then cmdtool runs /bin/sh.
THE COMMAND SUBWINDOW
The subwindow of cmdtool is a command subwindow, which is also found in dbxtool and potentially in other tools as well. The command subwindow is based on the text facility. For more information about the text facility, see Windows and Window-Based Tools: Beginner’s Guide. The pop-up menu associated with command subwindow is the same as that for the text facility (see textedit (1)), with two additional items, Enable Edit and Disable Scrolling. The generic text menu items will not be described here except for Put, then Get, as it approximates the functionality of Stuff in shelltool (1), and is also implemented for shelltool.
Command subwindow now supports cursor motion. In order to do so, a new termcap type has been invented, sun-cmd. Command subwindow automatically sets the TERM environment variable to sun-cmd when it starts up. This means that if you rlogin to a machine that does not have sun-cmd defined in its termcap file, it will complain "Type sun-cmd unknown". To rectify this, just "set TERM=sun". This also means that any program written using the curses package will automatically work in command subwindow, but a program written specifically for termcap type "sun" will not work. When doing cursor motion, the command subwindow automatically takes on the appearance and characteristics of a tty subwindow (as in shelltool), with a wide margin where the scrollbar used to be. When the program doing cursor motion ends or goes to sleep, it automatically returns to its text subwindow appearance and behavior.
Also supported now, are programs that use CBREAK or RAW mode, or NO ECHO. Usually this support is invisible. However, rlogin and script have the unexpected characteristic of turning off the ability to edit the commandline with the mouse, although old-fashioned backspace, word and line kill still operate. This is because they go into RAW mode, demanding that cmdtool ship every character as it is typed, rather than echo locally.
Put, then Get
When there is a selection, this item reads Put, then Get. It causes the selection to be copied both to the shelf and to the caret.
Put, then Get
When there is no selection but there is text on the shelf, Put, then is grayed out, though Get remains active. Selecting this item causes the contents of the shelf to be copied to the caret. When there is no selection and nothing is on the shelf, this item is inactive.
Enable Edit
If the defaults entry Append_only_log is set to TRUE, but at some point you want to edit the log, selecting this menu item makes editting the log possible. When the log is editable, this item reads Disable Edit, and selecting it makes the log read-only before the start of the command line.
Disable Scrolling
Normally, command subwindow enters tty subwindow mode automatically when you start up a program that does cursor motion. If it fails to do so, perhaps because the program does not use curses and does not interpret termcap correctly, or if you want tty subwindow mode because it supports something that command subwindow doesn’t (see BUGS below), this menu item lets you enter tty subwindow mode manually. The tty subwindow that comes up has Enable Scrolling added to its menu to allow manual return to text subwindow mode. Disable and Enable Scrolling correspond to the termcap "ti" and "te" escape sequences for the "sun-cmd" termcap entry, respectively. If you manually disable and enable scrolling often, you may find it useful to assign these sequences to function keys in your .ttyswrc file. Refer to /etc/termcap for the escape sequences and refer to shelltool (1) for a description of .ttyswrc.
Certain text facility accelerators that are especially useful in command subwindows are described here. See textedit (1) for more information.
CTRL-RETURN
Holding down the control key while typing newline (carriage return) positions the caret at the bottom and scrolls it into view, as determined by the defaults option /Text/Lower_context.
CTRL-P
is an accelerator for the Put, then Get menu item described above.
CAPS-lock
Bound to F1, it causes subsequent keyboard input to be uppercase. This key is a toggle; striking it a second time undoes the effect of the first strike.
FILES
/tmp/tty.txt.nnnnnn
~/.textswrc
SEE ALSO
shelltool(1), suntools(1), textedit(1), defaultsedit(1),
Windows and Window-Based Tools: Beginner’s Guide
BUGS
Full terminal emulation is not complete. Some examples of manifestations of this deficiency include:
•File completion in the csh does not work.
•Emphasized text (eg. in man pages) does not show up as emphasized.
Occasionally csh exits due to a hangup signal after the first command. This causes cmdtool to exit as well, and print a message to either the console or the window it was started from. The message reads:
A command window has exited because its child exited.
Its child’s process id was 1603 and it died due to signal 1.
Sun Release 3.2 — Last change: 30 September 1985