summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2015-11-28 16:41:21 +0100
committerBert Münnich <ber.t@posteo.de>2018-12-29 19:19:11 +0100
commit134ea56bac17a42cf71742807a50f4ca4ac72474 (patch)
tree6479654b106115f913949c94effe14c2e914b53f /main.c
parentb234c5153b5f12b82dceefd04865213554a875da (diff)
Set LC_CTYPE after reading ~/.rcrc
rc does not handle umlauts correctly, if locale environment variables are first set in ~/.rcrc. It is necessary to update the environment before calling setlocale(3) because it would otherwise not see the variable values assigned in ~/.rcrc.
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main.c b/main.c
index 870d104..026f0e7 100644
--- a/main.c
+++ b/main.c
@@ -3,9 +3,12 @@
#include "rc.h"
#include <errno.h>
+#include <locale.h>
#include "input.h"
+extern char **environ;
+
bool dashdee, dashee, dasheye, dashell, dashen;
bool dashpee, dashoh, dashess, dashvee, dashex;
bool interactive;
@@ -120,6 +123,8 @@ quitopts:
close(fd);
}
}
+ environ = makeenv();
+ setlocale(LC_CTYPE, "");
if (dashsee[0] != NULL || dashess) { /* input from -c or -s? */
if (*argv != NULL)