[pacman-dev] alpm_option_set_logcb(), an example of usage

Dan McGee dpmcgee at gmail.com
Wed Aug 13 06:51:37 EDT 2008

On Wed, Aug 13, 2008 at 4:32 AM, Xavier <shiningxc at gmail.com> wrote:
> On Wed, Aug 13, 2008 at 11:17 AM, Imanol Celaya <archye at pycut.com.ar> wrote:
>>> Why not just using grep or whatever :
>>> $ grep -r cb_log src/pacman/*.c
>>> src/pacman/callback.c:void cb_log(pmloglevel_t level, char *fmt, va_list args)
>>> src/pacman/pacman.c:    alpm_option_set_logcb(cb_log);
>>> All callbacks (cb) are defined in that callback.c file.
>> thanks, I didn't know about grep -r
> Hmm, in the example above, -r is not needed because I specified a list of files.
> $ grep cb_log src/pacman/*.c
> -r is needed when running on directories (just like rm) :
> $ grep -r cb_log .
> But sometimes you get unwanted spam, so it is better to only search
> the .c files like above.
> Another way :
> $ find . -name "*.c" | xargs grep logcb
> Finally, a more powerful tool is cscope :
> http://cscope.sourceforge.net/
> But I didn't manage to get used to this tool yet, I tried it once or
> twice then I always forget about it :P

ctags is great as well. ctags -R will build the tag database, and then
I could type:
vim -t cb_log
and it would bring me right to the function without even knowing what
file it is in.


More information about the pacman-dev mailing list