summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraaron <>1999-06-29 17:49:24 +0000
committeraaron <>1999-06-29 17:49:24 +0000
commite5791ef4d456e0071415b711d9969fb50535b063 (patch)
treed0b040d51012c77f9cd08cc467a67a62aabb119a
parent4ea419d50dea9afe08224089edf11a126f2aa8bd (diff)
downloadopenbsd-e5791ef4d456e0071415b711d9969fb50535b063.tar.gz
openbsd-e5791ef4d456e0071415b711d9969fb50535b063.tar.bz2
openbsd-e5791ef4d456e0071415b711d9969fb50535b063.zip
new mdoc bm(3) man page
-rw-r--r--src/lib/libc/string/bm.3107
1 files changed, 54 insertions, 53 deletions
diff --git a/src/lib/libc/string/bm.3 b/src/lib/libc/string/bm.3
index 5b92b8e4f1..afab2334db 100644
--- a/src/lib/libc/string/bm.3
+++ b/src/lib/libc/string/bm.3
@@ -32,82 +32,83 @@
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE. 33.\" SUCH DAMAGE.
34.\" 34.\"
35.\" $OpenBSD: bm.3,v 1.3 1999/05/28 01:57:37 aaron Exp $ 35.\" $OpenBSD: bm.3,v 1.4 1999/06/29 17:49:24 aaron Exp $
36.\" 36.\"
37.TH BM 3 37.Dd June 29, 1999
38.SH NAME 38.Dt BM 3
39bm_comp, bm_exec, bm_free \- Boyer-Moore string search 39.Os
40.SH SYNOPSIS 40.Sh NAME
41.ft B 41.Nm bm_comp ,
42#include <sys/types.h> 42.Nm bm_exec ,
43.br 43.Nm bm_free
44#include <bm.h> 44.Nd Boyer-Moore string search
45.sp 45.Sh SYNOPSIS
46bm_pat * 46.Fd #include <sys/types.h>
47.br 47.Fd #include <bm.h>
48bm_comp(u_char *pattern, size_t patlen, u_char freq[256]); 48.Ft bm_pat *
49.sp 49.Fn bm_comp "u_char *pattern" "size_t patlen" "u_char freq[256]"
50u_char * 50.Ft u_char *
51.br 51.Fn bm_exec "bm_pat *pdesc" "u_char *text" "size_t len"
52bm_exec(bm_pat *pdesc, u_char *text, size_t len); 52.Ft void
53.sp 53.Fn bm_free "bm_pat *pdesc"
54void 54.Sh DESCRIPTION
55.br
56bm_free(bm_pat *pdesc);
57.SH DESCRIPTION
58These routines implement an efficient mechanism to find an 55These routines implement an efficient mechanism to find an
59occurrence of a byte string within another byte string. 56occurrence of a byte string within another byte string.
60.PP 57.Pp
61.I Bm_comp 58.Fn bm_comp
62evaluates the 59evaluates
63.I patlen 60.Fa patlen
64bytes starting at 61bytes starting at
65.IR pattern , 62.Fa pattern ,
66and returns a pointer to a structure describing them. 63and returns a pointer to a structure describing them.
67The bytes referenced by 64The bytes referenced by
68.I pattern 65.Fa pattern
69may be of any value. 66may be of any value.
70.PP 67.Pp
71The search takes advantage of the frequency distribution of the 68The search takes advantage of the frequency distribution of the
72bytes in the text to be searched. 69bytes in the text to be searched.
73If specified, 70If specified,
74.I freq 71.Ar freq
75should be an array of 256 values, 72should be an array of 256 values,
76with higher values indicating that the corresponding character occurs 73with higher values indicating that the corresponding character occurs
77more frequently. 74more frequently.
78(A less than optimal frequency distribution can only result in less 75(A less than optimal frequency distribution can only result in less
79than optimal performance, not incorrect results.) 76than optimal performance, not incorrect results.)
80If 77If
81.I freq 78.Ar freq
82is NULL, 79is
80.Dv NULL ,
83a system default table is used. 81a system default table is used.
84.PP 82.Pp
85.I Bm_exec 83.Fn bm_exec
86returns a pointer to the leftmost occurrence of the string given to 84returns a pointer to the leftmost occurrence of the string given to
87.I bm_comp 85.Fn bm_comp
88within 86within
89.IR text , 87.Ar text ,
90or NULL if none occurs. 88or
89.Dv NULL
90if none occurs.
91The number of bytes in 91The number of bytes in
92.I text 92.Ar text
93must be specified by 93must be specified by
94.IR len . 94.Ar len .
95.PP 95.Pp
96Space allocated for the returned description is discarded 96Space allocated for the returned description is discarded
97by calling 97by calling
98.I bm_free 98.Fn bm_free
99with the returned description as an argument. 99with the returned description as an argument.
100.PP 100.Pp
101The asymptotic speed of 101The asymptotic speed of
102.I bm_exec 102.Fn bm_exec
103is 103is
104.RI O( len / patlen ). 104.Pf O Ns Pq len / patlen .
105.PP 105.Sh SEE ALSO
106.SH SEE ALSO 106.Xr regexp 3 ,
107.IR regexp (3), 107.Xr strstr 3
108.IR strstr (3) 108.Rs
109.sp 109.%R "Fast String Searching"
110.IR "Fast String Searching" , 110.%A "Hume and Sunday"
111Hume and Sunday, 111.%J "Software Practice and Experience"
112Software Practice and Experience, 112.%V Volume 21, 11 (November 1991)
113Vol. 21, 11 (November 1991) pp. 1221-48. 113.%P 1221-48
114.Re