comparison src/w32.c @ 33869:e41a7b1e443f

(init_environment): Set LANG environment variable based on locale settings, if not set.
author Jason Rumney <jasonr@gnu.org>
date Fri, 24 Nov 2000 21:30:06 +0000
parents f5c37cece73f
children 69143373d98d
comparison
equal deleted inserted replaced
33868:d77db72e017d 33869:e41a7b1e443f
700 don't exist. Fallback on default values where applicable. */ 700 don't exist. Fallback on default values where applicable. */
701 { 701 {
702 int i; 702 int i;
703 LPBYTE lpval; 703 LPBYTE lpval;
704 DWORD dwType; 704 DWORD dwType;
705 char locale_name[32];
705 706
706 static struct env_entry 707 static struct env_entry
707 { 708 {
708 char * name; 709 char * name;
709 char * def_value; 710 char * def_value;
719 {"EMACSLOCKDIR", "%emacs_dir%/lock"}, 720 {"EMACSLOCKDIR", "%emacs_dir%/lock"},
720 /* We no longer set INFOPATH because Info-default-directory-list 721 /* We no longer set INFOPATH because Info-default-directory-list
721 is then ignored. */ 722 is then ignored. */
722 /* {"INFOPATH", "%emacs_dir%/info"}, */ 723 /* {"INFOPATH", "%emacs_dir%/info"}, */
723 {"EMACSDOC", "%emacs_dir%/etc"}, 724 {"EMACSDOC", "%emacs_dir%/etc"},
724 {"TERM", "cmd"} 725 {"TERM", "cmd"},
726 {"LANG", NULL},
725 }; 727 };
728
729 /* Get default locale info and use it for LANG. */
730 if (GetLocaleInfo (LOCALE_USER_DEFAULT,
731 LOCALE_SABBREVLANGNAME | LOCALE_USE_CP_ACP,
732 locale_name, sizeof (locale_name)))
733 {
734 for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
735 {
736 if (strcmp (env_vars[i].name, "LANG") == 0)
737 {
738 env_vars[i].def_value = locale_name;
739 break;
740 }
741 }
742 }
726 743
727 #define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */ 744 #define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */
728 745
729 /* Treat emacs_dir specially: set it unconditionally based on our 746 /* Treat emacs_dir specially: set it unconditionally based on our
730 location, if it appears that we are running from the bin subdir 747 location, if it appears that we are running from the bin subdir
750 _snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname); 767 _snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname);
751 _putenv (strdup (buf)); 768 _putenv (strdup (buf));
752 } 769 }
753 } 770 }
754 771
755 for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++) 772 for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
756 { 773 {
757 if (!getenv (env_vars[i].name)) 774 if (!getenv (env_vars[i].name))
758 { 775 {
759 int dont_free = 0; 776 int dont_free = 0;
760 777