Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!ames!lll-tis!lll-winken!uunet!mcvax!ukc!warwick!cvaxa!aledm
From: aledm@cvaxa.sussex.ac.uk (Aled Morris)
Newsgroups: comp.unix.wizards
Subject: Re: cmp efficiency
Summary: cmp is wrong if you say "-s"
Message-ID: <494@cvaxa.sussex.ac.uk>
Date: 7 Jul 88 19:42:16 GMT
References: <16186@brl-adm.ARPA> <56810@sun.uucp> <3048@ccicpg.UUCP>
Organization: School of Cognitive Sciences, Univ of Sussex, Brighton, UK
Lines: 21

In article <3048@ccicpg.UUCP>, nick@ccicpg.UUCP (Nick Crossley) writes:
>>While we're on the subject of efficiency, cmp is coded wrong. It should
>>first stat the two files to be compared. If the character count is different,
>>so are the files. And files tend to be different more often than the same.
[...]
>        if the files are not the same size, cmp will tell you if they have the
>same contents up to the length of the shorter (cmp will say 'EOF on file 1/2').
>I find this useful in some contexts, and would not want cmp just to give up
>if the sizes differed.

I never use "cmp" and to read its output, I only ever use it with "-s".
If you specify this flag, cmp really ought to look at the file sizes first.

Aled Morris
systems programmer

      mail: aledm@uk.ac.sussex.cvaxa   |   School of Cognitive Science
      uucp: ..!mcvax!ukc!cvaxa!aledm   |   University of Sussex
      talk: +44-(0)273-606755  x4284   |   Falmer, Brighton  BN1 9QN
       fax: +44-(0)273-678335          |   East Sussex, England
   "I'm living in the future/I feel wonderful/I'm tipping over backwards...
I'm so ambitious/I'm looking back/I'm running a race and you're the book I read"