From 61733e322a765c9279506675830a23efea9d4721 Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Thu, 28 Nov 2013 16:12:17 +0100 Subject: [PATCH 1/1] asc2log: inform about uninstalled locales at date conversion failures Signed-off-by: Oliver Hartkopp --- asc2log.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/asc2log.c b/asc2log.c index bb1baab..548fc7e 100644 --- a/asc2log.c +++ b/asc2log.c @@ -132,8 +132,10 @@ int get_date(struct timeval *tv, char *date) { if (sscanf(date, "%9s %d %9s %9s %d", ctmp, &itmp, ctmp, ctmp, &itmp) == 5) { /* assume EN/US date due to existing am/pm field */ - if (!setlocale(LC_TIME, "en_US")) + if (!setlocale(LC_TIME, "en_US")) { + fprintf(stderr, "Setting locale to 'en_US' failed!\n"); return 1; + } if (!strptime(date, "%B %d %r %Y", &tms)) return 1; @@ -144,8 +146,10 @@ int get_date(struct timeval *tv, char *date) { if (sscanf(date, "%9s %d %9s %d", ctmp, &itmp, ctmp, &itmp) != 4) return 1; - if (!setlocale(LC_TIME, "de_DE")) + if (!setlocale(LC_TIME, "de_DE")) { + fprintf(stderr, "Setting locale to 'de_DE' failed!\n"); return 1; + } if (!strptime(date, "%B %d %T %Y", &tms)) return 1; -- 2.39.2