diff options
author | charnier <charnier@FreeBSD.org> | 1997-10-08 07:48:21 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-10-08 07:48:21 +0000 |
commit | 1c390186cd64897d9b1b87cb01152be10cc44005 (patch) | |
tree | fafe85eadca3db5f2091738324c5253d4072cf3e /usr.sbin/pkg_install/lib/msg.c | |
parent | ad57db7eefbd5760a834879d200ce1043f86046d (diff) | |
download | FreeBSD-src-1c390186cd64897d9b1b87cb01152be10cc44005.zip FreeBSD-src-1c390186cd64897d9b1b87cb01152be10cc44005.tar.gz |
Use err(3). Cosmetics in usage string and man page.
Diffstat (limited to 'usr.sbin/pkg_install/lib/msg.c')
-rw-r--r-- | usr.sbin/pkg_install/lib/msg.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/usr.sbin/pkg_install/lib/msg.c b/usr.sbin/pkg_install/lib/msg.c index e35aba8..032320b 100644 --- a/usr.sbin/pkg_install/lib/msg.c +++ b/usr.sbin/pkg_install/lib/msg.c @@ -1,5 +1,6 @@ #ifndef lint -static const char *rcsid = "$Id$"; +static const char rcsid[] = + "$Id: msg.c,v 1.8 1997/02/22 16:09:50 peter Exp $"; #endif /* @@ -23,44 +24,18 @@ static const char *rcsid = "$Id$"; * */ +#include <err.h> #include "lib.h" /* Die a relatively simple death */ void upchuck(const char *err) { - fprintf(stderr, "Fatal error during execution: "); - perror(err); + warn("fatal error during execution: %s", err); cleanup(0); exit(1); } -/* Die a more complex death */ -void -barf(const char *err, ...) -{ - va_list args; - - va_start(args, err); - vfprintf(stderr, err, args); - fputc('\n', stderr); - va_end(args); - cleanup(0); - exit(2); -} - -/* Get annoyed about something but don't go to pieces over it */ -void -whinge(const char *err, ...) -{ - va_list args; - - va_start(args, err); - vfprintf(stderr, err, args); - fputc('\n', stderr); - va_end(args); -} - /* * As a yes/no question, prompting from the varargs string and using * default if user just hits return. @@ -79,7 +54,7 @@ y_or_n(Boolean def, const char *msg, ...) */ tty = fopen("/dev/tty", "r"); if (!tty) - barf("Can't open /dev/tty!\n"); + cleanup(0), errx(2, "can't open /dev/tty!"); while (ch != 'Y' && ch != 'N') { vfprintf(stderr, msg, args); if (def) |