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.
This commit is contained in:
pst 1994-09-19 07:49:56 +00:00
parent bd23e306ee
commit 23e4aed0da
2 changed files with 11 additions and 2 deletions

View File

@ -104,6 +104,9 @@ symbolic links in the argument list are not indirected through.
Output is not sorted.
.It Fl i
For each file, print the file's file serial number (inode number).
.It Fl k
If the 's' option is specified, print the file size allocation in kilobytes,
not blocks.
.It Fl l
(The lowercase letter ``ell.'') List in long format. (See below.)
If the output is to a terminal, a total sum for all the file

View File

@ -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. */