Using Mosaic by Remote Control
NCSA Mosaic (version 1.1 or later) can be operated by
remote control. This means that an application -- any application --
can directly operate Mosaic, by specifying documents on the network to
view, directing it to open new windows, etc.
How It Works
Mosaic has a signal handler for the "extra", normally unused signal
called SIGUSR1
. When that signal is received by a
running Mosaic process, the signal handler determines its process ID
or pid (via the getpid()
call) and derives a
config filename:
/tmp/xmosaic.pid
So, for example, if the running Mosaic's pid is 1343, the config
filename is:
/tmp/xmosaic.1343
This config file is assumed to contain two lines of text:
- The first line is a directive, either
goto
(which means
jump right to a document) or newwin
(which means
open a new window and use that window to display a document).
- The second line is the URL of the document to download and view.
So, an example config file that tells Mosaic to view document
file://ftp.ncsa.uiuc.edu/
in an already-open window is:
goto
file://ftp.ncsa.uiuc.edu/
(Note that a goto
command will cause the document to be
viewed in the most-recently-used document view window, if a Mosaic
session has multiple open windows.)
How To Use It
One way to use this capability is to take advantage of
Mosaic's interaction and display functionality to provide cheap and
low-overhead online, possibly context-sensitive help for other
applications. The first time help is requested in your application,
fork off a new Mosaic process with a command-line argument
corresponding to the appropriate help document, which can of course be
pulled over the network in real time or retrieved from the local disk.
Subsequent help requests can use the running Mosaic process by writing
a config file (the Mosaic process ID is returned from the initial
fork()
call) and using the kill()
call to
send a SIGUSR1
.
Another use is Mosaic as a general hypermedia display engine for mail
readers, news readers, HTML editors, and similar applications. For
example, we're currently building capabilities into the Emacs html-mode.el
package developed by one of the Mosaic authors
(marca@ncsa.uiuc.edu) to provide transparent HTML previewing
via a single keystroke. Other people are putting hooks into existing
mail and news handlers. More information will be available when it's
available.
Future Possibilities
Have any ideas for future possibilities along these lines? We're
thinking both in terms of what can be done with this method as well as
more advanced capabilities involving two-way network communication for
the future. Drop us a line if you have any interesting thoughts.
Acknowledgements
Thanks much to Ken Evans (evans@phebos.aps.anl.gov) who suggested the
concept and contributed initial code.