]> git.ipfire.org Git - thirdparty/man-pages.git/log
thirdparty/man-pages.git
7 days agobin/grepc: srcfix (Compact single-line cases)
Alejandro Colomar [Sun, 5 Nov 2023 12:39:23 +0000 (13:39 +0100)] 
bin/grepc: srcfix (Compact single-line cases)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc, grepc.1: -c: Add option to count matches
Alejandro Colomar [Sun, 5 Nov 2023 12:31:33 +0000 (13:31 +0100)] 
bin/grepc, grepc.1: -c: Add option to count matches

As in pcre2grep(1) and grep(1).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc, grepc.1: Rename option -c to -r
Alejandro Colomar [Sun, 5 Nov 2023 12:23:29 +0000 (13:23 +0100)] 
bin/grepc, grepc.1: Rename option -c to -r

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>
7 days agogrepc.1: -c: Remove outdated sentence
Alejandro Colomar [Sun, 5 Nov 2023 12:14:51 +0000 (13:14 +0100)] 
grepc.1: -c: Remove outdated sentence

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>
7 days agobin/grepc, grepc.1: Use 'l' instead of 's' for Linux system calls
Alejandro Colomar [Sun, 5 Nov 2023 12:06:15 +0000 (13:06 +0100)] 
bin/grepc, grepc.1: Use 'l' instead of 's' for Linux system calls

To avoid confusion to users of other kernels.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: srcfix (Reorder some function definitions)
Alejandro Colomar [Sun, 5 Nov 2023 12:03:15 +0000 (13:03 +0100)] 
bin/grepc: srcfix (Reorder some function definitions)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc, grepc.1: -n: Add option to control printing of line numbers
Alejandro Colomar [Sun, 5 Nov 2023 02:12:53 +0000 (03:12 +0100)] 
bin/grepc, grepc.1: -n: Add option to control printing of line numbers

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: srcfix (Actually create file with mktemp(1))
Alejandro Colomar [Sun, 5 Nov 2023 01:49:37 +0000 (02:49 +0100)] 
bin/grepc: srcfix (Actually create file with mktemp(1))

This ensures we own the file, removing any races.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: srcfix (Add some tabs, and remove a function)
Alejandro Colomar [Sun, 5 Nov 2023 01:47:09 +0000 (02:47 +0100)] 
bin/grepc: srcfix (Add some tabs, and remove a function)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc, grepc.1: -A, -B, -C: Add flags for printing context.
Alejandro Colomar [Sat, 4 Nov 2023 21:00:57 +0000 (22:00 +0100)] 
bin/grepc, grepc.1: -A, -B, -C: Add flags for printing context.

These flags are passed to pcre2grep(1).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: srcfix (Variables for options hold their '-')
Alejandro Colomar [Sat, 4 Nov 2023 20:53:13 +0000 (21:53 +0100)] 
bin/grepc: srcfix (Variables for options hold their '-')

This is to allow adding options that have arguments that are passed to
pcre2grep(1).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc, grepc.1: -h: Add option to suppress prefixing file names
Alejandro Colomar [Sat, 4 Nov 2023 20:47:44 +0000 (21:47 +0100)] 
bin/grepc, grepc.1: -h: Add option to suppress prefixing file names

Equivalent to grep(1)'s -h, except that we always default to -H behavior.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: srcfix (Add missing variable definition)
Alejandro Colomar [Sat, 4 Nov 2023 20:04:32 +0000 (21:04 +0100)] 
bin/grepc: srcfix (Add missing variable definition)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc, grepc.1: Remove -h flag
Alejandro Colomar [Sat, 4 Nov 2023 19:59:06 +0000 (20:59 +0100)] 
bin/grepc, grepc.1: Remove -h flag

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>
7 days agobin/grepc: srcfix (Change variable names)
Alejandro Colomar [Sat, 4 Nov 2023 19:56:16 +0000 (20:56 +0100)] 
bin/grepc: srcfix (Change variable names)

Use single-letter names for variables that hold command-line options.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc, grepc.1: Always enable recursive mode; remove -r
Alejandro Colomar [Sat, 4 Nov 2023 19:45:11 +0000 (20:45 +0100)] 
bin/grepc, grepc.1: Always enable recursive mode; remove -r

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>
7 days agoAdd recursive search back in with -r
Alejandro Colomar [Fri, 3 Nov 2023 21:21:30 +0000 (22:21 +0100)] 
Add recursive search back in with -r

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agoAllow specifying several files
Alejandro Colomar [Fri, 3 Nov 2023 17:48:51 +0000 (18:48 +0100)] 
Allow specifying several files

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Don't use pcre2grep(1)'s --label
Alejandro Colomar [Fri, 3 Nov 2023 17:46:09 +0000 (18:46 +0100)] 
bin/grepc: Don't use pcre2grep(1)'s --label

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_search())
Alejandro Colomar [Fri, 3 Nov 2023 17:26:00 +0000 (18:26 +0100)] 
bin/grepc: Simplify (remove grepc_search())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Compact code
Alejandro Colomar [Fri, 3 Nov 2023 17:23:44 +0000 (18:23 +0100)] 
bin/grepc: Compact code

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Optimize
Alejandro Colomar [Fri, 3 Nov 2023 16:41:22 +0000 (17:41 +0100)] 
bin/grepc: Optimize

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.

7 days agoDon't find files recursively
Alejandro Colomar [Fri, 3 Nov 2023 14:08:49 +0000 (15:08 +0100)] 
Don't find files recursively

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>
7 days agoRemove '-g' option
Alejandro Colomar [Thu, 2 Nov 2023 15:11:45 +0000 (16:11 +0100)] 
Remove '-g' option

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>
7 days agoRemove '-x' option
Alejandro Colomar [Thu, 2 Nov 2023 15:08:31 +0000 (16:08 +0100)] 
Remove '-x' option

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>
7 days agobin/grepc, grepc.1: -tmf, -tmo: Add options to find only function-like macros, or...
Alejandro Colomar [Fri, 3 Nov 2023 00:16:42 +0000 (01:16 +0100)] 
bin/grepc, grepc.1: -tmf, -tmo: Add options to find only function-like macros, or other macros

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Shorten function names
Alejandro Colomar [Fri, 3 Nov 2023 00:01:07 +0000 (01:01 +0100)] 
bin/grepc: Shorten function names

Also, use names consistent with the command-line option arguments.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Shorten variable names
Alejandro Colomar [Thu, 2 Nov 2023 19:12:31 +0000 (20:12 +0100)] 
bin/grepc: Shorten variable names

Also, use names consistent with the command-line option arguments.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_use_func())
Alejandro Colomar [Thu, 2 Nov 2023 18:52:57 +0000 (19:52 +0100)] 
bin/grepc: Simplify (remove grepc_use_func())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_use_type())
Alejandro Colomar [Thu, 2 Nov 2023 18:38:43 +0000 (19:38 +0100)] 
bin/grepc: Simplify (remove grepc_use_type())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_type())
Alejandro Colomar [Thu, 2 Nov 2023 18:33:54 +0000 (19:33 +0100)] 
bin/grepc: Simplify (remove grepc_type())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_type_typedef())
Alejandro Colomar [Thu, 2 Nov 2023 18:30:00 +0000 (19:30 +0100)] 
bin/grepc: Simplify (remove grepc_type_typedef())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_macro())
Alejandro Colomar [Thu, 2 Nov 2023 18:21:22 +0000 (19:21 +0100)] 
bin/grepc: Simplify (remove grepc_macro())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Compact one-liner definitions
Alejandro Colomar [Thu, 2 Nov 2023 18:15:33 +0000 (19:15 +0100)] 
bin/grepc: Compact one-liner definitions

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_glibc_func_def())
Alejandro Colomar [Thu, 2 Nov 2023 18:10:43 +0000 (19:10 +0100)] 
bin/grepc: Simplify (remove grepc_glibc_func_def())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Improve error messages
Alejandro Colomar [Thu, 2 Nov 2023 17:52:04 +0000 (18:52 +0100)] 
bin/grepc: Improve error messages

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Transform some if's to simpler test&&
Alejandro Colomar [Thu, 2 Nov 2023 17:32:41 +0000 (18:32 +0100)] 
bin/grepc: Transform some if's to simpler test&&

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_use())
Alejandro Colomar [Thu, 2 Nov 2023 17:13:22 +0000 (18:13 +0100)] 
bin/grepc: Simplify (remove grepc_use())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_glibc_func())
Alejandro Colomar [Thu, 2 Nov 2023 17:08:34 +0000 (18:08 +0100)] 
bin/grepc: Simplify (remove grepc_glibc_func())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_linux_func())
Alejandro Colomar [Thu, 2 Nov 2023 17:05:45 +0000 (18:05 +0100)] 
bin/grepc: Simplify (remove grepc_linux_func())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_func())
Alejandro Colomar [Thu, 2 Nov 2023 17:02:39 +0000 (18:02 +0100)] 
bin/grepc: Simplify (remove grepc_func())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agobin/grepc: Simplify (remove grepc_search_default())
Alejandro Colomar [Thu, 2 Nov 2023 16:59:27 +0000 (17:59 +0100)] 
bin/grepc: Simplify (remove grepc_search_default())

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agoUse pcre2grep(1) instead of pcregrep(1)
Alejandro Colomar [Thu, 2 Nov 2023 15:02:08 +0000 (16:02 +0100)] 
Use pcre2grep(1) instead of pcregrep(1)

PCRE are EOL.  Long live PCRE2.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agoUse recursion to improve matching of function parameter lists
Alejandro Colomar [Sun, 8 Jan 2023 14:26:09 +0000 (15:26 +0100)] 
Use recursion to improve matching of function parameter lists

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agoSupport parenthesized function names
Alejandro Colomar [Sat, 7 Jan 2023 23:10:39 +0000 (00:10 +0100)] 
Support parenthesized function names

This creates some false positives, but with appropriate flags, those can
be removed.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
7 days agogrepc, grepc.1: -tg, -tgp, -tgd: Add more support for glibc internal names of libc...
Alejandro Colomar [Wed, 17 Aug 2022 08:11:15 +0000 (10:11 +0200)] 
grepc, grepc.1: -tg, -tgp, -tgd: Add more support for glibc internal names of libc functions

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: -tm: Fix finding macros defined as empty
Alejandro Colomar [Tue, 21 Jun 2022 11:19:48 +0000 (13:19 +0200)] 
grepc: -tm: Fix finding macros defined as empty

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: -c: Add flag to color uses
Alejandro Colomar [Wed, 25 May 2022 21:40:22 +0000 (23:40 +0200)] 
grepc, grepc.1: -c: Add flag to color uses

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Remove constraints in the file prefiltering
Alejandro Colomar [Wed, 25 May 2022 21:08:42 +0000 (23:08 +0200)] 
grepc: Remove constraints in the file prefiltering

To make -tu work correctly, which doesn't have the word-boundary
constraint.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: -tut: Fix regex for braces in the same line as 'struct'
Alejandro Colomar [Wed, 25 May 2022 21:03:12 +0000 (23:03 +0200)] 
grepc: -tut: Fix regex for braces in the same line as 'struct'

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Read in the helper
Alejandro Colomar [Wed, 25 May 2022 21:00:26 +0000 (23:00 +0200)] 
grepc: Read  in the helper

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Don't search underlying structure of a typedef
Alejandro Colomar [Wed, 25 May 2022 13:46:26 +0000 (15:46 +0200)] 
grepc: Don't search underlying structure of a typedef

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>
7 days agogrepc: Fix glitch with incorrectly indented code
Alejandro Colomar [Tue, 24 May 2022 22:05:20 +0000 (00:05 +0200)] 
grepc: Fix glitch with incorrectly indented code

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>
7 days agogrepc: Fix some typedef corner cases
Alejandro Colomar [Tue, 24 May 2022 21:50:09 +0000 (23:50 +0200)] 
grepc: Fix some typedef corner cases

- Typedefs to arrays of structures.
- Typedefs to structures of the same name.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Improve regexes
Alejandro Colomar [Tue, 24 May 2022 20:56:00 +0000 (22:56 +0200)] 
grepc: Improve regexes

- 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>
7 days agogrepc: bugfix
Alejandro Colomar [Sat, 21 May 2022 23:27:14 +0000 (01:27 +0200)] 
grepc: bugfix

SC2068: Double quote array expansions to avoid re-splitting elements.

Reported-by: shellcheck(1)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: srcfix
Alejandro Colomar [Sat, 21 May 2022 23:25:46 +0000 (01:25 +0200)] 
grepc: srcfix

SC2124: Use $* instead of $@ to concatenate.

Reported-by: shellcheck(1)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: srcfix
Alejandro Colomar [Sat, 21 May 2022 23:21:22 +0000 (01:21 +0200)] 
grepc: srcfix

SC2004: $/${} is unnecessary on arithmetic variables.

Reported-by: shellcheck(1)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Add -i flag as in grep(1)
Alejandro Colomar [Sat, 21 May 2022 22:51:30 +0000 (00:51 +0200)] 
grepc, grepc.1: Add -i flag as in grep(1)

Also, add some symmetry between ${iflag} and ${lflag}.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Remove -tu from the defaults
Alejandro Colomar [Sat, 21 May 2022 22:29:44 +0000 (00:29 +0200)] 
grepc, grepc.1: Remove -tu from the defaults

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>
7 days agogrepc, grepc.1: -tu: Allow searching special characters
Alejandro Colomar [Fri, 20 May 2022 02:00:04 +0000 (04:00 +0200)] 
grepc, grepc.1: -tu: Allow searching special characters

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Fix grepc_type_typedef_underlying_struct_union_enum
Alejandro Colomar [Fri, 20 May 2022 01:47:38 +0000 (03:47 +0200)] 
grepc: Fix grepc_type_typedef_underlying_struct_union_enum

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>
7 days agogrepc: -tt: Find typedefs to function pointers
Alejandro Colomar [Tue, 17 May 2022 08:59:52 +0000 (10:59 +0200)] 
grepc: -tt: Find typedefs to function pointers

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: tfix
Alejandro Colomar [Mon, 16 May 2022 22:38:10 +0000 (00:38 +0200)] 
grepc: tfix

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: srcfix
Alejandro Colomar [Mon, 16 May 2022 14:18:31 +0000 (16:18 +0200)] 
grepc: srcfix

Sort alphabetically the optstring.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Allow a pattern to start with '-'
Alejandro Colomar [Sat, 14 May 2022 23:53:26 +0000 (01:53 +0200)] 
grepc: Allow a pattern to start with '-'

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: -t...: Allow more granularity
Alejandro Colomar [Sat, 14 May 2022 23:40:56 +0000 (01:40 +0200)] 
grepc, grepc.1: -t...: Allow more granularity

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc.1: wfix
Alejandro Colomar [Sat, 14 May 2022 23:28:28 +0000 (01:28 +0200)] 
grepc.1: wfix

7 days agogrepc, grepc.1: wfix
Alejandro Colomar [Sat, 14 May 2022 23:24:46 +0000 (01:24 +0200)] 
grepc, grepc.1: wfix

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>
7 days agogrepc, grepc.1: -tu: Search also within enum and type definitions
Alejandro Colomar [Sat, 14 May 2022 23:20:39 +0000 (01:20 +0200)] 
grepc, grepc.1: -tu: Search also within enum and type definitions

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: grepc_enum_constant: Fix edge cases
Alejandro Colomar [Sat, 14 May 2022 22:52:03 +0000 (00:52 +0200)] 
grepc: grepc_enum_constant: Fix edge cases

Most importantly, typedef enum.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Add -l flag as in grep(1)
Alejandro Colomar [Sat, 14 May 2022 16:22:47 +0000 (18:22 +0200)] 
grepc, grepc.1: Add -l flag as in grep(1)

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: grepc_use_macro: tfix
Alejandro Colomar [Fri, 13 May 2022 15:33:58 +0000 (17:33 +0200)] 
grepc: grepc_use_macro: tfix

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc.1: ffix
Alejandro Colomar [Fri, 13 May 2022 15:20:03 +0000 (17:20 +0200)] 
grepc.1: ffix

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Add -tu to search for uses
Alejandro Colomar [Fri, 13 May 2022 15:17:45 +0000 (17:17 +0200)] 
grepc, grepc.1: Add -tu to search for uses

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: grepc_macro_*: Remove a few false positives
Alejandro Colomar [Fri, 13 May 2022 15:12:47 +0000 (17:12 +0200)] 
grepc: grepc_macro_*: Remove a few false positives

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: srcfix
Alejandro Colomar [Fri, 13 May 2022 15:12:06 +0000 (17:12 +0200)] 
grepc: srcfix

Use alphabetic order.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Add -k option for a more compact output
Alejandro Colomar [Thu, 12 May 2022 13:15:28 +0000 (15:15 +0200)] 
grepc, grepc.1: Add -k option for a more compact output

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Add -t option to restrict the search to a type of code.
Alejandro Colomar [Thu, 12 May 2022 12:10:53 +0000 (14:10 +0200)] 
grepc, grepc.1: Add -t option to restrict the search to a type of code.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: srcfix
Alejandro Colomar [Thu, 12 May 2022 11:47:38 +0000 (13:47 +0200)] 
grepc: srcfix

Improve grouping so that adding flags for running the different
functions is simple.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Don't print leading blank lines.
Alejandro Colomar [Wed, 11 May 2022 19:36:45 +0000 (21:36 +0200)] 
grepc, grepc.1: Don't print leading blank lines.

Also, update the manual page EXAMPLES regarding blank lines.

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc.1: SYNOPSIS: ffix
Alejandro Colomar [Wed, 11 May 2022 19:24:11 +0000 (21:24 +0200)] 
grepc.1: SYNOPSIS: ffix

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: Add optional FILE trailing arguments
Alejandro Colomar [Wed, 11 May 2022 18:46:01 +0000 (20:46 +0200)] 
grepc, grepc.1: Add optional FILE trailing arguments

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: -g: Add option to restrict search to files tracked by git
Alejandro Colomar [Wed, 11 May 2022 17:51:46 +0000 (19:51 +0200)] 
grepc, grepc.1: -g: Add option to restrict search to files tracked by git

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: -x: Add option to edit file extension
Alejandro Colomar [Wed, 11 May 2022 17:51:46 +0000 (19:51 +0200)] 
grepc, grepc.1: -x: Add option to edit file extension

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc, grepc.1: -h: Add option to print the usage message.
Alejandro Colomar [Wed, 11 May 2022 17:51:46 +0000 (19:51 +0200)] 
grepc, grepc.1: -h: Add option to print the usage message.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Usage: ffix
Alejandro Colomar [Wed, 11 May 2022 16:53:30 +0000 (18:53 +0200)] 
grepc: Usage: ffix

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>
7 days agogrepc.1: wfix
Alejandro Colomar [Tue, 10 May 2022 21:34:58 +0000 (23:34 +0200)] 
grepc.1: wfix

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Simplify escaping \
Alejandro Colomar [Tue, 10 May 2022 17:35:15 +0000 (19:35 +0200)] 
grepc: Simplify escaping \

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Use -r option to read(1)
Alejandro Colomar [Tue, 10 May 2022 17:33:15 +0000 (19:33 +0200)] 
grepc: Use -r option to read(1)

Let's fall on the safe side.

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Make it portable to sh(1)
Alejandro Colomar [Tue, 10 May 2022 17:24:26 +0000 (19:24 +0200)] 
grepc: Make it portable to sh(1)

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Use a portable shebang
Alejandro Colomar [Tue, 10 May 2022 17:17:51 +0000 (19:17 +0200)] 
grepc: Use a portable shebang

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Remove spurious blank lines
Alejandro Colomar [Tue, 10 May 2022 17:09:40 +0000 (19:09 +0200)] 
grepc: Remove spurious blank lines

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: Remove blank line between header and code
Alejandro Colomar [Tue, 10 May 2022 16:48:01 +0000 (18:48 +0200)] 
grepc: Remove blank line between header and code

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc: grepc_linux_syscall_def: Improve readability of regex
Alejandro Colomar [Tue, 10 May 2022 16:46:46 +0000 (18:46 +0200)] 
grepc: grepc_linux_syscall_def: Improve readability of regex

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>
7 days agogrepc: grepc_find_files: Get a reduced list of files once
Alejandro Colomar [Tue, 10 May 2022 16:44:58 +0000 (18:44 +0200)] 
grepc: grepc_find_files: Get a reduced list of files once

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>
7 days agogrepc: Fix some corner cases
Alejandro Colomar [Mon, 9 May 2022 22:59:06 +0000 (00:59 +0200)] 
grepc: Fix some corner cases

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>
7 days agogrepc.1: ffix
Alejandro Colomar [Mon, 9 May 2022 20:18:08 +0000 (22:18 +0200)] 
grepc.1: ffix

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc.1: Add break points in URI
Alejandro Colomar [Mon, 9 May 2022 16:08:41 +0000 (18:08 +0200)] 
grepc.1: Add break points in URI

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
7 days agogrepc.1: EXAMPLES: Add example with nxt_sprintf
Alejandro Colomar [Mon, 9 May 2022 15:45:44 +0000 (17:45 +0200)] 
grepc.1: EXAMPLES: Add example with nxt_sprintf

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>