Be sure you have read (or at least skimmed) 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.
Do as many of the following programming problems as you like (none, all, or some). 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 5''). You can develop your programs on any system that provides the needed functionality (something UNIX-like), but I will test them on one of the department's Fedora Core 5 Linux machines, so you should probably make sure they work in that environment before turning them in.
Results for directory /lib with blocksize 512: 157 files of size 1 blocks 87 files of size 2 blocks 69 files of size 3 blocks 113 files of size 4 blocks 38 files of size 5 blocks 26 files of size 6 blocks 33 files of size 7 blocks 24 files of size 8 blocks 19 files of size 9 blocks 21 files of size 10 blocks 14 files of size 11 blocks 27 files of size 12 blocks 18 files of size 13 blocks 8 files of size 14 blocks 34 files of size 15 blocks 92 files of size 16 blocks 102 files of size 17 blocks 59 files of size 18 blocks 61 files of size 19 blocks 69 files of size 20 blocks 2342 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. It's okay in to just print error messages for files/directories you can't access.)
To get maximum points, your program should be in C or C++ and make no use of system commands such as ls. (You can use another language, or even write a shell script, but you will get fewer points.) Library functions opendir, readdir, and lstat will probably be helpful. You might also be interested in functions chdir and strerror. These functions are described by man pages. (Remember also that man -a foo gives all man pages for foo. This can be helpful if there is both a command foo and a functionfoo.)
Broken symbolic links in /users/bmassing/Local/HTML-Documents/CS4320/Homeworks/HW05/Problems: /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/barfoo /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/foobar
(Again, you won't be able to examine files in directories you don't have access to, so just print error messages. You should be able to access everything in the above directory, however. If you want to create some test data of your own, remember that to make a symbolic link called sym pointing to foo, you type ln -s foo sym.)
To get maximum points, your program should be in C or C++ and make no use of system commands such as ls. (You can use another language, or even write a shell script, but you will get fewer points.) The library routines mentioned for the previous problem may be helpful.
Files with multiple hard links in /users/bmassing/Local/HTML-Documents/CS4320/Homeworks/HW05/Problems: /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/homework/index.html /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/homework/homework.html /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/bbbb /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/bbb /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/b /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/bb /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/dd /users/bmassing/Local/HTML-Documents/Classes/CS4320_2006fall/Homeworks/HW05/Problems/TestData/d
This output means that the two pathnames in the first group reference the same file, the four pathnames in the second group reference the same file, etc. Output can be in any order as long as paths that reference the same file are grouped together. (Again, you won't be able to examine files in directories you don't have access to, so just print error messages. You should be able to access everything in the above directory, however. If you want to create some test data of your own, remember that to make a hard link called sym pointing to foo, you type ln foo sym.)
To get maximum points, your program should be in C or C++ and make no use of system commands such as ls. (You can use another language, or even write a shell script, but you will get fewer points.) The library routines mentioned for the previous problems may be helpful.