diff --git a/NEWS b/NEWS index 82190d9..256b541 100644 --- a/NEWS +++ b/NEWS @@ -4,16 +4,16 @@ GNU coreutils NEWS -*- outline -*- ** New features + stat now shows the mountpoint of a specified file or directory + in its default output. It also will show this when a format is + explicitly specified through the use of the %m specifier. + cp now accepts the --attributes-only option to not copy file data, which is useful for efficiently modifying files. du recognizes -d N as equivalent to --max-depth=N, for compatibility with FreeBSD. - du now uses less than half as much memory when operating on trees - with many hard-linked files. With --count-links (-l), or when - operating on trees with no hard-linked files, there is no change. - sort now accepts the --debug option, to highlight the part of the line significant in the sort, and warn about questionable options. @@ -42,11 +42,6 @@ GNU coreutils NEWS -*- outline -*- Also errors are no longer suppressed for unsupported file types, and relative sizes are restricted to supported file types. -** Bug fixes - - du no longer multiply counts a file that is a directory or whose - link count is 1, even if the file is reached multiple times by - following symlinks or via multiple arguments. * Noteworthy changes in release 8.5 (2010-04-23) [stable] diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 21cf36d..ea3f142 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -10666,6 +10666,7 @@ The valid @var{format} directives for files with @option{--format} and @item %G - Group name of owner @item %h - Number of hard links @item %i - Inode number +@item %m - Mount point @item %n - File name @item %N - Quoted file name with dereference if symbolic link @item %o - I/O block size diff --git a/gnulib b/gnulib --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4 +Subproject commit 7773f84fe1aa3bb17defad704ee87f2615894ae4-dirty diff --git a/src/Makefile.am b/src/Makefile.am index 0630a06..f090087 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -145,6 +145,7 @@ noinst_HEADERS = \ copy.h \ cp-hash.h \ dircolors.h \ + findmountpoint.h \ fs.h \ group-list.h \ ls.h \ diff --git a/src/stat.c b/src/stat.c index c3730f0..f283437 100644 --- a/src/stat.c +++ b/src/stat.c @@ -68,6 +68,9 @@ #include "quotearg.h" #include "stat-time.h" #include "strftime.h" +#include "findmountpoint.h" +#include "save-cwd.h" +#include "xgetcwd.h" #if USE_STATVFS # define STRUCT_STATVFS struct statvfs @@ -612,6 +615,7 @@ print_stat (char *pformat, size_t prefix_len, char m, struct stat *statbuf = (struct stat *) data; struct passwd *pw_ent; struct group *gw_ent; + char * mp; bool fail = false; switch (m) @@ -679,6 +683,14 @@ print_stat (char *pformat, size_t prefix_len, char m, case 't': out_uint_x (pformat, prefix_len, major (statbuf->st_rdev)); break; + case 'm': + mp = find_mount_point (filename, statbuf); + if (mp) { + out_string (pformat, prefix_len, mp); + } else { + fail = true; + } + break; case 'T': out_uint_x (pformat, prefix_len, minor (statbuf->st_rdev)); break; @@ -1025,6 +1037,7 @@ The valid format sequences for files (without --file-system):\n\ fputs (_("\ %h Number of hard links\n\ %i Inode number\n\ + %m Mount point\n\ %n File name\n\ %N Quoted file name with dereference if symbolic link\n\ %o I/O block size\n\