omit trailing whitespace for print_columns

This commit is contained in:
tg 2015-07-05 14:47:41 +00:00
parent 62e27c3e07
commit 69eac312de

17
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h> #include <grp.h>
#endif #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 #define KSH_CHVT_FLAG
#ifdef MKSH_SMALL #ifdef MKSH_SMALL
@ -1283,13 +1283,14 @@ print_columns(struct shf *shf, unsigned int n,
nspace = 1; nspace = 1;
for (r = 0; r < rows; r++) { for (r = 0; r < rows; r++) {
for (c = 0; c < cols; c++) { for (c = 0; c < cols; c++) {
i = c * rows + r; if ((i = c * rows + r) >= n)
if (i < n) { break;
(*func)(str, max_oct, i, arg); (*func)(str, max_oct, i, arg);
shf_fprintf(shf, "%*s", max_col, str); if (i + rows >= n)
if (i + rows < n) shf_puts(str, shf);
shf_fprintf(shf, "%*s", nspace, null); else
} shf_fprintf(shf, "%*s%*s",
max_col, str, nspace, null);
} }
shf_putchar('\n', shf); shf_putchar('\n', shf);
} }