#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