]> sjero.net Git - wget/commitdiff
[svn] Fix breakage in ls output parsing. By Larry Jones.
authorhniksic <devnull@localhost>
Sun, 21 May 2006 09:10:39 +0000 (02:10 -0700)
committerhniksic <devnull@localhost>
Sun, 21 May 2006 09:10:39 +0000 (02:10 -0700)
src/ChangeLog
src/ftp-ls.c

index ec7f0ff944e0f40816c0344ca44d65dc4995070b..b8e207a7c59ad2e5dd923513631ad1190404b5bb 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-18  Lawrence Jones  <lawrence.jones@ugs.com>
+
+       * ftp-ls.c (ftp_parse_unix_ls): Correct size parsing, add size
+       and filename debugging output.
+
 2006-04-28  Mauro Tortonesi  <mauro@ferrara.linux.it>
 
        * http.c: If Content-Disposition header is present, allow unique
index 9e35f27afb30fc4e91ec4a5702258aa86c40fbcf..6406c8fbe9894a8b3d1f0e27656c18e968d2b290 100644 (file)
@@ -195,7 +195,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
         This tactic is quite dubious when it comes to
         internationalization issues (non-English month names), but it
         works for now.  */
-      ptok = line;
+      tok = line;
       while (ptok = tok,
             (tok = strtok (NULL, " ")) != NULL)
        {
@@ -211,25 +211,22 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
                {
                  wgint size;
 
-                 /* Back up to the beginning of the previous token
-                    and parse it with str_to_wgint.  */
-                 char *t = ptok;
-                 while (t > line && ISDIGIT (*t))
-                   --t;
-                 if (t == line)
+                 /* Parse the previous token with str_to_wgint.  */
+                 if (ptok == line)
                    {
                      /* Something has gone wrong during parsing. */
                      error = 1;
                      break;
                    }
                  errno = 0;
-                 size = str_to_wgint (t, NULL, 10);
+                 size = str_to_wgint (ptok, NULL, 10);
                  if (size == WGINT_MAX && errno == ERANGE)
                    /* Out of range -- ignore the size.  #### Should
                       we refuse to start the download.  */
                    cur.size = 0;
                  else
                    cur.size = size;
+                 DEBUGP (("size: %s; ", number_to_static_string(cur.size)));
 
                  month = i;
                  next = 5;
@@ -363,7 +360,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
       if (!cur.name || (cur.type == FT_SYMLINK && !cur.linkto))
        error = 1;
 
-      DEBUGP (("\n"));
+      DEBUGP (("%s\n", cur.name ? cur.name : ""));
 
       if (error || ignore)
        {