Commit Graph

32 Commits

Author SHA1 Message Date
enami fa07a48b77 Don't put a space before function call operator. 2005-04-11 10:39:06 +00:00
enami e61e3e0913 byte offset and line count shouldn't be initialized inside the loop. 2005-04-11 09:41:02 +00:00
enami 168f415563 Fix indent and wrap long lines. 2005-04-11 09:40:15 +00:00
dsl 48a0480288 Initialise dfound outside loop so that 0 sized files compare correctly
and to that 'cmp -l' will exit with error is the last block matches.
Pointed out in a private mail bt someone who wishes to remain anonymous.
2005-03-07 07:51:42 +00:00
dsl afc59ef61f mmap normal files in 1MB chunks.
Due to a bug in mmap() the address space isn't counted against ulimit
until the page is faulted in - so mmapping a large file suceeds, but
cmp SIGSEGVs when it runs out of address space.
Also I don't believe that the madvise( MAP_SEQUENTIAL) has the desired
effect, and mmaping a large file is probably very bad for the UBC.
2005-02-06 21:19:46 +00:00
dsl 6ffe77ddd2 Taking (out) the __P 2005-02-06 20:50:34 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
ross 2a76afae02 Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:36:18 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
lukem c2b84904ae use %ll_ instead of the less standard %q_ 2001-01-04 23:05:54 +00:00
mycroft 2dc192ae06 Use MAP_SHARED. 2000-07-27 02:58:57 +00:00
jdolecek 2d6604a645 Do not mmap() with MAP_PRIVATE - looks like kernel tries to preallocate
some memory in case the mmapped contents would be changed and this fails
for very large files; it's unnecessary anyway, cmp(1) does not change file
contents in any way.
This fixes bin/10625 by Uwe Klaus.

While here, change the code to fallback to classic stdio if mmap fails.
2000-07-18 10:23:43 +00:00
kleink 0848e8913a * Hint MADV_SEQUENTIAL.
* -1 -> MAP_FAILED.
2000-03-20 18:23:26 +00:00
ross f670fa10c5 Add { and } to shut up egcs. Reformat the more questionable code. 1998-08-25 20:59:36 +00:00
mikel 83d4f0d268 make usage string match manpage 1998-01-12 08:11:19 +00:00
mrg 25b87a361a use MAP_PRIVATE|MAP_FILE rather than "0" 1997-12-09 10:59:54 +00:00
mrg 66f7b9fd72 fix compile warnings on the alpha. 1997-10-19 14:05:56 +00:00
lukem 9992ac3ea9 getopt returns -1 not EOF 1997-10-18 12:54:24 +00:00
lukem 18ce25404d WARNSify, fix .Nm usage 1997-10-18 12:52:04 +00:00
tls 9d225a1783 RCS ID police 1997-01-09 20:18:21 +00:00
mrg dc8adb9e7c don't warn about missing files with -s. POSIX doesn't define a specific
action, and, most other implimentations use this (sane) method.  (from jtc).
1996-02-01 03:32:41 +00:00
tls 94f6fc8e46 Sync with 4.4lite2 1995-09-08 03:22:54 +00:00
tls 46ef75ac74 imported from 44lite2 1995-09-04 21:07:24 +00:00
mycroft adf20f8c80 Fix bug in handling short reads. 1994-03-25 17:07:02 +00:00
mycroft 84f6895ad3 As suggested by Xavier Leroy <xavier@Theory.Stanford.EDU>, make sure we don't
flag a short read on the 2nd file as an EOF when it isn't.  This implementation
differs in that at most one read is done per file per comparison, so that an
early mismatch may avoid hanging on input or continuing some expensive process
if reading from a pipe.
1993-12-02 01:56:04 +00:00
jtc 4d9f06c8e5 Get rid of otoi(), use strtoul() instead. Not only gets rid of a function,
but allows hex offsets as well.
Misc other minor tweaks.
1993-11-23 00:50:46 +00:00
jtc ed96eac23a Document the fact that cmp now conforms to POSIX.2. 1993-09-21 22:37:52 +00:00
jtc 8ad38f4118 Changed to conform to POSIX.2:
EOF message printed to stderr.
Removed bogositys wrt. getopt() processing (special casing `-' is unnecessary).
Updated usage message to document fact that -s and -l options are mutually
exclusive.
1993-09-21 22:35:56 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
mycroft dfb9caab49 Add RCS indentifiers. 1993-08-01 07:32:48 +00:00
mycroft 690cae8181 Add RCS indentifiers. 1993-07-31 15:17:49 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00