Add files for swift over UDP.
[swifty.git] / src / libswift_udp / bingrep.cpp
diff --git a/src/libswift_udp/bingrep.cpp b/src/libswift_udp/bingrep.cpp
new file mode 100644 (file)
index 0000000..f5cd51c
--- /dev/null
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <string.h>
+#include "bin.h"
+
+int main (int argn, char** args) {
+    int lr;
+    unsigned long long of;
+    sscanf(args[1],"%i,%lli",&lr,&of);
+    bin_t target(lr,of);
+    char line[1024];
+    while (gets(line)) {
+        char* br = strchr(line,'(');
+        if (br && 2==sscanf(br,"(%i,%lli)",&lr,&of)) {
+            bin_t found(lr,of);
+            if ( target.contains(found) || found.contains(target))
+                printf("%s\n",line);
+        }
+    }
+    return 0;
+}