Introducing base64(1)

From: Piotr P. Stefaniak <>
Date: Mon, 22 Nov 2021 19:16:45 UTC
Hello archers,

I've prepared a short series of changes: "Conflate uudecode and uuencode" "b64encode: implement -w to wrap lines" "Implement base64(1)"

First, I modularize uuencode and uudecode by wrapping them in
bin2text2bin.c ("binary to text to binary"). The program will be
installed as bin2text2bin, uuencode, uudecode, b64encode, and b64decode
and will be responsible for running the coders according to their
historical behavior.

Additionally, bin2text2bin will be able to take a parameter designating
the coder and accept all its options in this form:
bin2text2bin <coder> [options]
and the behavior should be the same as if
<coder> [options]
was invoked.
This has the advantage that adding coders won't require installing them
as binaries. I think quoted-printable or yEnc would be nice, but
currently I have no plans to implement those.

Second, I implement an option to b64encode that sets the column after
which lines wrap. Plus, I accidentally optimize the function that
produces the encoded output.

Third, I use the existing b64encode and b64decode implementation and the
newly implemented option to call it as base64, respecting the syntax of
that program's invocation.

Corrections, bug reports and other thoughts welcome.