Date: Mon, 28 Nov 2011 20:00:31 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r228093 - head/usr.bin/grep Message-ID: <201111282000.pASK0VfU006649@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Mon Nov 28 20:00:31 2011 New Revision: 228093 URL: http://svn.freebsd.org/changeset/base/228093 Log: - Fix behavior of --null to match GNU grep PR: bin/162906 Submitted by: Jan Beich <jbeich@tormail.net> MFC after: 3 days Modified: head/usr.bin/grep/util.c Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Mon Nov 28 19:53:16 2011 (r228092) +++ head/usr.bin/grep/util.c Mon Nov 28 20:00:31 2011 (r228093) @@ -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, reg 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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111282000.pASK0VfU006649>