summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-03 08:53:36 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2009-10-03 08:53:36 (GMT)
commit0683d4d633b150b6a292ca5279a87c7ee2790b2e (patch)
tree5a2b3f698daf81c8a10dbbd2346dc1b65c5a96d4
parent76c7d9500a535ba7cfdf2c040324e72f17c803fe (diff)
downloadbusybox-0683d4d633b150b6a292ca5279a87c7ee2790b2e.tar.gz
busybox-0683d4d633b150b6a292ca5279a87c7ee2790b2e.tar.bz2
ls: add standards doc; record author of "total NNNN" code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/ls.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 7fb6b2c..31abbc9 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -584,6 +584,16 @@ static void showfiles(struct dnode **dn, unsigned nfiles)
#if ENABLE_DESKTOP
+/* http://www.opengroup.org/onlinepubs/9699919799/utilities/ls.html
+ * If any of the -l, -n, -s options is specified, each list
+ * of files within the directory shall be preceded by a
+ * status line indicating the number of file system blocks
+ * occupied by files in the directory in 512-byte units if
+ * the -k option is not specified, or 1024-byte units if the
+ * -k option is specified, rounded up to the next integral
+ * number of units.
+ */
+/* by Jorgen Overgaard (jorgen AT antistaten.se) */
static off_t calculate_blocks(struct dnode **dn, int nfiles)
{
uoff_t blocks = 1;
@@ -593,7 +603,7 @@ static off_t calculate_blocks(struct dnode **dn, int nfiles)
nfiles--;
}
- /* Even though POSIX says use 512 byte blocks, coreutils use 1k */
+ /* Even though standard says use 512 byte blocks, coreutils use 1k */
/* Actually, we round up by calculating (blocks + 1) / 2,
* "+ 1" was done when we initialized blocks to 1 */
return blocks >> 1;