diff options
-rw-r--r-- | usr.bin/fold/fold.1 | 4 | ||||
-rw-r--r-- | usr.bin/fold/fold.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/fold/fold.1 b/usr.bin/fold/fold.1 index c0c2246..c603487 100644 --- a/usr.bin/fold/fold.1 +++ b/usr.bin/fold/fold.1 @@ -48,7 +48,7 @@ The .Nm utility is a filter which folds the contents of the specified files, or the standard input if no files are specified, -breaking the lines to have a maximum of 80 characters. +breaking the lines to have a maximum of 80 columns. .Pp The options are as follows: .Bl -tag -width indent @@ -61,7 +61,7 @@ Fold line after the last blank character within the first .Ar width column positions (or bytes). .It Fl w Ar width -Specify a line width to use instead of the default 80 characters. +Specify a line width to use instead of the default 80 columns. .Ar Width should be a multiple of 8 if tabs are present, or the tabs should be expanded using diff --git a/usr.bin/fold/fold.c b/usr.bin/fold/fold.c index 39f8bfa..49dbb0e 100644 --- a/usr.bin/fold/fold.c +++ b/usr.bin/fold/fold.c @@ -171,7 +171,8 @@ fold(width) indx -= space; col = 0; for (i = 0; i < indx; i++) - col = newpos(col, buf[i]); + col = newpos(col, + (unsigned char)buf[i]); } else { fwrite(buf, 1, indx, stdout); col = indx = 0; @@ -214,7 +215,8 @@ newpos(col, ch) col = (col + 8) & ~7; break; default: - ++col; + if (isprint(ch)) + ++col; break; } |