From 0bff53b958d0a3310e138da1c240bcd089b68479 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 2 Sep 2001 14:40:51 +0000 Subject: File positions are off_t nowdays, not long, so: fseek -> fseeko ftell -> ftello NOTE: fseek/ftell not works for >long offsets per POSIX: [EOVERFLOW] For fseek( ), the resulting file offset would be a value which cannot be represented correctly in an object of type long. [EOVERFLOW] For ftell ( ), the current file offset cannot be represented correctly in an object of type long. --- usr.bin/mail/collect.c | 4 ++-- usr.bin/mail/edit.c | 4 ++-- usr.bin/mail/fio.c | 3 ++- usr.bin/mail/quit.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'usr.bin/mail') diff --git a/usr.bin/mail/collect.c b/usr.bin/mail/collect.c index 7331763..12fac37 100644 --- a/usr.bin/mail/collect.c +++ b/usr.bin/mail/collect.c @@ -458,7 +458,7 @@ mesedit(fp, c) FILE *nf = run_editor(fp, (off_t)-1, c, 0); if (nf != NULL) { - (void)fseek(nf, 0L, 2); + (void)fseeko(nf, (off_t)0, SEEK_END); collf = nf; (void)Fclose(fp); } @@ -508,7 +508,7 @@ mespipe(fp, cmd) /* * Take new files. */ - (void)fseek(nf, 0L, 2); + (void)fseeko(nf, (off_t)0, SEEK_END); collf = nf; (void)Fclose(fp); out: diff --git a/usr.bin/mail/edit.c b/usr.bin/mail/edit.c index 76d679d..e8d54de 100644 --- a/usr.bin/mail/edit.c +++ b/usr.bin/mail/edit.c @@ -111,8 +111,8 @@ edit1(msgvec, type) sigint = signal(SIGINT, SIG_IGN); fp = run_editor(setinput(mp), mp->m_size, type, readonly); if (fp != NULL) { - (void)fseek(otf, 0L, 2); - size = ftell(otf); + (void)fseeko(otf, (off_t)0, SEEK_END); + size = ftello(otf); mp->m_block = blockof(size); mp->m_offset = boffsetof(size); mp->m_size = fsize(fp); diff --git a/usr.bin/mail/fio.c b/usr.bin/mail/fio.c index 0a017ce..c9dcb94 100644 --- a/usr.bin/mail/fio.c +++ b/usr.bin/mail/fio.c @@ -201,7 +201,8 @@ setinput(mp) { (void)fflush(otf); - if (fseek(itf, (long)positionof(mp->m_block, mp->m_offset), 0) < 0) + if (fseeko(itf, + positionof(mp->m_block, mp->m_offset), SEEK_SET) < 0) err(1, "fseek"); return (itf); } diff --git a/usr.bin/mail/quit.c b/usr.bin/mail/quit.c index f2ba618..7831bb3 100644 --- a/usr.bin/mail/quit.c +++ b/usr.bin/mail/quit.c @@ -117,7 +117,7 @@ quit() (rbuf = Fdopen(fd, "w")) == NULL) goto newmail; #ifdef APPEND - (void)fseek(fbuf, (long)mailsize, 0); + (void)fseeko(fbuf, mailsize, SEEK_SET); while ((c = getc(fbuf)) != EOF) (void)putc(c, rbuf); #else @@ -442,7 +442,7 @@ edstop() relsesigs(); reset(0); } - (void)fseek(ibuf, (long)mailsize, 0); + (void)fseeko(ibuf, mailsize, SEEK_SET); while ((c = getc(ibuf)) != EOF) (void)putc(c, obuf); (void)Fclose(ibuf); -- cgit v1.1