# jinit.tcl

## Introduction

The jinit.tcl library is distributed as part of the jstools package. It consists of a procedure, `::jstools::jstools_init`, that reads user preferences and initialises data used by the jstools libraries. Any application that uses the jstools libraries should either call `::jstools::jstools_init` early on, or duplicate its functionality.

This document describes jinit.tcl version 2001.02.10.

## Usage

### Accessing the Library

In order to use the jinit.tcl library, it (and any other libraries it depends on) 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

### Procedure

`::jstools::jstools_init` - common initialisation for jstools applications and libraries

## ::jstools::jstools_init

### Usage

`::jstools::jstools_init` [app]

### Argument

app - name of the current application

### Description

This procedure performs common setup tasks for the jstools applications and other applications using the jstools libraries. Specifically, it does the following:

- It sets `NAME` and `HOME` global variables with the user's login name and home directory, if it can find those in the environment.
- It sets the application's `client' and `command' properties for the use of X session managers.
- It reads in the user's global preferences. This is important, as many of the jstools libraries depend on the existence of variables created during this process.
- It tries to load the user's preferred language database for presentation of strings by library routines.
- It reads in the X resource file ~/.tk/jstools.ad, if it exists, allowing the user to override widget defaults for all jstools applications.
- If app was specified, it also tries to load an applicationspecific language database for presentation of strings used by the application.
- If app was specified, it tries to load an applicationspecific X resource file named ~/.tk/app.ad which can override the values in ~/.tk/jstools.ad.
- It sets up Text and Entry bindings to use the user's preferred editor emulation, and reads the user's ~/.tk/textbindings.tcl and ~/.tk/entrybindings.tcl, if any.
- It calls `::jstools::site_init app` to perform any site-specific configuration (such as providing the names of available printers). The installer can edit the file jsiteinit.tcl in the jstools package directory to tailor it for the local installation. As shipped, that file does nothing (and editing it is optional).

If you don't want to use `j:jstools_init` because there's something it does that you don't like, you should refer to the procedure itself to see what you need to do to initialise your application.

## Bugs and Limitations

##

##

Some applications may not use text widgets, entry widgets, or both. Initialising text and entry mappings is a waste of time and I/O in that case. (On the other hand, any application which uses such jstools procedures as `::jstools::fs` or `::jstools::prompt_tcl` needs entry bindings, and an application which uses `::jstools::more` might need text bindings.)
- It would be nice if`::jstools::jstools_init` could handle setting up the `auto_path` variable to find the libraries. Since it is itself called using the autoloading mechanism, of course, it can't.

`
`