summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-05-16 20:06:56 +0000
committerJim Meyering <jim@meyering.net>1998-05-16 20:06:56 +0000
commit24a7456cc0e4e6b2397b7e0ea0925f2695efb435 (patch)
tree9eefadd944d308d2e758bf21f461afaf59bcc54e /src/tac.c
parentb17e1af41c864e24c22760bcaf6f7a7efcdf7e22 (diff)
downloadcoreutils-24a7456cc0e4e6b2397b7e0ea0925f2695efb435.tar.xz
(tac_seekable): Fix error in handling regex separators.
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tac.c b/src/tac.c
index 0678acf01..b27446156 100644
--- 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;
}
}
}