diff options
author | rwatson <rwatson@FreeBSD.org> | 2008-10-31 15:14:40 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2008-10-31 15:14:40 +0000 |
commit | 7e60f291b22872c56c3e044cd9247ea674fbfa22 (patch) | |
tree | 471f565051b0ea10428ccb1142fe9f585f28715b /lib/libc | |
parent | efc5b661a18dbeb6d04e9916452fb1bd3a748c45 (diff) | |
download | FreeBSD-src-7e60f291b22872c56c3e044cd9247ea674fbfa22.zip FreeBSD-src-7e60f291b22872c56c3e044cd9247ea674fbfa22.tar.gz |
In example use of err(3) and errx(3), use sysexits(3) constants.
MFC after: 3 days
Submitted by: Bruce Cran <bruce at cran dot org dot uk>
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/err.3 | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/gen/err.3 b/lib/libc/gen/err.3 index 7c7720b..4871bcc 100644 --- a/lib/libc/gen/err.3 +++ b/lib/libc/gen/err.3 @@ -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)) == -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); + err(EX_OSFILE, "%s", block_device); .Ed .Pp Warn of an error without using the global variable |