diff options
| author | itojun <itojun@NetBSD.org> | 2004-02-16 21:57:04 +0000 |
|---|---|---|
| committer | itojun <itojun@NetBSD.org> | 2004-02-16 21:57:04 +0000 |
| commit | 7551fb024f2ebb3a29db60f29d4a3496a72f045d (patch) | |
| tree | b5136232440f816223a11a68ede70cc7130b10cb /usr.bin | |
| parent | bb3980ab7adf25719ba74ccdb2d48d147dbd81f0 (diff) | |
do not use long for file offset, use off_t. otto@openbsd
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/tail/extern.h | 6 | ||||
| -rw-r--r-- | usr.bin/tail/forward.c | 14 | ||||
| -rw-r--r-- | usr.bin/tail/reverse.c | 10 | ||||
| -rw-r--r-- | usr.bin/tail/tail.c | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/usr.bin/tail/extern.h b/usr.bin/tail/extern.h index e940861d02f..55607ccc94b 100644 --- a/usr.bin/tail/extern.h +++ b/usr.bin/tail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.7 2003/08/07 11:16:01 agc Exp $ */ +/* $NetBSD: extern.h,v 1.8 2004/02/16 21:57:04 itojun Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,8 +37,8 @@ enum STYLE { NOTSET = 0, FBYTES, FLINES, RBYTES, RLINES, REVERSE }; -void forward(FILE *, enum STYLE, long, struct stat *); -void reverse(FILE *, enum STYLE, long, struct stat *); +void forward(FILE *, enum STYLE, off_t, struct stat *); +void reverse(FILE *, enum STYLE, off_t, struct stat *); int bytes(FILE *, off_t); int lines(FILE *, off_t); diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index eb03b92fe4a..34d02c6fe66 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -1,4 +1,4 @@ -/* $NetBSD: forward.c,v 1.25 2003/08/07 11:16:01 agc Exp $ */ +/* $NetBSD: forward.c,v 1.26 2004/02/16 21:57:04 itojun Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: forward.c,v 1.25 2003/08/07 11:16:01 agc Exp $"); +__RCSID("$NetBSD: forward.c,v 1.26 2004/02/16 21:57:04 itojun Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -55,7 +55,7 @@ __RCSID("$NetBSD: forward.c,v 1.25 2003/08/07 11:16:01 agc Exp $"); #include <string.h> #include "extern.h" -static int rlines(FILE *, long, struct stat *); +static int rlines(FILE *, off_t, struct stat *); /* defines for inner loop actions */ #define USE_SLEEP 0 @@ -85,7 +85,7 @@ static int rlines(FILE *, long, struct stat *); * NOREG cyclically read lines into a wrap-around array of buffers */ void -forward(FILE *fp, enum STYLE style, long int off, struct stat *sbp) +forward(FILE *fp, enum STYLE style, off_t off, struct stat *sbp) { int ch, n; int kq=-1, action=USE_SLEEP; @@ -105,7 +105,7 @@ forward(FILE *fp, enum STYLE style, long int off, struct stat *sbp) if (S_ISREG(sbp->st_mode)) { if (sbp->st_size < off) off = sbp->st_size; - if (fseek(fp, off, SEEK_SET) == -1) { + if (fseeko(fp, off, SEEK_SET) == -1) { ierr(); return; } @@ -136,7 +136,7 @@ forward(FILE *fp, enum STYLE style, long int off, struct stat *sbp) case RBYTES: if (S_ISREG(sbp->st_mode)) { if (sbp->st_size >= off && - fseek(fp, -off, SEEK_END) == -1) { + fseeko(fp, -off, SEEK_END) == -1) { ierr(); return; } @@ -277,7 +277,7 @@ forward(FILE *fp, enum STYLE style, long int off, struct stat *sbp) * Non-zero return means than a (non-fatal) error occurred. */ static int -rlines(FILE *fp, long int off, struct stat *sbp) +rlines(FILE *fp, off_t off, struct stat *sbp) { off_t file_size; off_t file_remaining; diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index 9ab09c236bb..2bcf20b8e59 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -1,4 +1,4 @@ -/* $NetBSD: reverse.c,v 1.15 2003/08/07 11:16:02 agc Exp $ */ +/* $NetBSD: reverse.c,v 1.16 2004/02/16 21:57:04 itojun Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: reverse.c,v 1.15 2003/08/07 11:16:02 agc Exp $"); +__RCSID("$NetBSD: reverse.c,v 1.16 2004/02/16 21:57:04 itojun Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -53,7 +53,7 @@ __RCSID("$NetBSD: reverse.c,v 1.15 2003/08/07 11:16:02 agc Exp $"); #include "extern.h" static void r_buf(FILE *); -static void r_reg(FILE *, enum STYLE, long, struct stat *); +static void r_reg(FILE *, enum STYLE, off_t, struct stat *); /* * reverse -- display input in reverse order by line. @@ -74,7 +74,7 @@ static void r_reg(FILE *, enum STYLE, long, struct stat *); * NOREG cyclically read input into a linked list of buffers */ void -reverse(FILE *fp, enum STYLE style, long int off, struct stat *sbp) +reverse(FILE *fp, enum STYLE style, off_t off, struct stat *sbp) { if (style != REVERSE && off == 0) return; @@ -103,7 +103,7 @@ reverse(FILE *fp, enum STYLE style, long int off, struct stat *sbp) * r_reg -- display a regular file in reverse order by line. */ static void -r_reg(FILE *fp, enum STYLE style, long int off, struct stat *sbp) +r_reg(FILE *fp, enum STYLE style, off_t off, struct stat *sbp) { off_t size; int llen; diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c index 9648495811a..7f6c3049f5a 100644 --- a/usr.bin/tail/tail.c +++ b/usr.bin/tail/tail.c @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ #if 0 static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: tail.c,v 1.11 2003/08/07 11:16:03 agc Exp $"); +__RCSID("$NetBSD: tail.c,v 1.12 2004/02/16 21:57:04 itojun Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -64,7 +64,7 @@ main(int argc, char *argv[]) { struct stat sb; FILE *fp; - long off; + off_t off; enum STYLE style; int ch, first; char *p; @@ -85,7 +85,7 @@ main(int argc, char *argv[]) #define ARG(units, forward, backward) { \ if (style) \ usage(); \ - off = strtol(optarg, &p, 10) * (units); \ + off = strtoll(optarg, &p, 10) * (units); \ if (*p) \ err(1, "illegal offset -- %s", optarg); \ switch(optarg[0]) { \ |
