omit trailing whitespace for print_columns

This commit is contained in:
tg 2015-07-05 14:47:41 +00:00
parent 62e27c3e07
commit 69eac312de
1 changed files with 9 additions and 8 deletions

17
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.234 2015/07/05 14:43:07 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.235 2015/07/05 14:47:41 tg Exp $");
#define KSH_CHVT_FLAG
#ifdef MKSH_SMALL
@ -1283,13 +1283,14 @@ print_columns(struct shf *shf, unsigned int n,
nspace = 1;
for (r = 0; r < rows; r++) {
for (c = 0; c < cols; c++) {
i = c * rows + r;
if (i < n) {
(*func)(str, max_oct, i, arg);
shf_fprintf(shf, "%*s", max_col, str);
if (i + rows < n)
shf_fprintf(shf, "%*s", nspace, null);
}
if ((i = c * rows + r) >= n)
break;
(*func)(str, max_oct, i, arg);
if (i + rows >= n)
shf_puts(str, shf);
else
shf_fprintf(shf, "%*s%*s",
max_col, str, nspace, null);
}
shf_putchar('\n', shf);
}