[Patch,AVR]: Use tr instead of set to canonicalize line endings for cmp
Richard Henderson
rth@redhat.com
Wed May 30 16:29:00 GMT 2012
On 05/30/2012 05:17 AM, Georg-Johann Lay wrote:
> +# The avr-mmcu.texi we want to compare against / check into svn should
> +# have unix-style line endings. To make this work on MinGW, remove \r.
> +# \r is not portable to Solaris tr, therefore we have a special case
> +# for ASCII. We use \r for other encodings like EBCDIC.
> s-avr-mmcu-texi: gen-avr-mmcu-texi$(build_exeext)
> - $(RUN_GEN) ./$< | sed -e 's:\r::g'> avr-mmcu.texi
> + $(RUN_GEN) ./$< > tmp-avr-mmcu.texi
> + case `echo X|tr X '\101'` in \
> + A) tr -d '\015'< tmp-avr-mmcu.texi> tmp2-avr-mmcu.texi ;; \
> + *) tr -d '\r'< tmp-avr-mmcu.texi> tmp2-avr-mmcu.texi ;; \
> + esac
Why not do this inside gen-avr-mmcu-texi.c instead?
Instead of writing to stdout, open the file to write, and open
it in binary mode. Seems much easier than fighting with conversion
after the fact.
r~
More information about the Gcc-patches
mailing list