Detect DOS line endings
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 15 May 2010 05:37:37 +0000 (05:37 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 15 May 2010 05:37:37 +0000 (05:37 +0000)
cp-po

diff --git a/cp-po b/cp-po
index 504b7f2ffe13ce274f6013aa1989ee4d06fafac3..0661d09c7aef5fbd0b7d909aa27a394e7c98d9a8 100755 (executable)
--- a/cp-po
+++ b/cp-po
@@ -74,6 +74,17 @@ for srcfile in $(find "$srcdir" -name '*.po'); do
                fi
        fi
 
+       if grep -q -IU '\r' $srcfile; then
+               # DOS line endings break Solaris msgfmt
+               echo "$me: $srcfile contains DOS line endings" 1>&2
+               grep -n -m5 -IU '\r' $srcfile 1>&2 || :
+               if $force; then
+                       echo "$me: copying anyway, as requested" 1>&2
+               else
+                       continue
+               fi
+       fi
+
        for y in $nls_mks; do
                destcat=$(cat $y | sed -n 's/CATALOG_NAME.*:*= *\([^ ]*\)$/\1/p')
                if [ -z "$destcat" ]; then