Remove HAVE_STRFTIME ifdefs

strftime(3) has been in standard C since C89.  It is also in
POSIX.1-2001, and in SVr4 (see strftime(3) and strftime(3p)).
We can assume that this function is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar
2021-12-27 20:50:06 +01:00
parent 92bd73c657
commit 3e602b58a2
6 changed files with 2 additions and 61 deletions

View File

@ -232,13 +232,8 @@ int failcheck (uid_t uid, struct faillog *fl, bool failed)
void failprint (const struct faillog *fail)
{
struct tm *tp;
#if HAVE_STRFTIME
char lasttimeb[256];
char *lasttime = lasttimeb;
#else
char *lasttime;
#endif
time_t NOW;
if (0 == fail->fail_cnt) {
@ -248,31 +243,11 @@ void failprint (const struct faillog *fail)
tp = localtime (&(fail->fail_time));
(void) time (&NOW);
#if HAVE_STRFTIME
/*
* Print all information we have.
*/
(void) strftime (lasttimeb, sizeof lasttimeb, "%c", tp);
#else
/*
* Do the same thing, but don't use strftime since it
* probably doesn't exist on this system
*/
lasttime = asctime (tp);
lasttime[24] = '\0';
if ((NOW - fail->fail_time) < YEAR) {
lasttime[19] = '\0';
}
if ((NOW - fail->fail_time) < DAY) {
lasttime = lasttime + 11;
}
if (' ' == *lasttime) {
lasttime++;
}
#endif
/*@-formatconst@*/
(void) printf (ngettext ("%d failure since last login.\n"
"Last was %s on %s.\n",