1 .\" Copyright (C) 2006 Justin Pryzby <pryzbyj@justinpryzby.com>
2 .\" and Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
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:
12 .\" The above copyright notice and this permission notice shall be
13 .\" included in all copies or substantial portions of the Software.
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.
24 .\" glibc manual and source
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
30 .TH ERROR 3 2006-04-25 "GNU" "Linux Programmer's Manual"
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 ¤Î¥¨¥é¡¼½ñ¤½Ð¤·´Ø¿ô
41 \fBvoid error(int \fIstatus, \fBint\fI errnum, \
42 \fBconst char *\fIformat, \fB...);
44 \fBvoid error_at_line(int \fIstatus, \fBint \fIerrnum, \
45 \fBconst char *\fIfilename,
46 \fBunsigned int \fIlinenum, \
47 \fBconst char *\fIformat, \fB...);
49 \fBextern unsigned int \fIerror_message_count\fP;
51 \fBextern int \fIerror_one_per_line\fP;
53 \fBextern void (* \fIerror_print_progname\fB) (void);
58 .\"O is a general error reporting function.
60 ¤ÏÈÆÍÑŪ¤Ê¥¨¥é¡¼½ñ¤½Ð¤·´Ø¿ô¤Ç¤¢¤ë¡£
63 .\"O and then outputs to
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.
72 ¤Ë½ñ¤½Ð¤·¤Æ¤«¤é¡¢É¸½à¥¨¥é¡¼½ÐÎÏ
75 ½ñ¤½Ð¤¹ÆâÍƤϡ¢¥×¥í¥°¥é¥à̾¡¦¥³¥í¥ó¡¦¥¹¥Ú¡¼¥¹¡¦
78 ¥Õ¥©¡¼¥Þ¥Ã¥Èʸ»úÎó \fIformat\fP ¤Ç»ØÄꤵ¤ì¤¿¥á¥Ã¥»¡¼¥¸¤Ç¤¢¤ë¡£
79 \fIerrnum\fP ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢2 ¤ÄÌܤΥ³¥í¥ó¤È¥¹¥Ú¡¼¥¹¤Î¸å¤Ë
80 \fBperror(\fIerrnum\fB)\fP
81 ¤Ç»ØÄꤵ¤ì¤¿Ê¸»úÎó¤â½ñ¤½Ð¤¹¡£
82 .\"O Any arguments required for
86 .\"O in the argument list.
88 ¤ËɬÍפÊǤ°Õ¤Î°ú¤¿ô¤¬¡¢°ú¤¿ô¥ê¥¹¥È¤Î
91 .\"O The output is terminated by a newline character.
92 ½ÐÎϤνªÃ¼¤Ë¤Ï²þ¹Ôʸ»ú¤¬ÉÕ¤¯¡£
94 .\"O The program name printed by
96 .\"O is the value of the global variable
97 .\"O .BR program_invocation_name (3).
99 ¤Ç½ÐÎϤµ¤ì¤ë¥×¥í¥°¥é¥à̾¤Ï¡¢Âç°èÊÑ¿ô
100 .BR program_invocation_name (3)
102 .\"O .I program_invocation_name
103 .\"O initially has the same value as
106 .I program_invocation_name
112 .\"O The value of this variable can be modified to change the output of
114 ¤³¤ÎÊÑ¿ô¤ÎÃͤÏÊѹ¹²Äǽ¤Ç¤¢¤ê¡¢Êѹ¹¤¹¤ë¤È
118 .\"O If \fIstatus\fP has a nonzero value, then
122 .\"O to terminate the program using the given value as the exit status.
123 \fIstatus\fP ¤¬ 0 °Ê³°¤Î¾ì¹ç¡¢
127 ¤ò¸Æ¤Ó½Ð¤·¤Æ¡¢»ØÄꤵ¤ì¤¿½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤Ç¥×¥í¥°¥é¥à¤ò½ªÎ»¤µ¤»¤ë¡£
130 .\"O .BR error_at_line ()
131 .\"O function is exactly the same as
133 .\"O except for the addition of the arguments
142 ¤¬Äɲ䵤ì¤Æ¤¤¤ë°Ê³°¤Ï¡¢
145 .\"O The output produced is as for
147 .\"O except that after the program name are written: a colon, the value of
149 .\"O a colon, and the value of
151 À¸À®¤µ¤ì¤ë½ÐÎϤϡ¢¥×¥í¥°¥é¥à̾¤Î¸å¤Ë
152 ¥³¥í¥ó¡¦\fIfilename\fR ¤ÎÃÍ¡¦¥³¥í¥ó¡¦\fIlinenum\fR ¤ÎÃͤ¬½ñ¤½Ð¤µ¤ì¤ë°Ê³°¤Ï¡¢
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 ¤Ï¡¢
162 ¤ò¸Æ¤Ó½Ð¤¹¤È¤¤ËÌò¤ËΩ¤Ä¡£
163 ¤½¤Î¾¤Î¥×¥ê¥×¥í¥»¥Ã¥µ¤ÎÃͤâ»È¤¦¤³¤È¤¬¤Ç¤¤ë¡£
164 Î㤨¤Ð¡¢¤³¤ì¤é¤Î°ú¤¿ô¤ÇÆþÎÏ¥Õ¥¡¥¤¥ë¤Ë¤ª¤±¤ë°ÌÃÖ¤ò»²¾È¤Ç¤¤ë¡£
166 .\"O If the global variable \fIerror_one_per_line\fP is set nonzero,
168 .\"O .BR error_at_line ()
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 ¤ÎÃͤ¬¶¦¤ËÅù¤·¤¤
176 1 ¤Ä¤Î (ºÇ½é¤Î) ¥á¥Ã¥»¡¼¥¸¤Î½ÐÎϤˤޤȤá¤é¤ì¤ë¡£
178 .\"O The global variable \fIerror_message_count\fP counts the number of
179 .\"O messages that have been output by
182 .\"O .BR error_at_line ().
183 Âç°èÊÑ¿ô \fIerror_message_count\fP ¤Ï¡¢
187 ¤Ç½ÐÎϤµ¤ì¤¿¥á¥Ã¥»¡¼¥¸¤Î¿ô¤òɽ¤¹¡£
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
195 Âç°èÊÑ¿ô \fIerror_print_progname\fP ¤Ë
196 ´Ø¿ô¤Î¥¢¥É¥ì¥¹¤¬³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¾ì¹ç (¤Ä¤Þ¤ê NULL ¤Ç¤Ï¤Ê¤¤¾ì¹ç)¡¢
197 ¥á¥Ã¥»¡¼¥¸¤ÎÁ°¤Ë¥×¥í¥°¥é¥à̾¤È¥³¥í¥ó¤ò½ñ¤½Ð¤¹¤Î¤Ç¤Ï¤Ê¤¯¡¢
199 ¤³¤Î´Ø¿ô¤Ïɸ½à¥¨¥é¡¼½ÐÎÏ
201 ¤ËÂФ·¤Æ¤ÎŬÀÚ¤Êʸ»úÎó¤ò½ñ¤½Ð¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
202 .\"O .SH "CONFORMING TO"
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 °Ü¿¢À¤ò¹Í¤¨¤¿¥×¥í¥°¥é¥à¤Ç¤Ï»ÈÍѤ¹¤Ù¤¤Ç¤Ï¤Ê¤¤¡£
214 .BR program_invocation_name (3),