From 5ff5e936a561ee9e5bf5036430c14b2b4c669cf0 Mon Sep 17 00:00:00 2001 From: janp Date: Wed, 2 May 2001 03:15:17 -0700 Subject: [PATCH] [svn] Correct the conversion of month entries for NT and VMS. --- src/ChangeLog | 6 ++++++ src/ftp-ls.c | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f1ff7e1e..12c7e3ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-05-02 Jan Prikryl + + * ftp-ls.c (ftp_parse_winnt_ls): Assure months are being correctly + converted. Pointed out by . + (ftp_parse_vms_ls): Ditto. + 2001-04-30 Hrvoje Niksic * init.c (cmd_address): Zero SIN before using it; apparently diff --git a/src/ftp-ls.c b/src/ftp-ls.c index 58d652ae..28fcf9c2 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -146,7 +146,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms) break; default: cur.type = FT_UNKNOWN; - DEBUGP (("UNKOWN; ")); + DEBUGP (("UNKNOWN; ")); break; } @@ -441,9 +441,11 @@ ftp_parse_winnt_ls (const char *file) cur.name = xstrdup(tok); DEBUGP(("Name: '%s'\n", cur.name)); - /* First column: mm-dd-yy */ + /* First column: mm-dd-yy. Should atoi() on the month fail, january + will be assumed. */ tok = strtok(line, "-"); - month = atoi(tok); + month = atoi(tok) - 1; + if (month < 0) month = 0; tok = strtok(NULL, "-"); day = atoi(tok); tok = strtok(NULL, " "); @@ -667,9 +669,9 @@ ftp_parse_vms_ls (const char *file) } for (i=0; i<12; i++) if (!strcmp(tok,months[i])) break; /* Uknown months are mapped to January */ - month = (i%12)+1; - tok = strtok(NULL, " "); - year = atoi(tok)-1900; + month = i % 12 ; + tok = strtok (NULL, " "); + year = atoi (tok) - 1900; DEBUGP(("date parsed\n")); /* Fourth/Third column: Time hh:mm[:ss] */ -- 2.39.2