Here are routines to perform fast string searches using the
Boyer-Moore-Gosper algorithm; they can be used in any Unix program (and
should be portable to non-Unix systems). You can search either a file
or a buffer in memory.
The code is mostly due to James A. Woods ([email protected]
although I have modified it heavily, so all bugs are my fault. The
original code is from his sped-up version of egrep, recently posted on
mod.sources and available via anonymous FTP from ames-aurora.arpa as
pub/egrep.one and pub/egrep.two. That code handles regular
expressions; mine does not.
The files included here are
MakefileCan be modified for 4.xBSD or Sys V compilation
bmgsubs.cThe search code
bmgtest.cTest program (example of file searching)
bmgtest2.cAnother test program, showing buffer searching
These have only been tested on 4.2BSD Vax systems.
-Jeff Mogul[email protected]