next up previous
Next: Discussion Up: base.html Previous: base.html  

Description of the problem

This assignment is to implement an interactive version of the KWIC index system (described in Parnas's On the Criteria To Be Used in Decomposing Systems into Modules) in the Pipe-Filter paradigm. You will be provided with two implementations of the KWIC system - one in Unix shell commands and one in C. You will be asked to extend these implementations with new functionality.

Both versions of the current system accept input at the command line and produce output to the terminal screen. Both versions implement a pipe and filter system that shifts and sorts the input, and then transforms to upper case letters the first word in each line (look at the first example on subsequent pages).

You will be provided with the source code for these systems, as well as source code for two utility programs, diverge and converge - one to split an input stream and one to join two input streams.

The source code for the current system will be made available in the directory ``/afs/cs/academic/class/15675/C++/a1".

Your assignment is to modify the existing code to support the following changes:

  1. Extend the shell script version of the system to produce a KWIC index of the login and user names of all users currently logged on a system. Hint: look at finger and cut and tail.
  2. Do the same with the C language implementation.
  3. Modify the shell script version of the system to produce a KWIC listing that contains no duplicate entries. Hint: look at uniq.
  4. Modify the C language version of the system to produce a KWIC index in which the login names of users appear as separate entries from the users' real names. Define a set of ``trivial" login names to contain ``john",``smith", ``david" and your own login name. In the final output, only nontrivial login names should appear, and only the first and last name of each real user name should appear. (i.e remove middle initials or middle names). Hint: Use the diverge and converge programs provided. You might find the C function ``nxtarg" useful for some of the C functions you will have to write, or look into diverge.c to see how parsing words is easily done.

Here are sample outputs for the solution to each part of the problem:
(The finger part is a real snapshot of some machine, therefore the choice
of names has no deep meaning)

% solution1.csh and solution2
BENNETT jcrb John C R
C R Bennett jcrb John
CERIA santi Santiago
DAFNA Talmor tdafna
DAFNA Talmor tdafna
EHT Eric Thayer
ERIC Thayer eht
GALMES pepe Jose M
JCRB John C R Bennett
JOHN C R Bennett jcrb
JOSE M Galmes pepe
M Galmes pepe Jose
PEPE Jose M Galmes
R Bennett jcrb John C
SANTI Santiago Ceria
SANTIAGO Ceria santi
TALMOR tdafna Dafna
TALMOR tdafna Dafna
TDAFNA Dafna Talmor
TDAFNA Dafna Talmor
THAYER eht Eric
 
% solution3.csh
BENNETT jcrb John C R
C R Bennett jcrb John
CERIA santi Santiago
DAFNA Talmor tdafna
EHT Eric Thayer
ERIC Thayer eht
GALMES pepe Jose M
JCRB John C R Bennett
JOHN C R Bennett jcrb
JOSE M Galmes pepe
M Galmes pepe Jose
PEPE Jose M Galmes
R Bennett jcrb John C
SANTI Santiago Ceria
SANTIAGO Ceria santi
TALMOR tdafna Dafna
TDAFNA Dafna Talmor
THAYER eht Eric

Remark: TRIVIAL_NAMES = {'tdafna','john','smith','david'}
% solution4
Bennett John
Ceria Santiago
Dafna Talmor
Dafna Talmor
eht
Eric Thayer
Galmes Jose
jcrb
John Bennett
Jose Galmes
pepe
santi
Santiago Ceria
Talmor Dafna
Talmor Dafna
Thayer Eric


next up previous
Next: Discussion Up: base.html Previous: base.html

TOM Conversion
Wed Feb 5 18:30:25 EST 1997