From 5d76519869e4bf188f748e487e083ef394e384a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Sun, 17 Sep 2017 22:09:19 +0200 Subject: Move utf8_locale setting in utf8.c Less goo in main.c --- src/main.c | 8 +------- src/utf8.c | 15 ++++++++++++++- src/utf8.h | 2 ++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main.c b/src/main.c index fa49784..91082f3 100644 --- a/src/main.c +++ b/src/main.c @@ -38,10 +38,6 @@ #include "ratpoison.h" -#ifdef HAVE_LANGINFO_CODESET -# include -#endif - /* Command line options */ static struct option ratpoison_longopts[] = { {"help", no_argument, 0, 'h'}, @@ -309,9 +305,7 @@ main (int argc, char *argv[]) else PRINT_ERROR (("X doesn't seem to support your locale.\n")); -#ifdef HAVE_LANGINFO_CODESET - utf8_locale = !strcmp (nl_langinfo (CODESET), "UTF-8"); -#endif + utf8_check_locale(); /* Parse the arguments */ myargv = argv; diff --git a/src/utf8.c b/src/utf8.c index bb53d57..c15e5c1 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -1,3 +1,16 @@ -#include "utf8.h" +#include "ratpoison.h" + +#ifdef HAVE_LANGINFO_CODESET +# include +#endif int utf8_locale; + +int +utf8_check_locale(void) +{ +#ifdef HAVE_LANGINFO_CODESET + utf8_locale = !strcmp (nl_langinfo (CODESET), "UTF-8"); +#endif + return utf8_locale; +} diff --git a/src/utf8.h b/src/utf8.h index 10cec7f..2847b5a 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -3,4 +3,6 @@ extern int utf8_locale; +int utf8_check_locale(void); + #endif -- cgit v1.2.3