]> sjero.net Git - wget/blobdiff - src/res.c
Fix build when libpsl is not available
[wget] / src / res.c
index eb4caf11c0b26d4a7de70ed1db55f9f334fb1f56..3038229bf074891e3dcdee5c383aeef77d264df3 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -1,5 +1,6 @@
 /* Support for Robot Exclusion Standard (RES).
-   Copyright (C) 2001, 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+   Foundation, Inc.
 
 This file is part of Wget.
 
@@ -282,7 +283,7 @@ res_parse (const char *source, int length)
       SKIP_SPACE (p);
       if (field_b == field_e || EOL (p) || *p != ':')
         {
-          DEBUGP (("Ignoring malformed line %d", line_count));
+          DEBUGP (("Ignoring malformed line %d\n", line_count));
           goto next;
         }
       ++p;                      /* skip ':' */
@@ -350,7 +351,7 @@ res_parse (const char *source, int length)
         }
       else
         {
-          DEBUGP (("Ignoring unknown field at line %d", line_count));
+          DEBUGP (("Ignoring unknown field at line %d\n", line_count));
           goto next;
         }
 
@@ -384,7 +385,7 @@ struct robot_specs *
 res_parse_from_file (const char *filename)
 {
   struct robot_specs *specs;
-  struct file_memory *fm = read_file (filename);
+  struct file_memory *fm = wget_read_file (filename);
   if (!fm)
     {
       logprintf (LOG_NOTQUIET, _("Cannot open %s: %s"),
@@ -392,7 +393,7 @@ res_parse_from_file (const char *filename)
       return NULL;
     }
   specs = res_parse (fm->content, fm->length);
-  read_file_free (fm);
+  wget_read_file_free (fm);
   return specs;
 }
 
@@ -551,7 +552,7 @@ res_retrieve_file (const char *url, char **file, struct iri *iri)
   opt.timestamping = false;
   opt.spider       = false;
 
-  url_parsed = url_parse (robots_url, &url_err, iri, true);
+  url_parsed = url_parse (robots_url, &url_err, i, true);
   if (!url_parsed)
     {
       char *error = url_error (robots_url, url_err);
@@ -589,7 +590,7 @@ is_robots_txt_url (const char *url)
   bool ret = are_urls_equal (url, robots_url);
 
   xfree (robots_url);
-  
+
   return ret;
 }
 \f
@@ -614,21 +615,21 @@ res_cleanup (void)
 #ifdef TESTING
 
 const char *
-test_is_robots_txt_url()
+test_is_robots_txt_url(void)
 {
-  int i;
-  struct {
-    char *url;
+  unsigned i;
+  static const struct {
+    const char *url;
     bool expected_result;
   } test_array[] = {
     { "http://www.yoyodyne.com/robots.txt", true },
     { "http://www.yoyodyne.com/somepath/", false },
     { "http://www.yoyodyne.com/somepath/robots.txt", false },
   };
-  
-  for (i = 0; i < sizeof(test_array)/sizeof(test_array[0]); ++i) 
+
+  for (i = 0; i < countof(test_array); ++i)
     {
-      mu_assert ("test_is_robots_txt_url: wrong result", 
+      mu_assert ("test_is_robots_txt_url: wrong result",
                  is_robots_txt_url (test_array[i].url) == test_array[i].expected_result);
     }