xref: /original-bsd/lib/libc/locale/mbrune.3 (revision e58c8952)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Paul Borman at Krystal Technologies.
6.\"
7.\" %sccs.include.redist.roff%
8.\"
9.\"	@(#)mbrune.3	8.2 (Berkeley) 04/19/94
10.\"
11.Dd ""
12.Dt MBRUNE 3
13.Os
14.Sh NAME
15.Nm mbrune ,
16.Nm mbrrune ,
17.Nm mbmb
18.Nd multibyte rune support for C
19.Sh SYNOPSIS
20.Fd #include <rune.h>
21.Ft char *
22.Fn mbrune "const char *string" "rune_t rune"
23.Ft char *
24.Fn mbrrune "const char *string" "rune_t rune"
25.Ft char *
26.Fn mbmb "const char *string" "char *pattern"
27.Sh DESCRIPTION
28These routines provide the corresponding functionality of
29.Fn strchr ,
30.Fn strrchr
31and
32.Fn strstr
33for multibyte strings.
34.Pp
35The
36.Fn mbrune
37function locates the first occurrence of
38.Fn rune
39in the string pointed to by
40.Ar string .
41The terminating
42.Dv NULL
43character is considered part of the string.
44If
45.Fa rune
46is
47.Ql \e0 ,
48.Fn mbrune
49locates the terminating
50.Ql \e0 .
51.Pp
52The
53.Fn mbrrune
54function
55locates the last occurrence of
56.Fa rune
57in the string
58.Fa string .
59If
60.Fa rune
61is
62.Ql \e0 ,
63.Fn mbrune
64locates the terminating
65.Ql \e0 .
66.Pp
67The
68.Fn mbmb
69function locates the first occurrence of the null-terminated string
70.Fa pattern
71in the null-terminated string
72.Fa string.
73If
74.Fa pattern
75is the empty string,
76.Fn mbmb
77returns
78.Fa string ;
79if
80.Fa pattern
81occurs nowhere in
82.Fa string ,
83.Fn mbmb
84returns
85.Dv NULL ;
86otherwise
87.Fn mbmb
88returns a pointer to the first character of the first occurrence of
89.Fa pattern .
90.Sh RETURN VALUES
91The function
92.Fn mbrune
93returns a pointer to the located character, or
94.Dv NULL
95if the character does not appear in the string.
96.Pp
97The
98.Fn mbrrune
99function
100returns a pointer to the character, or
101.Dv NULL
102if the character does not appear in the string.
103.Pp
104The
105.Fn mbmb
106function
107returns a pointer to the
108.Fa pattern ,
109or
110.Dv NULL
111if the
112.Fa pattern
113does not appear in the string.
114.Sh "SEE ALSO
115.Xr euc 4 ,
116.Xr mbrune 3 ,
117.Xr rune 3 ,
118.Xr setlocale 3 ,
119.Xr utf2 4
120.Sh HISTORY
121The
122.Fn mbrune ,
123.Fn mbrrune ,
124and
125.Fn mbmb
126functions
127first appeared in Plan 9 from Bell Labs as
128.Fn utfrune ,
129.Fn utfrrune ,
130and
131.Fn utfutf .
132