CSCI212 Assignment 1

This assignment is concerned with the writing of a program which provides a statistical report of the process table as reported by the ls() command. The command, ls() is a command to list files in Unix and Unix-liked operating systems. It is an abbreviation of list segments and specified by POSIX specification. You will be writing a filter to take input from the command and process it to yield a report.

In order to do this assignment, you will need the knowledge of ls(), pipelines in Unix and processes. Finally, you need C++ programming knowledge.

About ls() command

Before you start the coding, you need to understand the problem well. In this case, we need to study about ls() command. When a user execute this command, the system will reply in following format.

drwxr-xr-x 4 user1 root 4096 2007-09-30 17:17 .
drwxr-xr-x 4 user1 root 4096 2007-09-30 16:09 ..
-rwxr--r-- 1 user1 root    0 2007-09-30 08:26 fish
-rwxr--r-- 1 user1 root   26 2007-09-30 08:16 foobar

The output is broken down into columns, which maps to the column fields as indicated:


There are 8 parameters in total (permission, directories, owner, group, size, date, time, filename).  For details of each parameters, you may check in your terminal by "man ls" or website.

Pipeline

Using the output of the command ls(), the program should read the output as standard input. In another words, the program is to behave as if it were part of the pipeline. Typical execution would be

ls -al | a.out or ls -al | sort | ./a.out (if you prefer to sort them)

where a.out is your executable program which will take in the std::out of ls() command as std::in of your program.


No comments:

Post a Comment