|
@@ -674,6 +674,7 @@ bool CFtpListResult::ParseShortDate(const char *str, int len, t_directory::t_dir
|
|
}
|
|
}
|
|
|
|
|
|
date.hasdate = TRUE;
|
|
date.hasdate = TRUE;
|
|
|
|
+ date.hasyear = TRUE;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -803,6 +804,7 @@ BOOL CFtpListResult::parseAsVMS(const char *line, const int linelen, t_directory
|
|
p++;
|
|
p++;
|
|
|
|
|
|
dir.date.year = static_cast<int>(strntoi64(p, tokenlen - (p - str)));
|
|
dir.date.year = static_cast<int>(strntoi64(p, tokenlen - (p - str)));
|
|
|
|
+ dir.date.hasyear = TRUE;
|
|
|
|
|
|
//Get time
|
|
//Get time
|
|
str = GetNextToken(line, linelen, tokenlen, pos, 0);
|
|
str = GetNextToken(line, linelen, tokenlen, pos, 0);
|
|
@@ -1169,6 +1171,7 @@ bool CFtpListResult::parseMlsdDateTime(const CString value, t_directory::t_diren
|
|
if (result)
|
|
if (result)
|
|
{
|
|
{
|
|
date.year = Year;
|
|
date.year = Year;
|
|
|
|
+ date.hasyear = TRUE;
|
|
date.month = Month;
|
|
date.month = Month;
|
|
date.day = Day;
|
|
date.day = Day;
|
|
date.hour = Hours;
|
|
date.hour = Hours;
|
|
@@ -1185,7 +1188,7 @@ void CFtpListResult::GuessYearIfUnknown(t_directory::t_direntry::t_date & Date)
|
|
// others use one year as limit. IIS shows time for files from the current year (jan-dec).
|
|
// others use one year as limit. IIS shows time for files from the current year (jan-dec).
|
|
// So there is no support for files with time
|
|
// So there is no support for files with time
|
|
// dated in the near future. Under normal conditions there should not be such files.
|
|
// dated in the near future. Under normal conditions there should not be such files.
|
|
- if (!Date.year)
|
|
|
|
|
|
+ if (!Date.year) // might use direntry.date.hasyear now?
|
|
{
|
|
{
|
|
CTime curtime = CTime::GetCurrentTime();
|
|
CTime curtime = CTime::GetCurrentTime();
|
|
int curday = curtime.GetDay();
|
|
int curday = curtime.GetDay();
|
|
@@ -1201,6 +1204,7 @@ void CFtpListResult::GuessYearIfUnknown(t_directory::t_direntry::t_date & Date)
|
|
{
|
|
{
|
|
Date.year = curyear - 1;
|
|
Date.year = curyear - 1;
|
|
}
|
|
}
|
|
|
|
+ // year is guessed, not setting hasyear
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1492,6 +1496,7 @@ BOOL CFtpListResult::parseAsUnix(const char *line, const int linelen, t_director
|
|
else if (p-smonth == 4) //2002-10-14
|
|
else if (p-smonth == 4) //2002-10-14
|
|
{
|
|
{
|
|
direntry.date.year = static_cast<int>(strntoi64(smonth, p-smonth));
|
|
direntry.date.year = static_cast<int>(strntoi64(smonth, p-smonth));
|
|
|
|
+ direntry.date.hasyear = TRUE;
|
|
sday = pos2 + 1;
|
|
sday = pos2 + 1;
|
|
sdaylen = smonthlen - (pos2 - smonth) - 1;
|
|
sdaylen = smonthlen - (pos2 - smonth) - 1;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
@@ -1513,6 +1518,7 @@ BOOL CFtpListResult::parseAsUnix(const char *line, const int linelen, t_director
|
|
else if (p-smonth) //14-10-2002 or 01-jun-99
|
|
else if (p-smonth) //14-10-2002 or 01-jun-99
|
|
{
|
|
{
|
|
direntry.date.year = static_cast<int>(strntoi64(pos2+1, tokenlen - (pos2-smonth) - 1));
|
|
direntry.date.year = static_cast<int>(strntoi64(pos2+1, tokenlen - (pos2-smonth) - 1));
|
|
|
|
+ direntry.date.hasyear = TRUE;
|
|
sday = smonth;
|
|
sday = smonth;
|
|
sdaylen = p - smonth;
|
|
sdaylen = p - smonth;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
@@ -1554,6 +1560,7 @@ BOOL CFtpListResult::parseAsUnix(const char *line, const int linelen, t_director
|
|
else if (p-smonth==4)
|
|
else if (p-smonth==4)
|
|
{
|
|
{
|
|
direntry.date.year = static_cast<int>(strntoi64(smonth, p-smonth));
|
|
direntry.date.year = static_cast<int>(strntoi64(smonth, p-smonth));
|
|
|
|
+ direntry.date.hasyear = TRUE;
|
|
sday = pos2 + 1;
|
|
sday = pos2 + 1;
|
|
sdaylen = smonthlen - (pos2 - smonth) - 1;
|
|
sdaylen = smonthlen - (pos2 - smonth) - 1;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
@@ -1575,6 +1582,7 @@ BOOL CFtpListResult::parseAsUnix(const char *line, const int linelen, t_director
|
|
else if (p-smonth==2)
|
|
else if (p-smonth==2)
|
|
{
|
|
{
|
|
direntry.date.year = static_cast<int>(strntoi64(pos2+1, tokenlen - (pos2-smonth) - 1));
|
|
direntry.date.year = static_cast<int>(strntoi64(pos2+1, tokenlen - (pos2-smonth) - 1));
|
|
|
|
+ direntry.date.hasyear = TRUE;
|
|
sday = smonth;
|
|
sday = smonth;
|
|
sdaylen = p - smonth;
|
|
sdaylen = p - smonth;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
smonthlen = pos2-smonth - (p-smonth) - 1;
|
|
@@ -1677,6 +1685,7 @@ BOOL CFtpListResult::parseAsUnix(const char *line, const int linelen, t_director
|
|
{
|
|
{
|
|
gotYear = true;
|
|
gotYear = true;
|
|
direntry.date.year = year;
|
|
direntry.date.year = year;
|
|
|
|
+ direntry.date.hasyear = TRUE;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -1767,12 +1776,13 @@ BOOL CFtpListResult::parseAsUnix(const char *line, const int linelen, t_director
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if (!direntry.date.year)
|
|
|
|
|
|
+ else if (!direntry.date.year) // might use direntry.date.hasyear now?
|
|
{
|
|
{
|
|
//No delimiters -> year
|
|
//No delimiters -> year
|
|
|
|
|
|
direntry.date.hastime = FALSE;
|
|
direntry.date.hastime = FALSE;
|
|
direntry.date.year = static_cast<int>(strntoi64(stimeyear, stimeyearlen));
|
|
direntry.date.year = static_cast<int>(strntoi64(stimeyear, stimeyearlen));
|
|
|
|
+ direntry.date.hasyear = TRUE;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -1781,7 +1791,7 @@ BOOL CFtpListResult::parseAsUnix(const char *line, const int linelen, t_director
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (!direntry.date.year) //Year 0? Really ancient file, this is invalid!
|
|
|
|
|
|
+ if (!direntry.date.year) //Year 0? Really ancient file, this is invalid! might use direntry.date.hasyear now?
|
|
{
|
|
{
|
|
return FALSE;
|
|
return FALSE;
|
|
}
|
|
}
|
|
@@ -1927,6 +1937,7 @@ void CFtpListResult::TimeTToDate(time_t TimeT, t_directory::t_direntry::t_date &
|
|
{
|
|
{
|
|
tm * sTime = gmtime(&TimeT);
|
|
tm * sTime = gmtime(&TimeT);
|
|
Date.year = sTime->tm_year + 1900;
|
|
Date.year = sTime->tm_year + 1900;
|
|
|
|
+ Date.hasyear = TRUE;
|
|
Date.month = sTime->tm_mon+1;
|
|
Date.month = sTime->tm_mon+1;
|
|
Date.day = sTime->tm_mday;
|
|
Date.day = sTime->tm_mday;
|
|
Date.hour = sTime->tm_hour;
|
|
Date.hour = sTime->tm_hour;
|
|
@@ -2105,6 +2116,7 @@ BOOL CFtpListResult::parseAsOther(const char *line, const int linelen, t_directo
|
|
return FALSE;
|
|
return FALSE;
|
|
|
|
|
|
direntry.date.year = static_cast<int>(strntoi64(str, tokenlen));
|
|
direntry.date.year = static_cast<int>(strntoi64(str, tokenlen));
|
|
|
|
+ direntry.date.hasyear = TRUE;
|
|
if (direntry.date.year < 50)
|
|
if (direntry.date.year < 50)
|
|
direntry.date.year += 2000;
|
|
direntry.date.year += 2000;
|
|
else if (direntry.date.year < 1000)
|
|
else if (direntry.date.year < 1000)
|