date and time created 91/07/21 14:50:09 by bostic
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 22 Jul 1991 05:50:09 +0000 (21:50 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 22 Jul 1991 05:50:09 +0000 (21:50 -0800)
SCCS-vsn: usr.bin/tail/misc.c 5.1

usr/src/usr.bin/tail/misc.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/tail/misc.c b/usr/src/usr.bin/tail/misc.c
new file mode 100644 (file)
index 0000000..2704278
--- /dev/null
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Edward Sze-Tyan Wang.
+ *
+ * %sccs.include.redist.c%
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)misc.c     5.1 (Berkeley) %G%";
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "extern.h"
+
+void
+ierr()
+{
+       err("%s: %s", fname, strerror(errno));
+}
+
+void
+oerr()
+{
+       err("stdout: %s", strerror(errno));
+}
+
+#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, "tail: ");
+       (void)vfprintf(stderr, fmt, ap);
+       va_end(ap);
+       (void)fprintf(stderr, "\n");
+       exit(1);
+       /* NOTREACHED */
+}