I run diff
with the -p
option so the output will include the name of the function where each change occurred. Is there an analogous option for
Unfortunately, no. This feature does not exist in grep
nor does it exist in ack
(which is ab improved grep
replacement).
I really do wish this existed, though. It would come in handy. Someone did take a shot at implementing it a while back, but it doesn't look like their patch ever got accepted (or was ever even posted online, strangely). You can try emailing him and see if he still has the code and still wants to get an option to show C functions into grep
.
You could write a regular expression to match a C function, but I bet that'd be one monster of a regexp.