aboutsummaryrefslogtreecommitdiff
path: root/bin/ls/ls.c
diff options
context:
space:
mode:
authorPaul Traina <pst@FreeBSD.org>1994-09-19 07:49:56 +0000
committerPaul Traina <pst@FreeBSD.org>1994-09-19 07:49:56 +0000
commit475727a09f5fdd22aa10a1a8658c25b103f904b4 (patch)
treecf0a2a31ce925702a635a6801dce68c240bd4a56 /bin/ls/ls.c
parentec5d3c392aa83e8831603ad5015610a8074104a0 (diff)
downloadsrc-475727a09f5fdd22aa10a1a8658c25b103f904b4.tar.gz
src-475727a09f5fdd22aa10a1a8658c25b103f904b4.zip
Add support for '-k' option to print file allocation space in 'K' instead of
system blocks. This is semi-original code, not the same way this crufty option was handled in FreeBSD 1.x.
Notes
Notes: svn path=/head/; revision=2889
Diffstat (limited to 'bin/ls/ls.c')
-rw-r--r--bin/ls/ls.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 1cea616821d2..db1ee39a4f66 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -75,6 +75,7 @@ int f_accesstime; /* use time of last access */
int f_column; /* columnated format */
int f_flags; /* show flags associated with a file */
int f_inode; /* print inode */
+int f_kblocks; /* print size in kilobytes */
int f_listdir; /* list actual directory, not contents */
int f_listdot; /* list files beginning with . */
int f_longform; /* long listing format */
@@ -119,7 +120,7 @@ main(argc, argv)
f_listdot = 1;
fts_options = FTS_PHYSICAL;
- while ((ch = getopt(argc, argv, "1ACFLRTacdfgiloqrstu")) != EOF) {
+ while ((ch = getopt(argc, argv, "1ACFLRTacdfgikloqrstu")) != EOF) {
switch (ch) {
/*
* The -1, -C and -l options all override each other so shell
@@ -175,6 +176,9 @@ main(argc, argv)
case 'i':
f_inode = 1;
break;
+ case 'k':
+ f_kblocks = 1;
+ break;
case 'o':
f_flags = 1;
break;
@@ -218,7 +222,9 @@ main(argc, argv)
/* If -l or -s, figure out block size. */
if (f_longform || f_size) {
(void)getbsize(&notused, &blocksize);
- blocksize /= 512;
+ blocksize /= 512;
+ if (f_kblocks)
+ blocksize *= 2;
}
/* Select a sort function. */