Make me a program that counts directory structures.
1 - prints every full pathname
1 - prints a [f] or a [d] or [l] next to the path depending on type
1 - prints the file size for every file (see stat or fstat)
1 - prints where the link goes for every link (see readlink)
1 - does not go into an infinite loop even if the diretcory structure has loops
1 - Uses both 'auto' and 'assert' (remember to #include )
1 - You can add up every directory and tell me the total space used.
1 - Shows permissions (rwx) for each file
-1 - Each work day day after Mon Oct 25 (max -3)
(Out of 7, so you can skip one of these)

There are soft links. Soft links are read using readlink. See https://linux.die.net/man/2/readlink.

You may assume that no path exceeds 2048 bytes long.

Calling readdir on a link will fail. Use readlink.

Do NOT recurse on the directory entries "." and "..".

My program that does all but the last two and is 57 lines of code.

There are test directories at /home/rappleto/pub/Classes/CS426/Assignments/dircount-assignment.
You might run it like this:
  ./dircount /home/rappleto/pub/Classes/CS426/Assignments/dircount-assignment/test1

test1 - has a single, empty file.
test2 - has a subdir that has a file within it.
test3 -- Has some links that are the same file.
test4 -- Has a loop for directory soft links.
test5 -- Has a soft links that points to a normal file.
test6 -- Has a link the loops back, and several files scattered around.

As of this writing, here are the correct answers.  (Don't be surprised if something changes, especially file sizes.)

./test2/subdir/.. (d)
./test2/subdir/file (f,4399)
./test2/subdir/. (d)
./test2/subdir (d)
./test2/.. (d)
./test2/. (d)
./test2 (d)
./test1/.. (d)
./test1/file (f,0)
./test1/. (d)
./test1 (d)
./test3/link (l,->link)
./test3/subdir/link (l,->..)
./test3/subdir/.. (d)
./test3/subdir/. (d)
./test3/subdir (d)
./test3/.. (d)
./test3/. (d)
./test3 (d)
./test6/a/b/.. (d)
./test6/a/b/. (d)
./test6/a/b/c/file3 (f,2444)
./test6/a/b/c/.. (d)
./test6/a/b/c/. (d)
./test6/a/b/c/d/.. (d)
./test6/a/b/c/d/. (d)
./test6/a/b/c/d/e/f/link-back (l,->../../../../../../a)
./test6/a/b/c/d/e/f/.. (d)
./test6/a/b/c/d/e/f/. (d)
./test6/a/b/c/d/e/f (d)
./test6/a/b/c/d/e/.. (d)
./test6/a/b/c/d/e/. (d)
./test6/a/b/c/d/e (d)
./test6/a/b/c/d (d)
./test6/a/b/c (d)
./test6/a/b/file2 (f,1)
./test6/a/b (d)
./test6/a/.. (d)
./test6/a/file (f,1)
./test6/a/. (d)
./test6/a (d)
./test6/.. (d)
./test6/file (f,1)
./test6/. (d)
./test6 (d)
./.. (d)
./test5/link (l,->file.txt)
./test5/.. (d)
./test5/. (d)
./test5/file.txt (f,3802)
./test5 (d)
./dircount-assignment.html (f,1287)
./. (d)
./test4/.. (d)
./test4/subdirectory (l,->subdirectory)
./test4/. (d)
./test4 (d)
./dircount.cc (f,1185)
./a.out (f,19408)