Possible bug in Sun 4 FORTRAN I/O system

RON MADDALENA rmaddale at lodestar.gb.nrao.edu
Fri Mar 2 02:08:53 AEST 1990


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 <rmaddale at nrao.edu>
National Radio Astronomy Observatory



More information about the Comp.sys.sun mailing list