summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authorwiz <wiz@NetBSD.org>2001-04-09 12:07:57 +0000
committerwiz <wiz@NetBSD.org>2001-04-09 12:07:57 +0000
commit13e4a787c0b1ed239bbc28f6ecd5ecf3d92832e5 (patch)
tree2003deb40cfc18a3ba16542222570c8f582b87f8 /lib/libc/string
parenta69e2f13109bc01a022e668b208f3c3576767ae5 (diff)
mdoc'ify
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/bm.3103
1 files changed, 52 insertions, 51 deletions
diff --git a/lib/libc/string/bm.3 b/lib/libc/string/bm.3
index d251588222d..7e9a98a9c89 100644
--- a/lib/libc/string/bm.3
+++ b/lib/libc/string/bm.3
@@ -1,3 +1,5 @@
+.\" $NetBSD: bm.3,v 1.4 2001/04/09 12:07:57 wiz Exp $
+.\"
.\" Copyright (c) 1994
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -33,82 +35,81 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)bm.3 8.4 (Berkeley) 6/21/94
-.\" $NetBSD: bm.3,v 1.3 1997/10/09 10:08:23 lukem Exp $
.\"
-.TH BM 3
-.SH NAME
-bm_comp, bm_exec, bm_free \- Boyer-Moore string search
-.SH SYNOPSIS
-.ft B
-#include <sys/types.h>
-.br
-#include <bm.h>
-.sp
-bm_pat *
-.br
-bm_comp(u_char *pattern, size_t patlen, u_char freq[256]);
-.sp
-u_char *
-.br
-bm_exec(bm_pat *pdesc, u_char *text, size_t len);
-.sp
-void
-.br
-bm_free(bm_pat *pdesc);
-.SH DESCRIPTION
+.Dd April 8, 2001
+.Dt BM 3
+.Os
+.Sh NAME
+.Nm bm_comp ,
+.Nm bm_exec ,
+.Nm bm_free
+.Nd Boyer-Moore string search
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <bm.h>
+.Ft bm_pat *
+.Fn bm_comp "u_char *pattern" "size_t patlen" "u_char freq[256]"
+.Ft u_char *
+.Fn bm_exec "bm_pat *pdesc" "u_char *text" "size_t len"
+.Ft void
+.Fn bm_free "bm_pat *pdesc"
+.Sh DESCRIPTION
These routines implement an efficient mechanism to find an
occurrence of a byte string within another byte string.
-.PP
-.I Bm_comp
+.Pp
+.Fn bm_comp
evaluates the
-.I patlen
+.Fa patlen
bytes starting at
-.IR pattern ,
+.Fa pattern ,
and returns a pointer to a structure describing them.
The bytes referenced by
-.I pattern
+.Fa pattern
may be of any value.
-.PP
+.Pp
The search takes advantage of the frequency distribution of the
bytes in the text to be searched.
If specified,
-.I freq
+.Fa freq
should be an array of 256 values,
with higher values indicating that the corresponding character occurs
more frequently.
(A less than optimal frequency distribution can only result in less
than optimal performance, not incorrect results.)
If
-.I freq
+.Fa freq
is NULL,
a system default table is used.
-.PP
-.I Bm_exec
+.Pp
+.Fn bm_exec
returns a pointer to the leftmost occurrence of the string given to
-.I bm_comp
+.Fn bm_comp
within
-.IR text ,
+.Fa text ,
or NULL if none occurs.
The number of bytes in
-.I text
+.Fa text
must be specified by
-.IR len .
-.PP
+.Fa len .
+.Pp
Space allocated for the returned description is discarded
by calling
-.I bm_free
+.Fn bm_free
with the returned description as an argument.
-.PP
+.Pp
The asymptotic speed of
-.I bm_exec
-is
-.RI O( len / patlen ).
-.PP
-.SH "SEE ALSO"
-.IR regexp (3),
-.IR strstr (3)
-.sp
-.IR "Fast String Searching" ,
-Hume and Sunday,
-Software Practice and Experience,
-Vol. 21, 11 (November 1991) pp. 1221-48.
+.Fn bm_exec
+is O(len/patlen).
+.Sh SEE ALSO
+.Xr regexp 3 ,
+.Xr strstr 3
+.Rs
+.%A Hume and Sunday
+.%D November 1991
+.%J "Software Practice and Experience"
+.%P pp. 1221-48
+.%T "Fast String Searching"
+.%V Vol. 21, 11
+.Re