2002-06-04 10:25:48 +08:00
|
|
|
#include "config.h"
|
1998-02-01 09:37:08 +08:00
|
|
|
#include "f2c.h"
|
|
|
|
#include "fio.h"
|
|
|
|
#include <sys/types.h>
|
|
|
|
uiolen f__reclen;
|
|
|
|
|
main.c (main): Avoid implicit int.
* libF77/main.c (main): Avoid implicit int.
* libI77/dfe.c (y_rsk, y_getc, c_dfe): Likewise.
* libI77/due.c (c_due): Likewise.
* libI77/err.c (f__canseek, f__nowreading, f__nowwriting):
Likewise.
* libI77/fmt.c (op_gen, ne_d, e_d, pars_f, type_f, en_fio):
Likewise.
* libI77/iio.c (z_getc, z_rnew, c_si, z_wnew): Likewise.
* libI77/lread.c (t_getc, c_le, l_read): Likewise.
* libI77/lwrite.c (l_write): Likewise.
* libI77/open.c (fk_open): Likewise.
* libI77/rdfmt.c (rd_ed, rd_ned): Likewise.
* libI77/rsfe.c (xrd_SL, x_getc, x_endp, x_rev): Likewise.
* libI77/rsne.c (t_getc, x_rsne): Likewise.
* libI77/sfe.c (c_sfe): Likewise.
* libI77/sue.c (c_sue): Likewise.
* libI77/uio.c (do_us): Likewise.
* libI77/wref.c (wrt_E, wrt_F): Likewise.
* libI77/wrtfmt.c (wrt_L, w_ed, w_ned): Likewise.
From-SVN: r54169
2002-06-02 21:01:12 +08:00
|
|
|
int
|
2002-06-01 20:38:32 +08:00
|
|
|
do_us (ftnint * number, char *ptr, ftnlen len)
|
1998-02-01 09:37:08 +08:00
|
|
|
{
|
2002-06-01 20:38:32 +08:00
|
|
|
if (f__reading)
|
|
|
|
{
|
|
|
|
f__recpos += (int) (*number * len);
|
|
|
|
if (f__recpos > f__reclen)
|
|
|
|
err (f__elist->cierr, 110, "do_us");
|
2002-06-02 20:54:28 +08:00
|
|
|
if (fread (ptr, (size_t) len, (size_t) (*number), f__cf) != (size_t) *number)
|
2002-06-01 20:38:32 +08:00
|
|
|
err (f__elist->ciend, EOF, "do_us");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
f__reclen += *number * len;
|
|
|
|
(void) fwrite (ptr, (size_t) len, (size_t) (*number), f__cf);
|
|
|
|
return (0);
|
|
|
|
}
|
1998-02-01 09:37:08 +08:00
|
|
|
}
|
2002-06-01 20:38:32 +08:00
|
|
|
integer
|
|
|
|
do_ud (ftnint * number, char *ptr, ftnlen len)
|
1998-02-01 09:37:08 +08:00
|
|
|
{
|
2002-06-01 20:38:32 +08:00
|
|
|
f__recpos += (int) (*number * len);
|
|
|
|
if (f__recpos > f__curunit->url && f__curunit->url != 1)
|
|
|
|
err (f__elist->cierr, 110, "do_ud");
|
|
|
|
if (f__reading)
|
|
|
|
{
|
1998-02-01 09:37:08 +08:00
|
|
|
#ifdef Pad_UDread
|
2002-06-01 20:38:32 +08:00
|
|
|
size_t i;
|
|
|
|
if (!(i = fread (ptr, (size_t) len, (size_t) (*number), f__cf))
|
|
|
|
&& !(f__recpos - *number * len))
|
|
|
|
err (f__elist->cierr, EOF, "do_ud");
|
2002-06-02 20:54:28 +08:00
|
|
|
if (i < (size_t) *number)
|
2002-06-01 20:38:32 +08:00
|
|
|
memset (ptr + i * len, 0, (*number - i) * len);
|
|
|
|
return 0;
|
1998-02-01 09:37:08 +08:00
|
|
|
#else
|
2002-06-01 20:38:32 +08:00
|
|
|
if (fread (ptr, (size_t) len, (size_t) (*number), f__cf) != *number)
|
|
|
|
err (f__elist->cierr, EOF, "do_ud");
|
|
|
|
else
|
|
|
|
return (0);
|
1998-02-01 09:37:08 +08:00
|
|
|
#endif
|
2002-06-01 20:38:32 +08:00
|
|
|
}
|
|
|
|
(void) fwrite (ptr, (size_t) len, (size_t) (*number), f__cf);
|
|
|
|
return (0);
|
1998-02-01 09:37:08 +08:00
|
|
|
}
|
2002-06-01 20:38:32 +08:00
|
|
|
|
|
|
|
integer
|
|
|
|
do_uio (ftnint * number, char *ptr, ftnlen len)
|
1998-02-01 09:37:08 +08:00
|
|
|
{
|
2002-06-01 20:38:32 +08:00
|
|
|
if (f__sequential)
|
|
|
|
return (do_us (number, ptr, len));
|
|
|
|
else
|
|
|
|
return (do_ud (number, ptr, len));
|
1998-02-01 09:37:08 +08:00
|
|
|
}
|