<div dir="ltr">Thanks for the response.<div><br></div><div>I&#39;m working on the formatting but I wanted to leave that as the last thing and focus on all the functionality first. Again 9/10 times it&#39;s fine it&#39;s that 1 other time that I need to fix. <br>
<div><br></div><div>The -d example you gave makes more sense as a use case and I see the differences.</div><div><br></div><div>On the recursive, the latter output is what mine does which is the problem. I think it&#39;s because I&#39;m purely using fts_read in my program and haven&#39;t used fts_children. I can see how using fts_children could allow the output to be formatted that way since you&#39;re reading one directory at a time where as with fts_read you&#39;re reading the hierarchy as it traverses. I&#39;ll have to redo some of my code and approach to handle being able to output correctly.</div>

<div><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Oct 5, 2013 at 2:17 PM, Jan Schaumann <span dir="ltr">&lt;<a href="mailto:jschauma@stevens.edu" target="_blank">jschauma@stevens.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Tejas Nadkarni &lt;<a href="mailto:tnadkarn@stevens.edu" target="_blank">tnadkarn@stevens.edu</a>&gt; wrote:<br>
<br>
&gt; - How important is variable column width that&#39;s dynamic to the content like<br>
&gt; the system &#39;ls&#39; implementation does - this is specific to the -l<br>
&gt; longformat. Is this required and will points be deducted? Mine uses fixed<br>
&gt; widths which work for nearly every condition but obviously large file sizes<br>
&gt; will throw it off. Want to check before I invest more time in it<br>
<br>
</div>It&#39;s not functionally crucial, but you should try to make an effort to<br>
handle this.<br>
<br>
As noted before, we are writing system tools conceptually suitable for<br>
inclusion in the OS as a core component.  If you used the command<br>
provided by the system, and it garbled the output or took obvious short<br>
cuts, you&#39;d likely think less of the system.  Formatting etc. tends to<br>
reflect on the overall care paid to the program.<br>
<div><br>
&gt; - What is the point of the &#39;-d&#39; flag?<br>
<br>
</div>The &#39;-d&#39; flag is useful when you want to display certain entries without<br>
recursing into them should they happen to be directories.  Suppose you<br>
want to get the long listing information of all entries starting with<br>
the letter &#39;b&#39; under &#39;/&#39;:<br>
<br>
ls -l /b*<br>
<br>
will open the /bin directory and instead give you the information about<br>
the files in that directory.<br>
<br>
ls -ld /b*<br>
<br>
will do the right thing.<br>
<div><br>
<br>
&gt; It&#39;s not clear if all we&#39;re doing is printing out the path or cwd and<br>
&gt; exiting?<br>
<br>
</div>You should, as the manual page states, list directories encountered as<br>
plain files (and not list their contents, as you would without the &#39;-d&#39;<br>
flag) and not follow symbolic links given as arguments.<br>
<br>
ln -s / foo<br>
ls foo<br>
ls -ld foo<br>
ls -d foo<br>
<div><br>
&gt; - the extra credit to implement -c that&#39;s for ls with the short format<br>
&gt; right? i.e. not -l because we have to multi-column output for &#39;-l&#39; already.<br>
&gt; I&#39;m assuming then that -c is only valid without -l<br>
<br>
</div>Correct.  &#39;-c&#39; changes the default output format of your program from<br>
&#39;-1&#39; to match that of the system provided ls(1).<br>
<div><br>
<br>
&gt; Currently mine just prints out the files/directories as it traverses<br>
&gt; based on sort. Any thoughts?<br>
<br>
</div>I&#39;m not sure I understand your question correctly, but: Your program<br>
needs to show the user which files belong to which directory.  That is,<br>
a single list of all files without any indication of what subdirectory<br>
they were found in would not be reasonable.<br>
<br>
For example:<br>
<br>
mkdir -p dir/subdir/subsubdir<br>
touch dir/file dir/subdir/file dir/subdir/subsubdir/file<br>
ls -R<br>
.:<br>
dir<br>
<br>
./dir:<br>
file  subdir<br>
<br>
./dir/subdir:<br>
file  subsubdir<br>
<br>
./dir/subdir/subsubdir:<br>
file<br>
<br>
<br>
allows the user to see which files exist where.  If you printed<br>
<br>
ls -R<br>
dir<br>
file  subdir<br>
file  subsubdir<br>
file<br>
<br>
then it would be confusing for the user to figure out which &#39;file&#39;<br>
resides where.<br>
<br>
<br>
If you meant something else, perhaps show examples of your program&#39;s<br>
output versus the system command&#39;s.<br>
<span><font color="#888888"><br>
-Jan<br>
</font></span><div><div>_______________________________________________<br>
cs631apue mailing list<br>
<a href="mailto:cs631apue@lists.stevens.edu" target="_blank">cs631apue@lists.stevens.edu</a><br>
<a href="https://lists.stevens.edu/mailman/listinfo/cs631apue" target="_blank">https://lists.stevens.edu/mailman/listinfo/cs631apue</a><br>
</div></div></blockquote></div><br></div></div></div></div>