Commit Graph

21 Commits

Author SHA1 Message Date
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Philippe Charnier
dd99983988 add __unused to succeed at WARNS=6 2008-07-10 13:26:46 +00:00
David Schultz
d48905120d 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
David Malone
f2e8e0dad7 ANSIify function definitions to avoid a warning. 2002-07-28 15:13:17 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
David Malone
9f5b04e925 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
David Malone
5748d9ba6f 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
Mark Murray
6af414cb2e Turn on WARNS=2.
Use __FBSDID().
2001-12-02 23:29:26 +00:00
David Malone
c5250ed112 Make filenames const to avoid a few warnings.
Add FreeBSD tags.

Reviewed by:	cmp
2001-11-05 20:33:40 +00:00
David Malone
60b49f05fa 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
Brian Feldman
84ad3d8fc4 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
Poul-Henning Kamp
78cb0ab485 Oops, byte offset was as off_t. 2000-05-15 08:43:25 +00:00
Poul-Henning Kamp
e03983a32c 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
Brian Feldman
ac02226555 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
Warner Losh
96846ff646 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 Cobbs
fa146c5335 Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00
Alexander Langer
8abdc2eb40 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
Joerg Wunsch
c28065c606 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
John Dyson
2ae09ad871 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
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00