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>
# Defaults:
git='no';
-ext='\.[ch]$';
FILES='.';
iflag='';
lflag='';
grepc_parse_cmd()
{
- while getopts "cghiklt:x:" opt; do
+ while getopts "cghiklt:" opt; do
case "$opt" in
c)
cflag='yes';
esac;
tflag='yes';
;;
- x)
- ext="$OPTARG";
- ;;
?)
exit 1; # getopts(1) prints an error msg.
;;
else
find $FILES -type f;
fi \
- | grep -P -- "$ext" \
| xargs grep -${iflag}lPI -- "$1" \
| tee "$files_use" \
| xargs grep -${iflag}lP -- "$1\b" \
.I file
is a directory,
the search is recursive within that directory.
-If
-.I file
-doesn't match a certain extension, it is skipped
-(see
-.B \-x
-in OPTIONS).
If no
.I file
is given,
to search for various types of code.
Default:
.BR "e f m t" .
-.TP
-.BI \-x " extension"
-Restrict the search to files ending with
-.IR extension .
-It is interpreted as a PCRE pattern.
-Default:
-.BR \e.[ch]$ .
.SH EXAMPLES
.EX
.RB \(ti/src/nginx/unit$ " grepc nxt_sprintf;"