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/nohup.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/nohup.c')
-rw-r--r-- | src/nohup.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nohup.c b/src/nohup.c index 8cdacedb8..f81d3feea 100644 --- a/src/nohup.c +++ b/src/nohup.c @@ -29,7 +29,6 @@ #include "filenamecat.h" #include "fd-reopen.h" #include "long-options.h" -#include "quote.h" #include "unistd--.h" #define PROGRAM_NAME "nohup" @@ -158,10 +157,10 @@ main (int argc, char **argv) if (out_fd < 0) { int saved_errno2 = errno; - error (0, saved_errno, _("failed to open %s"), quote (file)); + error (0, saved_errno, _("failed to open %s"), quoteaf (file)); if (in_home) error (0, saved_errno2, _("failed to open %s"), - quote (in_home)); + quoteaf (in_home)); return exit_internal_failure; } file = in_home; @@ -172,7 +171,7 @@ main (int argc, char **argv) _(ignoring_input ? N_("ignoring input and appending output to %s") : N_("appending output to %s")), - quote (file)); + quoteaf (file)); free (in_home); } @@ -227,7 +226,7 @@ main (int argc, char **argv) In other words, output the diagnostic if possible, but only if it will go to the original stderr. */ if (dup2 (saved_stderr_fd, STDERR_FILENO) == STDERR_FILENO) - error (0, saved_errno, _("failed to run command %s"), quote (*cmd)); + error (0, saved_errno, _("failed to run command %s"), quoteaf (*cmd)); return exit_status; } |