coccigrep(1)
π coccigrep(1) β semantic grep for C, bestie
okay so this is the coccigrep(1) page from the General Commands Manual, and itβs about to make your C codebase make sense. no cap. β¨
πΈ NAME πΈ
coccigrep β semantic grep for the C programming language.
β¨ SYNOPSIS β¨
coccigrep [OPTIONS] -t TYPE [FILE...]
π¦ DESCRIPTION π¦
okay so coccigrep is a semantic grep for the C programming language. itβs 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β PrintNUMlines of trailing context after the matching line.-B NUM,--before-context=NUMβ PrintNUMlines of leading context before the matching line.-c,--colorβ Colorize output (needspygments).-C NUM,--context=NUMβ PrintNUMlines of output context.-f FORMAT,--output-format=FORMATβ Colorize format for output.FORMATistermorhtml.
π Search options
-a ATTRIBUTE,--attribut=ATTRIBUTEβ Match operations that involve the fieldATTRIBUTEof the structure given with option-t.--cppβ ActivatecoccinelleC++ support.-o OPERATION,--operation=OPERATIONβ Specify the kind of operation to look for. The available values forOPERATIONare:derefβ any access to anATTRIBUTE.funcβ any function call for which one of the parameters is of typeTYPE(as defined with-t). In this operation, the option-asets the name of the function to match and does not refer to an attribute.setβ any operation that changes the value of anATTRIBUTE.testβ any boolean test where anATTRIBUTEappears.usedβ any statement where the typeTYPE(as defined with-t) appears. ThisOPERATIONdoes not need to look for anATTRIBUTE, thus it ignores option-a.
-t TYPE,--type=TYPEβ C type to look for.
The default operation is used if -a is not given, or deref if it is. Depending on your environment, more OPERATION values may be available. See option -L for information about OPERATION listing.
β¨οΈ Editor options
-E,--emacsβ Emacs output.-V,--vimβ Vim output.
βΉοΈ Program information
-h,--helpβ Print usage message and exit.-L,--list-operationsβ List availableOPERATIONs. Use together with-vto get detailed information about listedOPERATIONs.-v,--verboseβ Verbose output (includingcoccinelleerrors).--versionβ Print the version number ofcoccigrep.
π§° 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 π
bestie, heads up: 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 π
- Find where in a set of files the structure
Packetis used:
$ coccigrep -t Packet *c
- Finds where in a set of files the
datalinkattribute is used in the structurePacket:
$ coccigrep -t Packet -a datalink *c
- Finds where the
datalinkattribute ofPacketis set:
$ coccigrep -t Packet -a datalink -o set source*c
π FILES π
~/.coccigrepβ Configuration file forcoccigrep.
π SEE ALSO π
spatch(1)- Project homepage:
http://home.regit.org/software/coccigrep/
π thatβs the whole page, bestie! this is coccigrep version 1.3, dated October 16, 2011 β go find those structs, periodt. π¦
π¦ where this page comes from
- opensuse-leap 16.0: coccigrep 1.21-bp160.1.8 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms