Forwarding to list
Tony.

-------- Original Message --------
Subject: Re: Search and replace as per format
Date: Wed, 06 Sep 2006 16:13:26 +0530
From: Srinivas Rao. M <[EMAIL PROTECTED]>
To: A.J.Mechelynck <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

Thanks for the reply, In the simplest terms i want to add an extra
argument to a function call(and floow the printf's formatting syntax)
also.

i.e

        func(arg1, arg2, arg3)

to      
        func(arg1, arg2, arg3, arg4)

        and  edit arg2(which is a formatting string) to suite arg4 in all the
c files. Formatting string is similar to what supplied for printf()


regards,
Srini...
        
        
        


On Wed, 2006-09-06 at 10:03 +0200, A.J.Mechelynck wrote:
Srinivas Rao. M wrote:
> Hi Tim, Charles,
> > I am rather looking at a generic substitution where the number of open
> quotes are matched, and then add an argument to log(). IN a generic
> aproach we may have a variable number of arguments, just like thwe way
> printf() supports. > The strings like "module name", LOG_LEVEL_DEBUG, and "The Value of
> status=" can be anything.
> > All these needs to be substituted in the .c files. > > regards,
> Srini...
> > > > > > On Tue, 2006-09-05 at 12:54 -0400, Charles E Campbell Jr wrote:
>> Srinivas Rao. M wrote:
>>
>>> Hi Vimmers,
>>>
>>> I am tasked to replace the pattern
>>>
>>> log("module_name", LOG_LEVEL_DEBUG, "The Value of status=%d message",
>>> status);
>>>
>>> to
>>>
>>> log("module_name", LOG_LEVEL_DEBUG, "%s:The Value of status=%d
>>> message",__FUNCTION__, status);
[...]

Well, please describe exactly what you want to do, and in particular, how to determine which string(s) to modify (like "The Value of..." and which not to (like "module name").

I suspect the problem can be solved with an ":args" command (such as ":args **/*.[ch]") followed by ":argdo g/\<log(/s/something/something/g". Possibly wrapping it in a function if things like __FUNCTION__ must be specified on each invocation.



Best regards,
Tony.




Reply via email to