From 1db8f7d916874f22c15df3121e3ec5ba5f7e7310 Mon Sep 17 00:00:00 2001 From: epochqwert Date: Wed, 30 Dec 2015 04:37:22 -0600 Subject: enabled magic by default in cuturl. made cuturl print empty string instead of trying to print nulls. matchurl was matching multiple times for things it shouldn't have and not cleaing out the url struct. Makefile now uses -Wall --- Makefile | 4 ++-- cuturl.c | 18 ++++++++++-------- matchurl.c | 19 ++++++++++--------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 7257526..8c8e858 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ PREFIX=/usr/local CC=gcc all: - $(CC) -o matchurl matchurl.c url.c - $(CC) -o cuturl cuturl.c url.c + $(CC) -Wall -o matchurl matchurl.c url.c + $(CC) -Wall -o cuturl cuturl.c url.c clean: rm -f matchurl diff --git a/cuturl.c b/cuturl.c index 95d96ad..b2e7f84 100644 --- a/cuturl.c +++ b/cuturl.c @@ -8,6 +8,8 @@ #include "url.h" +#define MAGIC + /* schemes are case sensitive but cononicals are lower case. domain is case insensitive. return it lowercased? @@ -161,14 +163,14 @@ int main(int argc,char *argv[]) { } else { if(c) { for(i=0;i= strlen(argv[i+1]) && !strncmp(u.domain+strlen(u.domain)-strlen(argv[i+1]),argv[i+1],strlen(argv[i+1]))) - printf("%s\n",copy); - case 'P': if(u.port && !strcmp(u.port,argv[i+1])) printf("%s\n",copy); - case 'p': if(u.path && !strcmp(u.path,argv[i+1])) printf("%s\n",copy); - case 'q': if(u.query_string && !strcmp(u.query_string,argv[i+1])) printf("%s\n",copy); - case 'f': if(u.fragment_id && !strcmp(u.fragment_id,argv[i+1])) printf("%s\n",copy); + printf("D: %s\n",copy); break; default: printf("unknown url part letter! '%c'\n",argv[i][0]); -- cgit v1.2.3