diff --git a/usr.bin/tset/Makefile b/usr.bin/tset/Makefile index c096f2a3409e..4fdf7793535e 100644 --- a/usr.bin/tset/Makefile +++ b/usr.bin/tset/Makefile @@ -1,7 +1,6 @@ -# $NetBSD: Makefile,v 1.4 1997/10/14 02:07:55 lukem Exp $ +# $NetBSD: Makefile,v 1.5 1997/10/20 01:07:48 lukem Exp $ # @(#)Makefile 8.1 (Berkeley) 6/9/93 -WARNS?= 1 PROG= tset SRCS= map.c misc.c set.c term.c tset.c wrterm.c diff --git a/usr.bin/tset/extern.h b/usr.bin/tset/extern.h index aa71b705756d..bc9a27191f01 100644 --- a/usr.bin/tset/extern.h +++ b/usr.bin/tset/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.4 1997/10/14 02:07:56 lukem Exp $ */ +/* $NetBSD: extern.h,v 1.5 1997/10/20 01:07:50 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -45,7 +45,6 @@ extern int erasechar, intrchar, killchar; void add_mapping __P((char *, char *)); void cat __P((char *)); -void err __P((const char *, ...)); char *get_termcap_entry __P((char *, char **)); char *mapped __P((char *)); void outc __P((int)); diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c index 01b8dbb8ba4f..4fedacf27230 100644 --- a/usr.bin/tset/map.c +++ b/usr.bin/tset/map.c @@ -1,4 +1,4 @@ -/* $NetBSD: map.c,v 1.7 1997/10/14 02:07:57 lukem Exp $ */ +/* $NetBSD: map.c,v 1.8 1997/10/20 01:07:51 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93"; #endif -__RCSID("$NetBSD: map.c,v 1.7 1997/10/14 02:07:57 lukem Exp $"); +__RCSID("$NetBSD: map.c,v 1.8 1997/10/20 01:07:51 lukem Exp $"); #endif /* not lint */ #include +#include #include #include #include @@ -83,7 +84,7 @@ add_mapping(port, arg) copy = strdup(arg); mapp = malloc((u_int)sizeof(MAP)); if (copy == NULL || mapp == NULL) - err("%s", strerror(errno)); + err(1, "malloc"); mapp->next = NULL; if (maplist == NULL) cur = maplist = mapp; @@ -159,7 +160,7 @@ next: if (*arg == ':') { /* If user specified a port with an option flag, set it. */ done: if (port) { if (mapp->porttype) -badmopt: err("illegal -m option format: %s", copy); +badmopt: errx(1, "illegal -m option format: %s", copy); mapp->porttype = port; } diff --git a/usr.bin/tset/misc.c b/usr.bin/tset/misc.c index b500264dd83f..9a81aa55242d 100644 --- a/usr.bin/tset/misc.c +++ b/usr.bin/tset/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.4 1997/10/14 02:07:58 lukem Exp $ */ +/* $NetBSD: misc.c,v 1.5 1997/10/20 01:07:52 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,9 +38,10 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/9/93"; #endif -__RCSID("$NetBSD: misc.c,v 1.4 1997/10/14 02:07:58 lukem Exp $"); +__RCSID("$NetBSD: misc.c,v 1.5 1997/10/20 01:07:52 lukem Exp $"); #endif /* not lint */ +#include #include #include #include @@ -57,13 +58,13 @@ cat(file) char buf[1024]; if ((fd = open(file, O_RDONLY, 0)) < 0) - err("%s: %s", file, strerror(errno)); + err(1, "%s", file); while ((nr = read(fd, buf, sizeof(buf))) > 0) if ((nw = write(STDERR_FILENO, buf, nr)) == -1) - err("write to stderr: %s", strerror(errno)); + err(1, "write to stderr"); if (nr != 0) - err("%s: %s", file, strerror(errno)); + err(1, "%s", file); (void)close(fd); } @@ -73,32 +74,3 @@ outc(c) { (void)putc(c, stderr); } - -#if __STDC__ -#include -#else -#include -#endif - -void -#if __STDC__ -err(const char *fmt, ...) -#else -err(fmt, va_alist) - char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - (void)fprintf(stderr, "tset: "); - (void)vfprintf(stderr, fmt, ap); - va_end(ap); - (void)fprintf(stderr, "\n"); - exit(1); - /* NOTREACHED */ -} diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c index 91d0824a158e..8339e1df1689 100644 --- a/usr.bin/tset/term.c +++ b/usr.bin/tset/term.c @@ -1,4 +1,4 @@ -/* $NetBSD: term.c,v 1.8 1997/10/14 02:08:01 lukem Exp $ */ +/* $NetBSD: term.c,v 1.9 1997/10/20 01:07:53 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93"; #endif -__RCSID("$NetBSD: term.c,v 1.8 1997/10/14 02:08:01 lukem Exp $"); +__RCSID("$NetBSD: term.c,v 1.9 1997/10/20 01:07:53 lukem Exp $"); #endif /* not lint */ #include +#include #include #include #include @@ -114,12 +115,14 @@ found: if ((p = getenv("TERMCAP")) != NULL && *p != '/') /* Find the termcap entry. If it doesn't exist, ask the user. */ while ((rval = tgetent(tbuf, ttype)) == 0) { - (void)fprintf(stderr, - "tset: terminal type %s is unknown\n", ttype); + warnx("terminal type %s is unknown", ttype); ttype = askuser(NULL); } - if (rval == -1) - err("termcap: %s", strerror(errno ? errno : ENOENT)); + if (rval == -1) { + if (!errno) + errno = ENOENT; + err(1, "%s", ""); + } *tcapbufp = tbuf; return (ttype); } diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c index 6d2d04f6270c..54aef765c8be 100644 --- a/usr.bin/tset/tset.c +++ b/usr.bin/tset/tset.c @@ -1,4 +1,4 @@ -/* $NetBSD: tset.c,v 1.5 1997/10/14 02:08:03 lukem Exp $ */ +/* $NetBSD: tset.c,v 1.6 1997/10/20 01:07:54 lukem Exp $ */ /*- * Copyright (c) 1980, 1991, 1993 @@ -43,12 +43,13 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993\n\ #if 0 static char sccsid[] = "@(#)tset.c 8.1 (Berkeley) 6/9/93"; #endif -__RCSID("$NetBSD: tset.c,v 1.5 1997/10/14 02:08:03 lukem Exp $"); +__RCSID("$NetBSD: tset.c,v 1.6 1997/10/20 01:07:54 lukem Exp $"); #endif /* not lint */ #include #include #include +#include #include #include #include @@ -83,7 +84,7 @@ main(argc, argv) char savech, *p, *t, *tcapbuf, *ttype; if (tcgetattr(STDERR_FILENO, &mode) < 0) - err("standard error: %s", strerror(errno)); + err(1, "standard error"); oldmode = mode; ospeed = cfgetospeed(&mode); @@ -100,7 +101,7 @@ main(argc, argv) obsolete(argv); noinit = noset = quiet = Sflag = sflag = showterm = 0; - while ((ch = getopt(argc, argv, "-a:d:e:Ii:k:m:np:QSrs")) != EOF) { + while ((ch = getopt(argc, argv, "-a:d:e:Ii:k:m:np:QSrs")) != -1) { switch (ch) { case '-': /* display term only */ noset = 1; @@ -195,7 +196,7 @@ main(argc, argv) savech = *p; *p = '\0'; if ((ttype = strdup(t)) == NULL) - err("%s", strerror(errno)); + err(1, "strdup"); *p = savech; } } diff --git a/usr.bin/tset/wrterm.c b/usr.bin/tset/wrterm.c index 7d0c26ea5790..f585ee532f60 100644 --- a/usr.bin/tset/wrterm.c +++ b/usr.bin/tset/wrterm.c @@ -1,4 +1,4 @@ -/* $NetBSD: wrterm.c,v 1.5 1997/10/14 02:08:05 lukem Exp $ */ +/* $NetBSD: wrterm.c,v 1.6 1997/10/20 01:07:55 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,11 +38,12 @@ #if 0 static char sccsid[] = "@(#)wrterm.c 8.1 (Berkeley) 6/9/93"; #endif -__RCSID("$NetBSD: wrterm.c,v 1.5 1997/10/14 02:08:05 lukem Exp $"); +__RCSID("$NetBSD: wrterm.c,v 1.6 1997/10/20 01:07:55 lukem Exp $"); #endif /* not lint */ #include #include +#include #include #include #include "extern.h" @@ -55,13 +56,13 @@ void wrtermcap(bp) char *bp; { - register int ch; - register char *p; + int ch; + char *p; char *t, *sep; /* Find the end of the terminal names. */ - if ((t = index(bp, ':')) == NULL) - err("termcap names not colon terminated"); + if ((t = strchr(bp, ':')) == NULL) + errx(1, "termcap names not colon terminated"); *t++ = '\0'; /* Output terminal names that don't have whitespace or quotes. */