summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-11-03 15:36:48 +0000
committerPádraig Brady <P@draigBrady.com>2016-11-05 00:44:06 +0000
commit9ad400f1adfcb90289107afcbc49469560ba14b5 (patch)
tree3c6caf709f0713364ac2b9d9270bff211052b414 /doc
parent6f64cb64f7e1f14bb8968a8838cc3bbe9d28d10b (diff)
downloadcoreutils-9ad400f1adfcb90289107afcbc49469560ba14b5.tar.xz
stat: make --format=%N honor the QUOTING_STYLE env var
* doc/coreutils.texi (stat invocation): Describe the QUOTING_STYLE values now supported. * src/stat.c (getenv_quoting_style): A new function called from main, that sets the default quoting style for quotearg. (main): Call getenv_quoting_style() when %N specified. * tests/misc/stat-fmt.sh: Add a test case. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/23422
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 95419b44e..927e552ab 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7724,6 +7724,7 @@ Use style @var{word} to quote file names and other strings that may
contain arbitrary characters. The @var{word} should
be one of the following:
+@macro quotingStyles
@table @samp
@item literal
Output strings as-is; this is the same as the @option{-N} or
@@ -7761,6 +7762,8 @@ surrounding quotation marks appropriate for the locale, and quote
@t{'like this'} instead of @t{"like
this"} in the default C locale. This looks nicer on many displays.
@end table
+@end macro
+@quotingStyles
You can specify the default value of the @option{--quoting-style} option
with the environment variable @env{QUOTING_STYLE}@. If that environment
@@ -11775,7 +11778,7 @@ The valid @var{format} directives for files with @option{--format} and
@item %i - Inode number
@item %m - Mount point (See note below)
@item %n - File name
-@item %N - Quoted file name with dereference if symbolic link
+@item %N - Quoted file name with dereference if symbolic link (see below)
@item %o - Optimal I/O transfer size hint
@item %s - Total size, in bytes
@item %t - Major device type in hex (see below)
@@ -11797,6 +11800,11 @@ to control the zero padding of the output with the @samp{#} and @samp{0}
printf flags. For example to pad to at least 3 wide while making larger
numbers unambiguously octal, you can use @samp{%#03a}.
+The @samp{%N} format can be set with the environment variable
+@env{QUOTING_STYLE}@. If that environment variable is not set,
+the default value is @samp{shell-escape}. Valid quoting styles are:
+@quotingStyles
+
The @samp{%t} and @samp{%T} formats operate on the st_rdev member of
the stat(2) structure, and are only defined for character and block
special files. On some systems or file types, st_rdev may be used to