summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-08-16 16:47:17 +0100
committerPádraig Brady <P@draigBrady.com>2015-09-03 01:11:32 +0100
commit895a56c53118ea1ed97e0641a413ca4793afaa20 (patch)
tree045e10cc7014c17686290859ca935d36d1461aa6
parentdf3b9120b4b0444bedbe53ef7a2cc5bb28fb3943 (diff)
downloadcoreutils-895a56c53118ea1ed97e0641a413ca4793afaa20.tar.xz
ls,ptx: restrict quotearg use to file name output
* src/ls.c (getenv_quoting_style, decode_switches, parse_ls_color): Use quote() rather than quotearg(), as the latter defaults to outputting the input unquoted. * src/ptx.c (main): Likewise.
-rw-r--r--src/ls.c8
-rw-r--r--src/ptx.c5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/ls.c b/src/ls.c
index 72e4af6c7..7c22b66fd 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1619,7 +1619,7 @@ decode_switches (int argc, char **argv)
if (p && *p && ! set_line_length (p))
error (0, 0,
_("ignoring invalid width in environment variable COLUMNS: %s"),
- quotearg (p));
+ quote (p));
}
#ifdef TIOCGWINSZ
@@ -1647,7 +1647,7 @@ decode_switches (int argc, char **argv)
{
error (0, 0,
_("ignoring invalid tab size in environment variable TABSIZE: %s"),
- quotearg (p));
+ quote (p));
}
}
}
@@ -2446,7 +2446,7 @@ parse_ls_color (void)
}
}
if (state == PS_FAIL)
- error (0, 0, _("unrecognized prefix: %s"), quotearg (label));
+ error (0, 0, _("unrecognized prefix: %s"), quote (label));
}
break;
@@ -2507,7 +2507,7 @@ getenv_quoting_style (void)
else
error (0, 0,
_("ignoring invalid value of environment variable QUOTING_STYLE: %s"),
- quotearg (q_style));
+ quote (q_style));
}
}
diff --git a/src/ptx.c b/src/ptx.c
index 3aea4cdf2..2ccabb734 100644
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -28,7 +28,6 @@
#include "error.h"
#include "fadvise.h"
#include "quote.h"
-#include "quotearg.h"
#include "read-file.h"
#include "stdio--.h"
#include "xstrtol.h"
@@ -1949,7 +1948,7 @@ main (int argc, char **argv)
if (xstrtoul (optarg, NULL, 0, &tmp_ulong, NULL) != LONGINT_OK
|| ! (0 < tmp_ulong && tmp_ulong <= INT_MAX))
error (EXIT_FAILURE, 0, _("invalid gap width: %s"),
- quotearg (optarg));
+ quote (optarg));
gap_size = tmp_ulong;
break;
}
@@ -1976,7 +1975,7 @@ main (int argc, char **argv)
if (xstrtoul (optarg, NULL, 0, &tmp_ulong, NULL) != LONGINT_OK
|| ! (0 < tmp_ulong && tmp_ulong <= INT_MAX))
error (EXIT_FAILURE, 0, _("invalid line width: %s"),
- quotearg (optarg));
+ quote (optarg));
line_width = tmp_ulong;
break;
}