From 25c40a3f4c5447fc2224b1707b44a99b46515151 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 22 Apr 2019 23:33:09 -0500 Subject: only printing parts of the url that are actually defined now --- uricut.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'uricut.c') diff --git a/uricut.c b/uricut.c index cf143c0..41b1d17 100644 --- a/uricut.c +++ b/uricut.c @@ -137,14 +137,14 @@ int main(int argc,char *argv[]) { if(args[i]&F_WHOLE_URI) printf("%s\n",uri); } } else { - printf("scheme: %s\n",u.scheme); - printf("username: %s\n",u.username); - printf("password: %s\n",u.password); - printf("domain: %s\n",u.domain); - printf("port: %s\n",u.port); - printf("path: %s\n",u.path); - printf("query_string: %s\n",u.query_string); - printf("fragment_id: %s\n",u.fragment_id); + if(u.scheme) printf("scheme: %s\n",u.scheme); + if(u.username) printf("username: %s\n",u.username); + if(u.password) printf("password: %s\n",u.password); + if(u.domain) printf("domain: %s\n",u.domain); + if(u.port) printf("port: %s\n",u.port); + if(u.path) printf("path: %s\n",u.path); + if(u.query_string) printf("query_string: %s\n",u.query_string); + if(u.fragment_id) printf("fragment_id: %s\n",u.fragment_id); printf("whole_uri: %s\n",uri); } free(uri);//this is definitely malloc()d -- cgit v1.2.3