Преглед на файлове

parse_url() is void.

tags/v0.9.3
Michael Brown преди 19 години
родител
ревизия
044b20385b
променени са 1 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. 8
    1
      src/core/url.c

+ 8
- 1
src/core/url.c Целия файл

@@ -8,7 +8,6 @@
8 8
  *
9 9
  *   [protocol://[host][:port]/]path/to/file
10 10
  *
11
- * We return true for success, 0 for failure (e.g. unknown protocol).
12 11
  * The URL string will be modified by having NULs inserted after
13 12
  * "protocol", "host" and "port".  The original URL can be
14 13
  * reconstructed by calling unparse_url.
@@ -17,6 +16,8 @@
17 16
 void parse_url ( struct url_info *info, char *url ) {
18 17
 	char *p;
19 18
 
19
+	DBG ( "URL parsing \"%s\"\n", url );
20
+
20 21
 	/* Zero the structure */
21 22
 	memset ( info, 0, sizeof ( *info ) );
22 23
 
@@ -44,11 +45,15 @@ void parse_url ( struct url_info *info, char *url ) {
44 45
 			}
45 46
 		}
46 47
 		info->file = p;
48
+		DBG ( "URL protocol \"%s\" host \"%s\" port \"%s\" "
49
+		      "file \"%s\"\n", info->protocol, info->host,
50
+		      info->port ? info->port : "(NONE)", info->file );
47 51
 		return;
48 52
 	}
49 53
 
50 54
 	/* URL has no explicit protocol; is just a filename */
51 55
 	info->file = url;
56
+	DBG ( "URL file \"%s\"\n", info->file );
52 57
 }
53 58
 
54 59
 /*
@@ -63,9 +68,11 @@ char * unparse_url ( struct url_info *info ) {
63 68
 			info->port[-1] = ':';
64 69
 		}
65 70
 		info->host[-3] = ':';
71
+		DBG ( "URL reconstructed \"%s\"\n", info->protocol );
66 72
 		return info->protocol;
67 73
 	} else {
68 74
 		/* URL had no protocol; was just a filename */
75
+		DBG ( "URL reconstructed \"%s\"\n", info->file );
69 76
 		return info->file;
70 77
 	}
71 78
 }

Loading…
Отказ
Запис