4 if [ $# -eq 3 -a "$2" = '-d' ]; then
7 elif [ $# -ne 1 ]; then
8 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
13 patch $pdir -f --no-backup-if-mismatch -p1 < $0
14 echo '2.05' > $dir/_distribution
15 echo '0' > $dir/_patchlevel
17 rm -f $dir/_distribution $dir/_patchlevel
20 patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
21 rm -f $dir/configure $dir/_distribution $dir/_patchlevel
24 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
29 # DP: use the system random functions
31 diff -urb bash.orig/config.h.in bash/config.h.in
32 --- bash.orig/config.h.in 2003-09-22 14:42:35.000000000 +0200
33 +++ bash/config.h.in 2003-09-28 00:27:15.000000000 +0200
35 /* Define if you have the putenv function. */
38 +/* Define if you have the random function. */
41 /* Define if you have the readlink function. */
45 /* Define if you have the strsignal function or macro. */
48 +/* Define if you have the srandom function. */
51 /* Define if you have the sysconf function. */
54 diff -urb bash.orig/variables.c bash/variables.c
55 --- bash.orig/variables.c 2003-07-31 16:28:57.000000000 +0200
56 +++ bash/variables.c 2003-09-28 00:27:15.000000000 +0200
57 @@ -1098,16 +1098,22 @@
58 static unsigned long rseed = 1;
59 static int last_random_value;
61 -/* A linear congruential random number generator based on the example
62 - one in the ANSI C standard. This one isn't very good, but a more
63 - complicated one is overkill. */
64 +/* Use the random number genrator provided by the standard C library,
65 + else use a linear congruential random number generator based on the
66 + ANSI C standard. This one isn't very good (the values are alternately
67 + odd and even, for example), but a more complicated one is overkill. */
69 /* Returns a pseudo-random number between 0 and 32767. */
73 +#if defined(HAVE_RANDOM)
74 + rseed = (unsigned int) (labs(random()) & 32767);
77 rseed = rseed * 1103515245 + 12345;
78 return ((unsigned int)((rseed >> 16) & 32767)); /* was % 32768 */
82 /* Set the random number generator seed to SEED. */
83 @@ -1115,8 +1121,12 @@
87 +#if defined(HAVE_SRANDOM)
91 last_random_value = 0;
96 --- bash/configure.in~ 2004-03-02 00:04:29.000000000 +0100
97 +++ bash/configure.in 2004-03-02 00:05:48.000000000 +0100
102 +dnl checks for random functions
103 +AC_CHECK_FUNCS(random srandom)
106 dnl Checks for lib/intl and related code (uses some of the output from