/* Copyright (c) 1985 Regents of the University of California */
* These routines are for faster tag lookup. They support the binary
* search used in tagfind() instead of the linear search. The speedup
* is quite noticable looking for a tag at the end of a long tags
* file. Define FASTTAG in the Makefile to use these routines.
static char *sccsid
= "@(#)ex_tagio.c 7.4 (Berkeley) %G%";
static int b_size
= MAXBSIZE
;
if ((fd
= open(file
, O_RDONLY
, 0)) < 0)
if (fstat(fd
, &statb
) < 0) {
b_size
= statb
.st_blksize
;
nblock
= off
/ b_size
* b_size
;
if (lseek(fd
, nblock
, L_SET
) < 0)
if ((bcnt
= read(fd
, ibuf
, b_size
)) < 0)
if ((bcnt
= read(fd
, ibuf
, b_size
)) <= 0)
if ((bcnt
= read(fd
, ibuf
, b_size
)) <= 0) {
if ((*buf
++ = *cp
++) == '\n')