ack/util/ack
George Koehler 07b04c64c8 Let ack(1) compile files with non-ASCII names.
This commit changes how ack(1) parses backslashes in its descr files.
Before this commit, ack set the high bit of each character escaped by
a backslash, and later cleared all high bits in command arguments, but
this lost the high bits in non-ASCII filenames.  After this commit,
ack keeps backslashes in strings while processing them.  Functions
scanvars(), scanexpr(), doassign(), unravel(), addargs() now
understand backslashes.  I remove from ack_basename() the warning
about non-ASCII characters.

This commit makes some incompatible changes for backslashes in descr
files.  None of our descr files uses backslashes, except for those
backslashes that continue lines, and there are no changes for those
backslashes.  The problem with non-ASCII filenames had its cause in a
feature that we weren't using.

With this commit, ack now understands backslashes after the = sign in
both "var NAME=value" and "mapflag -flag NAME=value".  Before, ack
never scanned backslashes in "var" lines, so "var A=\{B}" failed to
prevent expansion of B.  Now it does.  Before, ack did scan for
backslashes in the "-flag NAME=" part of "mapflag" lines.  Now it
doesn't, so it is no longer possible to map a flag that contains a
literal space, tab, or star "*".

I removed the expansion of "{{" to "{".  One can use "\{" for a
literal "{", and "\{" now works in "var" lines.  Before and now, ack
never expanded "{" in flags for "mapflag", so the correct way to map a
literal flag "-{" remains "mapflag -{ ...", not "mapflag -{{ ...".
(The other way "mapflag -\{ ..." stops working with this commit.)

Backslashes in strange places, like "{NA\ME}", probably have different
behavior now.

Backslashes in "program" lines now work.  Before, ack scanned for
backslashes there but forgot to clear the high bits later.

Escaping < or > as \< or \> now works, and prevents substitution of
the input or output file paths.  Before, ack only expanded the first <
or > in each argument.  Now, it expands every unescaped < or > in an
argument, but this is an accident of how I rewrote the code.  I don't
suggest to put more than one each of < or > in a command.  The code no
longer optimizes away its recursive calls when the argument is "<".

The code continues to set or clear the high bit NO_SCAN on the first
characters of flags.  This doesn't seem to be a problem, because flags
usually begin with an ASCII hyphen '-'.
2016-11-15 11:33:35 -05:00
..
ack.1.X Remove references to using-machine-name-for-compiler, as we don't do that any more. 2010-08-09 22:47:33 +00:00
ack.h Let ack(1) compile files with non-ASCII names. 2016-11-15 11:33:35 -05:00
build.lua Don't build mktables.c in the ack binary. 2016-11-11 17:06:25 -05:00
data.c Header --> Id 1994-06-24 11:31:16 +00:00
data.h In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
dmach.h Header --> Id 1994-06-24 11:31:16 +00:00
files.c In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
grows.c In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
grows.h In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
list.c In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
list.h In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
main.c In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
mktables.c Add enough return types to the K&R C that the ACK builds (on Linux) using clang 2016-11-10 22:04:18 +01:00
rmach.c Let ack(1) compile files with non-ASCII names. 2016-11-15 11:33:35 -05:00
run.c Let ack(1) compile files with non-ASCII names. 2016-11-15 11:33:35 -05:00
scan.c In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
svars.c Don't print a string after possibly freeing it. 2016-11-13 12:02:35 -05:00
trans.c Let ack(1) compile files with non-ASCII names. 2016-11-15 11:33:35 -05:00
trans.h In util/ack, add prototypes and static to functions. 2016-11-12 21:12:45 -05:00
util.c Let ack(1) compile files with non-ASCII names. 2016-11-15 11:33:35 -05:00