Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/cmp add a flag to avoid mmap...
details: https://anonhg.NetBSD.org/src/rev/cce423b5970a
branches: trunk
changeset: 348615:cce423b5970a
user: christos <christos%NetBSD.org@localhost>
date: Sun Oct 30 19:13:36 2016 +0000
description:
add a flag to avoid mmap...
diffstat:
usr.bin/cmp/cmp.1 | 15 ++++++++++++---
usr.bin/cmp/cmp.c | 13 ++++++++-----
2 files changed, 20 insertions(+), 8 deletions(-)
diffs (91 lines):
diff -r 484dd0231786 -r cce423b5970a usr.bin/cmp/cmp.1
--- a/usr.bin/cmp/cmp.1 Sun Oct 30 16:17:16 2016 +0000
+++ b/usr.bin/cmp/cmp.1 Sun Oct 30 19:13:36 2016 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: cmp.1,v 1.9 2003/08/07 11:13:21 agc Exp $
+.\" $NetBSD: cmp.1,v 1.10 2016/10/30 19:13:36 christos Exp $
.\"
.\" Copyright (c) 1987, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -32,7 +32,7 @@
.\"
.\" @(#)cmp.1 8.1 (Berkeley) 6/6/93
.\"
-.Dd June 6, 1993
+.Dd October 30, 2016
.Dt CMP 1
.Os
.Sh NAME
@@ -40,7 +40,7 @@
.Nd compare two files
.Sh SYNOPSIS
.Nm
-.Op Fl l | Fl s
+.Op Fl c | Fl l | Fl s
.Ar file1 file2
.Op Ar skip1 Op Ar skip2
.Sh DESCRIPTION
@@ -55,6 +55,15 @@
.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 -r 484dd0231786 -r cce423b5970a usr.bin/cmp/cmp.c
--- a/usr.bin/cmp/cmp.c Sun Oct 30 16:17:16 2016 +0000
+++ b/usr.bin/cmp/cmp.c Sun Oct 30 19:13:36 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmp.c,v 1.18 2011/08/29 14:14:11 joerg Exp $ */
+/* $NetBSD: cmp.c,v 1.19 2016/10/30 19:13:36 christos Exp $ */
/*
* Copyright (c) 1987, 1990, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)cmp.c 8.3 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: cmp.c,v 1.18 2011/08/29 14:14:11 joerg Exp $");
+__RCSID("$NetBSD: cmp.c,v 1.19 2016/10/30 19:13:36 christos Exp $");
#endif
#endif /* not lint */
@@ -71,8 +71,12 @@
setlocale(LC_ALL, "");
- while ((ch = getopt(argc, argv, "ls")) != -1)
+ special = 0;
+ while ((ch = getopt(argc, argv, "cls")) != -1)
switch (ch) {
+ case 'c':
+ special = 1; /* careful! Don't use mmap() */
+ break;
case 'l': /* print all differences */
lflag = 1;
break;
@@ -93,7 +97,6 @@
usage();
/* Backward compatibility -- handle "-" meaning stdin. */
- special = 0;
if (strcmp(file1 = argv[0], "-") == 0) {
special = 1;
fd1 = 0;
@@ -159,6 +162,6 @@
{
(void)fprintf(stderr,
- "usage: cmp [-l | -s] file1 file2 [skip1 [skip2]]\n");
+ "usage: cmp [-c | -l | -s] file1 file2 [skip1 [skip2]]\n");
exit(ERR_EXIT);
}
Home |
Main Index |
Thread Index |
Old Index