Christian Hudon wrote:
> In the ls manpage (and in its info manual too, I presume), option -f is
> described as:
>
> -f do not sort, enable -aU, disable -lst
That is true. The question is what else does it do.
> However looking in the neighborhood of option -s, we see:
>
> -s, --size
> print size of each file, in blocks
>
> -S sort by file size
>
> It'd be a good idea to take a look at the code to confirm, but given its
> description, it'd make more sense if -f disabled option -S instead of
> (or in addition to?) option -s.
It would be -S in addition to the -s option. Looking at the code I
can also see that it disables --color and -1 too.
static enum sort_type const sort_types[] =
{
sort_none, sort_time, sort_size, sort_extension, sort_version
};
...
case 'f':
/* Same as enabling -a -U and disabling -l -s. */
ignore_mode = IGNORE_MINIMAL;
sort_type = sort_none;
sort_type_specified = true;
/* disable -l */
if (format == long_format)
format = (isatty (STDOUT_FILENO) ? many_per_line : one_per_line);
print_block_size = false; /* disable -s */
print_with_color = false; /* disable --color */
break;
...
case 's':
print_block_size = true;
break;
...
case 'S':
sort_type = sort_size;
sort_type_specified = true;
break;
It may seem strange that this is documented as it is but the
documented behavior is required by POSIX.
http://www.opengroup.org/onlinepubs/009695399/utilities/ls.html
-f
Force each argument to be interpreted as a directory and list the
name found in each slot. This option shall turn off -l, -t, -s,
and -r, and shall turn on -a; the order is the order in which
entries appear in the directory.
It also has additional behavior too.
Bob
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]