mirror of
https://git.busybox.net/busybox.git
synced 2024-11-29 00:23:28 +08:00
Bug fix. grep wasn't printing file names they way it was supposed to.
-Erik
This commit is contained in:
parent
46a4e76243
commit
a2f69e5485
@ -1,5 +1,7 @@
|
|||||||
0.42
|
0.42
|
||||||
* Made tar creation support in busybox tar optional.
|
* Made tar creation support in busybox tar optional.
|
||||||
|
* Made grep and grep -h do the right thing wrt printing
|
||||||
|
the file name (it failed to print files names in many cases).
|
||||||
|
|
||||||
-Erik Andersen
|
-Erik Andersen
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ extern int grep_main (int argc, char **argv)
|
|||||||
char *cp;
|
char *cp;
|
||||||
char *needle;
|
char *needle;
|
||||||
char *fileName;
|
char *fileName;
|
||||||
int tellName=FALSE;
|
int tellName=TRUE;
|
||||||
int ignoreCase=FALSE;
|
int ignoreCase=TRUE;
|
||||||
int tellLine=FALSE;
|
int tellLine=FALSE;
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ extern int grep_main (int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
tellName = TRUE;
|
tellName = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
@ -137,6 +137,9 @@ extern int grep_main (int argc, char **argv)
|
|||||||
if (argc==0) {
|
if (argc==0) {
|
||||||
do_grep( stdin, needle, "stdin", FALSE, ignoreCase, tellLine);
|
do_grep( stdin, needle, "stdin", FALSE, ignoreCase, tellLine);
|
||||||
} else {
|
} else {
|
||||||
|
/* Never print the filename for just one file */
|
||||||
|
if (argc==1)
|
||||||
|
tellName=FALSE;
|
||||||
while (argc-- > 0) {
|
while (argc-- > 0) {
|
||||||
fileName = *argv++;
|
fileName = *argv++;
|
||||||
|
|
||||||
|
9
grep.c
9
grep.c
@ -90,8 +90,8 @@ extern int grep_main (int argc, char **argv)
|
|||||||
char *cp;
|
char *cp;
|
||||||
char *needle;
|
char *needle;
|
||||||
char *fileName;
|
char *fileName;
|
||||||
int tellName=FALSE;
|
int tellName=TRUE;
|
||||||
int ignoreCase=FALSE;
|
int ignoreCase=TRUE;
|
||||||
int tellLine=FALSE;
|
int tellLine=FALSE;
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ extern int grep_main (int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
tellName = TRUE;
|
tellName = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
@ -137,6 +137,9 @@ extern int grep_main (int argc, char **argv)
|
|||||||
if (argc==0) {
|
if (argc==0) {
|
||||||
do_grep( stdin, needle, "stdin", FALSE, ignoreCase, tellLine);
|
do_grep( stdin, needle, "stdin", FALSE, ignoreCase, tellLine);
|
||||||
} else {
|
} else {
|
||||||
|
/* Never print the filename for just one file */
|
||||||
|
if (argc==1)
|
||||||
|
tellName=FALSE;
|
||||||
while (argc-- > 0) {
|
while (argc-- > 0) {
|
||||||
fileName = *argv++;
|
fileName = *argv++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user