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

Sadia Akhter sakhter at stevens.edu
Mon Oct 6 17:35:42 EDT 2014


Thanks for your reply. I have used getopt() and I have implemented it this way. My observation is that the standard ls command in Unix does not work in this way. I have checked it in Linux Lab. So my question was "why", not "how".

-Sadia


On Oct 6, 2014, at 3:58 PM, Pengfei Zhang <pzhang11 at stevens.edu> wrote:

> I implement this by using getopt, it would get options as the order you input. So I just set when I get -1, set nflag and lflag to 0, vice verse. The last one in the argument list would be set to 1, other 2 options would be set to 0.
> Hope that helps.
> 
> Pengfei Zhang
> 
> On Mon, Oct 6, 2014 at 3:41 PM, Sadia Akhter <sakhter at stevens.edu> wrote:
> Hi,
> 
> 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. 
> 
> Is the deviation from the standard intentional? So which one should we implement? 
> 
> Thanks,
> Sadia
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs631apue
> 
> 
> 
> 
> -- 
> Best regards
> Pengfei Zhang
> ---------------------------------------------------------------------------
> <未标题-1.jpg>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20141006/f6a16a73/attachment.html>


More information about the cs631apue mailing list