diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-11-01 18:53:26 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-11-04 23:30:14 +0000 |
commit | 08e8fd7e38f2dae7c69c54eb22d508b6517e66e5 (patch) | |
tree | 63d021e305cd93bea445f9484fe8b3446dda2c3d /src/join.c | |
parent | 1e8f9afac53a628dbc64e62bea53eb2da29c47fa (diff) | |
download | coreutils-08e8fd7e38f2dae7c69c54eb22d508b6517e66e5.tar.xz |
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.
Diffstat (limited to 'src/join.c')
-rw-r--r-- | src/join.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/join.c b/src/join.c index ffef70f77..08af0156a 100644 --- a/src/join.c +++ b/src/join.c @@ -971,7 +971,7 @@ add_file_name (char *name, char *names[2], switch (operand_status[op0]) { case MUST_BE_OPERAND: - error (0, 0, _("extra operand %s"), quote (name)); + error (0, 0, _("extra operand %s"), quoteaf (name)); usage (EXIT_FAILURE); case MIGHT_BE_J1_ARG: @@ -1183,18 +1183,18 @@ main (int argc, char **argv) fp1 = STREQ (g_names[0], "-") ? stdin : fopen (g_names[0], "r"); if (!fp1) - error (EXIT_FAILURE, errno, "%s", quote (g_names[0])); + error (EXIT_FAILURE, errno, "%s", quotef (g_names[0])); fp2 = STREQ (g_names[1], "-") ? stdin : fopen (g_names[1], "r"); if (!fp2) - error (EXIT_FAILURE, errno, "%s", quote (g_names[1])); + error (EXIT_FAILURE, errno, "%s", quotef (g_names[1])); if (fp1 == fp2) error (EXIT_FAILURE, errno, _("both files cannot be standard input")); join (fp1, fp2); if (fclose (fp1) != 0) - error (EXIT_FAILURE, errno, "%s", quote (g_names[0])); + error (EXIT_FAILURE, errno, "%s", quotef (g_names[0])); if (fclose (fp2) != 0) - error (EXIT_FAILURE, errno, "%s", quote (g_names[1])); + error (EXIT_FAILURE, errno, "%s", quotef (g_names[1])); if (issued_disorder_warning[0] || issued_disorder_warning[1]) return EXIT_FAILURE; |