]> sjero.net Git - wget/commitdiff
[svn] recur.c (parse_robots): Applied Edward J. Sabol's patch for Guan Yang's reported
authordan <devnull@localhost>
Thu, 2 Mar 2000 21:28:59 +0000 (13:28 -0800)
committerdan <devnull@localhost>
Thu, 2 Mar 2000 21:28:59 +0000 (13:28 -0800)
problem with "User-agent:<space>*<space>" lines.

src/recur.c

index 8de3806118a2dc0a6275abced7c76a535b0ec7c4..078f7d855ee3f3d2308b2d2dee159117a91c0277 100644 (file)
@@ -709,13 +709,13 @@ parse_robots (const char *robots_filename)
       *str++ = '\0';
       /* Look for the string beginning...  */
       for (; *str && ISSPACE (*str); str++);
-      /* Look for comments and kill them off.  */
+      /* Look for comments or trailing spaces and kill them off.  */
       for (p = str; *p; p++)
-       if (*p && ISSPACE (*p) && *(p + 1) == '#')
+       if (*p && ISSPACE (*p) && ((*(p + 1) == '#') || (*(p + 1) == '\0')))
          {
-           /* We have found a shell-style comment `<sp>+ #'.  Now
-              rewind to the beginning of the spaces and place '\0'
-              there.  */
+           /* We have found either a shell-style comment `<sp>+#' or some
+               trailing spaces.  Now rewind to the beginning of the spaces
+               and place '\0' there.  */
            while (p > str && ISSPACE (*p))
              --p;
            if (p == str)