plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit b707cb51ed57c8d189a2e9f96ee31fa41a63e18c
parent d9e16d252a4f84a6b30a7837ed6524e2dffec5ec
Author: rsc <devnull@localhost>
Date:   Sun, 13 Jun 2004 20:08:00 +0000

handle 64-bit file sizes

Diffstat:
Msrc/cmd/look.c | 4++--
Msrc/cmd/tail.c | 14+++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/cmd/look.c b/src/cmd/look.c @@ -162,8 +162,8 @@ main(int argc, char *argv[]) int locate(void) { - long top, bot, mid; - long c; + vlong top, bot, mid; + int c; int n; bot = 0; diff --git a/src/cmd/tail.c b/src/cmd/tail.c @@ -8,7 +8,7 @@ * the simple command tail -c, legal in v10, is illegal */ -long count; +vlong count; int anycount; int follow; int file = 0; @@ -41,7 +41,7 @@ extern void suffix(char*); extern long tread(char*, long); #define trunc tailtrunc extern void trunc(Dir*, Dir**); -extern long tseek(long, int); +extern vlong tseek(vlong, int); extern void twrite(char*, long); extern void usage(void); @@ -85,7 +85,7 @@ main(int argc, char **argv) if(dir==REV && (units==CHARS || follow || origin==BEG)) fatal("incompatible options"); if(!anycount) - count = dir==REV? ~0UL>>1: 10; + count = dir==REV? ~0ULL>>1: 10; if(origin==BEG && units==LINES && count>0) count--; if(argc > 2) @@ -126,7 +126,7 @@ void trunc(Dir *old, Dir **new) { Dir *d; - ulong olength; + vlong olength; d = dirfstat(file); if(d == nil) @@ -268,7 +268,7 @@ reverse(void) long n = 0; long bufsiz = 0; char *buf = 0; - long pos = tseek(0L, 2); + vlong pos = tseek(0L, 2); for(first=1; pos>0 && count>0; first=0) { n = pos>Bsize? Bsize: (int)pos; @@ -301,8 +301,8 @@ reverse(void) twrite(buf, len); } -long -tseek(long o, int p) +vlong +tseek(vlong o, int p) { o = seek(file, o, p); if(o == -1)