2 .\" The Regents of the University of California. All rights reserved.
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
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.
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
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 $
37 .\" 2011-09-10, mtk, Converted from mdoc to man macros
39 .\"*******************************************************************
41 .\" This file was generated with po4a. Translate the source file.
43 .\"*******************************************************************
45 .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI
46 .\" all rights reserved.
47 .\" Translated 2003-03-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
49 .TH ERR 3 2020\-06\-09 Linux "Linux Programmer's Manual"
51 err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- エラーメッセージを整形する
54 \fB#include <err.h>\fP
56 \fBvoid err(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
58 \fBvoid errx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
60 \fBvoid warn(const char *\fP\fIfmt\fP\fB, ...);\fP
62 \fBvoid warnx(const char *\fP\fIfmt\fP\fB, ...);\fP
64 \fB#include <stdarg.h>\fP
66 \fBvoid verr(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
68 \fBvoid verrx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
70 \fBvoid vwarn(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
72 \fBvoid vwarnx(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
75 \fBerr\fP() 関数群と \fBwarn\fP() 関数群は、エラーメッセージを整形して標準エラー出力に表示する。
76 どの関数の場合も、(ディレクトリ部分を省いた)プログラム名、 コロン 1個、スペース 1個が出力される。 \fIfmt\fP 引き数が NULL でない場合、
77 \fBprintf\fP(3) と同様に整形が行われ、エラーメッセージが出力される。 出力は改行文字で終わる。
79 関数 \fBerr\fP(), \fBverr\fP(), \fBwarn\fP(), \fBvwarn\fP() は、グローバル変数 \fIerrno\fP に基づいて
80 \fBstrerror\fP(3) から得たエラーメッセージを出力する。 \fIfmt\fP 引き数が NULL
81 でない場合は、一個ずつのコロンとスペースに続けて出力する。
83 関数 \fBerrx\fP(), \fBwarnx\fP() はエラーメッセージを付け加えない。
85 関数 \fBerr\fP(), \fBverr\fP(), \fBerrx\fP(), \fBverrx\fP() は返り値を返さないが、引き数 \fIeval\fP の値を
88 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
106 T} Thread safety MT\-Safe locale
115 .\" functions first appeared in
117 これらの関数は非標準の BSD 拡張である。
119 現在の \fIerrno\fP の情報を表示し、終了する:
125 err(EXIT_FAILURE, NULL);
126 fd = open(file_name, O_RDONLY, 0);
128 err(EXIT_FAILURE, "%s", file_name);
136 if (tm.tm_hour < START_TIME)
137 errx(EXIT_FAILURE, "too early, wait until %s",
146 fd = open(raw_device, O_RDONLY, 0);
148 warnx("%s: %s: trying the block device",
149 raw_device, strerror(errno));
150 fd = open(block_device, O_RDONLY, 0);
152 err(EXIT_FAILURE, "%s", block_device);
156 \fBerror\fP(3), \fBexit\fP(3), \fBperror\fP(3), \fBprintf\fP(3), \fBstrerror\fP(3)
158 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
159 \%https://www.kernel.org/doc/man\-pages/ に書かれている。