From 462460bf597689a138ba023ad715d092f89734f8 Mon Sep 17 00:00:00 2001
From: nehalmistry <>
Date: Sat, 1 Jun 2002 23:18:33 +0000
Subject: [PATCH] fix for bash 2.03 (and possible older versions)

---
 setup | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/setup b/setup
index 01905b07e..870adcd16 100755
--- a/setup
+++ b/setup
@@ -88,6 +88,10 @@ else
   CROSS=" win32"
 fi
 
+if [ "`read -n 1 -t 0 2>&1 | grep e`x" = "x" ]; then
+    N="-n1"
+fi
+
 cat << .. > $RULESFILE
 ##   ___________		     _________		      _____  __
 ##   \_	  _____/______   ____   ____ \_   ___ \____________ _/ ____\/  |_
@@ -441,7 +445,7 @@ if test "$WIN32" = 0 ; then
   fi
   echo
   echo -n "Please enter selection: "
-  read -n 1 VIDSEL
+  read $N VIDSEL
   echo
 fi
 
@@ -549,7 +553,7 @@ fi
 
 echo
 echo -n "Do you want to compile with sound? (y) "
-read -n 1 ANSWER
+read $N ANSWER
 echo
 case $ANSWER in
   [nN])
@@ -570,7 +574,7 @@ case $ANSWER in
 	    echo
 	    echo "Assuming you have a thread-safe X11 (libc6 or glibc),"
 	    echo -n "do you want to compile with threaded sound? (n) "
-	    read -n 1 ANSWER2
+	    read $N ANSWER2
 	    echo
 	    case $ANSWER2 in [yY])
 	      echo "THREAD		= -D_REENTRANT -DUSE_THREAD" >> $RULESFILE
@@ -587,7 +591,7 @@ case $ANSWER in
 	LIBCHECK="-lFLAC -lm"; check_for_libs
 	if test "$?" = 0 ; then 
 	echo -n "Would you like FLAC support? (n) "
-	read -n 1 ANSWER
+	read $N ANSWER
 	echo
 	case $ANSWER in 
 	    [yY])
@@ -605,7 +609,7 @@ case $ANSWER in
 	LIBCHECK="-lvorbisfile -lvorbis -logg"; check_for_libs
 	if test "$?" = 0 ; then 
 	echo -n "Would you like OGG support? (n) "
-	read -n 1 ANSWER
+	read $N ANSWER
 	echo
 	case $ANSWER in 
 	    [yY])
@@ -635,7 +639,7 @@ case $ANSWER in
 	LIBCHECK="-lmad"; check_for_libs
 	if test "$?" = 0 ; then 
 	echo -n "Would you like MAD MP3 support? (n) "
-	read -n 1 ANSWER
+	read $N ANSWER
 	echo
 	case $ANSWER in 
 	    [yY])
@@ -655,7 +659,7 @@ case $ANSWER in
 	echo -n "or [S]DL "
 	fi
 	echo -n "CD Audio support? (n) "
-	read -n 1 CDMode
+	read $N CDMode
 	echo
 	case $CDMode in
 	    [sS])
@@ -739,7 +743,7 @@ if (test "$HAVE_LIBZ" = 1 -o "$HAVE_LIBZ" = 2 && test "$HAVE_LIBBZ2" = 1 && test
 fi
 echo
 echo -n "Please enter selection ($COMPDEF): "
-read -n 1 COMPOPT
+read $N COMPOPT
 echo
 
 if test "$COMPOPT x" = " x" ; then COMPOPT=$COMPDEF; fi
@@ -897,7 +901,7 @@ echo -n "	\$(FLAC) \$(OGG) \$(MAD) " >> $RULESFILE
 
 echo
 echo -n "Are you using the WarCraft 2 Expansion CD? (n): "
-read -n 1 YESORNO
+read $N YESORNO
 echo
 if [ "$YESORNO" = "Y" -o "$YESORNO" = "y" ] ; then
 echo -n " -DHAVE_EXPANSION" >> $RULESFILE
@@ -965,7 +969,7 @@ echo
 echo "Done generating $RULESFILE."
 echo
 echo -n "Would you like to compile it now? (y) "
-read -n 1 ANSWER
+read $N ANSWER
 echo
 
 case $ANSWER in