cmp efficiency

Aled Morris aledm at cvaxa.sussex.ac.uk
Fri Jul 8 05:42:16 AEST 1988


In article <3048 at ccicpg.UUCP>, nick at 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 at 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"



More information about the Comp.unix.wizards mailing list