---
name: "grepc_c"
section: "1"
platform: "linux"
package: "man-pages-utils"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/grepc_c"
---

# grepc\_c(1)

print PCRE patterns for searching C code

## NAME

grepc\_c - print PCRE patterns for searching C code

## SYNOPSIS

**grepc\_c** \[*option* ...\] *pattern*

## DESCRIPTION

[**grepc\_c**(1)](/grepc_c/1.md) is a driver for [**grepc**(1)](/grepc/1.md). It prints PCRE patterns that [**grepc**(1)](/grepc/1.md) will use to search for declarations, definitions, and/or uses of *pattern* in C source code.

*pattern* is a PCRE pattern. It normally represents a C identifier, and word boundaries are implicitly added to it in most cases.

### Types of code

This program can produce PCRE pattern for several types of code. The following arguments can be passed to the **-t** option to select the types of code that will be searched.

- **e**

  enum constant definitions.

- **f**

  Function prototypes and definitions. This can be further subdivided into:

  - **fp**

    Function prototypes.

  - **fd**

    Function definitions.

  - **fl**

    Linux kernel system calls. This can be further subdivided into:

    - **flp**

      Linux kernel system call prototypes.

    - **fld**

      Linux kernel system call definitions.

  - **fg**

    glibc internal names of libc functions. This can be further subdivided into:

    - **fgp**

      glibc prototypes.

    - **fgd**

      glibc definitions.

- **m**

  Macro definitions.

  - **mf**

    Function-like macro definitions.

  - **mo**

    Other macro definitions.

- **t**

  Type definitions.

- **u**

  Uses. Searches occurences of *pattern* within enums, function bodies, macro replacements, and type definitions, and prints the whole enum, function, macro, and/or type definitions. In this case there are no word boundaries set by default, so if *pattern* is **open**, **fopen** will also be found; that's to allow searching for patterns containing any sequence of characters.

-

  This can be further subdivided into:

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

[**grepc**(1)](/grepc/1.md), [**pcre2grep**(1)](/pcre2grep/1.md), [**pcre2syntax**(3)](/pcre2syntax/3.md), [**pcre2pattern**(3)](/pcre2pattern/3.md)
