aboutsummaryrefslogtreecommitdiffstats
path: root/variables.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1997-09-22 20:22:27 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:51 +0000
commite8ce775db824de329b81293b4e5d8fbd65624528 (patch)
tree4b20c4dc766f5172b65ca1bc16ae1b6d48920fa1 /variables.c
parentd166f048818e10cf3799aa24a174fb22835f1acc (diff)
downloadandroid_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.gz
android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.tar.bz2
android_external_bash-e8ce775db824de329b81293b4e5d8fbd65624528.zip
Imported from ../bash-2.01.1.tar.gz.
Diffstat (limited to 'variables.c')
-rw-r--r--variables.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/variables.c b/variables.c
index fad37af..212724e 100644
--- a/variables.c
+++ b/variables.c
@@ -907,7 +907,11 @@ static int
brand ()
{
rseed = rseed * 1103515245 + 12345;
+#if 0
return ((unsigned int)(rseed / 65536) % 32768);
+#else
+ return ((unsigned int)(rseed % 32768));
+#endif
}
/* Set the random number generator seed to SEED. */
@@ -916,6 +920,7 @@ sbrand (seed)
int seed;
{
rseed = seed;
+ last_random_value = 0;
}
static SHELL_VAR *
@@ -936,7 +941,7 @@ get_random (var)
/* Reset for command and process substitution. */
if (subshell_environment)
- sbrand ((int)(getpid() + NOW));
+ sbrand (rseed + (int)(getpid() + NOW));
do
rv = brand ();
@@ -1462,6 +1467,10 @@ assign_array_from_string (name, value)
}
else if (array_p (var) == 0)
var = convert_var_to_array (var);
+#if 0
+ else
+ empty_array (array_cell (var));
+#endif
return (assign_array_var_from_string (var, value));
}
@@ -1509,6 +1518,13 @@ assign_array_var_from_string (var, value)
else
nlist = expand_string (value, 0);
+#if 1
+ /* Now that we are ready to assign values to the array, kill the existing
+ value. */
+ if (a)
+ empty_array (a);
+#endif
+
for (last_ind = 0, list = nlist; list; list = list->next)
{
w = list->word->word;