re PR libf2c/11918 (isatty does not call f_init)

2003-09-21  Toon Moene  <toon@moene.indiv.nluug.nl>

	PR libf2c/11918
	* fstat_.c: Call f_init().
	* isatty_.c: Ditto.
	* fnum_.c: Check file descriptor before handing it back.

From-SVN: r71628
This commit is contained in:
Toon Moene 2003-09-21 18:16:46 +02:00 committed by Toon Moene
parent fa543fdda1
commit e94915267b
4 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2003-09-21 Toon Moene <toon@moene.indiv.nluug.nl>
PR libf2c/11918
* fstat_.c: Call f_init().
* isatty_.c: Ditto.
* fnum_.c: Check file descriptor before handing it back.
Tue Sep 9 15:22:57 2003 Alan Modra <amodra@bigpond.net.au> Tue Sep 9 15:22:57 2003 Alan Modra <amodra@bigpond.net.au>
* configure: Regenerate. * configure: Regenerate.

View File

@ -27,6 +27,10 @@ G77_fnum_0 (integer * lunit)
{ {
if (*lunit >= MXUNIT || *lunit < 0) if (*lunit >= MXUNIT || *lunit < 0)
err (1, 101, "fnum"); err (1, 101, "fnum");
if (f__units[*lunit].ufd == NULL)
err (1, 114, "fnum");
/* f__units is a table of descriptions for the unit numbers (defined /* f__units is a table of descriptions for the unit numbers (defined
in io.h). Use file descriptor (ufd) and fileno rather than udev in io.h). Use file descriptor (ufd) and fileno rather than udev
field since udev is unix specific */ field since udev is unix specific */

View File

@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h" #include "config.h"
#endif #endif
#include "f2c.h" #include "f2c.h"
#include "fio.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -34,6 +35,7 @@ G77_fstat_0 (const integer * lunit, integer statb[13])
int err; int err;
struct stat buf; struct stat buf;
if (f__init != 1) f_init();
err = fstat (G77_fnum_0 (lunit), &buf); err = fstat (G77_fnum_0 (lunit), &buf);
statb[0] = buf.st_dev; statb[0] = buf.st_dev;
statb[1] = buf.st_ino; statb[1] = buf.st_ino;

View File

@ -30,6 +30,7 @@ extern integer G77_fnum_0 (integer *);
logical logical
G77_isatty_0 (integer * lunit) G77_isatty_0 (integer * lunit)
{ {
if (f__init != 1) f_init();
if (*lunit >= MXUNIT || *lunit < 0) if (*lunit >= MXUNIT || *lunit < 0)
err (1, 101, "isatty"); err (1, 101, "isatty");
/* f__units is a table of descriptions for the unit numbers (defined /* f__units is a table of descriptions for the unit numbers (defined