coccigrep(1)

πŸ“¦ version 1.21, in opensuse-leap 16.0

πŸ’… 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 β€” Print NUM lines of trailing context after the matching line.
  • -B NUM, --before-context=NUM β€” Print NUM lines of leading context before the 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 that 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.
  • -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 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 πŸ’€

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 πŸŽ€

  1. Find where in a set of files the structure Packet is used:
$ coccigrep -t Packet *c
  1. Finds where in a set of files the datalink attribute is used in the structure Packet:
$ coccigrep -t Packet -a datalink *c
  1. 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 🌈


πŸ’– 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