OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / 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 .TH ERR 3 2012\-03\-15 Linux "Linux Programmer's Manual"
45 .SH 名前
46 err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- エラーメッセージを整形する
47 .SH 書式
48 .nf
49 \fB#include <err.h>\fP
50 .sp
51 \fBvoid err(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
52 .sp
53 \fBvoid errx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP
54 .sp
55 \fBvoid warn(const char *\fP\fIfmt\fP\fB, ...);\fP
56 .sp
57 \fBvoid warnx(const char *\fP\fIfmt\fP\fB, ...);\fP
58 .sp
59 \fB#include <stdarg.h>\fP
60 .sp
61 \fBvoid verr(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
62 .sp
63 \fBvoid verrx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
64 .sp
65 \fBvoid vwarn(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
66 .sp
67 \fBvoid vwarnx(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP
68 .fi
69 .SH 説明
70 \fBerr\fP()  関数群と \fBwarn\fP()  関数群は、エラーメッセージを整形して標準エラー出力に表示する。
71 どの関数の場合も、(ディレクトリ部分を省いた)プログラム名、 コロン 1個、スペース 1個が出力される。 \fIfmt\fP 引き数が NULL でない場合、
72 \fBprintf\fP(3)  と同様に整形が行われ、エラーメッセージが出力される。 出力は改行文字で終わる。
73 .PP
74 関数 \fBerr\fP(), \fBverr\fP(), \fBwarn\fP(), \fBvwarn\fP()  は、グローバル変数 \fIerrno\fP に基づいて
75 \fBstrerror\fP(3)  から得たエラーメッセージを出力する。 \fIfmt\fP 引き数が NULL
76 でない場合は、一個ずつのコロンとスペースに続けて出力する。
77 .PP
78 関数 \fBerrx\fP(), \fBwarnx\fP()  はエラーメッセージを付け加えない。
79 .PP
80 関数 \fBerr\fP(), \fBverr\fP(), \fBerrx\fP(), \fBverrx\fP()  は返り値を返さないが、引き数 \fIeval\fP の値を
81 exit status に設定し終了する。
82 .SH 準拠
83 .\" .SH HISTORY
84 .\" The
85 .\" .BR err ()
86 .\" and
87 .\" .BR warn ()
88 .\" functions first appeared in
89 .\" 4.4BSD.
90 これらの関数は非標準の BSD 拡張である。
91 .SH 例
92 現在の \fIerrno\fP の情報を表示し、終了する:
93 .in +4n
94 .nf
95
96 if ((p = malloc(size)) == NULL)
97     err(1, NULL);
98 if ((fd = open(file_name, O_RDONLY, 0)) == \-1)
99     err(1, "%s", file_name);
100 .fi
101 .in
102 .PP
103 エラーメッセージを表示し、終了する:
104 .in +4n
105 .nf
106
107 if (tm.tm_hour < START_TIME)
108     errx(1, "too early, wait until %s", start_time_string);
109 .fi
110 .in
111 .PP
112 エラーを警告表示する:
113 .in +4n
114 .nf
115
116 if ((fd = open(raw_device, O_RDONLY, 0)) == \-1)
117     warnx("%s: %s: trying the block device",
118             raw_device, strerror(errno));
119 if ((fd = open(block_device, O_RDONLY, 0)) == \-1)
120     err(1, "%s", block_device);
121 .fi
122 .in
123 .SH 関連項目
124 \fBerror\fP(3), \fBexit\fP(3), \fBperror\fP(3), \fBprintf\fP(3), \fBstrerror\fP(3)
125 .SH この文書について
126 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
127 である。プロジェクトの説明とバグ報告に関する情報は
128 http://www.kernel.org/doc/man\-pages/ に書かれている。