James Youngman wrote: > ... searching for a constant needle in a large > number of haystacks. In such cases, the preparation only needs to be > done once at all. In the specific case of findutils, locate will > typically search for a single needle in one or two million haystacks. > Of course, locate also always knows the length of both the needle and > the haystack, too.
You need a different API for doing that. See [1] for a sketch (s/fnmatch/memmem/g). Bruno [1] http://lists.gnu.org/archive/html/bug-gnulib/2007-12/msg00071.html