repo: uritools
action: commit
revision: 
path_from: 
revision_from: 6a78fa292800adba07094bd5e06b0bb8a4fb8305:
path_to: 
revision_to: 
git.thebackupbox.net
uritools
git clone git://git.thebackupbox.net/uritools
commit 6a78fa292800adba07094bd5e06b0bb8a4fb8305
Author: epoch 
Date:   Sat Apr 20 06:43:23 2019 -0500

    put _XOPEN_SOURCE only in the file it is actually needed. fixed parse bug where uris without a scheme were not defaulting provided line to an authority section

diff --git a/uri.h b/uri.h
index 97ce3c27e28338149c620814167244da3fc3ec71..
index ..aa12a8c6c7dcdde4c44f128426728886275252f9 100644
--- a/uri.h
+++ b/uri.h
@@ -1,7 +1,7 @@
 #ifndef uri_H
 #define uri_H

-#define _XOPEN_SOURCE 500 //for strdup
+//#define _XOPEN_SOURCE 500 //for strdup
 #include 
 #include 
 #include 
@@ -211,8 +211,10 @@ int urifromline(struct uri *u,char *line) {
     //if there wasn't a /, it points at a null byte. so "empty"
     u->username=line+1;
   } else {
-    //we have all we need.
-    return 1;
+    //we're an authority section without a // I guess.
+    //or we're a path
+    if(u->scheme) u->path=line;
+    else u->username=line;//if we have a scheme we're not a //-less authority
   }

   if(u->username) {//this contains all of the authority.
diff --git a/uricut.c b/uricut.c
index 5fe8764ac4fe3dbe396a602223b475bd02f3a7f0..
index ..3c0359c49d30389d9db8b6e8f8df6816f5131646 100644
--- a/uricut.c
+++ b/uricut.c
@@ -1,8 +1,9 @@
+#define _XOPEN_SOURCE 500
+#include 
 #include "uri.h"

 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

-----END OF PAGE-----