CMDTOOL(1) General Commands Manual CMDTOOL(1)
cmdtool - run a shell (or program) using the SunView text facility
cmdtool [ -C ] [ -M bytes ] [ -P count ] [ generic-tool-arguments ] [
program [ program-arguments ] ]
This command is available with the SunView User's software installation
option. Refer to for information on how to install optional software.
cmdtool is the standard SunView support facility for shells and other
programs. When invoked, cmdtool runs a program (usually a shell) in a
text-based command subwindow. Characters typed on the keyboard are
inserted at the caret. If the program is a shell, that shell accepts
and runs commands in the usual manner. cmdtool also supports programs
that perform cursor motions directly, such as vi(1).
The text of the current command line can be edited using normal texte-
dit(1) functions. The command subwindow displays a log of the session,
which can be scrolled through using the scrollbar (unless the command
does cursor motion). This log can be edited, and saved by choosing the
`Store as New File' item in the text facility's pop-up menu. The `Split
View' command, also in the pop-up menu, can be used to create two or
more independent views of the log.
-C Console cmdtool. Display console messages in this cmd-
tool, which might otherwise appear in unexpected places
on the workstation screen. Since a cmdtool window can
be scrolled, console error messages can be recorded for
-M bytes Set the log to wrap-around after the indicated number of
-P count Checkpoint the log after every set of count editing
cmdtool accepts the generic tool arguments listed in
program [ program-arguments ]
If a program argument is present, cmdtool runs it and
passes any remaining arguments to that program. If no
program is given, cmdtool runs the program indicated by
the SHELL environment variable, or /usr/bin/sh by
Refer to for details on how to use cmdtool.
The following options can be configured as default settings using
When set to TRUE (the standard default) only command lines can
be edited. FALSE allows the entire log to be edited. (See also
the description of Enable Edit below.)
This entry allows you to specify the method for displaying the
Same_as_for_text Use the setting specified in the defaults for
the Text category (the standard default).
If_auto_scroll If the caret is showing, and an inserted NEW-
LINE would position it below the bottom of the
screen (as determined by /Text/Lower_context),
the text is scrolled to keep the caret show-
ing. The number of lines scrolled is deter-
mined by the /Text/Auto_scroll_by default.
(See textedit(1) for more information.)
Always Scroll the caret back into view whenever input
would position it off the screen.
If set to 0 (the standard default) no checkpointing is done.
For any value greater than zero, a checkpoint is made each time
the indicated number editing operations has been performed since
the last checkpoint. Each character typed, each Paste, and each
Cut counts as an editing operation. At each checkpoint, an
updated copy of the log is saved in a file with a name that is
constructed by appending two percent signs (%%) to the name of
the log file. By default, the log file has a name of the form
/tmp/tty.txt.pid (pid is the process ID number of cmdtool); the
corresponding checkpoint file has a name of the form
If set to 0 (the standard default) no wrap-around takes place;
the log file grows without a specified limit. For values
greater than zero, wrap-around occurs whenever the indicated
number of characters have been written to the log since the last
wrap-around. Characters that are pushed over the top are
replaced by the message:
*** Text is lost because the maximum edit log size has
been exceeded. ***
Set the character for erasing to the left of the caret. Note:
in cmdtool, the `stty erase' command has no effect. Text-based
tools refer only to the defaults database key settings. The
default is DELETE.
Set the character for erasing the word to the left of the caret.
The standard default is CTRL-W.
Set the character for erasing all characters to the left of the
caret. Note: `stty kill' has no effect in cmdtool. The stan-
dard default is CTRL-U.
The Command Subwindow
The command subwindow is based on the text facility, which is described
in It uses the same pop-up menu as the text facility, but with an addi-
tional pull-right `Cmd Modes' menu, which contains the `Enable Editing'
and `Disable Scrolling' items.
Command subwindows support cursor motions, using a new /etc/termcap
entry called sun-cmd. Command subwindows automatically set the TERM
environment variable to sun-cmd. So, if you rlogin(1C) to a machine
that does not have an entry for sun-cmd in its /etc/termcap file, the
error message `Type sun-cmd unknown' results. To rectify this, type
the command `set TERM=sun'. Programs written using the curses(3V)
library package will work in a command subwindow, but programs hard-
coded for sun-type terminals may not. When supporting a program that
performs cursor motions, the command subwindow automatically takes on
the characteristics of a tty subwindow (as with shelltool(1)). When
that program terminates or sleeps, the full command subwindow function-
ality is restored.
cmdtool supports programs that use CBREAK and NO ECHO terminal modes.
This support is normally invisible to the user. However, programs that
use RAW mode, such as rlogin(1C) and script(1), inhibit command-line
editing with the mouse. In this case, however, tty-style ERASE, word-
kill and line-kill characters can still be used to edit the current
The Command Subwindow Menu
Copy, then Paste When there is a current selection, the entire menu
item is active. The selection is copied both to the
clipboard and to the location pointed to by the
caret. When there is no selection, but there is text
on the clipboard, only Paste is active. In this
case, the contents of the clipboard are copied to the
caret. When there is no selection and the clipboard
is empty, this item is inactive. `Copy then Paste'
is a generic text menu item. Refer to textedit(1)
for information about other generic text menu items.
Disable Edit Toggle to allow or disallow editing on the log.
Enable Scrolling Toggle between a scrollable, editable window, or a
display that supports cursor motions. Note: for
well-behaved programs (such as vi(1)) this switching
is performed automatically (so this menu item is sel-
Text facility accelerators that are especially useful in command sub-
windows are described here. See
textedit(1) for more information.
CTRL-RETURN Position the caret at the bottom, and scroll it into
view as determined by /Text/Lower_context.
META-P Choose the `Copy, then Paste' menu item.
F1 Toggle between all-upper-case keyboard input, and
The environment variables LC_CTYPE, LANG, and LC_default control the
character classification throughout cmdtool. On entry to cmdtool,
these environment variables are checked in the following order:
LC_CTYPE, LANG, and LC_default. When a valid value is found, remaining
environment variables for character classification are ignored. For
example, a new setting for LANG does not override the current valid
character classification rules of LC_CTYPE. When none of the values is
valid, the shell character classification defaults to the POSIX.1 "C"
/tmp/tty.txt.pid log file
defaultsedit(1), rlogin(1C), script(1), sh(1), shelltool(1), sun-
view(1), textedit(1), vi(1), curses(3V)
Typing ahead while cmdtool changes between its scrollable and cursor
motion modes will sometimes freeze cmdtool .
Full terminal emulation is not complete. Some manifestations of this
o File completion in the C shell does not work.
o Enhanced display of text is not supported.
19 July 1989 CMDTOOL(1)