mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
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:
parent
8f01c7c1f8
commit
91a5df442f
@ -166,7 +166,7 @@ AC_CHECK_FUNCS([\
|
|||||||
initgroups isascii \
|
initgroups isascii \
|
||||||
memcpy memset \
|
memcpy memset \
|
||||||
putenv \
|
putenv \
|
||||||
setreuid setuid statfs strerror strftime sysconf \
|
setreuid setuid statfs strerror sysconf \
|
||||||
tcgetattr tcsetattr truncate \
|
tcgetattr tcsetattr truncate \
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
#define INVALID_TIME_TEXT "(invalid)"
|
#define INVALID_TIME_TEXT "(invalid)"
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
|
|
||||||
/* safe localtime formatting - strftime()-using version */
|
/* safe localtime formatting - strftime()-using version */
|
||||||
#define FMT_LOCALTIME(buffer, bufsize, fmt, when) \
|
#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) \
|
#define FMT_LOCALTIME_CURRENT(buffer, bufsize, fmt) \
|
||||||
{ \
|
{ \
|
||||||
time_t __current_time; \
|
time_t __current_time; \
|
||||||
|
@ -142,7 +142,7 @@ fi
|
|||||||
AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod)
|
AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod)
|
||||||
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
|
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(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(initgroups select rdchk getgrnam pathconf)
|
||||||
AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate)
|
AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups mktime rename ftruncate)
|
||||||
AC_CHECK_FUNCS(grantpt dup2 yp_get_default_domain getpwanam)
|
AC_CHECK_FUNCS(grantpt dup2 yp_get_default_domain getpwanam)
|
||||||
|
@ -493,11 +493,7 @@ char *http_timestring(time_t t)
|
|||||||
if (!tm)
|
if (!tm)
|
||||||
slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
|
slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
|
||||||
else
|
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);
|
strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
|
||||||
#endif /* !HAVE_STRFTIME */
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#endif /*0 */
|
#endif /*0 */
|
||||||
@ -515,11 +511,7 @@ char *timestring(void )
|
|||||||
if (!tm) {
|
if (!tm) {
|
||||||
slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t);
|
slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t);
|
||||||
} else {
|
} else {
|
||||||
#ifdef HAVE_STRFTIME
|
|
||||||
strftime(TimeBuf,100,"%Y/%m/%d %H:%M:%S",tm);
|
strftime(TimeBuf,100,"%Y/%m/%d %H:%M:%S",tm);
|
||||||
#else
|
|
||||||
fstrcpy(TimeBuf, asctime(tm));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return(TimeBuf);
|
return(TimeBuf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user