summaryrefslogtreecommitdiffstats
path: root/bin (follow)
Commit message (Collapse)AuthorAgeLines
* grepc: Remove constraints in the file prefilteringAlejandro Colomar2022-05-25-1/+1
| | | | | | | To make -tu work correctly, which doesn't have the word-boundary constraint. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: -tut: Fix regex for braces in the same line as 'struct'Alejandro Colomar2022-05-25-1/+1
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Read in the helperAlejandro Colomar2022-05-25-35/+19
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Don't search underlying structure of a typedefAlejandro Colomar2022-05-25-14/+0
| | | | | | | | 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>
* grepc: Fix glitch with incorrectly indented codeAlejandro Colomar2022-05-25-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* grepc: Fix some typedef corner casesAlejandro Colomar2022-05-24-3/+3
| | | | | | | - Typedefs to arrays of structures. - Typedefs to structures of the same name. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Improve regexesAlejandro Colomar2022-05-24-16/+16
| | | | | | | | - 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>
* grepc: bugfixAlejandro Colomar2022-05-22-2/+2
| | | | | | | SC2068: Double quote array expansions to avoid re-splitting elements. Reported-by: shellcheck(1) Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: srcfixAlejandro Colomar2022-05-22-1/+1
| | | | | | | SC2124: Use $* instead of $@ to concatenate. Reported-by: shellcheck(1) Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: srcfixAlejandro Colomar2022-05-22-1/+1
| | | | | | | SC2004: $/${} is unnecessary on arithmetic variables. Reported-by: shellcheck(1) Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Add -i flag as in grep(1)Alejandro Colomar2022-05-22-8/+12
| | | | | | Also, add some symmetry between ${iflag} and ${lflag}. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Remove -tu from the defaultsAlejandro Colomar2022-05-22-1/+0
| | | | | | | | | | | 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>
* grepc, grepc.1: -tu: Allow searching special charactersAlejandro Colomar2022-05-20-7/+7
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Fix grepc_type_typedef_underlying_struct_union_enumAlejandro Colomar2022-05-20-26/+43
| | | | | | | | | | | 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>
* grepc: -tt: Find typedefs to function pointersAlejandro Colomar2022-05-17-0/+10
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: tfixAlejandro Colomar2022-05-17-1/+1
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: srcfixAlejandro Colomar2022-05-16-1/+1
| | | | | | Sort alphabetically the optstring. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Allow a pattern to start with '-'Alejandro Colomar2022-05-15-5/+5
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: -t...: Allow more granularityAlejandro Colomar2022-05-15-1/+66
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: wfixAlejandro Colomar2022-05-15-11/+11
| | | | | | | 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>
* grepc, grepc.1: -tu: Search also within enum and type definitionsAlejandro Colomar2022-05-15-0/+46
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: grepc_enum_constant: Fix edge casesAlejandro Colomar2022-05-15-3/+3
| | | | | | Most importantly, typedef enum. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Add -l flag as in grep(1)Alejandro Colomar2022-05-14-3/+13
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: grepc_use_macro: tfixAlejandro Colomar2022-05-13-1/+1
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Add -tu to search for usesAlejandro Colomar2022-05-13-0/+55
| | | | | Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: grepc_macro_*: Remove a few false positivesAlejandro Colomar2022-05-13-2/+2
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: srcfixAlejandro Colomar2022-05-13-13/+13
| | | | | | Use alphabetic order. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Add -k option for a more compact outputAlejandro Colomar2022-05-12-3/+11
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Add -t option to restrict the search to a type of code.Alejandro Colomar2022-05-12-3/+51
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: srcfixAlejandro Colomar2022-05-12-43/+43
| | | | | | | Improve grouping so that adding flags for running the different functions is simple. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Don't print leading blank lines.Alejandro Colomar2022-05-11-8/+13
| | | | | | | Also, update the manual page EXAMPLES regarding blank lines. Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: Add optional FILE trailing argumentsAlejandro Colomar2022-05-11-4/+10
| | | | | Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: -g: Add option to restrict search to files tracked by gitAlejandro Colomar2022-05-11-2/+10
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: -x: Add option to edit file extensionAlejandro Colomar2022-05-11-3/+10
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc, grepc.1: -h: Add option to print the usage message.Alejandro Colomar2022-05-11-12/+38
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Usage: ffixAlejandro Colomar2022-05-11-1/+1
| | | | | | | | | | | | | | | | | 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>
* grepc: Simplify escaping \Alejandro Colomar2022-05-10-2/+2
| | | | | Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Use -r option to read(1)Alejandro Colomar2022-05-10-1/+1
| | | | | | | Let's fall on the safe side. Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Make it portable to sh(1)Alejandro Colomar2022-05-10-23/+23
| | | | | Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Use a portable shebangAlejandro Colomar2022-05-10-1/+1
| | | | | Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Remove spurious blank linesAlejandro Colomar2022-05-10-7/+7
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Remove blank line between header and codeAlejandro Colomar2022-05-10-1/+1
| | | | | Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: grepc_linux_syscall_def: Improve readability of regexAlejandro Colomar2022-05-10-1/+1
| | | | | | | 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>
* grepc: grepc_find_files: Get a reduced list of files onceAlejandro Colomar2022-05-10-18/+27
| | | | | | | | | | 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>
* grepc: Fix some corner casesAlejandro Colomar2022-05-10-2/+2
| | | | | | | | 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>
* grepc: Use '' when possibleAlejandro Colomar2022-05-09-10/+10
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: Fix some corner casesAlejandro Colomar2022-05-09-4/+4
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: grepc_type_*: Fix some typedef corner casesAlejandro Colomar2022-05-09-8/+8
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: grepc_macro_simple: Fix regex for empty macroAlejandro Colomar2022-05-09-1/+1
| | | | Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
* grepc: OptimizeAlejandro Colomar2022-05-09-7/+18
| | | | | | | | Use 2 grep(1) filters instead of 1, to be able to filter better before the multiline pcregrep(1) filter, which is considerably slower. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>