Debian Codegraph @

upstream/debian-unstable/man1/grepc_c.1

raw
1 .\" Copyright, the authors of the Linux man-pages project
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH grepc_c 1 2026-01-06 "Linux man-pages 6.18"
6 .SH NAME
7 grepc_c \- print PCRE patterns for searching C code
8 .SH SYNOPSIS
9 .B grepc_c
10 .RI [ option\~ .\|.\|.\&]
11 .I pattern
12 .SH DESCRIPTION
13 .BR grepc_c (1)
14 is a driver for
15 .BR grepc (1).
16 It prints PCRE patterns that
17 .BR grepc (1)
18 will use to
19 search for declarations, definitions, and/or uses of
20 .I pattern
21 in C source code.
22 .P
23 .I pattern
24 is a PCRE pattern.
25 It normally represents a C identifier,
26 and word boundaries are implicitly added to it in most cases.
27 .SS Types of code
28 This program can produce PCRE pattern for several types of code.
29 The following arguments can be passed to the
30 .B \-t
31 option
32 to select the types of code that will be searched.
33 .TP
34 .B e
35 enum constant definitions.
36 .TP
37 .B f
38 Function prototypes and definitions.
39 This can be further subdivided into:
40 .RS
41 .TP
42 .B fp
43 Function prototypes.
44 .TP
45 .B fd
46 Function definitions.
47 .TP
48 .B fl
49 Linux kernel system calls.
50 This can be further subdivided into:
51 .RS
52 .TP
53 .B flp
54 Linux kernel system call prototypes.
55 .TP
56 .B fld
57 Linux kernel system call definitions.
58 .RE
59 .TP
60 .B fg
61 glibc internal names of libc functions.
62 This can be further subdivided into:
63 .RS
64 .TP
65 .B fgp
66 glibc prototypes.
67 .TP
68 .B fgd
69 glibc definitions.
70 .RE
71 .RE
72 .TP
73 .B m
74 Macro definitions.
75 .RS
76 .TP
77 .B mf
78 Function-like macro definitions.
79 .TP
80 .B mo
81 Other macro definitions.
82 .RE
83 .TP
84 .B t
85 Type definitions.
86 .TP
87 .B u
88 Uses.
89 Searches occurences of
90 .I pattern
91 within enums,
92 function bodies,
93 macro replacements,
94 and type definitions,
95 and prints the whole enum, function, macro, and/or type definitions.
96 In this case there are no word boundaries set by default,
97 so if
98 .I pattern
99 is
100 .BR open ,
101 .B fopen
102 will also be found;
103 that's to allow searching for patterns containing any sequence of characters.
104 .IP
105 This can be further subdivided into:
106 .RS
107 .TP
108 .B ue
109 Uses within enum definitions (except as an enum constant).
110 .TP
111 .B uf
112 Uses within function definition bodies.
113 .TP
114 .B um
115 Uses within macro replacements.
116 .TP
117 .B ut
118 Uses within type definitions
119 (except enum; that is: typedef, struct, or union).
120 .RE
121 .SH OPTIONS
122 .TP
123 .BI \-t " type"
124 Restrict the search to a specific
125 .I type
126 of code (see Types of code under DESCRIPTION).
127 This option can be passed multiple times
128 to search for various types of code.
129 Default:
130 .BR "e f m t" .
131 .SH EXAMPLES
132 .EX
133 .RB alx@devuan:\[ti]$ " grepc_c \-tm alignof" ;
134 (?s)\[ha][ \[rs]t]*#\[rs]s*define\[rs]s[\[rs]s\[rs]\[rs]]*alignof\[rs](.*?[\[ha]\[rs]\[rs]]$
135 (?s)\[ha][ \[rs]t]*#\[rs]s*define\[rs]s[\[rs]s\[rs]\[rs]]*alignof\[rs]b(?!\[rs]().*?(?<!\[rs]\[rs])$
136 .RB alx@devuan:\[ti]$ " cd /usr/lib/gcc/" ;
137 .RB alx@devuan:/usr/lib/gcc$ " pcre2grep \-rnMf <(grepc_c \-tm alignof) .";
138 \&./x86_64\-linux\-gnu/15/include/stdalign.h:33:#define alignof _Alignof
139 .EE
140 .SH SEE ALSO
141 .BR grepc (1),
142 .BR pcre2grep (1),
143 .BR pcre2syntax (3),
144 .BR pcre2pattern (3)