Commit Graph

37 Commits

Author SHA1 Message Date
murray
30398d34ea phk added the -x option in May 2000, but only for regular files; for
special files it was treated like -l.  This commit adds the -x option
in for special files as well.

PR:		bin/46249
Submitted by:	Colin Percival <cperciva@sfu.ca>
2003-06-19 07:24:26 +00:00
das
9f4f6d9aa9 The cmp utility has the questionable feature of using mmap when
comparing regular files.  Add a SIGSEGV handler to make its
behavior less surprising when a read error occurs.  The handler
does not attempt to distinguish errors from file truncation, but
anyone actively modifying a file while trying to compare it
shouldn't even expect something sane to happen.

PR:		45391
Reviewed by:	mike (mentor)
2003-02-26 06:44:46 +00:00
schweikh
28d78933e7 Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
dwmalone
7e6edb2c7e ANSIify function definitions to avoid a warning. 2002-07-28 15:13:17 +00:00
tjr
6a4312625e No need to check for "-" explicitly in getopt() loop. 2002-06-07 02:35:21 +00:00
tjr
9147b02d6c Exit >1 when an error occurs, regardless of whether -s is specified (SUSv3) 2002-06-07 02:30:56 +00:00
imp
0338ac6a1a remove __P 2002-03-22 01:22:50 +00:00
markm
72f8b8d824 Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
dwmalone
7a4ad1e332 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
dwmalone
2ef6612038 Cast off_t to long long before printing. Use %ll instead of %q incase
long long and quad_t are not the same.
2001-12-03 20:56:16 +00:00
markm
16413a4a7b Turn on WARNS=2.
Use __FBSDID().
2001-12-02 23:29:26 +00:00
dwmalone
d624682564 Make filenames const to avoid a few warnings.
Add FreeBSD tags.

Reviewed by:	cmp
2001-11-05 20:33:40 +00:00
dwmalone
5c617b01fb Don't use gcc -Wall flag. Add FreeBSD: line. 2001-11-05 20:27:17 +00:00
dwmalone
620d500283 Make cmp work by mmapping chunks of a file, rather than the whole
file at one time.

PR:		24732
Submitted by:	Andrew L. Neporada <andr@dgap.mipt.ru>
MFC after:	2 weeks
2001-11-04 21:31:16 +00:00
dd
7d1013753f Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
ru
0957874304 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
sheldonh
f632918f01 Fix a bug introduced in rev 1.8, where special files ended up
being treated like regular files because of missing braces.

PR:		20143
2000-07-25 13:01:34 +00:00
brian
52aeebe4a8 Add the -z flag to check file sizes first
Correct the cmp.1 usage message
Correct the -l/-s incompatibility message

Submitted by: Mark Knight <markk@knigma.org>
2000-07-14 16:54:59 +00:00
green
2562c15e95 Make cmp -s work properly if skip values are given. Also, exit(1)
is now exit(DIFF_EXIT).

PR:		18597
Submitted by:	Anatoly Vorobey <mellon@pobox.com>
Committed at:	Usenix terminal room
2000-06-20 20:28:40 +00:00
phk
3dc559cdc7 Oops, byte offset was as off_t. 2000-05-15 08:43:25 +00:00
phk
6d9d3152cc Let cmp(1) grow in -x option to print differences in contemporarry hex
format rather than the mixed decimal/octal format of -l.
2000-05-15 08:30:43 +00:00
peter
e4b04a2b21 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
green
6bc22f00ac Fix improper mmap length paramater which can result in improper behavior
or cmp crashing in specific cases.
1999-07-29 23:26:22 +00:00
imp
b8d073ef7a More egcs warning fixes:
o main returns int not void
	o use return 0 at end of main when needed
	o use braces to avoid potentially ambiguous else
	o don't default to type int
	o #ifdef 0 -> #if 0

Reviewed by: obrien and chuckr
1999-04-25 22:37:58 +00:00
archie
b24c3efc8e Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00
steve
862b1db549 "EOF of file..." is written to stderr and not stdout.
PR:		6756
1998-05-26 00:39:12 +00:00
jlemon
4963345d55 Permit hex/octal parameters to cmp, to match what the manual page says.
PR:		3850, 3855
1997-08-19 14:34:04 +00:00
charnier
8f5625f239 Correct usage string. Program name converted to bold in man page. 1997-06-26 11:22:12 +00:00
imp
cd84ece5fd compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
peter
aef78d145b Revert $FreeBSD$ to $Id$ 1997-02-22 19:58:13 +00:00
alex
ee019a53dc Sweep through the tree fixing mmap() usage:
- Use MAP_FAILED instead of the constant -1 to indicate
    failure (required by POSIX).
  - Removed flag arguments of '0' (required by POSIX).
  - Fixed code which expected an error return of 0.
  - Fixed code which thought any address with the high bit set
    was an error.
  - Check for failure where no checks were present.

Discussed with:	bde
1997-01-16 21:58:40 +00:00
jkh
9c0cd3f9df Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
joerg
905959b15e Our mmap(2) has a limitation where the `offset' parameter must be
page-aligned.  cmp(1) should know about this flaw, and work around it.

While i was at it, fixed an uninitialized variable as reported by
-Wall.
1997-01-08 12:00:55 +00:00
dyson
804439a665 When mmap is used, do an madvise(MADV_SEQUENTIAL) to make things
go much more quickly when file input is really done.  Of course, the
fully cached case will make no difference.
1996-12-11 05:20:20 +00:00
wosch
d4a1c1cff8 [HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41
1996-08-29 18:06:19 +00:00
jkh
6d2b5649a0 I don't like what they did to cmp(1) in 4.4 Lite; now it whines all
the time, even with -s.  Make cmp SHUT UP about non-existant files
when run with -s.
Submitted by:	jkh
1994-08-20 11:14:07 +00:00
rgrimes
f9ab90d9d6 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00