next up previous
Next: Retaining Converted Data
Up: ADDITIONAL FACILITIES
Previous: ADDITIONAL FACILITIES

Explicit Deletion Commands  

When accessing files containing foreign format data, the NDF library will, on occasion, have to delete them (for instance, the routine NDF_DELET might have been called by an application). Normally, this causes no problem, as a named file can easily be deleted when necessary. With some formats, however, this is not so simple. For example, data written in IRAF format will normally reside in two associated files - although the NDF library can delete the one it knows about, the other one would remain in existence.

To overcome this and other similar problems, it is possible to define an explicit deletion command for any foreign format which needs special treatment. If one is defined, it will over-ride any attempt by the NDF library to delete files which it knows are written in that format.

Taking the IRAF format as an example, the command would be defined via the environment variable NDF_DEL_IRAF in the same way as when defining format conversion commands. For example:

setenv NDF_DEL_IRAF 'rm -f ^dir^name.imh ^dir^name.pix'

would unsure that both files associated with the dataset (with extensions `.imh' and `.pix') are deleted when necessary.

The deletion command is invoked in the normal way, by passing it to the C run time library ``system'' function, having first performed message token substitution on it (see §[*]). In this case, the NDF library defines the following tokens for use in the command:

Token Value
dir Directory in which the foreign file resides
name Foreign file name (without directory or extension)
type Foreign file extension (with leading `.')
vers Foreign file version number (blank if not supported)
fxs Foreign extension specifier (see §[*] )
fxscl Clean version of fxs (all non-alphanumeric characters replaced by underscores)
fmt Foreign format name (upper case)


next up previous
Next: Retaining Converted Data
Up: ADDITIONAL FACILITIES
Previous: ADDITIONAL FACILITIES


Starlink System Note 20
R.F.Warren-Smith & D.S.Berry
17th July 2000
E-mail:ussc@star.rl.ac.uk

Copyright © 2000 Council for the Central Laboratory of the Research Councils