# HG changeset patch
# User Stiletto <blasux@blasux.ru>
# Date 1414145626 -14400
# Node ID 442bed4a072e03e976ac9d1dacbe79408a51f698
# Parent  96b47c0505b501446c985b0a0e4cfeba4372c324
Locale support for status-time

diff -r 96b47c0505b5 -r 442bed4a072e config.mk
--- a/config.mk	Thu Oct 23 20:49:34 2014 +0400
+++ b/config.mk	Fri Oct 24 14:13:46 2014 +0400
@@ -13,8 +13,8 @@
 STATUS_LIBS = -L/usr/lib
 STATUS_INCS =
 STATUS_CPPFLAGS = -DVERSION=\"${VERSION}\"
-STATUS_CFLAGS = -std=c99 -pedantic -Wall -Os ${STATUS_INCS} ${STATUS_CPPFLAGS}
-STATUS_LDFLAGS = ${STATUS_LIBS} -static
+STATUS_CFLAGS = -g -std=c99 -pedantic -Wall -Os ${STATUS_INCS} ${STATUS_CPPFLAGS}
+STATUS_LDFLAGS = -g ${STATUS_LIBS} -static
 
 STATUS = status-time status-mem status-loadavg status-wifi status-bat
 # compiler and linker
diff -r 96b47c0505b5 -r 442bed4a072e status-time/Makefile
--- a/status-time/Makefile	Thu Oct 23 20:49:34 2014 +0400
+++ b/status-time/Makefile	Fri Oct 24 14:13:46 2014 +0400
@@ -2,6 +2,7 @@
 # See LICENSE file for copyright and license details.
 
 include ../config.mk
+include config.mk
 
 OUT = status-time
 SRC = time.c
diff -r 96b47c0505b5 -r 442bed4a072e status-time/config.def.h
--- a/status-time/config.def.h	Thu Oct 23 20:49:34 2014 +0400
+++ b/status-time/config.def.h	Fri Oct 24 14:13:46 2014 +0400
@@ -1,3 +1,4 @@
 #define TIMEZONE "Europe/Moscow"
 #define TIMEFORMAT "%d.%m.%Y %H:%M"
+#define LOCALE "" // comment out to disable locale support
 #define UPDATE_PERIOD 1
diff -r 96b47c0505b5 -r 442bed4a072e status-time/config.mk
--- a/status-time/config.mk	Thu Oct 23 20:49:34 2014 +0400
+++ b/status-time/config.mk	Fri Oct 24 14:13:46 2014 +0400
@@ -0,0 +1,3 @@
+# setlocale is broken in statically-linked binaries
+# comment out the following line if you don't need it
+STATUS_LDFLAGS = ${STATUS_LIBS}
diff -r 96b47c0505b5 -r 442bed4a072e status-time/time.c
--- a/status-time/time.c	Thu Oct 23 20:49:34 2014 +0400
+++ b/status-time/time.c	Fri Oct 24 14:13:46 2014 +0400
@@ -8,6 +8,9 @@
 #include <time.h>
 
 #include "config.h"
+#ifdef LOCALE
+#include <locale.h>
+#endif
 
 int
 main(void)
@@ -15,6 +18,9 @@
     char buf[129];
     time_t tim;
     struct tm *timtm;
+#ifdef LOCALE
+    setlocale(LC_TIME, LOCALE);
+#endif
 
     setenv("TZ", TIMEZONE, 1);