add .gitignore
[swift-upb.git] / bingrep.cpp
1 #include <stdio.h>
2 #include <string.h>
3 #include "bin64.h"
4
5 int main (int argn, char** args) {
6     int lr;
7     unsigned long long of;
8     sscanf(args[1],"%i,%lli",&lr,&of);
9     bin64_t target(lr,of);
10     char line[1024];
11     while (gets(line)) {
12         char* br = strchr(line,'(');
13         if (br && 2==sscanf(br,"(%i,%lli)",&lr,&of)) {
14             bin64_t found(lr,of);
15             if ( found.within(target) || target.within(found))
16                 printf("%s\n",line);
17         }
18     }
19     return 0;
20 }