CSc265 -- Exercise 5

DUE: midnight, Tuesday 3 December 1996


Overview

Write the Perl program treeBrowse to provide a better browser for Unix directory trees than the standard one: ls, cd, and vi. Your Perl prgram will recursively traverse a directory tree and produce a new tree suitable for browsing with Netscape.

Preparing for the Assignment

The directory /home/csc265/Exercises/Ex5 contains:
	d/      d.treeBrowse     d.html

	kwic/   kwic.treeBrowse  kwic.html
Begin by making a copy of the Ex5/ directory.

Study d.html and all the files in d.treeBrowse/ and d/. Then open d.html using Netscape (File|Open File...). Select every HTML link. Continue studying these files until you thoroughly understand the relationship between the source tree (d/), and the generated tree (d.treeBrowse/) and its index (d.html).

Then use Netscape to open kwic.html and open a sample of the HTML links.

The Desired Task

Your job is to write treeBrowse, a Perl program that generates, for example, d.html and d.treeBrowse/ from d/. Invoking
	treeBrowse x
must generate
x.html
an HTML file that mimics the structure of x. There must be one line in x.html for each file F in x. Indenting must be used to show the directory structure. If F is not a directory, then F's line must be an HTML link to a file in x.treeBrowse.
x.treeBrowse/
a directory tree identical to x/ with one exception. For each file F ending in .c or .h:
Test your program on Ex5/d/ and Ex5/kwic/. Your version of treeBrowse should produce exactly the same results as those shown in Ex5/. Verify that this is so with
	diff yourEx5/d.html ~csc465/Exercises/Ex5/d.html

	diff -r yourEx5/d.treeBrowse ~csc465/Exercises/Ex5/d.treeBrowse

	diff yourEx5/kwic.html ~csc465/Exercises/Ex5/kwic.html

	diff -r yourEx5/kwic.treeBrowse ~csc465/Exercises/Ex5/kwic.treeBrowse
There should be no differences.

Submitting Your Solutions

Make sure that the names of your team members and the lab section which you attend appears in the comment at the beginning of the treeBrowse file. Then submit your treeBrowse program to csc265 using a command like the following:
	% mail -s 'Exercise 5 submission' csc265@gulf < treeBrowse

Grading Criteria

As always, you may submit the assignment only once because only the first submission will be graded.