| Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This policy is based on the Gentoo policy (see link below).
However, I've modified our text to be more restrictive.
Link: <https://wiki.gentoo.org/wiki/Project:Council/AI_policy>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: Sam James <sam@gentoo.org>
Cc: "G. Branden Robinson" <branden@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Ideally one should be able to use flock to synchronize with another
process (or thread) closing that file, for instance before attempting
to execve it (as execve of a file open for writing fails with ETXTBSY).
Unfortunately, on Linux it is not reliable, because in the process of
closing a file its locks are dropped before the refcounts of the file
(as well as its underlying filesystem) are decremented, creating a race
window where execve of the just-unlocked file sees it as if still open.
Linux developers have indicated that it is not easy to fix, and the
appropriate course of action for now is to document this limitation.
Link: <https://lore.kernel.org/linux-fsdevel/68c99812-e933-ce93-17c0-3fe3ab01afb8@ispras.ru/>
Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Message-ID: <181d561860e52955b29fe388ad089bde4f67241a.1760627023.git.amonakov@ispras.ru>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Closes: <https://bugzilla.kernel.org/show_bug.cgi?id=220489>
Signed-off-by: Wes Gibbs <wg21908@gmail.com>
Message-ID: <20251102000330.155591-1-wg21908@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
.d_ino and .st_ino
Suggested-by: Pali Rohár <pali@kernel.org>
Co-authored-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Pali Rohár <pali@kernel.org>
Co-authored-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: "G. Branden Robinson" <branden@debian.org>
Cc: <linux-fsdevel@vger.kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
addition of PR_THP_DISABLE_EXCEPT_ADVISED
PR_THP_DISABLE_EXCEPT_ADVISED extended PR_SET_THP_DISABLE to only provide
THPs when advised. IOW, it allows individual processes to opt-out of
THP = "always" into THP = "madvise", without affecting other workloads
on the system. The series has been merged in [1]. Before [1], the
following 2 calls were allowed with PR_SET_THP_DISABLE:
prctl(PR_SET_THP_DISABLE, 0, 0, 0, 0); // reset THP setting.
prctl(PR_SET_THP_DISABLE, 1, 0, 0, 0); // disable THPs completely.
Now in addition to the 2 calls above, you can do:
// disable THPs except madvise.
prctl(PR_SET_THP_DISABLE, 1, PR_THP_DISABLE_EXCEPT_ADVISED, 0, 0);
This patch documents the changes introduced due to the addition of
PR_THP_DISABLE_EXCEPT_ADVISED flag:
- PR_GET_THP_DISABLE returns a value whose bits indicate how
THP-disable is configured for the calling thread (with or without
PR_THP_DISABLE_EXCEPT_ADVISED).
- PR_SET_THP_DISABLE now uses arg3 to specify whether to disable THP
completely for the process, or disable except madvise
(PR_THP_DISABLE_EXCEPT_ADVISED).
Link: [1] <https://github.com/torvalds/linux/commit/9dc21bbd62edeae6f63e6f25e1edb7167452457b>
Signed-off-by: Usama Arif <usamaarif642@gmail.com>
Message-ID: <20251105134811.3170745-1-usamaarif642@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This was necessary when we used one pcre2grep(1) call per regex.
but long ago we switched to a single pcre2grep(1) call for all regexes,
which only prints each file once, and thus we don't need uniq(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Colorizing is imperfect, so don't do it.
Let the user colorize it by piping to grep(1), if needed.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
We already run iwyu(1) on a separate target (lint-c-iwyu).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
grepc(1)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
It was useful when we had separate calls to pcre2grep(1) for each
pattern, but now that we call it once, it's fine to have overlapping
regexes.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
grepc_c_u_body_() consumes a lot of resources unnecessarily.
This is especially true within grepc_c_t_td_braced(), which was crashing
with relatively small code. The reason is that grepc_c_t_td_braced()
searches for code where the identifier is last, so it needs to store
a lot of code just in case. For that, an optimized grepc_c_body_() is
more appropriate.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
In the last case, it removes part of the regex, but I believe that
wasn't necessary.
Also, while at this, make the trailing of the regexes to be consistently
'[^;];', which is simpler, and seems to work just fine. If we ever see
some false positives or negatives with this regex, we should fix them
all at once, and maybe put them in a helper function.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This adds support for:
enum : int {
X
};
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
A function body and an enum body are quite similar.
The same regex works for both.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
and other macros
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
While splitting, improve the regex part in two ways:
- Use a non-capturing group. This improves performance.
- Use negative lookahead instead of '[^\\]$'. This allows matching
a macro where the searched identifier is the last thing in the
replacement list.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Fixes: 91c6563acf5e (2025-10-29; "grepc, grepc.1: Add -tu to search for uses")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This will be reused for -tuf.
I copied '[\w\s,;[\]*\?:+-]*\)' from grepc_c_f_params_().
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This regex part will be reused by other regexes.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This reuses the regex used by -tfp.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This adds support for function declarators such as:
int
main(int argc, char *argv[argc + 1]);
char *
seprintf(char dst[], const char end[];
char dst[dst ? end - dst : 0], const char end[0],
const char *restrict fmt, ...);
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This allows $identifier to contain capturing groups.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
The regex for a function declarator is too complex. Split it into
helper functions that prints the parts of the regex, so that each one
is easier to understand.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
It's known that echo(1) doesn't expand anything. No need to warn.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
echo(1) is fine as long as the first argument doesn't start with a dash.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
With grep(1), we don't need to hard-code escape sequences.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
POSIX allows blank characters before '!', but not after.
Reported-by: <onf@disroot.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
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>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
These programs print the PCRE2 patterns used by grepc(1). This allows
easily implementing different drivers for parsing different languages.
It also allows easily using pcre2grep(1) in cases where grepc(1) might
be limited; for example, searching in non-regular files, or passing
other flags that grepc(1) doesn't pass to pcre2grep(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
We don't use globs within these scripts, so disable them, for safety
reasons.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
'xargs grep' is hard, because grep(1) exits with a status of 1 for no
match, which is not an error, but xargs(1) takes that as an error, which
is confused with other errors.
This trick with sh(1) was suggested by Paul, and nicely solves this
problem.
We also need to change $opts to be a normal variable.
We can't export bash array variables, and passing them to sh(1) -c is
not great; escapes could be messed. It's more robust to use a normal
variable.
Link: <https://lists.gnu.org/archive/html/bug-grep/2025-10/msg00029.html>
Suggested-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Exit with 2 on error.
If nothing matches, it's a success, and it exits with 0 normally.
This is different from grep(1), but I don't know how to write
the script to exit with 1 if nothing matches.
This implementation may also ignore some xargs(1) errors. A future
commit --with code suggested by Paul Eggert-- will fix this.
Link: <https://software.codidact.com/posts/294883>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
It will allow using 'set -Eeuo pipefail' and trap(1) ERR.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
The output shows the line number, so it must have been called with -n.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This is safer than silencing shellcheck(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
In theory, getopts(1) will make sure that no other values arrive here.
However, it's easy to add a check, and that will be safer than silencing
shellcheck(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
We don't need ';;&' since the commit referenced below.
Fixes: 0ba68dd03564 (2024-09-19, 2025-10-29; "bin/grepc, grepc.1: -k: Remove flag")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
It started as a script in the Linux man-pages project, under scripts/
within scripts/bash_aliases.
Eventually, I turned it into a large script, and moved it into a
separate project, to be able to work on it more freely.
The original scripts were removed from this project in commit
c3752af0549c (2022-11-22; "bash_aliases: Remove grep_syscall(),
grep_syscall_def(), and grep_glibc_prototype()").
Now, grepc(1) has stabilized, and I find it very useful for maintaining
this project (as well as others), so let's merge it back. This will
allow distros to package it sooner than if it remained as a standalone
project.
I've imported the git history (ignoring files we don't care about) with
the help of git-filter-repo(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
It's slightly different than the regex we were using, but I can't see a
reason for it. It was probably due to forgetting to improve this regex.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Files are simpler to handle. It results in less flags, and simpler
command invocations. And it allows breaking the line more nicely,
without having to break in the middle of a quoted region.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This is currently a (very useful) GNU extension, and soon might become
standard in C2y.
Link: n3394 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3394.pdf>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Just behave like grep(1) and pcre2grep(1). If the user wants to see it
more nicely, they can do it themselves.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Fixes: 92dca8e97bfa ("bin/grepc: srcfix (Variables for options hold their '-')")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Reported-by: terdon <https://linux.codidact.com/users/57088>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
As in pcre2grep(1) and grep(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This leaves -c unused, so we can add -c with the same meaning of
grep(1): count.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Since 83cfbb6042d1 ("bin/grepc: Optimize"), we color also in ther types
of code. Update the manual page.
Fixes: 83cfbb6042d1 ("bin/grepc: Optimize")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
To avoid confusion to users of other kernels.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This ensures we own the file, removing any races.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
These flags are passed to pcre2grep(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This is to allow adding options that have arguments that are passed to
pcre2grep(1).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Equivalent to grep(1)'s -h, except that we always default to -H behavior.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
There's already a manual page, and the short help from -h was quite
unhelpful. I want to reuse -h for grep(1)'s meaning (don't print the
filename).
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Use single-letter names for variables that hold command-line options.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
The non-recursive behavior is so slow that it's quite useless. It is
only useful when reading from standard input, but for several files it's
useless. Make '-r' the default when any files are specified, and remove
the flag (since now it's always enabled). This happens to bring back a
behavior close to what we had before
2fb22befdfb9 ("Don't find files recursively").
Non-seekable files can still be read, if redirected to standard input.
Update the example from the manual page to reflect current usage.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Call pcre2grep(1) only once, which allows removing named pipes. This is
an important optimization, and will also allow accepting several file
names in the command line (in a future commit). The source code is also
significantly simplified.
It has a caveat: this single call to pcre2grep(1) will consume more
resources, and will crash on certain input files. The workaround is to
restrict the search to just one or a few types of code. Document this
in the manual page. This caveat only applies to very specific files,
which so far I've only found in the Linux kernel source tree.
|
|
grep only one file (or stdin).
The current implementation doesn't allow filterin standard input, which
I miss some times. I'm removing this feature now, to be able to rewrite
most of the program in a way that allows filtering stdin, and then will
consider adding back a recursive mode if necessary.
Also, don't remove the two blanks at the start of the output, for
consistency when calling this program via xargs(1), which will become
more common now that it only handles single files.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This program shouldn't know about file names. If that is wanted, use
something like `find ... | grep ... | xargs grepc ...`.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This program shouldn't know about file extensions. If that is wanted,
use something like `find ... | grep ... | xargs grepc ...`.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
macros, or other macros
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Also, use names consistent with the command-line option arguments.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Also, use names consistent with the command-line option arguments.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
PCRE are EOL. Long live PCRE2.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This creates some false positives, but with appropriate flags, those can
be removed.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
of libc functions
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
To make -tu work correctly, which doesn't have the word-boundary
constraint.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
In some cases it might be nice, but in some other cases, it might
cause a lot of code to be printed. Let the user explicitly search
for it or not in a separate run.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Avoid this glich from glibc:
./sysdeps/unix/sysv/linux/x86/sys/ucontext.h:133:
typedef struct
{
gregset_t __ctx(gregs);
/* Note that fpregs is a pointer. */
fpregset_t __ctx(fpregs);
__extension__ unsigned long long __reserved1 [8];
} mcontext_t;
/* Userlevel context. */
typedef struct ucontext_t
{
unsigned long int __ctx(uc_flags);
struct ucontext_t *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
sigset_t uc_sigmask;
struct _libc_fpstate __fpregs_mem;
__extension__ unsigned long long int __ssp[4];
} ucontext_t;
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
- Typedefs to arrays of structures.
- Typedefs to structures of the same name.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
- Use the same ammount of spaces for the closing brace as for the
opening brace.
- Fix position of attributes.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
SC2068: Double quote array expansions to avoid re-splitting elements.
Reported-by: shellcheck(1)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
SC2124: Use $* instead of $@ to concatenate.
Reported-by: shellcheck(1)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
SC2004: $/${} is unnecessary on arithmetic variables.
Reported-by: shellcheck(1)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Also, add some symmetry between ${iflag} and ${lflag}.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Normally, one either wants to see a declaration/definition, or its
uses, but not both at the same time. Also, there are usually many
more use sites than than definitions, and therefore definitions
are shadowed between all the noise. Restrict the default to
declarations and definitions, which in my experience seems to be
the most common use case.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
When it calls grepc_type_struct_union_enum(), it needs to use a
different file list, since it's searching for an identifier
different from the one passed in the command line.
Also, while at it, improve the quoting of the pattern passed to
pcregrep(1).
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Sort alphabetically the optstring.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
|
|
Rename functions to have different starting letters. Also rename
the macro functions to more closely match ISO C nomenclature.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Most importantly, typedef enum.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Use alphabetic order.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Improve grouping so that adding flags for running the different
functions is simple.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Also, update the manual page EXAMPLES regarding blank lines.
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Using caps instead of <> will be nicer when we add options and
optional arguments for the files/directories:
Usage: grepc [OPTION]... IDENTIFIER [FILE]...
vs
Usage: grepc [<option>]... IDENTIFIER [<file>]...
Also, it's what pcregrep(1) and GNU grep(1) use, so it's good to
use the same syntax here.
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Let's fall on the safe side.
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
This improves the readability of the regex, and also the
robustness, at the cost of just a few ms.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Instead of running find and grep -l for every function, store the
result in a temporary file for reuse in all functions.
This is a considerable speedup, between 3x and 10x in some tests
within the Linux kernel source code.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Those two spaces are for handling some insane GNU style. Those
are always spaces, so let's use ' ' instead of '\s\s' to make
sure we don't match two tabs, or things like that.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|
|
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
|