pxfsystem
- Date:
10-20-2011
NAME
PXFSYSTEM - Issues a shell command
SYNOPSIS
CHARACTER*N cmd
INTEGER ilen, ierror
CALL PXFSYSTEM(cmd, ilen, ierror)
IMPLEMENTATION
Cray Linux Environment (CLE)
STANDARDS
The PXFSYSTEM(3F) subroutine is an extension to IEEE > Std 1003.9-1992
DESCRIPTION
The PXFSYSTEM subroutine uses the system() function to pass the command argument to a shell command as input. The command is executed as if the command is transmitted from a terminal.
Use an empty input string to determine if the shell command is present and executable. system() returns nonzero if the shell command is available. Otherwise, it returns zero.
When using the Cray Fortran Compiler, all arguments must be of default kind unless documented otherwise. The default kind is KIND=4 for integer, real, complex, and logical arguments.
The PXFSYSTEM subroutine supports the following arguments:
- cmd
Input character variable containing a command.
- ilen
Input integer variable containing the length of cmd in characters. If ilen is zero, all trailing blanks at the end of cmd are removed before calling system().
- ierror
Output integer variable that contains zero if the execution of the command was successful or nonzero if the execution of the command was not successful.
RETURN VALUES
In addition to the errors returned by the system() function, PXFSYSTEM may return the following errors:
- einval
If ilen is less than zero or greater than len(cmd).
- enomem
If PXFSYSTEM is unable to obtain memory to copy cmd.
NOTES
Replace the subroutine or function reference to ISHELL with the subroutine call to PXFSYSTEM.
EXAMPLES
program main
INTEGER ilen,ierror
! issue shell command date
ileN=0
CALL PXFSYSTEM ('date',ilen,ierror)
if (ierror .NE. 0) then
print *,'PXFSYSTEM call for date returned error = ', ierror
endif
end
should produce output from the 'date' command:
Thu Feb 19 21:21:45 CST 2004