Be sure you have read Chapter 6.
Answer the following questions. You may write out your answers by hand or using a word processor or other program, but please submit hard copy, either in class or in my mailbox in the department office.
(Optional) Do the following programming problems. You will end up with at least one code file per problem. Submit your program source (and any other needed files) by sending mail to bmassing@cs.trinity.edu, with each file as an attachment. Please use a subject line that mentions the course number and the assignment (e.g., ``csci 4320 homework 6''). You can develop your programs on any system that provides the needed functionality, but I will test them on one of the department's Fedora Core 4 Linux machines, so you should probably make sure they work in that environment before turning them in.
[bmassing@Xena02]$ ./filesizes /var/www 512 20
Unable to open /var/www/HTML-Documents/howland-cousins/config: Permission denied
Unable to open /var/www/HTML-Documents/About/The_Courses/cs3394.hci/dcernose/javapres/turnin/COM: Permission denied
Unable to open /var/www/HTML-Documents/About/The_Courses/cs3291.java/dcernose/javapres/turnin/COM: Permission denied
Unable to open /var/www/HTML-Documents/cs1300/config: Permission denied
Unable to open /var/www/HTML-Documents/apache-documentation/manual/search: Permission denied
Unable to open /var/www/HTML-Documents/TUSSW/config: Permission denied
Unable to open /var/www/HTML-Documents/TUSSW/magpierss-0.61: Permission denied
Results for directory /var/www:
2870 files of size 1 blocks
833 files of size 2 blocks
1231 files of size 3 blocks
1310 files of size 4 blocks
7300 files of size 5 blocks
9882 files of size 6 blocks
5870 files of size 7 blocks
3888 files of size 8 blocks
1847 files of size 9 blocks
1049 files of size 10 blocks
1663 files of size 11 blocks
745 files of size 12 blocks
469 files of size 13 blocks
697 files of size 14 blocks
554 files of size 15 blocks
545 files of size 16 blocks
469 files of size 17 blocks
322 files of size 18 blocks
345 files of size 19 blocks
291 files of size 20 blocks
6917 files of size 21 blocks or more
(Of course, you won't be able to examine files in directories you
don't have access to. That's okay; just print error messages as above.)
Hints: Read the man pages for opendir, readdir, and lstat. You might also be interested in the man pages for chdir and strerror.