# jviewers.tcl

## Introduction

The jviewers.tcl library is distributed as part of the jstools package. It consists of procedures to manage display of World Wide Web documents and Unix manual pages to the user, honouring hir preferences for what tools to use.

This document describes jviewers.tcl version 2001.02.10.

## Usage

### Accessing the Library

In order to use the jviewers.tcl library, it must be in your Tcl `auto_path`, described in `tclvars`(n). Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.

## Credits and Copyright

### Author

Jay Sekora
`js@aq.org`
`http://www.aq.org/~js/`

### Copyright

The library is copyright © 1992-2001 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.

## Overview

`::jstools::view_url` - display the document pointed to by a World Wide Web URL
`::jstools::view_man` - display a Unix manual page

## ::jstools::view_url

### Usage

`::jstools::view_url` url

### Argument

url is the URL of the web document to display

### Examples

`::jstools::view_url http://www.aq.org/~js/`
`::jstools::view_url ftp://ftp.example.net/pub/tcl/README`

### Description

This procedure invokes the user's chosen web browser to display the document indicated by url. The exact mechanism whereby this happens may vary from browser to browser.

## ::jstools::view_man

### Usage

`::jstools::view_man` manpage

### Argument

manpage is the name of the manual page to display

### Example

`::jstools::view_man xauth`

### Description

This procedure invokes the users chosen method for viewing Unix manual pages to display the page named manpage. The exact mechanism whereby this happens may vary depending on the mechanism chosen. (For instance, for TkMan, it may involve using the Tk `send`(n) command to communicate with a running copy of TkMan; for the `builtin` method it involves displaying the filtered output of `man`(1) in a window.)

## Other Procedures

Other procedures in the library implement the interface to particular web browsers or manualpage viewers a user may choose. You shouldn't call them directly in your code - doing so would defeat the purpose of allowing the user to set viewer preferences.

## Bugs and Misfeatures

- `::jstools::view_man` isn't as useful in my documents any more now that (1) Tcl/Tk is cross-platform (not just Unix), and (2) I'm writing documents on the assumption that they'll be viewed mostly via HTML.
- As implied above, `::jstools::view_man` is basically Unix-specific.
- I don't think anybody's using Mosaic anymore. :-)
- I don't know how to manipulate web browsers remotely under Windows or MacOS.

## Future Directions

- There need to be more choices, and also a mechanism for the user to specify tools I haven't foreseen.
- This concept might be extended to display of other sorts of information.
- It might be appropriate to let the user specify different tools for different URL access mechanisms (e.g. `ftp:` vs. `http:`) or (more likely) different kinds of documents (e.g. `image/jpeg` vs. `audio/basic`). This is unlikely, though, since it would probably require implementing something like a web browser in Tcl and duplicating lots of functionality that already exists in other tools. [When I wrote that sentence, there weren't Tk-based web browsers. Now there are. Maybe I'll revisit this.]

`
`