OSDN Git Service

LDP: Update draft based on the previous commit
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / err.3
1 .\" Copyright (c) 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"     This product includes software developed by the University of
16 .\"     California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\"    may be used to endorse or promote products derived from this software
19 .\"    without specific prior written permission.
20 .\"
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" SUCH DAMAGE.
32 .\" %%%LICENSE_END
33 .\"
34 .\"     From: @(#)err.3 8.1 (Berkeley) 6/9/93
35 .\" $FreeBSD: src/lib/libc/gen/err.3,v 1.11.2.5 2001/08/17 15:42:32 ru Exp $
36 .\"
37 .\" 2011-09-10, mtk, Converted from mdoc to man macros
38 .\"
39 .\"*******************************************************************
40 .\"
41 .\" This file was generated with po4a. Translate the source file.
42 .\"
43 .\"*******************************************************************
44 .\"
45 .\" Japanese Version Copyright (c) 2003  Akihiro MOTOKI
46 .\"         all rights reserved.
47 .\" Translated 2003-03-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
48 .\"
49 .TH ERR 3 2020\-06\-09 Linux "Linux Programmer's Manual"
50 .SH 名前
51 err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- エラーメッセージを整形する
52 .SH 書式
53 .nf
54 \fB#include <err.h>\fP
55 .PP
56 \fBvoid err(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
57 .PP
58 \fBvoid errx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
59 .PP
60 \fBvoid warn(const char *\fP\fIfmt\fP\fB, ...);\fP
61 .PP
62 \fBvoid warnx(const char *\fP\fIfmt\fP\fB, ...);\fP
63
64 \fB#include <stdarg.h>\fP
65 .PP
66 \fBvoid verr(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
67 .PP
68 \fBvoid verrx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
69 .PP
70 \fBvoid vwarn(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
71 .PP
72 \fBvoid vwarnx(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
73 .fi
74 .SH 説明
75 \fBerr\fP()  関数群と \fBwarn\fP()  関数群は、エラーメッセージを整形して標準エラー出力に表示する。
76 どの関数の場合も、(ディレクトリ部分を省いた)プログラム名、 コロン 1個、スペース 1個が出力される。 \fIfmt\fP 引き数が NULL でない場合、
77 \fBprintf\fP(3)  と同様に整形が行われ、エラーメッセージが出力される。 出力は改行文字で終わる。
78 .PP
79 関数 \fBerr\fP(), \fBverr\fP(), \fBwarn\fP(), \fBvwarn\fP()  は、グローバル変数 \fIerrno\fP に基づいて
80 \fBstrerror\fP(3)  から得たエラーメッセージを出力する。 \fIfmt\fP 引き数が NULL
81 でない場合は、一個ずつのコロンとスペースに続けて出力する。
82 .PP
83 関数 \fBerrx\fP(), \fBwarnx\fP()  はエラーメッセージを付け加えない。
84 .PP
85 関数 \fBerr\fP(), \fBverr\fP(), \fBerrx\fP(), \fBverrx\fP()  は返り値を返さないが、引き数 \fIeval\fP の値を
86 exit status に設定し終了する。
87 .SH 属性
88 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
89 .TS
90 allbox;
91 lbw17 lb lb
92 l l l.
93 インターフェース        属性  値
94 T{
95 \fBerr\fP(),
96 \fBerrx\fP(),
97 .br
98 \fBwarn\fP(),
99 \fBwarnx\fP(),
100 .br
101 \fBverr\fP(),
102 \fBverrx\fP(),
103 .br
104 \fBvwarn\fP(),
105 \fBvwarnx\fP()
106 T}      Thread safety   MT\-Safe locale
107 .TE
108 .sp 1
109 .SH 準拠
110 .\" .SH HISTORY
111 .\" The
112 .\" .BR err ()
113 .\" and
114 .\" .BR warn ()
115 .\" functions first appeared in
116 .\" 4.4BSD.
117 これらの関数は非標準の BSD 拡張である。
118 .SH EXAMPLES
119 現在の \fIerrno\fP の情報を表示し、終了する:
120 .PP
121 .in +4n
122 .EX
123 p = malloc(size);
124 if (p == NULL)
125     err(EXIT_FAILURE, NULL);
126 fd = open(file_name, O_RDONLY, 0);
127 if (fd == \-1)
128     err(EXIT_FAILURE, "%s", file_name);
129 .EE
130 .in
131 .PP
132 エラーメッセージを表示し、終了する:
133 .PP
134 .in +4n
135 .EX
136 if (tm.tm_hour < START_TIME)
137     errx(EXIT_FAILURE, "too early, wait until %s",
138             start_time_string);
139 .EE
140 .in
141 .PP
142 エラーを警告表示する:
143 .PP
144 .in +4n
145 .EX
146 fd = open(raw_device, O_RDONLY, 0);
147 if (fd == \-1)
148     warnx("%s: %s: trying the block device",
149             raw_device, strerror(errno));
150 fd = open(block_device, O_RDONLY, 0);
151 if (fd == \-1)
152     err(EXIT_FAILURE, "%s", block_device);
153 .EE
154 .in
155 .SH 関連項目
156 \fBerror\fP(3), \fBexit\fP(3), \fBperror\fP(3), \fBprintf\fP(3), \fBstrerror\fP(3)
157 .SH この文書について
158 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
159 \%https://www.kernel.org/doc/man\-pages/ に書かれている。