[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sr #103417] Cannot insert sharps

From: Eric Blake
Subject: [sr #103417] Cannot insert sharps
Date: Sun, 28 May 2006 14:30:42 -0600
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.5) Gecko/20060111 Netscape/8.1

Update of sr #103417 (project m4):

                Severity:            6 - Security => 3 - Normal             
                  Status:                    None => Invalid                
             Assigned to:                    None => ericb                  
             Open/Closed:                    Open => Closed                 


Follow-up Comment #1:

Sorry for the long delay; the web forum is not tracked as actively as the
address@hidden mailing list (Gary, could we get savannah set up to carbon the
list when someone posts here?)

Anyway, your problem is that by default, # starts a comment, so as m4 expands
the macro, it is coming across a comment and getting lost.  Furthermore, you
are not using enough quoting - a good rule of thumb is to use one level of
quotes inside every () unless you WANT macro expansion.

Look at what happens when you run with 'm4 -dteaq':

define(`QuoteVariable', `ifelse(substr($1,0,1), i, #$1,
ifelse(substr($1,0,1), o, #$1, "$1" ) ) ')
m4trace: -1- define(`QuoteVariable', `ifelse(substr($1,0,1), i, #$1,
ifelse(substr($1,0,1), o, #$1, "$1" ) ) ')

m4trace: -1- QuoteVariable(`iTestI') -> `ifelse(substr(iTestI,0,1), i,
#iTestI, ifelse(substr(iTestI,0,1), o, #iTestI, "iTestI" ) ) '
m4trace: -2- substr(`iTestI', `0', `1') -> `i'

The first expansion has an unquoted comment in the place where the third
argument to ifelse starts, and that comment consumes everything to the end of
the line, meaning that the ifelse is unterminated until the ) on the next

Try instead using this approach, which uses enough quoting, and simplifies
the ifelse (there is no need to nest):

define(`QuoteVariable', `ifelse(substr(`$1',`0',`1'), `i', ``#'$1',
substr(`$1', `0', `1'), `o', ``#'$1', `"$1"')')

Also take a look at changecom.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]