]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: mention the '0#' printf flags with stat %a
authorPádraig Brady <P@draigBrady.com>
Tue, 12 Jan 2016 13:12:37 +0000 (13:12 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 13 Jan 2016 11:16:39 +0000 (11:16 +0000)
* src/stat.c (usage): Mention the '#' and '0' flags are useful with %a.
* doc/coreutils.texi (stat invocation): Likewise.  Also give an example
printing unambiguous octal output.
Reported at http://bugs.debian.org/810539

doc/coreutils.texi
src/stat.c

index f7bdc4274c35f6084bd4c4825a5fc41742982013..eb5159a445f05056f65e9c54a4f4942370565e65 100644 (file)
@@ -11738,7 +11738,7 @@ The valid @var{format} directives for files with @option{--format} and
 @option{--printf} are:
 
 @itemize @bullet
-@item %a - Access rights in octal
+@item %a - Access rights in octal (note @samp{#} and @samp{0} printf flags)
 @item %A - Access rights in human readable form
 @item %b - Number of blocks allocated (see @samp{%B})
 @item %B - The size in bytes of each block reported by @samp{%b}
@@ -11770,6 +11770,11 @@ The valid @var{format} directives for files with @option{--format} and
 @item %Z - Time of last status change as seconds since Epoch
 @end itemize
 
+The @samp{%a} format prints the octal mode, and so it is useful
+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{%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
index 3c6926448b78be0885c134fb059d173b7314f0d5..e11e4318f8572c8032c804b3decf84db44e4499f 100644 (file)
@@ -1453,7 +1453,7 @@ Display file or file system status.\n\
       fputs (_("\n\
 The valid format sequences for files (without --file-system):\n\
 \n\
-  %a   access rights in octal\n\
+  %a   access rights in octal (note '#' and '0' printf flags)\n\
   %A   access rights in human readable form\n\
   %b   number of blocks allocated (see %B)\n\
   %B   the size in bytes of each block reported by %b\n\