summaryrefslogtreecommitdiffstats
path: root/usr.bin/tset/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tset/misc.c')
-rw-r--r--usr.bin/tset/misc.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/usr.bin/tset/misc.c b/usr.bin/tset/misc.c
index 27a2bf6..1e94df1 100644
--- a/usr.bin/tset/misc.c
+++ b/usr.bin/tset/misc.c
@@ -32,11 +32,15 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/9/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <fcntl.h>
-#include <errno.h>
+#include <err.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -51,13 +55,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);
}
@@ -67,32 +71,3 @@ outc(c)
{
return putc(c, stderr);
}
-
-#if __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#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 */
-}
OpenPOWER on IntegriCloud