On Tue, 13 Mar 2001, Richard Levitte wrote:
> The release of the second beta of OpenSSL 0.9.6a is scheduled for
> Monday 2001-03-19. To make sure that it will work correctly, please
> test this version (especially on less common platforms), and report
> any problems to <[EMAIL PROTECTED]>.
>
Here is an enhanced version of bctest.
It will do a search of $PATH for all instances of bc and
use the first one that works.
This helps out those on Solaris and SCO that have installed
GNU bc in /usr/local/bin but have not removed the system bc.
--
Tim Rice Multitalents (707) 887-1469
[EMAIL PROTECTED]
--- openssl-0.9.6a-beta1/test/bctest.old Wed Jan 17 02:26:25 2001
+++ openssl-0.9.6a-beta1/test/bctest Wed Mar 14 19:45:21 2001
@@ -12,7 +12,8 @@
# Test for SunOS 5.[78] bc bug (or missing bc)
-if [ 0 != "`bc <<\EOF
+SunOStest() {
+if [ 0 != "`${1} <<\EOF
obase=16
ibase=16
a=AD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C66C6A\
@@ -28,15 +29,16 @@
(a/b)*b + (a%b) - a
EOF`" ]
then
- echo "bc does not work. Consider installing GNU bc." >&2
- echo "cat >/dev/null"
- exit 1
+# echo "bc does not work. Consider installing GNU bc." >&2
+# echo "cat >/dev/null"
+ return 1
fi
-
+}
# Test for SCO bc bug.
+SCOtest() {
if [ "0
-0" != "`bc <<\EOF
+0" != "`${1} <<\EOF
obase=16
ibase=16
-FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4AEC6F15AC177F176F2274D2\
@@ -64,21 +66,46 @@
5296964
EOF`" ]
then
- echo "bc does not work. Consider installing GNU bc." >&2
- echo "cat >/dev/null"
- exit 1
+# echo "bc does not work. Consider installing GNU bc." >&2
+# echo "cat >/dev/null"
+ return 1
fi
+}
+#
+# Find the full pathname(s) of bc
+#
+findBc()
+{
+ IFS=:
+ for i in $PATH; do
+ eval test -x $i/bc -a ! -d $i/bc && { echo $i/bc ; }
+ done
+}
+Printtest() {
# bc works, good.
# Now check if it knows the 'print' command.
-if [ "OK" = "`bc 2>/dev/null <<\EOF
+if [ "OK" = "`${1} 2>/dev/null <<\EOF
print \"OK\"
EOF`" ]
then
- echo "bc"
+ echo "${1}"
else
- echo "sed 's/print.*//' | bc"
+ echo "sed 's/print.*//' | ${1}"
fi
exit 0
+}
+
+for BC in `findBc`
+do
+ if SunOStest ${BC} && SCOtest ${BC}
+ then
+ Printtest ${BC}
+ fi
+done
+
+echo "bc does not work. Consider installing GNU bc." >&2
+echo "cat >/dev/null"
+exit 1