Hrvoje Niksic <[EMAIL PROTECTED]> writes:

> Now that I have the address of a system to test, I'll take a look at
> the parser and see if I can fix it.

The problem was that the code expected time as hh:mm:ss, while the
server issued hh:mm.  (It actually coredumped on me.)  The following
patch makes it work for me:

2001-04-12  Hrvoje Niksic  <[EMAIL PROTECTED]>

        * ftp-ls.c (ftp_parse_vms_ls): Make seconds optional in time
        specification.

Index: src/ftp-ls.c
===================================================================
RCS file: /pack/anoncvs/wget/src/ftp-ls.c,v
retrieving revision 1.12
diff -u -r1.12 ftp-ls.c
--- src/ftp-ls.c        2001/04/10 17:05:43     1.12
+++ src/ftp-ls.c        2001/04/12 12:05:16
@@ -584,6 +584,7 @@
   /* Line loop to end of file: */
   while ((line = read_whole_line (fp)))
     {
+      char *p;
       i = clean_line (line);
       if (!i) break;
 
@@ -670,13 +671,17 @@
       year = atoi(tok)-1900;
       DEBUGP(("date parsed\n"));
 
-      /* Fourth/Third column: Time hh:mm:ss */
-      tok = strtok(NULL,  ":");
-      hour = atoi(tok);
-      tok = strtok(NULL,  ":");
-      min = atoi(tok);
-      tok = strtok(NULL,  " ");
-      sec = atoi(tok);
+      /* Fourth/Third column: Time hh:mm[:ss] */
+      tok = strtok (NULL, " ");
+      hour = min = sec = 0;
+      p = tok;
+      hour = atoi (p);
+      for (; *p && *p != ':'; ++p);
+      if (*p)
+       min = atoi (++p);
+      for (; *p && *p != ':'; ++p);
+      if (*p)
+       sec = atoi (++p);
 
       DEBUGP(("YYYY/MM/DD HH:MM:SS - %d/%02d/%02d %02d:%02d:%02d\n", 
               year+1900, month, day, hour, min, sec));

Reply via email to