time due | submission file |
---|---|
12:45 PM Tuesday 7 February, 2005 | csci/331/HW1/dcflist.c |
This homework is due at 1:45 PM, the beginning of class, on Tuesday, 7 February, 2005. You turn the program in by copying it to the file csci/331/HW1/dcflist.c within your home directory on busbee.cs.unca.edu, the UNCA Computer Science server.
The Department requires an SSH-enabled FTP for the transfer. If you need help doing this from a Windows computer, look at Section 5 of the UNCA CSCI 107 lab on files and directories.
Start by reading Sections 1, 2, 3.1, and 3.2 (pages 1 to 10) of version 1.0 of the Design for Camera File system specification of JEITA, the Japan Electronics and Information Technolgy Industries Association. This is a some dated version of the specification used to store files in digital cameras. Pay particular attention to sections 3.1 and 3.2.
A significant "real world" component of this exercise is make sure you can work from published standards. You should be able to understand the first 10 pages of this document without assistence.
Your assignment is to write a program that opens a DCF image root directory (which must be named DCIM) that is a subdirectory of the current directory and gives a nicely formatted printing of the DCF directories and objects contained within the DCF image root directory. The output of your program should organize DCF directories by the "directory number", as defined in section 3.1.2 of the specification number, and should organize DCF files by "file number", as defined in section 3.2.1.
You should write this program in C using the standard
Linix-based API. This means using routines like opendir
and readdir
or even scandir
, though it's
not a POSIX routine.
This 96 kbyte ZIP file creates the directory I used in my solution, and this 2 kbyte file is the result of running my solution on this directory.
My solution contain has 76 lines used as shown in the following table.
#include "statements" | 4 lines | |
istable11char |
C function to test if character is in Table 1.1 | 3 lines |
gooddir |
C function to test if directory name meets DCF rules | 12 lines |
goodfile |
C function to test if file name meets DCF rules | 20 lines |
objectsort |
C function to compare DCF filenames by DCF object name "field"
(written for use with quicksort or scandir )
|
10 lines |
main |
Two nested loops to do the work | 22 lines |
blank lines | 7 lines | |
lines of comments | 0 lines |
The gooddir
and goodfile
routines are
unexpectedly long because they contain no loops. They have a lot
of mindless cut-and-paste replication of code.
Your solution should have many more lines of comments.