components/tcsh/003.locale.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Thu, 17 Feb 2011 14:05:50 -0800
changeset 94 e2364cad23ff
permissions -rw-r--r--
7019782 move tcsh to userland

--- 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:%=@localedir@/%/LC_MESSAGES/tcsh.cat)
+
+all:	$(CATALOGS)
+
+install:	$(INSTALLED)
+
+@localedir@/%/LC_MESSAGES/tcsh.cat:	%.cat
+	mkdir -p $(@D)
+	$(INSTALL) $< $@
+
+%.cat:
+	$(GENCAT) $@ $(@:%.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)
 VPATH=@srcdir@
 srcdir=@srcdir@
+localedir=@localedir@
 
 ################################################################
 ## 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"' @DFLAGS@ @CPPFLAGS@
+DFLAGS += -DLOCALEDIR='"${localedir}"'
 
 
+
 ################################################################
 ## LDFLAGS.  Define something here if you need to
 ################################################################
@@ -231,7 +234,7 @@
 #
 
 EXTRAFLAGS = @HESDEF@ $(AFSDEF)
-EXTRALIBS = @HESLIB@ $(AFSLIB) @LIBICONV@
+EXTRALIBS = @HESLIB@ $(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