Dropping non-strftime() support and fixing -Werror problem

Problem:

a) when running ./configure, strftime() and other functions cannot be
   properly detected, since autoconf generates crappy test code, which
   at least fails when warnings are treated as errors (gcc: -Werror).

b) strtime() is standard since C89, so we can simply expect it to exists
   (if there's *really* some acient box out there breaking mc build,
   it's libc/toolchain should be fixed ;-p)

Solution:

Remove the checks for strftime() and all workarounds
This commit is contained in:
Enrico Weigelt, metux IT service 2009-10-28 11:09:15 +01:00
parent 8f01c7c1f8
commit 91a5df442f
4 changed files with 2 additions and 22 deletions

View File

@ -166,7 +166,7 @@ AC_CHECK_FUNCS([\
initgroups isascii \
memcpy memset \
putenv \
setreuid setuid statfs strerror strftime sysconf \
setreuid setuid statfs strerror sysconf \
tcgetattr tcsetattr truncate \
])

View File

@ -10,8 +10,6 @@
#define INVALID_TIME_TEXT "(invalid)"
#ifdef HAVE_STRFTIME
/* safe localtime formatting - strftime()-using version */
#define FMT_LOCALTIME(buffer, bufsize, fmt, when) \
{ \
@ -28,16 +26,6 @@
} \
} \
#else
/* fallback when strftime/localtime not available */
#define FMT_LOCALTIME(buffer,bufsize,fmt,when) \
{ \
ctime_r(when,buffer); \
} \
#endif
#define FMT_LOCALTIME_CURRENT(buffer, bufsize, fmt) \
{ \
time_t __current_time; \

View File

@ -142,7 +142,7 @@ fi
AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod)
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob pipe crypt16 getauthuid)
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
AC_CHECK_FUNCS(sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf)
AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate)
AC_CHECK_FUNCS(grantpt dup2 yp_get_default_domain getpwanam)

View File

@ -493,11 +493,7 @@ char *http_timestring(time_t t)
if (!tm)
slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
else
#ifndef HAVE_STRFTIME
fstrcpy(buf, asctime(tm));
#else /* !HAVE_STRFTIME */
strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
#endif /* !HAVE_STRFTIME */
return buf;
}
#endif /*0 */
@ -515,11 +511,7 @@ char *timestring(void )
if (!tm) {
slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t);
} else {
#ifdef HAVE_STRFTIME
strftime(TimeBuf,100,"%Y/%m/%d %H:%M:%S",tm);
#else
fstrcpy(TimeBuf, asctime(tm));
#endif
}
return(TimeBuf);
}