]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(tac_seekable): Fix error in handling regex separators.
authorJim Meyering <jim@meyering.net>
Sat, 16 May 1998 20:06:56 +0000 (20:06 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 16 May 1998 20:06:56 +0000 (20:06 +0000)
src/tac.c

index 0678acf01bf9e969afd1021cee0ee2be017950dd..b274461568faefef078249dd0e133477aa5ddf5c 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -105,8 +105,8 @@ static int show_version;
 
 static struct option const longopts[] =
 {
-  {"before", no_argument, &separator_ends_record, 0},
-  {"regex", no_argument, &sentinel_length, 0},
+  {"before", no_argument, NULL, 'b'},
+  {"regex", no_argument, NULL, 'r'},
   {"separator", required_argument, NULL, 's'},
   {"help", no_argument, &show_help, 1},
   {"version", no_argument, &show_version, 1},
@@ -344,7 +344,10 @@ tac_seekable (int input_fd, const char *file)
              output (match_start, past_end);
              past_end = match_start;
            }
-         match_start -= match_length - 1;
+
+         /* For non-regex matching, we can back up.  */
+         if (sentinel_length > 0)
+           match_start -= match_length - 1;
        }
     }
 }