summaryrefslogtreecommitdiffstats
path: root/usr.bin/rs
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/rs')
-rw-r--r--usr.bin/rs/rs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c
index 429dadc..2f5e92b 100644
--- a/usr.bin/rs/rs.c
+++ b/usr.bin/rs/rs.c
@@ -184,7 +184,7 @@ void
putfile()
{
register char **ep;
- register int i, j;
+ register int i, j, k;
ep = elem;
if (flags & TRANSPOSE)
@@ -194,9 +194,10 @@ putfile()
putchar('\n');
}
else
- for (i = 0; i < orows; i++) {
- for (j = 0; j < ocols; j++)
- prints(*ep++, j);
+ for (i = k = 0; i < orows; i++) {
+ for (j = 0; j < ocols; j++, k++)
+ if (k < nelem)
+ prints(ep[k], j);
putchar('\n');
}
}
OpenPOWER on IntegriCloud