]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
man/man1/grepc{,_c}.1: Split documentation into a manual page for the driver
authorAlejandro Colomar <alx@kernel.org>
Sun, 2 Nov 2025 20:04:24 +0000 (21:04 +0100)
committerAlejandro Colomar <alx@kernel.org>
Mon, 3 Nov 2025 10:42:40 +0000 (11:42 +0100)
I've left grepc_mk undocumented for the moment, as it's still not
as stable as the C driver.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man1/grepc.1
man/man1/grepc_c.1 [new file with mode: 0644]

index c27fad90008daa71b7e42b840bbdd5405526dac9..6386de3e55476d549e09c65f15e3f79d66e3d205 100644 (file)
@@ -4,7 +4,7 @@
 .\"
 .TH grepc 1 (date) "Linux man-pages (unreleased)"
 .SH NAME
-grepc \- find declarations, definitions, and uses in source code
+grepc \- find declarations, definitions, and uses in source code
 .SH SYNOPSIS
 .B grepc
 .RI [ option\~ .\|.\|.\&]
@@ -12,14 +12,14 @@ grepc \- find C declarations, definitions, and uses in source code
 .RI [ file\~ .\|.\|.\&]
 .SH DESCRIPTION
 .BR grepc (1)
-searches for 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
@@ -30,100 +30,6 @@ Otherwise,
 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
@@ -175,11 +81,13 @@ with escape sequences to display them in color on the terminal.
 .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,
@@ -187,7 +95,9 @@ internal calls to
 .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.
@@ -199,6 +109,7 @@ redirect it to the standard input.
 \&./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)
diff --git a/man/man1/grepc_c.1 b/man/man1/grepc_c.1
new file mode 100644 (file)
index 0000000..f743014
--- /dev/null
@@ -0,0 +1,144 @@
+.\" 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)