.\"
.TH grepc 1 (date) "Linux man-pages (unreleased)"
.SH NAME
-grepc \- find C declarations, definitions, and uses in source code
+grepc \- find declarations, definitions, and uses in source code
.SH SYNOPSIS
.B grepc
.RI [ option\~ .\|.\|.\&]
.RI [ file\~ .\|.\|.\&]
.SH DESCRIPTION
.BR grepc (1)
-searches for C declarations, definitions, and/or uses of
+searches for declarations, definitions, and/or uses of
.I pattern
-in each
+in each source
.IR file .
.P
.I pattern
is a PCRE pattern.
-It normally represents a C identifier,
+It normally represents an identifier,
and word boundaries are implicitly added to it in most cases.
.P
If no
it reads all files specified,
and searches under any specified directories, recursively,
without following symbolic links.
-.SS Types of code
-This program can search for several types of code.
-The following arguments can be passed to the
-.B \-t
-option
-to select the types of code that will be searched.
-.TP
-.B e
-enum constant definitions.
-.TP
-.B f
-Function prototypes and definitions.
-This can be further subdivided into:
-.RS
-.TP
-.B fp
-Function prototypes.
-.TP
-.B fd
-Function definitions.
-.TP
-.B fl
-Linux kernel system calls.
-This can be further subdivided into:
-.RS
-.TP
-.B flp
-Linux kernel system call prototypes.
-.TP
-.B fld
-Linux kernel system call definitions.
-.RE
-.TP
-.B fg
-Glibc internal names of libc functions.
-This can be further subdivided into:
-.RS
-.TP
-.B fgp
-Glibc prototypes.
-.TP
-.B fgd
-Glibc definitions.
-.RE
-.RE
-.TP
-.B m
-Macro definitions.
-.RS
-.TP
-.B mf
-Function-like macro definitions.
-.TP
-.B mo
-Other macro definitions.
-.RE
-.TP
-.B t
-Type definitions.
-.TP
-.B u
-Uses.
-Searches occurences of
-.I 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
-.I pattern
-is
-.BR open ,
-.B fopen
-will also be found;
-that's to allow searching for patterns containing any sequence of characters.
-.IP
-This can be further subdivided into:
-.RS
-.TP
-.B ue
-Uses within enum definitions (except as an enum constant).
-.TP
-.B uf
-Uses within function definition bodies.
-.TP
-.B um
-Uses within macro replacements.
-.TP
-.B ut
-Uses within type definitions
-(except enum; that is: typedef, struct, or union).
-.RE
.SH OPTIONS
.TP
.BI \-A \~n
.BI \-t \~type
Restrict the search to a specific
.I type
-of code (see Types of code under DESCRIPTION).
+of code.
This option can be passed multiple times
to search for various types of code.
-Default:
-.BR "e f m t" .
+The acceptable values depend on the driver used for the language.
+See
+.BR grepc_c (1),
+which is the default driver.
.SH CAVEATS
.SS Crashes
In some cases,
.BR pcre2grep (1)
may fail after consuming too much resources.
To solve that,
-restrict the "types of code" of your search.
+use
+.B \-t
+to restrict the types of code of your search.
.SS Seekable files
Files specified in the command line
must be seekable and able to be opened twice.
\&./x86_64\-linux\-gnu/15/include/stdalign.h:33:#define alignof _Alignof
.EE
.SH SEE ALSO
+.BR grepc_c (1),
.BR pcre2grep (1),
.BR pcre2syntax (3),
.BR pcre2pattern (3)
--- /dev/null
+.\" Copyright, the authors of the Linux man-pages project
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH grepc_c 1 (date) "Linux man-pages (unreleased)"
+.SH NAME
+grepc_c \- print PCRE patterns for searching C code
+.SH SYNOPSIS
+.B grepc_c
+.RI [ option\~ .\|.\|.\&]
+.I pattern
+.SH DESCRIPTION
+.BR grepc_c (1)
+is a driver for
+.BR grepc (1).
+It prints PCRE patterns that
+.BR grepc (1)
+will use to
+search for declarations, definitions, and/or uses of
+.I pattern
+in C source code.
+.P
+.I pattern
+is a PCRE pattern.
+It normally represents a C identifier,
+and word boundaries are implicitly added to it in most cases.
+.SS Types of code
+This program can produce PCRE pattern for several types of code.
+The following arguments can be passed to the
+.B \-t
+option
+to select the types of code that will be searched.
+.TP
+.B e
+enum constant definitions.
+.TP
+.B f
+Function prototypes and definitions.
+This can be further subdivided into:
+.RS
+.TP
+.B fp
+Function prototypes.
+.TP
+.B fd
+Function definitions.
+.TP
+.B fl
+Linux kernel system calls.
+This can be further subdivided into:
+.RS
+.TP
+.B flp
+Linux kernel system call prototypes.
+.TP
+.B fld
+Linux kernel system call definitions.
+.RE
+.TP
+.B fg
+Glibc internal names of libc functions.
+This can be further subdivided into:
+.RS
+.TP
+.B fgp
+Glibc prototypes.
+.TP
+.B fgd
+Glibc definitions.
+.RE
+.RE
+.TP
+.B m
+Macro definitions.
+.RS
+.TP
+.B mf
+Function-like macro definitions.
+.TP
+.B mo
+Other macro definitions.
+.RE
+.TP
+.B t
+Type definitions.
+.TP
+.B u
+Uses.
+Searches occurences of
+.I 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
+.I pattern
+is
+.BR open ,
+.B fopen
+will also be found;
+that's to allow searching for patterns containing any sequence of characters.
+.IP
+This can be further subdivided into:
+.RS
+.TP
+.B ue
+Uses within enum definitions (except as an enum constant).
+.TP
+.B uf
+Uses within function definition bodies.
+.TP
+.B um
+Uses within macro replacements.
+.TP
+.B ut
+Uses within type definitions
+(except enum; that is: typedef, struct, or union).
+.RE
+.SH OPTIONS
+.TP
+.BI \-t " type"
+Restrict the search to a specific
+.I type
+of code (see Types of code under DESCRIPTION).
+This option can be passed multiple times
+to search for various types of code.
+Default:
+.BR "e f m t" .
+.SH EXAMPLES
+.EX
+.RB alx@devuan:\[ti]$ " grepc_c \-tm alignof" ;
+(?s)\[ha][ \[rs]t]*#\[rs]s*define\[rs]s[\[rs]s\[rs]\[rs]]*alignof\[rs](.*?[\[ha]\[rs]\[rs]]$
+(?s)\[ha][ \[rs]t]*#\[rs]s*define\[rs]s[\[rs]s\[rs]\[rs]]*alignof\[rs]b(?!\[rs]().*?(?<!\[rs]\[rs])$
+.RB alx@devuan:\[ti]$ " cd /usr/lib/gcc/" ;
+.RB alx@devuan:/usr/lib/gcc$ " pcre2grep \-rnMf <(grepc_c \-tm alignof) .";
+\&./x86_64\-linux\-gnu/15/include/stdalign.h:33:#define alignof _Alignof
+.EE
+.SH SEE ALSO
+.BR grepc (1),
+.BR pcre2grep (1),
+.BR pcre2syntax (3),
+.BR pcre2pattern (3)