[cs631apue] Long Print Total

Timothy Wang twang77 at stevens.edu
Thu Sep 30 13:34:07 EDT 2021


Hi Everyone,

I’m starting the implementation of long print for ls and wondering if anybody can help me out with a part of the logic. An example call is:
apue$ ls -l
total 624
-rw-------  1 twang77  users     147 Sep 19 21:38 Makefile
…

I notice that the total block sizes come first in the output. Is there any way to get the directory size directly through fts_open or will I have to traverse all files via fts_read and get the size via stat? My concern is getting the size via stat will require me to keep hold of each ftsent*, get a total of all sizes, print the total, and then finally print each ftsent* information.

Thanks,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20210930/53d812aa/attachment.html>


More information about the cs631apue mailing list