On Wed, Feb 26, 2014 at 5:08 AM, Arne Goedeke <[email protected]> wrote:
> I wasnt sure whats a portable fix. Interestingly, any backslash
> in an argument to echo is undefined behavior, according to
> posix, so I suppose echo ought to be avoided in this case.

I'm not 100% sure about the portability of single-quoted heredoc
syntax, so that might need to be checked.

BTW, need to strip off a pile of those backslashes. Alternative patch attached.

ChrisA
From 6b6c7aa886a854a1e73a5c49b9a96c1c9b66d8af Mon Sep 17 00:00:00 2001
From: Chris Angelico <[email protected]>
Date: Wed, 26 Feb 2014 04:02:31 +1100
Subject: [PATCH] Rework bin/getwhitespace.sh to use a heredoc for dash/bash
 compatibility

---
 bin/getwhitespace.sh |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bin/getwhitespace.sh b/bin/getwhitespace.sh
index 213b16f..a210eb9 100755
--- a/bin/getwhitespace.sh
+++ b/bin/getwhitespace.sh
@@ -1,12 +1,13 @@
 #!/bin/sh
 
-echo "/* File generated on `date`
+echo "/* File generated on `date`"
+cat <<'EOM'
 by getwhitespace <UnicodeData.txt */
 
-#define SPACECASE8							\\
-       case ' ':case '\\\\t':case '\\\\r':case '\\\\n':case '\\\\v':case '\\\\f':	\\
+#define SPACECASE8							\
+       case ' ':case '\t':case '\r':case '\n':case '\v':case '\f':	\
        case 0x85:case 0xa0:
-"
+EOM
 
 echo '#define SPACECASE16	SPACECASE8 \'
 sed -n -e '
-- 
1.7.10.4

  • bash/dash Arne Goedeke
    • Re: bash/dash Chris Angelico
      • Re: bash/... Arne Goedeke
        • Re: b... Chris Angelico
          • R... Arne Goedeke
            • ... Chris Angelico
              • ... Per Hedbor () @ Pike (-) developers forum
                • ... Henrik Grubbstr�m (Lysator) @ Pike (-) developers forum
          • R... Stephen R. van den Berg
            • ... Chris Angelico
              • ... Stephen R. van den Berg

Reply via email to