summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorErik Andersen2000-01-19 04:30:37 +0000
committerErik Andersen2000-01-19 04:30:37 +0000
commita2f69e548587b7079e0973146895774250c3406a (patch)
tree58af08e4da017d64d6adc66c30120b07eef189ab /grep.c
parent46a4e762439eb519345703311ad314827bcd74c1 (diff)
downloadbusybox-a2f69e548587b7079e0973146895774250c3406a.zip
busybox-a2f69e548587b7079e0973146895774250c3406a.tar.gz
Bug fix. grep wasn't printing file names they way it was supposed to.
-Erik
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/grep.c b/grep.c
index fdfc959..287d9f8 100644
--- a/grep.c
+++ b/grep.c
@@ -90,8 +90,8 @@ extern int grep_main (int argc, char **argv)
char *cp;
char *needle;
char *fileName;
- int tellName=FALSE;
- int ignoreCase=FALSE;
+ int tellName=TRUE;
+ int ignoreCase=TRUE;
int tellLine=FALSE;
@@ -115,7 +115,7 @@ extern int grep_main (int argc, char **argv)
break;
case 'h':
- tellName = TRUE;
+ tellName = FALSE;
break;
case 'n':
@@ -137,6 +137,9 @@ extern int grep_main (int argc, char **argv)
if (argc==0) {
do_grep( stdin, needle, "stdin", FALSE, ignoreCase, tellLine);
} else {
+ /* Never print the filename for just one file */
+ if (argc==1)
+ tellName=FALSE;
while (argc-- > 0) {
fileName = *argv++;