OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / draft / man3 / error.3
1 .\" Copyright (C) 2006 Justin Pryzby <pryzbyj@justinpryzby.com>
2 .\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" Permission is hereby granted, free of charge, to any person obtaining
5 .\" a copy of this software and associated documentation files (the
6 .\" "Software"), to deal in the Software without restriction, including
7 .\" without limitation the rights to use, copy, modify, merge, publish,
8 .\" distribute, sublicense, and/or sell copies of the Software, and to
9 .\" permit persons to whom the Software is furnished to do so, subject to
10 .\" the following conditions:
11 .\"
12 .\" The above copyright notice and this permission notice shall be
13 .\" included in all copies or substantial portions of the Software.
14 .\"
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 .\"
23 .\" References:
24 .\"   glibc manual and source
25 .\"
26 .\" Japanese Version Copyright (c) 2006 Yuichi SATO
27 .\"         all rights reserved.
28 .\" Translated 2006-08-04 by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.36
29 .\"
30 .TH ERROR 3 2006-04-25 "GNU" "Linux Programmer's Manual"
31 .\"O .SH NAME
32 .SH Ì¾Á°
33 .\"O error, error_at_line, error_message_count, error_on_per_line, \
34 .\"O error_print_progname \- glibc error reporting functions
35 error, error_at_line, error_message_count, error_on_per_line, error_print_progname \- glibc ¤Î¥¨¥é¡¼½ñ¤­½Ð¤·´Ø¿ô
36 .\"O .SH SYNOPSIS
37 .SH ½ñ¼°
38 .nf
39 \fB#include <error.h>
40
41 \fBvoid error(int \fIstatus, \fBint\fI errnum, \
42 \fBconst char *\fIformat, \fB...);
43
44 \fBvoid error_at_line(int \fIstatus, \fBint \fIerrnum, \
45 \fBconst char *\fIfilename,
46                    \fBunsigned int \fIlinenum, \
47 \fBconst char *\fIformat, \fB...);
48
49 \fBextern unsigned int \fIerror_message_count\fP;
50
51 \fBextern int \fIerror_one_per_line\fP;
52
53 \fBextern void (* \fIerror_print_progname\fB) (void);
54 .fi
55 .\"O .SH DESCRIPTION
56 .SH ÀâÌÀ
57 .\"O .BR error ()
58 .\"O is a general error reporting function.
59 .BR error ()
60 ¤ÏÈÆÍÑŪ¤Ê¥¨¥é¡¼½ñ¤­½Ð¤·´Ø¿ô¤Ç¤¢¤ë¡£
61 .\"O It flushes
62 .\"O .IR stdout ,
63 .\"O and then outputs to
64 .\"O .I stderr
65 .\"O the program name, a colon and a space, the message specified by the
66 .\"O .BR printf (3)-style
67 .\"O format string \fIformat\fP, and, if \fIerrnum\fP is
68 .\"O nonzero, a second colon and a space followed by the string given by
69 .\"O \fBperror(\fIerrnum\fB)\fP.
70 ¤³¤Î´Ø¿ô¤Ïɸ½à½ÐÎÏ
71 .RI ( stdout )
72 ¤Ë½ñ¤­½Ð¤·¤Æ¤«¤é¡¢É¸½à¥¨¥é¡¼½ÐÎÏ
73 .RI ( stderr )
74 ¤Ë½ñ¤­½Ð¤¹¡£
75 ½ñ¤­½Ð¤¹ÆâÍƤϡ¢¥×¥í¥°¥é¥à̾¡¦¥³¥í¥ó¡¦¥¹¥Ú¡¼¥¹¡¦
76 .BR printf (3)
77 ·Á¼°¤Î
78 ¥Õ¥©¡¼¥Þ¥Ã¥Èʸ»úÎó \fIformat\fP ¤Ç»ØÄꤵ¤ì¤¿¥á¥Ã¥»¡¼¥¸¤Ç¤¢¤ë¡£
79 \fIerrnum\fP ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢2 ¤ÄÌܤΥ³¥í¥ó¤È¥¹¥Ú¡¼¥¹¤Î¸å¤Ë
80 \fBperror(\fIerrnum\fB)\fP
81 ¤Ç»ØÄꤵ¤ì¤¿Ê¸»úÎó¤â½ñ¤­½Ð¤¹¡£
82 .\"O Any arguments required for
83 .\"O .I format
84 .\"O should follow
85 .\"O .I format
86 .\"O in the argument list.
87 .I format
88 ¤ËɬÍפÊǤ°Õ¤Î°ú¤­¿ô¤¬¡¢°ú¤­¿ô¥ê¥¹¥È¤Î
89 .I format
90 ¤Î¸å¤Ë³¤¯¡£
91 .\"O The output is terminated by a newline character.
92 ½ÐÎϤνªÃ¼¤Ë¤Ï²þ¹Ôʸ»ú¤¬ÉÕ¤¯¡£
93
94 .\"O The program name printed by
95 .\"O .BR error ()
96 .\"O is the value of the global variable
97 .\"O .BR program_invocation_name (3).
98 .BR error ()
99 ¤Ç½ÐÎϤµ¤ì¤ë¥×¥í¥°¥é¥à̾¤Ï¡¢Âç°èÊÑ¿ô
100 .BR program_invocation_name (3)
101 ¤ÎÃͤǤ¢¤ë¡£
102 .\"O .I program_invocation_name
103 .\"O initially has the same value as
104 .\"O .IR main ()'s
105 .\"O .IR argv[0] .
106 .I program_invocation_name
107 ¤Î½é´üÃͤÏ
108 .IR main ()
109 ¤Î
110 .I argv[0]
111 ¤ÎÃͤÈÅù¤·¤¤¡£
112 .\"O The value of this variable can be modified to change the output of
113 .\"O .BR error ().
114 ¤³¤ÎÊÑ¿ô¤ÎÃͤÏÊѹ¹²Äǽ¤Ç¤¢¤ê¡¢Êѹ¹¤¹¤ë¤È
115 .BR error ()
116 ¤Î½ÐÎϤ¬ÊѤï¤ë¡£
117
118 .\"O If \fIstatus\fP has a nonzero value, then
119 .\"O .BR error ()
120 .\"O calls
121 .\"O .BR exit (3)
122 .\"O to terminate the program using the given value as the exit status.
123 \fIstatus\fP ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢
124 .BR error ()
125 ¤Ï
126 .BR exit (3)
127 ¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢»ØÄꤵ¤ì¤¿½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ç¥×¥í¥°¥é¥à¤ò½ªÎ»¤µ¤»¤ë¡£
128
129 .\"O The
130 .\"O .BR error_at_line ()
131 .\"O function is exactly the same as
132 .\"O .BR error (),
133 .\"O except for the addition of the arguments
134 .\"O .I filename
135 .\"O and
136 .\"O .IR linenum .
137 .BR error_at_line ()
138 ´Ø¿ô¤Ï¡¢°ú¤­¿ô
139 .I filename
140 ¤È
141 .I linenum
142 ¤¬Äɲ䵤ì¤Æ¤¤¤ë°Ê³°¤Ï¡¢
143 .BR error ()
144 ¤ÈƱ¤¸¤Ç¤¢¤ë¡£
145 .\"O The output produced is as for
146 .\"O .BR error (),
147 .\"O except that after the program name are written: a colon, the value of
148 .\"O .IR filename ,
149 .\"O a colon, and the value of
150 .\"O .IR linenum .
151 À¸À®¤µ¤ì¤ë½ÐÎϤϡ¢¥×¥í¥°¥é¥à̾¤Î¸å¤Ë
152 ¥³¥í¥ó¡¦\fIfilename\fR ¤ÎÃÍ¡¦¥³¥í¥ó¡¦\fIlinenum\fR ¤ÎÃͤ¬½ñ¤­½Ð¤µ¤ì¤ë°Ê³°¤Ï¡¢
153 .BR error ()
154 ¤ÈƱ¤¸¤Ç¤¢¤ë¡£
155 .\"O The preprocessor values \fB__LINE__\fP and
156 .\"O \fB__FILE__\fP may be useful when calling
157 .\"O .BR error_at_line (),
158 .\"O but other values can also be used.
159 .\"O For example, these arguments could refer to a location in an input file.
160 ¥×¥ê¥×¥í¥»¥Ã¥µ¤ÎÃÍ \fB__LINE__\fP ¤È \fB__FILE__\fP ¤Ï¡¢
161 .BR error_at_line ()
162 ¤ò¸Æ¤Ó½Ð¤¹¤È¤­¤ËÌò¤ËΩ¤Ä¡£
163 ¤½¤Î¾¤Î¥×¥ê¥×¥í¥»¥Ã¥µ¤ÎÃͤâ»È¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
164 Î㤨¤Ð¡¢¤³¤ì¤é¤Î°ú¤­¿ô¤ÇÆþÎÏ¥Õ¥¡¥¤¥ë¤Ë¤ª¤±¤ë°ÌÃÖ¤ò»²¾È¤Ç¤­¤ë¡£
165
166 .\"O If the global variable \fIerror_one_per_line\fP is set nonzero,
167 .\"O a sequence of
168 .\"O .BR error_at_line ()
169 .\"O calls with the
170 .\"O same value of \fIfilename\fP and \fIlinenum\fP will result in only
171 .\"O one message (the first) being output.
172 Âç°èÊÑ¿ô \fIerror_one_per_line\fP ¤¬ 0 °Ê³°¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
173 \fIfilename\fP ¤È \fIlinenum\fP ¤ÎÃͤ¬¶¦¤ËÅù¤·¤¤
174 .BR error_at_line ()
175 ¤Î¸Æ¤Ó½Ð¤·¤Ï¡¢
176 1 ¤Ä¤Î (ºÇ½é¤Î) ¥á¥Ã¥»¡¼¥¸¤Î½ÐÎϤˤޤȤá¤é¤ì¤ë¡£
177
178 .\"O The global variable \fIerror_message_count\fP counts the number of
179 .\"O messages that have been output by
180 .\"O .BR error ()
181 .\"O and
182 .\"O .BR error_at_line ().
183 Âç°èÊÑ¿ô \fIerror_message_count\fP ¤Ï¡¢
184 .BR error ()
185 ¤È
186 .BR error_at_line ()
187 ¤Ç½ÐÎϤµ¤ì¤¿¥á¥Ã¥»¡¼¥¸¤Î¿ô¤òɽ¤¹¡£
188
189 .\"O If the global variable \fIerror_print_progname\fP
190 .\"O is assigned the address of a function
191 .\"O (i.e., is not NULL), then that function is called
192 .\"O instead of prefixing the message with the program name and colon.
193 .\"O The function should print a suitable string to
194 .\"O .IR stderr .
195 Âç°èÊÑ¿ô \fIerror_print_progname\fP ¤Ë
196 ´Ø¿ô¤Î¥¢¥É¥ì¥¹¤¬³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¾ì¹ç (¤Ä¤Þ¤ê NULL ¤Ç¤Ï¤Ê¤¤¾ì¹ç)¡¢
197 ¥á¥Ã¥»¡¼¥¸¤ÎÁ°¤Ë¥×¥í¥°¥é¥à̾¤È¥³¥í¥ó¤ò½ñ¤­½Ð¤¹¤Î¤Ç¤Ï¤Ê¤¯¡¢
198 ¤³¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¡£
199 ¤³¤Î´Ø¿ô¤Ïɸ½à¥¨¥é¡¼½ÐÎÏ
200 .RI ( stderr )
201 ¤ËÂФ·¤Æ¤ÎŬÀÚ¤Êʸ»úÎó¤ò½ñ¤­½Ð¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
202 .\"O .SH "CONFORMING TO"
203 .SH ½àµò
204 .\"O These functions and variables are GNU extensions, and should not be
205 .\"O used in programs intended to be portable.
206 ¤³¤ì¤é¤Î´Ø¿ô¤ÈÊÑ¿ô¤Ï GNU ¤Ë¤è¤ë³ÈÄ¥¤Ç¤¢¤ê¡¢
207 °Ü¿¢À­¤ò¹Í¤¨¤¿¥×¥í¥°¥é¥à¤Ç¤Ï»ÈÍѤ¹¤Ù¤­¤Ç¤Ï¤Ê¤¤¡£
208 .\"O .SH SEE ALSO
209 .SH ´ØÏ¢¹àÌÜ
210 .BR err (3),
211 .BR errno (3),
212 .BR exit (3),
213 .BR perror (3),
214 .BR program_invocation_name (3),
215 .BR strerror (3)