diff options
author | 2015-11-14 17:03:02 +0000 | |
---|---|---|
committer | 2015-11-14 17:03:02 +0000 | |
commit | fb0bf2738412d7e424a0caf266ed65e53c8fd284 (patch) | |
tree | 2eca0ebc5fafbfcc27372c8a0613a664a0d9c545 | |
parent | Remove mrtdebug and reduce differences with the v6 version. (diff) | |
download | wireguard-openbsd-fb0bf2738412d7e424a0caf266ed65e53c8fd284.tar.xz wireguard-openbsd-fb0bf2738412d7e424a0caf266ed65e53c8fd284.zip |
Fix the obvious bug that with -z, every column was at least as wide
as the previous one. While here, shorten the -z code by one line.
-rw-r--r-- | usr.bin/rs/rs.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c index 5d702cf4509..f8ca9bbb46a 100644 --- a/usr.bin/rs/rs.c +++ b/usr.bin/rs/rs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rs.c,v 1.28 2015/11/10 14:42:41 schwarze Exp $ */ +/* $OpenBSD: rs.c,v 1.29 2015/11/14 17:03:02 schwarze Exp $ */ /*- * Copyright (c) 1993 @@ -276,20 +276,19 @@ prepfile(void) if (!(colwidths = calloc(ocols, sizeof(short)))) errx(1, "malloc: No gutter space"); if (flags & SQUEEZE) { - if (flags & TRANSPOSE) - for (ep = elem, i = 0; i < ocols; i++) { + for (ep = elem, i = 0; i < ocols; i++) { + max = 0; + if (flags & TRANSPOSE) { for (j = 0; j < orows; j++) if ((n = strlen(*ep++)) > max) max = n; - colwidths[i] = max + gutter; - } - else - for (ep = elem, i = 0; i < ocols; i++) { + } else { for (j = i; j < nelem; j += ocols) if ((n = strlen(ep[j])) > max) max = n; - colwidths[i] = max + gutter; } + colwidths[i] = max + gutter; + } } else { for (i = 0; i < ocols; i++) colwidths[i] = colw; |