components/tcsh/patches/003.locale.patch
changeset 1073 c80b2ce240a9
parent 115 c360825c3a3f
child 5271 195e24ffa71a
equal deleted inserted replaced
1072:75ddf7807870 1073:c80b2ce240a9
     1 --- tcsh-6.17.00/sh.c.orig	Tue Sep 22 13:39:07 2009
     1 --- tcsh-6.18.01/configure.in.orig	Wed Sep  5 11:52:15 2012
     2 +++ tcsh-6.17.00/sh.c	Wed Sep 23 00:46:27 2009
     2 +++ tcsh-6.18.01/configure.in	Wed Sep  5 11:52:40 2012
     3 @@ -160,6 +160,52 @@
     3 @@ -303,7 +303,6 @@
       
     4  AC_SEARCH_LIBS(gethostbyname, nsl)
       
     5  AC_SEARCH_LIBS(connect, socket)
       
     6  AC_SEARCH_LIBS(catgets, catgets)
       
     7 -AM_ICONV
     4  
     8  
     5  	int		  main		(int, char **);
     9  dnl Checks for header files
     6  
    10  AC_CHECK_HEADERS([auth.h crypt.h features.h inttypes.h paths.h] dnl
     7 +#ifndef LOCALEDIR
    11 --- tcsh-6.18.01/Makefile.in.orig	Wed Sep  5 11:56:12 2012
     8 +#define LOCALEDIR "/usr/share/locale"
    12 +++ tcsh-6.18.01/Makefile.in	Wed Sep  5 11:57:51 2012
     9 +#endif
       
    10 +
       
    11 +static void
       
    12 +add_localedir_to_nslpath(char *path)
       
    13 +{
       
    14 +    char *old = getenv("NLSPATH");
       
    15 +    char *new;
       
    16 +    int len = 0;
       
    17 +
       
    18 +    if (path == NULL)
       
    19 +        return;
       
    20 +
       
    21 +    if (old != NULL)
       
    22 +        len += strlen(old);
       
    23 +
       
    24 +#if !defined(HAVE_SETENV)
       
    25 +    len += sizeof ("NLSPATH=");
       
    26 +#endif
       
    27 +
       
    28 +    len += (strlen(path) + sizeof ("/%L/LC_MESSAGES/%N.cat"));
       
    29 +
       
    30 +    if ((new = calloc(len, 1)) == NULL)
       
    31 +        return;
       
    32 +
       
    33 +#if !defined(HAVE_SETENV)
       
    34 +    strcpy(new, "NLSPATH=");
       
    35 +#endif
       
    36 +
       
    37 +    if (old != NULL) {
       
    38 +        strncat(new, old, len);
       
    39 +        strncat(new, ":", len);
       
    40 +    }
       
    41 +
       
    42 +    strncat(new, path, len);
       
    43 +    strncat(new, "/%L/LC_MESSAGES/%N.cat", len);
       
    44 +
       
    45 +#if defined(HAVE_SETENV)
       
    46 +    setenv("NLSPATH", new, 1);
       
    47 +    free(new);
       
    48 +#else
       
    49 +    putenv(new);
       
    50 +#endif
       
    51 +}
       
    52 +
       
    53  int
       
    54  main(int argc, char **argv)
       
    55  {
       
    56 @@ -192,6 +238,8 @@
       
    57  # endif /* LC_CTYPE */
       
    58  #endif /* NLS */
       
    59  
       
    60 +    add_localedir_to_nslpath(LOCALEDIR);
       
    61 +
       
    62      nlsinit();
       
    63  
       
    64  #ifdef MALLOC_TRACE
       
    65 --- tcsh-6.17.00/nls/Makefile.in.orig	Wed Oct  7 13:25:44 2009
       
    66 +++ tcsh-6.17.00/nls/Makefile.in	Wed Oct  7 13:31:57 2009
       
    67 @@ -0,0 +1,24 @@
       
    68 +# $tcsh: Makefile,v 1.14 2006/03/02 18:46:45 christos Exp $
       
    69 +
       
    70 +LOCALES=	C et finnish french german greek italian ja pl russian \
       
    71 +		spanish ukrainian
       
    72 +GENCAT=		gencat
       
    73 +INSTALL=	ginstall
       
    74 +
       
    75 +CATALOGS=$(LOCALES:%=%.cat)
       
    76 +INSTALLED=$(LOCALES:%=@localedir@/%/LC_MESSAGES/tcsh.cat)
       
    77 +
       
    78 +all:	$(CATALOGS)
       
    79 +
       
    80 +install:	$(INSTALLED)
       
    81 +
       
    82 +@localedir@/%/LC_MESSAGES/tcsh.cat:	%.cat
       
    83 +	mkdir -p $(@D)
       
    84 +	$(INSTALL) $< $@
       
    85 +
       
    86 +%.cat:
       
    87 +	$(GENCAT) $@ $(@:%.cat=%)/*set*
       
    88 +
       
    89 +clean:
       
    90 +	$(RM) $(CATALOGS)
       
    91 +
       
    92 
       
    93 --- tcsh-6.17.00/Makefile.in.orig	Wed Jun 24 15:09:05 2009
       
    94 +++ tcsh-6.17.00/Makefile.in	Wed Oct  7 14:19:01 2009
       
    95 @@ -12,6 +12,7 @@
    13 @@ -12,6 +12,7 @@
    96  BUILD=tcsh$(EXEEXT)
    14  BUILD=tcsh$(EXEEXT)
    97  VPATH=@srcdir@
    15  VPATH=@srcdir@
    98  srcdir=@srcdir@
    16  srcdir=@srcdir@
    99 +localedir=@localedir@
    17 +localedir=@localedir@
   100  
    18  
   101  ################################################################
    19  ################################################################
   102  ## CFLAGS.  For various -D things, see config.h
    20  ## CFLAGS.  For various -D things, see config.h
   103 @@ -137,8 +138,10 @@
    21 @@ -145,6 +146,7 @@
   104  #DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
    22  #DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
   105  ## The following is set by autoconf.
    23  ## The following is set by autoconf.
   106  DFLAGS = -D_PATH_TCSHELL='"${bindir}/tcsh"' @DFLAGS@ @CPPFLAGS@
    24  DFLAGS = -D_PATH_TCSHELL='"${bindir}/tcsh"' @DFLAGS@ @CPPFLAGS@
   107 +DFLAGS += -DLOCALEDIR='"${localedir}"'
    25 +DFLAGS += -DLOCALEDIR='"${localedir}"'
   108  
    26  
   109  
    27  
   110 +
       
   111  ################################################################
    28  ################################################################
   112  ## LDFLAGS.  Define something here if you need to
    29 @@ -296,7 +298,7 @@
   113  ################################################################
       
   114 @@ -231,7 +234,7 @@
       
   115  #
    30  #
   116  
    31  
   117  EXTRAFLAGS = @HESDEF@ $(AFSDEF)
    32  EXTRAFLAGS = @HESDEF@ $(AFSDEF)
   118 -EXTRALIBS = @HESLIB@ $(AFSLIB) @LIBICONV@
    33 -EXTRALIBS = @HESLIB@ $(AFSLIB) @LIBICONV@
   119 +EXTRALIBS = @HESLIB@ $(AFSLIB)
    34 +EXTRALIBS = @HESLIB@ $(AFSLIB)
   120  
    35  
   121  
    36  
   122  
    37  
   123 --- tcsh-6.17.00/configure.in	Fri Jul 10 10:13:56 2009
    38 --- tcsh-6.18.01/sh.c.orig	Thu Nov 15 14:26:18 2012
   124 +++ tc/configure.in	Wed Oct  7 14:21:21 2009
    39 +++ tcsh-6.18.01/sh.c	Thu Nov 15 14:26:37 2012
   125 @@ -281,7 +281,6 @@
    40 @@ -175,17 +175,10 @@
   126  AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
    41      size_t len;
   127  AC_SEARCH_LIBS(gethostbyname, nsl)
    42      int add_LOC = 1;
   128  AC_SEARCH_LIBS(connect, socket)
    43      int add_lang = 1;
   129 -AM_ICONV
    44 -    char trypath[MAXPATHLEN];
       
    45 -    struct stat st;
   130  
    46  
   131  dnl Checks for header files
    47      if (path == NULL)
   132  AC_CHECK_HEADERS([auth.h crypt.h inttypes.h shadow.h stdint.h utmp.h utmpx.h])
    48          return;
   133 @@ -440,5 +440,5 @@
       
   134  AC_SUBST(HESDEF)
       
   135  AC_SUBST(HESLIB)
       
   136  
    49  
   137 -AC_CONFIG_FILES([Makefile])
    50 -    (void) xsnprintf(trypath, sizeof(trypath), "%s/en/LC_MESSAGES/tcsh.cat",
   138 +AC_CONFIG_FILES([Makefile nls/Makefile])
    51 -	path);
   139  AC_OUTPUT
    52 -    if (stat(trypath, &st) == -1)
   140 
    53 -	return;
       
    54 -
       
    55      if ((old = getenv("NLSPATH")) != NULL)
       
    56          len = strlen(old) + 1;	/* don't forget the colon. */
       
    57      else
       
    58 --- tcsh-6.18.01/sh.func.c.orig	Mon Dec  3 13:09:33 2012
       
    59 +++ tcsh-6.18.01/sh.func.c	Mon Dec  3 13:09:54 2012
       
    60 @@ -2627,6 +2627,8 @@
       
    61  
       
    62      if (adrof(STRcatalog) != NULL)
       
    63  	catalog = xasprintf("tcsh.%s", short2str(varval(STRcatalog)));
       
    64 +/* for compatibility */
       
    65 +#undef NL_CAT_LOCALE
       
    66  #ifdef NL_CAT_LOCALE /* POSIX-compliant. */
       
    67      /*
       
    68       * Check if LC_MESSAGES is set in the environment and use it, if so.