linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: jack@suse.cz
Cc: Linux Filesystem Development List <linux-fsdevel@vger.kernel.org>,
	Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 5/5] Support systems which do not have nl_langinfo()
Date: Tue, 29 Mar 2016 20:48:07 -0400	[thread overview]
Message-ID: <1459298887-21519-6-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1459298887-21519-1-git-send-email-tytso@mit.edu>

Add a configure check and skip use of nl_langinfo if it is not
present.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 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 <time.h>
 #include <getopt.h>
 #include <locale.h>
+#ifdef HAVE_NL_LANGINFO
 #include <langinfo.h>
+#endif
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/utsname.h>
@@ -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


  parent reply	other threads:[~2016-03-30  0:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30  0:48 [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Theodore Ts'o
2016-03-30  0:48 ` [PATCH 1/5] Update the gitignore file to ignore additional generated files Theodore Ts'o
2016-03-30  0:48 ` [PATCH 2/5] Allow building on systems that do not have rpc header files Theodore Ts'o
2016-03-30  0:48 ` [PATCH 3/5] Use NGROUPS_MAX instead of NGROUPS Theodore Ts'o
2016-03-30  0:48 ` [PATCH 4/5] Provide fallback definitions for MNTTYPE_NFS and MNTTYPE_NOAUTO Theodore Ts'o
2016-03-30  0:48 ` Theodore Ts'o [this message]
2016-03-30  8:29 ` [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459298887-21519-6-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).