bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bsearch utility


From: Paul Eggert
Subject: Re: bsearch utility
Date: Thu, 21 Jul 2005 16:58:38 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Thanks for starting on this.  Here's a quick reaction.

We should be implementing something upward-compatible with BSD
look(1).  Visit <http://www.freebsd.org/cgi/man.cgi>, type "look", and
see the resulting man page.

You don't need to create a man page.  They are created automatically,
from --help output.  However, you do need to modify
doc/coreutils.texi.

There's a lot of code duplication between bsearch and source.
The common stuff should be factored out.

Always check for failure from every system call.  E.g., fstat might
fail.

Please use the same coding style (e.g., indenting) that coreutils
already uses.

Why not use binary_search if the file is seekable?  Some files are not
regular files, but are still seekable.

You should use an interpolating search rather than a straight binary
search.  That is much faster for the common case of looking something
up in /usr/dict/words.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]