From e8ce775db824de329b81293b4e5d8fbd65624528 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Mon, 22 Sep 1997 20:22:27 +0000 Subject: Imported from ../bash-2.01.1.tar.gz. --- variables.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'variables.c') 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; -- cgit v1.2.3