tags:

views:

69

answers:

1

I have code like this:

define(`DOSPACE',`...................................
.........................
................`'ifelse(eval(len(`Space: $2: $3')>60),1,`...'substr($3,eval((60-len(`Space: $2: $3')-7)*-1),$3)
...................
...................')

That is, if the total string is too long (over 60 chars), I want to strip off enough characters (+3) off the left of $3 to make it fit, and add a "..." to show the missing characters.

I'm at a loss. I'm convinced its either a quoting issue or a "time of execution" issue (whereby $2 and $3 are not what I think they are...)

To complicate matters: this macro is being called in another (I'd forgotten...)

define(`DOGROWTH',dnl
DOSPACE(`$1',`$2',`/path/to/some/$3/where')
DOSPACE(`$1',`$2',`/path/to/some/$3/else')
)
A: 

What about patsubst?

Ross Rogers