[cs631apue] midterm project: combination of option l,n,1 in ls

Jan Schaumann jschauma at stevens.edu
Mon Oct 6 17:45:53 EDT 2014

Sadia Akhter <sakhter at stevens.edu> wrote:
> In the assignment, it says, "The ?1, ?l, and ?n options override each
> other; the last one specified determines the format used."  I have
> implemented it this way. But when I was testing it by comparing with
> the ls command in Unix, I found that -n overrides -l, -1; and -l
> overrides only -1. So the standard behavior is different from that
> what was given in the midterm specification. 

I think it's just a confusing phrasing in the manual page.  '-n' is the
same as '-l', modulo uid/gid instead of username/groupname.  So '-n'
overrides '-1', just as '-l' does.

However, '-l' and '-n' don't override _each other_: if '-n' is given,
then you get '-l' with uid/gid regardless of whether or not '-l' is
_also_ specified.

I've changed the manual page to read

"The -1 and -l options override each other, as do the -1 and -n options;
the last one specified determines the format used."


Does that make it clearer?


More information about the cs631apue mailing list