|
Last change
on this file since 3670 was 3529, checked in by bird, 4 years ago |
|
Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.
|
-
Property svn:executable
set to
*
|
|
File size:
828 bytes
|
| Line | |
|---|
| 1 | #!/bin/sh
|
|---|
| 2 | # Case-insensitive grep with a 0-size input file would fail in grep up to 2.6.3
|
|---|
| 3 | . "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|---|
| 4 |
|
|---|
| 5 | mkdir a || framework_failure
|
|---|
| 6 |
|
|---|
| 7 | # Lower and upper bound of valid exit status for "grep -f DIR",
|
|---|
| 8 | # when reading from empty and nonempty files, respectively.
|
|---|
| 9 | if cat a >acopy 2>&1 && cmp a acopy; then
|
|---|
| 10 | l=1 u=1 L=0 U=1
|
|---|
| 11 | else
|
|---|
| 12 | l=2 u=127 L=2 U=127
|
|---|
| 13 | fi
|
|---|
| 14 |
|
|---|
| 15 | status_range ()
|
|---|
| 16 | {
|
|---|
| 17 | status=$?
|
|---|
| 18 | { test $1 -le $status && test $status -le $2; } || fail=1
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | echo x | grep -f a/; status_range $L $U
|
|---|
| 22 | echo x | grep -if a/; status_range $L $U
|
|---|
| 23 | echo x | grep -Ff a/; status_range $L $U
|
|---|
| 24 | echo x | grep -Fif a/; status_range $L $U
|
|---|
| 25 |
|
|---|
| 26 | grep -f a/ < /dev/null; status_range $l $u
|
|---|
| 27 | grep -if a/ < /dev/null; status_range $l $u
|
|---|
| 28 | grep -Ff a/ < /dev/null; status_range $l $u
|
|---|
| 29 | grep -Fif a/ < /dev/null; status_range $l $u
|
|---|
| 30 |
|
|---|
| 31 | Exit $fail
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.