.\" -*- cwish -*-
.TH CWISH 1 "25 July 1995" "Cwish Version 4.0"
cwish \- curses windowing shell
.IR arg \|.\|.\|.\|
\fBCwish\fR is a Tcl shell with the CTk toolkit extension added.
The CTk toolkit is a port of the X11 Tk toolkit to curses.
\fBCwish\fR creates a main window and then processes Tcl commands
from a file, standard input or a dialog window.
If \fBcwish\fR is invoked with an initial \fIfileName\fR argument
(cannot begin with ``\-''),
then \fIfileName\fR is treated as the name of a script file.
\fBCwish\fR will evaluate the script in \fIfileName\fR (which
presumably creates a user interface), then it will respond to events
until all windows have been deleted.
Commands will not be read from standard input.
If \fIfileName\fR is not specified then \fBcwish\fR runs interactively.
First, if there exists a file \fB.wishrc\fR in the home directory of
the user, \fBcwish\fR evaluates the file as a Tcl script.
If the display has not been redirected
(via the \fB-display\fR option or \fBCTK_DISPLAY\fR environment variable),
then a command dialog is displayed and \fBcwish\fR processes events
until all windows have been deleted.
Otherwise, \fBcwish\fR reads Tcl commands interactively from standard input.
It will continue processing commands until all windows have been
deleted or until end-of-file is reached on standard input.
\fBCwish\fR automatically processes the following command-line options:
.IP "\fB\-display \fIdevice\fR[:\fItype\fR]" 20
Display device (and terminal type) on which to display window.
If type is not specified then terminal type is defined by the
\fBTERM\fR enviroment variable.
.IP "\fB\-geometry \fIgeometry\fR" 20
Initial geometry to use for window. If this option is specified, its
value is stored in the \fBgeometry\fR global variable of the application's
.IP "\fB\-name \fIname\fR" 20
Use \fIname\fR as the title to be displayed in the window, and
as the name of the application for processing options
in the .ctkdefaults file.
.IP "\fB\-\|\-\fR" 20
Pass all remaining arguments through to the script's \fBargv\fR
variable without interpreting them.
This provides a mechanism for passing arguments such as \fB\-name\fR
to a script instead of having \fBcwish\fR interpret them.
Any other command-line arguments besides these are passed through
to the application using the \fBargc\fR and \fBargv\fR variables
.SH "APPLICATION NAME AND CLASS"
The name and class for an application are used for specifying options
with a .ctkdefaults file
(analogous to a .Xdefaults file).
The application name is taken from the \fB\-name\fR option,
if it is specified;
otherwise it is taken from \fIfileName\fR, if it is specified,
or from the command name by which \fBcwish\fR was invoked.
In the last two cases, if the name contains a ``/''
character, then only the characters after the last slash are used
as the application name.
The class of the application is the same as its name
except that the first letter is capitalized.
\fBCwish\fR sets the following Tcl variables:
Contains a count of the number of \fIarg\fR arguments (0 if none),
not including the options described above.
Contains a Tcl list whose elements are the \fIarg\fR arguments
that follow a \fB\-\|\-\fR option or don't match any of the
options described in OPTIONS above, in order, or an empty string
if there are no such arguments.
Contains \fIfileName\fR if it was specified.
Otherwise, contains the name by which \fBcwish\fR was invoked.
If the \fB\-geometry\fR option is specified, \fBcwish\fR copies its
value into this variable. If the variable still exists after
\fIfileName\fR has been evaluated, \fBcwish\fR uses the value of
the variable in a \fBwm geometry\fR command to set the main
Contains 1 if \fBcwish\fR is reading commands interactively (\fIfileName\fR
was not specified and standard input is a terminal-like
device), 0 otherwise.
.SH "SCRIPT FILES"
If you create a Tcl script in a file whose first line is
then you can invoke the script file directly from your shell if
you mark it as executable.
This assumes that \fBcwish\fR has been installed in the default
location in /usr/local/bin; if it's installed somewhere else
then you'll have to modify the above line to match.
Many UNIX systems do not allow the \fB#!\fR line to exceed about
30 characters in length, so be sure that the \fBcwish\fR executable
can be accessed with a short file name.
An even better approach is to start your script files with the
following three lines:
# the next line restarts using cwish \e
exec cwish "$0" "$@"\fR
This approach has three advantages over the approach in the previous
paragraph. First, the location of the \fBcwish\fR binary doesn't have
to be hard-wired into the script: it can be anywhere in your shell
search path. Second, it gets around the 30-character file name limit
in the previous approach.
Third, this approach will work even if \fBcwish\fR is
itself a shell script (this is done on some systems in order to
handle multiple architectures or operating systems: the \fBcwish\fR
script selects one of several binaries to run). The three lines
cause both \fBsh\fR and \fBcwish\fR to process the script, but the
\fBexec\fR is only executed by \fBsh\fR.
\fBsh\fR processes the script first; it treats the second
line as a comment and executes the third line.
The \fBexec\fR statement cause the shell to stop processing and
instead to start up \fBcwish\fR to reprocess the entire script.
When \fBcwish\fR starts up, it treats all three lines as comments,
since the backslash at the end of the second line causes the third
line to be treated as part of the comment on the second line.
If your system does not have Tk installed, you may want to link
cwish to plain "wish" so that scripts written for the Tk windowing
shell will invoke cwish. Beware that most Tk scripts require some
modification to be usable with CTk.
.SH "ENVIRONMENT VARIABLES"
.IP CTK_DISPLAY 20
Define this variable to display to a device other than standard input/output.
The device can be followed by :\fIterm\fR to set the terminal type
for the device.
.IP CTK_LIBRARY 20
Define this variable to override the CTK_LIBRARY path
that was compiled into the cwish binary.
.IP CTK_TERM 20
Define this variable to override the value of the \fBTERM\fR
.IP TERM 20
Defines the type of terminal for the standard input and output device.
Martin Andrews <firstname.lastname@example.org>
Report bugs to email@example.com.
Include a complete, self-contained example
that will allow the bug to be reproduced,
and say which version of CTk and Tcl you are using.
.SH "SEE ALSO"
.BR tclsh (1)