POSIX 1003.2B/D9 symbolic links
[unix-history] / usr / src / usr.bin / cmp / misc.c
CommitLineData
3c5ddde7 1/*-
e5824735
KB
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
3c5ddde7
KB
4 *
5 * %sccs.include.redist.c%
6 */
7
8#ifndef lint
e5824735 9static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) %G%";
3c5ddde7
KB
10#endif /* not lint */
11
12#include <sys/types.h>
13#include <stdio.h>
14#include <stdlib.h>
15#include "extern.h"
16
17void
18eofmsg(file)
19 char *file;
20{
21 if (!sflag)
22 (void)fprintf(stderr, "cmp: EOF on %s\n", file);
23 exit(1);
24}
25
26void
27diffmsg(file1, file2, byte, line)
28 char *file1, *file2;
29 off_t byte, line;
30{
31 if (!sflag)
9e7572e5 32 (void)printf("%s %s differ: char %qd, line %qd\n",
3c5ddde7
KB
33 file1, file2, byte, line);
34 exit(1);
35}
36
37#if __STDC__
38#include <stdarg.h>
39#else
40#include <varargs.h>
41#endif
42
43void
44#if __STDC__
45err(const char *fmt, ...)
46#else
47err(fmt, va_alist)
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, "cmp: ");
59 (void)vfprintf(stderr, fmt, ap);
60 va_end(ap);
61 (void)fprintf(stderr, "\n");
62 exit(2);
63 /* NOTREACHED */
64}