Fix printing of -- marker when using -A as noted by gnezdo@
authorotto <otto@openbsd.org>
Tue, 28 Dec 2021 16:27:53 +0000 (16:27 +0000)
committerotto <otto@openbsd.org>
Tue, 28 Dec 2021 16:27:53 +0000 (16:27 +0000)
ok millert@

usr.bin/grep/util.c

index e16d08e..bcef089 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: util.c,v 1.63 2020/07/23 20:19:27 martijn Exp $       */
+/*     $OpenBSD: util.c,v 1.64 2021/12/28 16:27:53 otto Exp $  */
 
 /*-
  * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -258,8 +258,8 @@ print:
 
        if ((tail > 0 || c) && !cflag && !qflag) {
                if (c) {
-                       if (first > 0 && tail == 0 && (Bflag < linesqueued) &&
-                           (Aflag || Bflag))
+                       if (first > 0 && tail == 0 && (Aflag || (Bflag &&
+                           Bflag < linesqueued)))
                                printf("--\n");
                        first = 1;
                        tail = Aflag;