4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / lib / libc / locale / mbrune.3
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Paul Borman at Krystal Technologies.
.\"
.\" %sccs.include.redist.roff%
.\"
.\" @(#)mbrune.3 8.1 (Berkeley) %G%
.\"
.Dd ""
.Dt MBRUNE 3
.Os
.Sh NAME
.Nm mbrune ,
.Nm mbrrune ,
.Nm mbmb
.Nd multibyte rune support for C
.Sh SYNOPSIS
.Fd #include <rune.h>
.Ft char *
.Fn mbrune "const char *string" "rune_t rune"
.Ft char *
.Fn mbrrune "const char *string" "rune_t rune"
.Ft char *
.Fn mbmb "const char *string" "char *pattern"
.Sh DESCRIPTION
These routines provide the corresponding functionality of
.Fn strchr ,
.Fn strrchr
and
.Fn strstr
for multibyte strings.
.Pp
The
.Fn mbrune
function locates the first occurence of
.Fn rune
in the string pointed to by
.Ar string .
The terminating
.Dv NULL
character is considered part of the string.
If
.Fa rune
is
.Ql \e0 ,
.Fn mbrune
locates the terminating
.Ql \e0 .
.Pp
The
.Fn mbrrune
function
locates the last occurrence of
.Fa rune
in the string
.Fa string .
If
.Fa rune
is
.Ql \e0 ,
.Fn mbrune
locates the terminating
.Ql \e0 .
.Pp
The
.Fn mbmb
function locates the first occurence of the null-terminated string
.Fa pattern
in the null-terminated string
.Fa string.
If
.Fa pattern
is the empty string,
.Fn mbmb
returns
.Fa string ;
if
.Fa pattern
occurs nowhere in
.Fa string ,
.Fn mbmb
returns
.Dv NULL ;
otherwise
.Fn mbmb
returns a pointer to the first character of the first occurrence of
.Fa pattern .
.Sh RETURN VALUES
The function
.Fn mbrune
returns a pointer to the located character, or
.Dv NULL
if the character does not appear in the string.
.Pp
The
.Fn mbrrune
function
returns a pointer to the character, or
.Dv NULL
if the character does not appear in the string.
.Pp
The
.Fn mbmb
function
returns a pointer to the
.Fa pattern ,
or
.Dv NULL
if the
.Fa pattern
does not appear in the string.
.Sh "SEE ALSO
.Xr euc 4 ,
.Xr mbrune 3 ,
.Xr rune 3 ,
.Xr setlocale 3 ,
.Xr utf2 4
.Sh HISTORY
The
.Fn mbrune ,
.Fn mbrrune ,
and
.Fn mbmb
functions
first appeared in Plan 9 from Bell Labs as
.Fn utfrune ,
.Fn utfrrune ,
and
.Fn utfutf .