ctagscscope

using ctags or cscope(without interactive mode) from commandline


I am using a custom editor for an embedded systems project. For source code I would like to get ctags working from command line and give me search results on commandline. Other option is to work with cscope in non interactive mode so I can include it in my editor at a later date. I did some initial web search but couldn't find anything relevant to accomplish this.

Does anyone know how to use either of these tools from command line?? Any tutorial?

Thanks. Have a great day.


Solution

  • Using readtags.c shipped as part of ctags implementation, you can search a tag from given tags file.

    Let me show an example:

    $ ctags -R main
    $ readtags -t tags kindDefinition
    kindDefinition  main/types.h    /^typedef struct sKindDefinition kindDefinition;$/
    $ readtags -t tags -e kindDefinition
    kindDefinition  main/types.h    /^typedef struct sKindDefinition kindDefinition;$/;"    kind:t  typeref:struct:sKindDefinition