Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Release 1.0
[palacios.git] / geekos / scripts / scan
diff --git a/geekos/scripts/scan b/geekos/scripts/scan
new file mode 100755 (executable)
index 0000000..cbfe6dc
--- /dev/null
@@ -0,0 +1,29 @@
+#! /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";