[cs631apue] Fwd: Some questions on midterm....

Tejas Nadkarni tnadkarn at stevens.edu
Sat Oct 5 14:09:54 EDT 2013


Didn't go to distribution.

---------- Forwarded message ----------
From: Tejas Nadkarni <tnadkarn at stevens.edu>
Date: Sat, Oct 5, 2013 at 2:02 PM
Subject: Re: [cs631apue] Some questions on midterm....
To: Kai Wang <kaikaiw321 at gmail.com>


Thanks, but iterating twice doesn't seem like a good idea. What if you are
calling 'ls -lR /' it's going to traverse every folder and file in the
filesystem twice, you'll be sitting there for a bit before anything happens.

How will -c and -x override -l? They are different. -c and -x appear to be
modifiers of the short format. If you have -l then it will always override
the others.

I'll play around more with the recursive aspect. Thanks.

-Tejas


On Sat, Oct 5, 2013 at 1:59 PM, Kai Wang <kaikaiw321 at gmail.com> wrote:

> Dear Tejas,
>
> - you can iterator all entries twice, first time for maximum column
> length, then print.
>
> - -d will print all entries of depth 0, e.g. roots of all file tree.
>
> - -c,-x will override -l
>
> - what fts does is a breadth first scanning, e.g. it visits all depth 0
> entires then all depth 1 entries and so on.
>   if -R is specified, for each depth 0 entry, after fts visited all its
> depth 1 entries, it will visit every deeper entries till deepest.
>
> Sincerely,
> Kai
>
>
> 2013/10/5 Tejas Nadkarni <tnadkarn at stevens.edu>
>
>>  Jan/All,
>>
>> Some quick questions:
>>
>> - How important is variable column width that's dynamic to the content
>> like the system 'ls' implementation does - this is specific to the -l
>> longformat. Is this required and will points be deducted? Mine uses fixed
>> widths which work for nearly every condition but obviously large file sizes
>> will throw it off. Want to check before I invest more time in it
>>
>> - What is the point of the '-d' flag? When I tried it on the system 'ls'
>> it seems to just print out whatever the full pathname of the argument was?
>> i.e. "ls -d /" will just print "/" or "ls -d" will just print "." or "ls -d
>> ~/" will print the full path of my home directory. Using the -l flag just
>> shows the info of that one entry. It's not clear if all we're doing is
>> printing out the path or cwd and exiting?
>>
>> - the extra credit to implement -c that's for ls with the short format
>> right? i.e. not -l because we have to multi-column output for '-l' already.
>> I'm assuming then that -c is only valid without -l
>>
>> - For the -R recursive flag, my functionality works great but the output
>> is not similar to system ls. It's not clear if our output has to match the
>> system implementation. In the system implementation, each directory is
>> printed out then there's a break then the next directory path then it's
>> contents, etc. Does our implementation have to match? I'm using FTS and the
>> way it traverses the directory structure makes printing it out as the
>> system ls does a bit challenging. Currently mine just prints out the
>> files/directories as it traverses based on sort. Any thoughts?
>>
>> Thanks,
>> Tejas
>>
>>
>> _______________________________________________
>> cs631apue mailing list
>> cs631apue at lists.stevens.edu
>> https://lists.stevens.edu/mailman/listinfo/cs631apue
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20131005/ebc2f8bf/attachment.html>


More information about the cs631apue mailing list