diff options
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) |