reinplace question
Bradley Giesbrecht
brad at pixilla.com
Sat Mar 21 09:08:02 PDT 2009
On Mar 20, 2009, at 6:25 PM, Rainer Müller wrote:
> Bradley Giesbrecht wrote:
>> This is what I ended up with to escape double quotes. I'm sure
>> someone
>> here will show me a better way.
>>
>> set CCARGS [concat ${CCARGS} -DUSE_SASL_AUTH -
>> DDEF_SERVER_SASL_TYPE=\\\\\\"dovecot\\\\\\"]
>
> First, there is usually no need to do:
> set foo [concat $foo bar]
> You can use append for strings and lappend for lists instead:
> lappend foo bar
>
> In this specific case, I don't know why you had to put that many
> backslashes there. How is it used further?
>
> It can also end in funny results if you try to use a list as a string
> without using join. See this short tclsh example for the difference:
>
> $ tclsh
> % set foo "bar"
> bar
> % lappend foo baz="qux"
> bar baz=\"qux\"
> % puts $foo
> bar baz=\"qux\"
Thank you. This is what I needed, a backslash doublequote \". I'm
adding dovecot_sasl variant to my local postfix. The existing Portfile
uses a lot of concat so I just rolled with it.
% set CCARGS "-DSOMETHING"
-DSOMETHING
% append CCARGS \ -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\"dovecot\\"
-DSOMETHING -DUSE_SASL_AUTH-DDEF_SERVER_SASL_TYPE=\"dovecot\"
Portfile:
variant dovecot_sasl description "add Dovecot SASL support " {
append CCARGS \ -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\"dovecot\
\"
}
//Brad
More information about the macports-dev
mailing list