The "echo" command was soft-deprecated from the shell programming
language in ~1992. There is no way to use it correctly if:
- the "-e" or "-n" or "-E" or any other options are used
- backslash escape sequences are used
- the printed string contains shell variables containing either of the
above
In recognition of the fact that echo was historically used in many
scripts, some of which avoided these issues and therefore succeeded when
run, the "echo" command was NOT marked as obsolescent, out of fear that
marking it as obsolescent would lead to vendors removing "echo" entirely
and breaking existing scripts (or at least, the subset of scripts which
managed to work correctly).
However, it is warned against, that after 1992 you should avoid writing
new code that uses "echo" and instead use "printf".
printf has an actual definition of its behavior, which echo did not, and
that behavior is to interpret backslash escapes in the first parameter,
which is necessary by this Makefile.am in order to embed newlines into
the generated libtool file. Simply replacing "echo -e" with "printf"
will therefore correctly and reliably do the intended functionality. We
also add one final embedded newline to avoid producing a file without an
end-of-line character on the last line of the file.
Fixes: https://github.com/ckolivas/lrzip/issues/257
Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Previously help and all usage errors resulted in exit status 255, which
is unconventional.
Treat help as non-error, and error with status 2 for usage errors to
match more common command behavior.
The exit status of -? changes to that of an usage error, even though it
is listed as one of the help invoking options, due to getopt_long
behavior.
read_fdhist() cannot be called after write_1g() is called, in case that write() caused a switch to !TMP_OUTBUF, moving the read pointer.
read_fdhist() should only be called immediately after seekto_fdhist()
In this case, only one call to read_fdhist() was enough, before the loop, as subsuequent calls only gave repeats of the same data.