DragonFly On-Line Manual Pages

Search: Section:  


coccigrep(1)           DragonFly General Commands Manual          coccigrep(1)

NAME

coccigrep - semantic grep for the C programming language

SYNOPSIS

coccigrep [OPTIONS] -t TYPE [FILE...]

DESCRIPTION

coccigrep is a semantic grep for the C programming language. It is based on coccinelle and can be used to find where a given structure is used in C source files. coccigrep depends on the spatch program which comes with coccinelle.

OPTIONS

Display options -A NUM, --after-context=NUM Print NUM lines of trailing context after matching line. -B NUM, --before-context=NUM Print NUM lines of leading context before matching line. -c, --color Colorize output (needs pygments). -C NUM, --context=NUM Print NUM lines of output context. -f FORMAT, --output-format=FORMAT Colorize format for output. FORMAT is term or html. Search options -a ATTRIBUTE, --attribut=ATTRIBUTE Match operations that involve the field ATTRIBUTE of the structure given with option -t. --cpp Activate coccinelle C++ support. -o OPERATION, --operation=OPERATION Specify the kind of operation to look for. The available values for OPERATION are: deref Any access to an ATTRIBUTE. func Any function call for which one of the parameters is of type TYPE (as defined with -t). In this operation, the option -a sets the name of the function to match and does not refer to an attribute. set Any operation wich changes the value of an ATTRIBUTE. test Any boolean test where an ATTRIBUTE appears. used Any statement where the type TYPE (as defined with -t) appears. This OPERATION does not need to look for an ATTRIBUTE thus it ignores option -a. The default operation is used if -a is not given, or deref if it is. Depending on your environment, more OPERATIONs may be available. See option -L for information about OPERATION listing. -t TYPE, --type=TYPE C type to look for. Editor options -E, --emacs Emacs output. -V, --vim Vim output. Program information -h, --help Print usage message and exit. -L, --list-operations List available OPERATIONs. Use together with -v to get detailed information about listed OPERATIONs. -v, --verbose Verbose output (including coccinelle errors). --version Print the version number of coccigrep. Other options -p NCPUS, --process=NCPUS Number of cpus to use. -s SP, --sp=SP Semantic patch to use. -l FILE, --file-list=FILE File containing a list of input files.

BUGS

The operation option could lead to some missed match because the semantic patches used internally may need some improvements. Use options -L together with -v to get detailed information about available operations. Please report issues to <https://github.com/regit/coccigrep/issues>. All ideas are welcome.

EXAMPLES

1. Find where in a set of files the structure Packet is used: $ coccigrep -t Packet *c 2. Finds where in a set of files the datalink attribute is used in the structure Packet: $ coccigrep -t Packet -a datalink *c 3. Finds where the datalink attribute of Packet is set: $ coccigrep -t Packet -a datalink -o set source*c

FILES

~/.coccigrep Configuration file for coccigrep.

SEE ALSO

spatch(1) Project homepage: <http://home.regit.org/software/coccigrep/> version 1.3 October 16, 2011 coccigrep(1)

Search: Section: