]> sjero.net Git - wget/commitdiff
[svn] Remember the position of the previous token instead of backtracking to it.
authorhniksic <devnull@localhost>
Thu, 4 Aug 2005 21:45:28 +0000 (14:45 -0700)
committerhniksic <devnull@localhost>
Thu, 4 Aug 2005 21:45:28 +0000 (14:45 -0700)
By Giuseppe Bonacci.

src/ChangeLog
src/ftp-ls.c

index 15e55151fc4abcb7aa91542c84c3efa69012679b..774f9b53ffe7665b8fd793a1f576e2b0b29b2fa5 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-04  Giuseppe Bonacci  <g.bonacci@libero.it>
+
+       * ftp-ls.c (ftp_parse_unix_ls): Remember the position of the
+       previous token instead of backtracking back to it.
+
 2005-07-08  Gisle Vanem  <giva@bgnett.no>
 
        * mswindows.h: Include process.h to get getpid() declaration.
 2005-07-08  Gisle Vanem  <giva@bgnett.no>
 
        * mswindows.h: Include process.h to get getpid() declaration.
index ce17f450b86c12a745c73ab83507f5d112a44fab..9e35f27afb30fc4e91ec4a5702258aa86c40fbcf 100644 (file)
@@ -104,7 +104,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
   struct tm timestruct, *tnow;
   time_t timenow;
 
   struct tm timestruct, *tnow;
   time_t timenow;
 
-  char *line, *tok;            /* tokenizer */
+  char *line, *tok, *ptok;     /* tokenizer */
   struct fileinfo *dir, *l, cur; /* list creation */
 
   fp = fopen (file, "rb");
   struct fileinfo *dir, *l, cur; /* list creation */
 
   fp = fopen (file, "rb");
@@ -195,7 +195,9 @@ 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.  */
         This tactic is quite dubious when it comes to
         internationalization issues (non-English month names), but it
         works for now.  */
-      while ((tok = strtok (NULL, " ")) != NULL)
+      ptok = line;
+      while (ptok = tok,
+            (tok = strtok (NULL, " ")) != NULL)
        {
          --next;
          if (next < 0)         /* a month name was not encountered */
        {
          --next;
          if (next < 0)         /* a month name was not encountered */
@@ -211,7 +213,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
 
                  /* Back up to the beginning of the previous token
                     and parse it with str_to_wgint.  */
 
                  /* Back up to the beginning of the previous token
                     and parse it with str_to_wgint.  */
-                 char *t = tok - 2;
+                 char *t = ptok;
                  while (t > line && ISDIGIT (*t))
                    --t;
                  if (t == line)
                  while (t > line && ISDIGIT (*t))
                    --t;
                  if (t == line)