aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-08-11 09:46:36 -0500
committerRob Landley <rob@landley.net>2016-08-11 09:46:36 -0500
commit4460e9f0ed16a3f4dea4dec13f90df9c956b4dc9 (patch)
tree3cb9485b3e7bbda90018b3fafb12fca1cb898fd2 /toys
parent5b360d8da327b38daf0c5b8874fbe55406b70ced (diff)
downloadtoybox-4460e9f0ed16a3f4dea4dec13f90df9c956b4dc9.tar.gz
Matthias Urhahn pointed out that %b returns hardwired 512 byte units
(man 2 stat says so) and %B is the units on %b (I.E. always 512), so change output and help text. This matches what other implementations produce.
Diffstat (limited to 'toys')
-rw-r--r--toys/other/stat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/other/stat.c b/toys/other/stat.c
index 7a6b38d7..082a5ea1 100644
--- a/toys/other/stat.c
+++ b/toys/other/stat.c
@@ -19,8 +19,8 @@ config STAT
(with -f = -c "%n %i %l %t %s %S %b %f %a %c %d")
The valid format escape sequences for files:
- %a Access bits (octal) |%A Access bits (flags)|%b Blocks allocated
- %B Bytes per block |%d Device ID (dec) |%D Device ID (hex)
+ %a Access bits (octal) |%A Access bits (flags)|%b Size/512
+ %B Bytes per %b (512) |%d Device ID (dec) |%D Device ID (hex)
%f All mode bits (hex) |%F File type |%g Group ID
%G Group name |%h Hard links |%i Inode
%m Mount point |%n Filename |%N Long filename
@@ -81,7 +81,7 @@ static void print_stat(char type)
mode_to_string(stat->st_mode, str);
xprintf("%s", str);
} else if (type == 'b') out('u', stat->st_blocks);
- else if (type == 'B') out('u', stat->st_blksize);
+ else if (type == 'B') printf("512");
else if (type == 'd') out('d', stat->st_dev);
else if (type == 'D') out('x', stat->st_dev);
else if (type == 'f') out('x', stat->st_mode);