summaryrefslogtreecommitdiff
path: root/usr.bin/cmp
diff options
context:
space:
mode:
authorKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-05-28 19:19:51 -0500
committerKiyoshi Aman <kiyoshi.aman+adelie@gmail.com>2019-05-28 19:19:51 -0500
commit5e166e5a1e6a1dd0bab8ad057ce66063f5abc8e1 (patch)
tree67ceb4c573f48bb87f576bd60a097a9a55d3769d /usr.bin/cmp
parent0986a21124880869cb146ac7fa80a6bc3a6f09dd (diff)
downloaduserland-5e166e5a1e6a1dd0bab8ad057ce66063f5abc8e1.tar.gz
userland-5e166e5a1e6a1dd0bab8ad057ce66063f5abc8e1.tar.bz2
userland-5e166e5a1e6a1dd0bab8ad057ce66063f5abc8e1.tar.xz
userland-5e166e5a1e6a1dd0bab8ad057ce66063f5abc8e1.zip
usr.bin/cmp: make buildable, remove nonstandard flag
Diffstat (limited to 'usr.bin/cmp')
-rw-r--r--usr.bin/cmp/cmp.110
-rw-r--r--usr.bin/cmp/cmp.c29
-rw-r--r--usr.bin/cmp/extern.h6
-rw-r--r--usr.bin/cmp/misc.c9
-rw-r--r--usr.bin/cmp/regular.c11
-rw-r--r--usr.bin/cmp/special.c9
6 files changed, 9 insertions, 65 deletions
diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1
index e61f62c..e55d7c6 100644
--- a/usr.bin/cmp/cmp.1
+++ b/usr.bin/cmp/cmp.1
@@ -40,7 +40,6 @@
.Nd compare two files
.Sh SYNOPSIS
.Nm
-.Op Fl c
.Op Fl l | Fl s
.Ar file1 file2
.Op Ar skip1 Op Ar skip2
@@ -56,15 +55,6 @@ Bytes and lines are numbered beginning with one.
.Pp
The following options are available:
.Bl -tag -width flag
-.It Fl c
-Do the compare using
-.Xr getc 3
-rather than
-.Xr mmap 2 .
-Combined with the
-.Fl l
-flag, this can be helpful in locating an I/O error in the underlying
-device.
.It Fl l
Print the byte number (decimal) and the differing
byte values (octal) for each difference.
diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c
index 4301731..eed0b52 100644
--- a/usr.bin/cmp/cmp.c
+++ b/usr.bin/cmp/cmp.c
@@ -29,20 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1987, 1990, 1993, 1994\
- The Regents of the University of California. All rights reserved.");
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)cmp.c 8.3 (Berkeley) 4/2/94";
-#else
-__RCSID("$NetBSD: cmp.c,v 1.20 2016/10/30 19:33:49 christos Exp $");
-#endif
-#endif /* not lint */
-
#include <sys/types.h>
#include <sys/stat.h>
@@ -51,6 +37,7 @@ __RCSID("$NetBSD: cmp.c,v 1.20 2016/10/30 19:33:49 christos Exp $");
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <bsd/stdlib.h>
#include <string.h>
#include <unistd.h>
#include <locale.h>
@@ -59,7 +46,7 @@ __RCSID("$NetBSD: cmp.c,v 1.20 2016/10/30 19:33:49 christos Exp $");
int lflag, sflag;
-__dead static void usage(void);
+static void usage(void);
int
main(int argc, char *argv[])
@@ -72,11 +59,8 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
special = 0;
- while ((ch = getopt(argc, argv, "cls")) != -1)
+ while ((ch = getopt(argc, argv, "ls")) != -1)
switch (ch) {
- case 'c':
- special = 1; /* careful! Don't use mmap() */
- break;
case 'l': /* print all differences */
lflag = 1;
break;
@@ -108,9 +92,6 @@ main(int argc, char *argv[])
exit(ERR_EXIT);
}
if (strcmp(file2 = argv[1], "-") == 0) {
- if (special)
- errx(ERR_EXIT,
- "standard input may only be specified once");
special = 1;
fd2 = 0;
file2 = "stdin";
@@ -125,12 +106,12 @@ main(int argc, char *argv[])
char *ep;
errno = 0;
- skip1 = strtoq(argv[2], &ep, 0);
+ skip1 = strtoll(argv[2], &ep, 0);
if (errno || ep == argv[2])
usage();
if (argc == 4) {
- skip2 = strtoq(argv[3], &ep, 0);
+ skip2 = strtoll(argv[3], &ep, 0);
if (errno || ep == argv[3])
usage();
}
diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h
index d8a72ed..09800bc 100644
--- a/usr.bin/cmp/extern.h
+++ b/usr.bin/cmp/extern.h
@@ -37,8 +37,8 @@
void c_regular(int, const char *, off_t, off_t, int, const char *, off_t, off_t);
void c_special(int, const char *, off_t, int, const char *, off_t);
-__dead void diffmsg(const char *, const char *, off_t, off_t);
-__dead void eofmsg(const char *, off_t, off_t);
-__dead void errmsg(const char *, off_t, off_t);
+void diffmsg(const char *, const char *, off_t, off_t);
+void eofmsg(const char *, off_t, off_t);
+void errmsg(const char *, off_t, off_t);
extern int lflag, sflag;
diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c
index 3195de9..7bc169f 100644
--- a/usr.bin/cmp/misc.c
+++ b/usr.bin/cmp/misc.c
@@ -29,15 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
-#else
-__RCSID("$NetBSD: misc.c,v 1.12 2009/04/11 12:16:12 lukem Exp $");
-#endif
-#endif /* not lint */
-
#include <sys/types.h>
#include <err.h>
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c
index 63c663f..1112def 100644
--- a/usr.bin/cmp/regular.c
+++ b/usr.bin/cmp/regular.c
@@ -29,15 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)regular.c 8.3 (Berkeley) 4/2/94";
-#else
-__RCSID("$NetBSD: regular.c,v 1.24 2013/11/20 17:19:14 kleink Exp $");
-#endif
-#endif /* not lint */
-
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -54,7 +45,7 @@ void
c_regular(int fd1, const char *file1, off_t skip1, off_t len1,
int fd2, const char *file2, off_t skip2, off_t len2)
{
- u_char ch, *p1, *p2;
+ unsigned char ch, *p1, *p2;
off_t byte, length, line;
int dfound;
size_t blk_sz, blk_cnt;
diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c
index 0b1afc5..e9a10a7 100644
--- a/usr.bin/cmp/special.c
+++ b/usr.bin/cmp/special.c
@@ -29,15 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)special.c 8.3 (Berkeley) 4/2/94";
-#else
-__RCSID("$NetBSD: special.c,v 1.14 2011/11/28 10:10:10 wiz Exp $");
-#endif
-#endif /* not lint */
-
#include <sys/types.h>
#include <err.h>