[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SP2NL cleanup
From: |
Ralf Wildenhues |
Subject: |
Re: SP2NL cleanup |
Date: |
Tue, 16 Aug 2005 16:32:50 +0200 |
User-agent: |
Mutt/1.4.1i |
Hi Stepan,
* Stepan Kasal wrote on Tue, Aug 16, 2005 at 03:36:21PM CEST:
> Hello,
> attached please find a patch, which changes the check for EBCDIC.
>
> 1) I added a comment which explains why \n isn't portable enough.
> 2) space is space, no need to use \040
Not true. :)
> 3) Change the logic, so that it potentially works even for other
> charsets.
Good idea.
Comments below.
Cheers,
Ralf
> 2005-08-16 Stepan Kasal <address@hidden>
>
> * config/general.m4sh (SP2NL, NL2SP): Simplify.
>
> Index: config/general.m4sh
> ===================================================================
> RCS file: /cvsroot/libtool/libtool/config/general.m4sh,v
> retrieving revision 1.18
> diff -u -r1.18 general.m4sh
> --- config/general.m4sh 5 Jun 2005 17:34:17 -0000 1.18
> +++ config/general.m4sh 16 Aug 2005 13:26:48 -0000
> @@ -106,14 +106,15 @@
> s/\([[^\\]]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'
>
> # test EBCDIC or ASCII
> -case `$ECHO A|tr A '\301'` in
> - A) # EBCDIC based system
> - SP2NL="tr '\100' '\n'"
> - NL2SP="tr '\r\n' '\100\100'"
> +case `$ECHO X|tr X '\101'` in
Please replace $ECHO with echo. Yes, this was broken before.
Whereever safe, echo is to be preferred, see HACKING.
This is because $ECHO might be "$LIBTOOL --fallback-echo", and on the
system where it is, it will take *forever*.
> + A) # ASCII based system
> + # '\n' is not interpreted correctly by Solaris 8 /usr/ucb/tr
> + SP2NL="tr ' ' '\012'"
This is broken. It was broken before, but your change exposes it:
We do not use $SP2NL within an eval'ed string, we just use it like this:
echo "foo bar" | $SP2NL
Your version reports an error then:
tr: too many arguments
> + NL2SP="tr '\015\012' ' '"
> ;;
> - *) # Assume ASCII based system
> - SP2NL="tr '\040' '\012'"
> - NL2SP="tr '\015\012' '\040\040'"
> + *) # EBCDIC based system
> + SP2NL="tr ' ' '\n'"
> + NL2SP="tr '\r\n' ' '"
> ;;
> esac
>
- SP2NL cleanup, Stepan Kasal, 2005/08/16
- Re: SP2NL cleanup,
Ralf Wildenhues <=