SUMMARY: How to test a byte in a bin file

From: Jacques-D. Piguet (Jacques.Piguet@ericsson.com)
Date: Wed Jun 16 2004 - 10:25:58 EDT


Hi all,

Many thanks to Lars Hecking who brought the solution!

Best regards, Jacques-D. Piguet

=================================================
#! /usr/bin/csh

@ CHECKSUM_OK = <Some value>
set R0 = <Some binary file>
set BYTES = `od -t u1 -j 0x800 -N 2 $R0 | head -1 | cut -f2,3 -d' '`
@ SUBFILES = $BYTES[1]
@ CHECKSUM = $BYTES[2]

if $CHECKSUM != $CHECKSUM_OK then
   echo WARNING: This dump has an invalid checksum \!
   exit 1
endif

@ i = 0
while ($i <= 5)
   if ($SUBFILES & (1 << $i)) != 0 then
     echo R$i is in use
   else
     echo R$i is not used
   endif
   @ i ++
end

=================================================

Hi Managers,

I need to test the value of a specific byte in a binary file and a
specific bit in another byte:
- Is the byte at offset &801 equal to &3F ?
- Is the bit 3 of byte at offset &800 equal to 1 ?

How to do that in a script?

BR and thanks, Jacques-D. Piguet
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:28:53 EDT