aboutsummaryrefslogblamecommitdiff
path: root/ja_JP.eucJP/man/man3/re_comp.3
blob: 1d2165a5e8732bfd4923b207fed61f80f841a9f2 (plain) (tree)
































                                                                              
             













































































                                                                         
.\" Copyright (c) 1980, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" 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.
.\"
.\"     @(#)re_comp.3	8.1 (Berkeley) 6/4/93
.\"
.\" $FreeBSD$
.Dd June 4, 1993
.Dt RE_COMP 3
.Os
.Sh 名称
.Nm re_comp ,
.Nm re_exec
.Nd 定型数式ハンドラ
.Sh 書式
.Fd #include <unistd.h>
.Ft char *
.Fn re_comp "const char *s"
.Ft int
.Fn re_exec "const char *s"
.Sh 解説
このインタフェースは、
.Xr regex 3
に置き換わりました。互換性ライブラリ libcompat から使用できます。
.Pp
.Fn re_comp
関数は、パターンマッチングに合う内部形式にストリングをコンパイルします。 
.Fn re_exec
関数は、
.Fn re_comp
に渡された最後のストリングと引数ストリングを照合します。
.Pp
.Fn re_comp
関数は、ストリング
.Fa s
が問題なくコンパイルされると 0を戻します。問題が発生した場合は、エラー
メッセージを含むストリングが戻されます。0 か null ストリングが渡された
.Fn re_comp
は、現在コンパイルされている定型数式を変更せずに戻ります。
.Pp
.Fn re_exec
関数は、最後にコンパイルされた定型数式とストリング
.Fa s
が一致すると 1を戻します。最後にコンパイルされた定型数式とストリング
.Fa s
が一致しない場合は 0を戻します。コンパイルされた定型数式が正しくない場
合は \-1 を戻します(内部エラー)。
.Pp
.Fn re_comp
と
.Fn re_exec
の両方に渡すストリングには、最後に改行キャラクタが付いていたり、改行キャ
ラクタが埋め込まれていたりすることがありますが、これらは 
.Dv NULL
で終了されます。認識される定型数式については、上記のような違いがありま
すが、 
.Xr ed 1
のマニュアルエントリを参照してください。
.Sh 診断
.Fn re_exec
関数は、内部エラーが発生した場合、-1 を戻します。
.Pp
.Fn re_comp
関数は、エラーが発生した場合、以下のストリングのうち 1つを戻します。
.Bd -unfilled -offset indent
No previous regular expression,
Regular expression too long,
nmatched \e(,
missing ],
too many \e(\e) pairs,
unmatched \e).
.Sh 関連項目
.Xr ed 1 ,
.Xr egrep 1 ,
.Xr ex 1 ,
.Xr fgrep 1 ,
.Xr grep 1 ,
.Xr regex 3
.Sh 歴史
.Fn re_comp
関数と
.Fn re_exec
関数は、
.Bx 4.0
に追加されました。