grepc_c(1)

๐Ÿ“ฆ
version 6.20 ยท 4 versions
, in arch rolling, nixpkgs unstable

๐Ÿ’– NAME ๐Ÿ’–

okay so we're reading the grepc_c(1) page from the General Commands Manual, and the whole point of grepc_c is printing PCRE patterns for searching C code. that's it. that's the gig. โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

grepc_c [option ...] pattern

๐ŸŒธ DESCRIPTION ๐ŸŒธ

so bestie, grepc_c(1) is a driver for grepc(1). what it actually does is print out the PCRE patterns that grepc(1) is gonna use to search for declarations, definitions, and/or uses of pattern in C source code. it's giving personal assistant energy, honestly. ๐Ÿ’…

pattern is a PCRE pattern. it normally represents a C identifier, and word boundaries get implicitly added to it in most cases. sneaky little boundaries. ๐ŸŽ€

๐Ÿซถ Types of code ๐Ÿซถ

this program can produce PCRE patterns for several types of code. you pass the following arguments to the -t option to select which types of code will get searched:

  • e โ€” enum constant definitions. ๐Ÿ’œ
  • f โ€” function prototypes and definitions. and this one? it subdivides, bestie:
    • fp โ€” function prototypes.
    • fd โ€” function definitions.
    • fl โ€” Linux kernel system calls. and that can be further subdivided into:
      • flp โ€” Linux kernel system call prototypes.
      • fld โ€” Linux kernel system call definitions.
    • fg โ€” glibc internal names of libc functions. which also subdivides into:
      • fgp โ€” glibc prototypes.
      • fgd โ€” glibc definitions.
  • m โ€” macro definitions.
    • mf โ€” function-like macro definitions.
    • mo โ€” other macro definitions.
  • t โ€” type definitions.
  • u โ€” uses. it searches for occurrences of pattern within enums, function bodies, macro replacements, and type definitions, and prints the whole enum, function, macro, and/or type definition. and lowkey important: in this case there are no word boundaries set by default, so if pattern is open, then fopen will also get found. that's intentional, it's so you can search for patterns containing any sequence of characters. iconic behaviour tbh. ๐Ÿ˜Œ
    • ue โ€” uses within enum definitions (except as an enum constant).
    • uf โ€” uses within function definition bodies.
    • um โ€” uses within macro replacements.
    • ut โ€” uses within type definitions (except enum; that is: typedef, struct, or union).

โœจ OPTIONS โœจ

  • -t type โ€” restrict the search to a specific type of code (see Types of code under DESCRIPTION, bestie, it's right up there ๐Ÿซถ). this option can be passed multiple times to search for various types of code. Default: e f m t.

๐Ÿ‘‘ EXAMPLES ๐Ÿ‘‘

alx@devuan:~$ grepc_c -tm alignof;
(?s)^[ \t]*#\s*define\s[\s\\]*alignof\(.*?[^\\]$
(?s)^[ \t]*#\s*define\s[\s\\]*alignof\b(?!\().*?(?<!\\)$
alx@devuan:~$ cd /usr/lib/gcc/;
alx@devuan:/usr/lib/gcc$ pcre2grep -rnMf <(grepc_c -tm alignof) .;
./x86_64-linux-gnu/15/include/stdalign.h:33:#define alignof _Alignof

๐ŸŒˆ SEE ALSO ๐ŸŒˆ


okay that's the whole page, bestie, we ate and left no crumbs ๐Ÿ’…โœจ this little number is from Linux man-pages 6.20, dated 2026-01-06 โ€” go forth and grep your C code, mwah ๐ŸŽ€๐Ÿ’–

๐Ÿ“ฆ where this page comes from