X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=release%2Fman3%2Ferr.3;h=3c481384c711c16fd008834b17d553174a15970a;hb=82891fbd71c0dc60b4109ed02b08fa3fe70cc7f3;hp=c23c6af9596ffd734fdb58f127d8b48a20c15b05;hpb=4098ba44b0a43ff980f70689be7c8ed69230e427;p=linuxjm%2FLDP_man-pages.git diff --git a/release/man3/err.3 b/release/man3/err.3 index c23c6af9..3c481384 100644 --- a/release/man3/err.3 +++ b/release/man3/err.3 @@ -1,6 +1,7 @@ .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" +.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -28,98 +29,85 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. +.\" %%%LICENSE_END .\" .\" From: @(#)err.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD: src/lib/libc/gen/err.3,v 1.11.2.5 2001/08/17 15:42:32 ru Exp $ .\" .\" 2011-09-10, mtk, Converted from mdoc to man macros .\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.\" .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2003-03-10, Akihiro MOTOKI .\" -.TH ERR 3 2011-09-15 "Linux" "Linux Programmer's Manual" -.SH ̾Á° -err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òÀ°·Á¤¹¤ë -.Nd -.SH ½ñ¼° +.TH ERR 3 2013\-12\-30 Linux "Linux Programmer's Manual" +.SH 名前 +err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- エラーメッセージを整形する +.SH 書式 .nf -.B #include +\fB#include \fP .sp -.BI "void err(int " eval ", const char *" fmt ", ...);" +\fBvoid err(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP .sp -.BI "void errx(int " eval ", const char *" fmt ", ...);" +\fBvoid errx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, ...);\fP .sp -.BI "void warn(const char *" fmt ", ...);" +\fBvoid warn(const char *\fP\fIfmt\fP\fB, ...);\fP .sp -.BI "void warnx(const char *" fmt ", ...);" +\fBvoid warnx(const char *\fP\fIfmt\fP\fB, ...);\fP .sp -.B #include +\fB#include \fP .sp -.BI "void verr(int " eval ", const char *" fmt ", va_list " args ); +\fBvoid verr(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP .sp -.BI "void verrx(int " eval ", const char *" fmt ", va_list " args ); +\fBvoid verrx(int \fP\fIeval\fP\fB, const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP .sp -.BI "void vwarn(const char *" fmt ", va_list " args ); +\fBvoid vwarn(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP .sp -.BI "void vwarnx(const char *" fmt ", va_list " args ); +\fBvoid vwarnx(const char *\fP\fIfmt\fP\fB, va_list \fP\fIargs\fP\fB);\fP .fi -.SH ÀâÌÀ -.BR err () -´Ø¿ô·²¤È -.BR warn () -´Ø¿ô·²¤Ï¡¢¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òÀ°·Á¤·¤Æɸ½à¥¨¥é¡¼½ÐÎϤËɽ¼¨¤¹¤ë¡£ -¤É¤Î´Ø¿ô¤Î¾ì¹ç¤â¡¢(¥Ç¥£¥ì¥¯¥È¥êÉôʬ¤ò¾Ê¤¤¤¿)¥×¥í¥°¥é¥à̾¡¢ -¥³¥í¥ó 1¸Ä¡¢¥¹¥Ú¡¼¥¹ 1¸Ä¤¬½ÐÎϤµ¤ì¤ë¡£ -.I fmt -°ú¤­¿ô¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢ -.BR printf (3) -¤ÈƱÍͤËÀ°·Á¤¬¹Ô¤ï¤ì¡¢¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤¬½ÐÎϤµ¤ì¤ë¡£ -½ÐÎϤϲþ¹Ôʸ»ú¤Ç½ª¤ï¤ë¡£ +.SH 説明 +\fBerr\fP() 関数群と \fBwarn\fP() 関数群は、エラーメッセージを整形して標準エラー出力に表示する。 +どの関数の場合も、(ディレクトリ部分を省いた)プログラム名、 コロン 1個、スペース 1個が出力される。 \fIfmt\fP 引き数が NULL でない場合、 +\fBprintf\fP(3) と同様に整形が行われ、エラーメッセージが出力される。 出力は改行文字で終わる。 .PP -\"O motoki: based on a code or ¡Á ¤Î¡Öa code¡×¤È¤Ï¡© -´Ø¿ô -.BR err (), -.BR verr (), -.BR warn (), -.BR vwarn () -¤Ï¡¢¥°¥í¡¼¥Ð¥ëÊÑ¿ô -.I errno -¤Ë´ð¤Å¤¤¤Æ -.BR strerror (3) -¤«¤éÆÀ¤¿¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ò½ÐÎϤ¹¤ë¡£ -.I fmt -°ú¤­¿ô¤¬ NULL -¤Ç¤Ê¤¤¾ì¹ç¤Ï¡¢°ì¸Ä¤º¤Ä¤Î¥³¥í¥ó¤È¥¹¥Ú¡¼¥¹¤Ë³¤±¤Æ½ÐÎϤ¹¤ë¡£ +関数 \fBerr\fP(), \fBverr\fP(), \fBwarn\fP(), \fBvwarn\fP() は、グローバル変数 \fIerrno\fP に基づいて +\fBstrerror\fP(3) から得たエラーメッセージを出力する。 \fIfmt\fP 引き数が NULL +でない場合は、一個ずつのコロンとスペースに続けて出力する。 .PP -´Ø¿ô -.BR errx (), -.BR warnx () -¤Ï¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òÉÕ¤±²Ã¤¨¤Ê¤¤¡£ +関数 \fBerrx\fP(), \fBwarnx\fP() はエラーメッセージを付け加えない。 .PP -´Ø¿ô -.BR err (), -.BR verr (), -.BR errx (), -.BR verrx () -¤ÏÊÖ¤êÃͤòÊÖ¤µ¤Ê¤¤¤¬¡¢°ú¤­¿ô -.I eval -¤ÎÃͤò exit status ¤ËÀßÄꤷ½ªÎ»¤¹¤ë¡£ -.SH Îã -¸½ºß¤Î -.I errno -¤Î¾ðÊó¤òɽ¼¨¤·¡¢½ªÎ»¤¹¤ë: +関数 \fBerr\fP(), \fBverr\fP(), \fBerrx\fP(), \fBverrx\fP() は返り値を返さないが、引き数 \fIeval\fP の値を +exit status に設定し終了する。 +.SH 準拠 +.\" .SH HISTORY +.\" The +.\" .BR err () +.\" and +.\" .BR warn () +.\" functions first appeared in +.\" 4.4BSD. +これらの関数は非標準の BSD 拡張である。 +.SH 例 +現在の \fIerrno\fP の情報を表示し、終了する: .in +4n .nf -if ((p = malloc(size)) == NULL) +p = malloc(size); +if (p == NULL) err(1, NULL); -if ((fd = open(file_name, O_RDONLY, 0)) == \-1) +fd = open(file_name, O_RDONLY, 0); +if (fd == \-1) err(1, "%s", file_name); .fi .in .PP -¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤·¡¢½ªÎ»¤¹¤ë: +エラーメッセージを表示し、終了する: .in +4n .nf @@ -128,30 +116,22 @@ if (tm.tm_hour < START_TIME) .fi .in .PP -¥¨¥é¡¼¤ò·Ù¹ðɽ¼¨¤¹¤ë: +エラーを警告表示する: .in +4n .nf -if ((fd = open(raw_device, O_RDONLY, 0)) == \-1) +fd = open(raw_device, O_RDONLY, 0); +if (fd == \-1) warnx("%s: %s: trying the block device", raw_device, strerror(errno)); -if ((fd = open(block_device, O_RDONLY, 0)) == \-1) +fd = open(block_device, O_RDONLY, 0); +if (fd == \-1) err(1, "%s", block_device); .fi .in -.SH ½àµò -¤³¤ì¤é¤Î´Ø¿ô¤ÏÈóɸ½à¤Î BSD ³ÈÄ¥¤Ç¤¢¤ë¡£ -.\" .SH Îò»Ë -.\" ´Ø¿ô -.\" .BR err () -.\" ¤È -.\" .BR warn () -.\" ¤Ï -.\" 4.4BSD -.\" ¤Ç½é¤á¤ÆÅо줷¤¿¡£ -.SH ´ØÏ¢¹àÌÜ -.BR error (3), -.BR exit (3), -.BR perror (3), -.BR printf (3), -.BR strerror (3) +.SH 関連項目 +\fBerror\fP(3), \fBexit\fP(3), \fBperror\fP(3), \fBprintf\fP(3), \fBstrerror\fP(3) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.78 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。