Quoting James Fidell ([EMAIL PROTECTED]):
> Quoting [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> 
> > Would that work?
> 
> No.  It's late, I'm tired.  And wrong.
> 
> > cut is line based.  So the first 8 bytes on each line will be missed ...
> > if the difference lies with the first 8 bytes they will not be detected ..?
> 
> Yup, you're dead right.  I was just thinking "how do I cut the first
> 8 bytes off a file?" and got the wrong command, but it gave the results
> I was expecting so I didn't worry any more.  cmp is supposed to take
> offsets into the file for the start of comparison anyway, but it doesn't
> appear to on any of my boxes.
> 
> I'll remember how to do it properly in a moment.  Probably just after
> I send this email.

Ok, hopefully getting it right this time, to compare two COFF files:

  $ m68k-palmos-gcc -Wall -O2 -c -o tools1.o tools.c
  $ m68k-palmos-gcc -Wall -O2 -c -o tools2.o tools.c
  $ tail -c +9 tools1.o > t1
  $ tail -c +9 tools2.o > t2
  $ ls -l tools?.o t?
  -rw-rw-r--    1 james    james        3203 Feb  5 01:34 t1
  -rw-rw-r--    1 james    james        3203 Feb  5 01:34 t2
  -rw-rw-r--    1 james    james        3211 Feb  5 01:34 tools1.o
  -rw-rw-r--    1 james    james        3211 Feb  5 01:34 tools2.o
  $ cmp -s tools?.o || echo different
  different
  $ cmp -s t? && echo same
  same

Or, with GNU cmp:

  $ cmp --ignore-initial=8 tools?.o && echo same
  same

which is possibly the neatest way of all.

I guess if you want to avoid the entire COFF header, you need "tail -c +17"
or "cmp --ignore-initial=16" instead.

James

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to