all: avoid quoting file names when possible
commit08e8fd7e38f2dae7c69c54eb22d508b6517e66e5
authorPádraig Brady <P@draigBrady.com>
Sun, 1 Nov 2015 18:53:26 +0000 (1 18:53 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 4 Nov 2015 23:30:14 +0000 (4 23:30 +0000)
tree63d021e305cd93bea445f9484fe8b3446dda2c3d
parent1e8f9afac53a628dbc64e62bea53eb2da29c47fa
all: avoid quoting file names when possible

Quote file names using the "shell-escape" or "shell-escape-always"
methods, which quote as appropriate for most shells,
and better support copy and paste of presented names.
The "always" variant is used when the file name is
embedded in an error message with surrounding spaces.

* cfg.mk (sc_error_shell_quotes): A new syntax check rule
to suggest quotef() where appropriate.
(sc_error_shell_always_quotes): Likewise for quoteaf().
* src/system.h (quotef): A new define to apply shell quoting
when needed.  I.E. when shell character or ':' is present.
(quoteaf): Likewise, but always quote.
* src/*.c: Use quotef() and quoteaf() rather than quote()
where appropriate.
* tests/: Adjust accordingly.
98 files changed:
cfg.mk
gl/lib/root-dev-ino.h
src/base64.c
src/cat.c
src/chcon.c
src/chgrp.c
src/chmod.c
src/chown-core.c
src/chown.c
src/chroot.c
src/cksum.c
src/comm.c
src/copy.c
src/coreutils.c
src/cp.c
src/csplit.c
src/cut.c
src/date.c
src/dd.c
src/df.c
src/dircolors.c
src/du.c
src/expand.c
src/expr.c
src/find-mount-point.c
src/fmt.c
src/fold.c
src/head.c
src/hostname.c
src/install.c
src/join.c
src/link.c
src/ln.c
src/ls.c
src/md5sum.c
src/mkdir.c
src/mkfifo.c
src/mknod.c
src/mv.c
src/nl.c
src/nohup.c
src/od.c
src/paste.c
src/pathchk.c
src/pinky.c
src/pr.c
src/ptx.c
src/pwd.c
src/readlink.c
src/realpath.c
src/remove.c
src/rm.c
src/rmdir.c
src/runcon.c
src/selinux.c
src/shred.c
src/shuf.c
src/sort.c
src/split.c
src/stat.c
src/stty.c
src/sum.c
src/sync.c
src/system.h
src/tac.c
src/tail.c
src/tee.c
src/touch.c
src/truncate.c
src/tsort.c
src/unexpand.c
src/uniq.c
src/unlink.c
src/uptime.c
src/users.c
src/wc.c
src/who.c
tests/df/total-unprocessed.sh
tests/du/files0-from-dir.sh
tests/du/files0-from.pl
tests/du/move-dir-while-traversing.sh
tests/ln/hard-to-sym.sh
tests/misc/dircolors.pl
tests/misc/ls-misc.pl
tests/misc/md5sum.pl
tests/misc/readlink-fp-loop.sh
tests/misc/sha1sum.pl
tests/misc/shred-passes.sh
tests/misc/sort-files0-from.pl
tests/misc/sort.pl
tests/misc/tsort.pl
tests/misc/wc-files0-from.pl
tests/rm/d-1.sh
tests/rm/d-3.sh
tests/rm/r-1.sh
tests/rm/r-2.sh
tests/rm/v-slash.sh
tests/split/l-chunk.sh