Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XtResolvePa(3) — OSF1 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtFindFile(1)

XtFilePredicate(2)

 

Name

XtResolvePathname — search for a file using standard substitutions in a path list. 

Synopsis

String XtResolvePathname(display, type, filename, suffix, path, substitutions, num_substitutions, predicate)

      Display ∗display;
      String type, filename, suffix, path;
      Substitution substitutions;
      Cardinal num_substitutions;
      XtFilePredicate predicate;

Arguments

displaySpecifies the display to use to find the language for language substitutions. 

type

filename

suffixSpecify values to substitute into the path. 

pathSpecifies the list of file specifications, or NULL. 

substitutions
Specifies a list of additional substitutions to make into the path, or NULL. 

num_substitutions
Specifies the number of entries in substitutions.

predicateSpecifies a procedure called to judge each potential file name, or NULL. 

Description

The Intrinsics provide two routines to look for a file by name using string substitutions in a list of file specifications.  XtFindFile uses an arbitrary set of client-specified substitutions, whereas XtResolvePathname uses a set of standard substitutions corresponding to the X/Open Portability Guide language localization conventions.  Most applications should use XtResolvePathname, which calls XtFindFile. 

The substitutions specified by XtResolvePathname are determines from the value of the language string retrieved by XtDisplayInitialize for the specified display.  A language is specified from three parts, two of which are optional: the language, the territory, and the codeset.  These parts are combined into a single string as follows:

language[_territory][.codeset]

The parts consist of arbitrary strings of letters and numbers.  The parts of the language are not interpreted except when used in substitutions.  To set the language for all applications specify:

∗xnlLanguage: lang

in the resource database. 

XtResolvePathname calls XtFindFile with the following substitutions in addition to any passed by the caller and returns the value returned by XtFindFile:

%NThe value of the filename parameter, or the application’s class name if filename is NULL. 

%TThe value of the type parameter. 

%SThe value of the suffix parameter. 

%LThe language specification associated with the specified display. 

%lThe language part of the display’s language spec. 

%tThe territory part of the display’s language spec. 

%cThe codeset part of the display’s language spec. 

If a path is passed to XtResolvePathname it will be passed along to XtFindFile.  If path is NULL, the value of the XFILESEARCHPATH environment variable will be passed to XtFindFile.  If XFILESEARCHPATH is not defined, an implementation-specific default path will be passed in which contains at least /usr/lib/X11/%T/%N%S.  If the path begins with a colon, it will be preceded by %N%S.  If the path includes two adjacent colons, %N%S will be inserted between them. 

The type parameter is intended to be a category of files, usually being translated into a directory in the pathname.  Possible values might include app-defaults, help, and bitmap. 

The suffix parameter is intended to be appended to the file name.  Possible values might include .txt, .dat, and .bm. 

A suggested value for the default path on POSIX-based systems is:

/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S

Using this example, if the user has specified a language, it will be used as a subdirectory of  /usr/lib/X11 that will be searched for other files.  If the desired, file is not found there, the lookup will be tried again using just the language part of the specification.  If the file is not there it will be looked for in /usr/lib/X11.  The type parameter is used as a subdirectory of the language directory or of /usr/lib/X11, and the suffix is appended to the file name. 

It is the responsibility of the caller to free the returned string using XtFree when it is no longer needed. 

Structures

A string substitution is defined by a list of Substitution entries. 

typedef struct {
char match;
String substitution;
} SubstitutionRec, ∗Substitution;

See Also

XtFindFile(1),
XtFilePredicate(2). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026