Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2021-12-23 13:33:17 +0300
committerBadlop <badlop@process-one.net>2021-12-23 15:57:12 +0300
commit84d23e60d1268edc155cf9b1f2a4515e8ab47efb (patch)
tree8bc6b5381711f57f587b107242e517e4824adee3 /tools
parentf4e2d278ba2225bbb2db6c3f42fce8369d856f65 (diff)
In POSIX sh, RANDOM is undefined: use always the other method
Diffstat (limited to 'tools')
-rwxr-xr-xtools/captcha.sh19
1 files changed, 6 insertions, 13 deletions
diff --git a/tools/captcha.sh b/tools/captcha.sh
index a619626cf..7885858a2 100755
--- a/tools/captcha.sh
+++ b/tools/captcha.sh
@@ -15,19 +15,12 @@
INPUT=$1
-if test -n ${BASH_VERSION:-''} ; then
- get_random ()
- {
- R=$RANDOM
- }
-else
- for n in $(od -A n -t u2 -N 48 /dev/urandom); do RL="$RL$n "; done
- get_random ()
- {
- R=${RL%% *}
- RL=${RL#* }
- }
-fi
+for n in $(od -A n -t u2 -N 48 /dev/urandom); do RL="$RL$n "; done
+get_random ()
+{
+ R=${RL%% *}
+ RL=${RL#* }
+}
get_random
WAVE1_AMPLITUDE=$((2 + R % 5))