diff options
author | obrien <obrien@FreeBSD.org> | 2002-05-09 22:47:59 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-05-09 22:47:59 +0000 |
commit | eb81e01d5162436a00b210305c91bbba234a0238 (patch) | |
tree | 1b3e8ec0841ab566eb88884cc3596cdc79bbdd34 /contrib/libf2c/libI77/endfile.c | |
parent | c8f5fc7032940ad6633f932ac40cade82ec4d0cc (diff) | |
download | FreeBSD-src-eb81e01d5162436a00b210305c91bbba234a0238.zip FreeBSD-src-eb81e01d5162436a00b210305c91bbba234a0238.tar.gz |
Gcc 3.1.0 pre-release's libf2c bits from the FSF anoncvs repo on
9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/libf2c/libI77/endfile.c')
-rw-r--r-- | contrib/libf2c/libI77/endfile.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/contrib/libf2c/libI77/endfile.c b/contrib/libf2c/libI77/endfile.c index 980c91d..4c5a9dd 100644 --- a/contrib/libf2c/libI77/endfile.c +++ b/contrib/libf2c/libI77/endfile.c @@ -70,7 +70,7 @@ t_runc(a) alist *a; t_runc(alist *a) #endif { - long loc, len; + off_t loc, len; unit *b; int rc; FILE *bf; @@ -81,9 +81,9 @@ t_runc(alist *a) b = &f__units[a->aunit]; if(b->url) return(0); /*don't truncate direct files*/ - loc=ftell(bf = b->ufd); - fseek(bf,0L,SEEK_END); - len=ftell(bf); + loc=FTELL(bf = b->ufd); + FSEEK(bf,0,SEEK_END); + len=FTELL(bf); if (loc >= len || b->useek == 0 || b->ufnm == NULL) return(0); #ifndef HAVE_FTRUNCATE @@ -111,7 +111,7 @@ t_runc(alist *a) } if (!(bf = freopen(b->ufnm, f__w_mode[0], bf))) goto bad1; - rewind(tf); + FSEEK(tf, 0, SEEK_SET); if (copy(tf, loc, bf)) goto bad1; b->uwrt = 1; @@ -121,7 +121,7 @@ t_runc(alist *a) fclose(bf); if (!(bf = fopen(b->ufnm, f__w_mode[3]))) goto bad; - fseek(bf,0L,SEEK_END); + FSEEK(bf,0,SEEK_END); b->urw = 3; } #endif @@ -131,7 +131,8 @@ done: f__cf = b->ufd = bf; #else /* !defined(HAVE_FTRUNCATE) */ fflush(b->ufd); - rc = ftruncate(fileno(b->ufd), (off_t)loc); + rc = ftruncate(fileno(b->ufd), loc); + FSEEK(bf,loc,SEEK_SET); #endif /* !defined(HAVE_FTRUNCATE) */ if (rc) err(a->aerr,111,"endfile"); |