components/tcsh/patches/003.locale.patch
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Tue, 01 Mar 2011 14:19:15 -0800
changeset 115 c360825c3a3f
parent 94 components/tcsh/[email protected]
child 1073 c80b2ce240a9
permissions -rw-r--r--
7022166 userland patches should move to subdirs
--- tcsh-6.17.00/sh.c.orig	Tue Sep 22 13:39:07 2009
+++ tcsh-6.17.00/sh.c	Wed Sep 23 00:46:27 2009
@@ -160,6 +160,52 @@
 
 	int		  main		(int, char **);
 
+#ifndef LOCALEDIR
+#define LOCALEDIR "/usr/share/locale"
+#endif
+
+static void
+add_localedir_to_nslpath(char *path)
+{
+    char *old = getenv("NLSPATH");
+    char *new;
+    int len = 0;
+
+    if (path == NULL)
+        return;
+
+    if (old != NULL)
+        len += strlen(old);
+
+#if !defined(HAVE_SETENV)
+    len += sizeof ("NLSPATH=");
+#endif
+
+    len += (strlen(path) + sizeof ("/%L/LC_MESSAGES/%N.cat"));
+
+    if ((new = calloc(len, 1)) == NULL)
+        return;
+
+#if !defined(HAVE_SETENV)
+    strcpy(new, "NLSPATH=");
+#endif
+
+    if (old != NULL) {
+        strncat(new, old, len);
+        strncat(new, ":", len);
+    }
+
+    strncat(new, path, len);
+    strncat(new, "/%L/LC_MESSAGES/%N.cat", len);
+
+#if defined(HAVE_SETENV)
+    setenv("NLSPATH", new, 1);
+    free(new);
+#else
+    putenv(new);
+#endif
+}
+
 int
 main(int argc, char **argv)
 {
@@ -192,6 +238,8 @@
 # endif /* LC_CTYPE */
 #endif /* NLS */
 
+    add_localedir_to_nslpath(LOCALEDIR);
+
     nlsinit();
 
 #ifdef MALLOC_TRACE
--- tcsh-6.17.00/nls/Makefile.in.orig	Wed Oct  7 13:25:44 2009
+++ tcsh-6.17.00/nls/Makefile.in	Wed Oct  7 13:31:57 2009
@@ -0,0 +1,24 @@
+# $tcsh: Makefile,v 1.14 2006/03/02 18:46:45 christos Exp $
+
+LOCALES=	C et finnish french german greek italian ja pl russian \
+		spanish ukrainian
+GENCAT=		gencat
+INSTALL=	ginstall
+
+CATALOGS=$(LOCALES:%=%.cat)
+INSTALLED=$(LOCALES:%[email protected]@/%/LC_MESSAGES/tcsh.cat)
+
+all:	$(CATALOGS)
+
+install:	$(INSTALLED)
+
[email protected]@/%/LC_MESSAGES/tcsh.cat:	%.cat
+	mkdir -p $(@D)
+	$(INSTALL) $< [email protected]
+
+%.cat:
+	$(GENCAT) [email protected] $(@:%.cat=%)/*set*
+
+clean:
+	$(RM) $(CATALOGS)
+

--- tcsh-6.17.00/Makefile.in.orig	Wed Jun 24 15:09:05 2009
+++ tcsh-6.17.00/Makefile.in	Wed Oct  7 14:19:01 2009
@@ -12,6 +12,7 @@
 BUILD=tcsh$(EXEEXT)
 [email protected]@
 [email protected]@
[email protected]@
 
 ################################################################
 ## CFLAGS.  For various -D things, see config.h
@@ -137,8 +138,10 @@
 #DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
 ## The following is set by autoconf.
 DFLAGS = -D_PATH_TCSHELL='"${bindir}/tcsh"' @[email protected] @[email protected]
+DFLAGS += -DLOCALEDIR='"${localedir}"'
 
 
+
 ################################################################
 ## LDFLAGS.  Define something here if you need to
 ################################################################
@@ -231,7 +234,7 @@
 #
 
 EXTRAFLAGS = @[email protected] $(AFSDEF)
-EXTRALIBS = @[email protected] $(AFSLIB) @[email protected]
+EXTRALIBS = @[email protected] $(AFSLIB)
 
 
 
--- tcsh-6.17.00/configure.in	Fri Jul 10 10:13:56 2009
+++ tc/configure.in	Wed Oct  7 14:21:21 2009
@@ -281,7 +281,6 @@
 AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
 AC_SEARCH_LIBS(gethostbyname, nsl)
 AC_SEARCH_LIBS(connect, socket)
-AM_ICONV
 
 dnl Checks for header files
 AC_CHECK_HEADERS([auth.h crypt.h inttypes.h shadow.h stdint.h utmp.h utmpx.h])
@@ -440,5 +440,5 @@
 AC_SUBST(HESDEF)
 AC_SUBST(HESLIB)
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile nls/Makefile])
 AC_OUTPUT