aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-10-20 08:43:10 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-10-20 08:43:10 +0000
commit078323010b5d88485748d05e512d451b876992b5 (patch)
treee7111140dd305eeedee2c4a3cfb0c0f45fc29a34
parentb730474bda4a964930e8013301ace7b49a0c5726 (diff)
downloadbusybox-w32-078323010b5d88485748d05e512d451b876992b5.tar.gz
busybox-w32-078323010b5d88485748d05e512d451b876992b5.tar.bz2
busybox-w32-078323010b5d88485748d05e512d451b876992b5.zip
dc: conditionalize parts which require libm
-rw-r--r--editors/Config.in2
-rw-r--r--miscutils/Config.in8
-rw-r--r--miscutils/dc.c4
-rw-r--r--shell/ash_test/ash-standalone/noexec_gets_no_env.right2
-rwxr-xr-xshell/ash_test/ash-standalone/noexec_gets_no_env.tests2
5 files changed, 17 insertions, 1 deletions
diff --git a/editors/Config.in b/editors/Config.in
index 27426bc2e..0388737c3 100644
--- a/editors/Config.in
+++ b/editors/Config.in
@@ -14,7 +14,7 @@ config AWK
14 14
15config FEATURE_AWK_MATH 15config FEATURE_AWK_MATH
16 bool "Enable math functions (requires libm)" 16 bool "Enable math functions (requires libm)"
17 default y 17 default n
18 depends on AWK 18 depends on AWK
19 help 19 help
20 Enable math functions of the Awk programming language. 20 Enable math functions of the Awk programming language.
diff --git a/miscutils/Config.in b/miscutils/Config.in
index 0c80ae6e9..15f677a73 100644
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
@@ -138,6 +138,14 @@ config DC
138 Dc is a reverse-polish desk calculator which supports unlimited 138 Dc is a reverse-polish desk calculator which supports unlimited
139 precision arithmetic. 139 precision arithmetic.
140 140
141config FEATURE_DC_LIBM
142 bool "Enable power and exp functions (requires libm)"
143 default n
144 depends on DC
145 help
146 Enable power and exp functions.
147 NOTE: This will require libm to be present for linking.
148
141config DEVFSD 149config DEVFSD
142 bool "devfsd (obsolete)" 150 bool "devfsd (obsolete)"
143 default n 151 default n
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 47ec060c8..7d5886eb2 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -53,12 +53,14 @@ static void mul(void)
53 push(pop() * pop()); 53 push(pop() * pop());
54} 54}
55 55
56#if ENABLE_FEATURE_DC_LIBM
56static void power(void) 57static void power(void)
57{ 58{
58 double topower = pop(); 59 double topower = pop();
59 60
60 push(pow(pop(), topower)); 61 push(pow(pop(), topower));
61} 62}
63#endif
62 64
63static void divide(void) 65static void divide(void)
64{ 66{
@@ -137,9 +139,11 @@ static const struct op operators[] = {
137 {"mul", mul}, 139 {"mul", mul},
138 {"/", divide}, 140 {"/", divide},
139 {"div", divide}, 141 {"div", divide},
142#if ENABLE_FEATURE_DC_LIBM
140 {"**", power}, 143 {"**", power},
141 {"exp", power}, 144 {"exp", power},
142 {"pow", power}, 145 {"pow", power},
146#endif
143 {"%", mod}, 147 {"%", mod},
144 {"mod", mod}, 148 {"mod", mod},
145 {"and", and}, 149 {"and", and},
diff --git a/shell/ash_test/ash-standalone/noexec_gets_no_env.right b/shell/ash_test/ash-standalone/noexec_gets_no_env.right
index 3d55d73b8..8522dff31 100644
--- a/shell/ash_test/ash-standalone/noexec_gets_no_env.right
+++ b/shell/ash_test/ash-standalone/noexec_gets_no_env.right
@@ -1,2 +1,4 @@
1VAR7=VAL 1VAR7=VAL
20 20
3VAR8=VAL
40
diff --git a/shell/ash_test/ash-standalone/noexec_gets_no_env.tests b/shell/ash_test/ash-standalone/noexec_gets_no_env.tests
index 5e12e5a25..0d347bdcd 100755
--- a/shell/ash_test/ash-standalone/noexec_gets_no_env.tests
+++ b/shell/ash_test/ash-standalone/noexec_gets_no_env.tests
@@ -1,3 +1,5 @@
1export VAR7=VAL 1export VAR7=VAL
2env | grep ^VAR7= 2env | grep ^VAR7=
3echo $? 3echo $?
4VAR8=VAL env | grep ^VAR8=
5echo $?