>From 2a887d28aacb6135cdacb9c8776385b8e4d6ab38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Tue, 12 Mar 2013 13:43:08 +0000 Subject: [PATCH] doc: clarify stat the meaning of --format="%t %T" * src/stat.c (usage): Mention sthat the values are only defined for character and block special files. * doc/coreutils.texi (stat invication): Likewise. Also mention st_rdev. Reported in http://bugs.gnu.org/13927 --- doc/coreutils.texi | 9 +++++++-- src/stat.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index c6b3b32..8f1df45 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -11631,8 +11631,8 @@ The valid @var{format} directives for files with @option{--format} and @item %N - Quoted file name with dereference if symbolic link @item %o - Optimal I/O transfer size hint @item %s - Total size, in bytes address@hidden %t - Major device type in hex address@hidden %T - Minor device type in hex address@hidden %t - Major device type in hex (see below) address@hidden %T - Minor device type in hex (see below) @item %u - User ID of owner @item %U - User name of owner @item %w - Time of file birth, or @samp{-} if unknown @@ -11645,6 +11645,11 @@ The valid @var{format} directives for files with @option{--format} and @item %Z - Time of last change as seconds since Epoch @end itemize +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 +represent other quantities. + The @samp{%W}, @samp{%X}, @samp{%Y}, and @samp{%Z} formats accept a precision preceded by a period to specify the number of digits to print after the decimal point. For example, @samp{%.3X} outputs the diff --git a/src/stat.c b/src/stat.c index 2326698..a1938a7 100644 --- a/src/stat.c +++ b/src/stat.c @@ -1393,8 +1393,8 @@ The valid format sequences for files (without --file-system):\n\ %N quoted file name with dereference if symbolic link\n\ %o optimal I/O transfer size hint\n\ %s total size, in bytes\n\ - %t major device type in hex\n\ - %T minor device type in hex\n\ + %t major device type in hex, for character/block device special files\n\ + %T minor device type in hex, for character/block device special files\n\ "), stdout); fputs (_("\ %u user ID of owner\n\ -- 1.7.7.6