summaryrefslogtreecommitdiffstats
path: root/bin/sh/var.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-05-08 17:40:10 +0000
committerjilles <jilles@FreeBSD.org>2011-05-08 17:40:10 +0000
commitc9be2081e05e10ddab3dcb7fe31efcc981524e18 (patch)
treee90b9f059591317bfa02d51bd83a0cf89ad9f520 /bin/sh/var.c
parentbf0e27838c7f0e2558fb05339e6f8b74848281c9 (diff)
downloadFreeBSD-src-c9be2081e05e10ddab3dcb7fe31efcc981524e18.zip
FreeBSD-src-c9be2081e05e10ddab3dcb7fe31efcc981524e18.tar.gz
sh: Add \u/\U support (in $'...') for UTF-8.
Because we have no iconv in base, support for other charsets is not possible. Note that \u/\U are processed using the locale that was active when the shell started. This is necessary to avoid behaviour that depends on the parse/execute split (for example when placing braces around an entire script). Therefore, UTF-8 encoding is implemented manually.
Diffstat (limited to 'bin/sh/var.c')
-rw-r--r--bin/sh/var.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c
index 33890db..84b6dea 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -517,6 +517,13 @@ updatecharset(void)
localeisutf8 = !strcmp(charset, "UTF-8");
}
+void
+initcharset(void)
+{
+ updatecharset();
+ initial_localeisutf8 = localeisutf8;
+}
+
/*
* Generate a list of exported variables. This routine is used to construct
* the third argument to execve when executing a program.
OpenPOWER on IntegriCloud