OSDN Git Service

cd54fea06961f856502c3ac6963115e83627c4c1
[linuxjm/LDP_man-pages.git] / release / man3 / memchr.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" Modified Mon Apr 12 12:49:57 1993, David Metcalfe
28 .\" Modified Sat Jul 24 18:56:22 1993, Rik Faith (faith@cs.unc.edu)
29 .\" Modified Wed Feb 20 21:09:36 2002, Ian Redfern (redferni@logica.com)
30 .\" 2008-07-09, mtk, add rawmemchr()
31 .\"
32 .\"*******************************************************************
33 .\"
34 .\" This file was generated with po4a. Translate the source file.
35 .\"
36 .\"*******************************************************************
37 .TH MEMCHR 3 2012\-04\-23 "" "Linux Programmer's Manual"
38 .SH 名前
39 memchr, memrchr, rawmemchr \- 文字を探すためにメモリをスキャンする
40 .SH 書式
41 .nf
42 \fB#include <string.h>\fP
43
44 \fBvoid *memchr(const void *\fP\fIs\fP\fB, int \fP\fIc\fP\fB, size_t \fP\fIn\fP\fB);\fP
45
46 \fBvoid *memrchr(const void *\fP\fIs\fP\fB, int \fP\fIc\fP\fB, size_t \fP\fIn\fP\fB);\fP
47
48 \fBvoid *rawmemchr(const void *\fP\fIs\fP\fB, int \fP\fIc\fP\fB);\fP
49 .fi
50 .sp
51 .in -4n
52 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
53 .in
54 .sp
55 \fBmemrchr\fP(): \fBrawmemchr\fP(): _GNU_SOURCE
56 .SH 説明
57 \fBmemchr\fP() 関数は、ポインタ \fIs\fP が指し示すメモリ領域の先頭の
58 \fIn\fP バイトから最初に登場する文字 \fIc\fP を探す。
59 \fIc\fP と \fIs\fP が指し示すメモリ領域の各バイトは両方とも
60 \fIunsigned char\fP と解釈される。
61 .PP
62 \fBmemrchr\fP()  関数は \fBmemchr\fP()  関数に似ているが、 先頭から順方向に探すのではなく、 ポインタ \fIs\fP が指し示す
63 \fIn\fP バイトのメモリブロックの 末尾から逆向きに探す。
64
65 \fBrawmemchr\fP() 関数は \fBmemchr\fP() と同様だが、 \fIc\fP が \fIs\fP が指す場所
66 から始まるメモリ領域のどこかにあることを前提にして (つまり、プログラマ
67 はそのことを知っている)、最適化した方法で \fIc\fP の検索を実行する (すなわ
68 ち、検索範囲の上限を示す引き数も使用されない)。\fIc\fP が見つからなかった
69 場合、その結果はどうなるか分からない。次に示す呼び出しは、文字列終端の
70 NULL バイトの位置を特定する高速な手段である。
71 .in +4n
72 .nf
73
74 char *p = rawmemchr(s,\ \(aq\e0\(aq);
75 .fi
76 .in
77 .SH 返り値
78 \fBmemchr\fP()  関数と \fBmemrchr\fP()  関数は一致する文字へのポインタを返し、 もし文字が指定メモリ領域に現れない場合は NULL
79 を返す。
80
81 \fBrawmemchr\fP()  関数はマッチするバイトが見つかった場合はマッチしたバイトへのポインタを返す。
82 マッチするバイトが見つからなかった場合、結果は不定である。
83 .SH バージョン
84 \fBrawmemchr\fP()  は glibc バージョン 2.1 で初めて登場した。
85
86 \fBmemrchr\fP()  は glibc バージョン 2.2 で初めて登場した。
87 .SH 準拠
88 \fBmemchr\fP()  関数は SVr4, 4.3BSD, C89, C99, POSIX.1\-2001 に準拠する。
89
90 \fBmemrchr\fP()  関数は GNU 拡張であり、glibc 2.1.91 から使用可能である。
91
92 \fBrawmemchr\fP()  関数は GNU 拡張であり、glibc 2.1 から使用可能である。
93 .SH 関連項目
94 \fBffs\fP(3), \fBindex\fP(3), \fBrindex\fP(3), \fBstrchr\fP(3), \fBstrpbrk\fP(3),
95 \fBstrrchr\fP(3), \fBstrsep\fP(3), \fBstrspn\fP(3), \fBstrstr\fP(3), \fBwmemchr\fP(3)
96 .SH この文書について
97 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
98 である。プロジェクトの説明とバグ報告に関する情報は
99 http://www.kernel.org/doc/man\-pages/ に書かれている。