f8d92613d0
2001-07-06 Toon Moene <toon@moene.indiv.nluug.nl> Pedro Vazquez <vazquez@penelope.iqm.unicamp.br> * configure.in: Check for fseeko, ftello. * configure: Rebuilt. * config.h.in: Rebuilt. * fio.h: Define FSEEK to be fseek or fseeko, depending on configure's findings. Ditto for FTELL and ftell / ftello. * backspace.c (f_back): Use FSEEK for fseek, FTELL for ftell. * dfe.c (c_dfe): Ditto. * due.c (c_due, e_rdue): Ditto. * endfile.c (t_runc): Ditto. * err.c (f__nowreading, f__nowwriting): Ditto. * ftell_.c (G77_ftell_0, G77_fseek_0): Ditto. * inquire.c (f_inqu): Ditto. * open.c (f_open): Ditto. * rdfmt.c (rd_ed): Ditto. * sue.c (s_wsue, e_wsue, e_rsue): Ditto. Co-Authored-By: Pedro Vazquez <vazquez@penelope.iqm.unicamp.br> From-SVN: r43806
48 lines
877 B
C
48 lines
877 B
C
#include "config.h"
|
|
#include "f2c.h"
|
|
#include "fio.h"
|
|
|
|
static FILE *
|
|
#ifdef KR_headers
|
|
unit_chk(Unit, who) integer Unit; char *who;
|
|
#else
|
|
unit_chk(integer Unit, char *who)
|
|
#endif
|
|
{
|
|
if (Unit >= MXUNIT || Unit < 0)
|
|
f__fatal(101, who);
|
|
return f__units[Unit].ufd;
|
|
}
|
|
|
|
off_t
|
|
#ifdef KR_headers
|
|
G77_ftell_0 (Unit) integer *Unit;
|
|
#else
|
|
G77_ftell_0 (integer *Unit)
|
|
#endif
|
|
{
|
|
FILE *f;
|
|
return (f = unit_chk(*Unit, "ftell")) ? FTELL(f) : -1L;
|
|
}
|
|
|
|
integer
|
|
#ifdef KR_headers
|
|
G77_fseek_0 (Unit, offset, xwhence) integer *Unit, *offset, *xwhence;
|
|
#else
|
|
G77_fseek_0 (integer *Unit, integer *offset, integer *xwhence)
|
|
#endif
|
|
{
|
|
FILE *f;
|
|
int w = (int)*xwhence;
|
|
#ifdef SEEK_SET
|
|
static int wohin[3] = { SEEK_SET, SEEK_CUR, SEEK_END };
|
|
#endif
|
|
if (w < 0 || w > 2)
|
|
w = 0;
|
|
#ifdef SEEK_SET
|
|
w = wohin[w];
|
|
#endif
|
|
return !(f = unit_chk(*Unit, "fseek"))
|
|
|| FSEEK(f, *offset, w) ? 1 : 0;
|
|
}
|