aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-10-05 23:48:05 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-10-05 23:48:05 +0000
commitba86cffb2840e12b5d72453d7c574850a76001d8 (patch)
tree9f6188f9d23abb5f462653f8b7fcfa650541cb47 /usr.bin
parente5f2d5b35e79ddf995a8a5c782a7940ca2e05fdf (diff)
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rs/rs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c
index 557c5b9f56c0..046bdc125f00 100644
--- a/usr.bin/rs/rs.c
+++ b/usr.bin/rs/rs.c
@@ -114,10 +114,11 @@ main(int argc, char *argv[])
static void
getfile(void)
{
- char *p;
+ char *p, *sp;
char *endp;
char **ep;
int c;
+ int len;
int multisep = (flags & ONEISEPONLY ? 0 : 1);
int nullpad = flags & NULLPAD;
char **padto;
@@ -159,11 +160,13 @@ getfile(void)
*ep = blank;
else /* store column entry */
*ep = p;
+ sp = p;
while (p < endp && *p != isep)
p++; /* find end of entry */
*p = '\0'; /* mark end of entry */
- if (maxlen < p - *ep) /* update maxlen */
- maxlen = p - *ep;
+ len = p - sp;
+ if (maxlen < len) /* update maxlen */
+ maxlen = len;
INCR(ep); /* prepare for next entry */
}
irows++; /* update row count */