From b7849c483393cf510cbe4bca137ce4520b636685 Mon Sep 17 00:00:00 2001 From: epochqwert Date: Sat, 22 Aug 2015 03:36:15 -0500 Subject: initial commit. --- matchurl.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 matchurl.c (limited to 'matchurl.c') diff --git a/matchurl.c b/matchurl.c new file mode 100644 index 0000000..aeb4aa4 --- /dev/null +++ b/matchurl.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include "url.h" + +#define LINE_LENGTH 1024 + +int main(int argc,char *argv[]) { + int i; + struct url u; + char *line=malloc(LINE_LENGTH); + char copy[LINE_LENGTH]; + if(argc < 3) { + printf("usage: matchurl [s|u|k|d|P|p|q|f] [string]\n"); + return 1; + } + while(fgets(line,LINE_LENGTH-1,stdin)) { + if(strchr(line,'\r')) *strchr(line,'\r')=0; + if(strchr(line,'\n')) *strchr(line,'\n')=0; + strcpy(copy,line); + urlfromline(&u,line); + //use the character in argv[1] to match stdin against argv[2]. if match print whole line. + for(i=1;i