.\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" 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. .\" .\" From: @(#) err. 3 8.1 (Berkeley) 6/9/93 .\" %FreeBSD: src/lib/libc/gen/err. 3, v 1.11. 2.6 2001/12/14 18:33:51 ru Exp % .\" .\" $FreeBSD: doc/ja_JP.eucJP/man/man3/err. 3, v 1.4 2002/05/18 07:12:54 horikawa Exp $ .Dd March 6, 1999 .Dt ERR 3 .Os .Sh ¸íĪ .Nm err , .Nm verr , .Nm errc , .Nm verrc , .Nm errx , .Nm verrx , .Nm warn , .Nm vwarn , .Nm warnc , .Nm vwarnc , .Nm warnx , .Nm vwarnx , .Nm err_set_exit , .Nm err_set_file .Nd Æ÷¸Ë µÈ ¿¡·¯ ¸Þ¼¼Áö .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libc .Sh ¼­½Ä .In err.h .Ft void .Fn err "int eval" "const char *fmt" "..." .Ft void .Fn err_set_exit "void (*exitf)(int)" .Ft void .Fn err_set_file "void *vfp" .Ft void .Fn errc "int eval" "int code" "const char *fmt" "..." .Ft void .Fn errx "int eval" "const char *fmt" "..." .Ft void .Fn warn "const char *fmt" "..." .Ft void .Fn warnc "int code" "const char *fmt" "..." .Ft void .Fn warnx "const char *fmt" "..." .In stdarg.h .Ft void .Fn verr "int eval" "const char *fmt" "va_list args" .Ft void .Fn verrc "int eval" "int code" "const char *fmt" "va_list args" .Ft void .Fn verrx "int eval" "const char *fmt" "va_list args" .Ft void .Fn vwarn "const char *fmt" "va_list args" .Ft void .Fn vwarnc "int code" "const char *fmt" "va_list args" .Ft void .Fn vwarnx "const char *fmt" "va_list args" .Sh ÇØ¼³ .Fn err ÇÔ¼ö¿Í .Fn warn ÇÔ¼öÀÇ ÆÐ¹Ð¸®´Â, Ç¥ÁØ ¿¡·¯ Ãâ·Â, ¶Ç´Â .Fn err_set_file ÇÔ¼ö¸¦ »ç¿ëÇØ ÁöÁ¤ÇÑ ´Ù¸¥ ÆÄÀÏ»ó¿¡ Æ÷¸Ë ³¡³­ ¿¡·¯ ¸Þ¼¼Áö¸¦ Ç¥½ÃÇÕ´Ï´Ù. ¸ðµç °æ¿ì¿¡, ÇÁ·Î±×·¥¸íÀÇ ¸¶Áö¸· ÄÄÆÛ³ÍÆ®, ÄÚ·Ðij¶óũŸ, ¹× ½ºÆäÀ̽º°¡ Ãâ·ÂµË´Ï´Ù. .Fa fmt Àμö°¡ NULL °¡ ¾Æ´Ñ °æ¿ì, .Xr printf 3 (¿Í)°ú °°Àº Æ÷¸Ë ³¡³­ ¿¡·¯ ¸Þ¼¼Áö°¡ Ãâ·ÂµË´Ï´Ù. Ãâ·ÂÀÇ ¸¶Áö¸·¿¡´Â °³Çà ij¸¯ÅͰ¡ ºÙ½À´Ï´Ù. .Pp .Fn err , .Fn errc , .Fn verr , .Fn verrc , .Fn warn , .Fn warnc , .Fn vwarn , .Fn vwarnc ÀÇ ÇÔ¼ö´Â, code ¶Ç´Â ±¤¿ª º¯¼ö .Va errno ¿¡ µû¸£´Â ¿¡·¯ ¸Þ¼¼Áö¸¦, Àü¿¡ Äڷаú °ø¹éÀ» ºÙ¿©, ºÎ°¡ÇÕ´Ï´Ù. ´Ù¸¸, .Fa fmt Àμö°¡ .Dv NULL ÀÇ °æ¿ì´Â ¿¹¿ÜÀÔ´Ï´Ù. .Pp .Fn errc , .Fn verrc , .Fn warnc , ¹× .Fn vwarnc ÀÇ °¢ ÇÔ¼öÀÇ °æ¿ì, .Va code Àμö°¡ ¿¡·¯ ¸Þ¼¼ÁöÀÇ °Ë»ö¿¡ »ç¿ëµË´Ï´Ù. .Pp .Fn err , .Fn verr , .Fn warn , ¹× .Fn vwarn ÀÇ °¢ ÇÔ¼ö´Â, ±Û·Î¹ú º¯¼ö .Va errno (À»)¸¦ »ç¿ëÇØ ¿¡·¯ ¸Þ¼¼Áö¸¦ °Ë»öÇÕ´Ï´Ù. .Pp .Fn errx ÇÔ¼ö ¹× .Fn warnx ÇÔ¼ö´Â, ¿¡·¯ ¸Þ¼¼Áö¸¦ Ãß°¡ÇÏÁö ¾Ê½À´Ï´Ù. .Pp .Fn err , .Fn verr , .Fn errc , .Fn verrc , .Fn errx , ¹× .Fn verrx ÀÇ °¢ ÇÔ¼ö´Â, µ¹¾Æ¿ÀÁö ¾Ê½À´Ï´Ù¸¸, Àμö .Fa eval ÀÇ °ªÀ¸·Î Á¾·áÇÕ´Ï´Ù. .Fn err_set_exit ÇÔ¼ö¸¦ »ç¿ëÇØ, .Xr exit 3 ÀÇ Àü¿¡ ºÒ·Á °¡´Â ÇÔ¼ö¸¦ ÁöÁ¤ÇØ, ÇÊ¿äÇÑ Å¬¸° ¾÷À» ½ÇÇàÇÒ ¼ö ÀÖ½À´Ï´Ù. .Va exitf ¿ëÀ¸·Î NULL ÇÔ¼ö Æ÷ÀÎÅ͸¦ ÇÒ´çÇϸé(ÀÚ), ÈÅÀÌ ¾Æ¹«°Íµµ ÇÏÁö ¾Ê°Ô ¸®¼ÂÆ® µË´Ï´Ù. ÇÔ¼ö´Â, ´Ù¸¥ ÇÔ¼ö°¡ »ç¿ëÇÏ´Â Ãâ·Â ½ºÆ®¸²À» ¼³Á¤ÇÕ´Ï´Ù. .Fa vfp Àμö´Â, ¿­·Á ÀÖ´Â ½ºÆ®¸² (ÀÌ¹Ì void * ¿¡ º¯È¯µÇ°í ÀÖÀ»Áöµµ ¸ð¸¨´Ï´Ù) Àΰ¡, NULL Æ÷ÀÎÅÍÀÔ´Ï´Ù (ÀÌ °æ¿ì Ãâ·Â ½ºÆ®¸²Àº Ç¥ÁØ ¿¡·¯·Î ¼³Á¤µË´Ï´Ù). .Sh ¿¹ ÇöÀçÀÇ errno Á¤º¸¸¦ Ç¥½ÃÇØ Á¾·áÇÕ´Ï´Ù. .Bd -literal -offset indent if ((p = malloc(size)) == NULL) err(1, NULL); if ((fd = open(file_name, O_RDONLY, 0)) == -1) err(1, "%s", file_name); .Ed .Pp ¿¡·¯ ¸Þ¼¼Áö¸¦ Ç¥½ÃÇØ Á¾·áÇÕ´Ï´Ù. .Bd -literal -offset indent if (tm.tm_hour < START_TIME) errx(1, "too early, wait until %s", start_time_string); .Ed .Pp ¿¡·¯ÀÇ °æ°í .Bd -literal -offset indent if ((fd = open(raw_device, O_RDONLY, 0)) == -1) warnx("%s: %s: trying the block device", raw_device, strerror(errno)); if ((fd = open(block_device, O_RDONLY, 0)) == -1) err(1, "%s", block_device); .Ed .Pp ±Û·Î¹ú º¯¼ö .Va errno (À»)¸¦ »ç¿ëÇÏÁö ¾Ê´Â ¿¡·¯ÀÇ °æ°í .Bd -literal -offset indent error = my_function(); /* returns a value from */ if (error ! = 0) warnc(error, "my_function"); .Ed .Sh °ü·Ã Ç׸ñ .Xr exit 3 , .Xr printf 3 , .Xr strerror 3 .Pp .Sh ¿ª»ç .Fn err ÇÔ¼ö¿Í .Fn warn ÇÔ¼ö´Â ÃÖÃÊ·Î .Bx 4.4 ±×¸®°í ³ªÅ¸³µ½À´Ï´Ù. .Fn err_set_exit ÇÔ¼ö .Fn err_set_file ÇÔ¼ö´Â ÃÖÃÊ·Î .Fx 2.1 ±×¸®°í ³ªÅ¸³µ½À´Ï´Ù. .Fn errc ÇÔ¼ö¿Í .Fn warnc ÇÔ¼ö´Â ÃÖÃÊ·Î .Fx 3.0 ±×¸®°í ³ªÅ¸³µ½À´Ï´Ù.