/* global libraries */
#include <alsa/asoundlib.h>
#include <fcntl.h>
+#include <locale.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
config_check()
{
struct stat fs;
+
+ /* check all files in the config.h file */
CHECK_FILE(batterynowfile, fs);
CHECK_FILE(batteryfullfile, fs);
CHECK_FILE(tempfile, fs);
+
+ /* check update interval */
+ if (update_interval < 1)
+ return -1;
+
+ /* exit successfully */
return 0;
}
/* get time in format */
time(&tm);
+ setlocale(LC_TIME, "");
if(!strftime(buf, bufsize, timeformat, localtime(&tm))) {
+ setlocale(LC_TIME, "C");
fprintf(stderr, "Strftime failed.\n");
return smprintf("n/a");
}
+ setlocale(LC_TIME, "C");
/* return time */
return smprintf("%s", buf);
}
/* check config for sanity */
if (config_check() < 0) {
- fprintf(stderr, "Config error, please check paths and recompile\n");
+ fprintf(stderr, "Config error, please check paths and interval and recompile!\n");
exit(1);
}