Finish up cols(1)

This commit is contained in:
FRIGN
2015-02-01 00:55:22 +01:00
parent 7cdb24d085
commit 5a20d0e9d7
3 changed files with 16 additions and 14 deletions

6
cols.c
View File

@@ -12,7 +12,7 @@
#include "util.h"
static size_t chars = 65;
static int cflag;
static int cflag;
static struct linebuf b = EMPTY_LINEBUF;
static size_t n_columns;
@@ -58,8 +58,8 @@ main(int argc, char *argv[])
for (l = 0; l < b.nlines; ++l) {
len = utflen(b.lines[l]);
bytes = strlen(b.lines[l]);
if (len > 0 && b.lines[l][bytes-1] == '\n') {
b.lines[l][bytes-1] = '\0';
if (len > 0 && b.lines[l][bytes - 1] == '\n') {
b.lines[l][bytes - 1] = '\0';
--len;
}
if (len > maxlen)