From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 15:14:41 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70B0810656D3; Fri, 31 Oct 2008 15:14:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 223E18FC1B; Fri, 31 Oct 2008 15:14:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9VFEfmq083786; Fri, 31 Oct 2008 15:14:41 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9VFEfi9083785; Fri, 31 Oct 2008 15:14:41 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200810311514.m9VFEfi9083785@svn.freebsd.org> From: Robert Watson Date: Fri, 31 Oct 2008 15:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184511 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2008 15:14:41 -0000 Author: rwatson Date: Fri Oct 31 15:14:40 2008 New Revision: 184511 URL: http://svn.freebsd.org/changeset/base/184511 Log: In example use of err(3) and errx(3), use sysexits(3) constants. MFC after: 3 days Submitted by: Bruce Cran Modified: head/lib/libc/gen/err.3 Modified: head/lib/libc/gen/err.3 ============================================================================== --- head/lib/libc/gen/err.3 Fri Oct 31 15:11:01 2008 (r184510) +++ head/lib/libc/gen/err.3 Fri Oct 31 15:14:40 2008 (r184511) @@ -178,15 +178,16 @@ or a null pointer Display the current errno information string and exit: .Bd -literal -offset indent if ((p = malloc(size)) == NULL) - err(1, NULL); + err(EX_OSERR, NULL); if ((fd = open(file_name, O_RDONLY, 0)) == -1) - err(1, "%s", file_name); + err(EX_NOINPUT, "%s", file_name); .Ed .Pp Display an error message and exit: .Bd -literal -offset indent if (tm.tm_hour < START_TIME) - errx(1, "too early, wait until %s", start_time_string); + errx(EX_DATAERR, "too early, wait until %s", + start_time_string); .Ed .Pp Warn of an error: @@ -195,7 +196,7 @@ if ((fd = open(raw_device, O_RDONLY, 0)) 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); + err(EX_OSFILE, "%s", block_device); .Ed .Pp Warn of an error without using the global variable