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 4ac751f..b005118 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 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.
        * tests/test-memchr.c; New file, based on tests/test-memchr2.c.
 
index 14cb9e0..e6a5e5d 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 4c65122..c56c675 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 c86c9fb..12a7ba9 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