grep: "implement" -a and -I by ignoring them

This commit is contained in:
Denis Vlasenko 2007-02-25 02:38:54 +00:00
parent 385304d449
commit f8ea0f3a66
2 changed files with 27 additions and 22 deletions

View File

@ -28,6 +28,9 @@
USE_FEATURE_GREP_CONTEXT("A:B:C:") \ USE_FEATURE_GREP_CONTEXT("A:B:C:") \
USE_FEATURE_GREP_EGREP_ALIAS("E") \ USE_FEATURE_GREP_EGREP_ALIAS("E") \
USE_DESKTOP("w") \ USE_DESKTOP("w") \
"aI"
/* ignored: -a "assume all files to be text" */
/* ignored: -I "assume binary files have no matches" */
enum { enum {
OPTBIT_l, OPTBIT_l,

View File

@ -1073,36 +1073,38 @@
" -H login_host Log login_host into the utmp file as the hostname" " -H login_host Log login_host into the utmp file as the hostname"
#define grep_trivial_usage \ #define grep_trivial_usage \
"[-rihHnqvso" \ "[-HhrilLnqvso" \
USE_DESKTOP("w") \
"eF" \
USE_FEATURE_GREP_EGREP_ALIAS("E") \ USE_FEATURE_GREP_EGREP_ALIAS("E") \
USE_FEATURE_GREP_CONTEXT("ABC") \ USE_FEATURE_GREP_CONTEXT("ABC") \
"] PATTERN [FILEs...]" "] PATTERN [FILEs...]"
#define grep_full_usage \ #define grep_full_usage \
"Search for PATTERN in each FILE or standard input" \ "Search for PATTERN in each FILE or standard input" \
"\n\nOptions:\n" \ "\n\nOptions:" \
" -H Prefix output lines with filename where match was found\n" \ "\n -H Prefix output lines with filename where match was found" \
" -h Suppress the prefixing filename on output\n" \ "\n -h Suppress the prefixing filename on output" \
" -r Recurse subdirectories\n" \ "\n -r Recurse subdirectories" \
" -i Ignore case distinctions\n" \ "\n -i Ignore case distinctions" \
" -l List names of files that match\n" \ "\n -l List names of files that match" \
" -L List names of files that do not match\n" \ "\n -L List names of files that do not match" \
" -n Print line number with output lines\n" \ "\n -n Print line number with output lines" \
" -q Be quiet. Returns 0 if PATTERN was found, 1 otherwise\n" \ "\n -q Be quiet. Returns 0 if PATTERN was found, 1 otherwise" \
" -v Select non-matching lines\n" \ "\n -v Select non-matching lines" \
" -s Suppress file open/read error messages\n" \ "\n -s Suppress file open/read error messages" \
" -c Only print count of matching lines\n" \ "\n -c Only print count of matching lines" \
" -f Read PATTERN from file\n" \ "\n -f Read PATTERN from file" \
" -o Show only the part of a line that matches PATTERN\n" \ "\n -o Show only the part of a line that matches PATTERN" \
" -e PATTERN is a regular expression\n" \ USE_DESKTOP( \
" -F PATTERN is a set of newline-separated strings" \ "\n -w Match whole words only") \
"\n -e PATTERN is a regular expression" \
"\n -F PATTERN is a set of newline-separated strings" \
USE_FEATURE_GREP_EGREP_ALIAS( \ USE_FEATURE_GREP_EGREP_ALIAS( \
"\n -E PATTERN is an extended regular expression") \ "\n -E PATTERN is an extended regular expression") \
USE_FEATURE_GREP_CONTEXT( \ USE_FEATURE_GREP_CONTEXT( \
"\n -A Print NUM lines of trailing context") \ "\n -A Print NUM lines of trailing context" \
USE_FEATURE_GREP_CONTEXT( \ "\n -B Print NUM lines of leading context" \
"\n -B Print NUM lines of leading context") \ "\n -C Print NUM lines of output context") \
USE_FEATURE_GREP_CONTEXT( \
"\n -C Print NUM lines of output context")
#define grep_example_usage \ #define grep_example_usage \
"$ grep root /etc/passwd\n" \ "$ grep root /etc/passwd\n" \