diff options
Diffstat (limited to 'src/listalf.c')
| -rw-r--r-- | src/listalf.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/listalf.c b/src/listalf.c index 34078e5..33b2bfe 100644 --- a/src/listalf.c +++ b/src/listalf.c @@ -50,14 +50,16 @@ void format_msdos_date(char *buf) { /* year actually ranges 1980 to 2107... */ year = (d >> 9) + 1980; - /* valid months range 1 to 12. values 0, 13, 14, 15 are possible - but invalid (print as ???) */ + /* valid months range 1 to 12 */ month = (d >> 5) & 0x0f; - /* valid day range is 1 to 31. 0 is invalid, print as-is. */ + /* valid day range is 1 to 31. 0 is invalid. */ day = d & 0x1f; - snprintf(buf, 12, "%2d %3s %04d", day, monthnames[month], year); + if(day == 0 || month == 0 || month > 12) + strncpy(buf, "<none>", 12); + else + snprintf(buf, 12, "%2d %3s %04d", day, monthnames[month], year); } /* small files may be "compressed" larger than the original, so this |
