On Tue, Oct 09, 2001 at 05:42:37PM +0100, Ian Abbott wrote:

> On 9 Oct 2001, at 17:01, [EMAIL PROTECTED] wrote:
> 
> > On 09/10/2001 14:25:57 Andre Pang wrote:
> > >Try this patch.  It should make -p _always_ get pre-requisites,
> > >even if you have -np on (which was the reason why i wrote the
> > >patch).  [snip]
> > 
> > Actually, case can be made for both ways.
> > Sometimes you might want -p to only get "images" conforming to -np. Perhaps
> > to skip (advertising)banners.
> > (those are usually served by another server, and thus ignored anyway unless
> > --span-hosts).
> > 
> > Perhaps make -p override -np, but have an "alternative" -p (e.g. -pnp )
> > which obeys -np.
> > 
> > I didn't see Andre's patch so I cannot comment on it (stripped by my mail
> > system)-:
> 
> I'll send Andre's patch to you in clear text.

[sigh]  I actually meant to send it in clear text (as opposed to
an attachment), but forgot.  My 3-second mindspan rears its head
again ...

So here it is again, for the benefit of everybody else on the list
and the mailing list archives :)

> > Another possibility would be to keep the existing behaviour (i.e. -np
> > overrides -p) and have a "stronger" -p (e.g. -pp ) which ignores -np.
> 
> Yes, for backwards compatibility it would be better to preserve the
> existing behavior of -p and define a new option for the new
> functionality. However, -pp doesn't really have a suitable
> matching long option name, so how about -fp,
> --force-page-requisites?

Yes, that sounds like a good idea.


Patch follows:

diff -u -r wget/src/html-url.c wget-andrep/src/html-url.c
--- wget/src/html-url.c Mon May 28 05:35:02 2001
+++ wget-andrep/src/html-url.c  Wed Jun  6 19:28:03 2001
@@ -299,7 +299,7 @@
 
 static void
 handle_link (struct collect_urls_closure *closure, const char *link_uri,
-            struct taginfo *tag, int attrid)
+            struct taginfo *tag, int attrid, int is_external)
 {
   int no_proto = !has_proto (link_uri);
   urlpos *newel;
@@ -308,7 +308,7 @@
   char *complete_uri;
 
   char *fragment = strrchr (link_uri, '#');
-
+  
   if (fragment)
     {
       /* Nullify the fragment identifier, i.e. everything after the
@@ -348,6 +348,10 @@
   newel->url = complete_uri;
   newel->pos = tag->attrs[attrid].value_raw_beginning - closure->text;
   newel->size = tag->attrs[attrid].value_raw_size;
+  /* ozone start */
+  if (is_external)
+    newel->is_external = 1;
+  /* ozone end */
 
   /* A URL is relative if the host and protocol are not named, and the
      name does not start with `/'.  */
@@ -409,7 +413,7 @@
                only 9.  */
            attr_value = find_attr (tag, url_tag_attr_map[i].attr_name, &id);
            if (attr_value)
-             handle_link (closure, attr_value, tag, id);
+             handle_link (closure, attr_value, tag, id, url_tag_attr_map[i].flags);
          }
       }
       break;
@@ -449,7 +453,7 @@
                   as they refer to external documents.  */
                if (!closure->dash_p_leaf_HTML
                    || (rel && !strcasecmp (rel, "stylesheet")))
-                 handle_link (closure, href, tag, id);
+                 handle_link (closure, href, tag, id, url_tag_attr_map[tagid].flags);
              }
          }
          break;
@@ -488,7 +492,7 @@
                offset = p - refresh;
                tag->attrs[id].value_raw_beginning += offset;
                tag->attrs[id].value_raw_size -= offset;
-               handle_link (closure, p, tag, id);
+               handle_link (closure, p, tag, id, url_tag_attr_map[tagid].flags);
              }
            else if (name && !strcasecmp (name, "robots"))
              {
diff -u -r wget/src/recur.c wget-andrep/src/recur.c
--- wget/src/recur.c    Fri Jun 15 07:48:00 2001
+++ wget-andrep/src/recur.c     Thu Aug  9 18:44:20 2001
@@ -301,9 +301,11 @@
       if (!inl && opt.no_parent
          /* If the new URL is FTP and the old was not, ignore
              opt.no_parent.  */
-         && !(!this_url_ftp && u->proto == URLFTP))
+         && !(!this_url_ftp && u->proto == URLFTP)
+         /* Only kill link if we are using -p and this link is external */
+         && (opt.page_requisites && cur_url->is_external == 1))
        {
-         /* Check for base_dir first.  */
+         /* Check for base_dir.  */
          if (!(base_dir && frontcmp (base_dir, u->dir)))
            {
              /* Failing that, check for parent dir.  */
diff -u -r wget/src/url.h wget-andrep/src/url.h
--- wget/src/url.h      Mon May 28 05:35:11 2001
+++ wget-andrep/src/url.h       Wed Jun  6 19:28:08 2001
@@ -62,6 +62,8 @@
   char *url;                   /* linked URL, after it has been
                                   merged with the base */
   char *local_name;            /* Local file to which it was saved */
+  int is_external;             /* This URL is an external link (to
+                                  another HTML file) */
 
   /* Information about the original link: */
   int link_relative_p;         /* was the link relative? */


-- 
#ozone/algorithm <[EMAIL PROTECTED]>          - trust.in.love.to.save

Reply via email to