head     1.1;
branch   1.1.1;
access   ;
symbols  start:1.1.1.1 webdox:1.1.1;
locks    ; strict;
comment  @# @;


1.1
date     2003.03.15.00.57.44;  author redpain;  state Exp;
branches 1.1.1.1;
next     ;

1.1.1.1
date     2003.03.15.00.57.44;  author redpain;  state Exp;
branches ;
next     ;


desc
@@



1.1
log
@Initial revision
@
text
@#! /usr/bin/perl

# Scan a file for a 32-bit word with a particular value.
# $Revision: 1.1 $

use strict qw(refs vars);
use FileHandle;

my $filename = shift @@ARGV;
my $word_value = shift @@ARGV;

((defined $filename) && (defined $word_value))
    || die "Usage: scan <filename> <word value in hex>\n";

my $fh = new FileHandle("<$filename");
my $val = hex($word_value);

my $buf = ' ' x 4;

my $offset = 0;
while ( read( $fh, $buf, 4) == 4 ) {
    my $out = unpack "V", $buf;
    if ( $out == $val ) {
	print "Found value $word_value at offset $offset\n";
	exit;
    }
    $offset += 4;
}
print "Didn't find value $word_value\n";
@


1.1.1.1
log
@Project Start
@
text
@@
