Lots of petty clean-up in evalfunction.c

Make variables more local, split long lines, kill some pointless
comments.  After an if stanza that returns, don't bother putting
subsequent code into an else clause unless it helps readability.
Eliminate some pointless copying of values via intermediate buffers;
and unused argcount variable.  Skip some pointless initializers (of
variables about to be assigned to in the conditions of while loops).
Diverse simplifications of the logic of functions and avoidance of
duplications of clean-up.  Fold separate conditions with the same code
together with || to make visible the similarity of the checks.  Use
strlcpy() in preference to snprintf() when it suffices; at least use
the right buffer size when it doesn't.  Indent comments with code.
Skip lots of pointless setting of variables to what an initializer had
already set.

Reworked some looping over lines of files to condition the loop on
running out of lines, moving the EOF check out of the loop in the
process and avoiding duplication of clean-up code.  Fixed a leak (on
file read error) in one of those cases.
(cherry picked from commit c9c1c544c995525cf4d32e0de548f88f987c29e7)

Conflicts:

	libpromises/evalfunction.c
Make sure we get correct number (3) from wc by specifying line count.

(cherry picked from commit f89ba4e12964b4cbe0f833d1131ea27a4da7fefc)
Add "ls" to tools list, used in 10_files/03_transform/003.cf.

(cherry picked from commit bf26abdb1bdf33d20974eb25168f0d138435afcb)
Fix sporadic failure of 10_files/03_transform/003.cf.

Don't use the same directory to hold the counter as the one who holds
the transformed files. Otherwise it may or may not be included
in the result, depending on file system order, since we use depth
search.

(cherry picked from commit 5909c367861910f80381a0d5d9f918bb04a1abb1)