Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rice!sun-spots-request From: rmaddale@lodestar.gb.nrao.edu ( RON MADDALENA ) Newsgroups: comp.sys.sun Subject: Re: Possible bug in Sun 4 FORTRAN I/O system Keywords: Miscellaneous Message-ID: <5405@brazos.Rice.edu> Date: 1 Mar 90 15:08:53 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 27 Approved: Sun-Spots@rice.edu X-Refs: Original: v9n62 X-Sun-Spots-Digest: Volume 9, Issue 66, message 3 I've never yet saw a UNIX system in which a Fortran SYSTEM call did not do something wrong!! In almost all cases it has been some bizarre interaction between Fortran I/O and SYSTEM. The 'fix' I've come up with, which works in almost all cases, is to call a c-routine (given below) which does the actual SYSTEM call (i.e., I cheat). int csystem_(string, len) /* Does a SYSTEM call */ char *string[]; int len; { return(system(string)); } Basically, just replace the word SYSTEM with CSYSTEM in your calling program, compile it and the c-routine CSYSTEM, and link the two. Note, however, that the return code generated by CSYSTEM becomes corrupted when you run your program in some Sunwindow environments like GFXTOOL -- in GFXTOOL, the return code is ALWAYS a -1, regardless of whether the SYSTEM call succedded or not. In CMNDTOOL or SHELLTOOL, the return code is always correct. Therefore, until someone comes up with a 'fix' to this different bug, one should not, to be on the safe side, test or care about the return code. Ronald J. Maddalena National Radio Astronomy Observatory