From ef3ac225d43f08544fd2f6bbb0da41bedb60f965 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 2 Apr 2006 00:55:33 +0000 Subject: use SEEK_* for lseek() --- usr.bin/less/ch.c | 6 +++--- usr.bin/less/decode.c | 2 +- usr.bin/less/edit.c | 2 +- usr.bin/less/filename.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.bin/less/ch.c b/usr.bin/less/ch.c index 0966dca9872..b96fbc12f49 100644 --- a/usr.bin/less/ch.c +++ b/usr.bin/less/ch.c @@ -190,7 +190,7 @@ fch_get() */ if (!(ch_flags & CH_CANSEEK)) return ('?'); - if (lseek(ch_file, (off_t)pos, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { error("seek error", NULL_PARG); clear_eol(); @@ -620,7 +620,7 @@ ch_flush() } #endif - if (lseek(ch_file, (off_t)0, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)0, SEEK_SET) == BAD_LSEEK) { /* * Warning only; even if the seek fails for some reason, @@ -709,7 +709,7 @@ seekable(f) return (0); } #endif - return (lseek(f, (off_t)1, 0) != BAD_LSEEK); + return (lseek(f, (off_t)1, SEEK_SET) != BAD_LSEEK); } /* diff --git a/usr.bin/less/decode.c b/usr.bin/less/decode.c index 1737327855f..586b98afa97 100644 --- a/usr.bin/less/decode.c +++ b/usr.bin/less/decode.c @@ -681,7 +681,7 @@ lesskey(filename, sysvar) close(f); return (-1); } - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) { free(buf); close(f); diff --git a/usr.bin/less/edit.c b/usr.bin/less/edit.c index bc0eca8dd3e..564ad5e9398 100644 --- a/usr.bin/less/edit.c +++ b/usr.bin/less/edit.c @@ -724,7 +724,7 @@ loop: * Append: open the file and seek to the end. */ logfile = open(filename, OPEN_APPEND); - if (lseek(logfile, (off_t)0, 2) == BAD_LSEEK) + if (lseek(logfile, (off_t)0, SEEK_END) == BAD_LSEEK) { close(logfile); logfile = -1; diff --git a/usr.bin/less/filename.c b/usr.bin/less/filename.c index 4e76843c95b..40c52c1d85a 100644 --- a/usr.bin/less/filename.c +++ b/usr.bin/less/filename.c @@ -492,7 +492,7 @@ bin_file(f) if (!seekable(f)) return (0); - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) return (0); n = read(f, data, sizeof(data)); for (i = 0; i < n; i++) @@ -510,7 +510,7 @@ seek_filesize(f) { off_t spos; - spos = lseek(f, (off_t)0, 2); + spos = lseek(f, (off_t)0, SEEK_END); if (spos == BAD_LSEEK) return (NULL_POSITION); return ((POSITION) spos); -- cgit v1.2.3