From a98337f82742f4d1b67f81bf9c79ce142ade8d88 Mon Sep 17 00:00:00 2001 From: hniksic Date: Thu, 12 Apr 2001 05:22:50 -0700 Subject: [PATCH] [svn] Make seconds optional in VMS time specification. Published in . --- src/ChangeLog | 5 +++++ src/ftp-ls.c | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 81cc52a7..cc4f276b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-04-12 Hrvoje Niksic + + * ftp-ls.c (ftp_parse_vms_ls): Make seconds optional in time + specification. + 2001-04-11 Hrvoje Niksic * url.c (parseurl): Don't strip trailing slash when u->dir is "/" diff --git a/src/ftp-ls.c b/src/ftp-ls.c index ca7f43f5..338c1a4e 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -584,6 +584,7 @@ ftp_parse_vms_ls (const char *file) /* 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 @@ ftp_parse_vms_ls (const char *file) 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)); -- 2.39.2