readpassphrase.c.patch   [plain text]


--- readpassphrase.c.orig	2003-05-20 15:21:02.000000000 -0700
+++ readpassphrase.c	2005-02-24 17:00:36.000000000 -0800
@@ -33,6 +33,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/lib/libc/gen/readpassphrase.c,v 1.6 2002/03/09 03:16:41 green Exp $");
 
+#include "xlocale_private.h"
+
 #include "namespace.h"
 #include <ctype.h>
 #include <errno.h>
@@ -59,6 +61,7 @@
 	struct termios term, oterm;
 	struct sigaction sa, saveint, savehup, savequit, saveterm;
 	struct sigaction savetstp, savettin, savettou;
+	locale_t loc = __current_locale();
 
 	/* I suppose we could alloc on demand in this case (XXX). */
 	if (bufsiz == 0) {
@@ -115,11 +118,11 @@
 		if (p < end) {
 			if ((flags & RPP_SEVENBIT))
 				ch &= 0x7f;
-			if (isalpha(ch)) {
+			if (isalpha_l(ch, loc)) {
 				if ((flags & RPP_FORCELOWER))
-					ch = tolower(ch);
+					ch = tolower_l(ch, loc);
 				if ((flags & RPP_FORCEUPPER))
-					ch = toupper(ch);
+					ch = toupper_l(ch, loc);
 			}
 			*p++ = ch;
 		}