]> sjero.net Git - wget/commitdiff
[svn] Make --base -i work.
authorhniksic <devnull@localhost>
Sat, 1 Dec 2001 19:17:19 +0000 (11:17 -0800)
committerhniksic <devnull@localhost>
Sat, 1 Dec 2001 19:17:19 +0000 (11:17 -0800)
Published in <sxsoflisqcf.fsf@florida.arsdigita.de>.

src/ChangeLog
src/url.c

index cb5d2cd5a3ec226c254dba57079040706ebc08a2..2c513dcf3eebee2c4b68c46400e35e5cf181b628 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-01  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * url.c (get_urls_file): If opt.base_href is specified, merge each
+       URL with the base.
+
 2001-12-01  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * main.c (print_help): Don't document the removed `-nh'.
index 44866bf6208dc233c7255ee8036196a9aa9f829d..fde1a41227f6206d367ef88e5d1f83816539da5f 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -1009,13 +1009,25 @@ get_urls_file (const char *file)
        --line_end;
       if (line_end > line_beg)
        {
+         /* URL is in the [line_beg, line_end) region. */
+
          int up_error_code;
          char *url_text;
          struct urlpos *entry;
          struct url *url;
 
-         /* We must copy the URL to a zero-terminated string.  *sigh*.  */
+         /* We must copy the URL to a zero-terminated string, and we
+            can't use alloca because we're in a loop.  *sigh*.  */
          url_text = strdupdelim (line_beg, line_end);
+
+         if (opt.base_href)
+           {
+             /* Merge opt.base_href with URL. */
+             char *merged = uri_merge (opt.base_href, url_text);
+             xfree (url_text);
+             url_text = merged;
+           }
+
          url = url_parse (url_text, &up_error_code);
          if (!url)
            {
@@ -1382,7 +1394,7 @@ find_last_char (const char *b, const char *e, char c)
    The parameters LINKLENGTH is useful if LINK is not zero-terminated.
    See uri_merge for a gentler interface to this functionality.
 
-   #### This function should handle `./' and `../' so that the evil
+   Perhaps this function should handle `./' and `../' so that the evil
    path_simplify can go.  */
 static char *
 uri_merge_1 (const char *base, const char *link, int linklength, int no_scheme)