1 /*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Edward Sze-Tyan Wang.
7 *
8 * %sccs.include.redist.c%
9 */
10
11 #ifndef lint
12 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 06/06/93";
13 #endif /* not lint */
14
15 #include <sys/types.h>
16 #include <sys/stat.h>
17 #include <errno.h>
18 #include <unistd.h>
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include "extern.h"
23
24 void
ierr()25 ierr()
26 {
27 err(0, "%s: %s", fname, strerror(errno));
28 }
29
30 void
oerr()31 oerr()
32 {
33 err(1, "stdout: %s", strerror(errno));
34 }
35
36 #if __STDC__
37 #include <stdarg.h>
38 #else
39 #include <varargs.h>
40 #endif
41
42 void
43 #if __STDC__
err(int fatal,const char * fmt,...)44 err(int fatal, const char *fmt, ...)
45 #else
46 err(fatal, fmt, va_alist)
47 int fatal;
48 char *fmt;
49 va_dcl
50 #endif
51 {
52 va_list ap;
53 #if __STDC__
54 va_start(ap, fmt);
55 #else
56 va_start(ap);
57 #endif
58 (void)fprintf(stderr, "tail: ");
59 (void)vfprintf(stderr, fmt, ap);
60 va_end(ap);
61 (void)fprintf(stderr, "\n");
62 if (fatal)
63 exit(1);
64 rval = 1;
65 }
66