elkins@topaz.rutgers.edu (George Elkins) (10/19/89)
I need to use some of the routines listed in IRIS 4D FORTRAN 77 Programmer's Guide, Chapter 4, System Functions and Subroutines. These allow many of the same system calls that can be easily done in the C language. I cannot seem to get these to work given only the man page and the Guide's description. I would rather use C, but since I am modifying a FORTRAN program, I am stuck. I would be extremely grateful if someone could send me a FORTRAN code fragment containing some of these (For example, getenv, getlog, fdate, etc.). George Elkins
mcqueen@acf4.NYU.EDU (David M. McQueen) (10/19/89)
c c this fragment determines what type of terminal you are logged in on c using the getenv routine. the purpose is to prevent inadvertently c running graphics when you are not (and somebody else is) at the c IRIS console. this may not be elegant, but it works. c character*80 terminal c do 101 iterm=1,80 terminal(iterm:iterm) = ' ' 101 continue call getenv('TERM',terminal) if (terminal .ne. 'iris-ansi') then do 103 iterm=1,80 lterm = iterm if (terminal(iterm:iterm) .eq. ' ') go to 104 103 continue 104 lterm = lterm - 1 if (lterm .lt. 10) then write(fm,111) lterm else write(fm,112) lterm end if 111 format('(a',i1,',a52)') 112 format('(a',i2,',a52)') write(6,*) write(6,fm) terminal(1:lterm), c ' is an inappropriate terminal type for IRIS graphics' write(6,*) stop end if
calvin@dinkum.wpd.sgi.com (Calvin H. Vu) (10/21/89)
In article <Oct.18.17.34.39.1989.29602@topaz.rutgers.edu>, elkins@topaz.rutgers.edu (George Elkins) writes: > > I need to use some of the routines listed in IRIS 4D FORTRAN 77 > Programmer's Guide, Chapter 4, System Functions and Subroutines. > containing some of these (For example, getenv, getlog, fdate, etc.). > > George Elkins This is an example in Fortran: integer putenv character*10 value character*24 name, date i = putenv("foo=bar") call getenv("foo", value) print *, value call getlog(name) print *, name call fdate(date) print *, date end and everything seems to work fine for me. In 3.2 and previous releases, for some Fortran system routines that take character arguments, if the length of your character arguments exceed 128 bytes those routines will return an 'invalid argument' error. This has been fixed in our next release. If you have the error above just check to make sure that the character argument is not defined with a length exceeding 128 bytes. Calvin Vu Silicon Graphics calvin@wpd.sgi.com