150450Sbostic /*-
2*62299Sbostic * Copyright (c) 1991, 1993
3*62299Sbostic * The Regents of the University of California. All rights reserved.
450450Sbostic *
550450Sbostic * This code is derived from software contributed to Berkeley by
650450Sbostic * Edward Sze-Tyan Wang.
750450Sbostic *
850450Sbostic * %sccs.include.redist.c%
950450Sbostic */
1050450Sbostic
1150450Sbostic #ifndef lint
12*62299Sbostic static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 06/06/93";
1350450Sbostic #endif /* not lint */
1450450Sbostic
1550450Sbostic #include <sys/types.h>
1650450Sbostic #include <sys/stat.h>
1750450Sbostic #include <errno.h>
1850450Sbostic #include <unistd.h>
1950450Sbostic #include <stdio.h>
2050450Sbostic #include <stdlib.h>
2150450Sbostic #include <string.h>
2250450Sbostic #include "extern.h"
2350450Sbostic
2450450Sbostic void
ierr()2550450Sbostic ierr()
2650450Sbostic {
2752827Sbostic err(0, "%s: %s", fname, strerror(errno));
2850450Sbostic }
2950450Sbostic
3050450Sbostic void
oerr()3150450Sbostic oerr()
3250450Sbostic {
3352827Sbostic err(1, "stdout: %s", strerror(errno));
3450450Sbostic }
3550450Sbostic
3650450Sbostic #if __STDC__
3750450Sbostic #include <stdarg.h>
3850450Sbostic #else
3950450Sbostic #include <varargs.h>
4050450Sbostic #endif
4150450Sbostic
4250450Sbostic void
4350450Sbostic #if __STDC__
err(int fatal,const char * fmt,...)4452827Sbostic err(int fatal, const char *fmt, ...)
4550450Sbostic #else
4652827Sbostic err(fatal, fmt, va_alist)
4752827Sbostic int fatal;
4850450Sbostic char *fmt;
4950450Sbostic va_dcl
5050450Sbostic #endif
5150450Sbostic {
5250450Sbostic va_list ap;
5350450Sbostic #if __STDC__
5450450Sbostic va_start(ap, fmt);
5550450Sbostic #else
5650450Sbostic va_start(ap);
5750450Sbostic #endif
5850450Sbostic (void)fprintf(stderr, "tail: ");
5950450Sbostic (void)vfprintf(stderr, fmt, ap);
6050450Sbostic va_end(ap);
6150450Sbostic (void)fprintf(stderr, "\n");
6252827Sbostic if (fatal)
6352827Sbostic exit(1);
6452827Sbostic rval = 1;
6550450Sbostic }
66