diff options
author | 1997-07-25 21:30:12 +0000 | |
---|---|---|
committer | 1997-07-25 21:30:12 +0000 | |
commit | 3445f54c514731b50996195f8d91435f622e7b8e (patch) | |
tree | cd070c93c680366bdd2e87c33103e68962454d63 | |
parent | use err(3) (diff) | |
download | wireguard-openbsd-3445f54c514731b50996195f8d91435f622e7b8e.tar.xz wireguard-openbsd-3445f54c514731b50996195f8d91435f622e7b8e.zip |
use err(3)
-rw-r--r-- | usr.bin/col/col.c | 15 | ||||
-rw-r--r-- | usr.bin/id/id.c | 47 |
2 files changed, 12 insertions, 50 deletions
diff --git a/usr.bin/col/col.c b/usr.bin/col/col.c index eb9933896f3..be75c0dbbc6 100644 --- a/usr.bin/col/col.c +++ b/usr.bin/col/col.c @@ -1,4 +1,4 @@ -/* $OpenBSD: col.c,v 1.4 1997/06/17 20:53:58 kstailey Exp $ */ +/* $OpenBSD: col.c,v 1.5 1997/07/25 21:30:12 mickey Exp $ */ /* $NetBSD: col.c,v 1.7 1995/09/02 05:48:50 jtc Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)col.c 8.5 (Berkeley) 5/4/95"; #endif -static char rcsid[] = "$OpenBSD: col.c,v 1.4 1997/06/17 20:53:58 kstailey Exp $"; +static char rcsid[] = "$OpenBSD: col.c,v 1.5 1997/07/25 21:30:12 mickey Exp $"; #endif /* not lint */ #include <ctype.h> @@ -101,7 +101,6 @@ void flush_lines __P((int)); void flush_blanks __P((void)); void free_line __P((LINE *)); void usage __P((void)); -void wrerr __P((void)); void *xmalloc __P((void *, size_t)); CSET last_set; /* char_set of last char printed */ @@ -114,7 +113,7 @@ int no_backspaces; /* if not to output any backspaces */ #define PUTC(ch) \ if (putchar(ch) == EOF) \ - wrerr(); + err(1, "stdout"); int main(argc, argv) @@ -529,14 +528,6 @@ usage() } void -wrerr() -{ - - (void)fprintf(stderr, "col: write error.\n"); - exit(1); -} - -void dowarn(line) int line; { diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c index c00df3f8c73..072adc40c27 100644 --- a/usr.bin/id/id.c +++ b/usr.bin/id/id.c @@ -1,4 +1,4 @@ -/* $OpenBSD: id.c,v 1.5 1997/07/25 21:05:27 mickey Exp $ */ +/* $OpenBSD: id.c,v 1.6 1997/07/25 21:33:39 mickey Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)id.c 8.3 (Berkeley) 4/28/95";*/ -static char rcsid[] = "$OpenBSD: id.c,v 1.5 1997/07/25 21:05:27 mickey Exp $"; +static char rcsid[] = "$OpenBSD: id.c,v 1.6 1997/07/25 21:33:39 mickey Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -53,9 +53,9 @@ static char rcsid[] = "$OpenBSD: id.c,v 1.5 1997/07/25 21:05:27 mickey Exp $"; #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <err.h> void current __P((void)); -void err __P((const char *, ...)); void pretty __P((struct passwd *)); void group __P((struct passwd *, int)); void usage __P((void)); @@ -162,7 +162,7 @@ pretty(pw) group(pw, 1); } else { if ((login = getlogin()) == NULL) - err("getlogin: %s", strerror(errno)); + err(1, "getlogin"); pw = getpwuid(rid = getuid()); if (pw == NULL || strcmp(login, pw->pw_name)) @@ -311,45 +311,16 @@ who(u) id = strtoul(u, &ep, 10); if (*u && !*ep && (pw = getpwuid(id))) return(pw); - err("%s: No such user", u); - /* NOTREACHED */ -} - -#ifdef __STDC__ -#include <stdarg.h> -#else -#include <varargs.h> -#endif - -void -#ifdef __STDC__ -err(const char *fmt, ...) -#else -err(fmt, va_alist) - char *fmt; - va_dcl -#endif -{ - va_list ap; -#ifdef __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - (void)fprintf(stderr, "id: "); - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); - exit(1); + errx(1, "%s: No such user", u); /* NOTREACHED */ } void usage() { - (void)fprintf(stderr, "usage: id [user]\n"); - (void)fprintf(stderr, " id -G [-n] [user]\n"); - (void)fprintf(stderr, " id -g [-nr] [user]\n"); - (void)fprintf(stderr, " id -u [-nr] [user]\n"); + (void)fprintf(stderr, "usage: id [user]\n" + " id -G [-n] [user]\n" + " id -g [-nr] [user]\n" + " id -u [-nr] [user]\n"); exit(1); } |