.\" 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. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)mbrune.3 8.2 (Berkeley) 4/19/94 .\" %FreeBSD: src/lib/libc/locale/mbrune.3,v 1.6.2.4 2001/12/14 18:33:54 ru Exp % .\" .\" $FreeBSD$ .Dd April 19, 1994 .Dt MBRUNE 3 .Os .Sh 名称 .Nm mbrune , .Nm mbrrune , .Nm mbmb .Nd C のためのマルチバイト文字 (rune) サポート .Sh ライブラリ .Lb libc .Sh 書式 .In 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 解説 これらのルーチン群は、マルチバイト文字列のための .Fn strchr , .Fn strrchr , .Fn strstr 相当の機能を提供します。 .Pp .Fn mbrune 関数は、 .Ar string の指す文字列の中で、 .Fa rune が最初に現れる位置を指します。 終端の .Dv NUL 文字は文字列の一部とみなされます。 .Fa rune が .Ql \e0 である場合は .Fn mbrune は終端の .Ql \e0 を指します。 .Pp .Fn mbrrune 関数は、文字列 .Fa string の中で .Fa rune が最後に現れる位置を指します。 .Fa rune が .Ql \e0 である場合は .Fn mbrune は終端の .Ql \e0 を指します。 .Pp .Fn mbmb 関数は、 ヌルで終端する文字列 .Fa string の中で、ヌルで終端する文字列 .Fa pattern が最初に現れるものを指します。 .Fa pattern が空文字列である場合、 .Fn mbmb は .Fa string を返します。 .Fa pattern が .Fa string の中のどこにも現れない場合、 .Fn mbmb は .Dv NULL を返します。 それ以外の場合、 .Fn mbmb は、 .Fa pattern が最初に現れる先頭の文字のポインタを返します。 .Sh 戻り値 .Fn mbrune 関数は、該当する文字の位置を示すポインタを返します。 文字列中に該当する文字が見つからない場合は .Dv NULL を返します。 .Pp .Fn mbrrune 関数は、該当する文字のポインタを返します。 文字列中に該当する文字が見つからない場合は .Dv NULL を返します。 .Pp .Fn mbmb 関数は、 .Fa pattern のポインタを返します。 文字列中に該当する .Fa pattern が見つからない場合は .Dv NULL を返します。 .Pp .Sh 関連項目 .Xr mbrune 3 , .Xr rune 3 , .Xr setlocale 3 , .Xr euc 4 , .Xr utf2 4 .Sh 歴史 .Fn mbrune , .Fn mbrrune , .Fn mbmb 関数は、Bell Labs の Plan 9 で .Fn utfrune , .Fn utfrrune , .Fn utfutf として現れました。