[pacman-dev] CVS update of pacman-lib/src/pacman (pacman.c)

dan at archlinux.org dan at archlinux.org
Mon Feb 12 20:50:18 EST 2007


    Date: Monday, February 12, 2007 @ 20:50:18
  Author: dan
    Path: /home/cvs-pacman/pacman-lib/src/pacman

Modified: pacman.c (1.95 -> 1.96)

Fixed locale setting issues in the frontend, and fixed description of --cachedir.


----------+
 pacman.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)


Index: pacman-lib/src/pacman/pacman.c
diff -u pacman-lib/src/pacman/pacman.c:1.95 pacman-lib/src/pacman/pacman.c:1.96
--- pacman-lib/src/pacman/pacman.c:1.95	Mon Feb 12 20:37:48 2007
+++ pacman-lib/src/pacman/pacman.c	Mon Feb 12 20:50:18 2007
@@ -155,7 +155,7 @@
 		printf(_("  -v, --verbose        be verbose\n"));
 		printf(_("  -r, --root <path>    set an alternate installation root\n"));
 		printf(_("  -b, --dbpath <path>  set an alternate database location\n"));
-		printf(_("      --cachedir <dir> set an alternate database location\n"));
+		printf(_("      --cachedir <dir> set an alternate package cache location\n"));
 	}
 }
 
@@ -435,13 +435,15 @@
 	signal(SIGSEGV, cleanup);
 
 	/* i18n init */
-	lang=getenv("LC_ALL");
-	if(lang==NULL || lang[0]=='\0')
-		lang=getenv("LC_MESSAGES");
-	if (lang==NULL || lang[0]=='\0')
-		lang=getenv("LANG");
+	lang = setlocale(LC_ALL, "");
+	/* if setlocale returns null, the locale was invalid- override it */
+	if (lang == NULL) {
+		lang = "C";
+		setlocale(LC_ALL, "C");
+		setenv("LC_ALL", lang, 1);
+		MSG(NL, _("warning: default locale is invalid; using default \"C\" locale"));
+	}
 
-	setlocale(LC_ALL, lang);
 	/* workaround for tr_TR */
 	if(lang && !strcmp(lang, "tr_TR"))
 		setlocale(LC_CTYPE, "C");




More information about the pacman-dev mailing list