X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fftp-ls.c;h=28fcf9c2913e197bb0f3c90dd3d9b2965b4040d4;hp=58d652aed386e27db04c536a0adb83722e03b2e2;hb=5ff5e936a561ee9e5bf5036430c14b2b4c669cf0;hpb=72b9bb6d922bef56ffa5f5627f38b274cd03bbb3 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] */