mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
- Fix behavior of --null to match GNU grep
PR: bin/162906 Submitted by: Jan Beich <jbeich@tormail.net> MFC after: 3 days
This commit is contained in:
parent
2b8895cd74
commit
f0c94259d6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228093
@ -246,9 +246,9 @@ procfile(const char *fn)
|
||||
printf("%u\n", c);
|
||||
}
|
||||
if (lflag && !qflag && c != 0)
|
||||
printf("%s\n", fn);
|
||||
printf("%s%c", fn, nullflag ? 0 : '\n');
|
||||
if (Lflag && !qflag && c == 0)
|
||||
printf("%s\n", fn);
|
||||
printf("%s%c", fn, nullflag ? 0 : '\n');
|
||||
if (c && !cflag && !lflag && !Lflag &&
|
||||
binbehave == BINFILE_BIN && f->binary && !qflag)
|
||||
printf(getstr(8), fn);
|
||||
@ -440,13 +440,13 @@ printline(struct str *line, int sep, regmatch_t *matches, int m)
|
||||
int i, n = 0;
|
||||
|
||||
if (!hflag) {
|
||||
if (nullflag == 0)
|
||||
if (!nullflag) {
|
||||
fputs(line->file, stdout);
|
||||
else {
|
||||
++n;
|
||||
} else {
|
||||
printf("%s", line->file);
|
||||
putchar(0);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (nflag) {
|
||||
if (n > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user