<div dir="ltr">Thanks for clarifying NetBSD vs. Unix.<div><br></div><div>I have verified the function is being executed, but I just found some more interesting behavior. I stuck a print statement in the block where it compares filesizes, and the output is interesting.</div><div><br></div><div>On NetBSD:</div><div><div>Comparing .test: 3 and print.o: 11496</div><div>Comparing helpers.c: 1846 and .test: 3</div><div>Comparing sort.o: 3720 and .test: 3</div><div>Comparing include: 4096 and .test: 3</div><div>Comparing GNUmakefile: 566 and .test: 3</div><div>Comparing helpers.o: 3968 and .test: 3</div><div>Comparing print_recurse.c: 1494 and .test: 3</div><div>Comparing ls: 22842 and .test: 3</div><div>Comparing print_recurse.o: 2848 and .test: 3</div><div>Comparing print_dir.o: 3256 and .test: 3</div><div>Comparing ls.o: 7504 and .test: 3</div><div>Comparing print.c: 7045 and .test: 3</div><div>Comparing sort.c: 6206 and .test: 3</div><div>Comparing ls.c: 3283 and .test: 3</div><div>Comparing print_dir.c: 1672 and .test: 3</div><div>Comparing README: 1392 and .test: 3</div><div>Comparing Makefile: 546 and .test: 3</div><div>Comparing print.o: 11496 and .test: 3</div></div><div><br></div><div>On Linux:</div><div><snip></div><div><div>Comparing include: 4096 and helpers.o: 4152</div><div>Comparing include: 4096 and print_recurse.o: 3112</div><div>Comparing print_dir.o: 3664 and print_recurse.o: 3112</div><div>Comparing helpers.c: 1846 and print_recurse.o: 3112</div><div>Comparing helpers.c: 1846 and print_recurse.c: 1494</div><div>Comparing .test: 3 and ls.o: 7888</div><div>Comparing print.c: 7045 and sort.c: 6206</div><div>Comparing ls.o: 7888 and print.c: 7045</div><div>Comparing .test: 3 and print.c: 7045</div><div>Comparing .test: 3 and sort.c: 6206</div><div>Comparing ls.c: 3283 and print_dir.c: 1672</div><div>Comparing Makefile: 546 and print.o: 12800</div><div>Comparing README: 1392 and print.o: 12800</div><div>Comparing README: 1392 and Makefile: 546</div><div>Comparing ls.c: 3283 and print.o: 12800</div><div>Comparing ls.c: 3283 and README: 1392</div><div>Comparing print_dir.c: 1672 and README: 1392</div></div><div><snip></div><div><br></div><div>So now it's clear why it's not sorting properly. On NetBSD the size is always being compared to 3, the size of the test 'hidden' file. But I have no idea why...</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 29, 2017 at 12:17 PM Jan Schaumann <<a href="mailto:jschauma@stevens.edu">jschauma@stevens.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Jason Ajmo <<a href="mailto:jajmo@stevens.edu" target="_blank">jajmo@stevens.edu</a>> wrote:<br>
> Code: <a href="https://gist.github.com/jajmo/5e4e7827fd5b52549132a6a6364c4e53" rel="noreferrer" target="_blank">https://gist.github.com/jajmo/5e4e7827fd5b52549132a6a6364c4e53</a><br>
> The following are sorted based on filesize, descending (ls -lS)<br>
> On Linux, the objects are linked with -lbsd, and include bsd/bsd.h.<br>
><br>
> Output on Unix:<br>
<br>
I think you mean 'NetBSD', which is a Unix-like OS.<br>
<a href="https://en.wikipedia.org/wiki/Unix-like" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/Unix-like</a><br>
<br>
> [vagrant@vagrant midterm]$ ./ls -lS<br>
> total 216<br>
> -rw-r--r-- 1 vagrant 1000 1846 Sep 28 16:29 helpers.c<br>
> -rw-r--r-- 1 vagrant 1000 3376 Sep 29 15:59 sort.o<br>
<br>
Weird. Looks like no sorting is taking place at all. Have you<br>
confirmed that the code block you think is being executed is in fact<br>
being executed?<br>
<br>
-Jan<br>
_______________________________________________<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" rel="noreferrer" target="_blank">https://lists.stevens.edu/mailman/listinfo/cs631apue</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Jason Ajmo</div><div>Stevens Institute of Technology</div><div>B.S. Cybersecurity '17</div><div>M.S. Computer Science '18</div><div>0x56FA3123</div></div></div>