OSDN Git Service

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