CS631 -- Advanced Programming in the UNIX Environment - Midterm Assignment

Midterm Assignment: Implement ls(1)

Summary

The objective of this assignment is for you to write a significant system tool from scratch. In doing so, you will learn many details of the UNIX filesystem and the general system concepts we have covered in class.

Problem assignment

Implement the ls(1) command as described in the manual page provided to you here.

Please note that this manual page describes a subset of the options available on most systems, so please make sure to consult only this page as reference.

Your program must follow the general homework guidelines.

Your code should be easily readable and contain comments where necessary. You should look at this file for examples of good coding style. Follow these guidelines! As before, correct functionality of your program is a necessary, but not sufficient pre-condition for a good grade. Some of the tests your command needs to pass are those shown in this file; you may want to use this script to create a test directory with a number of files that may tickle edge cases.

Deliverables and Due Date

Snapshot

You must submit a compilable and working snapshot of your project by 2018-10-01, at 16:00. By then, you should have implemented some basic functionality and some of the command-line options. It does not need to work without errors or bugs, but it shouldn't segfault either; it should just show that you are making progress. Failure to submit the snapshot on time will result in a 10% deduction from the grade for the midterm project.

Final submission

Splitting your code into multiple .c files is mandatory in this assignment. Please make sure to separate functionality in a meaningful way as well as to make proper use of header files.

The use of git as a code revision tool is mandatory in this assignment. Please make sure to regularly and frequently commit your code changes using meaningful commit messages and to include in your submission the output of the git log command.

You will submit a single tar archive named username-midterm.tar (where "username" is your Stevens username) that will extract into a directory named after your username. In that directory will be multiple .c files, a Makefile, your README, as well as your usual checklist.

For example, I would submit the file jschauma-midterm.tar by creating everything like this:

$ mkdir $USER
$ cd $USER
$ ls
Makefile        checklist       ls.c      print.c
README          cmp.c           ls.h      print.h
$ git log > LOG
$ cd ..
$ tar cf ${USER}-midterm.tar ${USER}
	

The due date for this assignment is 2018-10-15 16:00. Please attach the file to an email sent from your @stevens.edu email address to jschauma@stevens.edu with a subject of "[CS631] midterm".

Extra Credit

For 10 extra credit points, implement the "-C" option ("Force multi-column output; this is the default when output is to a terminal."), which nicely formats the output similar to the way the OS provided version of ls(1) does.

For 5 extra credit points, implement the "-x" option ("The same as -C, except that the multi-column output is produced with entries sorted across, rather than down, the columns.").

Both of these options take the COLUMNS environment variable into account.


[Course Website]