components/tcsh/patches/003.locale.patch
changeset 115 c360825c3a3f
parent 94 e2364cad23ff
child 1073 c80b2ce240a9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/tcsh/patches/003.locale.patch	Tue Mar 01 14:19:15 2011 -0800
@@ -0,0 +1,140 @@
+--- 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
[email protected]@ -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)
+ {
[email protected]@ -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
[email protected]@ -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
[email protected]@ -12,6 +12,7 @@
+ BUILD=tcsh$(EXEEXT)
+ [email protected]@
+ [email protected]@
[email protected]@
+ 
+ ################################################################
+ ## CFLAGS.  For various -D things, see config.h
[email protected]@ -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
+ ################################################################
[email protected]@ -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
[email protected]@ -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])
[email protected]@ -440,5 +440,5 @@
+ AC_SUBST(HESDEF)
+ AC_SUBST(HESLIB)
+ 
+-AC_CONFIG_FILES([Makefile])
++AC_CONFIG_FILES([Makefile nls/Makefile])
+ AC_OUTPUT
+