bingrep: useful debug utility
authorVictor Grishchenko <victor.grishchenko@gmail.com>
Wed, 16 Jun 2010 09:22:33 +0000 (11:22 +0200)
committerVictor Grishchenko <victor.grishchenko@gmail.com>
Wed, 16 Jun 2010 09:22:33 +0000 (11:22 +0200)
bingrep.cpp [new file with mode: 0644]

diff --git a/bingrep.cpp b/bingrep.cpp
new file mode 100644 (file)
index 0000000..7ed2c1c
--- /dev/null
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <string.h>
+#include "bin64.h"
+
+int main (int argn, char** args) {
+    int lr;
+    unsigned long long of;
+    sscanf(args[1],"%i,%lli",&lr,&of);
+    bin64_t target(lr,of);
+    char line[1024];
+    while (gets(line)) {
+        char* br = strchr(line,'(');
+        if (br && 2==sscanf(br,"(%i,%lli)",&lr,&of)) {
+            bin64_t found(lr,of);
+            if ( found.within(target) || target.within(found))
+                printf("%s\n",line);
+        }
+    }
+    return 0;
+}