Work around limitation of an old 'tr' program on Solaris.
authorBruno Haible <bruno@clisp.org>
Sat, 26 Apr 2008 12:14:12 +0000 (14:14 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 26 Apr 2008 12:14:12 +0000 (14:14 +0200)
ChangeLog
tests/test-xstrtoimax.sh
tests/test-xstrtol.sh
tests/test-xstrtoumax.sh

index 4ac751f4b5250e09ab052dcf6db2ba11cd857d0b..b005118c9d9286c7c63397e3cbaed316e6b14ab6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-04-26  Bruno Haible  <bruno@clisp.org>
+
+       * tests/test-xstrtol.sh: Work around limitation of an old 'tr' program
+       on Solaris.
+       * tests/test-xstrtoimax.sh: Likewise.
+       * tests/test-xstrtoumax.sh: Likewise.
+       Reported by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
+
 2008-04-26  Bruno Haible  <bruno@clisp.org>
 
        * modules/memchr-tests: New file.
index 14cb9e07ed48731b590741c2e390a547aad52644..e6a5e5dd5e8523b092b5793645d3828218164fbc 100755 (executable)
@@ -19,8 +19,16 @@ result=0
 ./test-xstrtoimax${EXEEXT} 010 >> t-xstrtoimax.tmp 2>&1 || result=1
 ./test-xstrtoimax${EXEEXT} MiB >> t-xstrtoimax.tmp 2>&1 || result=1
 
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
 # normalize output
-LC_ALL=C tr -d '\r' < t-xstrtoimax.tmp > t-xstrtoimax.xo
+LC_ALL=C tr -d "$cr" < t-xstrtoimax.tmp > t-xstrtoimax.xo
 mv t-xstrtoimax.xo t-xstrtoimax.tmp
 
 # compare expected output
index 4c65122bca88dc6035d27720e73217798439e688..c56c6750003e4d13461ea13a20ec66743b5a3a82 100755 (executable)
@@ -31,8 +31,16 @@ result=0
 ./test-xstrtoul${EXEEXT} 010 >> t-xstrtol.tmp 2>&1 || result=1
 ./test-xstrtoul${EXEEXT} MiB >> t-xstrtol.tmp 2>&1 || result=1
 
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
 # normalize output
-LC_ALL=C tr -d '\r' < t-xstrtol.tmp > t-xstrtol.xo
+LC_ALL=C tr -d "$cr" < t-xstrtol.tmp > t-xstrtol.xo
 mv t-xstrtol.xo t-xstrtol.tmp
 
 # compare expected output
index c86c9fbfcaf6c6bb3bbf2ba0ab9a62f5d7066b1d..12a7ba9f60b856b0bde1e71ec362f29042cc786f 100755 (executable)
@@ -19,8 +19,16 @@ result=0
 ./test-xstrtoumax${EXEEXT} 010 >> t-xstrtoumax.tmp 2>&1 || result=1
 ./test-xstrtoumax${EXEEXT} MiB >> t-xstrtoumax.tmp 2>&1 || result=1
 
+# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
+# does not understand '\r'.
+if echo solaris | tr -d '\r' | grep solais > /dev/null; then
+  cr='\015'
+else
+  cr='\r'
+fi
+
 # normalize output
-LC_ALL=C tr -d '\r' < t-xstrtoumax.tmp > t-xstrtoumax.xo
+LC_ALL=C tr -d "$cr" < t-xstrtoumax.tmp > t-xstrtoumax.xo
 mv t-xstrtoumax.xo t-xstrtoumax.tmp
 
 # compare expected output