summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 12:33:55 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2012-06-30 12:34:54 +0200
commit82d86ad7c741c3048c0bccdc18f52576708602a4 (patch)
tree3c426e7a3cf111f000d669aeba09268c3d4d4300 /src/utils.c
parent681a63ea76fff55d24820b03ef16793a33a37669 (diff)
downloadcalcurse-82d86ad7c741c3048c0bccdc18f52576708602a4.zip
Fix compilation with NLS disabled
* src/utils.c: Only call setlocale() if NLS is enabled. * src/calcurse.h: Define a fallback macro ngettext() if NLS is disabled. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 3ca89c2..14de867 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -383,15 +383,19 @@ char *date_sec2date_str(long sec, const char *datefmt)
/* Generic function to format date. */
void date_sec2date_fmt(long sec, const char *fmt, char *datef)
{
+#if ENABLE_NLS
/* TODO: Find a better way to deal with localization and strftime(). */
char *locale_old = mem_strdup (setlocale (LC_ALL, NULL));
setlocale (LC_ALL, "C");
+#endif
struct tm *lt = localtime((time_t *)&sec);
strftime(datef, BUFSIZ, fmt, lt);
+#if ENABLE_NLS
setlocale (LC_ALL, locale_old);
mem_free (locale_old);
+#endif
}
/*