gcc/libf2c/libI77/uio.c
Kaveh R. Ghazi 1fc04640bb 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 13:01:12 +00:00

60 lines
1.4 KiB
C

#include "f2c.h"
#include "fio.h"
#include <sys/types.h>
uiolen f__reclen;
int
do_us (ftnint * number, char *ptr, ftnlen len)
{
if (f__reading)
{
f__recpos += (int) (*number * len);
if (f__recpos > f__reclen)
err (f__elist->cierr, 110, "do_us");
if (fread (ptr, (size_t) len, (size_t) (*number), f__cf) != (size_t) *number)
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);
}
}
integer
do_ud (ftnint * number, char *ptr, ftnlen len)
{
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)
{
#ifdef Pad_UDread
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");
if (i < (size_t) *number)
memset (ptr + i * len, 0, (*number - i) * len);
return 0;
#else
if (fread (ptr, (size_t) len, (size_t) (*number), f__cf) != *number)
err (f__elist->cierr, EOF, "do_ud");
else
return (0);
#endif
}
(void) fwrite (ptr, (size_t) len, (size_t) (*number), f__cf);
return (0);
}
integer
do_uio (ftnint * number, char *ptr, ftnlen len)
{
if (f__sequential)
return (do_us (number, ptr, len));
else
return (do_ud (number, ptr, len));
}