pxfsetenv

Date:

10-20-2011

NAME

PXFSETENV - Sets environment variable pair

SYNOPSIS

CHARACTER*n name, new
INTEGER lenname, lennew, ioverwrite, ierror
CALL PXFSETENV(name, lenname, new, lennew, ioverwrite, ierror)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

IEEE Std 1003.9-1992 standard interface for FORTRAN 77

DESCRIPTION

The PXFSETENV routine uses the putenv(3c) function to change a currently existing “name=value” pair or create a new name=value pair. The name or new arguments are stripped of trailing blanks if lenname or lennew are zero.

All arguments must be of default kind unless documented otherwise. Default kind is KIND=4 for integer, real, complex, and logical arguments.

The following is a list of valid arguments for this routine:

name

An input character variable or array element containing the environment name value to be set.

lenname

An input integer variable containing the character length of name. If lenname is zero, trailing blanks are removed.

new

An input character variable or array element containing the new environment value for the name=value environment pair.

lennew

An input integer variable containing the character length of new. If lennew is zero, trailing blanks are removed.

ioverwrite

An input integer variable containing a zero or nonzero number. When the value is zero, a name=value pair with the name value matching name will not be replaced with a new name=new pair.

  • A nonzero ioverwrite value will replace the matching name=value pair with name=new pair.

ierror

An output integer variable that contains zero if the environment variable was changed or nonzero if PXFSETENV was not successful.

The PXFSETENV routine may return any of the following error values:

EINVAL

If ilen is less than 0 or lenname is greater than LEN(path)or lennew is less than 0 or lennew is greater than LEN(new).

ENOMEM

If PXFSETENV is unable to obtain memory to copy name and new to a new name=value string.

EXAMPLES

In this example, PXFSETENV sets the SHELL environment value to /bin/csh.

       program testpxf
       character*10 name, val
       integer lenname, lenval, ioverw, ierror
c set input arguments
       name='SHELL'
       ierror=0
       lenname=5
       val='/bin/csh'
       lenval=8
       ioverw=1
       CALL PXFSETENV(name,lenname,val,lenval,iover,ierror)
c print input arguments
       print *,'name=-',name,'-'
       print *,'lenname=',lenname
       print *,'val=-',val,'-'
       print *,'lenval=',lenval
       print *,'iotherw=',iotherw
c print output argument
       print *,'ierror=',ierror
       end

SEE ALSO

setenv(3c)