Subject: Re: RFC: memmem(3)
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-userlevel
Date: 03/02/2003 12:22:37
>      memmem(const void *b1, const void *b2, size_t len1, size_t len2);

For what it may be worth, for some time now I've had a private library
(called, for historical reasons, libsearchstr) that does basically
this, except

+ searching is usually much faster

+ there is a comparatively expensive setup call that must be done once
  the sought-for string is known

+ there's a maximum length on the sought-for string (approx. 255)

+ there's an equivalence table, permitting it to be used as a
  strcasestr, or for searching treating all digits identically, etc

If anyone's interested, let me know.  The C version is only 68 lines; I
also have .s versions for 68k, sparc, and vax.

The length limit could be raised to about 64k by doubling the size of
the table created by the setup call (shorts instead of chars).

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B