Add tablist support and a mandoc-manpage to expand(1)

and mark it as finished in the README.

This is another example showing how broken the GNU coreutils are:

$ echo -e "äää\tüüü\tööö" | gnu-expand -t "5,10,20"
äää    üüü    ööö
$ echo -e "äää\tüüü\tööö" | sbase-expand -t "5,10,20"
äää  üüü  ööö

This is due to the fact that they are still not UTF8-aware and
actually see "ä" as two single characters, expanding the "äää" with
4 spaces to a tab of length 10.
The correct way however is to expand the "äää" with 2 spaces to a
tab of length 5.
One can only imagine how this silently breaks a lot of code around
the world.
WHAT WERE THEY THINKING?
This commit is contained in:
FRIGN
2015-01-25 14:31:02 +01:00
parent 48bf88851a
commit 692c11bf2b
3 changed files with 143 additions and 77 deletions

View File

@@ -1,25 +1,50 @@
.TH EXPAND 1 sbase\-VERSION
.SH NAME
expand \- expand tabs to spaces
.SH SYNOPSIS
.B expand
.RB [ \-t
.IR n ]
.RI [ file ...]
.SH DESCRIPTION
expand processes the named files or the standard input, writing the
standard output with tabs changed into spaces. Backspace characters
are preserved into the output and decrement the column count for tab
calculations.
.SH OPTIONS
.TP
.BI \-i
Only change tabs to spaces at the start of lines.
.TP
.BI \-t " n"
Expand tabs to
.I n
spaces. We currently support only a single numerical argument.
.SH SEE ALSO
.IR unexpand (1),
.IR fold (1)
.Dd January 25, 2015
.Dt EXPAND 1 sbase\-VERSION
.Sh NAME
.Nm expand
.Nd expand tabs to spaces
.Sh SYNOPSIS
.Nm expand
.Op Fl i
.Op Fl t Ar tablist
.Op Ar file ...
.Sh DESCRIPTION
.Nm
converts tabs to spaces in each
.Ar file
as specified in
.Ar tablist .
If no file is given,
.Nm
reads from stdin.
.Pp
Backspace characters are preserved and decrement the column count
for tab calculations.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl i
Only expand tabs at the beginning of lines, i.e. expand each
line until a character different from '\et' and ' ' is reached.
.It Fl t Ar tablist
Specify tab size or tabstops.
.Ar tablist
is a list of one (in the former case) or multiple (in the latter case)
strictly positive integers separated by ' ' or ','.
.Pp
The default
.Ar tablist
is "8".
.El
.Sh SEE ALSO
.Xr unexpand 1 ,
.Xr fold 1
.Sh STANDARDS
The
.Nm
utility is compliant with the
.St -p1003.1-2008
specification.
.Pp
The
.Op Fl i
flag is an extension to that specification