The source code seems to have, over time, become less self-consistent
in style. In order to not have to keep this up manually, switch over
indenting to clang-format. A .clang-format file is provided to give
repeatable results.
The main difference is switching from tabs to non-tabs
usage. Otherwise the changes are mostly minor and leading to more
consistency. Contributions to the format style welcome!
Nota bene: this should have had no code impact. Any actual code
changes (beyond indenting) are bugs in the re-indent process.
There are three "tables" with structure initialization lists in mt.c,
which look like they were intended to be nicely-aligned, but over time
they got out of alignment.
Redo the alignment by unwrapping the lines and using Emacs'
align-regex, even though this leads to an exception of ~130 line
length for the 'cmds' table, since it leads to a very readable table
(on large terminals). Also protect these regions from clang-format, in
preparation for full file re-indents.
Short of moving to autotools, this is the best that can be done:
- move the version from hardcoded in the .c files, to a
dynamically-built `version.h` file so that we only declare the
version in one place
- build a better dist file (.tar.gz) by explicitly selecting which
files to copy, instead of unbounded recursion from the source
directory
- ensure that the files being copied to the archive have a sane
user/group and mode
- add a distcheck target that simply reuses the archive to build and
run the programs, and then regenerate the archive from itself
autotools would solve all this by default, but still feels too
heavyweight for just two .c files.
Additionall, drop the .lsm file. It seems mostly useless these days;
I'll be happy to reinstate it however if anyone cares.
While looking at Fedora's build spec for mt-st, I saw that they recode
the README.stinit file to UTF-8; this makes a lot of sense, so let's
recode all non-UTF files in UTF-8.
When using the default tape device (no $TAPE env. var and no explicit
tape given), check that it is indeed a character device; this will
help with better error messages on systems using udev, where /dev/tape
is a directory instead.