Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/paramgetpath.html
AHELP for CIAO 4.2

paccess

Context: paramio

Synopsis

Returns the path to the specified parameter file.

Syntax

String_Type paccess( String_Type paramfile )
String_Type paccess( String_Type paramfile, String_Type mode )
or
Int_Type paccess( Param_File_Type pfile, String_Type param )

String_Type paramgetpath( String_Type paramfile )
String_Type paramgetpath( Param_File_Type pfile )

Description

The paccess() and paramgetpath() routines are used to find out whether parameters and parameter files are accessible.

The paramio module is not available by default; to use it in a S-Lang program, it must be loaded using the S-Lang require() function:

  require("paramio");

paccess()

There are two forms of the paccess() call:

  • first argument is a string
  • first argument is a Param_File_Type variable

If given a string as the first argument then paccess() will return the full path to the parameter file, or NULL if it can not be found or the parameter file can not be accessed using the supplied mode (the optional second argument). If NULL is returned then the PF_Errno variable will be set to a non-zero value (see "ahelp paramio" for more information on this variable).

If given a Param_File_Type variable as the first argument then paccess() returns 1 if the second argument is listed in the parameter file, or 0 if not.

paramgetpath()

The paramgetpath() function returns the location of the parameter file for the given argument, which can be either the name of the parameter file or the Param_File_Type variable returned by paramopen(). If no parameter file can be found then NULL is returned and the PF_Errno variable will be set to a non-zero value (see "ahelp paramio" for a list of the values this variable can take).

Example 1

slsh> require("paramio");
slsh> paccess("dmlist");
/home/ciaouser/cxcds_param/dmlist.par

Example 2

slsh> fp = paramopen("dmlist");
slsh> paramgetpath(fp);
/home/ciaouser/cxcds_param/dmlist.par

Example 3

slsh> fp = paramopen( "dmcopy" );
slsh> paccess( fp, "infile" );
1
slsh> paccess( fp, "value" );
0

CHANGES IN CIAO 4.0

NULL when file not found

The paccess() function returns a NULL when the parameter file can not be found.

Bugs

See the bugs page for the paramio module on the CIAO website for an up-to-date listing of known bugs.

See Also

concept
parameter
modules
paramio
paramio
paramclose, paramopen, pget, pgets, plist_names, pquery, pset, punlearn
tools
dmhistory, dmkeypar, dmmakepar, dmreadpar, paccess, pdump, pget, pline, plist, pquery, pset, punlearn

Last modified: December 2009