Code cleanup
This commit is contained in:
parent
dae17c6dad
commit
b5186ccbd7
7
src/ls.c
7
src/ls.c
|
@ -582,14 +582,17 @@ static void _long_date(time_t date, char buf[15])
|
||||||
{
|
{
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
static time_t sixmonths = -1;
|
static time_t sixmonths = -1;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
if(sixmonths == -1)
|
if(sixmonths == -1)
|
||||||
sixmonths = time(NULL) - 15552000;
|
sixmonths = time(NULL) - 15552000;
|
||||||
localtime_r(&date, &tm);
|
localtime_r(&date, &tm);
|
||||||
if(date < sixmonths)
|
if(date < sixmonths)
|
||||||
strftime(buf, 14, "%b %e %Y", &tm);
|
len = strftime(buf, 14, "%b %e %Y", &tm);
|
||||||
else
|
else
|
||||||
strftime(buf, 14, "%b %e %H:%M", &tm);
|
len = strftime(buf, 14, "%b %e %H:%M", &tm);
|
||||||
|
if(len == 0)
|
||||||
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static char _file_mode_letter(mode_t mode)
|
static char _file_mode_letter(mode_t mode)
|
||||||
|
|
|
@ -41,8 +41,8 @@ static int _who(Prefs * prefs)
|
||||||
printf(" %c", '?');
|
printf(" %c", '?');
|
||||||
printf(" %-8s", u->ut_line);
|
printf(" %-8s", u->ut_line);
|
||||||
t = u->ut_tv.tv_sec;
|
t = u->ut_tv.tv_sec;
|
||||||
if((tm = localtime(&t)) == NULL || strftime(buf,
|
if((tm = localtime(&t)) == NULL || strftime(buf, sizeof(buf),
|
||||||
sizeof(buf), "%b %e %H:%M", tm) == 0)
|
"%b %e %H:%M", tm) == 0)
|
||||||
strcpy(buf, "n/a");
|
strcpy(buf, "n/a");
|
||||||
printf(" %s\n", buf);
|
printf(" %s\n", buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user