GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
coccigrep(1) FreeBSD General Commands Manual coccigrep(1)

coccigrep - semantic grep for the C programming language

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

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.

-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.

-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.

-E, --emacs
Emacs output.
-V, --vim
Vim output.

-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.

-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.

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.

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

~/.coccigrep Configuration file for coccigrep.

spatch(1)

Project homepage: <http://home.regit.org/software/coccigrep/>

October 16, 2011 version 1.3

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.