OSDN Git Service

Update release for LDP 3.67
[linuxjm/LDP_man-pages.git] / release / 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 2013\-12\-30 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 .sp
56 \fBvoid err(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
57 .sp
58 \fBvoid errx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
59 .sp
60 \fBvoid warn(const char *\fP\fIfmt\fP\fB, ...);\fP
61 .sp
62 \fBvoid warnx(const char *\fP\fIfmt\fP\fB, ...);\fP
63 .sp
64 \fB#include <stdarg.h>\fP
65 .sp
66 \fBvoid verr(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
67 .sp
68 \fBvoid verrx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
69 .sp
70 \fBvoid vwarn(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
71 .sp
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 .\" .SH HISTORY
89 .\" The
90 .\" .BR err ()
91 .\" and
92 .\" .BR warn ()
93 .\" functions first appeared in
94 .\" 4.4BSD.
95 これらの関数は非標準の BSD 拡張である。
96 .SH 例
97 現在の \fIerrno\fP の情報を表示し、終了する:
98 .in +4n
99 .nf
100
101 p = malloc(size);
102 if (p == NULL)
103     err(1, NULL);
104 fd = open(file_name, O_RDONLY, 0);
105 if (fd == \-1)
106     err(1, "%s", file_name);
107 .fi
108 .in
109 .PP
110 エラーメッセージを表示し、終了する:
111 .in +4n
112 .nf
113
114 if (tm.tm_hour < START_TIME)
115     errx(1, "too early, wait until %s", start_time_string);
116 .fi
117 .in
118 .PP
119 エラーを警告表示する:
120 .in +4n
121 .nf
122
123 fd = open(raw_device, O_RDONLY, 0);
124 if (fd == \-1)
125     warnx("%s: %s: trying the block device",
126             raw_device, strerror(errno));
127 fd = open(block_device, O_RDONLY, 0);
128 if (fd == \-1)
129     err(1, "%s", block_device);
130 .fi
131 .in
132 .SH 関連項目
133 \fBerror\fP(3), \fBexit\fP(3), \fBperror\fP(3), \fBprintf\fP(3), \fBstrerror\fP(3)
134 .SH この文書について
135 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
136 である。プロジェクトの説明とバグ報告に関する情報は
137 http://www.kernel.org/doc/man\-pages/ に書かれている。