| Thanks sirclif for your answer. I was thinking about regular expressions, but as I am not sure that I could list all possible contexts in which a unit number could appear and then write regular expressions that would certainly find everything, I would prefer to asociate stdin and stdout with something else. For example, a WRITE statement can have a unit number as the first argument, or it may appear later with 'UNIT=...', a unit number can also appear in CLOSE, REWIND and other statements, spaces are ignored in Fortran so maybe there is WRI TE in my code, or I may have UNI in columns 70-72, and NIT=6 in columns 7-11 of the next line. Things like these really appear in this code, I have seen them. So if I have to foresee all such things, I may as well write a compiler.
So I tried with SYSIN and SYSOUT. These names appear on the Internet, but it seems that they are not parts of the Fortran 77 standard. I can open(98,'SYSIN'), but I think that the compiler thinks that SYSIN is a regular file, as the next line OPEN(6,'filename') leads to a segmentation fault. Also CLOSE(6) before all this leads to a segmentation fault. |