aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-03-23 17:59:27 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-03-23 17:59:27 +0100
commit20704f066250744c0c2b84920c27d0fd0aa9e935 (patch)
tree8a76e56e4be0beb84dbe993922d4be86ab694350 /shell
parent7f4b769c42f3773ff2e2e749547291dcb7e85d01 (diff)
downloadbusybox-w32-20704f066250744c0c2b84920c27d0fd0aa9e935.tar.gz
busybox-w32-20704f066250744c0c2b84920c27d0fd0aa9e935.tar.bz2
busybox-w32-20704f066250744c0c2b84920c27d0fd0aa9e935.zip
ash,hush: recheck LANG before every line input
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c23
-rw-r--r--shell/hush.c25
2 files changed, 31 insertions, 17 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 0baf7c8e5..1520c5ae5 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -36,12 +36,14 @@
36 36
37#define JOBS ENABLE_ASH_JOB_CONTROL 37#define JOBS ENABLE_ASH_JOB_CONTROL
38 38
39#include "busybox.h" /* for applet_names */
40#include <paths.h> 39#include <paths.h>
41#include <setjmp.h> 40#include <setjmp.h>
42#include <fnmatch.h> 41#include <fnmatch.h>
43#include <sys/times.h> 42#include <sys/times.h>
44 43
44#include "busybox.h" /* for applet_names */
45#include "unicode.h"
46
45#include "shell_common.h" 47#include "shell_common.h"
46#if ENABLE_SH_MATH_SUPPORT 48#if ENABLE_SH_MATH_SUPPORT
47# include "math.h" 49# include "math.h"
@@ -72,13 +74,6 @@
72# error "Do not even bother, ash will not run on NOMMU machine" 74# error "Do not even bother, ash will not run on NOMMU machine"
73#endif 75#endif
74 76
75//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
76//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh))
77//applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, bash))
78
79//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
80//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
81
82//config:config ASH 77//config:config ASH
83//config: bool "ash" 78//config: bool "ash"
84//config: default y 79//config: default y
@@ -190,6 +185,13 @@
190//config: variable each time it is displayed. 185//config: variable each time it is displayed.
191//config: 186//config:
192 187
188//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
189//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh))
190//applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, bash))
191
192//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
193//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
194
193 195
194/* ============ Hash table sizes. Configurable. */ 196/* ============ Hash table sizes. Configurable. */
195 197
@@ -9626,6 +9628,11 @@ preadfd(void)
9626# if ENABLE_FEATURE_TAB_COMPLETION 9628# if ENABLE_FEATURE_TAB_COMPLETION
9627 line_input_state->path_lookup = pathval(); 9629 line_input_state->path_lookup = pathval();
9628# endif 9630# endif
9631 /* Unicode support should be activated even if LANG is set
9632 * _during_ shell execution, not only if it was set when
9633 * shell was started. Therefore, re-check LANG every time:
9634 */
9635 reinit_unicode(lookupvar("LANG"));
9629 nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout); 9636 nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout);
9630 if (nr == 0) { 9637 if (nr == 0) {
9631 /* Ctrl+C pressed */ 9638 /* Ctrl+C pressed */
diff --git a/shell/hush.c b/shell/hush.c
index 64d5e8587..339f3349a 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -81,7 +81,6 @@
81 * $ "export" i=`echo 'aaa bbb'`; echo "$i" 81 * $ "export" i=`echo 'aaa bbb'`; echo "$i"
82 * aaa 82 * aaa
83 */ 83 */
84#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */
85#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ 84#if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
86 || defined(__APPLE__) \ 85 || defined(__APPLE__) \
87 ) 86 )
@@ -93,6 +92,8 @@
93# include <fnmatch.h> 92# include <fnmatch.h>
94#endif 93#endif
95 94
95#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */
96#include "unicode.h"
96#include "shell_common.h" 97#include "shell_common.h"
97#include "math.h" 98#include "math.h"
98#include "match.h" 99#include "match.h"
@@ -105,14 +106,6 @@
105# define PIPE_BUF 4096 /* amount of buffering in a pipe */ 106# define PIPE_BUF 4096 /* amount of buffering in a pipe */
106#endif 107#endif
107 108
108//applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP))
109//applet:IF_MSH(APPLET(msh, BB_DIR_BIN, BB_SUID_DROP))
110//applet:IF_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, sh))
111//applet:IF_FEATURE_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, bash))
112
113//kbuild:lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o
114//kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o
115
116//config:config HUSH 109//config:config HUSH
117//config: bool "hush" 110//config: bool "hush"
118//config: default y 111//config: default y
@@ -249,6 +242,14 @@
249//config: msh is deprecated and will be removed, please migrate to hush. 242//config: msh is deprecated and will be removed, please migrate to hush.
250//config: 243//config:
251 244
245//applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP))
246//applet:IF_MSH(APPLET(msh, BB_DIR_BIN, BB_SUID_DROP))
247//applet:IF_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, sh))
248//applet:IF_FEATURE_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, bash))
249
250//kbuild:lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o
251//kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o
252
252/* -i (interactive) and -s (read stdin) are also accepted, 253/* -i (interactive) and -s (read stdin) are also accepted,
253 * but currently do nothing, therefore aren't shown in help. 254 * but currently do nothing, therefore aren't shown in help.
254 * NOMMU-specific options are not meant to be used by users, 255 * NOMMU-specific options are not meant to be used by users,
@@ -1906,6 +1907,12 @@ static void get_user_input(struct in_str *i)
1906 /* Enable command line editing only while a command line 1907 /* Enable command line editing only while a command line
1907 * is actually being read */ 1908 * is actually being read */
1908 do { 1909 do {
1910 /* Unicode support should be activated even if LANG is set
1911 * _during_ shell execution, not only if it was set when
1912 * shell was started. Therefore, re-check LANG every time:
1913 */
1914 reinit_unicode(get_local_var_value("LANG"));
1915
1909 G.flag_SIGINT = 0; 1916 G.flag_SIGINT = 0;
1910 /* buglet: SIGINT will not make new prompt to appear _at once_, 1917 /* buglet: SIGINT will not make new prompt to appear _at once_,
1911 * only after <Enter>. (^C will work) */ 1918 * only after <Enter>. (^C will work) */