add munmap call
[unix-history] / usr / src / usr.bin / tail / misc.c
CommitLineData
88ef8898
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * 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
31919d23 12static char sccsid[] = "@(#)misc.c 5.2 (Berkeley) %G%";
88ef8898
KB
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
24void
25ierr()
26{
31919d23 27 err(0, "%s: %s", fname, strerror(errno));
88ef8898
KB
28}
29
30void
31oerr()
32{
31919d23 33 err(1, "stdout: %s", strerror(errno));
88ef8898
KB
34}
35
36#if __STDC__
37#include <stdarg.h>
38#else
39#include <varargs.h>
40#endif
41
42void
43#if __STDC__
31919d23 44err(int fatal, const char *fmt, ...)
88ef8898 45#else
31919d23
KB
46err(fatal, fmt, va_alist)
47 int fatal;
88ef8898
KB
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");
31919d23
KB
62 if (fatal)
63 exit(1);
64 rval = 1;
88ef8898 65}