ENVINT() is a Fortran wrapper calling the C envintc()
INTEGER FUNCTION ENVINT( LNAME, DESCRIP, DEFAULT, STATUS ) CHARACTER*(*) LNAME ! logical name to evaluate CHARACTER*(*) DESCRIP ! description of the value INTEGER DEFAULT ! default value (if LNAME not set, or empty) INTEGER STATUS ! for distinguishing default/error cases
int envintc( const char * lname , const char * description , int defaultval , int * status )
For Fortran-90 declarations and interface checking:
USE M3UTILIO
See also
ENVDBLE,
ENVREAL,
ENVSTR,
ENVYN,
NAMEVAL, and
SETENVVAR.
#include "iodecl3.h"
if called from C.
LNAME and DESCRIP have length at most 256. (NOTE: POSIX says that environment variables may have lengths this long.)
... setenv FOO 23 ... /mydirectory/myprogram ...
... INTEGER FOO INTEGER STATUS ... FOO = ENVINT( 'FOO', & 'Some control parameter or other, called FOO', & 17 , & STATUS ) IF ( STATUS .GT. 0 ) THEN ... bad value for FOO; do something. END IF ...
#include "iodecl3.h" ... int status, value ; ... value = envintc( "FOO", "Here is where I put a description", 17 , & status ) ) if ( status 0 ) { ... stuff for bad (non-integer) value of environment variable FOO } else if ( status == -1 ) { ... stuff for empty-but-defined FOO } else if ( status == -2 ) { ... stuff for not-defined-at-all FOO } ... use value...
To: Models-3/EDSS I/O API: The Help Pages