From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from imap.thunk.org ([74.207.234.97]:44750 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758478AbcC3AsL (ORCPT ); Tue, 29 Mar 2016 20:48:11 -0400 From: Theodore Ts'o To: jack@suse.cz Cc: Linux Filesystem Development List , Theodore Ts'o Subject: [PATCH 5/5] Support systems which do not have nl_langinfo() Date: Tue, 29 Mar 2016 20:48:07 -0400 Message-Id: <1459298887-21519-6-git-send-email-tytso@mit.edu> In-Reply-To: <1459298887-21519-1-git-send-email-tytso@mit.edu> References: <1459298887-21519-1-git-send-email-tytso@mit.edu> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Add a configure check and skip use of nl_langinfo if it is not present. Signed-off-by: Theodore Ts'o --- configure.ac | 1 + warnquota.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index d17b18c..0d0ba57 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,7 @@ PKG_PROG_PKG_CONFIG([0.20]) AC_C_CONST AC_C_INLINE +AC_CHECK_FUNC(nl_langinfo) # =============== # Gettext support diff --git a/warnquota.c b/warnquota.c index e9868c1..0d911e4 100644 --- a/warnquota.c +++ b/warnquota.c @@ -30,7 +30,9 @@ #include #include #include +#ifdef HAVE_NL_LANGINFO #include +#endif #include #include #include @@ -723,10 +725,12 @@ static int readconfigfile(const char *filename, struct configparams *config) (config->charset)[0] = '\0'; setlocale(LC_ALL, NULL); locale = setlocale(LC_MESSAGES, NULL); +#ifdef HAVE_NL_LANGINFO if (locale && strcasecmp(locale, "posix") && strcasecmp(locale, "c")) { locale = nl_langinfo(CODESET); sstrncpy(config->charset, locale, CNF_BUFFER); } +#endif maildev[0] = 0; config->user_signature = config->user_message = config->group_signature = config->group_message = NULL; config->cc_before = -1; -- 2.5.0