NAME

cxParamPathnameGet - expand a parameter string value as a Unix path name
#include <cx/DataAccess.h>

char *cxParamPathnameGet ( cxParameter *src )
integer function cxParamPathnameGet( src, file )
integer src
character*(*) file
src
The input cxParameter value, assumed to contain a string value.
file
In Fortran, the output filename expanded from the cxParameter string.
In C, the value of src as a file name. In Fortran, the length of the file name. cxParamPathnameGet takes a character string, possibly beginning with a tilde and possibly containing environment variables, and returns a string containing the same information, but with the tilde notation and environment variables expanded.

If the string begins with a tilde character, then it is expanded into a home directory name according to the same rules used by C-shell. If this expansion fails (perhaps because it references the home directory of an unknown user), the tilde notation is left alone in the result. Environment variables may be used in the input string as well, again using the notation used by C-shell. They are replaced with the values of those variables. If an undefined environment variable is encountered, it is replaced by an empty string.

For example, consider the following string:

~explorer/$USER/data
If the home directory of the user named explorer is /usr/people/explorer, and the value of the USER environment variable is arnold, this string will expand into the following:
/usr/people/explorer/arnold/data

In C, the storage used by this routine for the return value is dynamically allocated. The module programmer is therefore responsible for freeing that storage when done with the contents, by using free(3E). In Fortran, the character variable file is declared by the user. Also, the returned value is the length of the string in the parameter, which may be longer than the character variable provided by the user, in which case the caller should try again to get the full file name.

csh(1), environ(5)
Last modified: Mon Nov 6 16:33:35 GMT 2000
[ Documentation Home ]
© The Numerical Algorithms Group Ltd, Oxford UK. 1996