D0 UNIX Utililies

D0 UNIX Utilities

This page describes UNIX utility programs and scripts in the unix section of the d0library.

All executable files reside in or are linked to the top level of the unix library section (i.e. $d0unix). Initializing the D0 environment adds this directory to the execute search list stored in the PATH environment variable. Any of the utilities described here may be invoked by typing their names followed by any options and arguments. All calling sequences adhere to standard unix conventions as described in the intro(1) man page.

Table of Contents

User Utilities

The utilities listed in this section are the ones that are most useful for ordinary users.

access

Currently the sole function of the access command is to define environment variables that point to
VMS project disks.
Usage:

% access disk [cluster]

Arguments:

disk    - Disk designation (e.g. top_doc).
cluster - The hundreds digit of the disk number 
          (1=d0sft; 2,4=fnald0; 3=d0tng).
The cluster argument is optional. It is necessary in some cases to resolve naming conflicts between disks served from different VMS clusters.
Examples:

% access top_doc
top_doc: /prj_root/200/top_doc
% access new_phenom_1 2
new_phenom_1: /prj_root/215/new_phenom_1
The project disks themselves are always accessible for reading via their absolute pathname whether or not an access command has been issued.

atoo

Pronounced Ay-Too-Oh (archive to object). This script creates an object file in the current working directory that contains all of the modules in a specified archive library. This script provides the most machine independent and reliable way to link the entire contents of a library.
Usage:

% atoo library

Arguments:

library - The name of an archive library.
Atoo is more reliable than force_load, but slower.

cmsfetch, cmsupdate

These shell scripts are similar to the D0 beta utilities of the same names. Cmsfetch retrieves one of more files from a VAX CMS library over the network. Cmsupdate puts one of more files into a CMS library.
Usage:

% cmsfetch [-b] [-h rhost] [-u ruser] [-d ldir] files cmslib
% cmsupdate [-b] [-h rhost] [-u ruser] files cmslib group remark

Options:

-b   Use BNL CMS library (default is local CMS library).
-h   Specify a remote VMS host (default = $VAXLIB_NODE).
-u   Specify a remote user (default = the current user).
-d   Specify a local directory to receive fetched files 
     (default = the current directory).

Arguments:

files  - A list of files to fetch or update.  May contain quoted wildcards.   
cmslib - CMS library.
group  - CMS group.
remark - CMS remark.  Quote if more than one word.
The files argument should be specified as a comma-separated list (with no spaces) of CMS element expressions (cmsfetch) or unix filenames (cmsupdate). This argument may contain quoted VMS or UNIX wildcards. Note that when fetching typeless files (which are relatively common in unix), the CMS element expression must include a final period, or it will be interpreted by CMS as a group name.

Cmsfetch and cmsupdate perform network transactions between trusted hosts using rsh and rcp. No passwords are involved. In order to be able to use cmsfetch and cmsupdate, it is necessary to have a suitable list of trusted hosts defined in your .rhosts files in the home directories of your UNIX and VMS accounts (see hosts.equiv(4) and multinet documentation).

Cmsupdate does not generate BNL files for elements that do not have them already.

d0rl

This is a filter that is an interface to the POSIX function readlink. It is somewhat similar to the VMS command "show logical." A list of files is read from the command line or from standard input. Files that are symbolic links are translated by readlink. Others are simply echoed. In either case, the output consists of a series of filenames that are written to standard output one per line.
Examples:

% d0rl *_rcp
% ls | d0rl

fort

Fort preprocesses and compiles various kinds of source files to object files (.o) with standard options and preprocessors.
Usage:

% fort [-t] [-f flavor] file1 file2 ...

Options:

-t   Touch intermediate and output files, but do not recreate them.
-f   Specify a UNIX flavor (default $D0FLAVOR).

Arguments:

file1, file2 ... - Source files.
Recognized source file types are .for (VAX fortran), .f (unix fortran-77), .c and .lex. The sequence of types is as follows:
      .for  ->  .f  ->  .o
      .lex  ->  .c  ->  .o
Standard options for the compilers are stored in the shell variables $f77flags (fortran), $ccflags (c) and $lccflags (lex c output).

The following rules are always followed.

See also lnk.

force_load

Force_load generates the link editor options necessary to force_load one or more archive libraries. Force_load is intended to be embedded in link editor or compiler commands.
Usage:

% force_load [-cl] library1 library2 ...

Options:

-c   - Generate compiler options (default).
-l   - Generate linker options.

Examples:

% ld ... `force_load -l userlib.a` ...
% f77 ... `force_load userlib.a` ...
% cc ... `force_load userlib.a` ... 
Force_load is SGI specific. It does not work on IBM. In the case of large libraries, force_load can fail because it overflows the maximum command line length. In either of these cases, the script atoo can be used instead.

libprod

This utility defines environment variables for a production release. Both d0library environment variables and the package environment variable are defined.
Usage:

% libprod [-cnp] [-r root] package

Options:

-c   Current version (new subdirectory ignored).
-n   New version (default if new subdirectory exists).  
-p   Print values of environment variables that are set.
-r   Specify root of production area (default
     $prod/package).
-s   D0library environment variables point to section
     subdirectories.  Package environment variable points to
     root of production area.

Arguments:

package - Name of production package (e.g. full_d0reco).
Only one of the options -c, -n or -s should be specified. If none is specified, -n is the default if a new subdirectory exists (otherwise -c). In current mode, d0library environment variables are set to a search list that points first to the top directory of the production area, and then to the section subdirectory. New mode adds the new subdirectory, if it exists. In subdirectory (-s) mode, which is maily intended for use during releases, d0library environment variables point only to section subdirectories in the production area.

Libprod is an alias that invokes the script libprod.csh. The effect of libprod is cancelled by nolibprod, which is simply an alias for nolibtest all, or by libtest (e.g. libtest all).

libtest, nolibtest, showlibtest

These utilities correspond to the VMS utilities of the same names.
Usage:

% libtest [-bgtop] [-a area] section1 section2 ...
% libtest [-bgtop] [-a area] all

Options:

-a   Alpha mode.  The alpha area is specified as an argument 
     to this option.
-b   Beta mode (root $d0beta).
-g   Gamma mode (root $d0gamma).
-t   Test mode (root $d0test).  This is default.
-o   Official mode (root $d0library).  Turns off all 
     non-official libraries.
-p   Print values of environment variables that are set.

Arguments:

section - A library section operate on (or all).
Libtest and nolibtest modify the environment variable that points to the root of the specified section(s). In the case of library sections that contain executable files, the environment variable PATH is also modified. Nolibtest is an alias for libtest -o.

lnk

This script invokes the link editor (via f77 or xlf) with standard options and libraries to produce an executable from the specified object files and archives libraries. Standard libraries include (deb_)general.a, cernlib libraries, (deb_)unix.a and system libraries.
Usage:

% lnk [-cd] [-o exe_file] arg1 arg2 ...

Options:

-c   Use FNAL cernlib (default is d0cernlib).
-d   Use debug d0 libraries (deb_ prefix).
-o   Specify name of executable (default is same as first 
     argument).
The arguments may consist of object files, archives, or f77 or xlf options. The latter should be preceded by at least one file argument or by double-hypen (--) to prevent them from being interpreted by the lnk script.

Examples:

% lnk my_file.o my_archive.a
% lnk -- `force_load userlib.a`

File Finding Utilieies - ufa, vfa, uff, vff, ufl, vfl, ufn, vfn

These are filters for lists of files. Each of the eight file-finding utilities have the following properties in common: The differences among the file finding utilities are summarizied below. When using command line arguments, characters that are special to the shell, such as wildcards, $ (dollar sign), [] (square brackets), etc. should be quoted unless their expansion can be safely left to the shell.
Examples:

% ufa \*                               # List all files in the working directory.
% ls | ufa                             # Ditto.
% uff $d0general/general.a             # List current general library (test or official).
% vff 'd0$general:general.a'           # Ditto.
% vfl 'd0$offline_util$general:*.for'  # List fortran files in a d0library section

userlib

Usage:

% userlib [-dn] [-l library] [-o makefile] [-f flavor] [-c comp_dir] file1 file2 ...

Options:

-d   Generate dependencies only for debug library.
-n   Generate dependencies only for non-debug library.
-l   Specify archive library (default userlib.a).
-o   Specify output file (default makefile).
-f   Specify UNIX flavor (default $D0FLAVOR).
-c   Specify compilation directory.

Arguments:

filen - One or more source files or -.
This script generates a makefile for updating an archive library using the make utility. By default the generated makefile contains rules for updating both a debug and a non-debug version of the library. The debug version of the library unconditionally gets a prefix deb_ (e.g. deb_userlib.a). The debug and non-debug versions of the library can be updated using the fake targets "debug" and "opt" respectively. The -d option suppresses generation of the fake target opt and its dependents. The -n option suppresses the fake target debug. Libraries can be built by specifying their names or their fake targets as arguments to the make command.
Examples:

% userlib *.for       # Create makefile.
% make debug          # Build debug library.
% make opt            # Build non-debug library.
% make deb_userlib.a  # Build deb_userlib.a
% make userlib.a      # Build userlib.a
% make                # Build default target (usually debug).
The generated makefile contains a third fake target "pre" that can be used to update preprocessed files (e.g. VAX fortran). It is not necessary to build the fake target pre explicitly, but it is sometimes convenient to do so.

The -c option is intended for use during during library releases. If specified, the -c option causes files to be compiled using a pathname relative to the specified directory, which must be stored in the environment variable d0scratch when the makefile is executed by make. If the -c option is omitted, then only absolute pathnames will appear in the resulting makefile and d0scratch does not need to be defined.

If the argument list consists of a single - (hyphen), then userlib reads the names of source files from standard input. This is useful is there are too many source files for the command line.

D0library Utilities

Utilities are listed in this section if they are intended mainly to be used in updating d0library, or they are usually called indirectly by other utilities.

d0cernlib

This is a script to make copies or symbolic links of the contents of cernlib files from a directory outside of d0library to the cernlib section of d0library.
Usage:

% d0cernlib local foreign version copy

Arguments:

local   - Local directory in d0library (e.g. $d0library/cenrlib).
foreign - Location of non-D0 copy of cernlib.
version - Cernlib version for D0 tag file.
copy    - Copy flag (0=link, 1=copy).

Example (use Fermi cernlib):

% setup cern v94a
% d0cernlib $d0library/cernlib $CRNLIB v94a 0

d0rexec

Usage:

% d0rexec node [-l user] [-p password] command

Options:

-l   Remote user (default current user).
-p   Remote user's password (default from .netrc).

Arguments:

node    - Remote node.
command - Remote command.
This program is similar to rsh, but uses the password/.netrc authentication mechanism (like ftp) to execute a command on a remote node.

ftpfetch, mixfetch, zftpfetch

Usage:

% ftpfetch [-h rhost] [-u ruser] [-d ldir] [-tmxgez] files % zftpfetch [-h rhost] [-u ruser] [-d ldir] [-tmxgnrlez] files % mixfetch [-h rhost] [-u ruser] [-d ldir] [-tmxgnrlez] files
Options:
-h Specify a remote VMS host (default = $VAXLIB_NODE or $ZFTP_NODE). -u Specify remote user. -d Specify a local directory to receive fetched files (default = the current directory). -t Fetch text files. -m Fetch compack menu files (2444 byte records). -x Fetch data exchange mode FZ files (32760 byte records). -g Fetch geant exchange mode FZ files (3600 byte records). -n Fetch VAX native mode FZ files. -r Fetch VAX native RZ files (4096 byte records). -l Fetch VAX native RZ files (32764 byte records). -e Fetch exchange mode RZ files (4096 byte records). -z Fetch exchange mode RZ files (32764 byte records). Arguments: files - A list of files to fetch or update.
This is a script to copy a directory tree of text files from VMS to UNIX. The files argument may contain quoted VMS wildcards, including the directory tree (...) wildcard. In the latter case, files in subdirectories are copied to the corresponding subdirectories in UNIX. If the appropriate UNIX subdirectory does not exist it is created.

The file fetching utilities understand nine distinct file formats that are commonly used in D0. Each format is designated by a single letter (one of TMXGNRLEZ). File formats are determined by executing the DCL script d0$unix$vms:file_type.com. Six of the nine formats are transportable using ftp. All nine formats are transportable using zftp. The following table summarizes the definition and transportability of the nine formats.

Format    Description     ftp transportability    zftp transportability

T Text ascii geta M Compack Menu binary getx (lrecl=2444) X FZ exchange binary getx (lrecl=32760) G FZ exchange binary getx (lrecl=3600) N FZ native no getfz E RZ exchange binary getx (lrecl=4096) Z RZ exchange binary getx (lrecl=32764) R RZ native no getrz L RZ native no getrz
Ftpfetch performs all network transfers using FTP (formats N, R and L are not tranferred). Zftpfetch performs all network transfers using zftp. Mixfetch uses ftp for the six formats that are transferrable using ftp and zftp for the three native Zebra formats. Security for both ftp and zftp is via the .netrc mechanism (see the ftp man page). As ftp is more reliable than zftp, mixfetch is the preferred file fetching utility in most cases. D0library releases are fetched using mixfetch.
Example:

% mixfetch -d $d0beta/unix 'd0$beta:[unix...]*.*'

lib_sect

This command prints information about d0library sections.
Usage:

% lib_sect [-cotv] [-h rhost] section1 section2 ...

Options:

-c   Specify compound libraries (e.g. general).  Only effective if the 
     argument list is empty.
-o   Official mode.
-t   Test mode.
-v   Print version numbers.
-h   Specify remote (VAX) host.  If not specified, the local
     (UNIX) host is assumed.

Arguments:

section1, section2 - A list of d0library sections.  If no
     arguments are given, information about is returned for
     all library sections (or all compound library sections
     if -c has been specified).  All component libraries of
     a compound library may be specified @general.
If -v is not specified, the only action of this script is to print a list of d0library sections. In this case, all other options (except -c) are ignored. If the -v option is specified, then this script prints a list of d0library section and their associated version numbers for the local UNIX host or a remote VAX host (-h option). Corrupted or non-existent sections are shown as version 0. Network access to the remote host is via FTP. Login information on the remote host must be contained in a .netrc file.

local_flavor

This script converts file(s) in situ to the local flavor using tasteofd0 and vmstounix in situ.
Usage:

% local_flavor [-f flavor] file1 file2 ...

Options:

-f   Specify a flavor (default $D0FLAVOR).

Arguments:

file1, file2 - Files to convert.
This script is used by the library release procedures, official_release and test_release to convert .inc, .def and .params files at release time.

main_list

This script gives a list of object modules in an object file archive library that contain main programs.
Usage:

% main_list library

Arguments:

library - Object file archive library.

mkdirp

This script creates one or more directories and recursively creates parent directories if necessary. This script does the same job as the command mkdir -p on sgi.
Usage:

% mkdirp dir1 dir2 ...

mms_filter

This command analyzes MMS files produced by the D0 release procedure. The output consists of a sorted list of VMS filenames. Dependent files (-s option) are output on the same line, separated by tabs.
Usage:

% mms_filter [-lsp] [-o library] mms_file

Options:

-l   Print a list of target libraries contained in the MMS file.
-o   Print a list of object files associated with a given target library.  
     Only the name field of the library is  significant.
-s   Print a list of object files and their dependents (for all libraries).  
     The first dependent is normally the source file.  Later dependents are 
     typically include files.
-p   Print a list of parent library sections.
Only one of the above options should be specified. If none is specified, -l is assumed. The following example will print a list of source files for all target libraries.
% mms_filter -s $mms_file | cut -f2
This script is used by mmstomake, which converts MMS files to makefiles.

mmstomake

Convert an MMS file created by the d0library release procedure into a makefile.
Usage:

% mmstomake [-f flavor] [-o makefile] mms_file

Options:

-f   Flavor (default $D0FLAVOR).
-o   Output file (default makefile).

Arguments:

mms_file - D0library MMS file.
The generated makefile contains three fake targets: pre, debug and opt. The fake targets debug and opt update all debug and non-debug target libraries respectively. The fake target pre preprocesses all files that need preprocessing (mainly VAX fortran files).
Example:

% mmstomake offline_util.mms
% make pre
% make debug        # or make deb_general.a
% make opt          # or make general.a

official_release, test_release

Pull an official or test D0library section from VMS to UNIX and build it.
Usage:

% official_release [-sv] [-h rhost] [-u ruser] [-d ldir] section
% test_release [-gsv] [-h rhost] [-f files] [-u ruser] [-d ldir] section

Options:

-f   - Spicify files to fetch.  Default is 
       'D0$DISK:[D0LIBRARY.TEST.section...]*.*' for test 
       release and 'D0$GAMMA:[section...]*.*' for gamma 
       release.  If included, this argument should be 
       quoted.
-g   - Specify gamma release (instead of test release).
-h   - Specify remote host (default $VAXLIB_NODE).
-s   - Leave in scratch area.
-u   - Specify remote user.
-v   - Check version number (do nothing if library is 
       current).
-d   - Specify local (UNIX) directory to receive release.

Arguments:

section - Library section.
Thses scripts use mixfetch to get text and binary files from the remote (VMS) node. If the -u option is not specified, there must be a valid .netrc file. Object archive libraries are built by make, which executes the makefile generated by mmstomake. Official, test and gamma libraries are stored under $d0library, $d0test and $d0gamma respectively, unless the -d option has been specified. Official_release deletes a test or gamma release for the specified library section, if either exists. Fetching a child library will automatically force a parent library (e.g. general) to be updated, if the parent needs updating.

production_release, pass_release

These scripts pull a production release or a pass release respectively from VMS into the production area.
Usage:

% production_release [-h rhost] [-u ruser] [-d dir] package
% pass_release [-h rhost] [-u ruser] [-d dir] package

Options:

-h   - Specify remote host (default $VAXLIB_NODE).
-u   - Specify remote user.
-d   - Specify local (UNIX) directory to receive release
       (default $prod/$package).

Arguments:

package - Production package (e.g. full_d0reco).
Thses scripts use mixfetch to get text and binary files from the remote (VMS) node. If the -u option is not specified, there must be a valid .netrc file. Object archive libraries are built by make, which executes a makefile generated by mmstomake for each library section in the production release. The production or pass release is stored under the directory $prod unless the -d option has been specified.

rmdirp

This script deletes the named directories, including contents and subdirectories (using rm -rf ...) and also recursively deletes parent directories that are empty and owned by the current user. Rmdirp does the same job as the command rmdir -p on sgi.
Usage:

% rmdirp dir1 dir2 ...

tasteofd0, vmstounix

These are precompilers for VAX fortran files. Tasteofd0 handles d0flavor-style conditional compilations (machine blocks). Tasteofd0 accepts a single argument specifying the flavor to be selected. Vmstounix changes VMS filenames appearing in INCLUDEs to their UNIX equivalants. Both tasteofd0 and vmstounix read from standard input and write to standard output. To read from or write to a file, use shell I/O redirection.
Example:

% tasteofd0 $D0FLAVOR < program.for | vmstounix > program.f
As in the above example, VAX fortran files normally have a type of .for, while UNIX fortran normally have type .f.

The following flavors are known to tasteofd0.

VAXVMS    VMS
VAXELN    VAX/ELN
ETA10
SIUNIX    Silicon Graphics/IRIX
IBMAIX    IBM/AIX
ULTRIX    DEC/Ultrix
HPUX      Hewlett-Packard
SUNOS     Sun
ALFOSF    Alpha/OSF
The names themselves have no significance. In particular, the appearance of a given flavor in the above list does not imply that that flavor has any level of support in D0.

The flavor of the local machine is stored in the environment variable D0FLAVOR when D0 environment is initialized.

update_library

This is a script to update all sections of the D0library that need updating. Whether a given section needs to be updated is determined by comparing the version number of the local D0library section to the version number on a remote (VAX) node.
Usage:

% update_library [-h rhost] [-ton]

Options:

-h   Specify a remote VMS host (default $VAXLIB_NODE).
-o   Update official library sections.
-t   Update test library sections.
-n   No update mode.  (Just show which sections are out of date.)
Either or both of the -t and -o options may be specified. If neither is specified, then this script does nothing.

vms_file_type

Usage:

% vms_file_type [-h rhost] [-u ruser] file(s)

Options:

-h   Specify a remote VMS host (default = $ZFTP_NODE).
-u   Specify a remote user (default = current user).

Arguments:

files -  A list of VMS files (may contain quoted VMS wildcards).  
Get a list of VMS files and types. Used by zftpfetch and mixfetch. Uses d0rexec to remotely execute @d0$unix:file_type.com. Require a valid .netrc file.
Example:

% vms_file_type -h d0sf21 'd0$beta:[unix...]*.*'

Links to other D0 pages

  • Top of this document.
  • D0 UNIX Page
  • D0 home Page

  • Last updated Sept, 7, 1995.
    H.G.