Re: nls/locale handling in util-linux general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 03 September 2007, Karel Zak wrote:
> On Mon, Sep 03, 2007 at 11:08:21AM -0400, Mike Frysinger wrote:
> > looks to me like all of the locale handling should be localized to the
> > include/nls.h file right ?  and that a few things havent been converted
> > to that ?  it also looks like in the ENABLE_NLS path, no one really
> > explicitly pulls in locale.h, yet in the !ENABLE_NLS path, locale.h gets
> > pulled in !?  in other words, util-linux wont build anymore on a real
> > system that completely lacks locale/nls support ... this about right ? 
> > this patch should fix that
>
>  Deja vu :-) See:
>
>    
> http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592
>
>  I agree that we need a better support for compilation without
>  locales, but from my point of view NLS != all locales stuff. The NLS
>  support is subset only.

thinking about the input from everyone, i'd propose the attached ...

Only pull in locale.h as needed and move it to the common nls.h.

Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
---
 configure.ac       |    1 +
 include/nls.h      |    8 +++++++-
 misc-utils/cal.c   |    1 -
 misc-utils/look.c  |    1 -
 misc-utils/write.c |    1 -
 text-utils/colrm.c |    2 +-
 text-utils/more.c  |    1 -
 text-utils/pg.c    |    2 --
 8 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e212ea..e7cfca3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,7 @@ AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h], [], [], [
 AC_CHECK_HEADERS(
 	[scsi/scsi.h \
 	langinfo.h \
+	locale.h \
 	sys/user.h \
 	rpcsvc/nfs_prot.h \
 	sys/io.h \
diff --git a/include/nls.h b/include/nls.h
index f571ca5..dd0440c 100644
--- a/include/nls.h
+++ b/include/nls.h
@@ -7,6 +7,13 @@ int main(int argc, char *argv[]);
 #define LOCALEDIR "/usr/share/locale"
 #endif
 
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#else
+# undef setlocale
+# define setlocale(Category, Locale) /* empty */
+#endif
+
 #ifdef ENABLE_NLS
 # include <libintl.h>
 # define _(Text) gettext (Text)
@@ -16,7 +23,6 @@ int main(int argc, char *argv[]);
 #  define N_(String) (String)
 # endif
 #else
-# include <locale.h>
 # undef bindtextdomain
 # define bindtextdomain(Domain, Directory) /* empty */
 # undef textdomain
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index f5ede93..77333d8 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -63,7 +63,6 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
-#include <locale.h>
 #include "errs.h"
 #include "nls.h"
 
diff --git a/misc-utils/look.c b/misc-utils/look.c
index 5c7e30c..9e25596 100644
--- a/misc-utils/look.c
+++ b/misc-utils/look.c
@@ -59,7 +59,6 @@
 #include <strings.h>
 #include <ctype.h>
 #include <getopt.h>
-#include <locale.h>
 #include "pathnames.h"
 #include "nls.h"
 
diff --git a/misc-utils/write.c b/misc-utils/write.c
index b3c96d1..46b8f0a 100644
--- a/misc-utils/write.c
+++ b/misc-utils/write.c
@@ -54,7 +54,6 @@
 #include <pwd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <locale.h>
 #include <signal.h>
 #include <sys/param.h>
 #include <sys/signal.h>
diff --git a/text-utils/colrm.c b/text-utils/colrm.c
index 5e18a6f..e8b1ea4 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -40,8 +40,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <locale.h>
 
+#include "nls.h"
 #include "widechar.h"
 
 /*
diff --git a/text-utils/more.c b/text-utils/more.c
index 19c4417..5dcae7b 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -55,7 +55,6 @@
 #include <sys/file.h>
 #include <sys/wait.h>
 #include <a.out.h>
-#include <locale.h>
 #include "xstrncpy.h"
 #include "nls.h"
 #include "widechar.h"
diff --git a/text-utils/pg.c b/text-utils/pg.c
index 10bdd15..3e1b25e 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -49,8 +49,6 @@
 #include <unistd.h>
 #include <signal.h>
 #include <setjmp.h>
-#include <locale.h>
-#include <nl_types.h>
 #include <libgen.h>
 
 #ifdef HAVE_NCURSES_H
-- 
1.5.3.rc7

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux