mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* vfs.c (vfs_parse_filemode): Fix parsing for filenames that
begin with a number. From Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
This commit is contained in:
parent
a3f9820755
commit
d2417f2096
@ -1,3 +1,9 @@
|
|||||||
|
2002-09-25 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* vfs.c (vfs_parse_filemode): Fix parsing for filenames that
|
||||||
|
begin with a number.
|
||||||
|
From Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
|
||||||
|
|
||||||
2002-09-24 Andrew V. Samoilov <sav@bcs.zp.ua>
|
2002-09-24 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
* smbfs.c: Undef USE_NCURSES - no needs to include *curces.h.
|
* smbfs.c: Undef USE_NCURSES - no needs to include *curces.h.
|
||||||
|
30
vfs/vfs.c
30
vfs/vfs.c
@ -1573,9 +1573,10 @@ int vfs_parse_filemode (const char *p)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vfs_parse_filedate(int idx, time_t *t)
|
/* This function parses from idx in the columns[] array */
|
||||||
{ /* This thing parses from idx in columns[] array */
|
int
|
||||||
|
vfs_parse_filedate (int idx, time_t *t)
|
||||||
|
{
|
||||||
char *p;
|
char *p;
|
||||||
struct tm tim;
|
struct tm tim;
|
||||||
int d[3];
|
int d[3];
|
||||||
@ -1648,16 +1649,22 @@ int vfs_parse_filedate(int idx, time_t *t)
|
|||||||
/* Here we expect to find time and/or year */
|
/* Here we expect to find time and/or year */
|
||||||
|
|
||||||
if (is_num (idx)) {
|
if (is_num (idx)) {
|
||||||
if(is_time(columns[idx], &tim) || (got_year = is_year(columns[idx], &tim))) {
|
if (is_time (columns[idx], &tim)
|
||||||
|
|| (got_year = is_year (columns[idx], &tim))) {
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
/* This is a special case for ctime() or Mon DD YYYY hh:mm */
|
/* This is a special case for ctime() or Mon DD YYYY hh:mm */
|
||||||
if(is_num (idx) && (columns[idx+1][0]) &&
|
if (is_num (idx) && (columns[idx + 1][0])) {
|
||||||
((got_year |= is_year(columns[idx], &tim)) || is_time(columns[idx], &tim)))
|
if (got_year) {
|
||||||
idx++; /* time & year or reverse */
|
if (is_time (columns[idx], &tim))
|
||||||
} /* only time or date */
|
idx++; /* time also */
|
||||||
|
} else {
|
||||||
|
if ((got_year = is_year (columns[idx], &tim)))
|
||||||
|
idx++; /* year also */
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
} /* only time or date */
|
||||||
|
} else
|
||||||
return 0; /* Nor time or date */
|
return 0; /* Nor time or date */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1666,9 +1673,8 @@ int vfs_parse_filedate(int idx, time_t *t)
|
|||||||
* This does not check for years before 1900 ... I don't know, how
|
* This does not check for years before 1900 ... I don't know, how
|
||||||
* to represent them at all
|
* to represent them at all
|
||||||
*/
|
*/
|
||||||
if (!got_year &&
|
if (!got_year && current_mon < 6 && current_mon < tim.tm_mon
|
||||||
current_mon < 6 && current_mon < tim.tm_mon &&
|
&& tim.tm_mon - current_mon >= 6)
|
||||||
tim.tm_mon - current_mon >= 6)
|
|
||||||
|
|
||||||
tim.tm_year--;
|
tim.tm_year--;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user